You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rya.apache.org by dl...@apache.org on 2018/01/04 22:07:32 UTC
[10/17] incubator-rya git commit: RYA-414 Fixing broken tests,
cleaning up documentate, cleaning up whitespace.
RYA-414 Fixing broken tests, cleaning up documentate, cleaning up whitespace.
Project: http://git-wip-us.apache.org/repos/asf/incubator-rya/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-rya/commit/157c0649
Tree: http://git-wip-us.apache.org/repos/asf/incubator-rya/tree/157c0649
Diff: http://git-wip-us.apache.org/repos/asf/incubator-rya/diff/157c0649
Branch: refs/heads/master
Commit: 157c06491cd814a1d6e445ebfe77fc63226e5739
Parents: 17cebae
Author: kchilton2 <ke...@gmail.com>
Authored: Tue Dec 26 18:42:33 2017 -0500
Committer: kchilton2 <ke...@gmail.com>
Committed: Wed Dec 27 14:45:18 2017 -0500
----------------------------------------------------------------------
.../AbstractMongoDBRdfConfigurationBuilder.java | 18 +-
.../rya/mongodb/EmbeddedMongoFactory.java | 5 +-
.../apache/rya/mongodb/MongoDBQueryEngine.java | 16 +-
.../rya/mongodb/MongoDBRdfConfiguration.java | 8 +-
.../apache/rya/mongodb/MongoSecondaryIndex.java | 5 +-
.../StatefulMongoDBRdfConfiguration.java | 22 +-
.../dao/SimpleMongoDBNamespaceManager.java | 244 +++----
.../mongodb/MongoDBRdfConfigurationTest.java | 4 +-
.../org/apache/rya/mongodb/MongoTestBase.java | 5 +-
.../rya/indexing/FilterFunctionOptimizer.java | 24 +-
.../entity/update/BaseEntityIndexer.java | 24 +-
.../entity/update/mongo/MongoEntityIndexer.java | 4 +-
.../rya/indexing/mongodb/MongoDbSmartUri.java | 2 +-
.../apache/rya/sail/config/RyaSailFactory.java | 64 +-
.../update/mongo/MongoEntityIndexerIT.java | 468 +++++++-------
.../rya/indexing/mongo/MongoEntityIndexIT.java | 50 +-
.../mongo/MongoIndexingConfigurationTest.java | 4 +-
.../mongo/MongoTemporalIndexerTest.java | 23 -
.../metadata/MongoStatementMetadataIT.java | 354 +++++------
.../MongoStatementMetadataNodeTest.java | 634 +++++++++----------
.../src/main/java/MongoRyaDirectExample.java | 12 +-
.../client/merge/StatementStoreFactory.java | 3 +-
.../rya/indexing/export/StoreToStoreIT.java | 4 +-
.../GeoEnabledFilterFunctionOptimizer.java | 60 +-
.../apache/rya/indexing/GeoRyaSailFactory.java | 13 +-
extras/rya.geoindexing/geo.mongo/pom.xml | 4 +-
.../mongo/MongoGeoTemporalIndexer.java | 8 +-
.../geotemporal/MongoGeoTemporalIndexIT.java | 257 ++++----
.../indexing/mongo/MongoGeoIndexerFilterIT.java | 472 +++++++-------
.../indexing/mongo/MongoGeoIndexerSfTest.java | 44 +-
.../rya/indexing/mongo/MongoGeoIndexerTest.java | 22 +-
.../indexing/mongo/MongoIndexerDeleteIT.java | 108 ++--
.../RdfCloudTripleStoreConnection.java | 6 +-
.../rya/RdfCloudTripleStoreConnectionTest.java | 15 +-
34 files changed, 1459 insertions(+), 1547 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/157c0649/dao/mongodb.rya/src/main/java/org/apache/rya/mongodb/AbstractMongoDBRdfConfigurationBuilder.java
----------------------------------------------------------------------
diff --git a/dao/mongodb.rya/src/main/java/org/apache/rya/mongodb/AbstractMongoDBRdfConfigurationBuilder.java b/dao/mongodb.rya/src/main/java/org/apache/rya/mongodb/AbstractMongoDBRdfConfigurationBuilder.java
index a2bd03f..277ba5e 100644
--- a/dao/mongodb.rya/src/main/java/org/apache/rya/mongodb/AbstractMongoDBRdfConfigurationBuilder.java
+++ b/dao/mongodb.rya/src/main/java/org/apache/rya/mongodb/AbstractMongoDBRdfConfigurationBuilder.java
@@ -63,7 +63,7 @@ public abstract class AbstractMongoDBRdfConfigurationBuilder<B extends AbstractM
* @param user - user name used to connect to Mongo
* @return specified builder for chaining method invocations
*/
- public B setMongoUser(final String user) {
+ public B setMongoUser(String user) {
this.user = user;
return confBuilder();
}
@@ -75,7 +75,7 @@ public abstract class AbstractMongoDBRdfConfigurationBuilder<B extends AbstractM
* @param password - password used to connect to Mongo
* @return specified builder for chaining method invocations
*/
- public B setMongoPassword(final String password) {
+ public B setMongoPassword(String password) {
this.pass = password;
return confBuilder();
}
@@ -87,7 +87,7 @@ public abstract class AbstractMongoDBRdfConfigurationBuilder<B extends AbstractM
* @param port - port used to connect Mongo
* @return specified builder for chaining method invocations
*/
- public B setMongoPort(final String port) {
+ public B setMongoPort(String port) {
this.port = port;
return confBuilder();
}
@@ -99,7 +99,7 @@ public abstract class AbstractMongoDBRdfConfigurationBuilder<B extends AbstractM
* @param host - host used to connect to Mongo
* @return specified builder for chaining method invocations
*/
- public B setMongoHost(final String host) {
+ public B setMongoHost(String host) {
this.host = host;
return confBuilder();
}
@@ -111,7 +111,7 @@ public abstract class AbstractMongoDBRdfConfigurationBuilder<B extends AbstractM
* @param name - name of MongoDB to connect to
* @return specified builder for chaining method invocations
*/
- public B setMongoDBName(final String name) {
+ public B setMongoDBName(String name) {
this.mongoDBName = name;
return confBuilder();
}
@@ -124,7 +124,7 @@ public abstract class AbstractMongoDBRdfConfigurationBuilder<B extends AbstractM
* @param name - name of Collection to connect to
* @return specified builder for chaining method invocations
*/
- public B setMongoCollectionPrefix(final String prefix) {
+ public B setMongoCollectionPrefix(String prefix) {
this.mongoCollectionPrefix = prefix;
return confBuilder();
}
@@ -136,7 +136,7 @@ public abstract class AbstractMongoDBRdfConfigurationBuilder<B extends AbstractM
* @param useMock - indicates whether to use embedded Mongo as Rya backing
* @return specified builder for chaining method invocations
*/
- public B setUseMockMongo(final boolean useMock) {
+ public B setUseMockMongo(boolean useMock) {
this.useMock = useMock;
return confBuilder();
}
@@ -155,7 +155,7 @@ public abstract class AbstractMongoDBRdfConfigurationBuilder<B extends AbstractM
* @param conf - Configuration object
* @return - Configuration object with parameters set
*/
- private C getConf(final C conf) {
+ private C getConf(C conf) {
conf.setUseMock(useMock);
conf.set("sc.useMongo", "true");
@@ -167,7 +167,7 @@ public abstract class AbstractMongoDBRdfConfigurationBuilder<B extends AbstractM
conf.setMongoPassword(pass);
}
conf.setMongoDBName(mongoDBName);
- conf.setRyaInstance(mongoCollectionPrefix);
+ conf.setRyaInstanceName(mongoCollectionPrefix);
conf.setTablePrefix(mongoCollectionPrefix);
conf.setMongoHostname(host);
conf.setMongoPort(port);
http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/157c0649/dao/mongodb.rya/src/main/java/org/apache/rya/mongodb/EmbeddedMongoFactory.java
----------------------------------------------------------------------
diff --git a/dao/mongodb.rya/src/main/java/org/apache/rya/mongodb/EmbeddedMongoFactory.java b/dao/mongodb.rya/src/main/java/org/apache/rya/mongodb/EmbeddedMongoFactory.java
index d695ffa..ced8aa5 100644
--- a/dao/mongodb.rya/src/main/java/org/apache/rya/mongodb/EmbeddedMongoFactory.java
+++ b/dao/mongodb.rya/src/main/java/org/apache/rya/mongodb/EmbeddedMongoFactory.java
@@ -58,7 +58,7 @@ public class EmbeddedMongoFactory {
* Create the testing utility using the specified version of MongoDB.
*
* @param version
- * - version of MongoDB.
+ * version of MongoDB.
*/
private EmbeddedMongoFactory(final IFeatureAwareVersion version) throws IOException {
final MongodStarter runtime = MongodStarter.getInstance(new RuntimeConfigBuilder().defaultsWithLogger(Command.MongoD, logger).build());
@@ -67,7 +67,7 @@ public class EmbeddedMongoFactory {
}
private IMongodConfig newMongodConfig(final IFeatureAwareVersion version) throws UnknownHostException, IOException {
- final Net net = new Net(findRandomOpenPortOnAllLocalInterfaces(), false);
+ Net net = new Net(findRandomOpenPortOnAllLocalInterfaces(), false);
return new MongodConfigBuilder().version(version).net(net).build();
}
@@ -95,7 +95,6 @@ public class EmbeddedMongoFactory {
return mongodProcess.getConfig();
}
-
/**
* Cleans up the resources created by the utility.
*/
http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/157c0649/dao/mongodb.rya/src/main/java/org/apache/rya/mongodb/MongoDBQueryEngine.java
----------------------------------------------------------------------
diff --git a/dao/mongodb.rya/src/main/java/org/apache/rya/mongodb/MongoDBQueryEngine.java b/dao/mongodb.rya/src/main/java/org/apache/rya/mongodb/MongoDBQueryEngine.java
index d107d43..e01fa34 100644
--- a/dao/mongodb.rya/src/main/java/org/apache/rya/mongodb/MongoDBQueryEngine.java
+++ b/dao/mongodb.rya/src/main/java/org/apache/rya/mongodb/MongoDBQueryEngine.java
@@ -18,6 +18,8 @@
*/
package org.apache.rya.mongodb;
+import static com.google.common.base.Preconditions.checkNotNull;
+
import java.io.IOException;
import java.util.AbstractMap;
import java.util.Collection;
@@ -73,11 +75,11 @@ public class MongoDBQueryEngine implements RyaQueryEngine<StatefulMongoDBRdfConf
public CloseableIteration<RyaStatement, RyaDAOException> query(
final RyaStatement stmt, final StatefulMongoDBRdfConfiguration conf)
throws RyaDAOException {
- Preconditions.checkNotNull(stmt);
- Preconditions.checkNotNull(conf);
+ checkNotNull(stmt);
+ checkNotNull(conf);
- final Entry<RyaStatement, BindingSet> entry = new AbstractMap.SimpleEntry<>(stmt, new MapBindingSet());
- final Collection<Entry<RyaStatement, BindingSet>> collection = Collections.singleton(entry);
+ Entry<RyaStatement, BindingSet> entry = new AbstractMap.SimpleEntry<>(stmt, new MapBindingSet());
+ Collection<Entry<RyaStatement, BindingSet>> collection = Collections.singleton(entry);
return new RyaStatementCursorIterator(queryWithBindingSet(collection, conf));
}
@@ -86,8 +88,8 @@ public class MongoDBQueryEngine implements RyaQueryEngine<StatefulMongoDBRdfConf
public CloseableIteration<? extends Entry<RyaStatement, BindingSet>, RyaDAOException> queryWithBindingSet(
final Collection<Entry<RyaStatement, BindingSet>> stmts,
final StatefulMongoDBRdfConfiguration conf) throws RyaDAOException {
- Preconditions.checkNotNull(stmts);
- Preconditions.checkNotNull(conf);
+ checkNotNull(stmts);
+ checkNotNull(conf);
final Multimap<RyaStatement, BindingSet> rangeMap = HashMultimap.create();
@@ -141,7 +143,7 @@ public class MongoDBQueryEngine implements RyaQueryEngine<StatefulMongoDBRdfConf
queries.put(stmt, new MapBindingSet());
}
- final Iterator<RyaStatement> iterator = new RyaStatementCursorIterator(queryWithBindingSet(queries.entrySet(), getConf()));
+ Iterator<RyaStatement> iterator = new RyaStatementCursorIterator(queryWithBindingSet(queries.entrySet(), getConf()));
return CloseableIterables.wrap((Iterable<RyaStatement>) () -> iterator);
}
http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/157c0649/dao/mongodb.rya/src/main/java/org/apache/rya/mongodb/MongoDBRdfConfiguration.java
----------------------------------------------------------------------
diff --git a/dao/mongodb.rya/src/main/java/org/apache/rya/mongodb/MongoDBRdfConfiguration.java b/dao/mongodb.rya/src/main/java/org/apache/rya/mongodb/MongoDBRdfConfiguration.java
index 4d06ea1..269a73c 100644
--- a/dao/mongodb.rya/src/main/java/org/apache/rya/mongodb/MongoDBRdfConfiguration.java
+++ b/dao/mongodb.rya/src/main/java/org/apache/rya/mongodb/MongoDBRdfConfiguration.java
@@ -191,14 +191,14 @@ public class MongoDBRdfConfiguration extends RdfCloudTripleStoreConfiguration {
/**
* @return The name of the Rya instance to connect to. (default: rya)
*/
- public String getRyaInstance() {
+ public String getRyaInstanceName() {
return get(MONGO_COLLECTION_PREFIX, "rya");
}
/**
* @param name - The name of the Rya instance to connect to.
*/
- public void setRyaInstance(final String name) {
+ public void setRyaInstanceName(final String name) {
requireNonNull(name);
set(MONGO_COLLECTION_PREFIX, name);
}
@@ -207,14 +207,14 @@ public class MongoDBRdfConfiguration extends RdfCloudTripleStoreConfiguration {
* @return The name of the MongoDB Collection that contains Rya statements. (default: rya_triples)
*/
public String getTriplesCollectionName() {
- return getRyaInstance() + "_triples";
+ return getRyaInstanceName() + "_triples";
}
/**
* @return The name of the MongoDB Collection that contains the Rya namespace. (default: rya_ns)
*/
public String getNameSpacesCollectionName() {
- return getRyaInstance() + "_ns";
+ return getRyaInstanceName() + "_ns";
}
/**
http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/157c0649/dao/mongodb.rya/src/main/java/org/apache/rya/mongodb/MongoSecondaryIndex.java
----------------------------------------------------------------------
diff --git a/dao/mongodb.rya/src/main/java/org/apache/rya/mongodb/MongoSecondaryIndex.java b/dao/mongodb.rya/src/main/java/org/apache/rya/mongodb/MongoSecondaryIndex.java
index 3be6da8..510e013 100644
--- a/dao/mongodb.rya/src/main/java/org/apache/rya/mongodb/MongoSecondaryIndex.java
+++ b/dao/mongodb.rya/src/main/java/org/apache/rya/mongodb/MongoSecondaryIndex.java
@@ -20,10 +20,7 @@ package org.apache.rya.mongodb;
import org.apache.rya.api.persist.index.RyaSecondaryIndexer;
-/**
- *TODO: doc me.
- */
public interface MongoSecondaryIndex extends RyaSecondaryIndexer{
@Override
- public void init();
+ public void init();
}
http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/157c0649/dao/mongodb.rya/src/main/java/org/apache/rya/mongodb/StatefulMongoDBRdfConfiguration.java
----------------------------------------------------------------------
diff --git a/dao/mongodb.rya/src/main/java/org/apache/rya/mongodb/StatefulMongoDBRdfConfiguration.java b/dao/mongodb.rya/src/main/java/org/apache/rya/mongodb/StatefulMongoDBRdfConfiguration.java
index 12bc5e3..61c349e 100644
--- a/dao/mongodb.rya/src/main/java/org/apache/rya/mongodb/StatefulMongoDBRdfConfiguration.java
+++ b/dao/mongodb.rya/src/main/java/org/apache/rya/mongodb/StatefulMongoDBRdfConfiguration.java
@@ -61,7 +61,7 @@ public class StatefulMongoDBRdfConfiguration extends MongoDBRdfConfiguration {
this.mongoClient = requireNonNull(mongoClient);
this.indexers = requireNonNull(indexers);
}
-
+
/**
* Constructs an instance of {@link StatefulMongoDBRdfConfiguration} pre-loaded with values.
*
@@ -75,14 +75,6 @@ public class StatefulMongoDBRdfConfiguration extends MongoDBRdfConfiguration {
}
/**
- * TODO doc
- * @param indexers (not null)
- */
- public void setIndexers(final List<MongoSecondaryIndex> indexers) {
- this.indexers = requireNonNull(indexers);
- }
-
- /**
* @return The {@link MongoClient} that Rya will use.
*/
public MongoClient getMongoClient() {
@@ -90,9 +82,21 @@ public class StatefulMongoDBRdfConfiguration extends MongoDBRdfConfiguration {
}
/**
+ * @param indexers - The {@link MongoSecondaryIndex}s that Rya will use. (not null)
+ */
+ public void setIndexers(final List<MongoSecondaryIndex> indexers) {
+ this.indexers = requireNonNull(indexers);
+ }
+
+ /**
* @return The {@link MongoSecondaryIndex}s that Rya will use.
*/
public List<MongoSecondaryIndex> getAdditionalIndexers() {
return indexers;
}
+
+ @Override
+ public MongoDBRdfConfiguration clone() {
+ return new StatefulMongoDBRdfConfiguration(this, mongoClient, indexers);
+ }
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/157c0649/dao/mongodb.rya/src/main/java/org/apache/rya/mongodb/dao/SimpleMongoDBNamespaceManager.java
----------------------------------------------------------------------
diff --git a/dao/mongodb.rya/src/main/java/org/apache/rya/mongodb/dao/SimpleMongoDBNamespaceManager.java b/dao/mongodb.rya/src/main/java/org/apache/rya/mongodb/dao/SimpleMongoDBNamespaceManager.java
index 88fa2b5..91ee064 100644
--- a/dao/mongodb.rya/src/main/java/org/apache/rya/mongodb/dao/SimpleMongoDBNamespaceManager.java
+++ b/dao/mongodb.rya/src/main/java/org/apache/rya/mongodb/dao/SimpleMongoDBNamespaceManager.java
@@ -37,145 +37,145 @@ import info.aduna.iteration.CloseableIteration;
public class SimpleMongoDBNamespaceManager implements MongoDBNamespaceManager {
- public class NamespaceImplementation implements Namespace {
+ public class NamespaceImplementation implements Namespace {
- private final String namespace;
- private final String prefix;
+ private final String namespace;
+ private final String prefix;
- public NamespaceImplementation(final String namespace, final String prefix) {
- this.namespace = namespace;
- this.prefix = prefix;
- }
+ public NamespaceImplementation(final String namespace, final String prefix) {
+ this.namespace = namespace;
+ this.prefix = prefix;
+ }
- @Override
- public int compareTo(final Namespace o) {
- if (!namespace.equalsIgnoreCase(o.getName())) {
+ @Override
+ public int compareTo(final Namespace o) {
+ if (!namespace.equalsIgnoreCase(o.getName())) {
return namespace.compareTo(o.getName());
}
- if (!prefix.equalsIgnoreCase(o.getPrefix())) {
+ if (!prefix.equalsIgnoreCase(o.getPrefix())) {
return prefix.compareTo(o.getPrefix());
}
- return 0;
- }
-
- @Override
- public String getName() {
- return namespace;
- }
-
- @Override
- public String getPrefix() {
- return prefix;
- }
-
- }
-
- public class MongoCursorIteration implements
- CloseableIteration<Namespace, RyaDAOException> {
- private final DBCursor cursor;
-
- public MongoCursorIteration(final DBCursor cursor2) {
- this.cursor = cursor2;
- }
-
- @Override
- public boolean hasNext() throws RyaDAOException {
- return cursor.hasNext();
- }
-
- @Override
- public Namespace next() throws RyaDAOException {
- final DBObject ns = cursor.next();
- final Map values = ns.toMap();
- final String namespace = (String) values.get(NAMESPACE);
- final String prefix = (String) values.get(PREFIX);
-
- final Namespace temp = new NamespaceImplementation(namespace, prefix);
- return temp;
- }
-
- @Override
- public void remove() throws RyaDAOException {
- next();
- }
-
- @Override
- public void close() throws RyaDAOException {
- cursor.close();
- }
-
- }
-
- private static final String ID = "_id";
- private static final String PREFIX = "prefix";
- private static final String NAMESPACE = "namespace";
- private StatefulMongoDBRdfConfiguration conf;
- private final DBCollection nsColl;
-
-
- public SimpleMongoDBNamespaceManager(final DBCollection nameSpaceCollection) {
- nsColl = nameSpaceCollection;
- }
-
- @Override
- public void createIndices(final DBCollection coll){
- coll.createIndex(PREFIX);
- coll.createIndex(NAMESPACE);
- }
-
- @Override
- public void setConf(final StatefulMongoDBRdfConfiguration conf) {
- this.conf = conf;
- }
-
- @Override
- public StatefulMongoDBRdfConfiguration getConf() {
- return conf;
- }
-
- @Override
- public void addNamespace(final String prefix, final String namespace)
- throws RyaDAOException {
- final String id = prefix;
- byte[] bytes = id.getBytes(StandardCharsets.UTF_8);
- try {
- final MessageDigest digest = MessageDigest.getInstance("SHA-1");
- bytes = digest.digest(bytes);
- } catch (final NoSuchAlgorithmException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- final BasicDBObject doc = new BasicDBObject(ID, new String(Hex.encodeHex(bytes)))
- .append(PREFIX, prefix)
- .append(NAMESPACE, namespace);
- nsColl.insert(doc);
-
- }
-
- @Override
- public String getNamespace(final String prefix) throws RyaDAOException {
+ return 0;
+ }
+
+ @Override
+ public String getName() {
+ return namespace;
+ }
+
+ @Override
+ public String getPrefix() {
+ return prefix;
+ }
+
+ }
+
+ public class MongoCursorIteration implements
+ CloseableIteration<Namespace, RyaDAOException> {
+ private final DBCursor cursor;
+
+ public MongoCursorIteration(final DBCursor cursor2) {
+ this.cursor = cursor2;
+ }
+
+ @Override
+ public boolean hasNext() throws RyaDAOException {
+ return cursor.hasNext();
+ }
+
+ @Override
+ public Namespace next() throws RyaDAOException {
+ final DBObject ns = cursor.next();
+ final Map values = ns.toMap();
+ final String namespace = (String) values.get(NAMESPACE);
+ final String prefix = (String) values.get(PREFIX);
+
+ final Namespace temp = new NamespaceImplementation(namespace, prefix);
+ return temp;
+ }
+
+ @Override
+ public void remove() throws RyaDAOException {
+ next();
+ }
+
+ @Override
+ public void close() throws RyaDAOException {
+ cursor.close();
+ }
+
+ }
+
+ private static final String ID = "_id";
+ private static final String PREFIX = "prefix";
+ private static final String NAMESPACE = "namespace";
+ private StatefulMongoDBRdfConfiguration conf;
+ private final DBCollection nsColl;
+
+
+ public SimpleMongoDBNamespaceManager(final DBCollection nameSpaceCollection) {
+ nsColl = nameSpaceCollection;
+ }
+
+ @Override
+ public void createIndices(final DBCollection coll){
+ coll.createIndex(PREFIX);
+ coll.createIndex(NAMESPACE);
+ }
+
+ @Override
+ public void setConf(final StatefulMongoDBRdfConfiguration conf) {
+ this.conf = conf;
+ }
+
+ @Override
+ public StatefulMongoDBRdfConfiguration getConf() {
+ return conf;
+ }
+
+ @Override
+ public void addNamespace(final String prefix, final String namespace)
+ throws RyaDAOException {
+ final String id = prefix;
+ byte[] bytes = id.getBytes(StandardCharsets.UTF_8);
+ try {
+ final MessageDigest digest = MessageDigest.getInstance("SHA-1");
+ bytes = digest.digest(bytes);
+ } catch (final NoSuchAlgorithmException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ final BasicDBObject doc = new BasicDBObject(ID, new String(Hex.encodeHex(bytes)))
+ .append(PREFIX, prefix)
+ .append(NAMESPACE, namespace);
+ nsColl.insert(doc);
+
+ }
+
+ @Override
+ public String getNamespace(final String prefix) throws RyaDAOException {
final DBObject query = new BasicDBObject().append(PREFIX, prefix);
final DBCursor cursor = nsColl.find(query);
String nameSpace = prefix;
while (cursor.hasNext()){
- final DBObject obj = cursor.next();
- nameSpace = (String) obj.toMap().get(NAMESPACE);
+ final DBObject obj = cursor.next();
+ nameSpace = (String) obj.toMap().get(NAMESPACE);
}
return nameSpace;
- }
+ }
- @Override
- public void removeNamespace(final String prefix) throws RyaDAOException {
+ @Override
+ public void removeNamespace(final String prefix) throws RyaDAOException {
final DBObject query = new BasicDBObject().append(PREFIX, prefix);
- nsColl.remove(query);
- }
+ nsColl.remove(query);
+ }
- @Override
- public CloseableIteration<? extends Namespace, RyaDAOException> iterateNamespace()
- throws RyaDAOException {
+ @Override
+ public CloseableIteration<? extends Namespace, RyaDAOException> iterateNamespace()
+ throws RyaDAOException {
final DBObject query = new BasicDBObject();
final DBCursor cursor = nsColl.find(query);
- return new MongoCursorIteration(cursor);
- }
+ return new MongoCursorIteration(cursor);
+ }
}
http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/157c0649/dao/mongodb.rya/src/test/java/org/apache/rya/mongodb/MongoDBRdfConfigurationTest.java
----------------------------------------------------------------------
diff --git a/dao/mongodb.rya/src/test/java/org/apache/rya/mongodb/MongoDBRdfConfigurationTest.java b/dao/mongodb.rya/src/test/java/org/apache/rya/mongodb/MongoDBRdfConfigurationTest.java
index 2d28bb5..948c3d5 100644
--- a/dao/mongodb.rya/src/test/java/org/apache/rya/mongodb/MongoDBRdfConfigurationTest.java
+++ b/dao/mongodb.rya/src/test/java/org/apache/rya/mongodb/MongoDBRdfConfigurationTest.java
@@ -64,7 +64,7 @@ public class MongoDBRdfConfigurationTest {
assertEquals(conf.getBoolean(".useMockInstance", false), useMock);
assertEquals(conf.getMongoPort(), "1000");
assertEquals(conf.getMongoDBName(), "dbname");
- assertEquals(conf.getRyaInstance(), "prefix_");
+ assertEquals(conf.getRyaInstanceName(), "prefix_");
assertEquals(conf.get(MongoDBRdfConfiguration.MONGO_USER), user);
assertEquals(conf.get(MongoDBRdfConfiguration.MONGO_USER_PASSWORD), password);
@@ -95,7 +95,7 @@ public class MongoDBRdfConfigurationTest {
assertEquals(conf.getBoolean(".useMockInstance", false), useMock);
assertEquals(conf.getMongoPort(), "1000");
assertEquals(conf.getMongoDBName(), "dbname");
- assertEquals(conf.getRyaInstance(), "prefix_");
+ assertEquals(conf.getRyaInstanceName(), "prefix_");
assertEquals(conf.get(MongoDBRdfConfiguration.MONGO_USER), user);
assertEquals(conf.get(MongoDBRdfConfiguration.MONGO_USER_PASSWORD), password);
}
http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/157c0649/dao/mongodb.rya/src/test/java/org/apache/rya/mongodb/MongoTestBase.java
----------------------------------------------------------------------
diff --git a/dao/mongodb.rya/src/test/java/org/apache/rya/mongodb/MongoTestBase.java b/dao/mongodb.rya/src/test/java/org/apache/rya/mongodb/MongoTestBase.java
index a3db535..6dbd19b 100644
--- a/dao/mongodb.rya/src/test/java/org/apache/rya/mongodb/MongoTestBase.java
+++ b/dao/mongodb.rya/src/test/java/org/apache/rya/mongodb/MongoTestBase.java
@@ -62,9 +62,10 @@ public class MongoTestBase {
}
/**
- * TODO doc
+ * Override this method if you would like to augment the configuration object that
+ * will be used to initialize indexers and create the mongo client prior to running a test.
*
- * @param conf
+ * @param conf - The configuration object that may be updated. (not null)
*/
protected void updateConfiguration(final MongoDBRdfConfiguration conf) {
// By default, do nothing.
http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/157c0649/extras/indexing/src/main/java/org/apache/rya/indexing/FilterFunctionOptimizer.java
----------------------------------------------------------------------
diff --git a/extras/indexing/src/main/java/org/apache/rya/indexing/FilterFunctionOptimizer.java b/extras/indexing/src/main/java/org/apache/rya/indexing/FilterFunctionOptimizer.java
index 58ec29a..6c4e05b 100644
--- a/extras/indexing/src/main/java/org/apache/rya/indexing/FilterFunctionOptimizer.java
+++ b/extras/indexing/src/main/java/org/apache/rya/indexing/FilterFunctionOptimizer.java
@@ -97,16 +97,16 @@ public class FilterFunctionOptimizer implements QueryOptimizer, Configurable {
private synchronized void init() {
if (!init) {
if (ConfigUtils.getUseMongo(conf)) {
- StatefulMongoDBRdfConfiguration stateConf = (StatefulMongoDBRdfConfiguration) conf;
- for(final MongoSecondaryIndex indexer : stateConf.getAdditionalIndexers()) {
- if(indexer instanceof FreeTextIndexer) {
- freeTextIndexer = (FreeTextIndexer) indexer;
- } else if(indexer instanceof TemporalIndexer) {
- temporalIndexer = (TemporalIndexer) indexer;
- }
- }
+ StatefulMongoDBRdfConfiguration stateConf = (StatefulMongoDBRdfConfiguration) conf;
+ for(final MongoSecondaryIndex indexer : stateConf.getAdditionalIndexers()) {
+ if(indexer instanceof FreeTextIndexer) {
+ freeTextIndexer = (FreeTextIndexer) indexer;
+ } else if(indexer instanceof TemporalIndexer) {
+ temporalIndexer = (TemporalIndexer) indexer;
+ }
+ }
} else {
- freeTextIndexer = new AccumuloFreeTextIndexer();
+ freeTextIndexer = new AccumuloFreeTextIndexer();
freeTextIndexer.setConf(conf);
temporalIndexer = new AccumuloTemporalIndexer();
temporalIndexer.setConf(conf);
@@ -164,7 +164,7 @@ public class FilterFunctionOptimizer implements QueryOptimizer, Configurable {
//find vars contained in filters
private static class SearchVarVisitor extends QueryModelVisitorBase<RuntimeException> {
- private final Collection<Var> searchProperties = new ArrayList<Var>();
+ private final Collection<Var> searchProperties = new ArrayList<>();
@Override
public void meet(final FunctionCall fn) {
@@ -179,8 +179,8 @@ public class FilterFunctionOptimizer implements QueryOptimizer, Configurable {
//find StatementPatterns containing filter variables
private static class MatchStatementVisitor extends QueryModelVisitorBase<RuntimeException> {
private final Collection<Var> propertyVars;
- private final Collection<Var> usedVars = new ArrayList<Var>();
- private final List<StatementPattern> matchStatements = new ArrayList<StatementPattern>();
+ private final Collection<Var> usedVars = new ArrayList<>();
+ private final List<StatementPattern> matchStatements = new ArrayList<>();
public MatchStatementVisitor(final Collection<Var> propertyVars) {
this.propertyVars = propertyVars;
http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/157c0649/extras/indexing/src/main/java/org/apache/rya/indexing/entity/update/BaseEntityIndexer.java
----------------------------------------------------------------------
diff --git a/extras/indexing/src/main/java/org/apache/rya/indexing/entity/update/BaseEntityIndexer.java b/extras/indexing/src/main/java/org/apache/rya/indexing/entity/update/BaseEntityIndexer.java
index 2ca6761..7392318 100644
--- a/extras/indexing/src/main/java/org/apache/rya/indexing/entity/update/BaseEntityIndexer.java
+++ b/extras/indexing/src/main/java/org/apache/rya/indexing/entity/update/BaseEntityIndexer.java
@@ -75,21 +75,21 @@ public abstract class BaseEntityIndexer implements EntityIndexer, MongoSecondary
private final AtomicReference<TypeStorage> types = new AtomicReference<>();
@Override
- public void init() {
- try {
- entities.set(getEntityStorage());
- } catch (final EntityStorageException e) {
- log.error("Unable to set entity storage.");
- }
- types.set(getTypeStorage());
+ public void init() {
+ try {
+ entities.set(getEntityStorage());
+ } catch (final EntityStorageException e) {
+ log.error("Unable to set entity storage.");
+ }
+ types.set(getTypeStorage());
}
-
+
@Override
public void setConf(final Configuration conf) {
requireNonNull(conf);
- checkArgument(conf instanceof StatefulMongoDBRdfConfiguration,
- "The configuration provided must be a StatefulMongoDBRdfConfiguration, found: "
- + conf.getClass().getSimpleName());
+ checkArgument(conf instanceof StatefulMongoDBRdfConfiguration,
+ "The configuration provided must be a StatefulMongoDBRdfConfiguration, found: "
+ + conf.getClass().getSimpleName());
configuration.set((StatefulMongoDBRdfConfiguration) conf);
}
@@ -109,7 +109,7 @@ public abstract class BaseEntityIndexer implements EntityIndexer, MongoSecondary
requireNonNull(statements);
final Map<RyaURI,List<RyaStatement>> groupedBySubject = statements.stream()
- .collect(groupingBy(RyaStatement::getSubject));
+ .collect(groupingBy(RyaStatement::getSubject));
for(final Entry<RyaURI, List<RyaStatement>> entry : groupedBySubject.entrySet()) {
try {
http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/157c0649/extras/indexing/src/main/java/org/apache/rya/indexing/entity/update/mongo/MongoEntityIndexer.java
----------------------------------------------------------------------
diff --git a/extras/indexing/src/main/java/org/apache/rya/indexing/entity/update/mongo/MongoEntityIndexer.java b/extras/indexing/src/main/java/org/apache/rya/indexing/entity/update/mongo/MongoEntityIndexer.java
index ea28388..a850557 100644
--- a/extras/indexing/src/main/java/org/apache/rya/indexing/entity/update/mongo/MongoEntityIndexer.java
+++ b/extras/indexing/src/main/java/org/apache/rya/indexing/entity/update/mongo/MongoEntityIndexer.java
@@ -39,12 +39,12 @@ public class MongoEntityIndexer extends BaseEntityIndexer {
@Override
public EntityStorage getEntityStorage() throws EntityStorageException {
final StatefulMongoDBRdfConfiguration conf = super.configuration.get();
- return new MongoEntityStorage(conf.getMongoClient(), conf.getRyaInstance());
+ return new MongoEntityStorage(conf.getMongoClient(), conf.getRyaInstanceName());
}
@Override
public TypeStorage getTypeStorage() {
final StatefulMongoDBRdfConfiguration conf = super.configuration.get();
- return new MongoTypeStorage(conf.getMongoClient(), conf.getRyaInstance());
+ return new MongoTypeStorage(conf.getMongoClient(), conf.getRyaInstanceName());
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/157c0649/extras/indexing/src/main/java/org/apache/rya/indexing/mongodb/MongoDbSmartUri.java
----------------------------------------------------------------------
diff --git a/extras/indexing/src/main/java/org/apache/rya/indexing/mongodb/MongoDbSmartUri.java b/extras/indexing/src/main/java/org/apache/rya/indexing/mongodb/MongoDbSmartUri.java
index 249bde5..a50d293 100644
--- a/extras/indexing/src/main/java/org/apache/rya/indexing/mongodb/MongoDbSmartUri.java
+++ b/extras/indexing/src/main/java/org/apache/rya/indexing/mongodb/MongoDbSmartUri.java
@@ -148,7 +148,7 @@ public class MongoDbSmartUri implements SmartUriStorage {
*/
private void setupClient(final StatefulMongoDBRdfConfiguration conf) throws UnknownHostException, MongoException, EntityStorageException {
mongoClient = conf.getMongoClient();
- entityStorage = new MongoEntityStorage(mongoClient, conf.getRyaInstance());
+ entityStorage = new MongoEntityStorage(mongoClient, conf.getRyaInstanceName());
isInit = true;
}
http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/157c0649/extras/indexing/src/main/java/org/apache/rya/sail/config/RyaSailFactory.java
----------------------------------------------------------------------
diff --git a/extras/indexing/src/main/java/org/apache/rya/sail/config/RyaSailFactory.java b/extras/indexing/src/main/java/org/apache/rya/sail/config/RyaSailFactory.java
index ffde9b2..b5adee3 100644
--- a/extras/indexing/src/main/java/org/apache/rya/sail/config/RyaSailFactory.java
+++ b/extras/indexing/src/main/java/org/apache/rya/sail/config/RyaSailFactory.java
@@ -95,11 +95,9 @@ public class RyaSailFactory {
// Add the Indexer and Optimizer names to the configuration object that are configured to be used.
ConfigUtils.setIndexers(mongoConfig);
- // Initialize the indexer and optimizer objects that will be used within the Sail object.
-
// Populate the configuration using previously stored Rya Details if this instance uses them.
try {
- final MongoRyaInstanceDetailsRepository ryaDetailsRepo = new MongoRyaInstanceDetailsRepository(client, mongoConfig.getRyaInstance());
+ final MongoRyaInstanceDetailsRepository ryaDetailsRepo = new MongoRyaInstanceDetailsRepository(client, mongoConfig.getRyaInstanceName());
RyaDetailsToConfiguration.addRyaDetailsToConfiguration(ryaDetailsRepo.getRyaInstanceDetails(), mongoConfig);
} catch (final RyaDetailsRepositoryException e) {
LOG.info("Instance does not have a rya details collection, skipping.");
@@ -239,62 +237,4 @@ public class RyaSailFactory {
LOG.info("Instance does not have a rya details collection, skipping.");
}
}
-}
-
-
-
-///**
-//* TODO add docs. names for reflection
-//* @param indexers
-//*/
-//public void setMongoIndexers(final Class<? extends MongoSecondaryIndex>... indexers) {
-// final List<String> strs = Lists.newArrayList();
-// for (final Class<?> ai : indexers){
-// strs.add(ai.getName());
-// }
-//
-// setStrings(CONF_ADDITIONAL_INDEXERS, strs.toArray(new String[]{}));
-//}
-
-///**
-//* TODO add docs. explain hack is used here. do reflection. eww.
-//* @return
-//*/
-//public List<MongoSecondaryIndex> getAdditionalIndexers() {
-// stateLock.lock();
-// try {
-// if(indexers == null) {
-// indexers = getInstances(CONF_ADDITIONAL_INDEXERS, MongoSecondaryIndex.class);
-// }
-// return indexers;
-// } finally {
-// stateLock.unlock();
-// }
-//}
-
-//// XXX Not sure what all of this stuff is for. I'm guessing Rya Sail state stuff.
-//public void setAdditionalIndexers(final Class<? extends MongoSecondaryIndex>... indexers) {
-// final List<String> strs = Lists.newArrayList();
-// for (final Class<?> ai : indexers){
-// strs.add(ai.getName());
-// }
-//
-// setStrings(CONF_ADDITIONAL_INDEXERS, strs.toArray(new String[]{}));
-//}
-//
-
-//conf.setStrings(AccumuloRdfConfiguration.CONF_ADDITIONAL_INDEXERS, indexList.toArray(new String[] {}));
-//conf.setStrings(RdfCloudTripleStoreConfiguration.CONF_OPTIMIZERS, optimizers.toArray(new String[] {}));
-
-//public List<MongoSecondaryIndex> getAdditionalIndexers() {
-// return getInstances(CONF_ADDITIONAL_INDEXERS, MongoSecondaryIndex.class);
-//}
-
-//public void setMongoClient(final MongoClient client) {
-// requireNonNull(client);
-// this.mongoClient = client;
-//}
-//
-//public MongoClient getMongoClient() {
-// return mongoClient;
-//}
\ No newline at end of file
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/157c0649/extras/indexing/src/test/java/org/apache/rya/indexing/entity/update/mongo/MongoEntityIndexerIT.java
----------------------------------------------------------------------
diff --git a/extras/indexing/src/test/java/org/apache/rya/indexing/entity/update/mongo/MongoEntityIndexerIT.java b/extras/indexing/src/test/java/org/apache/rya/indexing/entity/update/mongo/MongoEntityIndexerIT.java
index 88b2ed0..8b62a57 100644
--- a/extras/indexing/src/test/java/org/apache/rya/indexing/entity/update/mongo/MongoEntityIndexerIT.java
+++ b/extras/indexing/src/test/java/org/apache/rya/indexing/entity/update/mongo/MongoEntityIndexerIT.java
@@ -45,238 +45,238 @@ import com.google.common.collect.Sets;
*/
public class MongoEntityIndexerIT extends MongoTestBase {
- private static final Type PERSON_TYPE =
- new Type(new RyaURI("urn:person"),
- ImmutableSet.<RyaURI>builder()
- .add(new RyaURI("urn:name"))
- .add(new RyaURI("urn:age"))
- .add(new RyaURI("urn:eye"))
- .build());
-
- private static final Type EMPLOYEE_TYPE =
- new Type(new RyaURI("urn:employee"),
- ImmutableSet.<RyaURI>builder()
- .add(new RyaURI("urn:name"))
- .add(new RyaURI("urn:hoursPerWeek"))
- .build());
-
- @Test
- public void addStatement_setsType() throws Exception {
- try(MongoEntityIndexer indexer = new MongoEntityIndexer()) {
- indexer.setConf(conf);
- indexer.init();
- // Load a type into the TypeStorage.
- final TypeStorage types = new MongoTypeStorage(getMongoClient(), conf.getRyaInstance());
- types.create(PERSON_TYPE);
-
- // Index a RyaStatement that will create an Entity with an explicit type.
- final RyaStatement statement = new RyaStatement(new RyaURI("urn:SSN/111-11-1111"), new RyaURI( RDF.TYPE.toString() ), new RyaType(XMLSchema.ANYURI, "urn:person"));
- indexer.storeStatement(statement);
-
- // Fetch the Entity from storage and ensure it looks correct.
- final EntityStorage entities = new MongoEntityStorage(getMongoClient(), conf.getRyaInstance());
- final Entity entity = entities.get(new RyaURI("urn:SSN/111-11-1111")).get();
-
- final Entity expected = Entity.builder()
- .setSubject(new RyaURI("urn:SSN/111-11-1111"))
- .setExplicitType(new RyaURI("urn:person"))
- .build();
-
- assertEquals(expected, entity);
- }
- }
-
- @Test
- public void addStatement_setsProperty() throws Exception {
- try(MongoEntityIndexer indexer = new MongoEntityIndexer()) {
- indexer.setConf(conf);
- indexer.init();
- // Load the types into the TypeStorage.
- final TypeStorage types = new MongoTypeStorage(getMongoClient(), conf.getRyaInstance());
- types.create(PERSON_TYPE);
- types.create(EMPLOYEE_TYPE);
-
- // Index a RyaStatement that will create an Entity with two implicit types.
- final RyaStatement statement = new RyaStatement(new RyaURI("urn:SSN/111-11-1111"), new RyaURI("urn:name"), new RyaType(XMLSchema.STRING, "Alice"));
- indexer.storeStatement(statement);
-
- // Fetch the Entity from storage and ensure it looks correct.
- final EntityStorage entities = new MongoEntityStorage(getMongoClient(), conf.getRyaInstance());
- final Entity entity = entities.get(new RyaURI("urn:SSN/111-11-1111")).get();
-
- final Entity expected = Entity.builder()
- .setSubject(new RyaURI("urn:SSN/111-11-1111"))
- .setProperty(new RyaURI("urn:person"), new Property(new RyaURI("urn:name"), new RyaType(XMLSchema.STRING, "Alice")))
- .setProperty(new RyaURI("urn:employee"), new Property(new RyaURI("urn:name"), new RyaType(XMLSchema.STRING, "Alice")))
- .build();
-
- assertEquals(expected, entity);
- }
- }
-
- @Test
- public void addStatement_manyUpdates() throws Exception {
- try(MongoEntityIndexer indexer = new MongoEntityIndexer()) {
- indexer.setConf(conf);
- indexer.init();
- // Load the types into the TypeStorage.
- final TypeStorage types = new MongoTypeStorage(getMongoClient(), conf.getRyaInstance());
- types.create(PERSON_TYPE);
- types.create(EMPLOYEE_TYPE);
-
- // Index a bunch of RyaStatements.
- final RyaURI aliceSSN = new RyaURI("urn:SSN/111-11-1111");
- indexer.storeStatement(new RyaStatement(aliceSSN, new RyaURI( RDF.TYPE.toString() ), new RyaType(XMLSchema.ANYURI, "urn:person")));
- indexer.storeStatement(new RyaStatement(aliceSSN, new RyaURI("urn:name"), new RyaType(XMLSchema.STRING, "Alice")));
- indexer.storeStatement(new RyaStatement(aliceSSN, new RyaURI("urn:age"), new RyaType(XMLSchema.INT, "30")));
- indexer.storeStatement(new RyaStatement(aliceSSN, new RyaURI("urn:eye"), new RyaType(XMLSchema.STRING, "blue")));
-
- // Fetch the Entity from storage and ensure it looks correct.
- final EntityStorage entities = new MongoEntityStorage(getMongoClient(), conf.getRyaInstance());
- final Entity entity = entities.get(new RyaURI("urn:SSN/111-11-1111")).get();
-
- final Entity expected = Entity.builder()
- .setSubject(aliceSSN)
- .setExplicitType(new RyaURI("urn:person"))
- .setProperty(new RyaURI("urn:person"), new Property(new RyaURI("urn:name"), new RyaType(XMLSchema.STRING, "Alice")))
- .setProperty(new RyaURI("urn:person"), new Property(new RyaURI("urn:age"), new RyaType(XMLSchema.INT, "30")))
- .setProperty(new RyaURI("urn:person"), new Property(new RyaURI("urn:eye"), new RyaType(XMLSchema.STRING, "blue")))
- .setProperty(new RyaURI("urn:employee"), new Property(new RyaURI("urn:name"), new RyaType(XMLSchema.STRING, "Alice")))
- .setVersion( entity.getVersion() )
- .build();
-
- assertEquals(expected, entity);
- }
- }
-
- @Test
- public void addStatements() throws Exception {
- try(MongoEntityIndexer indexer = new MongoEntityIndexer()) {
- indexer.setConf(conf);
- indexer.init();
- // Load the types into the TypeStorage.
- final TypeStorage types = new MongoTypeStorage(getMongoClient(), conf.getRyaInstance());
- types.create(PERSON_TYPE);
- types.create(EMPLOYEE_TYPE);
-
- // Index a bunch of RyaStatements.
- final RyaURI aliceSSN = new RyaURI("urn:SSN/111-11-1111");
- final RyaURI bobSSN = new RyaURI("urn:SSN/222-22-2222");
-
- indexer.storeStatements(Sets.newHashSet(
- new RyaStatement(aliceSSN, new RyaURI( RDF.TYPE.toString() ), new RyaType(XMLSchema.ANYURI, "urn:person")),
- new RyaStatement(aliceSSN, new RyaURI("urn:name"), new RyaType(XMLSchema.STRING, "Alice")),
- new RyaStatement(aliceSSN, new RyaURI("urn:age"), new RyaType(XMLSchema.INT, "30")),
- new RyaStatement(aliceSSN, new RyaURI("urn:eye"), new RyaType(XMLSchema.STRING, "blue")),
-
- new RyaStatement(bobSSN, new RyaURI("urn:name"), new RyaType(XMLSchema.STRING, "Bob")),
- new RyaStatement(bobSSN, new RyaURI("urn:hoursPerWeek"), new RyaType(XMLSchema.INT, "40")),
- new RyaStatement(bobSSN, new RyaURI( RDF.TYPE.toString() ), new RyaType(XMLSchema.ANYURI, "urn:employee"))));
-
- // Fetch the Entity from storage and ensure it looks correct.
- final EntityStorage entities = new MongoEntityStorage(getMongoClient(), conf.getRyaInstance());
-
- final Entity alice = entities.get(aliceSSN).get();
- final Entity bob = entities.get(bobSSN).get();
- final Set<Entity> storedEntities = Sets.newHashSet(alice, bob);
-
- final Entity expectedAlice = Entity.builder()
- .setSubject(aliceSSN)
- .setExplicitType(new RyaURI("urn:person"))
- .setProperty(new RyaURI("urn:person"), new Property(new RyaURI("urn:name"), new RyaType(XMLSchema.STRING, "Alice")))
- .setProperty(new RyaURI("urn:person"), new Property(new RyaURI("urn:age"), new RyaType(XMLSchema.INT, "30")))
- .setProperty(new RyaURI("urn:person"), new Property(new RyaURI("urn:eye"), new RyaType(XMLSchema.STRING, "blue")))
- .setProperty(new RyaURI("urn:employee"), new Property(new RyaURI("urn:name"), new RyaType(XMLSchema.STRING, "Alice")))
- .setVersion( alice.getVersion() )
- .build();
- final Entity expectedBob = Entity.builder()
- .setSubject(bobSSN)
- .setExplicitType(new RyaURI("urn:employee"))
- .setProperty(new RyaURI("urn:employee"), new Property(new RyaURI("urn:name"), new RyaType(XMLSchema.STRING, "Bob")))
- .setProperty(new RyaURI("urn:employee"), new Property(new RyaURI("urn:hoursPerWeek"), new RyaType(XMLSchema.INT, "40")))
- .setProperty(new RyaURI("urn:person"), new Property(new RyaURI("urn:name"), new RyaType(XMLSchema.STRING, "Bob")))
- .setVersion( bob.getVersion() )
- .build();
- final Set<Entity> expected = Sets.newHashSet(expectedAlice, expectedBob);
-
- assertEquals(expected, storedEntities);
- }
- }
-
- @Test
- public void deleteStatement_deletesType() throws Exception {
- try(MongoEntityIndexer indexer = new MongoEntityIndexer()) {
- indexer.setConf(conf);
- indexer.init();
- // Load the type into the TypeStorage.
- final TypeStorage types = new MongoTypeStorage(getMongoClient(), conf.getRyaInstance());
- types.create(PERSON_TYPE);
- types.create(EMPLOYEE_TYPE);
-
- // Index a bunch of RyaStatements.
- final RyaURI aliceSSN = new RyaURI("urn:SSN/111-11-1111");
-
- indexer.storeStatements(Sets.newHashSet(
- new RyaStatement(aliceSSN, new RyaURI( RDF.TYPE.toString() ), new RyaType(XMLSchema.ANYURI, "urn:person")),
- new RyaStatement(aliceSSN, new RyaURI("urn:name"), new RyaType(XMLSchema.STRING, "Alice")),
- new RyaStatement(aliceSSN, new RyaURI("urn:age"), new RyaType(XMLSchema.INT, "30")),
- new RyaStatement(aliceSSN, new RyaURI("urn:eye"), new RyaType(XMLSchema.STRING, "blue"))));
-
- // Remove the explicit type from Alice.
- indexer.deleteStatement(new RyaStatement(aliceSSN, new RyaURI( RDF.TYPE.toString() ), new RyaType(XMLSchema.ANYURI, "urn:person")));
-
- // Fetch the Entity from storage and ensure it looks correct.
- final EntityStorage entities = new MongoEntityStorage(getMongoClient(), conf.getRyaInstance());
- final Entity entity = entities.get(new RyaURI("urn:SSN/111-11-1111")).get();
-
- final Entity expected = Entity.builder()
- .setSubject(aliceSSN)
- .setProperty(new RyaURI("urn:person"), new Property(new RyaURI("urn:name"), new RyaType(XMLSchema.STRING, "Alice")))
- .setProperty(new RyaURI("urn:person"), new Property(new RyaURI("urn:age"), new RyaType(XMLSchema.INT, "30")))
- .setProperty(new RyaURI("urn:person"), new Property(new RyaURI("urn:eye"), new RyaType(XMLSchema.STRING, "blue")))
- .setProperty(new RyaURI("urn:employee"), new Property(new RyaURI("urn:name"), new RyaType(XMLSchema.STRING, "Alice")))
- .setVersion( entity.getVersion() )
- .build();
-
- assertEquals(expected, entity);
- }
- }
-
- @Test
- public void deleteStatement_deletesProperty() throws Exception {
- try(MongoEntityIndexer indexer = new MongoEntityIndexer()) {
- indexer.setConf(conf);
- indexer.init();
- // Load the type into the TypeStorage.
- final TypeStorage types = new MongoTypeStorage(getMongoClient(), conf.getRyaInstance());
- types.create(PERSON_TYPE);
- types.create(EMPLOYEE_TYPE);
-
- // Index a bunch of RyaStatements.
- final RyaURI aliceSSN = new RyaURI("urn:SSN/111-11-1111");
-
- indexer.storeStatements(Sets.newHashSet(
- new RyaStatement(aliceSSN, new RyaURI( RDF.TYPE.toString() ), new RyaType(XMLSchema.ANYURI, "urn:person")),
- new RyaStatement(aliceSSN, new RyaURI("urn:name"), new RyaType(XMLSchema.STRING, "Alice")),
- new RyaStatement(aliceSSN, new RyaURI("urn:age"), new RyaType(XMLSchema.INT, "30")),
- new RyaStatement(aliceSSN, new RyaURI("urn:eye"), new RyaType(XMLSchema.STRING, "blue"))));
-
- // Remove the name property from Alice.
- indexer.deleteStatement(new RyaStatement(aliceSSN, new RyaURI("urn:name"), new RyaType(XMLSchema.STRING, "Alice")));
-
- // Fetch the Entity from storage and ensure it looks correct.
- final EntityStorage entities = new MongoEntityStorage(getMongoClient(), conf.getRyaInstance());
- final Entity entity = entities.get(new RyaURI("urn:SSN/111-11-1111")).get();
-
- final Entity expected = Entity.builder()
- .setSubject(aliceSSN)
- .setExplicitType(new RyaURI("urn:person"))
- .setProperty(new RyaURI("urn:person"), new Property(new RyaURI("urn:age"), new RyaType(XMLSchema.INT, "30")))
- .setProperty(new RyaURI("urn:person"), new Property(new RyaURI("urn:eye"), new RyaType(XMLSchema.STRING, "blue")))
- .setVersion( entity.getVersion() )
- .build();
-
- assertEquals(expected, entity);
- }
- }
+ private static final Type PERSON_TYPE =
+ new Type(new RyaURI("urn:person"),
+ ImmutableSet.<RyaURI>builder()
+ .add(new RyaURI("urn:name"))
+ .add(new RyaURI("urn:age"))
+ .add(new RyaURI("urn:eye"))
+ .build());
+
+ private static final Type EMPLOYEE_TYPE =
+ new Type(new RyaURI("urn:employee"),
+ ImmutableSet.<RyaURI>builder()
+ .add(new RyaURI("urn:name"))
+ .add(new RyaURI("urn:hoursPerWeek"))
+ .build());
+
+ @Test
+ public void addStatement_setsType() throws Exception {
+ try(MongoEntityIndexer indexer = new MongoEntityIndexer()) {
+ indexer.setConf(conf);
+ indexer.init();
+ // Load a type into the TypeStorage.
+ final TypeStorage types = new MongoTypeStorage(getMongoClient(), conf.getRyaInstanceName());
+ types.create(PERSON_TYPE);
+
+ // Index a RyaStatement that will create an Entity with an explicit type.
+ final RyaStatement statement = new RyaStatement(new RyaURI("urn:SSN/111-11-1111"), new RyaURI( RDF.TYPE.toString() ), new RyaType(XMLSchema.ANYURI, "urn:person"));
+ indexer.storeStatement(statement);
+
+ // Fetch the Entity from storage and ensure it looks correct.
+ final EntityStorage entities = new MongoEntityStorage(getMongoClient(), conf.getRyaInstanceName());
+ final Entity entity = entities.get(new RyaURI("urn:SSN/111-11-1111")).get();
+
+ final Entity expected = Entity.builder()
+ .setSubject(new RyaURI("urn:SSN/111-11-1111"))
+ .setExplicitType(new RyaURI("urn:person"))
+ .build();
+
+ assertEquals(expected, entity);
+ }
+ }
+
+ @Test
+ public void addStatement_setsProperty() throws Exception {
+ try(MongoEntityIndexer indexer = new MongoEntityIndexer()) {
+ indexer.setConf(conf);
+ indexer.init();
+ // Load the types into the TypeStorage.
+ final TypeStorage types = new MongoTypeStorage(getMongoClient(), conf.getRyaInstanceName());
+ types.create(PERSON_TYPE);
+ types.create(EMPLOYEE_TYPE);
+
+ // Index a RyaStatement that will create an Entity with two implicit types.
+ final RyaStatement statement = new RyaStatement(new RyaURI("urn:SSN/111-11-1111"), new RyaURI("urn:name"), new RyaType(XMLSchema.STRING, "Alice"));
+ indexer.storeStatement(statement);
+
+ // Fetch the Entity from storage and ensure it looks correct.
+ final EntityStorage entities = new MongoEntityStorage(getMongoClient(), conf.getRyaInstanceName());
+ final Entity entity = entities.get(new RyaURI("urn:SSN/111-11-1111")).get();
+
+ final Entity expected = Entity.builder()
+ .setSubject(new RyaURI("urn:SSN/111-11-1111"))
+ .setProperty(new RyaURI("urn:person"), new Property(new RyaURI("urn:name"), new RyaType(XMLSchema.STRING, "Alice")))
+ .setProperty(new RyaURI("urn:employee"), new Property(new RyaURI("urn:name"), new RyaType(XMLSchema.STRING, "Alice")))
+ .build();
+
+ assertEquals(expected, entity);
+ }
+ }
+
+ @Test
+ public void addStatement_manyUpdates() throws Exception {
+ try(MongoEntityIndexer indexer = new MongoEntityIndexer()) {
+ indexer.setConf(conf);
+ indexer.init();
+ // Load the types into the TypeStorage.
+ final TypeStorage types = new MongoTypeStorage(getMongoClient(), conf.getRyaInstanceName());
+ types.create(PERSON_TYPE);
+ types.create(EMPLOYEE_TYPE);
+
+ // Index a bunch of RyaStatements.
+ final RyaURI aliceSSN = new RyaURI("urn:SSN/111-11-1111");
+ indexer.storeStatement(new RyaStatement(aliceSSN, new RyaURI( RDF.TYPE.toString() ), new RyaType(XMLSchema.ANYURI, "urn:person")));
+ indexer.storeStatement(new RyaStatement(aliceSSN, new RyaURI("urn:name"), new RyaType(XMLSchema.STRING, "Alice")));
+ indexer.storeStatement(new RyaStatement(aliceSSN, new RyaURI("urn:age"), new RyaType(XMLSchema.INT, "30")));
+ indexer.storeStatement(new RyaStatement(aliceSSN, new RyaURI("urn:eye"), new RyaType(XMLSchema.STRING, "blue")));
+
+ // Fetch the Entity from storage and ensure it looks correct.
+ final EntityStorage entities = new MongoEntityStorage(getMongoClient(), conf.getRyaInstanceName());
+ final Entity entity = entities.get(new RyaURI("urn:SSN/111-11-1111")).get();
+
+ final Entity expected = Entity.builder()
+ .setSubject(aliceSSN)
+ .setExplicitType(new RyaURI("urn:person"))
+ .setProperty(new RyaURI("urn:person"), new Property(new RyaURI("urn:name"), new RyaType(XMLSchema.STRING, "Alice")))
+ .setProperty(new RyaURI("urn:person"), new Property(new RyaURI("urn:age"), new RyaType(XMLSchema.INT, "30")))
+ .setProperty(new RyaURI("urn:person"), new Property(new RyaURI("urn:eye"), new RyaType(XMLSchema.STRING, "blue")))
+ .setProperty(new RyaURI("urn:employee"), new Property(new RyaURI("urn:name"), new RyaType(XMLSchema.STRING, "Alice")))
+ .setVersion( entity.getVersion() )
+ .build();
+
+ assertEquals(expected, entity);
+ }
+ }
+
+ @Test
+ public void addStatements() throws Exception {
+ try(MongoEntityIndexer indexer = new MongoEntityIndexer()) {
+ indexer.setConf(conf);
+ indexer.init();
+ // Load the types into the TypeStorage.
+ final TypeStorage types = new MongoTypeStorage(getMongoClient(), conf.getRyaInstanceName());
+ types.create(PERSON_TYPE);
+ types.create(EMPLOYEE_TYPE);
+
+ // Index a bunch of RyaStatements.
+ final RyaURI aliceSSN = new RyaURI("urn:SSN/111-11-1111");
+ final RyaURI bobSSN = new RyaURI("urn:SSN/222-22-2222");
+
+ indexer.storeStatements(Sets.newHashSet(
+ new RyaStatement(aliceSSN, new RyaURI( RDF.TYPE.toString() ), new RyaType(XMLSchema.ANYURI, "urn:person")),
+ new RyaStatement(aliceSSN, new RyaURI("urn:name"), new RyaType(XMLSchema.STRING, "Alice")),
+ new RyaStatement(aliceSSN, new RyaURI("urn:age"), new RyaType(XMLSchema.INT, "30")),
+ new RyaStatement(aliceSSN, new RyaURI("urn:eye"), new RyaType(XMLSchema.STRING, "blue")),
+
+ new RyaStatement(bobSSN, new RyaURI("urn:name"), new RyaType(XMLSchema.STRING, "Bob")),
+ new RyaStatement(bobSSN, new RyaURI("urn:hoursPerWeek"), new RyaType(XMLSchema.INT, "40")),
+ new RyaStatement(bobSSN, new RyaURI( RDF.TYPE.toString() ), new RyaType(XMLSchema.ANYURI, "urn:employee"))));
+
+ // Fetch the Entity from storage and ensure it looks correct.
+ final EntityStorage entities = new MongoEntityStorage(getMongoClient(), conf.getRyaInstanceName());
+
+ final Entity alice = entities.get(aliceSSN).get();
+ final Entity bob = entities.get(bobSSN).get();
+ final Set<Entity> storedEntities = Sets.newHashSet(alice, bob);
+
+ final Entity expectedAlice = Entity.builder()
+ .setSubject(aliceSSN)
+ .setExplicitType(new RyaURI("urn:person"))
+ .setProperty(new RyaURI("urn:person"), new Property(new RyaURI("urn:name"), new RyaType(XMLSchema.STRING, "Alice")))
+ .setProperty(new RyaURI("urn:person"), new Property(new RyaURI("urn:age"), new RyaType(XMLSchema.INT, "30")))
+ .setProperty(new RyaURI("urn:person"), new Property(new RyaURI("urn:eye"), new RyaType(XMLSchema.STRING, "blue")))
+ .setProperty(new RyaURI("urn:employee"), new Property(new RyaURI("urn:name"), new RyaType(XMLSchema.STRING, "Alice")))
+ .setVersion( alice.getVersion() )
+ .build();
+ final Entity expectedBob = Entity.builder()
+ .setSubject(bobSSN)
+ .setExplicitType(new RyaURI("urn:employee"))
+ .setProperty(new RyaURI("urn:employee"), new Property(new RyaURI("urn:name"), new RyaType(XMLSchema.STRING, "Bob")))
+ .setProperty(new RyaURI("urn:employee"), new Property(new RyaURI("urn:hoursPerWeek"), new RyaType(XMLSchema.INT, "40")))
+ .setProperty(new RyaURI("urn:person"), new Property(new RyaURI("urn:name"), new RyaType(XMLSchema.STRING, "Bob")))
+ .setVersion( bob.getVersion() )
+ .build();
+ final Set<Entity> expected = Sets.newHashSet(expectedAlice, expectedBob);
+
+ assertEquals(expected, storedEntities);
+ }
+ }
+
+ @Test
+ public void deleteStatement_deletesType() throws Exception {
+ try(MongoEntityIndexer indexer = new MongoEntityIndexer()) {
+ indexer.setConf(conf);
+ indexer.init();
+ // Load the type into the TypeStorage.
+ final TypeStorage types = new MongoTypeStorage(getMongoClient(), conf.getRyaInstanceName());
+ types.create(PERSON_TYPE);
+ types.create(EMPLOYEE_TYPE);
+
+ // Index a bunch of RyaStatements.
+ final RyaURI aliceSSN = new RyaURI("urn:SSN/111-11-1111");
+
+ indexer.storeStatements(Sets.newHashSet(
+ new RyaStatement(aliceSSN, new RyaURI( RDF.TYPE.toString() ), new RyaType(XMLSchema.ANYURI, "urn:person")),
+ new RyaStatement(aliceSSN, new RyaURI("urn:name"), new RyaType(XMLSchema.STRING, "Alice")),
+ new RyaStatement(aliceSSN, new RyaURI("urn:age"), new RyaType(XMLSchema.INT, "30")),
+ new RyaStatement(aliceSSN, new RyaURI("urn:eye"), new RyaType(XMLSchema.STRING, "blue"))));
+
+ // Remove the explicit type from Alice.
+ indexer.deleteStatement(new RyaStatement(aliceSSN, new RyaURI( RDF.TYPE.toString() ), new RyaType(XMLSchema.ANYURI, "urn:person")));
+
+ // Fetch the Entity from storage and ensure it looks correct.
+ final EntityStorage entities = new MongoEntityStorage(getMongoClient(), conf.getRyaInstanceName());
+ final Entity entity = entities.get(new RyaURI("urn:SSN/111-11-1111")).get();
+
+ final Entity expected = Entity.builder()
+ .setSubject(aliceSSN)
+ .setProperty(new RyaURI("urn:person"), new Property(new RyaURI("urn:name"), new RyaType(XMLSchema.STRING, "Alice")))
+ .setProperty(new RyaURI("urn:person"), new Property(new RyaURI("urn:age"), new RyaType(XMLSchema.INT, "30")))
+ .setProperty(new RyaURI("urn:person"), new Property(new RyaURI("urn:eye"), new RyaType(XMLSchema.STRING, "blue")))
+ .setProperty(new RyaURI("urn:employee"), new Property(new RyaURI("urn:name"), new RyaType(XMLSchema.STRING, "Alice")))
+ .setVersion( entity.getVersion() )
+ .build();
+
+ assertEquals(expected, entity);
+ }
+ }
+
+ @Test
+ public void deleteStatement_deletesProperty() throws Exception {
+ try(MongoEntityIndexer indexer = new MongoEntityIndexer()) {
+ indexer.setConf(conf);
+ indexer.init();
+ // Load the type into the TypeStorage.
+ final TypeStorage types = new MongoTypeStorage(getMongoClient(), conf.getRyaInstanceName());
+ types.create(PERSON_TYPE);
+ types.create(EMPLOYEE_TYPE);
+
+ // Index a bunch of RyaStatements.
+ final RyaURI aliceSSN = new RyaURI("urn:SSN/111-11-1111");
+
+ indexer.storeStatements(Sets.newHashSet(
+ new RyaStatement(aliceSSN, new RyaURI( RDF.TYPE.toString() ), new RyaType(XMLSchema.ANYURI, "urn:person")),
+ new RyaStatement(aliceSSN, new RyaURI("urn:name"), new RyaType(XMLSchema.STRING, "Alice")),
+ new RyaStatement(aliceSSN, new RyaURI("urn:age"), new RyaType(XMLSchema.INT, "30")),
+ new RyaStatement(aliceSSN, new RyaURI("urn:eye"), new RyaType(XMLSchema.STRING, "blue"))));
+
+ // Remove the name property from Alice.
+ indexer.deleteStatement(new RyaStatement(aliceSSN, new RyaURI("urn:name"), new RyaType(XMLSchema.STRING, "Alice")));
+
+ // Fetch the Entity from storage and ensure it looks correct.
+ final EntityStorage entities = new MongoEntityStorage(getMongoClient(), conf.getRyaInstanceName());
+ final Entity entity = entities.get(new RyaURI("urn:SSN/111-11-1111")).get();
+
+ final Entity expected = Entity.builder()
+ .setSubject(aliceSSN)
+ .setExplicitType(new RyaURI("urn:person"))
+ .setProperty(new RyaURI("urn:person"), new Property(new RyaURI("urn:age"), new RyaType(XMLSchema.INT, "30")))
+ .setProperty(new RyaURI("urn:person"), new Property(new RyaURI("urn:eye"), new RyaType(XMLSchema.STRING, "blue")))
+ .setVersion( entity.getVersion() )
+ .build();
+
+ assertEquals(expected, entity);
+ }
+ }
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/157c0649/extras/indexing/src/test/java/org/apache/rya/indexing/mongo/MongoEntityIndexIT.java
----------------------------------------------------------------------
diff --git a/extras/indexing/src/test/java/org/apache/rya/indexing/mongo/MongoEntityIndexIT.java b/extras/indexing/src/test/java/org/apache/rya/indexing/mongo/MongoEntityIndexIT.java
index c33a5bb..e476874 100644
--- a/extras/indexing/src/test/java/org/apache/rya/indexing/mongo/MongoEntityIndexIT.java
+++ b/extras/indexing/src/test/java/org/apache/rya/indexing/mongo/MongoEntityIndexIT.java
@@ -67,8 +67,8 @@ public class MongoEntityIndexIT extends MongoTestBase {
conn.begin();
try(MongoEntityIndexer indexer = new MongoEntityIndexer()) {
- indexer.setConf(conf);
- indexer.init();
+ indexer.setConf(conf);
+ indexer.init();
setupTypes(indexer);
addStatements(conn);
@@ -89,9 +89,9 @@ public class MongoEntityIndexIT extends MongoTestBase {
conn.begin();
try(MongoEntityIndexer indexer = new MongoEntityIndexer()) {
- indexer.setConf(conf);
- indexer.init();
-
+ indexer.setConf(conf);
+ indexer.init();
+
setupTypes(indexer);
addStatements(conn);
@@ -125,9 +125,9 @@ public class MongoEntityIndexIT extends MongoTestBase {
conn.begin();
try(MongoEntityIndexer indexer = new MongoEntityIndexer()) {
- indexer.setConf(conf);
- indexer.init();
-
+ indexer.setConf(conf);
+ indexer.init();
+
setupTypes(indexer);
addStatements(conn);
conn.commit();
@@ -136,7 +136,7 @@ public class MongoEntityIndexIT extends MongoTestBase {
"<urn:george> <" + RDF.TYPE + "> <urn:person> ."+
"<urn:george> <urn:name> ?name . " +
"<urn:george> <urn:eye> ?eye . " +
- "}";
+ "}";
final TupleQueryResult rez = conn.prepareTupleQuery(QueryLanguage.SPARQL, query).evaluate();
final Set<BindingSet> results = new HashSet<>();
@@ -163,31 +163,31 @@ public class MongoEntityIndexIT extends MongoTestBase {
// Add some Types to the storage.
final Type cat = new Type(new RyaURI("urn:cat"),
ImmutableSet.<RyaURI>builder()
- .add(new RyaURI("urn:numLegs"))
- .add(new RyaURI("urn:eye"))
- .add(new RyaURI("urn:species"))
- .build());
+ .add(new RyaURI("urn:numLegs"))
+ .add(new RyaURI("urn:eye"))
+ .add(new RyaURI("urn:species"))
+ .build());
final Type dog = new Type(new RyaURI("urn:dog"),
ImmutableSet.<RyaURI>builder()
- .add(new RyaURI("urn:numLegs"))
- .add(new RyaURI("urn:eye"))
- .add(new RyaURI("urn:species"))
- .build());
+ .add(new RyaURI("urn:numLegs"))
+ .add(new RyaURI("urn:eye"))
+ .add(new RyaURI("urn:species"))
+ .build());
final Type icecream = new Type(new RyaURI("urn:icecream"),
ImmutableSet.<RyaURI>builder()
- .add(new RyaURI("urn:brand"))
- .add(new RyaURI("urn:flavor"))
- .add(new RyaURI("urn:cost"))
- .build());
+ .add(new RyaURI("urn:brand"))
+ .add(new RyaURI("urn:flavor"))
+ .add(new RyaURI("urn:cost"))
+ .build());
final Type person = new Type(new RyaURI("urn:person"),
ImmutableSet.<RyaURI>builder()
- .add(new RyaURI("urn:name"))
- .add(new RyaURI("urn:age"))
- .add(new RyaURI("urn:eye"))
- .build());
+ .add(new RyaURI("urn:name"))
+ .add(new RyaURI("urn:age"))
+ .add(new RyaURI("urn:eye"))
+ .build());
typeStore.create(cat);
typeStore.create(dog);
http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/157c0649/extras/indexing/src/test/java/org/apache/rya/indexing/mongo/MongoIndexingConfigurationTest.java
----------------------------------------------------------------------
diff --git a/extras/indexing/src/test/java/org/apache/rya/indexing/mongo/MongoIndexingConfigurationTest.java b/extras/indexing/src/test/java/org/apache/rya/indexing/mongo/MongoIndexingConfigurationTest.java
index 1f083f2..708219c 100644
--- a/extras/indexing/src/test/java/org/apache/rya/indexing/mongo/MongoIndexingConfigurationTest.java
+++ b/extras/indexing/src/test/java/org/apache/rya/indexing/mongo/MongoIndexingConfigurationTest.java
@@ -72,7 +72,7 @@ public class MongoIndexingConfigurationTest {
assertEquals(conf.getBoolean(".useMockInstance", false), useMock);
assertEquals(conf.getMongoPort(), "1000");
assertEquals(conf.getMongoDBName(), "dbname");
- assertEquals(conf.getRyaInstance(), "prefix_");
+ assertEquals(conf.getRyaInstanceName(), "prefix_");
assertEquals(conf.get(MongoDBRdfConfiguration.MONGO_USER), user);
assertEquals(conf.get(MongoDBRdfConfiguration.MONGO_USER_PASSWORD), password);
assertTrue(
@@ -107,7 +107,7 @@ public class MongoIndexingConfigurationTest {
assertEquals(conf.getBoolean(".useMockInstance", false), useMock);
assertEquals(conf.getMongoPort(), "1000");
assertEquals(conf.getMongoDBName(), "dbname");
- assertEquals(conf.getRyaInstance(), "prefix_");
+ assertEquals(conf.getRyaInstanceName(), "prefix_");
assertEquals(conf.get(MongoDBRdfConfiguration.MONGO_USER), user);
assertEquals(conf.get(MongoDBRdfConfiguration.MONGO_USER_PASSWORD), password);
assertTrue(
http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/157c0649/extras/indexing/src/test/java/org/apache/rya/indexing/mongo/MongoTemporalIndexerTest.java
----------------------------------------------------------------------
diff --git a/extras/indexing/src/test/java/org/apache/rya/indexing/mongo/MongoTemporalIndexerTest.java b/extras/indexing/src/test/java/org/apache/rya/indexing/mongo/MongoTemporalIndexerTest.java
index ec7d1ec..0f8497e 100644
--- a/extras/indexing/src/test/java/org/apache/rya/indexing/mongo/MongoTemporalIndexerTest.java
+++ b/extras/indexing/src/test/java/org/apache/rya/indexing/mongo/MongoTemporalIndexerTest.java
@@ -40,7 +40,6 @@ import org.apache.rya.indexing.accumulo.ConfigUtils;
import org.apache.rya.indexing.mongodb.temporal.MongoTemporalIndexer;
import org.apache.rya.mongodb.MongoDBRdfConfiguration;
import org.apache.rya.mongodb.MongoTestBase;
-import org.junit.Before;
import org.junit.Test;
import org.openrdf.model.Statement;
import org.openrdf.model.URI;
@@ -80,13 +79,10 @@ import info.aduna.iteration.CloseableIteration;
*
*/
public final class MongoTemporalIndexerTest extends MongoTestBase {
-// private MongoTemporalIndexer tIndexer;
-// private DBCollection collection;
private static final String URI_PROPERTY_EVENT_TIME = "Property:event:time";
private static final String URI_PROPERTY_CIRCA = "Property:circa";
private static final String URI_PROPERTY_AT_TIME = "Property:atTime";
-// private static final String STAT_VALUEHASH = "valuehash";
private static final StatementConstraints EMPTY_CONSTRAINTS = new StatementConstraints();
// Assign this in setUpBeforeClass, store them in each test.
@@ -162,25 +158,6 @@ public final class MongoTemporalIndexerTest extends MongoTestBase {
}
}
- @Before
- public void before() throws Exception {
-// // This is from http://linkedevents.org/ontology
-// // and http://motools.sourceforge.net/event/event.html
-// conf.setStrings(ConfigUtils.TEMPORAL_PREDICATES_LIST, ""
-// + URI_PROPERTY_AT_TIME + ","
-// + URI_PROPERTY_CIRCA + ","
-// + URI_PROPERTY_EVENT_TIME);
-
-// tIndexer
-// tIndexer.setConf(conf);
-// tIndexer.init();
-//// tIndexer.initIndexer(conf, super.getMongoClient());
-
-// final String dbName = conf.get(MongoDBRdfConfiguration.MONGO_DB_NAME);
-// final DB db = super.getMongoClient().getDB(dbName);
-// collection = db.getCollection(conf.get(MongoDBRdfConfiguration.MONGO_COLLECTION_PREFIX, "rya") + tIndexer.getCollectionName());
- }
-
@Override
protected void updateConfiguration(final MongoDBRdfConfiguration conf) {
// This is from http://linkedevents.org/ontology