Skip to content

Instantly share code, notes, and snippets.

@gscheibel
Created July 26, 2012 07:44
Show Gist options
  • Save gscheibel/3180802 to your computer and use it in GitHub Desktop.
Save gscheibel/3180802 to your computer and use it in GitHub Desktop.
public void testConnectionTimeout() {
Map<String, Object> cfg = new HashMap<String, Object>();
cfg.put( Environment.MONGODB_TIMEOUT, "50" );
cfg.put( Environment.MONGODB_HOST, "203.0.113.1" );
cfg.put( Environment.MONGODB_DATABASE, "ogm_test_database" );
MongoDBDatastoreProvider provider = new MongoDBDatastoreProvider();
provider.configure( cfg );
final long start = System.nanoTime();
try {
provider.start();
}
catch(Exception e){
final long end = System.nanoTime();
System.out.println( start );
System.out.println( end );
assertThat( end - 50 ).isGreaterThanOrEqualTo( start );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment