Created
July 25, 2012 17:40
-
-
Save gscheibel/3177456 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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