@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)); }
@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 } }