Map<String, Object> cfg = new HashMap<String, Object>();
cfg.put( MongoDBProperties.TIMEOUT, "30" );
cfg.put( OgmProperties.HOST, NON_EXISTENT_IP );
cfg.put( OgmProperties.DATABASE, "ogm_test_database" );
MongoDBDatastoreProvider provider = new MongoDBDatastoreProvider();
/*
* To be sure, the test passes on slow / busy machines the hole
* operation should not take more than 3 seconds.
*/
final long estimateSpentTime = 3L * 1000L * 1000L * 1000L;
provider.injectServices( getServiceRegistry( cfg ) );
provider.configure( cfg );
Exception exception = null;
final long start = System.nanoTime();
try {
provider.start();
}
catch ( Exception e ) {
exception = e;
assertThat( System.nanoTime() - start ).isLessThanOrEqualTo( estimateSpentTime );
}