Skip to content

Commit

Permalink
update unacknowledge write test to work with 3.0.x driver
Browse files Browse the repository at this point in the history
  • Loading branch information
Justin Lee committed Aug 28, 2013
1 parent c6c088f commit 13d11cf
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions morphia/src/test/java/com/google/code/morphia/TestUpdateOps.java
Original file line number Diff line number Diff line change
Expand Up @@ -151,12 +151,17 @@ public void testValidationBadFieldType() throws Exception {

@Test
public void testInsertUpdatesUnsafe() throws Exception {
if (mongo.getVersion().startsWith("2.")) {
final UpdateResults<Circle> res = ds.update(ds.createQuery(Circle.class)
ds.getDB()
.requestStart();
try {
ds.update(ds.createQuery(Circle.class)
.field("radius")
.equal(0), ds.createUpdateOperations(Circle.class)
.inc("radius", 1D), true, WriteConcern.NONE);
assertInserted(res);
assertEquals(1, ds.getCount(Circle.class));
} finally {
ds.getDB()
.requestDone();
}
}

Expand Down Expand Up @@ -337,7 +342,7 @@ public void testUpdateRef() throws Exception {


//test with Key<Pic>
UpdateResults<ContainsPic> res = ds.updateFirst(ds.find(ContainsPic.class, "name", cp.name), ds.createUpdateOperations(
final UpdateResults<ContainsPic> res = ds.updateFirst(ds.find(ContainsPic.class, "name", cp.name), ds.createUpdateOperations(
ContainsPic.class).set("pic", pic));

assertEquals(1, res.getUpdatedCount());
Expand Down Expand Up @@ -375,7 +380,7 @@ public void testUpdateKeyRef() throws Exception {


//test with Key<Pic>
UpdateResults<ContainsPicKey> res = ds.updateFirst(ds.find(ContainsPicKey.class, "name", cpk.name), ds.createUpdateOperations(
final UpdateResults<ContainsPicKey> res = ds.updateFirst(ds.find(ContainsPicKey.class, "name", cpk.name), ds.createUpdateOperations(
ContainsPicKey.class).set("pic", pic));

assertEquals(1, res.getUpdatedCount());
Expand Down

0 comments on commit 13d11cf

Please sign in to comment.