Map<String, Client> clients = (Map<String, Client>) em.getDelegate();
MongoDBClient client = (MongoDBClient) clients.get(persistenceUnit);
// Check default values
WriteConcern wc = client.getWriteConcern();
DBEncoder encoder = client.getEncoder();
Assert.assertNotNull(wc);
Assert.assertFalse(wc.getFsync());
Assert.assertEquals(0, wc.getW());
Assert.assertEquals(0, wc.getWtimeout());
Assert.assertNotNull(encoder);
Assert.assertTrue(encoder instanceof DefaultDBEncoder);
// Set parameters into EM
// (See http://api.mongodb.org/java/2.6/com/mongodb/WriteConcern.html)
WriteConcern wcNew = new WriteConcern(1, 300, true);
DBEncoder encoderNew = new LazyDBEncoder();
em.setProperty(MongoDBClientProperties.WRITE_CONCERN, wcNew);
em.setProperty(MongoDBClientProperties.BATCH_SIZE, 5);
// Check Modified values
WriteConcern wcModified = client.getWriteConcern();
DBEncoder encoderModified = client.getEncoder();
Assert.assertNotNull(wcModified);
Assert.assertTrue(wcModified.getFsync());
Assert.assertEquals(1, wcModified.getW());
Assert.assertEquals(300, wcModified.getWtimeout());
Assert.assertNotNull(encoderModified);