RYA-489 Moved common Accumulo integration test code to the rya.test.accumulo project. Closes #292
diff --git a/dao/accumulo.rya/pom.xml b/dao/accumulo.rya/pom.xml
index 03f4dc7..19e01d5 100644
--- a/dao/accumulo.rya/pom.xml
+++ b/dao/accumulo.rya/pom.xml
@@ -61,7 +61,8 @@
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
- </dependency>
+ </dependency>
+
<!-- testing dependencies -->
<dependency>
<groupId>org.eclipse.rdf4j</groupId>
@@ -80,29 +81,13 @@
<scope>test</scope>
</dependency>
<dependency>
- <groupId>org.apache.accumulo</groupId>
- <artifactId>accumulo-minicluster</artifactId>
+ <groupId>org.apache.rya</groupId>
+ <artifactId>rya.test.accumulo</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
- <plugins>
- <plugin>
- <!-- generate the test jar as well so it can be reused by dependent tools.
- TODO this is messy. in the future, classes that provide this functionality
- should be decoupled into reusable frameworks. -->
- <artifactId>maven-jar-plugin</artifactId>
- <executions>
- <execution>
- <goals>
- <goal>test-jar</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
-
<pluginManagement>
<plugins>
<plugin>
@@ -133,10 +118,9 @@
</configuration>
</execution>
</executions>
-
</plugin>
</plugins>
</build>
</profile>
</profiles>
-</project>
+</project>
\ No newline at end of file
diff --git a/dao/accumulo.rya/src/test/java/org/apache/rya/accumulo/AccumuloRyaITBase.java b/dao/accumulo.rya/src/test/java/org/apache/rya/accumulo/AccumuloRyaITBase.java
deleted file mode 100644
index 41d5cea..0000000
--- a/dao/accumulo.rya/src/test/java/org/apache/rya/accumulo/AccumuloRyaITBase.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/**
- * 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.accumulo;
-
-import org.junit.Rule;
-
-/**
- * Contains boilerplate code for spinning up a Mini Accumulo Cluster and initializing
- * some of the Rya stuff. We can not actually initialize an instance of Rya here
- * because Sail is not available to us.
- */
-public class AccumuloRyaITBase {
-
- @Rule
- public RyaTestInstanceRule testInstance = new RyaTestInstanceRule(true);
-
- /**
- * @return The {@link MiniAccumuloClusterInstance} used by the tests.
- */
- public MiniAccumuloClusterInstance getClusterInstance() {
- return MiniAccumuloSingleton.getInstance();
- }
-
- /**
- * @return The name of the Rya instance that is being used for the current test.
- */
- public String getRyaInstanceName() {
- return testInstance.getRyaInstanceName();
- }
-}
\ No newline at end of file
diff --git a/dao/accumulo.rya/src/test/java/org/apache/rya/accumulo/RyaTestInstanceRule.java b/dao/accumulo.rya/src/test/java/org/apache/rya/accumulo/RyaTestInstanceRule.java
deleted file mode 100644
index 3bbceb9..0000000
--- a/dao/accumulo.rya/src/test/java/org/apache/rya/accumulo/RyaTestInstanceRule.java
+++ /dev/null
@@ -1,93 +0,0 @@
-package org.apache.rya.accumulo;
-
-import java.util.concurrent.atomic.AtomicInteger;
-
-import org.apache.rya.accumulo.instance.AccumuloRyaInstanceDetailsRepository;
-import org.apache.rya.api.instance.RyaDetails;
-import org.apache.rya.api.instance.RyaDetails.EntityCentricIndexDetails;
-import org.apache.rya.api.instance.RyaDetails.FreeTextIndexDetails;
-import org.apache.rya.api.instance.RyaDetails.JoinSelectivityDetails;
-import org.apache.rya.api.instance.RyaDetails.PCJIndexDetails;
-import org.apache.rya.api.instance.RyaDetails.ProspectorDetails;
-import org.apache.rya.api.instance.RyaDetails.TemporalIndexDetails;
-import org.apache.rya.api.instance.RyaDetailsRepository;
-import org.junit.rules.ExternalResource;
-
-import com.google.common.base.Optional;
-
-/**
- * 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.
- */
-public class RyaTestInstanceRule extends ExternalResource {
-
- private static final MiniAccumuloClusterInstance cluster = MiniAccumuloSingleton.getInstance();
- private static final AtomicInteger ryaInstanceNameCounter = new AtomicInteger(1);
- private static final AtomicInteger userId = new AtomicInteger(1);
-
- private final boolean install;
- private String ryaInstanceName;
-
- public RyaTestInstanceRule(boolean install) {
- this.install = install;
- }
-
- public String getRyaInstanceName() {
- if (ryaInstanceName == null) {
- throw new IllegalStateException("Cannot get rya instance name outside of a test execution.");
- }
- return ryaInstanceName;
- }
-
- public String createUniqueUser() {
- int id = userId.getAndIncrement();
- return "user_" + id;
- }
-
- @Override
- protected void before() throws Throwable {
-
- // Get the next Rya instance name.
- ryaInstanceName = "testInstance_" + ryaInstanceNameCounter.getAndIncrement();
-
- if (install) {
- // Create Rya Details for the instance name.
- final RyaDetailsRepository detailsRepo = new AccumuloRyaInstanceDetailsRepository(cluster.getConnector(), ryaInstanceName);
-
- final RyaDetails details = RyaDetails.builder()
- .setRyaInstanceName(ryaInstanceName)
- .setRyaVersion("0.0.0.0")
- .setFreeTextDetails(new FreeTextIndexDetails(true))
- .setEntityCentricIndexDetails(new EntityCentricIndexDetails(true))
- //RYA-215 .setGeoIndexDetails( new GeoIndexDetails(true) )
- .setTemporalIndexDetails(new TemporalIndexDetails(true))
- .setPCJIndexDetails(PCJIndexDetails.builder().setEnabled(true))
- .setJoinSelectivityDetails(new JoinSelectivityDetails(Optional.absent()))
- .setProspectorDetails(new ProspectorDetails(Optional.absent()))
- .build();
-
- detailsRepo.initialize(details);
- }
- }
-
- @Override
- protected void after() {
- ryaInstanceName = null;
- // TODO consider teardown of instance (probably requires additional features)
- }
-
-}
diff --git a/dao/accumulo.rya/src/test/java/org/apache/rya/accumulo/instance/AccumuloRyaDetailsRepositoryIT.java b/dao/accumulo.rya/src/test/java/org/apache/rya/accumulo/instance/AccumuloRyaDetailsRepositoryIT.java
index 93ae174..ff0df6b 100644
--- a/dao/accumulo.rya/src/test/java/org/apache/rya/accumulo/instance/AccumuloRyaDetailsRepositoryIT.java
+++ b/dao/accumulo.rya/src/test/java/org/apache/rya/accumulo/instance/AccumuloRyaDetailsRepositoryIT.java
@@ -28,8 +28,6 @@
import org.apache.accumulo.core.client.AccumuloSecurityException;
import org.apache.accumulo.core.client.Connector;
import org.apache.accumulo.minicluster.MiniAccumuloCluster;
-import org.apache.rya.accumulo.AccumuloITBase;
-import org.apache.rya.accumulo.MiniAccumuloClusterInstance;
import org.apache.rya.api.instance.RyaDetails;
import org.apache.rya.api.instance.RyaDetails.EntityCentricIndexDetails;
import org.apache.rya.api.instance.RyaDetails.FreeTextIndexDetails;
@@ -45,6 +43,8 @@
import org.apache.rya.api.instance.RyaDetailsRepository.ConcurrentUpdateException;
import org.apache.rya.api.instance.RyaDetailsRepository.NotInitializedException;
import org.apache.rya.api.instance.RyaDetailsRepository.RyaDetailsRepositoryException;
+import org.apache.rya.test.accumulo.AccumuloITBase;
+import org.apache.rya.test.accumulo.MiniAccumuloClusterInstance;
import org.junit.Test;
import com.google.common.base.Optional;
diff --git a/extras/indexing/pom.xml b/extras/indexing/pom.xml
index 357c552..3adc823 100644
--- a/extras/indexing/pom.xml
+++ b/extras/indexing/pom.xml
@@ -102,28 +102,21 @@
<scope>test</scope>
</dependency>
<dependency>
- <groupId>org.apache.accumulo</groupId>
- <artifactId>accumulo-minicluster</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
<groupId>org.apache.fluo</groupId>
<artifactId>fluo-mini</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.rya</groupId>
- <artifactId>accumulo.rya</artifactId>
- <type>test-jar</type>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.rya</groupId>
<artifactId>mongodb.rya</artifactId>
<type>test-jar</type>
<scope>test</scope>
</dependency>
-
+ <dependency>
+ <groupId>org.apache.rya</groupId>
+ <artifactId>rya.test.accumulo</artifactId>
+ <scope>test</scope>
+ </dependency>
</dependencies>
<build>
<pluginManagement>
diff --git a/extras/indexing/src/test/java/org/apache/rya/api/client/accumulo/AccumuloAddUserIT.java b/extras/indexing/src/test/java/org/apache/rya/api/client/accumulo/AccumuloAddUserIT.java
index ed359f4..f7da7b8 100644
--- a/extras/indexing/src/test/java/org/apache/rya/api/client/accumulo/AccumuloAddUserIT.java
+++ b/extras/indexing/src/test/java/org/apache/rya/api/client/accumulo/AccumuloAddUserIT.java
@@ -25,13 +25,13 @@
import org.apache.accumulo.core.client.admin.SecurityOperations;
import org.apache.accumulo.core.client.security.tokens.PasswordToken;
import org.apache.accumulo.core.security.SystemPermission;
-import org.apache.rya.accumulo.AccumuloITBase;
import org.apache.rya.accumulo.AccumuloRdfConfiguration;
import org.apache.rya.api.client.Install.InstallConfiguration;
import org.apache.rya.api.client.RyaClient;
import org.apache.rya.api.instance.RyaDetails;
import org.apache.rya.indexing.accumulo.ConfigUtils;
import org.apache.rya.sail.config.RyaSailFactory;
+import org.apache.rya.test.accumulo.AccumuloITBase;
import org.eclipse.rdf4j.model.ValueFactory;
import org.eclipse.rdf4j.sail.Sail;
import org.eclipse.rdf4j.sail.SailConnection;
diff --git a/extras/indexing/src/test/java/org/apache/rya/api/client/accumulo/AccumuloBatchUpdatePCJIT.java b/extras/indexing/src/test/java/org/apache/rya/api/client/accumulo/AccumuloBatchUpdatePCJIT.java
index 2a6fbd5..3ee3ad8 100644
--- a/extras/indexing/src/test/java/org/apache/rya/api/client/accumulo/AccumuloBatchUpdatePCJIT.java
+++ b/extras/indexing/src/test/java/org/apache/rya/api/client/accumulo/AccumuloBatchUpdatePCJIT.java
@@ -23,7 +23,6 @@
import java.util.HashSet;
import java.util.Set;
-import org.apache.rya.accumulo.AccumuloITBase;
import org.apache.rya.accumulo.AccumuloRdfConfiguration;
import org.apache.rya.api.client.Install.InstallConfiguration;
import org.apache.rya.api.client.RyaClient;
@@ -34,6 +33,7 @@
import org.apache.rya.indexing.pcj.storage.PrecomputedJoinStorage;
import org.apache.rya.indexing.pcj.storage.accumulo.AccumuloPcjStorage;
import org.apache.rya.sail.config.RyaSailFactory;
+import org.apache.rya.test.accumulo.AccumuloITBase;
import org.eclipse.rdf4j.model.ValueFactory;
import org.eclipse.rdf4j.query.BindingSet;
import org.eclipse.rdf4j.query.impl.MapBindingSet;
diff --git a/extras/indexing/src/test/java/org/apache/rya/api/client/accumulo/AccumuloGetInstanceDetailsIT.java b/extras/indexing/src/test/java/org/apache/rya/api/client/accumulo/AccumuloGetInstanceDetailsIT.java
index e7ae332..b919569 100644
--- a/extras/indexing/src/test/java/org/apache/rya/api/client/accumulo/AccumuloGetInstanceDetailsIT.java
+++ b/extras/indexing/src/test/java/org/apache/rya/api/client/accumulo/AccumuloGetInstanceDetailsIT.java
@@ -27,7 +27,6 @@
import org.apache.accumulo.core.client.AccumuloSecurityException;
import org.apache.accumulo.core.client.TableExistsException;
import org.apache.accumulo.core.client.admin.TableOperations;
-import org.apache.rya.accumulo.AccumuloITBase;
import org.apache.rya.api.RdfCloudTripleStoreConstants;
import org.apache.rya.api.client.GetInstanceDetails;
import org.apache.rya.api.client.Install;
@@ -42,6 +41,7 @@
import org.apache.rya.api.instance.RyaDetails.PCJIndexDetails;
import org.apache.rya.api.instance.RyaDetails.ProspectorDetails;
import org.apache.rya.api.instance.RyaDetails.TemporalIndexDetails;
+import org.apache.rya.test.accumulo.AccumuloITBase;
import org.junit.Test;
import com.google.common.base.Optional;
diff --git a/extras/indexing/src/test/java/org/apache/rya/api/client/accumulo/AccumuloInstallIT.java b/extras/indexing/src/test/java/org/apache/rya/api/client/accumulo/AccumuloInstallIT.java
index a8c7455..e1fa40c 100644
--- a/extras/indexing/src/test/java/org/apache/rya/api/client/accumulo/AccumuloInstallIT.java
+++ b/extras/indexing/src/test/java/org/apache/rya/api/client/accumulo/AccumuloInstallIT.java
@@ -22,13 +22,13 @@
import org.apache.accumulo.core.client.AccumuloException;
import org.apache.accumulo.core.client.AccumuloSecurityException;
-import org.apache.rya.accumulo.AccumuloITBase;
import org.apache.rya.api.client.Install.DuplicateInstanceNameException;
import org.apache.rya.api.client.Install.InstallConfiguration;
import org.apache.rya.api.client.RyaClient;
import org.apache.rya.api.client.RyaClientException;
import org.apache.rya.api.instance.RyaDetailsRepository.NotInitializedException;
import org.apache.rya.api.instance.RyaDetailsRepository.RyaDetailsRepositoryException;
+import org.apache.rya.test.accumulo.AccumuloITBase;
import org.junit.Test;
/**
diff --git a/extras/indexing/src/test/java/org/apache/rya/api/client/accumulo/AccumuloInstanceExistsIT.java b/extras/indexing/src/test/java/org/apache/rya/api/client/accumulo/AccumuloInstanceExistsIT.java
index 7157ad6..fd47735 100644
--- a/extras/indexing/src/test/java/org/apache/rya/api/client/accumulo/AccumuloInstanceExistsIT.java
+++ b/extras/indexing/src/test/java/org/apache/rya/api/client/accumulo/AccumuloInstanceExistsIT.java
@@ -27,11 +27,10 @@
import org.apache.accumulo.core.client.TableExistsException;
import org.apache.accumulo.core.client.admin.TableOperations;
import org.junit.Test;
-
-import org.apache.rya.accumulo.AccumuloITBase;
import org.apache.rya.accumulo.instance.AccumuloRyaInstanceDetailsRepository;
import org.apache.rya.api.RdfCloudTripleStoreConstants;
import org.apache.rya.api.client.RyaClientException;
+import org.apache.rya.test.accumulo.AccumuloITBase;
/**
* Integration tests the methods of {@link AccumuloInstanceExists}.
diff --git a/extras/indexing/src/test/java/org/apache/rya/api/client/accumulo/AccumuloListInstancesIT.java b/extras/indexing/src/test/java/org/apache/rya/api/client/accumulo/AccumuloListInstancesIT.java
index b153a8c..e74f3d1 100644
--- a/extras/indexing/src/test/java/org/apache/rya/api/client/accumulo/AccumuloListInstancesIT.java
+++ b/extras/indexing/src/test/java/org/apache/rya/api/client/accumulo/AccumuloListInstancesIT.java
@@ -28,9 +28,9 @@
import org.apache.accumulo.core.client.admin.SecurityOperations;
import org.apache.accumulo.core.client.admin.TableOperations;
import org.apache.accumulo.core.security.SystemPermission;
-import org.apache.rya.accumulo.AccumuloITBase;
import org.apache.rya.api.client.Install;
import org.apache.rya.api.client.Install.InstallConfiguration;
+import org.apache.rya.test.accumulo.AccumuloITBase;
import org.apache.rya.api.client.ListInstances;
import org.apache.rya.api.client.RyaClientException;
import org.junit.Before;
diff --git a/extras/indexing/src/test/java/org/apache/rya/api/client/accumulo/AccumuloLoadStatementsFileIT.java b/extras/indexing/src/test/java/org/apache/rya/api/client/accumulo/AccumuloLoadStatementsFileIT.java
index 9b2926e..9ad0b49 100644
--- a/extras/indexing/src/test/java/org/apache/rya/api/client/accumulo/AccumuloLoadStatementsFileIT.java
+++ b/extras/indexing/src/test/java/org/apache/rya/api/client/accumulo/AccumuloLoadStatementsFileIT.java
@@ -30,7 +30,6 @@
import org.apache.accumulo.core.data.Key;
import org.apache.accumulo.core.data.Value;
import org.apache.accumulo.core.security.Authorizations;
-import org.apache.rya.accumulo.AccumuloITBase;
import org.apache.rya.api.RdfCloudTripleStoreConstants.TABLE_LAYOUT;
import org.apache.rya.api.client.Install;
import org.apache.rya.api.client.Install.InstallConfiguration;
@@ -40,6 +39,7 @@
import org.apache.rya.api.resolver.RyaToRdfConversions;
import org.apache.rya.api.resolver.triple.TripleRow;
import org.apache.rya.api.resolver.triple.impl.WholeRowTripleResolver;
+import org.apache.rya.test.accumulo.AccumuloITBase;
import org.eclipse.rdf4j.model.Statement;
import org.eclipse.rdf4j.model.ValueFactory;
import org.eclipse.rdf4j.model.impl.SimpleValueFactory;
diff --git a/extras/indexing/src/test/java/org/apache/rya/api/client/accumulo/AccumuloRemoveUserIT.java b/extras/indexing/src/test/java/org/apache/rya/api/client/accumulo/AccumuloRemoveUserIT.java
index 35e1210..580d863 100644
--- a/extras/indexing/src/test/java/org/apache/rya/api/client/accumulo/AccumuloRemoveUserIT.java
+++ b/extras/indexing/src/test/java/org/apache/rya/api/client/accumulo/AccumuloRemoveUserIT.java
@@ -25,13 +25,13 @@
import org.apache.accumulo.core.client.admin.SecurityOperations;
import org.apache.accumulo.core.client.security.tokens.PasswordToken;
import org.apache.accumulo.core.security.SystemPermission;
-import org.apache.rya.accumulo.AccumuloITBase;
import org.apache.rya.accumulo.AccumuloRdfConfiguration;
import org.apache.rya.api.client.Install.InstallConfiguration;
import org.apache.rya.api.client.RyaClient;
import org.apache.rya.api.instance.RyaDetails;
import org.apache.rya.indexing.accumulo.ConfigUtils;
import org.apache.rya.sail.config.RyaSailFactory;
+import org.apache.rya.test.accumulo.AccumuloITBase;
import org.eclipse.rdf4j.model.ValueFactory;
import org.eclipse.rdf4j.sail.Sail;
import org.eclipse.rdf4j.sail.SailConnection;
diff --git a/extras/indexing/src/test/java/org/apache/rya/api/client/accumulo/AccumuloSetRyaStreamsConfigurationIT.java b/extras/indexing/src/test/java/org/apache/rya/api/client/accumulo/AccumuloSetRyaStreamsConfigurationIT.java
index 928a29e..026a2a6 100644
--- a/extras/indexing/src/test/java/org/apache/rya/api/client/accumulo/AccumuloSetRyaStreamsConfigurationIT.java
+++ b/extras/indexing/src/test/java/org/apache/rya/api/client/accumulo/AccumuloSetRyaStreamsConfigurationIT.java
@@ -21,12 +21,12 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
-import org.apache.rya.accumulo.AccumuloITBase;
import org.apache.rya.api.client.Install;
import org.apache.rya.api.client.Install.InstallConfiguration;
import org.apache.rya.api.client.InstanceDoesNotExistException;
import org.apache.rya.api.client.RyaClient;
import org.apache.rya.api.instance.RyaDetails.RyaStreamsDetails;
+import org.apache.rya.test.accumulo.AccumuloITBase;
import org.junit.Test;
/**
diff --git a/extras/indexing/src/test/java/org/apache/rya/api/client/accumulo/AccumuloUninstallIT.java b/extras/indexing/src/test/java/org/apache/rya/api/client/accumulo/AccumuloUninstallIT.java
index e88e35c..939e267 100644
--- a/extras/indexing/src/test/java/org/apache/rya/api/client/accumulo/AccumuloUninstallIT.java
+++ b/extras/indexing/src/test/java/org/apache/rya/api/client/accumulo/AccumuloUninstallIT.java
@@ -21,8 +21,8 @@
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
-import org.apache.rya.accumulo.AccumuloITBase;
import org.apache.rya.api.client.Install.InstallConfiguration;
+import org.apache.rya.test.accumulo.AccumuloITBase;
import org.apache.rya.api.client.InstanceDoesNotExistException;
import org.apache.rya.api.client.RyaClient;
import org.junit.Test;
diff --git a/extras/indexing/src/test/java/org/apache/rya/api/client/accumulo/FluoITBase.java b/extras/indexing/src/test/java/org/apache/rya/api/client/accumulo/FluoITBase.java
index 1ef38aa..fd33e1d 100644
--- a/extras/indexing/src/test/java/org/apache/rya/api/client/accumulo/FluoITBase.java
+++ b/extras/indexing/src/test/java/org/apache/rya/api/client/accumulo/FluoITBase.java
@@ -44,9 +44,6 @@
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
import org.apache.rya.accumulo.AccumuloRdfConfiguration;
-import org.apache.rya.accumulo.MiniAccumuloClusterInstance;
-import org.apache.rya.accumulo.MiniAccumuloSingleton;
-import org.apache.rya.accumulo.RyaTestInstanceRule;
import org.apache.rya.api.client.Install;
import org.apache.rya.api.client.Install.DuplicateInstanceNameException;
import org.apache.rya.api.client.Install.InstallConfiguration;
@@ -66,6 +63,9 @@
import org.apache.rya.rdftriplestore.RyaSailRepository;
import org.apache.rya.rdftriplestore.inference.InferenceEngineException;
import org.apache.rya.sail.config.RyaSailFactory;
+import org.apache.rya.test.accumulo.MiniAccumuloClusterInstance;
+import org.apache.rya.test.accumulo.MiniAccumuloSingleton;
+import org.apache.rya.test.accumulo.RyaTestInstanceRule;
import org.apache.zookeeper.ClientCnxn;
import org.eclipse.rdf4j.repository.RepositoryConnection;
import org.eclipse.rdf4j.repository.RepositoryException;
@@ -103,7 +103,7 @@
protected RepositoryConnection ryaConn = null;
@Rule
- public RyaTestInstanceRule testInstance = new RyaTestInstanceRule(false);
+ public RyaTestInstanceRule testInstance = new RyaTestInstanceRule();
@BeforeClass
public static void beforeClass() throws Exception {
diff --git a/extras/rya.indexing.pcj/pom.xml b/extras/rya.indexing.pcj/pom.xml
index d36e94b..f40fb38 100644
--- a/extras/rya.indexing.pcj/pom.xml
+++ b/extras/rya.indexing.pcj/pom.xml
@@ -79,26 +79,20 @@
<scope>test</scope>
</dependency>
<dependency>
- <groupId>org.apache.accumulo</groupId>
- <artifactId>accumulo-minicluster</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
<groupId>org.apache.rya</groupId>
<artifactId>rya.sail</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.rya</groupId>
- <artifactId>accumulo.rya</artifactId>
- <type>test-jar</type>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.rya</groupId>
<artifactId>mongodb.rya</artifactId>
<type>test-jar</type>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.apache.rya</groupId>
+ <artifactId>rya.test.accumulo</artifactId>
+ <scope>test</scope>
+ </dependency>
</dependencies>
-</project>
+</project>
\ No newline at end of file
diff --git a/extras/rya.indexing.pcj/src/test/java/org/apache/rya/indexing/pcj/storage/accumulo/PcjTablesIT.java b/extras/rya.indexing.pcj/src/test/java/org/apache/rya/indexing/pcj/storage/accumulo/PcjTablesIT.java
index be1a64d..26d7596 100644
--- a/extras/rya.indexing.pcj/src/test/java/org/apache/rya/indexing/pcj/storage/accumulo/PcjTablesIT.java
+++ b/extras/rya.indexing.pcj/src/test/java/org/apache/rya/indexing/pcj/storage/accumulo/PcjTablesIT.java
@@ -41,9 +41,6 @@
import org.apache.log4j.Logger;
import org.apache.rya.accumulo.AccumuloRdfConfiguration;
import org.apache.rya.accumulo.AccumuloRyaDAO;
-import org.apache.rya.accumulo.MiniAccumuloClusterInstance;
-import org.apache.rya.accumulo.MiniAccumuloSingleton;
-import org.apache.rya.accumulo.RyaTestInstanceRule;
import org.apache.rya.api.RdfCloudTripleStoreConfiguration;
import org.apache.rya.api.model.VisibilityBindingSet;
import org.apache.rya.api.utils.CloseableIterator;
@@ -53,6 +50,9 @@
import org.apache.rya.indexing.pcj.storage.accumulo.BindingSetConverter.BindingSetConversionException;
import org.apache.rya.rdftriplestore.RdfCloudTripleStore;
import org.apache.rya.rdftriplestore.RyaSailRepository;
+import org.apache.rya.test.accumulo.MiniAccumuloClusterInstance;
+import org.apache.rya.test.accumulo.MiniAccumuloSingleton;
+import org.apache.rya.test.accumulo.RyaTestInstanceRule;
import org.apache.zookeeper.ClientCnxn;
import org.eclipse.rdf4j.model.Statement;
import org.eclipse.rdf4j.model.ValueFactory;
@@ -87,14 +87,14 @@
private static final AccumuloPcjSerializer converter = new AccumuloPcjSerializer();
// The MiniAccumuloCluster is re-used between tests.
- private MiniAccumuloClusterInstance cluster = MiniAccumuloSingleton.getInstance();
+ private final MiniAccumuloClusterInstance cluster = MiniAccumuloSingleton.getInstance();
// Rya data store and connections.
protected RyaSailRepository ryaRepo = null;
protected RepositoryConnection ryaConn = null;
@Rule
- public RyaTestInstanceRule testInstance = new RyaTestInstanceRule(false);
+ public RyaTestInstanceRule testInstance = new RyaTestInstanceRule();
@BeforeClass
public static void killLoudLogs() {
diff --git a/extras/rya.indexing.pcj/src/test/java/org/apache/rya/indexing/pcj/storage/accumulo/integration/AccumuloPcjStorageIT.java b/extras/rya.indexing.pcj/src/test/java/org/apache/rya/indexing/pcj/storage/accumulo/integration/AccumuloPcjStorageIT.java
index 8968898..d04712e 100644
--- a/extras/rya.indexing.pcj/src/test/java/org/apache/rya/indexing/pcj/storage/accumulo/integration/AccumuloPcjStorageIT.java
+++ b/extras/rya.indexing.pcj/src/test/java/org/apache/rya/indexing/pcj/storage/accumulo/integration/AccumuloPcjStorageIT.java
@@ -32,9 +32,15 @@
import org.apache.accumulo.core.client.AccumuloException;
import org.apache.accumulo.core.client.AccumuloSecurityException;
import org.apache.accumulo.core.client.Connector;
-import org.apache.rya.accumulo.AccumuloRyaITBase;
import org.apache.rya.accumulo.instance.AccumuloRyaInstanceDetailsRepository;
+import org.apache.rya.api.instance.RyaDetails;
+import org.apache.rya.api.instance.RyaDetails.EntityCentricIndexDetails;
+import org.apache.rya.api.instance.RyaDetails.FreeTextIndexDetails;
+import org.apache.rya.api.instance.RyaDetails.JoinSelectivityDetails;
+import org.apache.rya.api.instance.RyaDetails.PCJIndexDetails;
import org.apache.rya.api.instance.RyaDetails.PCJIndexDetails.PCJDetails;
+import org.apache.rya.api.instance.RyaDetails.ProspectorDetails;
+import org.apache.rya.api.instance.RyaDetails.TemporalIndexDetails;
import org.apache.rya.api.instance.RyaDetailsRepository;
import org.apache.rya.api.instance.RyaDetailsRepository.NotInitializedException;
import org.apache.rya.api.instance.RyaDetailsRepository.RyaDetailsRepositoryException;
@@ -46,13 +52,18 @@
import org.apache.rya.indexing.pcj.storage.accumulo.AccumuloPcjStorage;
import org.apache.rya.indexing.pcj.storage.accumulo.ShiftVarOrderFactory;
import org.apache.rya.indexing.pcj.storage.accumulo.VariableOrder;
+import org.apache.rya.test.accumulo.MiniAccumuloClusterInstance;
+import org.apache.rya.test.accumulo.MiniAccumuloSingleton;
+import org.apache.rya.test.accumulo.RyaTestInstanceRule;
import org.eclipse.rdf4j.model.ValueFactory;
import org.eclipse.rdf4j.model.impl.SimpleValueFactory;
import org.eclipse.rdf4j.query.BindingSet;
import org.eclipse.rdf4j.query.MalformedQueryException;
import org.eclipse.rdf4j.query.impl.MapBindingSet;
+import org.junit.Rule;
import org.junit.Test;
+import com.google.common.base.Optional;
import com.google.common.collect.ImmutableMap;
/**
@@ -61,14 +72,41 @@
* These tests ensures that the PCJ tables are maintained and that these operations
* also update the Rya instance's details.
*/
-public class AccumuloPcjStorageIT extends AccumuloRyaITBase {
+public class AccumuloPcjStorageIT {
private static final ValueFactory VF = SimpleValueFactory.getInstance();
+ @Rule
+ public RyaTestInstanceRule testInstance = new RyaTestInstanceRule(ryaInstanceName -> {
+ // Create Rya Details for the instance name.
+ final MiniAccumuloClusterInstance cluster = MiniAccumuloSingleton.getInstance();
+ final RyaDetailsRepository detailsRepo = new AccumuloRyaInstanceDetailsRepository(cluster.getConnector(), ryaInstanceName);
+ final RyaDetails details = RyaDetails.builder()
+ .setRyaInstanceName(ryaInstanceName)
+ .setRyaVersion("0.0.0.0")
+ .setFreeTextDetails(new FreeTextIndexDetails(true))
+ .setEntityCentricIndexDetails(new EntityCentricIndexDetails(true))
+ //RYA-215 .setGeoIndexDetails( new GeoIndexDetails(true) )
+ .setTemporalIndexDetails(new TemporalIndexDetails(true))
+ .setPCJIndexDetails(PCJIndexDetails.builder().setEnabled(true))
+ .setJoinSelectivityDetails(new JoinSelectivityDetails(Optional.absent()))
+ .setProspectorDetails(new ProspectorDetails(Optional.absent()))
+ .build();
+
+ detailsRepo.initialize(details);
+ });
+
+ /**
+ * @return The {@link MiniAccumuloClusterInstance} used by the tests.
+ */
+ private MiniAccumuloClusterInstance getClusterInstance() {
+ return MiniAccumuloSingleton.getInstance();
+ }
+
@Test
public void createPCJ() throws AccumuloException, AccumuloSecurityException, PCJStorageException, NotInitializedException, RyaDetailsRepositoryException {
// Setup the PCJ storage that will be tested against.
- final Connector connector = super.getClusterInstance().getConnector();
- final String ryaInstanceName = super.getRyaInstanceName();
+ final Connector connector = getClusterInstance().getConnector();
+ final String ryaInstanceName = testInstance.getRyaInstanceName();
try(final PrecomputedJoinStorage pcjStorage = new AccumuloPcjStorage(connector, ryaInstanceName)) {
// Create a PCJ.
final String pcjId = pcjStorage.createPcj("SELECT * WHERE { ?a <http://isA> ?b } ");
@@ -91,8 +129,8 @@
@Test
public void dropPCJ() throws AccumuloException, AccumuloSecurityException, PCJStorageException, NotInitializedException, RyaDetailsRepositoryException {
// Setup the PCJ storage that will be tested against.
- final Connector connector = super.getClusterInstance().getConnector();
- final String ryaInstanceName = super.getRyaInstanceName();
+ final Connector connector = getClusterInstance().getConnector();
+ final String ryaInstanceName = testInstance.getRyaInstanceName();
try(final PrecomputedJoinStorage pcjStorage = new AccumuloPcjStorage(connector, ryaInstanceName)) {
// Create a PCJ.
final String pcjId = pcjStorage.createPcj("SELECT * WHERE { ?a <http://isA> ?b } ");
@@ -114,8 +152,8 @@
@Test
public void listPcjs() throws AccumuloException, AccumuloSecurityException, PCJStorageException {
// Setup the PCJ storage that will be tested against.
- final Connector connector = super.getClusterInstance().getConnector();
- final String ryaInstanceName = super.getRyaInstanceName();
+ final Connector connector = getClusterInstance().getConnector();
+ final String ryaInstanceName = testInstance.getRyaInstanceName();
try(final PrecomputedJoinStorage pcjStorage = new AccumuloPcjStorage(connector, ryaInstanceName)) {
// Create a few PCJs and hold onto their IDs.
final List<String> expectedIds = new ArrayList<>();
@@ -142,8 +180,8 @@
@Test
public void getPcjMetadata() throws AccumuloException, AccumuloSecurityException, PCJStorageException, MalformedQueryException {
// Setup the PCJ storage that will be tested against.
- final Connector connector = super.getClusterInstance().getConnector();
- final String ryaInstanceName = super.getRyaInstanceName();
+ final Connector connector = getClusterInstance().getConnector();
+ final String ryaInstanceName = testInstance.getRyaInstanceName();
try(final PrecomputedJoinStorage pcjStorage = new AccumuloPcjStorage(connector, ryaInstanceName)) {
// Create a PCJ.
final String sparql = "SELECT * WHERE { ?a <http://isA> ?b }";
@@ -162,8 +200,8 @@
@Test
public void addResults() throws AccumuloException, AccumuloSecurityException, PCJStorageException, MalformedQueryException {
// Setup the PCJ storage that will be tested against.
- final Connector connector = super.getClusterInstance().getConnector();
- final String ryaInstanceName = super.getRyaInstanceName();
+ final Connector connector = getClusterInstance().getConnector();
+ final String ryaInstanceName = testInstance.getRyaInstanceName();
try(final PrecomputedJoinStorage pcjStorage = new AccumuloPcjStorage(connector, ryaInstanceName)) {
// Create a PCJ.
final String sparql = "SELECT * WHERE { ?a <http://isA> ?b }";
@@ -196,8 +234,8 @@
@Test
public void listResults() throws Exception {
// Setup the PCJ storage that will be tested against.
- final Connector connector = super.getClusterInstance().getConnector();
- final String ryaInstanceName = super.getRyaInstanceName();
+ final Connector connector = getClusterInstance().getConnector();
+ final String ryaInstanceName = testInstance.getRyaInstanceName();
try(final PrecomputedJoinStorage pcjStorage = new AccumuloPcjStorage(connector, ryaInstanceName)) {
// Create a PCJ.
final String sparql = "SELECT * WHERE { ?a <http://isA> ?b }";
@@ -238,8 +276,8 @@
@Test
public void purge() throws Exception {
// Setup the PCJ storage that will be tested against.
- final Connector connector = super.getClusterInstance().getConnector();
- final String ryaInstanceName = super.getRyaInstanceName();
+ final Connector connector = getClusterInstance().getConnector();
+ final String ryaInstanceName = testInstance.getRyaInstanceName();
try(final PrecomputedJoinStorage pcjStorage = new AccumuloPcjStorage(connector, ryaInstanceName)) {
// Create a PCJ.
final String sparql = "SELECT * WHERE { ?a <http://isA> ?b }";
diff --git a/extras/rya.indexing.pcj/src/test/java/org/apache/rya/indexing/pcj/storage/accumulo/integration/AccumuloPeriodicQueryResultStorageIT.java b/extras/rya.indexing.pcj/src/test/java/org/apache/rya/indexing/pcj/storage/accumulo/integration/AccumuloPeriodicQueryResultStorageIT.java
index 723c700..9eb48a3 100644
--- a/extras/rya.indexing.pcj/src/test/java/org/apache/rya/indexing/pcj/storage/accumulo/integration/AccumuloPeriodicQueryResultStorageIT.java
+++ b/extras/rya.indexing.pcj/src/test/java/org/apache/rya/indexing/pcj/storage/accumulo/integration/AccumuloPeriodicQueryResultStorageIT.java
@@ -28,7 +28,6 @@
import org.apache.accumulo.core.client.AccumuloException;
import org.apache.accumulo.core.client.AccumuloSecurityException;
import org.apache.accumulo.core.security.Authorizations;
-import org.apache.rya.accumulo.AccumuloITBase;
import org.apache.rya.api.model.VisibilityBindingSet;
import org.apache.rya.api.utils.CloseableIterator;
import org.apache.rya.indexing.pcj.storage.PeriodicQueryResultStorage;
@@ -37,6 +36,7 @@
import org.apache.rya.indexing.pcj.storage.accumulo.AccumuloPeriodicQueryResultStorage;
import org.apache.rya.indexing.pcj.storage.accumulo.PeriodicQueryTableNameFactory;
import org.apache.rya.indexing.pcj.storage.accumulo.VariableOrder;
+import org.apache.rya.test.accumulo.AccumuloITBase;
import org.eclipse.rdf4j.model.ValueFactory;
import org.eclipse.rdf4j.model.impl.SimpleValueFactory;
import org.eclipse.rdf4j.model.vocabulary.XMLSchema;
diff --git a/extras/rya.pcj.fluo/pcj.fluo.test.base/pom.xml b/extras/rya.pcj.fluo/pcj.fluo.test.base/pom.xml
index 512666c..f53ce92 100644
--- a/extras/rya.pcj.fluo/pcj.fluo.test.base/pom.xml
+++ b/extras/rya.pcj.fluo/pcj.fluo.test.base/pom.xml
@@ -52,14 +52,9 @@
<groupId>org.apache.fluo</groupId>
<artifactId>fluo-api</artifactId>
</dependency>
-
+
<!-- Testing dependencies. (should be compile scope for this project) -->
<dependency>
- <groupId>org.apache.rya</groupId>
- <artifactId>accumulo.rya</artifactId>
- <type>test-jar</type>
- </dependency>
- <dependency>
<groupId>org.apache.fluo</groupId>
<artifactId>fluo-mini</artifactId>
<scope>compile</scope>
@@ -105,5 +100,10 @@
<artifactId>fluo-recipes-test</artifactId>
<scope>compile</scope>
</dependency>
+ <dependency>
+ <groupId>org.apache.rya</groupId>
+ <artifactId>rya.test.accumulo</artifactId>
+ <scope>compile</scope>
+ </dependency>
</dependencies>
</project>
\ No newline at end of file
diff --git a/extras/rya.pcj.fluo/pcj.fluo.test.base/src/main/java/org/apache/rya/pcj/fluo/test/base/FluoITBase.java b/extras/rya.pcj.fluo/pcj.fluo.test.base/src/main/java/org/apache/rya/pcj/fluo/test/base/FluoITBase.java
index 18fc1c6..1c8c78b 100644
--- a/extras/rya.pcj.fluo/pcj.fluo.test.base/src/main/java/org/apache/rya/pcj/fluo/test/base/FluoITBase.java
+++ b/extras/rya.pcj.fluo/pcj.fluo.test.base/src/main/java/org/apache/rya/pcj/fluo/test/base/FluoITBase.java
@@ -38,9 +38,6 @@
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
import org.apache.rya.accumulo.AccumuloRdfConfiguration;
-import org.apache.rya.accumulo.MiniAccumuloClusterInstance;
-import org.apache.rya.accumulo.MiniAccumuloSingleton;
-import org.apache.rya.accumulo.RyaTestInstanceRule;
import org.apache.rya.api.client.Install;
import org.apache.rya.api.client.Install.DuplicateInstanceNameException;
import org.apache.rya.api.client.Install.InstallConfiguration;
@@ -56,6 +53,9 @@
import org.apache.rya.rdftriplestore.RyaSailRepository;
import org.apache.rya.rdftriplestore.inference.InferenceEngineException;
import org.apache.rya.sail.config.RyaSailFactory;
+import org.apache.rya.test.accumulo.MiniAccumuloClusterInstance;
+import org.apache.rya.test.accumulo.MiniAccumuloSingleton;
+import org.apache.rya.test.accumulo.RyaTestInstanceRule;
import org.apache.zookeeper.ClientCnxn;
import org.eclipse.rdf4j.repository.RepositoryConnection;
import org.eclipse.rdf4j.repository.RepositoryException;
@@ -94,7 +94,7 @@
protected RepositoryConnection ryaConn = null;
@Rule
- public RyaTestInstanceRule testInstance = new RyaTestInstanceRule(false);
+ public RyaTestInstanceRule testInstance = new RyaTestInstanceRule();
@BeforeClass
public static void beforeClass() throws Exception {
diff --git a/extras/shell/pom.xml b/extras/shell/pom.xml
index 5e671b3..d650ab3 100644
--- a/extras/shell/pom.xml
+++ b/extras/shell/pom.xml
@@ -88,25 +88,19 @@
<scope>test</scope>
</dependency>
<dependency>
- <groupId>org.apache.accumulo</groupId>
- <artifactId>accumulo-minicluster</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
<groupId>org.apache.fluo</groupId>
<artifactId>fluo-mini</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.rya</groupId>
- <artifactId>accumulo.rya</artifactId>
+ <artifactId>mongodb.rya</artifactId>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.rya</groupId>
- <artifactId>mongodb.rya</artifactId>
- <type>test-jar</type>
+ <artifactId>rya.test.accumulo</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
diff --git a/extras/shell/src/test/java/org/apache/rya/shell/RyaShellAccumuloITBase.java b/extras/shell/src/test/java/org/apache/rya/shell/RyaShellAccumuloITBase.java
index a115639..b761937 100644
--- a/extras/shell/src/test/java/org/apache/rya/shell/RyaShellAccumuloITBase.java
+++ b/extras/shell/src/test/java/org/apache/rya/shell/RyaShellAccumuloITBase.java
@@ -25,8 +25,8 @@
import org.apache.accumulo.minicluster.MiniAccumuloCluster;
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
-import org.apache.rya.accumulo.MiniAccumuloSingleton;
-import org.apache.rya.accumulo.RyaTestInstanceRule;
+import org.apache.rya.test.accumulo.MiniAccumuloSingleton;
+import org.apache.rya.test.accumulo.RyaTestInstanceRule;
import org.apache.zookeeper.ClientCnxn;
import org.junit.After;
import org.junit.Before;
@@ -35,8 +35,6 @@
import org.springframework.shell.Bootstrap;
import org.springframework.shell.core.JLineShellComponent;
-import org.apache.rya.accumulo.MiniAccumuloClusterInstance;
-
/**
* All Rya Shell integration tests should extend this one. It provides startup
* and shutdown hooks for a Mini Accumulo Cluster when you start and stop testing.
@@ -55,7 +53,7 @@
private JLineShellComponent shell;
@Rule
- public RyaTestInstanceRule testInstance = new RyaTestInstanceRule(false);
+ public RyaTestInstanceRule testInstance = new RyaTestInstanceRule();
@BeforeClass
public static void killLoudLogs() {
diff --git a/extras/shell/src/test/java/org/apache/rya/shell/util/ConnectorFactoryIT.java b/extras/shell/src/test/java/org/apache/rya/shell/util/ConnectorFactoryIT.java
index c3a5e74..c86b526 100644
--- a/extras/shell/src/test/java/org/apache/rya/shell/util/ConnectorFactoryIT.java
+++ b/extras/shell/src/test/java/org/apache/rya/shell/util/ConnectorFactoryIT.java
@@ -22,10 +22,9 @@
import org.apache.accumulo.core.client.AccumuloException;
import org.apache.accumulo.core.client.AccumuloSecurityException;
+import org.apache.rya.test.accumulo.AccumuloITBase;
import org.junit.Test;
-import org.apache.rya.accumulo.AccumuloITBase;
-
/**
* Tests the methods of {@link ConnectorFactory}.
*/
diff --git a/pom.xml b/pom.xml
index 052f294..932d443 100644
--- a/pom.xml
+++ b/pom.xml
@@ -536,6 +536,11 @@
</dependency>
<dependency>
<groupId>org.apache.rya</groupId>
+ <artifactId>rya.test.accumulo</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.rya</groupId>
<artifactId>rya.test.rdf</artifactId>
<version>${project.version}</version>
</dependency>
diff --git a/test/accumulo/pom.xml b/test/accumulo/pom.xml
new file mode 100644
index 0000000..4596171
--- /dev/null
+++ b/test/accumulo/pom.xml
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+ <parent>
+ <groupId>org.apache.rya</groupId>
+ <artifactId>rya.test.parent</artifactId>
+ <version>4.0.0-incubating-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>rya.test.accumulo</artifactId>
+
+ <name>Apache Rya Test Accumulo</name>
+ <description>
+ This module contains the Rya Test Accumulo components that help write
+ Accumulo based integration tests.
+ </description>
+
+ <dependencies>
+ <!-- 3rd party dependencies. -->
+ <dependency>
+ <groupId>com.github.stephenc.findbugs</groupId>
+ <artifactId>findbugs-annotations</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.accumulo</groupId>
+ <artifactId>accumulo-minicluster</artifactId>
+ </dependency>
+
+ <!-- Testing dependencies. -->
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>compile</scope>
+ </dependency>
+ </dependencies>
+</project>
\ No newline at end of file
diff --git a/dao/accumulo.rya/src/test/java/org/apache/rya/accumulo/AccumuloITBase.java b/test/accumulo/src/main/java/org/apache/rya/test/accumulo/AccumuloITBase.java
similarity index 97%
rename from dao/accumulo.rya/src/test/java/org/apache/rya/accumulo/AccumuloITBase.java
rename to test/accumulo/src/main/java/org/apache/rya/test/accumulo/AccumuloITBase.java
index 6d66090..ba55001 100644
--- a/dao/accumulo.rya/src/test/java/org/apache/rya/accumulo/AccumuloITBase.java
+++ b/test/accumulo/src/main/java/org/apache/rya/test/accumulo/AccumuloITBase.java
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.rya.accumulo;
+package org.apache.rya.test.accumulo;
import org.apache.accumulo.core.client.AccumuloException;
import org.apache.accumulo.core.client.AccumuloSecurityException;
@@ -39,7 +39,7 @@
private static MiniAccumuloClusterInstance cluster = MiniAccumuloSingleton.getInstance();
@Rule
- public RyaTestInstanceRule testInstance = new RyaTestInstanceRule(false);
+ public RyaTestInstanceRule testInstance = new RyaTestInstanceRule();
@BeforeClass
@@ -94,5 +94,4 @@
public String getRyaInstanceName() {
return testInstance.getRyaInstanceName();
}
-
}
\ No newline at end of file
diff --git a/dao/accumulo.rya/src/test/java/org/apache/rya/accumulo/MiniAccumuloClusterInstance.java b/test/accumulo/src/main/java/org/apache/rya/test/accumulo/MiniAccumuloClusterInstance.java
similarity index 98%
rename from dao/accumulo.rya/src/test/java/org/apache/rya/accumulo/MiniAccumuloClusterInstance.java
rename to test/accumulo/src/main/java/org/apache/rya/test/accumulo/MiniAccumuloClusterInstance.java
index 75ab792..8b641c3 100644
--- a/dao/accumulo.rya/src/test/java/org/apache/rya/accumulo/MiniAccumuloClusterInstance.java
+++ b/test/accumulo/src/main/java/org/apache/rya/test/accumulo/MiniAccumuloClusterInstance.java
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.rya.accumulo;
+package org.apache.rya.test.accumulo;
import java.io.File;
import java.io.IOException;
diff --git a/dao/accumulo.rya/src/test/java/org/apache/rya/accumulo/MiniAccumuloSingleton.java b/test/accumulo/src/main/java/org/apache/rya/test/accumulo/MiniAccumuloSingleton.java
similarity index 93%
rename from dao/accumulo.rya/src/test/java/org/apache/rya/accumulo/MiniAccumuloSingleton.java
rename to test/accumulo/src/main/java/org/apache/rya/test/accumulo/MiniAccumuloSingleton.java
index 8d731d3..832844f 100644
--- a/dao/accumulo.rya/src/test/java/org/apache/rya/accumulo/MiniAccumuloSingleton.java
+++ b/test/accumulo/src/main/java/org/apache/rya/test/accumulo/MiniAccumuloSingleton.java
@@ -16,15 +16,15 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.rya.accumulo;
+package org.apache.rya.test.accumulo;
+
+import java.io.IOException;
import org.apache.accumulo.core.client.AccumuloException;
import org.apache.accumulo.core.client.AccumuloSecurityException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import java.io.IOException;
-
public final class MiniAccumuloSingleton {
public static MiniAccumuloClusterInstance getInstance() {
@@ -61,24 +61,23 @@
public void run() {
try {
InstanceHolder.this.instance.stopMiniAccumulo();
- } catch (Throwable t) {
+ } catch (final Throwable t) {
// logging frameworks will likely be shut down
t.printStackTrace(System.err);
}
}
});
- } catch (InterruptedException e) {
+ } catch (final InterruptedException e) {
Thread.currentThread().interrupt();
log.error("Interrupted while starting mini accumulo", e);
} catch (IOException | AccumuloException | AccumuloSecurityException e) {
log.error("Unexpected error while starting mini accumulo", e);
- } catch (Throwable e) {
+ } catch (final Throwable e) {
// catching throwable because failure to construct an enum
// instance will lead to another error being thrown downstream
log.error("Unexpected throwable while starting mini accumulo", e);
}
}
}
-
-}
+}
\ No newline at end of file
diff --git a/test/accumulo/src/main/java/org/apache/rya/test/accumulo/RyaTestInstanceRule.java b/test/accumulo/src/main/java/org/apache/rya/test/accumulo/RyaTestInstanceRule.java
new file mode 100644
index 0000000..dd13a28
--- /dev/null
+++ b/test/accumulo/src/main/java/org/apache/rya/test/accumulo/RyaTestInstanceRule.java
@@ -0,0 +1,92 @@
+/**
+ * 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.test.accumulo;
+
+import java.util.Optional;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import org.junit.rules.ExternalResource;
+
+public class RyaTestInstanceRule extends ExternalResource {
+
+ private static final AtomicInteger ryaInstanceNameCounter = new AtomicInteger(1);
+ private static final AtomicInteger userId = new AtomicInteger(1);
+
+ private final Optional<DoInstall> doInstall;
+ private String ryaInstanceName;
+
+ /**
+ * Invoked within {@link RyaTestInstanceRule#before()} when provided.
+ */
+ public static interface DoInstall {
+
+ /**
+ * Invoked within {@link RyaTestInstanceRule#before()}.
+ *
+ * @param ryaInstanceName - The Rya Instance name for the test. (not null)
+ * @throws Throwable Anything caused the install to fail.
+ */
+ public void doInstall(String ryaInstanceName) throws Throwable;
+ }
+
+ /**
+ * Constructs an instance of {@link RyaTestInstnaceRule} where no extra steps need
+ * to be performed within {@link #before()}.
+ */
+ public RyaTestInstanceRule() {
+ this.doInstall = Optional.empty();
+ }
+
+ /**
+ * Constructs an instance of {@link RyaTestInstnaceRule}.
+ *
+ * @param doInstall - Invoked within {@link #before()}. (not null)
+ */
+ public RyaTestInstanceRule(final DoInstall doInstall) {
+ this.doInstall = Optional.of(doInstall);
+ }
+
+ public String getRyaInstanceName() {
+ if (ryaInstanceName == null) {
+ throw new IllegalStateException("Cannot get rya instance name outside of a test execution.");
+ }
+ return ryaInstanceName;
+ }
+
+ public String createUniqueUser() {
+ final int id = userId.getAndIncrement();
+ return "user_" + id;
+ }
+
+ @Override
+ protected void before() throws Throwable {
+ // Get the next Rya instance name.
+ ryaInstanceName = "testInstance_" + ryaInstanceNameCounter.getAndIncrement();
+
+ if (doInstall.isPresent()) {
+ doInstall.get().doInstall(ryaInstanceName);
+ }
+ }
+
+ @Override
+ protected void after() {
+ ryaInstanceName = null;
+ // TODO consider teardown of instance (probably requires additional features)
+ }
+}
\ No newline at end of file
diff --git a/test/pom.xml b/test/pom.xml
index f19743e..2517f6a 100644
--- a/test/pom.xml
+++ b/test/pom.xml
@@ -34,6 +34,7 @@
<packaging>pom</packaging>
<modules>
+ <module>accumulo</module>
<module>kafka</module>
<module>rdf</module>
</modules>