<commit_before>/*
 * Hibernate OGM, Domain model persistence for NoSQL datastores
 *
 * License: GNU Lesser General Public License (LGPL), version 2.1 or later
 * See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
 */
package org.hibernate.ogm.datastore.neo4j.test.remote;

import static org.fest.assertions.Assertions.assertThat;
import static org.junit.Assert.fail;

import java.util.Properties;

import org.hibernate.HibernateException;
import org.hibernate.ogm.cfg.OgmProperties;
import org.hibernate.ogm.datastore.neo4j.remote.impl.RemoteNeo4jDatastoreProvider;
import org.hibernate.ogm.utils.GridDialectType;
import org.hibernate.ogm.utils.SkipByGridDialect;
import org.hibernate.ogm.utils.SkippableTestRunner;
import org.junit.Test;
import org.junit.runner.RunWith;

/**
 * Neo4j remote should throw proper exceptions when the credentials for authentication are wrong.
 *
 * @author <NAME>
 */
@RunWith(SkippableTestRunner.class)
@SkipByGridDialect(value = { GridDialectType.NEO4J }, comment = "We need a remote server")
public class RemoteAuthenticationFailureTest {

	@Test
	public void testAuthenticationFailureAtStartUp() throws Exception {
		Properties properties = new Properties();
		properties.setProperty( OgmProperties.USERNAME, "completely wrong" );
		properties.setProperty( OgmProperties.PASSWORD, "<PASSWORD>" );
		RemoteNeo4jDatastoreProvider remoteDatastoreProvider = new RemoteNeo4jDatastoreProvider();
		remoteDatastoreProvider.configure( properties );
		try {
			remoteDatastoreProvider.start();
			fail( "Credentials should be invalid" );
		}
		catch (HibernateException e) {
			// Unable to start datastore provider
			assertThat( e.getMessage() ).startsWith( "OGM000071" );
			assertThat( e.getCause().getMessage() ).startsWith( "OGM001419" );
		}
		finally {
			remoteDatastoreProvider.stop();
		}
	}
}
<commit_msg>OGM-1012 Make sure that RemoteAuthenticationFailureTest uses the right HOST<commit_after>/*
 * Hibernate OGM, Domain model persistence for NoSQL datastores
 *
 * License: GNU Lesser General Public License (LGPL), version 2.1 or later
 * See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
 */
package org.hibernate.ogm.datastore.neo4j.test.remote;

import static org.fest.assertions.Assertions.assertThat;
import static org.junit.Assert.fail;

import java.util.Properties;

import org.hibernate.HibernateException;
import org.hibernate.ogm.cfg.OgmProperties;
import org.hibernate.ogm.datastore.neo4j.remote.impl.RemoteNeo4jDatastoreProvider;
import org.hibernate.ogm.utils.GridDialectType;
import org.hibernate.ogm.utils.SkipByGridDialect;
import org.hibernate.ogm.utils.SkippableTestRunner;
import org.junit.Test;
import org.junit.runner.RunWith;

/**
 * Neo4j remote should throw proper exceptions when the credentials for authentication are wrong.
 *
 * @author <NAME>
 */
@RunWith(SkippableTestRunner.class)
@SkipByGridDialect(value = { GridDialectType.NEO4J }, comment = "We need a remote server")
public class RemoteAuthenticationFailureTest {

	@Test
	public void testAuthenticationFailureAtStartUp() throws Exception {
		Properties properties = new Properties();
		// Set by Neo4jTestHelper
		properties.setProperty( OgmProperties.HOST, System.getProperties().getProperty( OgmProperties.HOST ) );
		properties.setProperty( OgmProperties.PORT, System.getProperties().getProperty( OgmProperties.PORT ) );
		properties.setProperty( OgmProperties.USERNAME, "completely wrong" );
		properties.setProperty( OgmProperties.PASSWORD, "<PASSWORD>" );
		RemoteNeo4jDatastoreProvider remoteDatastoreProvider = new RemoteNeo4jDatastoreProvider();
		remoteDatastoreProvider.configure( properties );
		try {
			remoteDatastoreProvider.start();
			fail( "Credentials should be invalid" );
		}
		catch (HibernateException e) {
			// Unable to start datastore provider
			assertThat( e.getMessage() ).startsWith( "OGM000071" );
			assertThat( e.getCause().getMessage() ).startsWith( "OGM001419" );
		}
		finally {
			remoteDatastoreProvider.stop();
		}
	}
}

{'fraction_non_alphanumeric': 0.1053019145802651, 'fraction_numerical': 0.012518409425625921, 'mean_word_length': 5.3473520249221185, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '382260', 'n_tokens_mistral': 1355, 'n_tokens_neox': 1244, 'n_words': 281}