Skip to content

Instantly share code, notes, and snippets.

@gscheibel
Created July 25, 2012 17:40
Show Gist options
  • Save gscheibel/3177456 to your computer and use it in GitHub Desktop.
Save gscheibel/3177456 to your computer and use it in GitHub Desktop.
public class ConnectionConfigurationTest extends OgmTestCase {
@Test
public void testConnectionTimeout() {
final long start = System.currentTimeMillis();
SessionFactoryImplementor factory = super.sfi();
ServiceRegistryImplementor serviceRegistry = factory.getServiceRegistry();
MongoDBDatastoreProvider provider = (MongoDBDatastoreProvider) serviceRegistry.getService( DatastoreProvider.class );
try {
provider.start();
}
finally {
final long end = System.currentTimeMillis();
assertThat( end-50 ).isGreaterThanOrEqualTo( start );
}
}
@Override
protected void configure(Configuration cfg) {
cfg.setProperty( Environment.MONGODB_TIMEOUT, "50" );
cfg.setProperty( Environment.MONGODB_HOST, "203.0.113.1" );
super.configure( cfg );
}
@Override
protected Class<?>[] getAnnotatedClasses() {
return new Class<?>[0];
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment