Repository: incubator-rya Updated Branches: refs/heads/master c8989858e -> fe6cbccf7
http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/fe6cbccf/extras/rya.geoindexing/src/test/java/org/apache/rya/indexing/accumulo/geo/GeoWaveIndexerTest.java ---------------------------------------------------------------------- diff --git a/extras/rya.geoindexing/src/test/java/org/apache/rya/indexing/accumulo/geo/GeoWaveIndexerTest.java b/extras/rya.geoindexing/src/test/java/org/apache/rya/indexing/accumulo/geo/GeoWaveIndexerTest.java new file mode 100644 index 0000000..7c4fa47 --- /dev/null +++ b/extras/rya.geoindexing/src/test/java/org/apache/rya/indexing/accumulo/geo/GeoWaveIndexerTest.java @@ -0,0 +1,448 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.rya.indexing.accumulo.geo; + +import static org.apache.rya.api.resolver.RdfToRyaConversions.convertStatement; +import static org.apache.rya.indexing.GeoIndexingTestUtils.getSet; + +import java.io.File; +import java.io.IOException; +import java.util.Collections; +import java.util.Set; + +import org.apache.accumulo.core.client.AccumuloException; +import org.apache.accumulo.core.client.AccumuloSecurityException; +import org.apache.accumulo.core.client.admin.TableOperations; +import org.apache.accumulo.minicluster.impl.MiniAccumuloClusterImpl; +import org.apache.accumulo.minicluster.impl.MiniAccumuloConfigImpl; +import org.apache.commons.io.FileUtils; +import org.apache.rya.accumulo.AccumuloRdfConfiguration; +import org.apache.rya.indexing.GeoConstants; +import org.apache.rya.indexing.GeoIndexerType; +import org.apache.rya.indexing.OptionalConfigUtils; +import org.apache.rya.indexing.StatementConstraints; +import org.apache.rya.indexing.accumulo.ConfigUtils; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; +import org.openrdf.model.Resource; +import org.openrdf.model.Statement; +import org.openrdf.model.URI; +import org.openrdf.model.Value; +import org.openrdf.model.ValueFactory; +import org.openrdf.model.impl.ContextStatementImpl; +import org.openrdf.model.impl.StatementImpl; +import org.openrdf.model.impl.ValueFactoryImpl; + +import com.google.common.collect.Sets; +import com.google.common.io.Files; +import com.vividsolutions.jts.geom.Coordinate; +import com.vividsolutions.jts.geom.GeometryFactory; +import com.vividsolutions.jts.geom.LinearRing; +import com.vividsolutions.jts.geom.Point; +import com.vividsolutions.jts.geom.Polygon; +import com.vividsolutions.jts.geom.PrecisionModel; +import com.vividsolutions.jts.geom.impl.PackedCoordinateSequence; + +import mil.nga.giat.geowave.datastore.accumulo.minicluster.MiniAccumuloClusterFactory; + +/** + * Tests higher level functioning of the geoindexer parse WKT, predicate list, + * prime and anti meridian, delete, search, context, search with Statement Constraints. + */ +public class GeoWaveIndexerTest { + + private static final StatementConstraints EMPTY_CONSTRAINTS = new StatementConstraints(); + + private AccumuloRdfConfiguration conf; + private final GeometryFactory gf = new GeometryFactory(new PrecisionModel(), 4326); + + private static File tempAccumuloDir; + private static MiniAccumuloClusterImpl accumulo; + + private static final boolean IS_MOCK = true; + + private static final String ACCUMULO_USER = IS_MOCK ? "username" : "root"; + private static final String ACCUMULO_PASSWORD = "password"; + + @BeforeClass + public static void setup() throws AccumuloException, AccumuloSecurityException, IOException, InterruptedException { + if (!IS_MOCK) { + tempAccumuloDir = Files.createTempDir(); + + accumulo = MiniAccumuloClusterFactory.newAccumuloCluster( + new MiniAccumuloConfigImpl(tempAccumuloDir, ACCUMULO_PASSWORD), + GeoWaveIndexerTest.class); + + accumulo.start(); + } + } + + @AfterClass + public static void cleanup() throws IOException, InterruptedException { + if (!IS_MOCK) { + try { + accumulo.stop(); + } finally { + FileUtils.deleteDirectory(tempAccumuloDir); + } + } + } + + @Before + public void before() throws Exception { + conf = new AccumuloRdfConfiguration(); + conf.setTablePrefix("triplestore_"); + final String tableName = GeoWaveGeoIndexer.getTableName(conf); + conf.setBoolean(ConfigUtils.USE_MOCK_INSTANCE, IS_MOCK); + conf.set(ConfigUtils.CLOUDBASE_USER, ACCUMULO_USER); + conf.set(ConfigUtils.CLOUDBASE_PASSWORD, ACCUMULO_PASSWORD); + conf.set(ConfigUtils.CLOUDBASE_INSTANCE, IS_MOCK ? "INSTANCE" : accumulo.getInstanceName()); + conf.set(ConfigUtils.CLOUDBASE_ZOOKEEPERS, IS_MOCK ? "localhost" : accumulo.getZooKeepers()); + conf.set(ConfigUtils.CLOUDBASE_AUTHS, "U"); + conf.set(OptionalConfigUtils.USE_GEO, "true"); + conf.set(OptionalConfigUtils.GEO_INDEXER_TYPE, GeoIndexerType.GEO_WAVE.toString()); + + final TableOperations tops = ConfigUtils.getConnector(conf).tableOperations(); + // get all of the table names with the prefix + final Set<String> toDel = Sets.newHashSet(); + for (final String t : tops.list()){ + if (t.startsWith(tableName)){ + toDel.add(t); + } + } + for (final String t : toDel) { + tops.delete(t); + } + } + + @Test + public void testRestrictPredicatesSearch() throws Exception { + conf.setStrings(ConfigUtils.GEO_PREDICATES_LIST, "pred:1,pred:2"); + try (final GeoWaveGeoIndexer f = new GeoWaveGeoIndexer()) { + f.setConf(conf); + f.purge(conf); + + final ValueFactory vf = new ValueFactoryImpl(); + + final Point point = gf.createPoint(new Coordinate(10, 10)); + final Value pointValue = vf.createLiteral("Point(10 10)", GeoConstants.XMLSCHEMA_OGC_WKT); + final URI invalidPredicate = GeoConstants.GEO_AS_WKT; + + // These should not be stored because they are not in the predicate list + f.storeStatement(convertStatement(new StatementImpl(vf.createURI("foo:subj1"), invalidPredicate, pointValue))); + f.storeStatement(convertStatement(new StatementImpl(vf.createURI("foo:subj2"), invalidPredicate, pointValue))); + + final URI pred1 = vf.createURI("pred:1"); + final URI pred2 = vf.createURI("pred:2"); + + // These should be stored because they are in the predicate list + final Statement s3 = new StatementImpl(vf.createURI("foo:subj3"), pred1, pointValue); + final Statement s4 = new StatementImpl(vf.createURI("foo:subj4"), pred2, pointValue); + f.storeStatement(convertStatement(s3)); + f.storeStatement(convertStatement(s4)); + + // This should not be stored because the object is not valid wkt + f.storeStatement(convertStatement(new StatementImpl(vf.createURI("foo:subj5"), pred1, vf.createLiteral("soint(10 10)")))); + + // This should not be stored because the object is not a literal + f.storeStatement(convertStatement(new StatementImpl(vf.createURI("foo:subj6"), pred1, vf.createURI("p:Point(10 10)")))); + + f.flush(); + + final Set<Statement> actual = getSet(f.queryEquals(point, EMPTY_CONSTRAINTS)); + Assert.assertEquals(2, actual.size()); + Assert.assertTrue(actual.contains(s3)); + Assert.assertTrue(actual.contains(s4)); + } + } + + @Test + public void testPrimeMeridianSearch() throws Exception { + try (final GeoWaveGeoIndexer f = new GeoWaveGeoIndexer()) { + f.setConf(conf); + f.purge(conf); + + final ValueFactory vf = new ValueFactoryImpl(); + final Resource subject = vf.createURI("foo:subj"); + final URI predicate = GeoConstants.GEO_AS_WKT; + final Value object = vf.createLiteral("Point(0 0)", GeoConstants.XMLSCHEMA_OGC_WKT); + final Resource context = vf.createURI("foo:context"); + + final Statement statement = new ContextStatementImpl(subject, predicate, object, context); + f.storeStatement(convertStatement(statement)); + f.flush(); + + final double[] ONE = { 1, 1, -1, 1, -1, -1, 1, -1, 1, 1 }; + final double[] TWO = { 2, 2, -2, 2, -2, -2, 2, -2, 2, 2 }; + final double[] THREE = { 3, 3, -3, 3, -3, -3, 3, -3, 3, 3 }; + + final LinearRing r1 = gf.createLinearRing(new PackedCoordinateSequence.Double(ONE, 2)); + final LinearRing r2 = gf.createLinearRing(new PackedCoordinateSequence.Double(TWO, 2)); + final LinearRing r3 = gf.createLinearRing(new PackedCoordinateSequence.Double(THREE, 2)); + + final Polygon p1 = gf.createPolygon(r1, new LinearRing[] {}); + final Polygon p2 = gf.createPolygon(r2, new LinearRing[] {}); + final Polygon p3 = gf.createPolygon(r3, new LinearRing[] {}); + + Assert.assertEquals(Sets.newHashSet(statement), getSet(f.queryWithin(p1, EMPTY_CONSTRAINTS))); + Assert.assertEquals(Sets.newHashSet(statement), getSet(f.queryWithin(p2, EMPTY_CONSTRAINTS))); + Assert.assertEquals(Sets.newHashSet(statement), getSet(f.queryWithin(p3, EMPTY_CONSTRAINTS))); + + // Test a ring with a hole in it + final Polygon p3m2 = gf.createPolygon(r3, new LinearRing[] { r2 }); + Assert.assertEquals(Sets.newHashSet(), getSet(f.queryWithin(p3m2, EMPTY_CONSTRAINTS))); + + // test a ring outside the point + final double[] OUT = { 3, 3, 1, 3, 1, 1, 3, 1, 3, 3 }; + final LinearRing rOut = gf.createLinearRing(new PackedCoordinateSequence.Double(OUT, 2)); + final Polygon pOut = gf.createPolygon(rOut, new LinearRing[] {}); + Assert.assertEquals(Sets.newHashSet(), getSet(f.queryWithin(pOut, EMPTY_CONSTRAINTS))); + } + } + + @Test + public void testDcSearch() throws Exception { + // test a ring around dc + try (final GeoWaveGeoIndexer f = new GeoWaveGeoIndexer()) { + f.setConf(conf); + f.purge(conf); + + final ValueFactory vf = new ValueFactoryImpl(); + final Resource subject = vf.createURI("foo:subj"); + final URI predicate = GeoConstants.GEO_AS_WKT; + final Value object = vf.createLiteral("Point(-77.03524 38.889468)", GeoConstants.XMLSCHEMA_OGC_WKT); + final Resource context = vf.createURI("foo:context"); + + final Statement statement = new ContextStatementImpl(subject, predicate, object, context); + f.storeStatement(convertStatement(statement)); + f.flush(); + + final double[] IN = { -78, 39, -77, 39, -77, 38, -78, 38, -78, 39 }; + final LinearRing r1 = gf.createLinearRing(new PackedCoordinateSequence.Double(IN, 2)); + final Polygon p1 = gf.createPolygon(r1, new LinearRing[] {}); + Assert.assertEquals(Sets.newHashSet(statement), getSet(f.queryWithin(p1, EMPTY_CONSTRAINTS))); + + // test a ring outside the point + final double[] OUT = { -77, 39, -76, 39, -76, 38, -77, 38, -77, 39 }; + final LinearRing rOut = gf.createLinearRing(new PackedCoordinateSequence.Double(OUT, 2)); + final Polygon pOut = gf.createPolygon(rOut, new LinearRing[] {}); + Assert.assertEquals(Sets.newHashSet(), getSet(f.queryWithin(pOut, EMPTY_CONSTRAINTS))); + } + } + + @Test + public void testDeleteSearch() throws Exception { + // test a ring around dc + try (final GeoWaveGeoIndexer f = new GeoWaveGeoIndexer()) { + f.setConf(conf); + f.purge(conf); + + final ValueFactory vf = new ValueFactoryImpl(); + final Resource subject = vf.createURI("foo:subj"); + final URI predicate = GeoConstants.GEO_AS_WKT; + final Value object = vf.createLiteral("Point(-77.03524 38.889468)", GeoConstants.XMLSCHEMA_OGC_WKT); + final Resource context = vf.createURI("foo:context"); + + final Statement statement = new ContextStatementImpl(subject, predicate, object, context); + f.storeStatement(convertStatement(statement)); + f.flush(); + + f.deleteStatement(convertStatement(statement)); + + // test a ring that the point would be inside of if not deleted + final double[] in = { -78, 39, -77, 39, -77, 38, -78, 38, -78, 39 }; + final LinearRing r1 = gf.createLinearRing(new PackedCoordinateSequence.Double(in, 2)); + final Polygon p1 = gf.createPolygon(r1, new LinearRing[] {}); + Assert.assertEquals(Sets.newHashSet(), getSet(f.queryWithin(p1, EMPTY_CONSTRAINTS))); + + // test a ring that the point would be outside of if not deleted + final double[] out = { -77, 39, -76, 39, -76, 38, -77, 38, -77, 39 }; + final LinearRing rOut = gf.createLinearRing(new PackedCoordinateSequence.Double(out, 2)); + final Polygon pOut = gf.createPolygon(rOut, new LinearRing[] {}); + Assert.assertEquals(Sets.newHashSet(), getSet(f.queryWithin(pOut, EMPTY_CONSTRAINTS))); + + // test a ring for the whole world and make sure the point is gone + final double[] world = { -180, 90, 180, 90, 180, -90, -180, -90, -180, 90 }; + final LinearRing rWorld = gf.createLinearRing(new PackedCoordinateSequence.Double(world, 2)); + final Polygon pWorld = gf.createPolygon(rWorld, new LinearRing[] {}); + Assert.assertEquals(Sets.newHashSet(), getSet(f.queryWithin(pWorld, EMPTY_CONSTRAINTS))); + } + } + + @Test + public void testDcSearchWithContext() throws Exception { + // test a ring around dc + try (final GeoWaveGeoIndexer f = new GeoWaveGeoIndexer()) { + f.setConf(conf); + f.purge(conf); + + final ValueFactory vf = new ValueFactoryImpl(); + final Resource subject = vf.createURI("foo:subj"); + final URI predicate = GeoConstants.GEO_AS_WKT; + final Value object = vf.createLiteral("Point(-77.03524 38.889468)", GeoConstants.XMLSCHEMA_OGC_WKT); + final Resource context = vf.createURI("foo:context"); + + final Statement statement = new ContextStatementImpl(subject, predicate, object, context); + f.storeStatement(convertStatement(statement)); + f.flush(); + + final double[] IN = { -78, 39, -77, 39, -77, 38, -78, 38, -78, 39 }; + final LinearRing r1 = gf.createLinearRing(new PackedCoordinateSequence.Double(IN, 2)); + final Polygon p1 = gf.createPolygon(r1, new LinearRing[] {}); + + // query with correct context + Assert.assertEquals(Sets.newHashSet(statement), getSet(f.queryWithin(p1, new StatementConstraints().setContext(context)))); + + // query with wrong context + Assert.assertEquals(Sets.newHashSet(), + getSet(f.queryWithin(p1, new StatementConstraints().setContext(vf.createURI("foo:context2"))))); + } + } + + @Test + public void testDcSearchWithSubject() throws Exception { + // test a ring around dc + try (final GeoWaveGeoIndexer f = new GeoWaveGeoIndexer()) { + f.setConf(conf); + f.purge(conf); + + final ValueFactory vf = new ValueFactoryImpl(); + final Resource subject = vf.createURI("foo:subj"); + final URI predicate = GeoConstants.GEO_AS_WKT; + final Value object = vf.createLiteral("Point(-77.03524 38.889468)", GeoConstants.XMLSCHEMA_OGC_WKT); + final Resource context = vf.createURI("foo:context"); + + final Statement statement = new ContextStatementImpl(subject, predicate, object, context); + f.storeStatement(convertStatement(statement)); + f.flush(); + + final double[] IN = { -78, 39, -77, 39, -77, 38, -78, 38, -78, 39 }; + final LinearRing r1 = gf.createLinearRing(new PackedCoordinateSequence.Double(IN, 2)); + final Polygon p1 = gf.createPolygon(r1, new LinearRing[] {}); + + // query with correct subject + Assert.assertEquals(Sets.newHashSet(statement), getSet(f.queryWithin(p1, new StatementConstraints().setSubject(subject)))); + + // query with wrong subject + Assert.assertEquals(Sets.newHashSet(), getSet(f.queryWithin(p1, new StatementConstraints().setSubject(vf.createURI("foo:subj2"))))); + } + } + + @Test + public void testDcSearchWithSubjectAndContext() throws Exception { + // test a ring around dc + try (final GeoWaveGeoIndexer f = new GeoWaveGeoIndexer()) { + f.setConf(conf); + f.purge(conf); + + final ValueFactory vf = new ValueFactoryImpl(); + final Resource subject = vf.createURI("foo:subj"); + final URI predicate = GeoConstants.GEO_AS_WKT; + final Value object = vf.createLiteral("Point(-77.03524 38.889468)", GeoConstants.XMLSCHEMA_OGC_WKT); + final Resource context = vf.createURI("foo:context"); + + final Statement statement = new ContextStatementImpl(subject, predicate, object, context); + f.storeStatement(convertStatement(statement)); + f.flush(); + + final double[] IN = { -78, 39, -77, 39, -77, 38, -78, 38, -78, 39 }; + final LinearRing r1 = gf.createLinearRing(new PackedCoordinateSequence.Double(IN, 2)); + final Polygon p1 = gf.createPolygon(r1, new LinearRing[] {}); + + // query with correct context subject + Assert.assertEquals(Sets.newHashSet(statement), + getSet(f.queryWithin(p1, new StatementConstraints().setContext(context).setSubject(subject)))); + + // query with wrong context + Assert.assertEquals(Sets.newHashSet(), + getSet(f.queryWithin(p1, new StatementConstraints().setContext(vf.createURI("foo:context2"))))); + + // query with wrong subject + Assert.assertEquals(Sets.newHashSet(), getSet(f.queryWithin(p1, new StatementConstraints().setSubject(vf.createURI("foo:subj2"))))); + } + } + + @Test + public void testDcSearchWithPredicate() throws Exception { + // test a ring around dc + try (final GeoWaveGeoIndexer f = new GeoWaveGeoIndexer()) { + f.setConf(conf); + f.purge(conf); + + final ValueFactory vf = new ValueFactoryImpl(); + final Resource subject = vf.createURI("foo:subj"); + final URI predicate = GeoConstants.GEO_AS_WKT; + final Value object = vf.createLiteral("Point(-77.03524 38.889468)", GeoConstants.XMLSCHEMA_OGC_WKT); + final Resource context = vf.createURI("foo:context"); + + final Statement statement = new ContextStatementImpl(subject, predicate, object, context); + f.storeStatement(convertStatement(statement)); + f.flush(); + + final double[] IN = { -78, 39, -77, 39, -77, 38, -78, 38, -78, 39 }; + final LinearRing r1 = gf.createLinearRing(new PackedCoordinateSequence.Double(IN, 2)); + final Polygon p1 = gf.createPolygon(r1, new LinearRing[] {}); + + // query with correct Predicate + Assert.assertEquals(Sets.newHashSet(statement), + getSet(f.queryWithin(p1, new StatementConstraints().setPredicates(Collections.singleton(predicate))))); + + // query with wrong predicate + Assert.assertEquals(Sets.newHashSet(), + getSet(f.queryWithin(p1, new StatementConstraints().setPredicates(Collections.singleton(vf.createURI("other:pred")))))); + } + } + + // @Test + public void testAntiMeridianSearch() throws Exception { + // verify that a search works if the bounding box crosses the anti meridian + try (final GeoWaveGeoIndexer f = new GeoWaveGeoIndexer()) { + f.setConf(conf); + f.purge(conf); + + final ValueFactory vf = new ValueFactoryImpl(); + final Resource context = vf.createURI("foo:context"); + + final Resource subjectEast = vf.createURI("foo:subj:east"); + final URI predicateEast = GeoConstants.GEO_AS_WKT; + final Value objectEast = vf.createLiteral("Point(179 0)", GeoConstants.XMLSCHEMA_OGC_WKT); + final Statement statementEast = new ContextStatementImpl(subjectEast, predicateEast, objectEast, context); + f.storeStatement(convertStatement(statementEast)); + + final Resource subjectWest = vf.createURI("foo:subj:west"); + final URI predicateWest = GeoConstants.GEO_AS_WKT; + final Value objectWest = vf.createLiteral("Point(-179 0)", GeoConstants.XMLSCHEMA_OGC_WKT); + final Statement statementWest = new ContextStatementImpl(subjectWest, predicateWest, objectWest, context); + f.storeStatement(convertStatement(statementWest)); + + f.flush(); + + final double[] ONE = { 178.1, 1, -178, 1, -178, -1, 178.1, -1, 178.1, 1 }; + + final LinearRing r1 = gf.createLinearRing(new PackedCoordinateSequence.Double(ONE, 2)); + + final Polygon p1 = gf.createPolygon(r1, new LinearRing[] {}); + + Assert.assertEquals(Sets.newHashSet(statementEast, statementWest), getSet(f.queryWithin(p1, EMPTY_CONSTRAINTS))); + } + } +} http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/fe6cbccf/extras/rya.geoindexing/src/test/java/org/apache/rya/indexing/mongo/MongoGeoIndexerSfTest.java ---------------------------------------------------------------------- diff --git a/extras/rya.geoindexing/src/test/java/org/apache/rya/indexing/mongo/MongoGeoIndexerSfTest.java b/extras/rya.geoindexing/src/test/java/org/apache/rya/indexing/mongo/MongoGeoIndexerSfTest.java index 0021e44..2edc006 100644 --- a/extras/rya.geoindexing/src/test/java/org/apache/rya/indexing/mongo/MongoGeoIndexerSfTest.java +++ b/extras/rya.geoindexing/src/test/java/org/apache/rya/indexing/mongo/MongoGeoIndexerSfTest.java @@ -18,7 +18,8 @@ package org.apache.rya.indexing.mongo; * under the License. */ -import java.util.HashSet; +import static org.apache.rya.indexing.GeoIndexingTestUtils.getSet; + import java.util.Map; import java.util.Set; import java.util.UUID; @@ -71,17 +72,17 @@ public class MongoGeoIndexerSfTest extends MongoRyaTestBase { // Here is the landscape: /** * <pre> - * +---+---+---+---+---+---+---+ - * | F | | - * + A + + C + - * | | | - * +---+---+ E +---+---+ - * | | / | - * + B + /+---+---+ - * | | / | | - * +---+---+/--+---+---+ - * / | D | - * / +---+---+ + * +---+---+---+---+---+---+---+ + * | F | | + * + A + + C + + * | | | + * +---+---+ E +---+---+ + * | | / | + * + B + /+---+---+ + * | | / | | + * +---+---+/--+---+---+ + * / | D | + * / +---+---+ * </pre> **/ @@ -161,14 +162,6 @@ public class MongoGeoIndexerSfTest extends MongoRyaTestBase { Assert.assertEquals(expectedSet, getSet(actual)); } - private static <X> Set<X> getSet(final CloseableIteration<X, ?> iter) throws Exception { - final Set<X> set = new HashSet<X>(); - while (iter.hasNext()) { - set.add(iter.next()); - } - return set; - } - private static Geometry[] EMPTY_RESULTS = {}; @Test http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/fe6cbccf/extras/rya.geoindexing/src/test/java/org/apache/rya/indexing/mongo/MongoGeoIndexerTest.java ---------------------------------------------------------------------- diff --git a/extras/rya.geoindexing/src/test/java/org/apache/rya/indexing/mongo/MongoGeoIndexerTest.java b/extras/rya.geoindexing/src/test/java/org/apache/rya/indexing/mongo/MongoGeoIndexerTest.java index fddcc0f..6ec6c4d 100644 --- a/extras/rya.geoindexing/src/test/java/org/apache/rya/indexing/mongo/MongoGeoIndexerTest.java +++ b/extras/rya.geoindexing/src/test/java/org/apache/rya/indexing/mongo/MongoGeoIndexerTest.java @@ -22,9 +22,9 @@ package org.apache.rya.indexing.mongo; import static org.apache.rya.api.resolver.RdfToRyaConversions.convertStatement; +import static org.apache.rya.indexing.GeoIndexingTestUtils.getSet; import java.util.Collections; -import java.util.HashSet; import java.util.Set; import org.apache.rya.indexing.GeoConstants; @@ -55,8 +55,6 @@ import com.vividsolutions.jts.geom.Polygon; import com.vividsolutions.jts.geom.PrecisionModel; import com.vividsolutions.jts.geom.impl.PackedCoordinateSequence; -import info.aduna.iteration.CloseableIteration; - public class MongoGeoIndexerTest extends MongoRyaTestBase { private static final StatementConstraints EMPTY_CONSTRAINTS = new StatementConstraints(); @@ -78,7 +76,7 @@ public class MongoGeoIndexerTest extends MongoRyaTestBase { @Test public void testRestrictPredicatesSearch() throws Exception { conf.setStrings(ConfigUtils.GEO_PREDICATES_LIST, "pred:1,pred:2"); - try (MongoGeoIndexer f = new MongoGeoIndexer()) { + try (final MongoGeoIndexer f = new MongoGeoIndexer()) { f.initIndexer(conf, mongoClient); final ValueFactory vf = new ValueFactoryImpl(); @@ -115,17 +113,9 @@ public class MongoGeoIndexerTest extends MongoRyaTestBase { } } - private static <X> Set<X> getSet(final CloseableIteration<X, ?> iter) throws Exception { - final Set<X> set = new HashSet<X>(); - while (iter.hasNext()) { - set.add(iter.next()); - } - return set; - } - @Test public void testPrimeMeridianSearch() throws Exception { - try (MongoGeoIndexer f = new MongoGeoIndexer()) { + try (final MongoGeoIndexer f = new MongoGeoIndexer()) { f.initIndexer(conf, mongoClient); final ValueFactory vf = new ValueFactoryImpl(); @@ -169,7 +159,7 @@ public class MongoGeoIndexerTest extends MongoRyaTestBase { @Test public void testDcSearch() throws Exception { // test a ring around dc - try (MongoGeoIndexer f = new MongoGeoIndexer()) { + try (final MongoGeoIndexer f = new MongoGeoIndexer()) { f.initIndexer(conf, mongoClient); final ValueFactory vf = new ValueFactoryImpl(); @@ -198,7 +188,7 @@ public class MongoGeoIndexerTest extends MongoRyaTestBase { @Test public void testDeleteSearch() throws Exception { // test a ring around dc - try (MongoGeoIndexer f = new MongoGeoIndexer()) { + try (final MongoGeoIndexer f = new MongoGeoIndexer()) { f.initIndexer(conf, mongoClient); final ValueFactory vf = new ValueFactoryImpl(); @@ -237,7 +227,7 @@ public class MongoGeoIndexerTest extends MongoRyaTestBase { @Test public void testDcSearchWithContext() throws Exception { // test a ring around dc - try (MongoGeoIndexer f = new MongoGeoIndexer()) { + try (final MongoGeoIndexer f = new MongoGeoIndexer()) { f.initIndexer(conf, mongoClient); final ValueFactory vf = new ValueFactoryImpl(); @@ -266,7 +256,7 @@ public class MongoGeoIndexerTest extends MongoRyaTestBase { @Test public void testDcSearchWithSubject() throws Exception { // test a ring around dc - try (MongoGeoIndexer f = new MongoGeoIndexer()) { + try (final MongoGeoIndexer f = new MongoGeoIndexer()) { f.initIndexer(conf, mongoClient); final ValueFactory vf = new ValueFactoryImpl(); @@ -294,7 +284,7 @@ public class MongoGeoIndexerTest extends MongoRyaTestBase { @Test public void testDcSearchWithSubjectAndContext() throws Exception { // test a ring around dc - try (MongoGeoIndexer f = new MongoGeoIndexer()) { + try (final MongoGeoIndexer f = new MongoGeoIndexer()) { f.initIndexer(conf, mongoClient); final ValueFactory vf = new ValueFactoryImpl(); @@ -327,7 +317,7 @@ public class MongoGeoIndexerTest extends MongoRyaTestBase { @Test public void testDcSearchWithPredicate() throws Exception { // test a ring around dc - try (MongoGeoIndexer f = new MongoGeoIndexer()) { + try (final MongoGeoIndexer f = new MongoGeoIndexer()) { f.initIndexer(conf, mongoClient); final ValueFactory vf = new ValueFactoryImpl(); @@ -357,7 +347,7 @@ public class MongoGeoIndexerTest extends MongoRyaTestBase { // @Test public void testAntiMeridianSearch() throws Exception { // verify that a search works if the bounding box crosses the anti meridian - try (MongoGeoIndexer f = new MongoGeoIndexer()) { + try (final MongoGeoIndexer f = new MongoGeoIndexer()) { f.initIndexer(conf, mongoClient); final ValueFactory vf = new ValueFactoryImpl(); http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/fe6cbccf/pom.xml ---------------------------------------------------------------------- diff --git a/pom.xml b/pom.xml index 43cf6f5..7524736 100644 --- a/pom.xml +++ b/pom.xml @@ -80,6 +80,7 @@ under the License. <pig.version>0.9.2</pig.version> <!-- Newest: 0.15.0 --> <geomesa.version>1.3.0-m1</geomesa.version> <!-- Newest: 1.3.0-m1 --> + <geowave.version>0.9.3</geowave.version> <!-- Newest: 0.9.3 --> <lucene.version>3.6.2</lucene.version> <!-- Newest: 5.3.1 --> <joda-time.version>2.1</joda-time.version> <!-- Newest: 2.9.1 --> @@ -525,6 +526,13 @@ under the License. <artifactId>geomesa-accumulo-distributed-runtime_2.11</artifactId> <version>${geomesa.version}</version> </dependency> + + <dependency> + <groupId>mil.nga.giat</groupId> + <artifactId>geowave-parent</artifactId> + <version>${geowave.version}</version> + </dependency> + <dependency> <groupId>org.apache.zookeeper</groupId> <artifactId>zookeeper</artifactId> @@ -918,7 +926,29 @@ under the License. <id>LocationTech - Third Party</id> <url>https://repo.locationtech.org/content/repositories/thirdparty/</url> </repository> - </repositories> + <repository> + <id>geowave-maven-releases</id> + <name>GeoWave AWS Release Repository</name> + <url>http://geowave-maven.s3-website-us-east-1.amazonaws.com/release</url> + <releases> + <enabled>true</enabled> + </releases> + <snapshots> + <enabled>false</enabled> + </snapshots> + </repository> + <repository> + <id>geowave-maven-snapshot</id> + <name>GeoWave AWS Snapshot Repository</name> + <url>http://geowave-maven.s3-website-us-east-1.amazonaws.com/snapshot</url> + <releases> + <enabled>false</enabled> + </releases> + <snapshots> + <enabled>true</enabled> + </snapshots> + </repository> + </repositories> <scm> <connection>scm:git:git://git.apache.org/incubator-rya.git</connection>
