コード例 #1
0
  public Response[] createTwoDocumentsInRemoteDb(CouchClientWrapper db) {
    Bar bar1 = new Bar();
    Response res1 = db.create(bar1);
    Assert.assertNotNull(res1);

    Bar bar2 = new Bar();
    Response res2 = db.create(bar2);
    bar2 = db.get(Bar.class, res2.getId());

    Response res3 = db.update(bar2.getId(), bar2);
    Assert.assertNotNull(res3);
    return new Response[] {res1, res2};
  }
コード例 #2
0
  public Response[] createDocAndUpdateTwoTimes(CouchClientWrapper db) {
    Response res1 = db.create(new Bar());
    Bar bar1 = db.get(Bar.class, res1.getId());

    Response res2 = db.update(bar1.getId(), bar1);
    Assert.assertNotNull(res2);
    Assert.assertEquals(res1.getId(), res2.getId());
    Bar bar2 = db.get(Bar.class, res1.getId());

    Response res3 = db.update(bar2.getId(), bar2);
    Assert.assertEquals(res1.getId(), res3.getId());
    Bar bar3 = db.get(Bar.class, res1.getId());
    Assert.assertNotNull(bar3);
    return new Response[] {res1, res2, res3};
  }
コード例 #3
0
  public Response[] createDocUpdateTwoTimesThenDelete(CouchClientWrapper remoteDb) {
    Response res1 = remoteDb.create(new Bar());
    Bar bar1 = remoteDb.get(Bar.class, res1.getId());

    Response res2 = remoteDb.update(bar1.getId(), bar1);
    Assert.assertNotNull(res2);
    Assert.assertEquals(res1.getId(), res2.getId());
    Bar bar2 = remoteDb.get(Bar.class, res1.getId());

    Response res3 = remoteDb.update(bar2.getId(), bar2);
    Assert.assertEquals(res1.getId(), res3.getId());
    Bar bar3 = remoteDb.get(Bar.class, res1.getId());
    Assert.assertNotNull(bar3);

    Response res4 = remoteDb.delete(bar3.getId(), bar3.getRevision());
    Assert.assertEquals(res1.getId(), res4.getId());
    try {
      Bar bar4 = remoteDb.get(Bar.class, res1.getId());
      Assert.fail();
    } catch (NoResourceException e) {
    }
    return new Response[] {res1, res2, res3, res4};
  }