private void rollback() { command(DropIndexOp.class).setTreeRefSpec(treeName).setAttributeName(attributeName).call(); }
@Override public boolean equals(Object o) { if (o instanceof Index) { Index i = (Index) o; return info().equals(i.info()) && indexTreeId().equals(i.indexTreeId()); } return false; }
@Test public void testEqualIndexesWithDifferentExtraAttributesHashDifferently() { Index noExtraAtts = createAndBuildIndex(); Index xExtraAtts = updateIndex(noExtraAtts.info().getTreeName(), "x"); Index yExtraAtts = updateIndex(noExtraAtts.info().getTreeName(), "y"); assertNotEquals(noExtraAtts, xExtraAtts); assertNotEquals(xExtraAtts, yExtraAtts); assertNotEquals(noExtraAtts.indexTreeId(), xExtraAtts.indexTreeId()); assertNotEquals(xExtraAtts.indexTreeId(), yExtraAtts.indexTreeId()); }
private IndexInfo createIndex(boolean indexHistory, @Nullable String... extraAttributes) { Index index = geogig.command(CreateQuadTree.class)// .setTreeRefSpec(worldPointsLayer.getName())// .setGeometryAttributeName("geom")// .setExtraAttributes(Lists.newArrayList(extraAttributes))// .setIndexHistory(indexHistory)// .call(); return index.info(); }
@Test public void testUpdateIndexOverwriteSameAttribute() { createIndex("x"); exception.expect(IllegalArgumentException.class); exception.expectMessage("Nothing to update..."); geogig.command(UpdateIndexOp.class)// .setTreeRefSpec(worldPointsLayer.getName())// .setExtraAttributes(Lists.newArrayList("x"))// .setOverwrite(true)// .call(); }
private Index createIndex(NodeRef typeRef, List<String> extraAttributes) { Index index = repo.command(CreateQuadTree.class)// .setBounds(QuadTreeTestSupport.wgs84Bounds())// .setTypeTreeRef(typeRef)// .setExtraAttributes(extraAttributes)// .call(); return index; }
@Test public void testUpdateIndexDoNothing() { createIndex("x"); exception.expect(IllegalStateException.class); exception.expectMessage("Nothing to update..."); geogig.command(UpdateIndexOp.class)// .setTreeRefSpec(worldPointsLayer.getName())// .call(); }
private Index createAndBuildIndex(@Nullable String... extraAttributes) { IndexInfo indexInfo = createIndex(extraAttributes); Index index = updateIndex(indexInfo.getTreeName(), extraAttributes); return index; }
private IndexInfo createIndex(boolean indexHistory, @Nullable String... extraAttributes) { Index index = geogig.command(CreateQuadTree.class)// .setTreeRefSpec(worldPointsLayer.getName())// .setGeometryAttributeName("geom")// .setExtraAttributes(Lists.newArrayList(extraAttributes))// .setIndexHistory(indexHistory)// .call(); return index.info(); }
@Test public void testUpdateIndexAddSameAttribute() { createIndex("x", "y"); exception.expect(IllegalArgumentException.class); exception.expectMessage("Nothing to update..."); geogig.command(UpdateIndexOp.class)// .setTreeRefSpec(worldPointsLayer.getName())// .setExtraAttributes(Lists.newArrayList("x"))// .setAdd(true)// .call(); }
private Index createIndex(NodeRef typeRef, List<String> extraAttributes) { Index index = repo.command(CreateQuadTree.class)// .setBounds(QuadTreeTestSupport.wgs84Bounds())// .setTypeTreeRef(typeRef)// .setExtraAttributes(extraAttributes)// .call(); return index; }
@Override public boolean equals(Object o) { if (o instanceof Index) { Index i = (Index) o; return info().equals(i.info()) && indexTreeId().equals(i.indexTreeId()); } return false; }
private void rollback() { command(DropIndexOp.class).setTreeRefSpec(treeName).setAttributeName(attributeName).call(); }
@Test public void testEqualIndexesWithDifferentExtraAttributesHashDifferently() { Index noExtraAtts = createAndBuildIndex(); Index xExtraAtts = updateIndex(noExtraAtts.info().getTreeName(), "x"); Index yExtraAtts = updateIndex(noExtraAtts.info().getTreeName(), "y"); assertNotEquals(noExtraAtts, xExtraAtts); assertNotEquals(xExtraAtts, yExtraAtts); assertNotEquals(noExtraAtts.indexTreeId(), xExtraAtts.indexTreeId()); assertNotEquals(xExtraAtts.indexTreeId(), yExtraAtts.indexTreeId()); }
@Test public void testUpdateIndexDoNothing() { createIndex("x"); exception.expect(IllegalArgumentException.class); exception.expectMessage("Nothing to update..."); geogig.command(UpdateIndexOp.class)// .setTreeRefSpec(worldPointsLayer.getName())// .call(); }
private Index createAndBuildIndex(@Nullable String... extraAttributes) { IndexInfo indexInfo = createIndex(extraAttributes); Index index = updateIndex(indexInfo.getTreeName(), extraAttributes); return index; }
@Test public void testUpdateIndexOverwriteSameAttribute() { createIndex("x"); exception.expect(IllegalStateException.class); exception.expectMessage("Nothing to update..."); geogig.command(UpdateIndexOp.class)// .setTreeRefSpec(worldPointsLayer.getName())// .setExtraAttributes(Lists.newArrayList("x"))// .setOverwrite(true)// .call(); }
@Override public void write(ResponseWriter out) throws Exception { out.start(); out.writeIndexInfo(index.info(), "index", false); out.writeElement("indexedTreeId", index.indexTreeId().toString()); out.finish(); } });
@Test public void testUpdateIndexAttributesNoFlagSpecified() { createIndex("x"); exception.expect(IllegalArgumentException.class); exception.expectMessage( "Extra attributes already exist on index, specify add or overwrite to update."); geogig.command(UpdateIndexOp.class)// .setTreeRefSpec(worldPointsLayer.getName())// .setExtraAttributes(Lists.newArrayList("y"))// .call(); }
@Override public void write(ResponseWriter out) throws Exception { out.start(); out.writeIndexInfo(index.info(), "index", false); out.writeElement("indexedTreeId", index.indexTreeId().toString()); out.finish(); } });