Commit 709598a3 by Madhan Neethiraj

ATLAS-4000: refactored UTs and ITs to remove compile dependency from product…

ATLAS-4000: refactored UTs and ITs to remove compile dependency from product code on atlas-testtools - #1
parent 90f5b4ad
...@@ -61,6 +61,7 @@ ...@@ -61,6 +61,7 @@
<groupId>org.apache.atlas</groupId> <groupId>org.apache.atlas</groupId>
<artifactId>atlas-testtools</artifactId> <artifactId>atlas-testtools</artifactId>
<version>${project.version}</version> <version>${project.version}</version>
<scope>test</scope>
</dependency> </dependency>
<dependency> <dependency>
......
...@@ -27,7 +27,6 @@ import org.apache.atlas.repository.graphdb.GraphDatabase; ...@@ -27,7 +27,6 @@ import org.apache.atlas.repository.graphdb.GraphDatabase;
import org.apache.atlas.repository.graphdb.janus.serializer.BigDecimalSerializer; import org.apache.atlas.repository.graphdb.janus.serializer.BigDecimalSerializer;
import org.apache.atlas.repository.graphdb.janus.serializer.BigIntegerSerializer; import org.apache.atlas.repository.graphdb.janus.serializer.BigIntegerSerializer;
import org.apache.atlas.repository.graphdb.janus.serializer.TypeCategorySerializer; import org.apache.atlas.repository.graphdb.janus.serializer.TypeCategorySerializer;
import org.apache.atlas.runner.LocalSolrRunner;
import org.apache.atlas.typesystem.types.DataTypes.TypeCategory; import org.apache.atlas.typesystem.types.DataTypes.TypeCategory;
import org.apache.atlas.utils.AtlasPerfTracer; import org.apache.atlas.utils.AtlasPerfTracer;
import org.apache.commons.configuration.Configuration; import org.apache.commons.configuration.Configuration;
...@@ -45,6 +44,7 @@ import org.slf4j.Logger; ...@@ -45,6 +44,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier; import java.lang.reflect.Modifier;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.BigInteger; import java.math.BigInteger;
...@@ -80,11 +80,11 @@ public class AtlasJanusGraphDatabase implements GraphDatabase<AtlasJanusVertex, ...@@ -80,11 +80,11 @@ public class AtlasJanusGraphDatabase implements GraphDatabase<AtlasJanusVertex,
} }
public static Configuration getConfiguration() throws AtlasException { public static Configuration getConfiguration() throws AtlasException {
startLocalSolr();
Configuration configProperties = ApplicationProperties.get(); Configuration configProperties = ApplicationProperties.get();
if (isEmbeddedSolr()) { // AtlasJanusGraphIndexClient.performRequestHandlerAction() fails for embedded-solr; disable freetext until this issue is resolved if (isEmbeddedSolr()) { // AtlasJanusGraphIndexClient.performRequestHandlerAction() fails for embedded-solr; disable freetext until this issue is resolved
startEmbeddedSolr();
configProperties.setProperty(ApplicationProperties.ENABLE_FREETEXT_SEARCH_CONF, false); configProperties.setProperty(ApplicationProperties.ENABLE_FREETEXT_SEARCH_CONF, false);
} }
...@@ -264,10 +264,12 @@ public class AtlasJanusGraphDatabase implements GraphDatabase<AtlasJanusVertex, ...@@ -264,10 +264,12 @@ public class AtlasJanusGraphDatabase implements GraphDatabase<AtlasJanusVertex,
t.printStackTrace(); t.printStackTrace();
} }
try { if (isEmbeddedSolr()) {
LocalSolrRunner.stop(); try {
} catch (Throwable t) { stopEmbeddedSolr();
LOG.warn("Could not stop local solr server", t); } catch (Throwable t) {
LOG.warn("Could not stop local solr server", t);
}
} }
} }
...@@ -282,18 +284,38 @@ public class AtlasJanusGraphDatabase implements GraphDatabase<AtlasJanusVertex, ...@@ -282,18 +284,38 @@ public class AtlasJanusGraphDatabase implements GraphDatabase<AtlasJanusVertex,
return new AtlasJanusGraph(getBulkLoadingGraphInstance()); return new AtlasJanusGraph(getBulkLoadingGraphInstance());
} }
private static void startLocalSolr() { private static void startEmbeddedSolr() throws AtlasException {
if (isEmbeddedSolr()) { LOG.info("==> startEmbeddedSolr()");
try {
LocalSolrRunner.start();
Configuration configuration = ApplicationProperties.get(); try {
configuration.clearProperty(SOLR_ZOOKEEPER_URL); Class<?> localSolrRunnerClz = Class.forName("org.apache.atlas.runner.LocalSolrRunner");
configuration.setProperty(SOLR_ZOOKEEPER_URL, LocalSolrRunner.getZookeeperUrls()); Method startMethod = localSolrRunnerClz.getMethod("start");
} catch (Exception e) {
throw new RuntimeException("Failed to start embedded solr cloud server. Aborting!", e); startMethod.invoke(null);
} } catch (Exception excp) {
LOG.error("startEmbeddedSolr(): failed", excp);
throw new AtlasException("startEmbeddedSolr(): failed", excp);
} }
LOG.info("<== startEmbeddedSolr()");
}
private static void stopEmbeddedSolr() throws AtlasException {
LOG.info("==> stopEmbeddedSolr()");
try {
Class<?> localSolrRunnerClz = Class.forName("org.apache.atlas.runner.LocalSolrRunner");
Method stopMethod = localSolrRunnerClz.getMethod("stop");
stopMethod.invoke(null);
} catch (Exception excp) {
LOG.error("stopEmbeddedSolr(): failed", excp);
throw new AtlasException("stopEmbeddedSolr(): failed", excp);
}
LOG.info("<== stopEmbeddedSolr()");
} }
public static boolean isEmbeddedSolr() { public static boolean isEmbeddedSolr() {
......
...@@ -274,13 +274,35 @@ public class Solr6Index implements IndexProvider { ...@@ -274,13 +274,35 @@ public class Solr6Index implements IndexProvider {
Mode mode = Mode.parse(configuration.get(SOLR_MODE)); Mode mode = Mode.parse(configuration.get(SOLR_MODE));
switch (mode) { switch (mode) {
case CLOUD: case CLOUD:
final CloudSolrClient cloudServer = new CloudSolrClient.Builder() /* ATLAS-2920: Update JanusGraph Solr clients to use all zookeeper entries – start */
List<String> zkHosts = new ArrayList<>();
String chroot = null;
String[] zkUrls = configuration.get(ZOOKEEPER_URLS);
if (zkUrls != null) {
for (int i = zkUrls.length - 1; i >= 0; i--) {
String zkUrl = zkUrls[i];
int idxChroot = zkUrl.indexOf(CHROOT_START_CHAR);
if (idxChroot != -1) {
if (chroot == null) {
chroot = zkUrl.substring(idxChroot);
}
zkUrl = zkUrl.substring(0, idxChroot);
}
zkHosts.add(zkUrl);
}
}
/* ATLAS-2920: - end */
final CloudSolrClient cloudServer = new CloudSolrClient.Builder().withZkHost(zkHosts).withZkChroot(chroot)
.withLBHttpSolrClientBuilder( .withLBHttpSolrClientBuilder(
new LBHttpSolrClient.Builder() new LBHttpSolrClient.Builder()
.withHttpSolrClientBuilder(new HttpSolrClient.Builder().withInvariantParams(clientParams)) .withHttpSolrClientBuilder(new HttpSolrClient.Builder().withInvariantParams(clientParams))
.withBaseSolrUrls(configuration.get(HTTP_URLS)) .withBaseSolrUrls(configuration.get(HTTP_URLS))
) )
.withZkHost(getZookeeperURLs(configuration))
.sendUpdatesOnlyToShardLeaders() .sendUpdatesOnlyToShardLeaders()
.build(); .build();
cloudServer.connect(); cloudServer.connect();
...@@ -1240,35 +1262,4 @@ public class Solr6Index implements IndexProvider { ...@@ -1240,35 +1262,4 @@ public class Solr6Index implements IndexProvider {
logger.info("Exiting solr wait"); logger.info("Exiting solr wait");
} }
} }
/* ATLAS-2920: Update JanusGraph Solr clients to use all zookeeper entries – start */
private static List<String> getZookeeperURLs(Configuration config) {
List<String> ret = null;
String[] zkHosts = config.get(ZOOKEEPER_URLS);
if (zkHosts != null) {
ret = new ArrayList<>(zkHosts.length);
for (int i = 0; i < zkHosts.length; i++) {
String zkHost = zkHosts[i];
if (StringUtils.isEmpty(zkHost)) {
continue;
}
int idxSlash = zkHost.indexOf(CHROOT_START_CHAR);
if (idxSlash != -1 && i < zkHosts.length - 1) {
zkHost = zkHost.substring(0, idxSlash);
}
if (StringUtils.isNotEmpty(zkHost)) {
ret.add(zkHost);
}
}
}
return ret;
}
/* ATLAS-2920 – end */
} }
\ No newline at end of file
...@@ -25,6 +25,7 @@ import org.apache.atlas.repository.graphdb.AtlasGraph; ...@@ -25,6 +25,7 @@ import org.apache.atlas.repository.graphdb.AtlasGraph;
import org.apache.atlas.repository.graphdb.AtlasGraphManagement; import org.apache.atlas.repository.graphdb.AtlasGraphManagement;
import org.apache.atlas.repository.graphdb.AtlasPropertyKey; import org.apache.atlas.repository.graphdb.AtlasPropertyKey;
import org.apache.atlas.repository.graphdb.AtlasVertex; import org.apache.atlas.repository.graphdb.AtlasVertex;
import org.apache.atlas.runner.LocalSolrRunner;
import org.testng.annotations.AfterClass; import org.testng.annotations.AfterClass;
import org.testng.annotations.AfterMethod; import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeClass; import org.testng.annotations.BeforeClass;
...@@ -33,6 +34,8 @@ import java.util.ArrayList; ...@@ -33,6 +34,8 @@ import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import static org.apache.atlas.graph.GraphSandboxUtil.useLocalSolr;
public abstract class AbstractGraphDatabaseTest { public abstract class AbstractGraphDatabaseTest {
protected static final String WEIGHT_PROPERTY = "weight"; protected static final String WEIGHT_PROPERTY = "weight";
...@@ -48,6 +51,10 @@ public abstract class AbstractGraphDatabaseTest { ...@@ -48,6 +51,10 @@ public abstract class AbstractGraphDatabaseTest {
public static void createIndices() throws Exception { public static void createIndices() throws Exception {
GraphSandboxUtil.create(); GraphSandboxUtil.create();
if (useLocalSolr()) {
LocalSolrRunner.start();
}
AtlasJanusGraphDatabase db = new AtlasJanusGraphDatabase(); AtlasJanusGraphDatabase db = new AtlasJanusGraphDatabase();
AtlasGraphManagement mgmt = db.getGraph().getManagementSystem(); AtlasGraphManagement mgmt = db.getGraph().getManagementSystem();
...@@ -75,9 +82,13 @@ public abstract class AbstractGraphDatabaseTest { ...@@ -75,9 +82,13 @@ public abstract class AbstractGraphDatabaseTest {
} }
@AfterClass @AfterClass
public static void cleanUp() { public static void cleanUp() throws Exception {
AtlasJanusGraph graph = new AtlasJanusGraph(); AtlasJanusGraph graph = new AtlasJanusGraph();
graph.clear(); graph.clear();
if (useLocalSolr()) {
LocalSolrRunner.stop();
}
} }
protected <V, E> void pushChangesAndFlushCache() { protected <V, E> void pushChangesAndFlushCache() {
......
...@@ -30,6 +30,7 @@ import org.apache.atlas.repository.graphdb.AtlasGraphQuery; ...@@ -30,6 +30,7 @@ import org.apache.atlas.repository.graphdb.AtlasGraphQuery;
import org.apache.atlas.repository.graphdb.AtlasGraphQuery.ComparisionOperator; import org.apache.atlas.repository.graphdb.AtlasGraphQuery.ComparisionOperator;
import org.apache.atlas.repository.graphdb.AtlasPropertyKey; import org.apache.atlas.repository.graphdb.AtlasPropertyKey;
import org.apache.atlas.repository.graphdb.AtlasVertex; import org.apache.atlas.repository.graphdb.AtlasVertex;
import org.apache.atlas.runner.LocalSolrRunner;
import org.apache.atlas.typesystem.types.DataTypes.TypeCategory; import org.apache.atlas.typesystem.types.DataTypes.TypeCategory;
import org.apache.commons.configuration.Configuration; import org.apache.commons.configuration.Configuration;
import org.testng.annotations.AfterClass; import org.testng.annotations.AfterClass;
...@@ -45,6 +46,7 @@ import java.util.Iterator; ...@@ -45,6 +46,7 @@ import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import static org.apache.atlas.graph.GraphSandboxUtil.useLocalSolr;
import static org.apache.atlas.repository.graphdb.janus.AtlasJanusGraphDatabase.initJanusGraph; import static org.apache.atlas.repository.graphdb.janus.AtlasJanusGraphDatabase.initJanusGraph;
import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertFalse; import static org.testng.Assert.assertFalse;
...@@ -61,9 +63,13 @@ public class AtlasJanusDatabaseTest { ...@@ -61,9 +63,13 @@ public class AtlasJanusDatabaseTest {
private AtlasGraph<?, ?> atlasGraph; private AtlasGraph<?, ?> atlasGraph;
private <V, E> AtlasGraph<V, E> getGraph() { private <V, E> AtlasGraph<V, E> getGraph() throws Exception {
GraphSandboxUtil.create(); GraphSandboxUtil.create();
if (useLocalSolr()) {
LocalSolrRunner.start();
}
if (atlasGraph == null) { if (atlasGraph == null) {
AtlasJanusGraphDatabase db = new AtlasJanusGraphDatabase(); AtlasJanusGraphDatabase db = new AtlasJanusGraphDatabase();
atlasGraph = db.getGraph(); atlasGraph = db.getGraph();
...@@ -83,11 +89,15 @@ public class AtlasJanusDatabaseTest { ...@@ -83,11 +89,15 @@ public class AtlasJanusDatabaseTest {
} }
@AfterClass @AfterClass
public void cleanup() { public void cleanup() throws Exception {
if (atlasGraph != null) { if (atlasGraph != null) {
atlasGraph.clear(); atlasGraph.clear();
atlasGraph = null; atlasGraph = null;
} }
if (useLocalSolr()) {
LocalSolrRunner.stop();
}
} }
@Test @Test
...@@ -115,7 +125,7 @@ public class AtlasJanusDatabaseTest { ...@@ -115,7 +125,7 @@ public class AtlasJanusDatabaseTest {
} }
@Test @Test
public <V, E> void testPropertyDataTypes() { public <V, E> void testPropertyDataTypes() throws Exception {
// primitives // primitives
AtlasGraph<V, E> graph = getGraph(); AtlasGraph<V, E> graph = getGraph();
...@@ -177,7 +187,7 @@ public class AtlasJanusDatabaseTest { ...@@ -177,7 +187,7 @@ public class AtlasJanusDatabaseTest {
} }
@Test @Test
public <V, E> void testMultiplicityOnePropertySupport() { public <V, E> void testMultiplicityOnePropertySupport() throws Exception {
AtlasGraph<V, E> graph = (AtlasGraph<V, E>) getGraph(); AtlasGraph<V, E> graph = (AtlasGraph<V, E>) getGraph();
...@@ -213,7 +223,7 @@ public class AtlasJanusDatabaseTest { ...@@ -213,7 +223,7 @@ public class AtlasJanusDatabaseTest {
} }
@Test @Test
public <V, E> void testRemoveEdge() { public <V, E> void testRemoveEdge() throws Exception {
AtlasGraph<V, E> graph = (AtlasGraph<V, E>) getGraph(); AtlasGraph<V, E> graph = (AtlasGraph<V, E>) getGraph();
AtlasVertex<V, E> v1 = graph.addVertex(); AtlasVertex<V, E> v1 = graph.addVertex();
...@@ -235,7 +245,7 @@ public class AtlasJanusDatabaseTest { ...@@ -235,7 +245,7 @@ public class AtlasJanusDatabaseTest {
} }
@Test @Test
public <V, E> void testRemoveVertex() { public <V, E> void testRemoveVertex() throws Exception {
AtlasGraph<V, E> graph = (AtlasGraph<V, E>) getGraph(); AtlasGraph<V, E> graph = (AtlasGraph<V, E>) getGraph();
...@@ -249,7 +259,7 @@ public class AtlasJanusDatabaseTest { ...@@ -249,7 +259,7 @@ public class AtlasJanusDatabaseTest {
} }
@Test @Test
public <V, E> void testGetEdges() { public <V, E> void testGetEdges() throws Exception {
AtlasGraph<V, E> graph = (AtlasGraph<V, E>) getGraph(); AtlasGraph<V, E> graph = (AtlasGraph<V, E>) getGraph();
AtlasVertex<V, E> v1 = graph.addVertex(); AtlasVertex<V, E> v1 = graph.addVertex();
...@@ -285,7 +295,7 @@ public class AtlasJanusDatabaseTest { ...@@ -285,7 +295,7 @@ public class AtlasJanusDatabaseTest {
} }
@Test @Test
public <V, E> void testMultiplictyManyPropertySupport() { public <V, E> void testMultiplictyManyPropertySupport() throws Exception {
AtlasGraph<V, E> graph = getGraph(); AtlasGraph<V, E> graph = getGraph();
...@@ -324,7 +334,7 @@ public class AtlasJanusDatabaseTest { ...@@ -324,7 +334,7 @@ public class AtlasJanusDatabaseTest {
} }
@Test @Test
public <V, E> void testListProperties() throws AtlasException { public <V, E> void testListProperties() throws Exception {
AtlasGraph<V, E> graph = getGraph(); AtlasGraph<V, E> graph = getGraph();
AtlasVertex<V, E> vertex = graph.addVertex(); AtlasVertex<V, E> vertex = graph.addVertex();
...@@ -347,7 +357,7 @@ public class AtlasJanusDatabaseTest { ...@@ -347,7 +357,7 @@ public class AtlasJanusDatabaseTest {
} }
@Test @Test
public <V, E> void testRemoveProperty() { public <V, E> void testRemoveProperty() throws Exception {
AtlasGraph<V, E> graph = getGraph(); AtlasGraph<V, E> graph = getGraph();
AtlasVertex<V, E> vertex = graph.addVertex(); AtlasVertex<V, E> vertex = graph.addVertex();
...@@ -375,7 +385,7 @@ public class AtlasJanusDatabaseTest { ...@@ -375,7 +385,7 @@ public class AtlasJanusDatabaseTest {
} }
@Test @Test
public <V, E> void getGetGraphQueryForVertices() { public <V, E> void getGetGraphQueryForVertices() throws Exception {
AtlasGraph<V, E> graph = getGraph(); AtlasGraph<V, E> graph = getGraph();
...@@ -410,7 +420,7 @@ public class AtlasJanusDatabaseTest { ...@@ -410,7 +420,7 @@ public class AtlasJanusDatabaseTest {
} }
private <V, E> void testExecuteGraphQuery(String property, ComparisionOperator op, Object value, private <V, E> void testExecuteGraphQuery(String property, ComparisionOperator op, Object value,
AtlasVertex<V, E>... expected) { AtlasVertex<V, E>... expected) throws Exception {
AtlasGraph<V, E> graph = getGraph(); AtlasGraph<V, E> graph = getGraph();
AtlasGraphQuery<V, E> query = graph.query(); AtlasGraphQuery<V, E> query = graph.query();
if (op != null) { if (op != null) {
...@@ -427,7 +437,7 @@ public class AtlasJanusDatabaseTest { ...@@ -427,7 +437,7 @@ public class AtlasJanusDatabaseTest {
} }
@Test @Test
public <V, E> void testAddMultManyPropertyValueTwice() { public <V, E> void testAddMultManyPropertyValueTwice() throws Exception {
AtlasGraph<V, E> graph = getGraph(); AtlasGraph<V, E> graph = getGraph();
String vertexId; String vertexId;
......
...@@ -21,12 +21,15 @@ import org.apache.atlas.ApplicationProperties; ...@@ -21,12 +21,15 @@ import org.apache.atlas.ApplicationProperties;
import org.apache.atlas.AtlasException; import org.apache.atlas.AtlasException;
import org.apache.atlas.graph.GraphSandboxUtil; import org.apache.atlas.graph.GraphSandboxUtil;
import org.apache.atlas.repository.graphdb.AtlasGraph; import org.apache.atlas.repository.graphdb.AtlasGraph;
import org.apache.atlas.runner.LocalSolrRunner;
import org.apache.commons.configuration.Configuration; import org.apache.commons.configuration.Configuration;
import org.testng.Assert; import org.testng.Assert;
import org.testng.annotations.AfterClass; import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeTest; import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test; import org.testng.annotations.Test;
import static org.apache.atlas.graph.GraphSandboxUtil.useLocalSolr;
@Test @Test
public class JanusGraphProviderTest { public class JanusGraphProviderTest {
...@@ -38,6 +41,10 @@ public class JanusGraphProviderTest { ...@@ -38,6 +41,10 @@ public class JanusGraphProviderTest {
public void setUp() throws Exception { public void setUp() throws Exception {
GraphSandboxUtil.create(); GraphSandboxUtil.create();
if (useLocalSolr()) {
LocalSolrRunner.start();
}
//First get Instance //First get Instance
graph = new AtlasJanusGraph(); graph = new AtlasJanusGraph();
configuration = ApplicationProperties.getSubsetConfiguration(ApplicationProperties.get(), AtlasJanusGraphDatabase.GRAPH_PREFIX); configuration = ApplicationProperties.getSubsetConfiguration(ApplicationProperties.get(), AtlasJanusGraphDatabase.GRAPH_PREFIX);
...@@ -56,6 +63,10 @@ public class JanusGraphProviderTest { ...@@ -56,6 +63,10 @@ public class JanusGraphProviderTest {
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
if (useLocalSolr()) {
LocalSolrRunner.stop();
}
} }
@Test @Test
......
...@@ -669,6 +669,8 @@ ...@@ -669,6 +669,8 @@
<janus.version>0.5.1</janus.version> <janus.version>0.5.1</janus.version>
<tinkerpop.version>3.4.6</tinkerpop.version> <tinkerpop.version>3.4.6</tinkerpop.version>
<lucene-solr.version>7.3.0</lucene-solr.version> <lucene-solr.version>7.3.0</lucene-solr.version>
<solr-test-framework.version>7.0.0</solr-test-framework.version>
<junit.version>4.13</junit.version>
<hadoop.version>3.1.1</hadoop.version> <hadoop.version>3.1.1</hadoop.version>
<hbase.version>2.0.2</hbase.version> <hbase.version>2.0.2</hbase.version>
...@@ -1235,12 +1237,54 @@ ...@@ -1235,12 +1237,54 @@
<dependency> <dependency>
<groupId>org.eclipse.jetty</groupId> <groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-util</artifactId>
<version>${jetty.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-util-ajax</artifactId>
<version>${jetty.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-io</artifactId>
<version>${jetty.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-http</artifactId>
<version>${jetty.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-security</artifactId>
<version>${jetty.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-webapp</artifactId> <artifactId>jetty-webapp</artifactId>
<version>${jetty.version}</version> <version>${jetty.version}</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-servlet</artifactId>
<version>${jetty.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>net.sourceforge.findbugs</groupId> <groupId>net.sourceforge.findbugs</groupId>
<artifactId>annotations</artifactId> <artifactId>annotations</artifactId>
<version>1.3.2</version> <version>1.3.2</version>
......
...@@ -248,6 +248,13 @@ ...@@ -248,6 +248,13 @@
<version>${poi-ooxml.version}</version> <version>${poi-ooxml.version}</version>
</dependency> </dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
</dependencies> </dependencies>
<profiles> <profiles>
...@@ -263,6 +270,7 @@ ...@@ -263,6 +270,7 @@
<groupId>org.apache.atlas</groupId> <groupId>org.apache.atlas</groupId>
<artifactId>atlas-testtools</artifactId> <artifactId>atlas-testtools</artifactId>
<version>${project.version}</version> <version>${project.version}</version>
<scope>test</scope>
<exclusions> <exclusions>
<exclusion> <exclusion>
<groupId>com.fasterxml.jackson.core</groupId> <groupId>com.fasterxml.jackson.core</groupId>
......
...@@ -25,7 +25,6 @@ import org.apache.atlas.repository.store.graph.v2.AtlasGraphUtilsV2; ...@@ -25,7 +25,6 @@ import org.apache.atlas.repository.store.graph.v2.AtlasGraphUtilsV2;
import org.apache.atlas.utils.AtlasPerfTracer; import org.apache.atlas.utils.AtlasPerfTracer;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.apache.solr.common.params.CommonParams;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
...@@ -39,7 +38,7 @@ import java.util.*; ...@@ -39,7 +38,7 @@ import java.util.*;
public class FreeTextSearchProcessor extends SearchProcessor { public class FreeTextSearchProcessor extends SearchProcessor {
private static final Logger LOG = LoggerFactory.getLogger(FreeTextSearchProcessor.class); private static final Logger LOG = LoggerFactory.getLogger(FreeTextSearchProcessor.class);
private static final Logger PERF_LOG = AtlasPerfTracer.getPerfLogger("FreeTextSearchProcessor"); private static final Logger PERF_LOG = AtlasPerfTracer.getPerfLogger("FreeTextSearchProcessor");
public static final String SOLR_QT_PARAMETER = CommonParams.QT; public static final String SOLR_QT_PARAMETER = "qt"; // org.apache.solr.common.params.CommonParams.QT;
public static final String SOLR_REQUEST_HANDLER_NAME = "/freetext"; public static final String SOLR_REQUEST_HANDLER_NAME = "/freetext";
private final AtlasIndexQuery indexQuery; private final AtlasIndexQuery indexQuery;
......
...@@ -45,7 +45,7 @@ import org.apache.atlas.type.*; ...@@ -45,7 +45,7 @@ import org.apache.atlas.type.*;
import org.apache.atlas.type.AtlasStructType.AtlasAttribute; import org.apache.atlas.type.AtlasStructType.AtlasAttribute;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.configuration.Configuration; import org.apache.commons.configuration.Configuration;
import org.apache.solr.common.StringUtils; import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.core.annotation.Order; import org.springframework.core.annotation.Order;
......
...@@ -26,6 +26,7 @@ import org.apache.atlas.model.glossary.AtlasGlossaryTerm; ...@@ -26,6 +26,7 @@ import org.apache.atlas.model.glossary.AtlasGlossaryTerm;
import org.apache.atlas.model.glossary.relations.AtlasGlossaryHeader; import org.apache.atlas.model.glossary.relations.AtlasGlossaryHeader;
import org.apache.atlas.model.instance.*; import org.apache.atlas.model.instance.*;
import org.apache.atlas.model.typedef.*; import org.apache.atlas.model.typedef.*;
import org.apache.atlas.repository.AtlasTestBase;
import org.apache.atlas.repository.store.graph.AtlasEntityStore; import org.apache.atlas.repository.store.graph.AtlasEntityStore;
import org.apache.atlas.repository.store.graph.v2.AtlasEntityStream; import org.apache.atlas.repository.store.graph.v2.AtlasEntityStream;
import org.apache.atlas.store.AtlasTypeDefStore; import org.apache.atlas.store.AtlasTypeDefStore;
...@@ -42,7 +43,7 @@ import java.util.stream.Stream; ...@@ -42,7 +43,7 @@ import java.util.stream.Stream;
import static org.apache.atlas.utils.TestLoadModelUtils.loadModelFromJson; import static org.apache.atlas.utils.TestLoadModelUtils.loadModelFromJson;
import static org.testng.Assert.fail; import static org.testng.Assert.fail;
public abstract class BasicTestSetup { public abstract class BasicTestSetup extends AtlasTestBase {
// Entity type // // Entity type //
protected static final String DATABASE_TYPE = "hive_db"; protected static final String DATABASE_TYPE = "hive_db";
......
...@@ -114,6 +114,8 @@ public class TestModules { ...@@ -114,6 +114,8 @@ public class TestModules {
@Override @Override
protected void configure() { protected void configure() {
GraphSandboxUtil.create();
if (useLocalSolr()) { if (useLocalSolr()) {
try { try {
LocalSolrRunner.start(); LocalSolrRunner.start();
...@@ -122,8 +124,6 @@ public class TestModules { ...@@ -122,8 +124,6 @@ public class TestModules {
} }
} }
GraphSandboxUtil.create();
bindAuditRepository(binder()); bindAuditRepository(binder());
bind(AtlasGraph.class).toProvider(AtlasGraphProvider.class); bind(AtlasGraph.class).toProvider(AtlasGraphProvider.class);
......
...@@ -18,7 +18,6 @@ ...@@ -18,7 +18,6 @@
package org.apache.atlas.discovery; package org.apache.atlas.discovery;
import org.apache.atlas.ApplicationProperties; import org.apache.atlas.ApplicationProperties;
import org.apache.atlas.AtlasException;
import org.apache.atlas.BasicTestSetup; import org.apache.atlas.BasicTestSetup;
import org.apache.atlas.TestModules; import org.apache.atlas.TestModules;
import org.apache.atlas.exception.AtlasBaseException; import org.apache.atlas.exception.AtlasBaseException;
...@@ -49,7 +48,9 @@ public class AtlasDiscoveryServiceTest extends BasicTestSetup { ...@@ -49,7 +48,9 @@ public class AtlasDiscoveryServiceTest extends BasicTestSetup {
private AtlasDiscoveryService discoveryService; private AtlasDiscoveryService discoveryService;
@BeforeClass @BeforeClass
public void setup() throws AtlasException, AtlasBaseException { public void setup() throws Exception {
super.initialize();
ApplicationProperties.get().setProperty(ApplicationProperties.ENABLE_FREETEXT_SEARCH_CONF, true); ApplicationProperties.get().setProperty(ApplicationProperties.ENABLE_FREETEXT_SEARCH_CONF, true);
setupTestData(); setupTestData();
createDimensionalTaggedEntity("sales"); createDimensionalTaggedEntity("sales");
...@@ -332,7 +333,9 @@ public class AtlasDiscoveryServiceTest extends BasicTestSetup { ...@@ -332,7 +333,9 @@ public class AtlasDiscoveryServiceTest extends BasicTestSetup {
} }
@AfterClass @AfterClass
public void teardown() { public void teardown() throws Exception {
AtlasGraphProvider.cleanup(); AtlasGraphProvider.cleanup();
super.cleanup();
} }
} }
...@@ -65,7 +65,9 @@ public class ClassificationSearchProcessorTest extends BasicTestSetup { ...@@ -65,7 +65,9 @@ public class ClassificationSearchProcessorTest extends BasicTestSetup {
private String dimensionalTagGuid; private String dimensionalTagGuid;
@BeforeClass @BeforeClass
public void setup() throws AtlasBaseException { public void setup() throws Exception {
super.initialize();
setupTestData(); setupTestData();
createDimensionTaggedEntityAndDelete(); createDimensionTaggedEntityAndDelete();
createDimensionalTaggedEntityWithAttr(); createDimensionalTaggedEntityWithAttr();
...@@ -298,7 +300,9 @@ public class ClassificationSearchProcessorTest extends BasicTestSetup { ...@@ -298,7 +300,9 @@ public class ClassificationSearchProcessorTest extends BasicTestSetup {
} }
@AfterClass @AfterClass
public void teardown() { public void teardown() throws Exception {
AtlasGraphProvider.cleanup(); AtlasGraphProvider.cleanup();
super.cleanup();
} }
} }
...@@ -63,7 +63,9 @@ public class EntitySearchProcessorTest extends BasicTestSetup { ...@@ -63,7 +63,9 @@ public class EntitySearchProcessorTest extends BasicTestSetup {
private EntityGraphRetriever entityRetriever; private EntityGraphRetriever entityRetriever;
@BeforeClass @BeforeClass
public void setup() { public void setup() throws Exception {
super.initialize();
setupTestData(); setupTestData();
} }
...@@ -363,8 +365,10 @@ public class EntitySearchProcessorTest extends BasicTestSetup { ...@@ -363,8 +365,10 @@ public class EntitySearchProcessorTest extends BasicTestSetup {
} }
@AfterClass @AfterClass
public void teardown() { public void teardown() throws Exception {
AtlasGraphProvider.cleanup(); AtlasGraphProvider.cleanup();
super.cleanup();
} }
@Test @Test
......
...@@ -52,7 +52,9 @@ public class FreeTextSearchProcessorTest extends BasicTestSetup { ...@@ -52,7 +52,9 @@ public class FreeTextSearchProcessorTest extends BasicTestSetup {
private EntityGraphRetriever entityRetriever; private EntityGraphRetriever entityRetriever;
@BeforeClass @BeforeClass
public void setup() { public void setup() throws Exception {
super.initialize();
setupTestData(); setupTestData();
} }
...@@ -131,8 +133,10 @@ public class FreeTextSearchProcessorTest extends BasicTestSetup { ...@@ -131,8 +133,10 @@ public class FreeTextSearchProcessorTest extends BasicTestSetup {
} }
@AfterClass @AfterClass
public void teardown() { public void teardown() throws Exception {
AtlasGraphProvider.cleanup(); AtlasGraphProvider.cleanup();
super.cleanup();
} }
} }
\ No newline at end of file
...@@ -23,7 +23,6 @@ import org.apache.atlas.discovery.EntityDiscoveryService; ...@@ -23,7 +23,6 @@ import org.apache.atlas.discovery.EntityDiscoveryService;
import org.apache.atlas.exception.AtlasBaseException; import org.apache.atlas.exception.AtlasBaseException;
import org.apache.atlas.model.discovery.AtlasSearchResult; import org.apache.atlas.model.discovery.AtlasSearchResult;
import org.apache.atlas.repository.graph.AtlasGraphProvider; import org.apache.atlas.repository.graph.AtlasGraphProvider;
import org.apache.atlas.runner.LocalSolrRunner;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
...@@ -40,7 +39,6 @@ import java.util.HashMap; ...@@ -40,7 +39,6 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import static org.apache.atlas.graph.GraphSandboxUtil.useLocalSolr;
import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertNotNull; import static org.testng.Assert.assertNotNull;
import static org.testng.Assert.assertNull; import static org.testng.Assert.assertNull;
...@@ -57,7 +55,8 @@ public class DSLQueriesTest extends BasicTestSetup { ...@@ -57,7 +55,8 @@ public class DSLQueriesTest extends BasicTestSetup {
@BeforeClass @BeforeClass
public void setup() throws Exception { public void setup() throws Exception {
LocalSolrRunner.start(); super.initialize();
setupTestData(); setupTestData();
pollForData(); pollForData();
...@@ -127,9 +126,7 @@ public class DSLQueriesTest extends BasicTestSetup { ...@@ -127,9 +126,7 @@ public class DSLQueriesTest extends BasicTestSetup {
public void teardown() throws Exception { public void teardown() throws Exception {
AtlasGraphProvider.cleanup(); AtlasGraphProvider.cleanup();
if (useLocalSolr()) { super.cleanup();
LocalSolrRunner.stop();
}
} }
@DataProvider(name = "comparisonQueriesProvider") @DataProvider(name = "comparisonQueriesProvider")
......
...@@ -23,6 +23,7 @@ import org.apache.atlas.model.impexp.ExportImportAuditEntry; ...@@ -23,6 +23,7 @@ import org.apache.atlas.model.impexp.ExportImportAuditEntry;
import org.apache.atlas.model.instance.AtlasEntity; import org.apache.atlas.model.instance.AtlasEntity;
import org.apache.atlas.repository.impexp.ExportImportAuditService; import org.apache.atlas.repository.impexp.ExportImportAuditService;
import org.apache.atlas.repository.store.graph.v2.AtlasEntityStoreV2; import org.apache.atlas.repository.store.graph.v2.AtlasEntityStoreV2;
import org.apache.atlas.runner.LocalSolrRunner;
import org.apache.atlas.store.AtlasTypeDefStore; import org.apache.atlas.store.AtlasTypeDefStore;
import org.apache.atlas.type.AtlasTypeRegistry; import org.apache.atlas.type.AtlasTypeRegistry;
import org.testng.SkipException; import org.testng.SkipException;
...@@ -31,6 +32,7 @@ import java.io.IOException; ...@@ -31,6 +32,7 @@ import java.io.IOException;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import static org.apache.atlas.graph.GraphSandboxUtil.useLocalSolr;
import static org.apache.atlas.utils.TestLoadModelUtils.createAtlasEntity; import static org.apache.atlas.utils.TestLoadModelUtils.createAtlasEntity;
import static org.apache.atlas.utils.TestLoadModelUtils.loadBaseModel; import static org.apache.atlas.utils.TestLoadModelUtils.loadBaseModel;
import static org.apache.atlas.utils.TestLoadModelUtils.loadEntity; import static org.apache.atlas.utils.TestLoadModelUtils.loadEntity;
...@@ -47,6 +49,17 @@ public class AtlasTestBase { ...@@ -47,6 +49,17 @@ public class AtlasTestBase {
protected static final String TABLE_VIEW_GUID = "56415119-7cb0-40dd-ace8-1e50efd54991"; protected static final String TABLE_VIEW_GUID = "56415119-7cb0-40dd-ace8-1e50efd54991";
protected static final String COLUMN_GUID_HIGH = "f87a5320-1529-4369-8d63-b637ebdf2c1c"; protected static final String COLUMN_GUID_HIGH = "f87a5320-1529-4369-8d63-b637ebdf2c1c";
protected void initialize() throws Exception {
if (useLocalSolr()) {
LocalSolrRunner.start();
}
}
protected void cleanup() throws Exception {
if (useLocalSolr()) {
LocalSolrRunner.stop();
}
}
protected void basicSetup(AtlasTypeDefStore typeDefStore, AtlasTypeRegistry typeRegistry) throws IOException, AtlasBaseException { protected void basicSetup(AtlasTypeDefStore typeDefStore, AtlasTypeRegistry typeRegistry) throws IOException, AtlasBaseException {
loadBaseModel(typeDefStore, typeRegistry); loadBaseModel(typeDefStore, typeRegistry);
......
...@@ -30,7 +30,6 @@ import org.apache.atlas.repository.graph.AtlasGraphProvider; ...@@ -30,7 +30,6 @@ import org.apache.atlas.repository.graph.AtlasGraphProvider;
import org.apache.atlas.repository.store.bootstrap.AtlasTypeDefStoreInitializer; import org.apache.atlas.repository.store.bootstrap.AtlasTypeDefStoreInitializer;
import org.apache.atlas.repository.store.graph.v2.AtlasEntityStoreV2; import org.apache.atlas.repository.store.graph.v2.AtlasEntityStoreV2;
import org.apache.atlas.repository.store.graph.v2.AtlasEntityStream; import org.apache.atlas.repository.store.graph.v2.AtlasEntityStream;
import org.apache.atlas.runner.LocalSolrRunner;
import org.apache.atlas.store.AtlasTypeDefStore; import org.apache.atlas.store.AtlasTypeDefStore;
import org.apache.atlas.type.AtlasTypeRegistry; import org.apache.atlas.type.AtlasTypeRegistry;
import org.apache.atlas.utils.TestResourceFileUtils; import org.apache.atlas.utils.TestResourceFileUtils;
...@@ -39,6 +38,7 @@ import org.slf4j.LoggerFactory; ...@@ -39,6 +38,7 @@ import org.slf4j.LoggerFactory;
import org.testng.Assert; import org.testng.Assert;
import org.testng.SkipException; import org.testng.SkipException;
import org.testng.annotations.AfterClass; import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeTest; import org.testng.annotations.BeforeTest;
import org.testng.annotations.Guice; import org.testng.annotations.Guice;
import org.testng.annotations.Test; import org.testng.annotations.Test;
...@@ -48,7 +48,6 @@ import java.io.IOException; ...@@ -48,7 +48,6 @@ import java.io.IOException;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import static org.apache.atlas.graph.GraphSandboxUtil.useLocalSolr;
import static org.testng.Assert.assertNotNull; import static org.testng.Assert.assertNotNull;
import static org.testng.Assert.assertTrue; import static org.testng.Assert.assertTrue;
import static org.testng.Assert.fail; import static org.testng.Assert.fail;
...@@ -72,6 +71,11 @@ public class AdminPurgeTest extends AtlasTestBase { ...@@ -72,6 +71,11 @@ public class AdminPurgeTest extends AtlasTestBase {
@Inject @Inject
private AtlasEntityStoreV2 entityStore; private AtlasEntityStoreV2 entityStore;
@BeforeClass
public void initialize() throws Exception {
super.initialize();
}
@BeforeTest @BeforeTest
public void setupTest() throws IOException, AtlasBaseException { public void setupTest() throws IOException, AtlasBaseException {
RequestContext.clear(); RequestContext.clear();
...@@ -84,9 +88,7 @@ public class AdminPurgeTest extends AtlasTestBase { ...@@ -84,9 +88,7 @@ public class AdminPurgeTest extends AtlasTestBase {
Thread.sleep(1000); Thread.sleep(1000);
AtlasGraphProvider.cleanup(); AtlasGraphProvider.cleanup();
if (useLocalSolr()) { super.cleanup();
LocalSolrRunner.stop();
}
} }
@Test @Test
......
...@@ -33,7 +33,6 @@ import org.apache.atlas.repository.graph.AtlasGraphProvider; ...@@ -33,7 +33,6 @@ import org.apache.atlas.repository.graph.AtlasGraphProvider;
import org.apache.atlas.repository.store.bootstrap.AtlasTypeDefStoreInitializer; import org.apache.atlas.repository.store.bootstrap.AtlasTypeDefStoreInitializer;
import org.apache.atlas.repository.store.graph.v2.AtlasEntityStoreV2; import org.apache.atlas.repository.store.graph.v2.AtlasEntityStoreV2;
import org.apache.atlas.repository.store.graph.v2.AtlasEntityStream; import org.apache.atlas.repository.store.graph.v2.AtlasEntityStream;
import org.apache.atlas.runner.LocalSolrRunner;
import org.apache.atlas.store.AtlasTypeDefStore; import org.apache.atlas.store.AtlasTypeDefStore;
import org.apache.atlas.type.AtlasType; import org.apache.atlas.type.AtlasType;
import org.apache.atlas.type.AtlasTypeRegistry; import org.apache.atlas.type.AtlasTypeRegistry;
...@@ -56,7 +55,6 @@ import java.util.HashMap; ...@@ -56,7 +55,6 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import static org.apache.atlas.graph.GraphSandboxUtil.useLocalSolr;
import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertNotNull; import static org.testng.Assert.assertNotNull;
import static org.testng.Assert.assertTrue; import static org.testng.Assert.assertTrue;
...@@ -88,7 +86,9 @@ public class ExportServiceTest extends AtlasTestBase { ...@@ -88,7 +86,9 @@ public class ExportServiceTest extends AtlasTestBase {
} }
@BeforeClass @BeforeClass
public void setupSampleData() throws AtlasBaseException { public void setupSampleData() throws Exception {
super.initialize();
AtlasTypesDef sampleTypes = TestUtilsV2.defineDeptEmployeeTypes(); AtlasTypesDef sampleTypes = TestUtilsV2.defineDeptEmployeeTypes();
AtlasTypesDef typesToCreate = AtlasTypeDefStoreInitializer.getTypesToCreate(sampleTypes, typeRegistry); AtlasTypesDef typesToCreate = AtlasTypeDefStoreInitializer.getTypesToCreate(sampleTypes, typeRegistry);
...@@ -110,9 +110,7 @@ public class ExportServiceTest extends AtlasTestBase { ...@@ -110,9 +110,7 @@ public class ExportServiceTest extends AtlasTestBase {
assertExportImportAuditEntry(auditService); assertExportImportAuditEntry(auditService);
AtlasGraphProvider.cleanup(); AtlasGraphProvider.cleanup();
if (useLocalSolr()) { super.cleanup();
LocalSolrRunner.stop();
}
} }
private AtlasExportRequest getRequestForFullFetch() { private AtlasExportRequest getRequestForFullFetch() {
......
...@@ -31,12 +31,12 @@ import org.apache.atlas.repository.AtlasTestBase; ...@@ -31,12 +31,12 @@ import org.apache.atlas.repository.AtlasTestBase;
import org.apache.atlas.repository.graph.AtlasGraphProvider; import org.apache.atlas.repository.graph.AtlasGraphProvider;
import org.apache.atlas.repository.store.graph.AtlasEntityStore; import org.apache.atlas.repository.store.graph.AtlasEntityStore;
import org.apache.atlas.repository.store.graph.v2.AtlasEntityStream; import org.apache.atlas.repository.store.graph.v2.AtlasEntityStream;
import org.apache.atlas.runner.LocalSolrRunner;
import org.apache.atlas.store.AtlasTypeDefStore; import org.apache.atlas.store.AtlasTypeDefStore;
import org.apache.atlas.type.AtlasTypeRegistry; import org.apache.atlas.type.AtlasTypeRegistry;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.testng.annotations.AfterClass; import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeTest; import org.testng.annotations.BeforeTest;
import org.testng.annotations.Guice; import org.testng.annotations.Guice;
import org.testng.annotations.Test; import org.testng.annotations.Test;
...@@ -46,7 +46,6 @@ import java.io.InputStream; ...@@ -46,7 +46,6 @@ import java.io.InputStream;
import java.util.List; import java.util.List;
import static org.apache.atlas.AtlasClient.REFERENCEABLE_ATTRIBUTE_NAME; import static org.apache.atlas.AtlasClient.REFERENCEABLE_ATTRIBUTE_NAME;
import static org.apache.atlas.graph.GraphSandboxUtil.useLocalSolr;
import static org.apache.atlas.repository.impexp.ZipFileResourceTestUtils.getInputStreamFrom; import static org.apache.atlas.repository.impexp.ZipFileResourceTestUtils.getInputStreamFrom;
import static org.apache.atlas.repository.impexp.ZipFileResourceTestUtils.getDefaultImportRequest; import static org.apache.atlas.repository.impexp.ZipFileResourceTestUtils.getDefaultImportRequest;
import static org.apache.atlas.utils.TestLoadModelUtils.loadFsModel; import static org.apache.atlas.utils.TestLoadModelUtils.loadFsModel;
...@@ -87,6 +86,11 @@ public class ImportReactivateTableTest extends AtlasTestBase { ...@@ -87,6 +86,11 @@ public class ImportReactivateTableTest extends AtlasTestBase {
@Inject @Inject
private AtlasTypeDefStore typeDefStore; private AtlasTypeDefStore typeDefStore;
@BeforeClass
public void initialize() throws Exception {
super.initialize();
}
@BeforeTest @BeforeTest
public void setup() throws IOException, AtlasBaseException { public void setup() throws IOException, AtlasBaseException {
RequestContext.clear(); RequestContext.clear();
...@@ -98,9 +102,7 @@ public class ImportReactivateTableTest extends AtlasTestBase { ...@@ -98,9 +102,7 @@ public class ImportReactivateTableTest extends AtlasTestBase {
public void clear() throws Exception { public void clear() throws Exception {
AtlasGraphProvider.cleanup(); AtlasGraphProvider.cleanup();
if (useLocalSolr()) { super.cleanup();
LocalSolrRunner.stop();
}
} }
private void importSeedData() throws AtlasBaseException, IOException { private void importSeedData() throws AtlasBaseException, IOException {
......
...@@ -39,7 +39,6 @@ import org.apache.atlas.repository.graphdb.AtlasVertex; ...@@ -39,7 +39,6 @@ import org.apache.atlas.repository.graphdb.AtlasVertex;
import org.apache.atlas.repository.store.graph.AtlasEntityStore; import org.apache.atlas.repository.store.graph.AtlasEntityStore;
import org.apache.atlas.repository.store.graph.v2.AtlasEntityStream; import org.apache.atlas.repository.store.graph.v2.AtlasEntityStream;
import org.apache.atlas.repository.store.graph.v2.AtlasGraphUtilsV2; import org.apache.atlas.repository.store.graph.v2.AtlasGraphUtilsV2;
import org.apache.atlas.runner.LocalSolrRunner;
import org.apache.atlas.store.AtlasTypeDefStore; import org.apache.atlas.store.AtlasTypeDefStore;
import org.apache.atlas.type.AtlasClassificationType; import org.apache.atlas.type.AtlasClassificationType;
import org.apache.atlas.type.AtlasTypeRegistry; import org.apache.atlas.type.AtlasTypeRegistry;
...@@ -48,6 +47,7 @@ import org.mockito.stubbing.Answer; ...@@ -48,6 +47,7 @@ import org.mockito.stubbing.Answer;
import org.testng.ITestContext; import org.testng.ITestContext;
import org.testng.annotations.AfterClass; import org.testng.annotations.AfterClass;
import org.testng.annotations.AfterTest; import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeTest; import org.testng.annotations.BeforeTest;
import org.testng.annotations.DataProvider; import org.testng.annotations.DataProvider;
import org.testng.annotations.Guice; import org.testng.annotations.Guice;
...@@ -60,7 +60,6 @@ import java.util.HashMap; ...@@ -60,7 +60,6 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import static org.apache.atlas.graph.GraphSandboxUtil.useLocalSolr;
import static org.apache.atlas.repository.impexp.ZipFileResourceTestUtils.getDefaultImportRequest; import static org.apache.atlas.repository.impexp.ZipFileResourceTestUtils.getDefaultImportRequest;
import static org.apache.atlas.repository.impexp.ZipFileResourceTestUtils.getZipSource; import static org.apache.atlas.repository.impexp.ZipFileResourceTestUtils.getZipSource;
import static org.apache.atlas.repository.impexp.ZipFileResourceTestUtils.getInputStreamFrom; import static org.apache.atlas.repository.impexp.ZipFileResourceTestUtils.getInputStreamFrom;
...@@ -107,6 +106,11 @@ public class ImportServiceTest extends AtlasTestBase { ...@@ -107,6 +106,11 @@ public class ImportServiceTest extends AtlasTestBase {
this.importService = importService; this.importService = importService;
} }
@BeforeClass
public void initialize() throws Exception {
super.initialize();
}
@BeforeTest @BeforeTest
public void setupTest() { public void setupTest() {
RequestContext.clear(); RequestContext.clear();
...@@ -117,9 +121,7 @@ public class ImportServiceTest extends AtlasTestBase { ...@@ -117,9 +121,7 @@ public class ImportServiceTest extends AtlasTestBase {
public void clear() throws Exception { public void clear() throws Exception {
AtlasGraphProvider.cleanup(); AtlasGraphProvider.cleanup();
if (useLocalSolr()) { super.cleanup();
LocalSolrRunner.stop();
}
} }
@AfterTest @AfterTest
......
...@@ -28,7 +28,6 @@ import org.apache.atlas.model.instance.AtlasObjectId; ...@@ -28,7 +28,6 @@ import org.apache.atlas.model.instance.AtlasObjectId;
import org.apache.atlas.repository.AtlasTestBase; import org.apache.atlas.repository.AtlasTestBase;
import org.apache.atlas.repository.graph.AtlasGraphProvider; import org.apache.atlas.repository.graph.AtlasGraphProvider;
import org.apache.atlas.repository.store.graph.v2.AtlasEntityStoreV2; import org.apache.atlas.repository.store.graph.v2.AtlasEntityStoreV2;
import org.apache.atlas.runner.LocalSolrRunner;
import org.apache.atlas.store.AtlasTypeDefStore; import org.apache.atlas.store.AtlasTypeDefStore;
import org.apache.atlas.type.AtlasTypeRegistry; import org.apache.atlas.type.AtlasTypeRegistry;
import org.testng.ITestContext; import org.testng.ITestContext;
...@@ -49,7 +48,6 @@ import java.util.Map; ...@@ -49,7 +48,6 @@ import java.util.Map;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import static org.apache.atlas.graph.GraphSandboxUtil.useLocalSolr;
import static org.apache.atlas.repository.impexp.ZipFileResourceTestUtils.getZipSource; import static org.apache.atlas.repository.impexp.ZipFileResourceTestUtils.getZipSource;
import static org.apache.atlas.utils.TestLoadModelUtils.loadModelFromJson; import static org.apache.atlas.utils.TestLoadModelUtils.loadModelFromJson;
import static org.apache.atlas.repository.impexp.ZipFileResourceTestUtils.runImportWithNoParameters; import static org.apache.atlas.repository.impexp.ZipFileResourceTestUtils.runImportWithNoParameters;
...@@ -105,7 +103,9 @@ public class RelationshipAttributesExtractorTest extends AtlasTestBase { ...@@ -105,7 +103,9 @@ public class RelationshipAttributesExtractorTest extends AtlasTestBase {
private AtlasEntityStoreV2 entityStore; private AtlasEntityStoreV2 entityStore;
@BeforeClass @BeforeClass
public void setup() throws IOException, AtlasBaseException { public void setup() throws Exception {
super.initialize();
loadBaseModel(); loadBaseModel();
loadHiveModel(); loadHiveModel();
} }
...@@ -120,9 +120,7 @@ public class RelationshipAttributesExtractorTest extends AtlasTestBase { ...@@ -120,9 +120,7 @@ public class RelationshipAttributesExtractorTest extends AtlasTestBase {
public void clear() throws Exception { public void clear() throws Exception {
AtlasGraphProvider.cleanup(); AtlasGraphProvider.cleanup();
if (useLocalSolr()) { super.cleanup();
LocalSolrRunner.stop();
}
} }
@DataProvider(name = "hiveDb") @DataProvider(name = "hiveDb")
......
...@@ -27,7 +27,6 @@ import org.apache.atlas.model.impexp.ExportImportAuditEntry; ...@@ -27,7 +27,6 @@ import org.apache.atlas.model.impexp.ExportImportAuditEntry;
import org.apache.atlas.repository.AtlasTestBase; import org.apache.atlas.repository.AtlasTestBase;
import org.apache.atlas.repository.graph.AtlasGraphProvider; import org.apache.atlas.repository.graph.AtlasGraphProvider;
import org.apache.atlas.repository.store.graph.AtlasEntityStore; import org.apache.atlas.repository.store.graph.AtlasEntityStore;
import org.apache.atlas.runner.LocalSolrRunner;
import org.apache.atlas.store.AtlasTypeDefStore; import org.apache.atlas.store.AtlasTypeDefStore;
import org.apache.atlas.type.AtlasType; import org.apache.atlas.type.AtlasType;
import org.apache.atlas.type.AtlasTypeRegistry; import org.apache.atlas.type.AtlasTypeRegistry;
...@@ -35,17 +34,17 @@ import org.slf4j.Logger; ...@@ -35,17 +34,17 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.testng.ITestContext; import org.testng.ITestContext;
import org.testng.SkipException; import org.testng.SkipException;
import org.testng.annotations.Guice;
import org.testng.annotations.Test;
import org.testng.annotations.AfterClass; import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeTest; import org.testng.annotations.BeforeTest;
import org.testng.annotations.DataProvider; import org.testng.annotations.DataProvider;
import org.testng.annotations.Guice;
import org.testng.annotations.Test;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.util.List; import java.util.List;
import static org.apache.atlas.graph.GraphSandboxUtil.useLocalSolr;
import static org.apache.atlas.repository.impexp.ZipFileResourceTestUtils.getDefaultImportRequest; import static org.apache.atlas.repository.impexp.ZipFileResourceTestUtils.getDefaultImportRequest;
import static org.apache.atlas.repository.impexp.ZipFileResourceTestUtils.getZipSource; import static org.apache.atlas.repository.impexp.ZipFileResourceTestUtils.getZipSource;
import static org.apache.atlas.repository.impexp.ZipFileResourceTestUtils.getInputStreamFrom; import static org.apache.atlas.repository.impexp.ZipFileResourceTestUtils.getInputStreamFrom;
...@@ -87,6 +86,11 @@ public class TableReplicationRequestProcessorTest extends AtlasTestBase { ...@@ -87,6 +86,11 @@ public class TableReplicationRequestProcessorTest extends AtlasTestBase {
@Inject @Inject
private AtlasTypeDefStore typeDefStore; private AtlasTypeDefStore typeDefStore;
@BeforeClass
public void initialize() throws Exception {
super.initialize();
}
@BeforeTest @BeforeTest
public void setupTest() throws IOException, AtlasBaseException { public void setupTest() throws IOException, AtlasBaseException {
RequestContext.clear(); RequestContext.clear();
...@@ -98,9 +102,7 @@ public class TableReplicationRequestProcessorTest extends AtlasTestBase { ...@@ -98,9 +102,7 @@ public class TableReplicationRequestProcessorTest extends AtlasTestBase {
public void clear() throws Exception { public void clear() throws Exception {
AtlasGraphProvider.cleanup(); AtlasGraphProvider.cleanup();
if (useLocalSolr()) { super.cleanup();
LocalSolrRunner.stop();
}
} }
@DataProvider(name = "source1") @DataProvider(name = "source1")
......
...@@ -20,29 +20,29 @@ package org.apache.atlas.repository.migration; ...@@ -20,29 +20,29 @@ package org.apache.atlas.repository.migration;
import com.google.inject.Inject; import com.google.inject.Inject;
import org.apache.atlas.exception.AtlasBaseException; import org.apache.atlas.exception.AtlasBaseException;
import org.apache.atlas.repository.AtlasTestBase;
import org.apache.atlas.repository.graph.AtlasGraphProvider; import org.apache.atlas.repository.graph.AtlasGraphProvider;
import org.apache.atlas.repository.graph.GraphBackedSearchIndexer; import org.apache.atlas.repository.graph.GraphBackedSearchIndexer;
import org.apache.atlas.repository.graph.GraphHelper; import org.apache.atlas.repository.graph.GraphHelper;
import org.apache.atlas.repository.graphdb.*; import org.apache.atlas.repository.graphdb.*;
import org.apache.atlas.repository.store.bootstrap.AtlasTypeDefStoreInitializer; import org.apache.atlas.repository.store.bootstrap.AtlasTypeDefStoreInitializer;
import org.apache.atlas.repository.store.graph.v2.AtlasGraphUtilsV2; import org.apache.atlas.repository.store.graph.v2.AtlasGraphUtilsV2;
import org.apache.atlas.runner.LocalSolrRunner;
import org.apache.atlas.store.AtlasTypeDefStore; import org.apache.atlas.store.AtlasTypeDefStore;
import org.apache.atlas.type.AtlasTypeRegistry; import org.apache.atlas.type.AtlasTypeRegistry;
import org.apache.atlas.utils.TestResourceFileUtils; import org.apache.atlas.utils.TestResourceFileUtils;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.testng.annotations.AfterClass; import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import java.io.IOException; import java.io.IOException;
import java.util.Iterator; import java.util.Iterator;
import static org.apache.atlas.graph.GraphSandboxUtil.useLocalSolr;
import static org.apache.atlas.utils.TestLoadModelUtils.loadModelFromJson; import static org.apache.atlas.utils.TestLoadModelUtils.loadModelFromJson;
import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertNotNull; import static org.testng.Assert.assertNotNull;
import static org.testng.Assert.assertTrue; import static org.testng.Assert.assertTrue;
public class MigrationBaseAsserts { public class MigrationBaseAsserts extends AtlasTestBase {
private static final String TYPE_NAME_PROPERTY = "__typeName"; private static final String TYPE_NAME_PROPERTY = "__typeName";
private static final String R_GUID_PROPERTY_NAME = "_r__guid"; private static final String R_GUID_PROPERTY_NAME = "_r__guid";
protected static final String ASSERT_NAME_PROPERTY = "Asset.name"; protected static final String ASSERT_NAME_PROPERTY = "Asset.name";
...@@ -67,13 +67,16 @@ public class MigrationBaseAsserts { ...@@ -67,13 +67,16 @@ public class MigrationBaseAsserts {
this.migrator = migrator; this.migrator = migrator;
} }
@BeforeClass
public void initialize() throws Exception {
super.initialize();
}
@AfterClass @AfterClass
public void clear() throws Exception { public void clear() throws Exception {
AtlasGraphProvider.cleanup(); AtlasGraphProvider.cleanup();
if (useLocalSolr()) { super.cleanup();
LocalSolrRunner.stop();
}
} }
protected void loadTypesFromJson() throws IOException, AtlasBaseException { protected void loadTypesFromJson() throws IOException, AtlasBaseException {
......
...@@ -29,7 +29,7 @@ import org.apache.atlas.model.typedef.AtlasEntityDef; ...@@ -29,7 +29,7 @@ import org.apache.atlas.model.typedef.AtlasEntityDef;
import org.apache.atlas.model.typedef.AtlasEnumDef; import org.apache.atlas.model.typedef.AtlasEnumDef;
import org.apache.atlas.model.typedef.AtlasStructDef; import org.apache.atlas.model.typedef.AtlasStructDef;
import org.apache.atlas.model.typedef.AtlasStructDef.AtlasAttributeDef; import org.apache.atlas.model.typedef.AtlasStructDef.AtlasAttributeDef;
import org.apache.atlas.runner.LocalSolrRunner; import org.apache.atlas.repository.AtlasTestBase;
import org.apache.atlas.store.AtlasTypeDefStore; import org.apache.atlas.store.AtlasTypeDefStore;
import org.apache.atlas.type.AtlasEntityType; import org.apache.atlas.type.AtlasEntityType;
import org.apache.atlas.type.AtlasClassificationType; import org.apache.atlas.type.AtlasClassificationType;
...@@ -39,10 +39,12 @@ import org.slf4j.Logger; ...@@ -39,10 +39,12 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.testng.Assert; import org.testng.Assert;
import org.testng.annotations.AfterClass; import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeTest; import org.testng.annotations.BeforeTest;
import org.testng.annotations.DataProvider; import org.testng.annotations.DataProvider;
import org.testng.annotations.Guice; import org.testng.annotations.Guice;
import org.testng.annotations.Test; import org.testng.annotations.Test;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
...@@ -52,11 +54,10 @@ import java.io.IOException; ...@@ -52,11 +54,10 @@ import java.io.IOException;
import java.util.Arrays; import java.util.Arrays;
import java.util.Date; import java.util.Date;
import static org.apache.atlas.graph.GraphSandboxUtil.useLocalSolr;
import static org.testng.Assert.*; import static org.testng.Assert.*;
@Guice(modules = TestModules.TestOnlyModule.class) @Guice(modules = TestModules.TestOnlyModule.class)
public class AtlasTypeDefGraphStoreTest { public class AtlasTypeDefGraphStoreTest extends AtlasTestBase {
private static final Logger LOG = LoggerFactory.getLogger(AtlasTypeDefGraphStoreTest.class); private static final Logger LOG = LoggerFactory.getLogger(AtlasTypeDefGraphStoreTest.class);
@Inject @Inject
...@@ -69,11 +70,14 @@ public class AtlasTypeDefGraphStoreTest { ...@@ -69,11 +70,14 @@ public class AtlasTypeDefGraphStoreTest {
RequestContext.get().setUser(TestUtilsV2.TEST_USER, null); RequestContext.get().setUser(TestUtilsV2.TEST_USER, null);
} }
@BeforeClass
public void initialize() throws Exception {
super.initialize();
}
@AfterClass @AfterClass
public void cleanup() throws Exception { public void cleanup() throws Exception {
if (useLocalSolr()) { super.cleanup();
LocalSolrRunner.stop();
}
} }
@Test @Test
......
...@@ -24,24 +24,24 @@ import org.apache.atlas.AtlasException; ...@@ -24,24 +24,24 @@ import org.apache.atlas.AtlasException;
import org.apache.atlas.TestModules; import org.apache.atlas.TestModules;
import org.apache.atlas.exception.AtlasBaseException; import org.apache.atlas.exception.AtlasBaseException;
import org.apache.atlas.model.typedef.AtlasEntityDef; import org.apache.atlas.model.typedef.AtlasEntityDef;
import org.apache.atlas.repository.AtlasTestBase;
import org.apache.atlas.repository.graph.AtlasGraphProvider; import org.apache.atlas.repository.graph.AtlasGraphProvider;
import org.apache.atlas.runner.LocalSolrRunner;
import org.apache.atlas.type.AtlasTypeUtil; import org.apache.atlas.type.AtlasTypeUtil;
import org.testng.Assert; import org.testng.Assert;
import org.testng.annotations.AfterClass; import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.DataProvider; import org.testng.annotations.DataProvider;
import org.testng.annotations.Guice; import org.testng.annotations.Guice;
import org.testng.annotations.Test; import org.testng.annotations.Test;
import java.util.Collections; import java.util.Collections;
import static org.apache.atlas.graph.GraphSandboxUtil.useLocalSolr;
/** /**
* Tests for AtlasEntityStoreV1 * Tests for AtlasEntityStoreV1
*/ */
@Guice(modules = TestModules.TestOnlyModule.class) @Guice(modules = TestModules.TestOnlyModule.class)
public class AtlasEntityDefStoreV2Test { public class AtlasEntityDefStoreV2Test extends AtlasTestBase {
@Inject @Inject
private private
...@@ -69,12 +69,15 @@ public class AtlasEntityDefStoreV2Test { ...@@ -69,12 +69,15 @@ public class AtlasEntityDefStoreV2Test {
} }
} }
@BeforeClass
public void initialize() throws Exception {
super.initialize();
}
@AfterClass @AfterClass
public void clear() throws Exception { public void clear() throws Exception {
AtlasGraphProvider.cleanup(); AtlasGraphProvider.cleanup();
if (useLocalSolr()) { super.cleanup();
LocalSolrRunner.stop();
}
} }
} }
...@@ -33,13 +33,13 @@ import org.apache.atlas.model.instance.EntityMutations.EntityOperation; ...@@ -33,13 +33,13 @@ import org.apache.atlas.model.instance.EntityMutations.EntityOperation;
import org.apache.atlas.model.typedef.AtlasClassificationDef; import org.apache.atlas.model.typedef.AtlasClassificationDef;
import org.apache.atlas.model.typedef.AtlasStructDef.AtlasAttributeDef; import org.apache.atlas.model.typedef.AtlasStructDef.AtlasAttributeDef;
import org.apache.atlas.model.typedef.AtlasTypesDef; import org.apache.atlas.model.typedef.AtlasTypesDef;
import org.apache.atlas.repository.AtlasTestBase;
import org.apache.atlas.repository.graph.AtlasGraphProvider; import org.apache.atlas.repository.graph.AtlasGraphProvider;
import org.apache.atlas.repository.graph.GraphBackedSearchIndexer; import org.apache.atlas.repository.graph.GraphBackedSearchIndexer;
import org.apache.atlas.repository.graphdb.AtlasGraph; import org.apache.atlas.repository.graphdb.AtlasGraph;
import org.apache.atlas.repository.store.bootstrap.AtlasTypeDefStoreInitializer; import org.apache.atlas.repository.store.bootstrap.AtlasTypeDefStoreInitializer;
import org.apache.atlas.repository.store.graph.AtlasEntityStore; import org.apache.atlas.repository.store.graph.AtlasEntityStore;
import org.apache.atlas.repository.store.graph.v1.DeleteHandlerDelegate; import org.apache.atlas.repository.store.graph.v1.DeleteHandlerDelegate;
import org.apache.atlas.runner.LocalSolrRunner;
import org.apache.atlas.store.AtlasTypeDefStore; import org.apache.atlas.store.AtlasTypeDefStore;
import org.apache.atlas.type.AtlasArrayType; import org.apache.atlas.type.AtlasArrayType;
import org.apache.atlas.type.AtlasMapType; import org.apache.atlas.type.AtlasMapType;
...@@ -62,12 +62,11 @@ import java.util.List; ...@@ -62,12 +62,11 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import static org.apache.atlas.TestUtilsV2.randomString; import static org.apache.atlas.TestUtilsV2.randomString;
import static org.apache.atlas.graph.GraphSandboxUtil.useLocalSolr;
import static org.mockito.Mockito.mock; import static org.mockito.Mockito.mock;
import static org.testng.Assert.fail; import static org.testng.Assert.fail;
@Guice(modules = TestModules.TestOnlyModule.class) @Guice(modules = TestModules.TestOnlyModule.class)
public class AtlasEntityTestBase { public class AtlasEntityTestBase extends AtlasTestBase {
@Inject @Inject
AtlasTypeRegistry typeRegistry; AtlasTypeRegistry typeRegistry;
...@@ -93,6 +92,8 @@ public class AtlasEntityTestBase { ...@@ -93,6 +92,8 @@ public class AtlasEntityTestBase {
RequestContext.clear(); RequestContext.clear();
RequestContext.get().setUser(TestUtilsV2.TEST_USER, null); RequestContext.get().setUser(TestUtilsV2.TEST_USER, null);
super.initialize();
new GraphBackedSearchIndexer(typeRegistry); new GraphBackedSearchIndexer(typeRegistry);
} }
...@@ -100,9 +101,7 @@ public class AtlasEntityTestBase { ...@@ -100,9 +101,7 @@ public class AtlasEntityTestBase {
public void clear() throws Exception { public void clear() throws Exception {
AtlasGraphProvider.cleanup(); AtlasGraphProvider.cleanup();
if (useLocalSolr()) { super.cleanup();
LocalSolrRunner.stop();
}
} }
@BeforeTest @BeforeTest
......
...@@ -26,23 +26,23 @@ import org.apache.atlas.exception.AtlasBaseException; ...@@ -26,23 +26,23 @@ import org.apache.atlas.exception.AtlasBaseException;
import org.apache.atlas.model.typedef.AtlasRelationshipDef; import org.apache.atlas.model.typedef.AtlasRelationshipDef;
import org.apache.atlas.model.typedef.AtlasRelationshipEndDef; import org.apache.atlas.model.typedef.AtlasRelationshipEndDef;
import org.apache.atlas.model.typedef.AtlasStructDef; import org.apache.atlas.model.typedef.AtlasStructDef;
import org.apache.atlas.repository.AtlasTestBase;
import org.apache.atlas.repository.graph.AtlasGraphProvider; import org.apache.atlas.repository.graph.AtlasGraphProvider;
import org.apache.atlas.runner.LocalSolrRunner;
import org.apache.atlas.type.AtlasTypeUtil; import org.apache.atlas.type.AtlasTypeUtil;
import org.testng.Assert; import org.testng.Assert;
import org.testng.annotations.AfterClass; import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.DataProvider; import org.testng.annotations.DataProvider;
import org.testng.annotations.Guice; import org.testng.annotations.Guice;
import org.testng.annotations.Test; import org.testng.annotations.Test;
import static org.apache.atlas.graph.GraphSandboxUtil.useLocalSolr;
import static org.testng.AssertJUnit.fail; import static org.testng.AssertJUnit.fail;
/** /**
* Tests for AtlasRelationshipStoreV1 * Tests for AtlasRelationshipStoreV1
*/ */
@Guice(modules = TestModules.TestOnlyModule.class) @Guice(modules = TestModules.TestOnlyModule.class)
public class AtlasRelationshipDefStoreV2Test { public class AtlasRelationshipDefStoreV2Test extends AtlasTestBase {
@Inject @Inject
private private
...@@ -325,12 +325,16 @@ public class AtlasRelationshipDefStoreV2Test { ...@@ -325,12 +325,16 @@ public class AtlasRelationshipDefStoreV2Test {
} }
} }
} }
@BeforeClass
public void initialize() throws Exception {
super.initialize();
}
@AfterClass @AfterClass
public void clear() throws Exception { public void clear() throws Exception {
AtlasGraphProvider.cleanup(); AtlasGraphProvider.cleanup();
if (useLocalSolr()) { super.cleanup();
LocalSolrRunner.stop();
}
} }
} }
...@@ -30,6 +30,7 @@ import org.apache.atlas.model.instance.AtlasObjectId; ...@@ -30,6 +30,7 @@ import org.apache.atlas.model.instance.AtlasObjectId;
import org.apache.atlas.model.instance.AtlasRelatedObjectId; import org.apache.atlas.model.instance.AtlasRelatedObjectId;
import org.apache.atlas.model.instance.EntityMutationResponse; import org.apache.atlas.model.instance.EntityMutationResponse;
import org.apache.atlas.model.typedef.AtlasTypesDef; import org.apache.atlas.model.typedef.AtlasTypesDef;
import org.apache.atlas.repository.AtlasTestBase;
import org.apache.atlas.repository.graph.AtlasGraphProvider; import org.apache.atlas.repository.graph.AtlasGraphProvider;
import org.apache.atlas.repository.graph.GraphBackedSearchIndexer; import org.apache.atlas.repository.graph.GraphBackedSearchIndexer;
import org.apache.atlas.repository.graphdb.AtlasGraph; import org.apache.atlas.repository.graphdb.AtlasGraph;
...@@ -37,7 +38,6 @@ import org.apache.atlas.repository.store.bootstrap.AtlasTypeDefStoreInitializer; ...@@ -37,7 +38,6 @@ import org.apache.atlas.repository.store.bootstrap.AtlasTypeDefStoreInitializer;
import org.apache.atlas.repository.store.graph.AtlasEntityStore; import org.apache.atlas.repository.store.graph.AtlasEntityStore;
import org.apache.atlas.repository.store.graph.AtlasRelationshipStore; import org.apache.atlas.repository.store.graph.AtlasRelationshipStore;
import org.apache.atlas.repository.store.graph.v1.DeleteHandlerDelegate; import org.apache.atlas.repository.store.graph.v1.DeleteHandlerDelegate;
import org.apache.atlas.runner.LocalSolrRunner;
import org.apache.atlas.store.AtlasTypeDefStore; import org.apache.atlas.store.AtlasTypeDefStore;
import org.apache.atlas.DeleteType; import org.apache.atlas.DeleteType;
import org.apache.atlas.type.AtlasEntityType; import org.apache.atlas.type.AtlasEntityType;
...@@ -61,7 +61,6 @@ import static org.apache.atlas.TestRelationshipUtilsV2.getDepartmentEmployeeInst ...@@ -61,7 +61,6 @@ import static org.apache.atlas.TestRelationshipUtilsV2.getDepartmentEmployeeInst
import static org.apache.atlas.TestRelationshipUtilsV2.getDepartmentEmployeeTypes; import static org.apache.atlas.TestRelationshipUtilsV2.getDepartmentEmployeeTypes;
import static org.apache.atlas.TestRelationshipUtilsV2.getInverseReferenceTestTypes; import static org.apache.atlas.TestRelationshipUtilsV2.getInverseReferenceTestTypes;
import static org.apache.atlas.TestUtilsV2.NAME; import static org.apache.atlas.TestUtilsV2.NAME;
import static org.apache.atlas.graph.GraphSandboxUtil.useLocalSolr;
import static org.apache.atlas.type.AtlasTypeUtil.getAtlasObjectId; import static org.apache.atlas.type.AtlasTypeUtil.getAtlasObjectId;
import static org.mockito.Mockito.mock; import static org.mockito.Mockito.mock;
import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertEquals;
...@@ -70,7 +69,7 @@ import static org.testng.Assert.assertNull; ...@@ -70,7 +69,7 @@ import static org.testng.Assert.assertNull;
import static org.testng.Assert.assertTrue; import static org.testng.Assert.assertTrue;
@Guice(modules = TestModules.TestOnlyModule.class) @Guice(modules = TestModules.TestOnlyModule.class)
public abstract class AtlasRelationshipStoreV2Test { public abstract class AtlasRelationshipStoreV2Test extends AtlasTestBase {
@Inject @Inject
AtlasTypeRegistry typeRegistry; AtlasTypeRegistry typeRegistry;
...@@ -103,6 +102,8 @@ public abstract class AtlasRelationshipStoreV2Test { ...@@ -103,6 +102,8 @@ public abstract class AtlasRelationshipStoreV2Test {
@BeforeClass @BeforeClass
public void setUp() throws Exception { public void setUp() throws Exception {
super.initialize();
new GraphBackedSearchIndexer(typeRegistry); new GraphBackedSearchIndexer(typeRegistry);
// create employee relationship types // create employee relationship types
...@@ -140,9 +141,7 @@ public abstract class AtlasRelationshipStoreV2Test { ...@@ -140,9 +141,7 @@ public abstract class AtlasRelationshipStoreV2Test {
public void clear() throws Exception { public void clear() throws Exception {
AtlasGraphProvider.cleanup(); AtlasGraphProvider.cleanup();
if (useLocalSolr()) { super.cleanup();
LocalSolrRunner.stop();
}
} }
@Test @Test
......
...@@ -29,10 +29,10 @@ import org.apache.atlas.model.instance.AtlasEntityHeader; ...@@ -29,10 +29,10 @@ import org.apache.atlas.model.instance.AtlasEntityHeader;
import org.apache.atlas.model.instance.AtlasObjectId; import org.apache.atlas.model.instance.AtlasObjectId;
import org.apache.atlas.model.instance.EntityMutationResponse; import org.apache.atlas.model.instance.EntityMutationResponse;
import org.apache.atlas.model.typedef.AtlasTypesDef; import org.apache.atlas.model.typedef.AtlasTypesDef;
import org.apache.atlas.repository.AtlasTestBase;
import org.apache.atlas.repository.graph.AtlasGraphProvider; import org.apache.atlas.repository.graph.AtlasGraphProvider;
import org.apache.atlas.repository.store.bootstrap.AtlasTypeDefStoreInitializer; import org.apache.atlas.repository.store.bootstrap.AtlasTypeDefStoreInitializer;
import org.apache.atlas.repository.store.graph.AtlasEntityStore; import org.apache.atlas.repository.store.graph.AtlasEntityStore;
import org.apache.atlas.runner.LocalSolrRunner;
import org.apache.atlas.store.AtlasTypeDefStore; import org.apache.atlas.store.AtlasTypeDefStore;
import org.apache.atlas.DeleteType; import org.apache.atlas.DeleteType;
import org.apache.atlas.type.AtlasEntityType; import org.apache.atlas.type.AtlasEntityType;
...@@ -50,7 +50,6 @@ import java.util.HashMap; ...@@ -50,7 +50,6 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import static org.apache.atlas.graph.GraphSandboxUtil.useLocalSolr;
import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertNull; import static org.testng.Assert.assertNull;
import static org.testng.Assert.assertTrue; import static org.testng.Assert.assertTrue;
...@@ -62,7 +61,7 @@ import static org.apache.atlas.TestUtilsV2.NAME; ...@@ -62,7 +61,7 @@ import static org.apache.atlas.TestUtilsV2.NAME;
* *
*/ */
@Guice(modules = TestModules.TestOnlyModule.class) @Guice(modules = TestModules.TestOnlyModule.class)
public abstract class InverseReferenceUpdateV2Test { public abstract class InverseReferenceUpdateV2Test extends AtlasTestBase {
@Inject @Inject
AtlasTypeRegistry typeRegistry; AtlasTypeRegistry typeRegistry;
...@@ -86,6 +85,8 @@ public abstract class InverseReferenceUpdateV2Test { ...@@ -86,6 +85,8 @@ public abstract class InverseReferenceUpdateV2Test {
RequestContext.clear(); RequestContext.clear();
RequestContext.get().setUser(TestUtilsV2.TEST_USER, null); RequestContext.get().setUser(TestUtilsV2.TEST_USER, null);
super.initialize();
AtlasTypesDef[] testTypesDefs = new AtlasTypesDef[] { TestUtilsV2.defineDeptEmployeeTypes(), AtlasTypesDef[] testTypesDefs = new AtlasTypesDef[] { TestUtilsV2.defineDeptEmployeeTypes(),
TestUtilsV2.defineInverseReferenceTestTypes() TestUtilsV2.defineInverseReferenceTestTypes()
}; };
...@@ -110,9 +111,7 @@ public abstract class InverseReferenceUpdateV2Test { ...@@ -110,9 +111,7 @@ public abstract class InverseReferenceUpdateV2Test {
public void clear() throws Exception { public void clear() throws Exception {
AtlasGraphProvider.cleanup(); AtlasGraphProvider.cleanup();
if (useLocalSolr()) { super.cleanup();
LocalSolrRunner.stop();
}
} }
@BeforeMethod @BeforeMethod
......
...@@ -33,12 +33,12 @@ import org.apache.atlas.model.lineage.AtlasLineageInfo.LineageRelation; ...@@ -33,12 +33,12 @@ import org.apache.atlas.model.lineage.AtlasLineageInfo.LineageRelation;
import org.apache.atlas.model.typedef.AtlasClassificationDef; import org.apache.atlas.model.typedef.AtlasClassificationDef;
import org.apache.atlas.model.typedef.AtlasStructDef.AtlasAttributeDef; import org.apache.atlas.model.typedef.AtlasStructDef.AtlasAttributeDef;
import org.apache.atlas.model.typedef.AtlasTypesDef; import org.apache.atlas.model.typedef.AtlasTypesDef;
import org.apache.atlas.repository.AtlasTestBase;
import org.apache.atlas.repository.graph.AtlasGraphProvider; import org.apache.atlas.repository.graph.AtlasGraphProvider;
import org.apache.atlas.repository.impexp.ImportService; import org.apache.atlas.repository.impexp.ImportService;
import org.apache.atlas.repository.impexp.ZipFileResourceTestUtils; import org.apache.atlas.repository.impexp.ZipFileResourceTestUtils;
import org.apache.atlas.repository.store.graph.AtlasEntityStore; import org.apache.atlas.repository.store.graph.AtlasEntityStore;
import org.apache.atlas.repository.store.graph.AtlasRelationshipStore; import org.apache.atlas.repository.store.graph.AtlasRelationshipStore;
import org.apache.atlas.runner.LocalSolrRunner;
import org.apache.atlas.store.AtlasTypeDefStore; import org.apache.atlas.store.AtlasTypeDefStore;
import org.apache.atlas.type.AtlasTypeRegistry; import org.apache.atlas.type.AtlasTypeRegistry;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
...@@ -60,7 +60,6 @@ import java.util.Map; ...@@ -60,7 +60,6 @@ import java.util.Map;
import java.util.Set; import java.util.Set;
import static org.apache.atlas.AtlasErrorCode.PROPAGATED_CLASSIFICATION_REMOVAL_NOT_SUPPORTED; import static org.apache.atlas.AtlasErrorCode.PROPAGATED_CLASSIFICATION_REMOVAL_NOT_SUPPORTED;
import static org.apache.atlas.graph.GraphSandboxUtil.useLocalSolr;
import static org.apache.atlas.model.lineage.AtlasLineageInfo.LineageDirection; import static org.apache.atlas.model.lineage.AtlasLineageInfo.LineageDirection;
import static org.apache.atlas.model.typedef.AtlasRelationshipDef.PropagateTags.BOTH; import static org.apache.atlas.model.typedef.AtlasRelationshipDef.PropagateTags.BOTH;
import static org.apache.atlas.model.typedef.AtlasRelationshipDef.PropagateTags.NONE; import static org.apache.atlas.model.typedef.AtlasRelationshipDef.PropagateTags.NONE;
...@@ -74,7 +73,7 @@ import static org.testng.Assert.assertTrue; ...@@ -74,7 +73,7 @@ import static org.testng.Assert.assertTrue;
import static org.testng.Assert.fail; import static org.testng.Assert.fail;
@Guice(modules = TestModules.TestOnlyModule.class) @Guice(modules = TestModules.TestOnlyModule.class)
public class ClassificationPropagationTest { public class ClassificationPropagationTest extends AtlasTestBase {
public static final String HDFS_PATH_EMPLOYEES = "HDFS_PATH_EMPLOYEES"; public static final String HDFS_PATH_EMPLOYEES = "HDFS_PATH_EMPLOYEES";
public static final String EMPLOYEES1_TABLE = "EMPLOYEES1_TABLE"; public static final String EMPLOYEES1_TABLE = "EMPLOYEES1_TABLE";
public static final String EMPLOYEES2_TABLE = "EMPLOYEES2_TABLE"; public static final String EMPLOYEES2_TABLE = "EMPLOYEES2_TABLE";
...@@ -113,9 +112,11 @@ public class ClassificationPropagationTest { ...@@ -113,9 +112,11 @@ public class ClassificationPropagationTest {
private AtlasLineageInfo lineageInfo; private AtlasLineageInfo lineageInfo;
@BeforeClass @BeforeClass
public void setup() { public void setup() throws Exception {
RequestContext.clear(); RequestContext.clear();
super.initialize();
loadModelFilesAndImportTestData(); loadModelFilesAndImportTestData();
} }
...@@ -123,9 +124,7 @@ public class ClassificationPropagationTest { ...@@ -123,9 +124,7 @@ public class ClassificationPropagationTest {
public void clear() throws Exception { public void clear() throws Exception {
AtlasGraphProvider.cleanup(); AtlasGraphProvider.cleanup();
if (useLocalSolr()) { super.cleanup();
LocalSolrRunner.stop();
}
} }
/** This test uses the lineage graph: /** This test uses the lineage graph:
......
...@@ -26,13 +26,14 @@ import org.apache.atlas.model.profile.AtlasUserProfile; ...@@ -26,13 +26,14 @@ import org.apache.atlas.model.profile.AtlasUserProfile;
import org.apache.atlas.model.profile.AtlasUserSavedSearch; import org.apache.atlas.model.profile.AtlasUserSavedSearch;
import org.apache.atlas.model.typedef.AtlasEntityDef; import org.apache.atlas.model.typedef.AtlasEntityDef;
import org.apache.atlas.model.typedef.AtlasTypesDef; import org.apache.atlas.model.typedef.AtlasTypesDef;
import org.apache.atlas.repository.AtlasTestBase;
import org.apache.atlas.repository.graph.AtlasGraphProvider; import org.apache.atlas.repository.graph.AtlasGraphProvider;
import org.apache.atlas.repository.util.FilterUtil; import org.apache.atlas.repository.util.FilterUtil;
import org.apache.atlas.runner.LocalSolrRunner;
import org.apache.atlas.store.AtlasTypeDefStore; import org.apache.atlas.store.AtlasTypeDefStore;
import org.apache.atlas.type.AtlasType; import org.apache.atlas.type.AtlasType;
import org.apache.atlas.type.AtlasTypeRegistry; import org.apache.atlas.type.AtlasTypeRegistry;
import org.testng.annotations.AfterClass; import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Guice; import org.testng.annotations.Guice;
import org.testng.annotations.Test; import org.testng.annotations.Test;
...@@ -42,7 +43,6 @@ import java.util.ArrayList; ...@@ -42,7 +43,6 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Optional; import java.util.Optional;
import static org.apache.atlas.graph.GraphSandboxUtil.useLocalSolr;
import static org.apache.atlas.model.profile.AtlasUserSavedSearch.SavedSearchType.BASIC; import static org.apache.atlas.model.profile.AtlasUserSavedSearch.SavedSearchType.BASIC;
import static org.apache.atlas.utils.TestLoadModelUtils.loadModelFromJson; import static org.apache.atlas.utils.TestLoadModelUtils.loadModelFromJson;
import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertEquals;
...@@ -51,7 +51,7 @@ import static org.testng.Assert.assertNotNull; ...@@ -51,7 +51,7 @@ import static org.testng.Assert.assertNotNull;
import static org.testng.Assert.assertTrue; import static org.testng.Assert.assertTrue;
@Guice(modules = TestModules.TestOnlyModule.class) @Guice(modules = TestModules.TestOnlyModule.class)
public class UserProfileServiceTest { public class UserProfileServiceTest extends AtlasTestBase {
private UserProfileService userProfileService; private UserProfileService userProfileService;
private AtlasTypeDefStore typeDefStore; private AtlasTypeDefStore typeDefStore;
...@@ -68,13 +68,16 @@ public class UserProfileServiceTest { ...@@ -68,13 +68,16 @@ public class UserProfileServiceTest {
loadModelFromJson("0010-base_model.json", typeDefStore, typeRegistry); loadModelFromJson("0010-base_model.json", typeDefStore, typeRegistry);
} }
@BeforeClass
public void initialize() throws Exception {
super.initialize();
}
@AfterClass @AfterClass
public void clear() throws Exception { public void clear() throws Exception {
AtlasGraphProvider.cleanup(); AtlasGraphProvider.cleanup();
if (useLocalSolr()) { super.cleanup();
LocalSolrRunner.stop();
}
} }
@Test @Test
......
...@@ -21,10 +21,10 @@ import org.apache.atlas.RequestContext; ...@@ -21,10 +21,10 @@ import org.apache.atlas.RequestContext;
import org.apache.atlas.TestModules; import org.apache.atlas.TestModules;
import org.apache.atlas.exception.AtlasBaseException; import org.apache.atlas.exception.AtlasBaseException;
import org.apache.atlas.model.metrics.AtlasMetrics; import org.apache.atlas.model.metrics.AtlasMetrics;
import org.apache.atlas.repository.AtlasTestBase;
import org.apache.atlas.repository.graph.AtlasGraphProvider; import org.apache.atlas.repository.graph.AtlasGraphProvider;
import org.apache.atlas.repository.impexp.ImportService; import org.apache.atlas.repository.impexp.ImportService;
import org.apache.atlas.repository.impexp.ZipFileResourceTestUtils; import org.apache.atlas.repository.impexp.ZipFileResourceTestUtils;
import org.apache.atlas.runner.LocalSolrRunner;
import org.apache.atlas.store.AtlasTypeDefStore; import org.apache.atlas.store.AtlasTypeDefStore;
import org.apache.atlas.type.AtlasTypeRegistry; import org.apache.atlas.type.AtlasTypeRegistry;
import org.apache.atlas.util.AtlasMetricsCounter; import org.apache.atlas.util.AtlasMetricsCounter;
...@@ -45,7 +45,6 @@ import java.time.ZoneOffset; ...@@ -45,7 +45,6 @@ import java.time.ZoneOffset;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import static org.apache.atlas.graph.GraphSandboxUtil.useLocalSolr;
import static org.apache.atlas.model.metrics.AtlasMetrics.*; import static org.apache.atlas.model.metrics.AtlasMetrics.*;
import static org.apache.atlas.utils.TestLoadModelUtils.loadModelFromJson; import static org.apache.atlas.utils.TestLoadModelUtils.loadModelFromJson;
import static org.apache.atlas.repository.impexp.ZipFileResourceTestUtils.runImportWithNoParameters; import static org.apache.atlas.repository.impexp.ZipFileResourceTestUtils.runImportWithNoParameters;
...@@ -62,7 +61,7 @@ import static org.apache.atlas.services.MetricsService.TAG; ...@@ -62,7 +61,7 @@ import static org.apache.atlas.services.MetricsService.TAG;
import static org.testng.Assert.*; import static org.testng.Assert.*;
@Guice(modules = TestModules.TestOnlyModule.class) @Guice(modules = TestModules.TestOnlyModule.class)
public class MetricsServiceTest { public class MetricsServiceTest extends AtlasTestBase {
public static final String IMPORT_FILE = "metrics-entities-data.zip"; public static final String IMPORT_FILE = "metrics-entities-data.zip";
...@@ -121,9 +120,11 @@ public class MetricsServiceTest { ...@@ -121,9 +120,11 @@ public class MetricsServiceTest {
}}; }};
@BeforeClass @BeforeClass
public void setup() { public void setup() throws Exception {
RequestContext.clear(); RequestContext.clear();
super.initialize();
loadModelFilesAndImportTestData(); loadModelFilesAndImportTestData();
// sleep for sometime for import to complete // sleep for sometime for import to complete
...@@ -142,9 +143,7 @@ public class MetricsServiceTest { ...@@ -142,9 +143,7 @@ public class MetricsServiceTest {
public void clear() throws Exception { public void clear() throws Exception {
AtlasGraphProvider.cleanup(); AtlasGraphProvider.cleanup();
if (useLocalSolr()) { super.cleanup();
LocalSolrRunner.stop();
}
} }
@Test @Test
......
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
<dependency> <dependency>
<groupId>org.apache.solr</groupId> <groupId>org.apache.solr</groupId>
<artifactId>solr-test-framework</artifactId> <artifactId>solr-test-framework</artifactId>
<version>7.0.0</version> <version>${solr-test-framework.version}</version>
<scope>compile</scope> <scope>compile</scope>
<exclusions> <exclusions>
<exclusion> <exclusion>
...@@ -75,6 +75,19 @@ ...@@ -75,6 +75,19 @@
<artifactId>commons-fileupload</artifactId> <artifactId>commons-fileupload</artifactId>
<version>1.3.3</version> <version>1.3.3</version>
</dependency> </dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
</dependency>
<dependency>
<groupId>org.apache.atlas</groupId>
<artifactId>atlas-intg</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
</dependency>
</dependencies> </dependencies>
<build> <build>
......
...@@ -14,7 +14,9 @@ ...@@ -14,7 +14,9 @@
package org.apache.atlas.runner; package org.apache.atlas.runner;
import org.apache.atlas.ApplicationProperties;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.configuration.Configuration;
import org.apache.commons.io.FileUtils; import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils; import org.apache.commons.io.IOUtils;
import org.apache.commons.lang.ArrayUtils; import org.apache.commons.lang.ArrayUtils;
...@@ -43,6 +45,9 @@ public class LocalSolrRunner { ...@@ -43,6 +45,9 @@ public class LocalSolrRunner {
private static final String TEMPLATE_DIRECTORY = "core-template"; private static final String TEMPLATE_DIRECTORY = "core-template";
protected static final String[] COLLECTIONS = readCollections(); protected static final String[] COLLECTIONS = readCollections();
// from org.apache.atlas.repository.graphdb.janus.AtlasJanusGraphDatabase
public static final String SOLR_ZOOKEEPER_URL = "atlas.graph.index.search.solr.zookeeper-url";
private static final Logger LOG = LoggerFactory.getLogger(LocalSolrRunner.class); private static final Logger LOG = LoggerFactory.getLogger(LocalSolrRunner.class);
private static MiniSolrCloudCluster miniSolrCloudCluster; private static MiniSolrCloudCluster miniSolrCloudCluster;
...@@ -78,6 +83,15 @@ public class LocalSolrRunner { ...@@ -78,6 +83,15 @@ public class LocalSolrRunner {
LOG.info("Uploading solr configurations for core: '{}', configPath: '{}'", coreName, coreConfigPath); LOG.info("Uploading solr configurations for core: '{}', configPath: '{}'", coreName, coreConfigPath);
} }
try {
Configuration configuration = ApplicationProperties.get();
configuration.clearProperty(SOLR_ZOOKEEPER_URL);
configuration.setProperty(SOLR_ZOOKEEPER_URL, LocalSolrRunner.getZookeeperUrls());
} catch (Exception e) {
throw new RuntimeException("Failed to start embedded solr cloud server. Aborting!", e);
}
LOG.info("<== LocalSolrRunner.start()"); LOG.info("<== LocalSolrRunner.start()");
} }
...@@ -160,4 +174,4 @@ public class LocalSolrRunner { ...@@ -160,4 +174,4 @@ public class LocalSolrRunner {
System.out.println("Bad first argument: " + Arrays.toString(args)); System.out.println("Bad first argument: " + Arrays.toString(args));
} }
} }
} }
\ No newline at end of file
...@@ -496,6 +496,11 @@ ...@@ -496,6 +496,11 @@
<version>${keycloak.version}</version> <version>${keycloak.version}</version>
</dependency> </dependency>
<dependency>
<groupId>org.apache.atlas</groupId>
<artifactId>atlas-testtools</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies> </dependencies>
<build> <build>
......
...@@ -21,15 +21,11 @@ package org.apache.atlas.web.security; ...@@ -21,15 +21,11 @@ package org.apache.atlas.web.security;
import org.apache.atlas.ApplicationProperties; import org.apache.atlas.ApplicationProperties;
import org.apache.atlas.AtlasClient; import org.apache.atlas.AtlasClient;
import org.apache.atlas.web.TestUtils; import org.apache.atlas.web.TestUtils;
import org.apache.commons.configuration.Configuration;
import org.apache.commons.configuration.PropertiesConfiguration; import org.apache.commons.configuration.PropertiesConfiguration;
import org.apache.hadoop.fs.Path; import org.apache.hadoop.fs.Path;
import org.apache.hadoop.security.UserGroupInformation; import org.apache.hadoop.security.UserGroupInformation;
import org.apache.hadoop.security.alias.JavaKeyStoreProvider; import org.apache.hadoop.security.alias.JavaKeyStoreProvider;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test; import org.testng.annotations.Test;
import org.junit.Ignore;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.net.URL; import java.net.URL;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment