コード例 #1
0
  @Test
  public void testVersioningNewCreate() {
    ParsedDocument doc =
        testParsedDocument(
            "1", "1", "test", null, -1, -1, testDocument(), Lucene.STANDARD_ANALYZER, B_1, false);
    Engine.Create create = new Engine.Create(null, newUid("1"), doc);
    engine.create(create);
    assertThat(create.version(), equalTo(1l));

    create = new Engine.Create(null, newUid("1"), doc).version(create.version()).origin(REPLICA);
    replicaEngine.create(create);
    assertThat(create.version(), equalTo(1l));
  }
コード例 #2
0
  @Test
  public void testVersioningCreateExistsException() {
    ParsedDocument doc =
        testParsedDocument(
            "1", "1", "test", null, -1, -1, testDocument(), Lucene.STANDARD_ANALYZER, B_1, false);
    Engine.Create create = new Engine.Create(null, newUid("1"), doc);
    engine.create(create);
    assertThat(create.version(), equalTo(1l));

    create = new Engine.Create(null, newUid("1"), doc);
    try {
      engine.create(create);
      assert false;
    } catch (DocumentAlreadyExistsException e) {
      // all is well
    }
  }