File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -262,6 +262,18 @@ public DBCursor addOption( int option ){
262262 return this ;
263263 }
264264
265+ public void setOptions ( int options ){
266+ _options = options ;
267+ }
268+
269+ public void resetOptions (){
270+ _options = 0 ;
271+ }
272+
273+ public int getOptions (){
274+ return _options ;
275+ }
276+
265277 // ---- internal stuff ------
266278
267279 private void _check ()
Original file line number Diff line number Diff line change @@ -66,6 +66,20 @@ public void testSnapshot() {
6666 assertEquals ( 50 , c .find ().snapshot ().limit (50 ).toArray ().size () );
6767 }
6868
69+ @ Test (groups = {"basic" })
70+ public void testOptions () {
71+ DBCollection c = _db .getCollection ("test" );
72+ DBCursor dbCursor = c .find ();
73+
74+ assertEquals (0 , dbCursor .getOptions ());
75+ dbCursor .setOptions (Bytes .QUERYOPTION_TAILABLE );
76+ assertEquals (Bytes .QUERYOPTION_TAILABLE , dbCursor .getOptions ());
77+ dbCursor .addOption (Bytes .QUERYOPTION_SLAVEOK );
78+ assertEquals (Bytes .QUERYOPTION_TAILABLE | Bytes .QUERYOPTION_SLAVEOK , dbCursor .getOptions ());
79+ dbCursor .resetOptions ();
80+ assertEquals (0 , dbCursor .getOptions ());
81+ }
82+
6983 @ Test
7084 public void testBig (){
7185 DBCollection c = _db .getCollection ("big1" );
You can’t perform that action at this time.
0 commit comments