Ejemplo n.º 1
0
  @Test
  public void testDelete() {
    create();
    for (int i = 0; i < ITERATIONS; ++i) {
      Integer deleted =
          database.command(new OCommandSQL("delete from AutoShardingTest where id = ?")).execute(i);

      Assert.assertEquals(deleted.intValue(), 2);

      long totExpected = ITERATIONS - (i + 1);
      Assert.assertEquals(idx.getSize(), totExpected * 2);
      Assert.assertEquals(idx.getKeySize(), totExpected);
    }

    Assert.assertEquals(idx.getSize(), 0);
    Assert.assertEquals(idx.getKeySize(), 0);
  }
Ejemplo n.º 2
0
  @Test
  public void testUpdate() {
    create();
    for (int i = 0; i < ITERATIONS; ++i) {
      Integer updated =
          database
              .command(
                  new OCommandSQL(
                      "update AutoShardingTest INCREMENT id = " + ITERATIONS + " where id = ?"))
              .execute(i);

      Assert.assertEquals(updated.intValue(), 2);

      Assert.assertEquals(idx.getSize(), ITERATIONS * 2);
      Assert.assertEquals(idx.getKeySize(), ITERATIONS);
    }

    Assert.assertEquals(idx.getSize(), ITERATIONS * 2);
    Assert.assertEquals(idx.getKeySize(), ITERATIONS);
  }