You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rya.apache.org by ca...@apache.org on 2017/08/16 20:53:18 UTC
incubator-rya git commit: Updated to extend MongoITBase. Added unique
mongoDBs for isolation. Closes #208.
Repository: incubator-rya
Updated Branches:
refs/heads/master 34ff001d5 -> 2f6052692
Updated to extend MongoITBase. Added unique mongoDBs for isolation. Closes #208.
Project: http://git-wip-us.apache.org/repos/asf/incubator-rya/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-rya/commit/2f605269
Tree: http://git-wip-us.apache.org/repos/asf/incubator-rya/tree/2f605269
Diff: http://git-wip-us.apache.org/repos/asf/incubator-rya/diff/2f605269
Branch: refs/heads/master
Commit: 2f60526929943ba86f9f3052a2a73aa8cf50e070
Parents: 34ff001
Author: jdasch <jd...@localhost.localdomain>
Authored: Tue Aug 15 16:07:52 2017 -0400
Committer: Caleb Meier <ca...@parsons.com>
Committed: Wed Aug 16 13:52:32 2017 -0700
----------------------------------------------------------------------
.../geotemporal/MongoGeoTemporalIndexIT.java | 10 ++++----
.../indexing/mongo/MongoGeoIndexerFilterIT.java | 24 +++++++++++++++-----
2 files changed, 24 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/2f605269/extras/rya.geoindexing/src/test/java/org/apache/rya/indexing/geotemporal/MongoGeoTemporalIndexIT.java
----------------------------------------------------------------------
diff --git a/extras/rya.geoindexing/src/test/java/org/apache/rya/indexing/geotemporal/MongoGeoTemporalIndexIT.java b/extras/rya.geoindexing/src/test/java/org/apache/rya/indexing/geotemporal/MongoGeoTemporalIndexIT.java
index 66de3fa..e0209e8 100644
--- a/extras/rya.geoindexing/src/test/java/org/apache/rya/indexing/geotemporal/MongoGeoTemporalIndexIT.java
+++ b/extras/rya.geoindexing/src/test/java/org/apache/rya/indexing/geotemporal/MongoGeoTemporalIndexIT.java
@@ -26,6 +26,7 @@ import java.util.HashSet;
import java.util.List;
import java.util.Optional;
import java.util.Set;
+import java.util.concurrent.atomic.AtomicInteger;
import org.apache.rya.api.RdfCloudTripleStoreConfiguration;
import org.apache.rya.api.domain.RyaURI;
@@ -36,8 +37,8 @@ import org.apache.rya.indexing.TemporalInstantRfc3339;
import org.apache.rya.indexing.accumulo.ConfigUtils;
import org.apache.rya.indexing.geotemporal.model.Event;
import org.apache.rya.indexing.geotemporal.mongo.MongoGeoTemporalIndexer;
+import org.apache.rya.indexing.geotemporal.mongo.MongoITBase;
import org.apache.rya.indexing.geotemporal.storage.EventStorage;
-import org.apache.rya.mongodb.MockMongoFactory;
import org.apache.rya.mongodb.MongoDBRdfConfiguration;
import org.junit.Before;
import org.junit.Test;
@@ -55,19 +56,20 @@ import org.openrdf.sail.Sail;
import com.mongodb.MongoClient;
-public class MongoGeoTemporalIndexIT {
+public class MongoGeoTemporalIndexIT extends MongoITBase {
private static final String URI_PROPERTY_AT_TIME = "Property:atTime";
private static final ValueFactory VF = ValueFactoryImpl.getInstance();
private MongoDBRdfConfiguration conf;
private SailRepositoryConnection conn;
private MongoClient mongoClient;
+ private static final AtomicInteger COUNTER = new AtomicInteger(1);
@Before
public void setUp() throws Exception{
- mongoClient = MockMongoFactory.newFactory().newMongoClient();
+ mongoClient = super.getMongoClient();
conf = new MongoDBRdfConfiguration();
- conf.set(MongoDBRdfConfiguration.MONGO_DB_NAME, "test");
+ conf.set(MongoDBRdfConfiguration.MONGO_DB_NAME, MongoGeoTemporalIndexIT.class.getSimpleName() + "_" + COUNTER.getAndIncrement());
conf.set(MongoDBRdfConfiguration.MONGO_COLLECTION_PREFIX, "rya");
conf.set(RdfCloudTripleStoreConfiguration.CONF_TBL_PREFIX, "rya");
conf.setBoolean(ConfigUtils.USE_MONGO, true);
http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/2f605269/extras/rya.geoindexing/src/test/java/org/apache/rya/indexing/mongo/MongoGeoIndexerFilterIT.java
----------------------------------------------------------------------
diff --git a/extras/rya.geoindexing/src/test/java/org/apache/rya/indexing/mongo/MongoGeoIndexerFilterIT.java b/extras/rya.geoindexing/src/test/java/org/apache/rya/indexing/mongo/MongoGeoIndexerFilterIT.java
index 389cc28..e96955c 100644
--- a/extras/rya.geoindexing/src/test/java/org/apache/rya/indexing/mongo/MongoGeoIndexerFilterIT.java
+++ b/extras/rya.geoindexing/src/test/java/org/apache/rya/indexing/mongo/MongoGeoIndexerFilterIT.java
@@ -22,6 +22,7 @@ import static org.junit.Assert.assertEquals;
import java.util.ArrayList;
import java.util.List;
+import java.util.concurrent.atomic.AtomicInteger;
import org.apache.rya.api.domain.RyaStatement;
import org.apache.rya.api.resolver.RdfToRyaConversions;
@@ -30,8 +31,9 @@ import org.apache.rya.indexing.GeoConstants;
import org.apache.rya.indexing.GeoRyaSailFactory;
import org.apache.rya.indexing.OptionalConfigUtils;
import org.apache.rya.indexing.accumulo.ConfigUtils;
+import org.apache.rya.indexing.geotemporal.mongo.MongoITBase;
import org.apache.rya.indexing.mongodb.MongoIndexingConfiguration;
-import org.apache.rya.mongodb.MockMongoFactory;
+import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.openrdf.model.Resource;
@@ -46,6 +48,7 @@ import org.openrdf.query.MalformedQueryException;
import org.openrdf.query.QueryEvaluationException;
import org.openrdf.query.QueryLanguage;
import org.openrdf.query.TupleQueryResult;
+import org.openrdf.repository.RepositoryException;
import org.openrdf.repository.sail.SailRepository;
import org.openrdf.repository.sail.SailRepositoryConnection;
import org.openrdf.sail.Sail;
@@ -58,27 +61,28 @@ import com.vividsolutions.jts.io.ParseException;
import com.vividsolutions.jts.io.WKTReader;
import com.vividsolutions.jts.io.WKTWriter;
-public class MongoGeoIndexerFilterIT {
+public class MongoGeoIndexerFilterIT extends MongoITBase {
private static final GeometryFactory GF = new GeometryFactory();
private static final Geometry WASHINGTON_MONUMENT = GF.createPoint(new Coordinate(38.8895, 77.0353));
private static final Geometry LINCOLN_MEMORIAL = GF.createPoint(new Coordinate(38.8893, 77.0502));
private static final Geometry CAPITAL_BUILDING = GF.createPoint(new Coordinate(38.8899, 77.0091));
private static final Geometry WHITE_HOUSE = GF.createPoint(new Coordinate(38.8977, 77.0365));
+ private static final AtomicInteger COUNTER = new AtomicInteger(1);
+
private MongoClient client;
private Sail sail;
private SailRepositoryConnection conn;
-
@Before
public void before() throws Exception {
final MongoIndexingConfiguration indxrConf = MongoIndexingConfiguration.builder()
.setMongoCollectionPrefix("rya_")
- .setMongoDBName("indexerTests")
+ .setMongoDBName(MongoGeoIndexerFilterIT.class.getSimpleName() + "_" + COUNTER.getAndIncrement())
.setUseMongoFreetextIndex(false)
.setUseMongoTemporalIndex(false)
.build();
- client = MockMongoFactory.newFactory().newMongoClient();
+ client = super.getMongoClient();
indxrConf.setBoolean(OptionalConfigUtils.USE_GEO, true);
indxrConf.set(ConfigUtils.GEO_PREDICATES_LIST, "http://www.opengis.net/ont/geosparql#asWKT");
indxrConf.setBoolean(ConfigUtils.USE_MONGO, true);
@@ -86,7 +90,13 @@ public class MongoGeoIndexerFilterIT {
sail = GeoRyaSailFactory.getInstance(indxrConf);
conn = new SailRepository(sail).getConnection();
- conn.begin();
+ }
+
+ @After
+ public void after() throws RepositoryException {
+ if(conn != null) {
+ conn.close();
+ }
}
@Test
@@ -252,6 +262,7 @@ public class MongoGeoIndexerFilterIT {
private void populateRya() throws Exception {
// geo 2x2 points
+ conn.begin();
RyaStatement stmnt = statement(WASHINGTON_MONUMENT);
Statement statement = RyaToRdfConversions.convertStatement(stmnt);
conn.add(statement);
@@ -267,6 +278,7 @@ public class MongoGeoIndexerFilterIT {
stmnt = statement(WHITE_HOUSE);
statement = RyaToRdfConversions.convertStatement(stmnt);
conn.add(statement);
+ conn.commit();
}
private static Geometry bindingToGeo(final BindingSet bs) throws ParseException {