Created
July 5, 2013 17:10
-
-
Save trishagee/5935911 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 MongoClientURITest { | |
@Test() | |
public void testWriteConcern() { | |
MongoClientURI uri = new MongoClientURI("mongodb://localhost"); | |
assertEquals(WriteConcern.ACKNOWLEDGED, uri.getOptions().getWriteConcern()); | |
uri = new MongoClientURI("mongodb://localhost/?wTimeout=5"); | |
assertEquals(new WriteConcern(1, 5, false, false), uri.getOptions().getWriteConcern()); | |
uri = new MongoClientURI("mongodb://localhost/?fsync=true"); | |
assertEquals(new WriteConcern(1, 0, true, false), uri.getOptions().getWriteConcern()); | |
uri = new MongoClientURI("mongodb://localhost/?j=true"); | |
assertEquals(new WriteConcern(1, 0, false, true), uri.getOptions().getWriteConcern()); | |
uri = new MongoClientURI("mongodb://localhost/?w=2&wtimeout=5&fsync=true&j=true"); | |
assertEquals(new WriteConcern(2, 5, true, true), uri.getOptions().getWriteConcern()); | |
uri = new MongoClientURI("mongodb://localhost/?w=majority&wtimeout=5&fsync=true&j=true"); | |
assertEquals(new WriteConcern("majority", 5, true, true), uri.getOptions().getWriteConcern()); | |
uri = new MongoClientURI("mongodb://localhost/?safe=true"); | |
assertEquals(WriteConcern.ACKNOWLEDGED, uri.getOptions().getWriteConcern()); | |
uri = new MongoClientURI("mongodb://localhost/?safe=false"); | |
assertEquals(WriteConcern.UNACKNOWLEDGED, uri.getOptions().getWriteConcern()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment