Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
atlas
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
dataplatform
atlas
Commits
235f4e9e
Commit
235f4e9e
authored
Apr 25, 2017
by
apoorvnaik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ATLAS-1753: Sandbox test data to avoid interference
parent
b6eef8c2
Hide whitespace changes
Inline
Side-by-side
Showing
61 changed files
with
520 additions
and
471 deletions
+520
-471
pom.xml
graphdb/common/pom.xml
+17
-7
GraphSandboxUtil.java
...rc/test/java/org/apache/atlas/graph/GraphSandboxUtil.java
+52
-0
pom.xml
graphdb/titan0/pom.xml
+8
-0
AbstractGraphDatabaseTest.java
.../repository/graphdb/titan0/AbstractGraphDatabaseTest.java
+7
-9
Titan0DatabaseTest.java
...e/atlas/repository/graphdb/titan0/Titan0DatabaseTest.java
+13
-15
Titan0DatabaseValidationTest.java
...pository/graphdb/titan0/Titan0DatabaseValidationTest.java
+3
-0
pom.xml
graphdb/titan1/pom.xml
+8
-0
AbstractGraphDatabaseTest.java
.../repository/graphdb/titan1/AbstractGraphDatabaseTest.java
+7
-9
Titan1DatabaseTest.java
...e/atlas/repository/graphdb/titan1/Titan1DatabaseTest.java
+12
-14
TitanGraphProviderTest.java
...las/repository/graphdb/titan1/TitanGraphProviderTest.java
+3
-0
pom.xml
pom.xml
+11
-4
pom.xml
repository/pom.xml
+13
-3
BaseRepositoryTest.java
...ry/src/test/java/org/apache/atlas/BaseRepositoryTest.java
+5
-16
DBSandboxer.java
repository/src/test/java/org/apache/atlas/DBSandboxer.java
+35
-0
RepositoryServiceLoadingTest.java
...t/java/org/apache/atlas/RepositoryServiceLoadingTest.java
+1
-1
TestOnlyModule.java
...sitory/src/test/java/org/apache/atlas/TestOnlyModule.java
+30
-0
TestUtils.java
repository/src/test/java/org/apache/atlas/TestUtils.java
+25
-42
DataSetLineageServiceTest.java
...org/apache/atlas/discovery/DataSetLineageServiceTest.java
+2
-2
GraphBackedDiscoveryServiceTest.java
...ache/atlas/discovery/GraphBackedDiscoveryServiceTest.java
+12
-24
EntityLineageServiceTest.java
...va/org/apache/atlas/lineage/EntityLineageServiceTest.java
+13
-16
QueryProcessorTest.java
.../test/java/org/apache/atlas/query/QueryProcessorTest.java
+9
-11
AbstractGremlinQueryOptimizerTest.java
...s/repository/graph/AbstractGremlinQueryOptimizerTest.java
+14
-11
GraphBackedMetadataRepositoryDeleteTestBase.java
...ry/graph/GraphBackedMetadataRepositoryDeleteTestBase.java
+5
-23
GraphBackedMetadataRepositoryTest.java
...s/repository/graph/GraphBackedMetadataRepositoryTest.java
+23
-26
GraphBackedRepositoryHardDeleteTest.java
...repository/graph/GraphBackedRepositoryHardDeleteTest.java
+1
-2
GraphBackedRepositorySoftDeleteTest.java
...repository/graph/GraphBackedRepositorySoftDeleteTest.java
+1
-2
GraphBackedSearchIndexerTest.java
.../atlas/repository/graph/GraphBackedSearchIndexerTest.java
+10
-13
GraphHelperMockTest.java
...rg/apache/atlas/repository/graph/GraphHelperMockTest.java
+6
-6
GraphHelperTest.java
...va/org/apache/atlas/repository/graph/GraphHelperTest.java
+14
-19
GraphRepoMapperScaleTest.java
...ache/atlas/repository/graph/GraphRepoMapperScaleTest.java
+3
-4
Gremlin2QueryOptimizerTest.java
...he/atlas/repository/graph/Gremlin2QueryOptimizerTest.java
+4
-3
Gremlin3QueryOptimizerTest.java
...he/atlas/repository/graph/Gremlin3QueryOptimizerTest.java
+4
-1
ReverseReferenceUpdateHardDeleteTest.java
...epository/graph/ReverseReferenceUpdateHardDeleteTest.java
+2
-2
ReverseReferenceUpdateSoftDeleteTest.java
...epository/graph/ReverseReferenceUpdateSoftDeleteTest.java
+3
-3
ReverseReferenceUpdateTestBase.java
...tlas/repository/graph/ReverseReferenceUpdateTestBase.java
+9
-10
ExportServiceTest.java
...org/apache/atlas/repository/impexp/ExportServiceTest.java
+4
-4
ImportServiceReportingTest.java
...e/atlas/repository/impexp/ImportServiceReportingTest.java
+2
-11
ImportServiceTest.java
...org/apache/atlas/repository/impexp/ImportServiceTest.java
+2
-2
AtlasTypeDefGraphStoreTest.java
...as/repository/store/graph/AtlasTypeDefGraphStoreTest.java
+3
-10
AtlasDeleteHandlerV1Test.java
...s/repository/store/graph/v1/AtlasDeleteHandlerV1Test.java
+3
-10
AtlasEntityStoreV1Test.java
...las/repository/store/graph/v1/AtlasEntityStoreV1Test.java
+2
-2
InverseReferenceUpdateHardDeleteV1Test.java
...tore/graph/v1/InverseReferenceUpdateHardDeleteV1Test.java
+5
-6
InverseReferenceUpdateSoftDeleteV1Test.java
...tore/graph/v1/InverseReferenceUpdateSoftDeleteV1Test.java
+5
-6
InverseReferenceUpdateV1Test.java
...pository/store/graph/v1/InverseReferenceUpdateV1Test.java
+15
-17
GraphBackedTypeStoreTest.java
.../atlas/repository/typestore/GraphBackedTypeStoreTest.java
+2
-2
StoreBackedTypeCacheConfigurationTest.java
...tory/typestore/StoreBackedTypeCacheConfigurationTest.java
+2
-3
StoreBackedTypeCacheTest.java
.../atlas/repository/typestore/StoreBackedTypeCacheTest.java
+7
-9
StoreBackedTypeCacheTestOnlyModule.java
...ository/typestore/StoreBackedTypeCacheTestOnlyModule.java
+3
-2
DefaultMetadataServiceTest.java
.../org/apache/atlas/service/DefaultMetadataServiceTest.java
+17
-30
StoreBackedTypeCacheMetadataServiceTest.java
...tlas/service/StoreBackedTypeCacheMetadataServiceTest.java
+6
-8
CompiledQueryCacheKeyTest.java
...java/org/apache/atlas/util/CompiledQueryCacheKeyTest.java
+3
-3
HiveModel.java
...itory/src/test/java/org/apache/atlas/utils/HiveModel.java
+7
-7
ExpressionTest.scala
...rc/test/scala/org/apache/atlas/query/ExpressionTest.scala
+2
-1
GremlinTest.scala
...y/src/test/scala/org/apache/atlas/query/GremlinTest.scala
+16
-17
GremlinTest2.scala
.../src/test/scala/org/apache/atlas/query/GremlinTest2.scala
+4
-8
LexerTest.scala
...ory/src/test/scala/org/apache/atlas/query/LexerTest.scala
+2
-1
LineageQueryTest.scala
.../test/scala/org/apache/atlas/query/LineageQueryTest.scala
+2
-5
ParserTest.scala
...ry/src/test/scala/org/apache/atlas/query/ParserTest.scala
+2
-1
pom.xml
webapp/pom.xml
+12
-0
TestEntitiesREST.java
.../java/org/apache/atlas/web/adapters/TestEntitiesREST.java
+4
-5
TestEntityREST.java
...st/java/org/apache/atlas/web/adapters/TestEntityREST.java
+3
-3
No files found.
graphdb/common/pom.xml
View file @
235f4e9e
...
...
@@ -34,13 +34,6 @@ under the License. -->
</dependency>
<dependency>
<groupId>
junit
</groupId>
<artifactId>
junit
</artifactId>
<version>
4.9
</version>
<scope>
test
</scope>
</dependency>
<dependency>
<groupId>
org.testng
</groupId>
<artifactId>
testng
</artifactId>
<version>
6.9.4
</version>
...
...
@@ -55,4 +48,21 @@ under the License. -->
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-jar-plugin
</artifactId>
<version>
2.4
</version>
<executions>
<execution>
<goals>
<goal>
test-jar
</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
graphdb/common/src/test/java/org/apache/atlas/graph/GraphSandboxUtil.java
0 → 100644
View file @
235f4e9e
/**
* 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
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* 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
.
atlas
.
graph
;
import
org.apache.atlas.ApplicationProperties
;
import
org.apache.atlas.AtlasException
;
import
org.apache.commons.configuration.Configuration
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
java.io.File
;
public
class
GraphSandboxUtil
{
private
static
final
Logger
LOG
=
LoggerFactory
.
getLogger
(
GraphSandboxUtil
.
class
);
public
static
void
create
()
{
Configuration
configuration
;
try
{
configuration
=
ApplicationProperties
.
get
();
// Append a suffix to isolate the database for each instance
long
currentMillisecs
=
System
.
currentTimeMillis
();
String
newStorageDir
=
System
.
getProperty
(
"atlas.data"
)
+
File
.
pathSeparator
+
"storage"
+
File
.
pathSeparator
+
currentMillisecs
;
configuration
.
setProperty
(
"atlas.graph.storage.directory"
,
newStorageDir
);
String
newIndexerDir
=
System
.
getProperty
(
"atlas.data"
)
+
File
.
pathSeparator
+
"index"
+
File
.
pathSeparator
+
currentMillisecs
;
configuration
.
setProperty
(
"atlas.graph.index.search.directory"
,
newIndexerDir
);
LOG
.
debug
(
"New Storage dir : {}"
,
newStorageDir
);
LOG
.
debug
(
"New Indexer dir : {}"
,
newIndexerDir
);
}
catch
(
AtlasException
ignored
)
{}
}
}
graphdb/titan0/pom.xml
View file @
235f4e9e
...
...
@@ -166,6 +166,14 @@
<scope>
test
</scope>
</dependency>
<dependency>
<groupId>
org.apache.atlas
</groupId>
<artifactId>
atlas-graphdb-common
</artifactId>
<version>
${project.version}
</version>
<classifier>
tests
</classifier>
<scope>
test
</scope>
</dependency>
</dependencies>
<build>
...
...
graphdb/titan0/src/test/java/org/apache/atlas/repository/graphdb/titan0/AbstractGraphDatabaseTest.java
View file @
235f4e9e
...
...
@@ -18,10 +18,7 @@
package
org
.
apache
.
atlas
.
repository
.
graphdb
.
titan0
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.List
;
import
org.apache.atlas.graph.GraphSandboxUtil
;
import
org.apache.atlas.repository.Constants
;
import
org.apache.atlas.repository.graphdb.AtlasCardinality
;
import
org.apache.atlas.repository.graphdb.AtlasGraph
;
...
...
@@ -32,6 +29,10 @@ import org.testng.annotations.AfterClass;
import
org.testng.annotations.AfterMethod
;
import
org.testng.annotations.BeforeClass
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.List
;
/**
*
*/
...
...
@@ -46,13 +47,10 @@ public abstract class AbstractGraphDatabaseTest {
private
AtlasGraph
<?,
?>
graph
=
null
;
public
AbstractGraphDatabaseTest
()
{
super
();
}
@BeforeClass
public
static
void
createIndices
()
{
GraphSandboxUtil
.
create
();
Titan0GraphDatabase
db
=
new
Titan0GraphDatabase
();
AtlasGraphManagement
mgmt
=
db
.
getGraph
().
getManagementSystem
();
...
...
graphdb/titan0/src/test/java/org/apache/atlas/repository/graphdb/titan0/Titan0DatabaseTest.java
View file @
235f4e9e
...
...
@@ -18,22 +18,8 @@
package
org
.
apache
.
atlas
.
repository
.
graphdb
.
titan0
;
import
static
org
.
testng
.
Assert
.
assertEquals
;
import
static
org
.
testng
.
Assert
.
assertFalse
;
import
static
org
.
testng
.
Assert
.
assertNotNull
;
import
static
org
.
testng
.
Assert
.
assertNull
;
import
static
org
.
testng
.
Assert
.
assertTrue
;
import
static
org
.
testng
.
Assert
.
fail
;
import
java.math.BigDecimal
;
import
java.math.BigInteger
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Collection
;
import
java.util.Collections
;
import
java.util.List
;
import
org.apache.atlas.AtlasException
;
import
org.apache.atlas.graph.GraphSandboxUtil
;
import
org.apache.atlas.repository.Constants
;
import
org.apache.atlas.repository.graphdb.AtlasCardinality
;
import
org.apache.atlas.repository.graphdb.AtlasEdge
;
...
...
@@ -48,6 +34,16 @@ import org.apache.atlas.typesystem.types.DataTypes.TypeCategory;
import
org.testng.annotations.AfterClass
;
import
org.testng.annotations.Test
;
import
java.math.BigDecimal
;
import
java.math.BigInteger
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Collection
;
import
java.util.Collections
;
import
java.util.List
;
import
static
org
.
testng
.
Assert
.*;
/**
* Sanity test of basic graph operations using the Titan 0.5.4 graphdb
* abstraction layer implementation.
...
...
@@ -57,6 +53,8 @@ public class Titan0DatabaseTest {
private
AtlasGraph
<?,
?>
atlasGraph
;
private
<
V
,
E
>
AtlasGraph
<
V
,
E
>
getGraph
()
{
GraphSandboxUtil
.
create
();
if
(
atlasGraph
==
null
)
{
Titan0GraphDatabase
db
=
new
Titan0GraphDatabase
();
atlasGraph
=
db
.
getGraph
();
...
...
graphdb/titan0/src/test/java/org/apache/atlas/repository/graphdb/titan0/Titan0DatabaseValidationTest.java
View file @
235f4e9e
...
...
@@ -19,6 +19,7 @@ package org.apache.atlas.repository.graphdb.titan0;
import
org.apache.atlas.ApplicationProperties
;
import
org.apache.atlas.AtlasException
;
import
org.apache.atlas.graph.GraphSandboxUtil
;
import
org.apache.atlas.repository.graphdb.AtlasGraph
;
import
org.apache.commons.configuration.Configuration
;
import
org.testng.Assert
;
...
...
@@ -34,6 +35,8 @@ public class Titan0DatabaseValidationTest {
@BeforeTest
public
void
setUp
()
throws
AtlasException
{
GraphSandboxUtil
.
create
();
// First get Instance
graph
=
new
Titan0Graph
();
configuration
=
ApplicationProperties
.
getSubsetConfiguration
(
ApplicationProperties
.
get
(),
...
...
graphdb/titan1/pom.xml
View file @
235f4e9e
...
...
@@ -210,6 +210,14 @@
<artifactId>
tinkergraph-gremlin
</artifactId>
<version>
3.0.1-incubating
</version>
</dependency>
<dependency>
<groupId>
org.apache.atlas
</groupId>
<artifactId>
atlas-graphdb-common
</artifactId>
<version>
${project.version}
</version>
<classifier>
tests
</classifier>
<scope>
test
</scope>
</dependency>
</dependencies>
<build>
...
...
graphdb/titan1/src/test/java/org/apache/atlas/repository/graphdb/titan1/AbstractGraphDatabaseTest.java
View file @
235f4e9e
...
...
@@ -18,10 +18,7 @@
package
org
.
apache
.
atlas
.
repository
.
graphdb
.
titan1
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.List
;
import
org.apache.atlas.graph.GraphSandboxUtil
;
import
org.apache.atlas.repository.Constants
;
import
org.apache.atlas.repository.graphdb.AtlasCardinality
;
import
org.apache.atlas.repository.graphdb.AtlasGraph
;
...
...
@@ -32,6 +29,10 @@ import org.testng.annotations.AfterClass;
import
org.testng.annotations.AfterMethod
;
import
org.testng.annotations.BeforeClass
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.List
;
/**
*
*/
...
...
@@ -46,13 +47,10 @@ public abstract class AbstractGraphDatabaseTest {
private
AtlasGraph
<?,
?>
graph
=
null
;
public
AbstractGraphDatabaseTest
()
{
super
();
}
@BeforeClass
public
static
void
createIndices
()
{
GraphSandboxUtil
.
create
();
Titan1GraphDatabase
db
=
new
Titan1GraphDatabase
();
AtlasGraphManagement
mgmt
=
db
.
getGraph
().
getManagementSystem
();
...
...
graphdb/titan1/src/test/java/org/apache/atlas/repository/graphdb/titan1/Titan1DatabaseTest.java
View file @
235f4e9e
...
...
@@ -18,21 +18,8 @@
package
org
.
apache
.
atlas
.
repository
.
graphdb
.
titan1
;
import
static
org
.
testng
.
Assert
.
assertEquals
;
import
static
org
.
testng
.
Assert
.
assertFalse
;
import
static
org
.
testng
.
Assert
.
assertNotNull
;
import
static
org
.
testng
.
Assert
.
assertNull
;
import
static
org
.
testng
.
Assert
.
assertTrue
;
import
static
org
.
testng
.
Assert
.
fail
;
import
java.math.BigDecimal
;
import
java.math.BigInteger
;
import
java.util.ArrayList
;
import
java.util.Collection
;
import
java.util.Collections
;
import
java.util.List
;
import
org.apache.atlas.AtlasException
;
import
org.apache.atlas.graph.GraphSandboxUtil
;
import
org.apache.atlas.repository.Constants
;
import
org.apache.atlas.repository.graphdb.AtlasCardinality
;
import
org.apache.atlas.repository.graphdb.AtlasEdge
;
...
...
@@ -47,6 +34,15 @@ import org.apache.atlas.typesystem.types.DataTypes.TypeCategory;
import
org.testng.annotations.AfterClass
;
import
org.testng.annotations.Test
;
import
java.math.BigDecimal
;
import
java.math.BigInteger
;
import
java.util.ArrayList
;
import
java.util.Collection
;
import
java.util.Collections
;
import
java.util.List
;
import
static
org
.
testng
.
Assert
.*;
/**
* Sanity test of basic graph operations using the Titan 0.5.4 graphdb
* abstraction layer implementation.
...
...
@@ -56,6 +52,8 @@ public class Titan1DatabaseTest {
private
AtlasGraph
<?,
?>
atlasGraph
;
private
<
V
,
E
>
AtlasGraph
<
V
,
E
>
getGraph
()
{
GraphSandboxUtil
.
create
();
if
(
atlasGraph
==
null
)
{
Titan1GraphDatabase
db
=
new
Titan1GraphDatabase
();
atlasGraph
=
db
.
getGraph
();
...
...
graphdb/titan1/src/test/java/org/apache/atlas/repository/graphdb/titan1/TitanGraphProviderTest.java
View file @
235f4e9e
...
...
@@ -19,6 +19,7 @@ package org.apache.atlas.repository.graphdb.titan1;
import
org.apache.atlas.ApplicationProperties
;
import
org.apache.atlas.AtlasException
;
import
org.apache.atlas.graph.GraphSandboxUtil
;
import
org.apache.atlas.repository.graphdb.AtlasGraph
;
import
org.apache.commons.configuration.Configuration
;
import
org.testng.Assert
;
...
...
@@ -34,6 +35,8 @@ public class TitanGraphProviderTest {
@BeforeTest
public
void
setUp
()
throws
AtlasException
{
GraphSandboxUtil
.
create
();
//First get Instance
graph
=
new
Titan1Graph
();
configuration
=
ApplicationProperties
.
getSubsetConfiguration
(
ApplicationProperties
.
get
(),
...
...
pom.xml
View file @
235f4e9e
...
...
@@ -1240,6 +1240,14 @@
<dependency>
<groupId>
org.apache.atlas
</groupId>
<artifactId>
atlas-graphdb-common
</artifactId>
<version>
${project.version}
</version>
<classifier>
tests
</classifier>
<scope>
test
</scope>
</dependency>
<dependency>
<groupId>
org.apache.atlas
</groupId>
<artifactId>
atlas-server-api
</artifactId>
<version>
${project.version}
</version>
</dependency>
...
...
@@ -1805,7 +1813,8 @@
<log4j.configuration>
atlas-log4j.xml
</log4j.configuration>
</systemProperties>
<skipTests>
${skipTests}
</skipTests>
<forkMode>
always
</forkMode>
<forkCount>
2C
</forkCount>
<reuseForks>
false
</reuseForks>
<redirectTestOutputToFile>
true
</redirectTestOutputToFile>
<argLine>
-Djava.awt.headless=true -Dproject.version=${project.version}
-Dhadoop.tmp.dir="${project.build.directory}/tmp-hadoop-${user.name}"
...
...
@@ -1838,10 +1847,8 @@
-Xmx1024m -XX:MaxPermSize=512m ${atlas.surefire.options}
</argLine>
<skip>
${skipITs}
</skip>
<parallel>
none
</parallel>
<reuseForks>
false
</reuseForks>
<forkCount>
1
</forkCount>
<threadCount>
5
</threadCount>
<forkCount>
2C
</forkCount>
<redirectTestOutputToFile>
true
</redirectTestOutputToFile>
</configuration>
<executions>
...
...
repository/pom.xml
View file @
235f4e9e
...
...
@@ -144,7 +144,8 @@
<dependency>
<groupId>
org.apache.atlas
</groupId>
<artifactId>
atlas-typesystem
</artifactId>
<artifactId>
atlas-graphdb-common
</artifactId>
<version>
${project.version}
</version>
<classifier>
tests
</classifier>
<scope>
test
</scope>
</dependency>
...
...
@@ -222,8 +223,17 @@
</executions>
</plugin>
<plugin>
<groupId>
net.alchim31.maven
</groupId>
<artifactId>
scala-maven-plugin
</artifactId>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-surefire-plugin
</artifactId>
<version>
2.18.1
</version>
<configuration
combine.children=
"override"
>
<properties>
<property>
<name>
listener
</name>
<value>
org.apache.atlas.DBSandboxer
</value>
</property>
</properties>
</configuration>
</plugin>
<plugin>
...
...
repository/src/test/java/org/apache/atlas/BaseRepositoryTest.java
View file @
235f4e9e
...
...
@@ -20,7 +20,6 @@ package org.apache.atlas;
import
com.google.common.base.Preconditions
;
import
com.google.common.collect.ImmutableList
;
import
com.google.common.collect.ImmutableSet
;
import
org.apache.atlas.repository.MetadataRepository
;
import
org.apache.atlas.repository.graph.AtlasGraphProvider
;
import
org.apache.atlas.repository.graph.GraphBackedSearchIndexer
;
...
...
@@ -31,32 +30,22 @@ import org.apache.atlas.typesystem.Referenceable;
import
org.apache.atlas.typesystem.TypesDef
;
import
org.apache.atlas.typesystem.json.TypesSerialization
;
import
org.apache.atlas.typesystem.persistence.Id
;
import
org.apache.atlas.typesystem.types.AttributeDefinition
;
import
org.apache.atlas.typesystem.types.ClassType
;
import
org.apache.atlas.typesystem.types.DataTypes
;
import
org.apache.atlas.typesystem.types.EnumTypeDefinition
;
import
org.apache.atlas.typesystem.types.HierarchicalTypeDefinition
;
import
org.apache.atlas.typesystem.types.IDataType
;
import
org.apache.atlas.typesystem.types.Multiplicity
;
import
org.apache.atlas.typesystem.types.StructTypeDefinition
;
import
org.apache.atlas.typesystem.types.TraitType
;
import
org.apache.atlas.typesystem.types.TypeSystem
;
import
org.apache.atlas.typesystem.types.*
;
import
org.apache.atlas.typesystem.types.utils.TypesUtil
;
import
org.testng.annotations.Guice
;
import
static
org
.
apache
.
atlas
.
AtlasClient
.
PROCESS_ATTRIBUTE_INPUTS
;
import
static
org
.
apache
.
atlas
.
AtlasClient
.
PROCESS_ATTRIBUTE_OUTPUTS
;
import
javax.inject.Inject
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
import
javax.inject.Inject
;
import
static
org
.
apache
.
atlas
.
AtlasClient
.
PROCESS_ATTRIBUTE_INPUTS
;
import
static
org
.
apache
.
atlas
.
AtlasClient
.
PROCESS_ATTRIBUTE_OUTPUTS
;
/**
* Base Class to set up hive types and instances for tests
*/
@Guice
(
modules
=
RepositoryMetadata
Module
.
class
)
@Guice
(
modules
=
TestOnly
Module
.
class
)
public
class
BaseRepositoryTest
{
@Inject
...
...
repository/src/test/java/org/apache/atlas/DBSandboxer.java
0 → 100644
View file @
235f4e9e
/**
* 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
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* 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
.
atlas
;
import
org.apache.atlas.graph.GraphSandboxUtil
;
import
org.apache.atlas.repository.graph.AtlasGraphProvider
;
import
org.testng.ITestContext
;
import
org.testng.TestListenerAdapter
;
public
class
DBSandboxer
extends
TestListenerAdapter
{
@Override
public
void
onStart
(
ITestContext
context
)
{
GraphSandboxUtil
.
create
();
}
@Override
public
void
onFinish
(
ITestContext
context
)
{
AtlasGraphProvider
.
cleanup
();
}
}
repository/src/test/java/org/apache/atlas/RepositoryServiceLoadingTest.java
View file @
235f4e9e
...
...
@@ -29,7 +29,7 @@ import org.testng.annotations.Test;
* Uses TestNG's Guice annotation to load the necessary modules and inject the
* objects from Guice
*/
@Guice
(
modules
=
RepositoryMetadata
Module
.
class
)
@Guice
(
modules
=
TestOnly
Module
.
class
)
public
class
RepositoryServiceLoadingTest
{
@Test
...
...
repository/src/test/java/org/apache/atlas/TestOnlyModule.java
0 → 100644
View file @
235f4e9e
/**
* 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
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* 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
.
atlas
;
import
org.apache.atlas.graph.GraphSandboxUtil
;
public
class
TestOnlyModule
extends
RepositoryMetadataModule
{
@Override
protected
void
configure
()
{
GraphSandboxUtil
.
create
();
// Configure extra stuff for test DI here
super
.
configure
();
}
}
repository/src/test/java/org/apache/atlas/TestUtils.java
View file @
235f4e9e
...
...
@@ -18,33 +18,9 @@
package
org
.
apache
.
atlas
;
import
static
org
.
apache
.
atlas
.
typesystem
.
types
.
utils
.
TypesUtil
.
createClassTypeDef
;
import
static
org
.
apache
.
atlas
.
typesystem
.
types
.
utils
.
TypesUtil
.
createOptionalAttrDef
;
import
static
org
.
apache
.
atlas
.
typesystem
.
types
.
utils
.
TypesUtil
.
createRequiredAttrDef
;
import
static
org
.
apache
.
atlas
.
typesystem
.
types
.
utils
.
TypesUtil
.
createStructTypeDef
;
import
static
org
.
apache
.
atlas
.
typesystem
.
types
.
utils
.
TypesUtil
.
createTraitTypeDef
;
import
static
org
.
apache
.
atlas
.
typesystem
.
types
.
utils
.
TypesUtil
.
createUniqueRequiredAttrDef
;
import
static
org
.
testng
.
Assert
.
assertEquals
;
import
java.io.File
;
import
java.io.FileOutputStream
;
import
java.io.IOException
;
import
java.lang.reflect.InvocationHandler
;
import
java.lang.reflect.InvocationTargetException
;
import
java.lang.reflect.Method
;
import
java.lang.reflect.Proxy
;
import
java.math.BigDecimal
;
import
java.math.BigInteger
;
import
java.util.ArrayList
;
import
java.util.Collection
;
import
java.util.Collections
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.HashSet
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Set
;
import
com.google.common.collect.ImmutableList
;
import
com.google.common.collect.ImmutableSet
;
import
com.google.inject.Provider
;
import
org.apache.atlas.listener.EntityChangeListener
;
import
org.apache.atlas.listener.TypesChangeListener
;
import
org.apache.atlas.repository.MetadataRepository
;
...
...
@@ -65,19 +41,8 @@ import org.apache.atlas.typesystem.Referenceable;
import
org.apache.atlas.typesystem.TypesDef
;
import
org.apache.atlas.typesystem.json.InstanceSerialization
;
import
org.apache.atlas.typesystem.persistence.Id
;
import
org.apache.atlas.typesystem.types.AttributeDefinition
;
import
org.apache.atlas.typesystem.types.AttributeInfo
;
import
org.apache.atlas.typesystem.types.ClassType
;
import
org.apache.atlas.typesystem.types.DataTypes
;
import
org.apache.atlas.typesystem.types.*
;
import
org.apache.atlas.typesystem.types.DataTypes.TypeCategory
;
import
org.apache.atlas.typesystem.types.EnumTypeDefinition
;
import
org.apache.atlas.typesystem.types.EnumValue
;
import
org.apache.atlas.typesystem.types.HierarchicalTypeDefinition
;
import
org.apache.atlas.typesystem.types.IDataType
;
import
org.apache.atlas.typesystem.types.Multiplicity
;
import
org.apache.atlas.typesystem.types.StructTypeDefinition
;
import
org.apache.atlas.typesystem.types.TraitType
;
import
org.apache.atlas.typesystem.types.TypeSystem
;
import
org.apache.atlas.typesystem.types.cache.DefaultTypeCache
;
import
org.apache.atlas.typesystem.types.cache.TypeCache
;
import
org.apache.atlas.typesystem.types.utils.TypesUtil
;
...
...
@@ -88,9 +53,27 @@ import org.codehaus.jettison.json.JSONArray;
import
org.testng.Assert
;
import
org.testng.SkipException
;
import
com.google.common.collect.ImmutableList
;
import
com.google.common.collect.ImmutableSet
;
import
com.google.inject.Provider
;
import
java.io.File
;
import
java.io.FileOutputStream
;
import
java.io.IOException
;
import
java.lang.reflect.InvocationHandler
;
import
java.lang.reflect.InvocationTargetException
;
import
java.lang.reflect.Method
;
import
java.lang.reflect.Proxy
;
import
java.math.BigDecimal
;
import
java.math.BigInteger
;
import
java.util.ArrayList
;
import
java.util.Collection
;
import
java.util.Collections
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.HashSet
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Set
;
import
static
org
.
apache
.
atlas
.
typesystem
.
types
.
utils
.
TypesUtil
.*;
import
static
org
.
testng
.
Assert
.
assertEquals
;
/**
* Test utility class.
...
...
repository/src/test/java/org/apache/atlas/discovery/DataSetLineageServiceTest.java
View file @
235f4e9e
...
...
@@ -22,7 +22,7 @@ import com.google.common.collect.ImmutableList;
import
org.apache.atlas.AtlasClient
;
import
org.apache.atlas.AtlasException
;
import
org.apache.atlas.BaseRepositoryTest
;
import
org.apache.atlas.
RepositoryMetadata
Module
;
import
org.apache.atlas.
TestOnly
Module
;
import
org.apache.atlas.query.QueryParams
;
import
org.apache.atlas.typesystem.ITypedReferenceableInstance
;
import
org.apache.atlas.typesystem.Referenceable
;
...
...
@@ -55,7 +55,7 @@ import static org.testng.Assert.fail;
/**
* Unit tests for Hive LineageService.
*/
@Guice
(
modules
=
RepositoryMetadata
Module
.
class
)
@Guice
(
modules
=
TestOnly
Module
.
class
)
public
class
DataSetLineageServiceTest
extends
BaseRepositoryTest
{
@Inject
...
...
repository/src/test/java/org/apache/atlas/discovery/GraphBackedDiscoveryServiceTest.java
View file @
235f4e9e
...
...
@@ -18,30 +18,11 @@
package
org
.
apache
.
atlas
.
discovery
;
import
static
org
.
apache
.
atlas
.
typesystem
.
types
.
utils
.
TypesUtil
.
createClassTypeDef
;
import
static
org
.
apache
.
atlas
.
typesystem
.
types
.
utils
.
TypesUtil
.
createOptionalAttrDef
;
import
static
org
.
apache
.
atlas
.
typesystem
.
types
.
utils
.
TypesUtil
.
createRequiredAttrDef
;
import
static
org
.
testng
.
Assert
.
assertEquals
;
import
static
org
.
testng
.
Assert
.
assertNotNull
;
import
java.text.SimpleDateFormat
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Collection
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.HashSet
;
import
java.util.Iterator
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Set
;
import
javax.inject.Inject
;
import
com.google.common.collect.ImmutableSet
;
import
org.apache.atlas.AtlasException
;
import
org.apache.atlas.BaseRepositoryTest
;
import
org.apache.atlas.RepositoryMetadataModule
;
import
org.apache.atlas.RequestContext
;
import
org.apache.atlas.TestOnlyModule
;
import
org.apache.atlas.TestUtils
;
import
org.apache.atlas.discovery.graph.GraphBackedDiscoveryService
;
import
org.apache.atlas.query.QueryParams
;
...
...
@@ -64,7 +45,6 @@ import org.codehaus.jettison.json.JSONArray;
import
org.codehaus.jettison.json.JSONException
;
import
org.codehaus.jettison.json.JSONObject
;
import
org.testng.Assert
;
import
org.testng.SkipException
;
import
org.testng.annotations.AfterClass
;
import
org.testng.annotations.BeforeClass
;
import
org.testng.annotations.BeforeMethod
;
...
...
@@ -72,9 +52,17 @@ import org.testng.annotations.DataProvider;
import
org.testng.annotations.Guice
;
import
org.testng.annotations.Test
;
import
com.google.common.collect.ImmutableSet
;
import
javax.inject.Inject
;
import
java.text.SimpleDateFormat
;
import
java.util.*
;
import
static
org
.
apache
.
atlas
.
typesystem
.
types
.
utils
.
TypesUtil
.
createClassTypeDef
;
import
static
org
.
apache
.
atlas
.
typesystem
.
types
.
utils
.
TypesUtil
.
createOptionalAttrDef
;
import
static
org
.
apache
.
atlas
.
typesystem
.
types
.
utils
.
TypesUtil
.
createRequiredAttrDef
;
import
static
org
.
testng
.
Assert
.
assertEquals
;
import
static
org
.
testng
.
Assert
.
assertNotNull
;
@Guice
(
modules
=
RepositoryMetadata
Module
.
class
)
@Guice
(
modules
=
TestOnly
Module
.
class
)
public
class
GraphBackedDiscoveryServiceTest
extends
BaseRepositoryTest
{
@Inject
...
...
repository/src/test/java/org/apache/atlas/lineage/EntityLineageServiceTest.java
View file @
235f4e9e
...
...
@@ -18,22 +18,11 @@
package
org
.
apache
.
atlas
.
lineage
;
import
static
org
.
testng
.
Assert
.
assertEquals
;
import
static
org
.
testng
.
Assert
.
assertNotNull
;
import
static
org
.
testng
.
Assert
.
assertTrue
;
import
static
org
.
testng
.
Assert
.
fail
;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Set
;
import
javax.inject.Inject
;
import
com.google.common.collect.ImmutableList
;
import
org.apache.atlas.AtlasClient
;
import
org.apache.atlas.AtlasErrorCode
;
import
org.apache.atlas.BaseRepositoryTest
;
import
org.apache.atlas.
RepositoryMetadata
Module
;
import
org.apache.atlas.
TestOnly
Module
;
import
org.apache.atlas.TestUtils
;
import
org.apache.atlas.discovery.EntityLineageService
;
import
org.apache.atlas.exception.AtlasBaseException
;
...
...
@@ -49,17 +38,25 @@ import org.apache.commons.lang.RandomStringUtils;
import
org.testng.Assert
;
import
org.testng.annotations.AfterClass
;
import
org.testng.annotations.BeforeClass
;
import
org.testng.annotations.BeforeMethod
;
import
org.testng.annotations.DataProvider
;
import
org.testng.annotations.Guice
;
import
org.testng.annotations.Test
;
import
com.google.common.collect.ImmutableList
;
import
javax.inject.Inject
;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Set
;
import
static
org
.
testng
.
Assert
.
assertEquals
;
import
static
org
.
testng
.
Assert
.
assertNotNull
;
import
static
org
.
testng
.
Assert
.
assertTrue
;
import
static
org
.
testng
.
Assert
.
fail
;
/**
* Unit tests for the new v2 Instance LineageService.
*/
@Guice
(
modules
=
RepositoryMetadata
Module
.
class
)
@Guice
(
modules
=
TestOnly
Module
.
class
)
public
class
EntityLineageServiceTest
extends
BaseRepositoryTest
{
@Inject
...
...
repository/src/test/java/org/apache/atlas/query/QueryProcessorTest.java
View file @
235f4e9e
...
...
@@ -17,12 +17,7 @@
*/
package
org
.
apache
.
atlas
.
query
;
import
static
org
.
apache
.
atlas
.
typesystem
.
types
.
utils
.
TypesUtil
.
createClassTypeDef
;
import
static
org
.
apache
.
atlas
.
typesystem
.
types
.
utils
.
TypesUtil
.
createRequiredAttrDef
;
import
java.util.HashSet
;
import
java.util.Set
;
import
com.google.common.collect.ImmutableSet
;
import
org.apache.atlas.AtlasException
;
import
org.apache.atlas.typesystem.types.ClassType
;
import
org.apache.atlas.typesystem.types.DataTypes
;
...
...
@@ -32,14 +27,17 @@ import org.apache.atlas.typesystem.types.IDataType;
import
org.apache.atlas.typesystem.types.TypeSystem
;
import
org.apache.atlas.typesystem.types.cache.DefaultTypeCache
;
import
org.testng.annotations.Test
;
import
static
org
.
testng
.
Assert
.
assertTrue
;
import
static
org
.
testng
.
Assert
.
assertFalse
;
import
com.google.common.collect.ImmutableSet
;
import
scala.util.Either
;
import
scala.util.parsing.combinator.Parsers
;
import
java.util.HashSet
;
import
java.util.Set
;
import
static
org
.
apache
.
atlas
.
typesystem
.
types
.
utils
.
TypesUtil
.
createClassTypeDef
;
import
static
org
.
apache
.
atlas
.
typesystem
.
types
.
utils
.
TypesUtil
.
createRequiredAttrDef
;
import
static
org
.
testng
.
Assert
.
assertFalse
;
import
static
org
.
testng
.
Assert
.
assertTrue
;
/**
* Tests the logic for skipping type cache lookup for things that
* cannot be types.
...
...
repository/src/test/java/org/apache/atlas/repository/graph/AbstractGremlinQueryOptimizerTest.java
View file @
235f4e9e
...
...
@@ -17,16 +17,6 @@
*/
package
org
.
apache
.
atlas
.
repository
.
graph
;
import
static
org
.
mockito
.
Matchers
.
any
;
import
static
org
.
mockito
.
Mockito
.
mock
;
import
static
org
.
mockito
.
Mockito
.
when
;
import
static
org
.
testng
.
Assert
.
assertEquals
;
import
static
org
.
testng
.
Assert
.
assertNotNull
;
import
java.util.Arrays
;
import
java.util.Collections
;
import
java.util.List
;
import
org.apache.atlas.AtlasException
;
import
org.apache.atlas.gremlin.GremlinExpressionFactory
;
import
org.apache.atlas.gremlin.optimizer.GremlinQueryOptimizer
;
...
...
@@ -54,19 +44,31 @@ import org.apache.atlas.typesystem.types.TypeSystem;
import
org.testng.annotations.BeforeClass
;
import
org.testng.annotations.Test
;
import
java.util.Arrays
;
import
java.util.Collections
;
import
java.util.List
;
import
static
org
.
mockito
.
Matchers
.
any
;
import
static
org
.
mockito
.
Mockito
.
mock
;
import
static
org
.
mockito
.
Mockito
.
when
;
import
static
org
.
testng
.
Assert
.
assertEquals
;
import
static
org
.
testng
.
Assert
.
assertNotNull
;
public
abstract
class
AbstractGremlinQueryOptimizerTest
implements
IAtlasGraphProvider
{
protected
abstract
GremlinExpressionFactory
getFactory
();
private
MetadataRepository
repo
=
new
GraphBackedMetadataRepository
(
this
,
new
HardDeleteHandler
(
TypeSystem
.
getInstance
()))
;
private
MetadataRepository
repo
;
private
final
GraphPersistenceStrategies
STRATEGY
=
mock
(
GraphPersistenceStrategies
.
class
);
@BeforeClass
public
void
setUp
()
{
GremlinQueryOptimizer
.
reset
();
GremlinQueryOptimizer
.
setExpressionFactory
(
getFactory
());
when
(
STRATEGY
.
typeAttributeName
()).
thenReturn
(
Constants
.
ENTITY_TYPE_PROPERTY_KEY
);
when
(
STRATEGY
.
superTypeAttributeName
()).
thenReturn
(
Constants
.
SUPER_TYPES_PROPERTY_KEY
);
repo
=
new
GraphBackedMetadataRepository
(
this
,
new
HardDeleteHandler
(
TypeSystem
.
getInstance
()));
}
private
FieldInfo
getTestFieldInfo
()
throws
AtlasException
{
...
...
@@ -695,6 +697,7 @@ public abstract class AbstractGremlinQueryOptimizerTest implements IAtlasGraphPr
protected
abstract
String
getExpectedGremlinForTestRangeWithOrderBy
();
@Override
public
AtlasGraph
get
()
throws
RepositoryException
{
AtlasGraph
graph
=
mock
(
AtlasGraph
.
class
);
...
...
repository/src/test/java/org/apache/atlas/repository/graph/GraphBackedMetadataRepositoryDeleteTestBase.java
View file @
235f4e9e
...
...
@@ -20,15 +20,14 @@ package org.apache.atlas.repository.graph;
import
com.google.common.collect.ImmutableList
;
import
com.google.common.collect.ImmutableSet
;
import
org.apache.atlas.AtlasClient
;
import
org.apache.atlas.AtlasClient.EntityResult
;
import
org.apache.atlas.AtlasException
;
import
org.apache.atlas.
RepositoryMetadataModule
;
import
org.apache.atlas.
CreateUpdateEntitiesResult
;
import
org.apache.atlas.RequestContext
;
import
org.apache.atlas.TestOnlyModule
;
import
org.apache.atlas.TestUtils
;
import
org.apache.atlas.repository.Constants
;
import
org.apache.atlas.CreateUpdateEntitiesResult
;
import
org.apache.atlas.repository.MetadataRepository
;
import
org.apache.atlas.repository.RepositoryException
;
import
org.apache.atlas.repository.graphdb.AtlasGraph
;
...
...
@@ -45,16 +44,7 @@ import org.apache.atlas.typesystem.exception.EntityExistsException;
import
org.apache.atlas.typesystem.exception.EntityNotFoundException
;
import
org.apache.atlas.typesystem.exception.NullRequiredAttributeException
;
import
org.apache.atlas.typesystem.persistence.Id
;
import
org.apache.atlas.typesystem.types.AttributeDefinition
;
import
org.apache.atlas.typesystem.types.ClassType
;
import
org.apache.atlas.typesystem.types.DataTypes
;
import
org.apache.atlas.typesystem.types.EnumTypeDefinition
;
import
org.apache.atlas.typesystem.types.HierarchicalTypeDefinition
;
import
org.apache.atlas.typesystem.types.IDataType
;
import
org.apache.atlas.typesystem.types.Multiplicity
;
import
org.apache.atlas.typesystem.types.StructTypeDefinition
;
import
org.apache.atlas.typesystem.types.TraitType
;
import
org.apache.atlas.typesystem.types.TypeSystem
;
import
org.apache.atlas.typesystem.types.*
;
import
org.apache.atlas.typesystem.types.utils.TypesUtil
;
import
org.testng.Assert
;
import
org.testng.annotations.AfterClass
;
...
...
@@ -70,15 +60,7 @@ import java.util.HashMap;
import
java.util.List
;
import
java.util.Map
;
import
static
org
.
apache
.
atlas
.
TestUtils
.
COLUMNS_ATTR_NAME
;
import
static
org
.
apache
.
atlas
.
TestUtils
.
COLUMN_TYPE
;
import
static
org
.
apache
.
atlas
.
TestUtils
.
NAME
;
import
static
org
.
apache
.
atlas
.
TestUtils
.
PII
;
import
static
org
.
apache
.
atlas
.
TestUtils
.
PROCESS_TYPE
;
import
static
org
.
apache
.
atlas
.
TestUtils
.
TABLE_TYPE
;
import
static
org
.
apache
.
atlas
.
TestUtils
.
createColumnEntity
;
import
static
org
.
apache
.
atlas
.
TestUtils
.
createDBEntity
;
import
static
org
.
apache
.
atlas
.
TestUtils
.
createTableEntity
;
import
static
org
.
apache
.
atlas
.
TestUtils
.*;
import
static
org
.
testng
.
Assert
.
assertEquals
;
import
static
org
.
testng
.
Assert
.
assertNotEquals
;
import
static
org
.
testng
.
Assert
.
assertTrue
;
...
...
@@ -90,7 +72,7 @@ import static org.testng.Assert.fail;
* Guice loads the dependencies and injects the necessary objects
*
*/
@Guice
(
modules
=
RepositoryMetadata
Module
.
class
)
@Guice
(
modules
=
TestOnly
Module
.
class
)
public
abstract
class
GraphBackedMetadataRepositoryDeleteTestBase
{
protected
MetadataRepository
repositoryService
;
...
...
repository/src/test/java/org/apache/atlas/repository/graph/GraphBackedMetadataRepositoryTest.java
View file @
235f4e9e
...
...
@@ -18,32 +18,13 @@
package
org
.
apache
.
atlas
.
repository
.
graph
;
import
static
org
.
apache
.
atlas
.
typesystem
.
types
.
utils
.
TypesUtil
.
createClassTypeDef
;
import
static
org
.
apache
.
atlas
.
typesystem
.
types
.
utils
.
TypesUtil
.
createUniqueRequiredAttrDef
;
import
static
org
.
testng
.
Assert
.
assertEquals
;
import
static
org
.
testng
.
Assert
.
assertNotEquals
;
import
static
org
.
testng
.
Assert
.
assertNotNull
;
import
static
org
.
testng
.
Assert
.
assertTrue
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.Iterator
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.UUID
;
import
java.util.concurrent.Callable
;
import
java.util.concurrent.ExecutorService
;
import
java.util.concurrent.Executors
;
import
java.util.concurrent.Future
;
import
javax.inject.Inject
;
import
com.google.common.collect.ImmutableList
;
import
com.google.common.collect.ImmutableSet
;
import
org.apache.atlas.AtlasException
;
import
org.apache.atlas.CreateUpdateEntitiesResult
;
import
org.apache.atlas.GraphTransaction
;
import
org.apache.atlas.RepositoryMetadataModule
;
import
org.apache.atlas.RequestContext
;
import
org.apache.atlas.TestOnlyModule
;
import
org.apache.atlas.TestUtils
;
import
org.apache.atlas.discovery.graph.GraphBackedDiscoveryService
;
import
org.apache.atlas.query.QueryParams
;
...
...
@@ -84,10 +65,26 @@ import org.testng.annotations.BeforeMethod;
import
org.testng.annotations.Guice
;
import
org.testng.annotations.Test
;
import
com.google.common.collect.ImmutableList
;
import
com.google.common.collect.ImmutableSet
;
import
javax.inject.Inject
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.Iterator
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.UUID
;
import
java.util.concurrent.Callable
;
import
java.util.concurrent.ExecutorService
;
import
java.util.concurrent.Executors
;
import
java.util.concurrent.Future
;
import
static
org
.
apache
.
atlas
.
typesystem
.
types
.
utils
.
TypesUtil
.
createClassTypeDef
;
import
static
org
.
apache
.
atlas
.
typesystem
.
types
.
utils
.
TypesUtil
.
createUniqueRequiredAttrDef
;
import
static
org
.
testng
.
Assert
.
assertEquals
;
import
static
org
.
testng
.
Assert
.
assertNotEquals
;
import
static
org
.
testng
.
Assert
.
assertNotNull
;
import
static
org
.
testng
.
Assert
.
assertTrue
;
/**
* GraphBackedMetadataRepository test
...
...
@@ -95,7 +92,7 @@ import java.util.Arrays;
* Guice loads the dependencies and injects the necessary objects
*
*/
@Guice
(
modules
=
RepositoryMetadata
Module
.
class
)
@Guice
(
modules
=
TestOnly
Module
.
class
)
public
class
GraphBackedMetadataRepositoryTest
{
@Inject
...
...
repository/src/test/java/org/apache/atlas/repository/graph/GraphBackedRepositoryHardDeleteTest.java
View file @
235f4e9e
...
...
@@ -18,12 +18,11 @@
package
org
.
apache
.
atlas
.
repository
.
graph
;
import
org.apache.atlas.repository.graphdb.AtlasVertex
;
import
org.apache.atlas.AtlasClient
;
import
org.apache.atlas.AtlasException
;
import
org.apache.atlas.TestUtils
;
import
org.apache.atlas.repository.Constants
;
import
org.apache.atlas.repository.graphdb.AtlasVertex
;
import
org.apache.atlas.typesystem.IReferenceableInstance
;
import
org.apache.atlas.typesystem.IStruct
;
import
org.apache.atlas.typesystem.ITypedReferenceableInstance
;
...
...
repository/src/test/java/org/apache/atlas/repository/graph/GraphBackedRepositorySoftDeleteTest.java
View file @
235f4e9e
...
...
@@ -18,12 +18,11 @@
package
org
.
apache
.
atlas
.
repository
.
graph
;
import
org.apache.atlas.repository.graphdb.AtlasVertex
;
import
org.apache.atlas.AtlasClient
;
import
org.apache.atlas.AtlasException
;
import
org.apache.atlas.TestUtils
;
import
org.apache.atlas.repository.Constants
;
import
org.apache.atlas.repository.graphdb.AtlasVertex
;
import
org.apache.atlas.typesystem.IReferenceableInstance
;
import
org.apache.atlas.typesystem.IStruct
;
import
org.apache.atlas.typesystem.ITypedReferenceableInstance
;
...
...
repository/src/test/java/org/apache/atlas/repository/graph/GraphBackedSearchIndexerTest.java
View file @
235f4e9e
...
...
@@ -18,16 +18,9 @@
package
org
.
apache
.
atlas
.
repository
.
graph
;
import
static
junit
.
framework
.
Assert
.
assertTrue
;
import
static
org
.
apache
.
atlas
.
typesystem
.
types
.
utils
.
TypesUtil
.
createClassTypeDef
;
import
static
org
.
testng
.
Assert
.
assertFalse
;
import
static
org
.
testng
.
Assert
.
assertNotNull
;
import
java.util.Arrays
;
import
java.util.Set
;
import
com.google.inject.Inject
;
import
org.apache.atlas.AtlasException
;
import
org.apache.atlas.
RepositoryMetadata
Module
;
import
org.apache.atlas.
TestOnly
Module
;
import
org.apache.atlas.TestUtils
;
import
org.apache.atlas.repository.Constants
;
import
org.apache.atlas.repository.graphdb.AtlasGraph
;
...
...
@@ -45,12 +38,16 @@ import org.apache.commons.lang.RandomStringUtils;
import
org.testng.annotations.Guice
;
import
org.testng.annotations.Test
;
import
com.google.inject.Inject
;
import
java.util.Arrays
;
import
java.util.Set
;
@Guice
(
modules
=
RepositoryMetadataModule
.
class
)
public
class
GraphBackedSearchIndexerTest
{
import
static
junit
.
framework
.
Assert
.
assertTrue
;
import
static
org
.
apache
.
atlas
.
typesystem
.
types
.
utils
.
TypesUtil
.
createClassTypeDef
;
import
static
org
.
testng
.
Assert
.
assertFalse
;
import
static
org
.
testng
.
Assert
.
assertNotNull
;
@Guice
(
modules
=
TestOnlyModule
.
class
)
public
class
GraphBackedSearchIndexerTest
{
@Inject
private
GraphBackedSearchIndexer
graphBackedSearchIndexer
;
...
...
repository/src/test/java/org/apache/atlas/repository/graph/GraphHelperMockTest.java
View file @
235f4e9e
...
...
@@ -17,12 +17,6 @@
*/
package
org
.
apache
.
atlas
.
repository
.
graph
;
import
static
org
.
mockito
.
Mockito
.
mock
;
import
static
org
.
mockito
.
Mockito
.
when
;
import
static
org
.
testng
.
Assert
.
assertEquals
;
import
java.util.Iterator
;
import
org.apache.atlas.repository.RepositoryException
;
import
org.apache.atlas.repository.graphdb.AtlasEdge
;
import
org.apache.atlas.repository.graphdb.AtlasEdgeDirection
;
...
...
@@ -32,6 +26,12 @@ import org.mockito.MockitoAnnotations;
import
org.testng.annotations.BeforeClass
;
import
org.testng.annotations.Test
;
import
java.util.Iterator
;
import
static
org
.
mockito
.
Mockito
.
mock
;
import
static
org
.
mockito
.
Mockito
.
when
;
import
static
org
.
testng
.
Assert
.
assertEquals
;
public
class
GraphHelperMockTest
{
private
GraphHelper
graphHelperInstance
;
...
...
repository/src/test/java/org/apache/atlas/repository/graph/GraphHelperTest.java
View file @
235f4e9e
...
...
@@ -18,25 +18,8 @@
package
org
.
apache
.
atlas
.
repository
.
graph
;
import
static
org
.
testng
.
Assert
.
assertEquals
;
import
static
org
.
testng
.
Assert
.
assertFalse
;
import
static
org
.
testng
.
Assert
.
assertNotNull
;
import
static
org
.
testng
.
Assert
.
assertNull
;
import
static
org
.
testng
.
Assert
.
assertTrue
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.HashMap
;
import
java.util.HashSet
;
import
java.util.Iterator
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Set
;
import
javax.inject.Inject
;
import
org.apache.atlas.AtlasException
;
import
org.apache.atlas.
RepositoryMetadata
Module
;
import
org.apache.atlas.
TestOnly
Module
;
import
org.apache.atlas.TestUtils
;
import
org.apache.atlas.repository.graph.GraphHelper.VertexInfo
;
import
org.apache.atlas.repository.graphdb.AtlasEdge
;
...
...
@@ -61,7 +44,19 @@ import org.testng.annotations.DataProvider;
import
org.testng.annotations.Guice
;
import
org.testng.annotations.Test
;
@Guice
(
modules
=
RepositoryMetadataModule
.
class
)
import
javax.inject.Inject
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.HashMap
;
import
java.util.HashSet
;
import
java.util.Iterator
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Set
;
import
static
org
.
testng
.
Assert
.*;
@Guice
(
modules
=
TestOnlyModule
.
class
)
public
class
GraphHelperTest
{
...
...
repository/src/test/java/org/apache/atlas/repository/graph/GraphRepoMapperScaleTest.java
View file @
235f4e9e
...
...
@@ -21,7 +21,7 @@ package org.apache.atlas.repository.graph;
import
org.apache.atlas.ApplicationProperties
;
import
org.apache.atlas.CreateUpdateEntitiesResult
;
import
org.apache.atlas.GraphTransaction
;
import
org.apache.atlas.
RepositoryMetadata
Module
;
import
org.apache.atlas.
TestOnly
Module
;
import
org.apache.atlas.TestUtils
;
import
org.apache.atlas.repository.Constants
;
import
org.apache.atlas.repository.RepositoryException
;
...
...
@@ -47,15 +47,14 @@ import org.testng.annotations.BeforeMethod;
import
org.testng.annotations.Guice
;
import
org.testng.annotations.Test
;
import
javax.inject.Inject
;
import
java.util.ArrayList
;
import
java.util.Collection
;
import
java.util.Date
;
import
java.util.Iterator
;
import
javax.inject.Inject
;
@Test
@Guice
(
modules
=
RepositoryMetadata
Module
.
class
)
@Guice
(
modules
=
TestOnly
Module
.
class
)
public
class
GraphRepoMapperScaleTest
{
private
static
final
String
DATABASE_NAME
=
"foo"
;
...
...
repository/src/test/java/org/apache/atlas/repository/graph/Gremlin2QueryOptimizerTest.java
View file @
235f4e9e
...
...
@@ -24,12 +24,13 @@ import org.testng.annotations.Test;
@Test
public
class
Gremlin2QueryOptimizerTest
extends
AbstractGremlinQueryOptimizerTest
{
private
static
final
GremlinExpressionFactory
FACTORY
=
new
Gremlin2ExpressionFactory
();
private
static
GremlinExpressionFactory
FACTORY
=
null
;
@Override
protected
GremlinExpressionFactory
getFactory
()
{
if
(
null
==
FACTORY
)
{
FACTORY
=
new
Gremlin2ExpressionFactory
();
}
return
FACTORY
;
}
...
...
repository/src/test/java/org/apache/atlas/repository/graph/Gremlin3QueryOptimizerTest.java
View file @
235f4e9e
...
...
@@ -25,10 +25,13 @@ import org.testng.annotations.Test;
@Test
public
class
Gremlin3QueryOptimizerTest
extends
AbstractGremlinQueryOptimizerTest
{
public
static
final
GremlinExpressionFactory
FACTORY
=
new
Gremlin3ExpressionFactory
()
;
public
static
GremlinExpressionFactory
FACTORY
=
null
;
@Override
protected
GremlinExpressionFactory
getFactory
()
{
if
(
null
==
FACTORY
)
{
FACTORY
=
new
Gremlin3ExpressionFactory
();
}
return
FACTORY
;
}
...
...
repository/src/test/java/org/apache/atlas/repository/graph/ReverseReferenceUpdateHardDeleteTest.java
View file @
235f4e9e
...
...
@@ -17,12 +17,12 @@
*/
package
org
.
apache
.
atlas
.
repository
.
graph
;
import
java.util.List
;
import
org.apache.atlas.typesystem.ITypedReferenceableInstance
;
import
org.apache.atlas.typesystem.types.TypeSystem
;
import
org.testng.Assert
;
import
java.util.List
;
/**
* Run tests in {@link ReverseReferenceUpdateTestBase} with hard delete enabled.
...
...
repository/src/test/java/org/apache/atlas/repository/graph/ReverseReferenceUpdateSoftDeleteTest.java
View file @
235f4e9e
...
...
@@ -17,9 +17,6 @@
*/
package
org
.
apache
.
atlas
.
repository
.
graph
;
import
java.util.Iterator
;
import
java.util.List
;
import
org.apache.atlas.repository.Constants
;
import
org.apache.atlas.repository.graphdb.AtlasEdge
;
import
org.apache.atlas.repository.graphdb.AtlasVertex
;
...
...
@@ -28,6 +25,9 @@ import org.apache.atlas.typesystem.persistence.Id;
import
org.apache.atlas.typesystem.types.TypeSystem
;
import
org.testng.Assert
;
import
java.util.Iterator
;
import
java.util.List
;
/**
* Run tests in {@link ReverseReferenceUpdateTestBase} with soft delete enabled.
...
...
repository/src/test/java/org/apache/atlas/repository/graph/ReverseReferenceUpdateTestBase.java
View file @
235f4e9e
...
...
@@ -17,13 +17,11 @@
*/
package
org
.
apache
.
atlas
.
repository
.
graph
;
import
java.util.Arrays
;
import
java.util.Collections
;
import
java.util.List
;
import
java.util.Map
;
import
com.google.common.collect.ImmutableList
;
import
com.google.common.collect.ImmutableSet
;
import
com.google.inject.Inject
;
import
org.apache.atlas.CreateUpdateEntitiesResult
;
import
org.apache.atlas.
RepositoryMetadata
Module
;
import
org.apache.atlas.
TestOnly
Module
;
import
org.apache.atlas.TestUtils
;
import
org.apache.atlas.repository.MetadataRepository
;
import
org.apache.atlas.type.AtlasTypeRegistry
;
...
...
@@ -45,15 +43,16 @@ import org.testng.annotations.BeforeMethod;
import
org.testng.annotations.Guice
;
import
org.testng.annotations.Test
;
import
com.google.common.collect.ImmutableList
;
import
com.google.common.collect.ImmutableSet
;
import
com.google.inject.Inject
;
import
java.util.Arrays
;
import
java.util.Collections
;
import
java.util.List
;
import
java.util.Map
;
/**
* Verifies automatic update of reverse references
*
*/
@Guice
(
modules
=
RepositoryMetadata
Module
.
class
)
@Guice
(
modules
=
TestOnly
Module
.
class
)
public
abstract
class
ReverseReferenceUpdateTestBase
{
@Inject
...
...
repository/src/test/java/org/apache/atlas/repository/impexp/ExportServiceTest.java
View file @
235f4e9e
...
...
@@ -19,7 +19,7 @@ package org.apache.atlas.repository.impexp;
import
com.google.inject.Inject
;
import
org.apache.atlas.
RepositoryMetadata
Module
;
import
org.apache.atlas.
TestOnly
Module
;
import
org.apache.atlas.TestUtilsV2
;
import
org.apache.atlas.exception.AtlasBaseException
;
import
org.apache.atlas.model.impexp.AtlasExportRequest
;
...
...
@@ -35,10 +35,10 @@ import org.apache.atlas.repository.store.graph.v1.DeleteHandlerV1;
import
org.apache.atlas.repository.store.graph.v1.SoftDeleteHandlerV1
;
import
org.apache.atlas.store.AtlasTypeDefStore
;
import
org.apache.atlas.type.AtlasTypeRegistry
;
import
org.testng.Assert
;
import
org.powermock.reflect.Whitebox
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.testng.Assert
;
import
org.powermock.reflect.Whitebox
;
import
org.testng.annotations.BeforeClass
;
import
org.testng.annotations.BeforeTest
;
import
org.testng.annotations.Guice
;
...
...
@@ -57,7 +57,7 @@ import java.util.Map;
import
static
org
.
testng
.
Assert
.*;
import
static
org
.
mockito
.
Mockito
.
mock
;
@Guice
(
modules
=
RepositoryMetadata
Module
.
class
)
@Guice
(
modules
=
TestOnly
Module
.
class
)
public
class
ExportServiceTest
{
private
static
final
Logger
LOG
=
LoggerFactory
.
getLogger
(
ExportServiceTest
.
class
);
...
...
repository/src/test/java/org/apache/atlas/repository/impexp/ImportServiceReportingTest.java
View file @
235f4e9e
...
...
@@ -18,24 +18,15 @@
package
org
.
apache
.
atlas
.
repository
.
impexp
;
import
com.google.inject.Inject
;
import
org.apache.atlas.RepositoryMetadataModule
;
import
org.apache.atlas.exception.AtlasBaseException
;
import
org.apache.atlas.TestOnlyModule
;
import
org.apache.atlas.repository.store.graph.AtlasEntityStore
;
import
org.apache.atlas.store.AtlasTypeDefStore
;
import
org.apache.atlas.type.AtlasTypeRegistry
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.testng.annotations.DataProvider
;
import
org.testng.annotations.Guice
;
import
org.testng.annotations.Test
;
import
java.io.IOException
;
import
static
org
.
apache
.
atlas
.
repository
.
impexp
.
ZipFileResourceTestUtils
.
getZipSource
;
import
static
org
.
apache
.
atlas
.
repository
.
impexp
.
ZipFileResourceTestUtils
.
loadModelFromJson
;
import
static
org
.
apache
.
atlas
.
repository
.
impexp
.
ZipFileResourceTestUtils
.
runAndVerifyQuickStart_v1_Import
;
@Guice
(
modules
=
RepositoryMetadataModule
.
class
)
@Guice
(
modules
=
TestOnlyModule
.
class
)
public
class
ImportServiceReportingTest
{
private
static
final
Logger
LOG
=
LoggerFactory
.
getLogger
(
ImportServiceReportingTest
.
class
);
...
...
repository/src/test/java/org/apache/atlas/repository/impexp/ImportServiceTest.java
View file @
235f4e9e
...
...
@@ -18,7 +18,7 @@
package
org
.
apache
.
atlas
.
repository
.
impexp
;
import
com.google.inject.Inject
;
import
org.apache.atlas.
RepositoryMetadata
Module
;
import
org.apache.atlas.
TestOnly
Module
;
import
org.apache.atlas.exception.AtlasBaseException
;
import
org.apache.atlas.repository.store.graph.AtlasEntityStore
;
import
org.apache.atlas.store.AtlasTypeDefStore
;
...
...
@@ -36,7 +36,7 @@ import static org.apache.atlas.repository.impexp.ZipFileResourceTestUtils.getZip
import
static
org
.
apache
.
atlas
.
repository
.
impexp
.
ZipFileResourceTestUtils
.
loadModelFromJson
;
import
static
org
.
apache
.
atlas
.
repository
.
impexp
.
ZipFileResourceTestUtils
.
runAndVerifyQuickStart_v1_Import
;
@Guice
(
modules
=
RepositoryMetadata
Module
.
class
)
@Guice
(
modules
=
TestOnly
Module
.
class
)
public
class
ImportServiceTest
{
private
static
final
Logger
LOG
=
LoggerFactory
.
getLogger
(
ImportServiceTest
.
class
);
...
...
repository/src/test/java/org/apache/atlas/repository/store/graph/AtlasTypeDefGraphStoreTest.java
View file @
235f4e9e
...
...
@@ -18,8 +18,7 @@
package
org
.
apache
.
atlas
.
repository
.
store
.
graph
;
import
com.google.inject.Inject
;
import
org.apache.atlas.RepositoryMetadataModule
;
import
org.apache.atlas.TestOnlyModule
;
import
org.apache.atlas.TestUtilsV2
;
import
org.apache.atlas.exception.AtlasBaseException
;
import
org.apache.atlas.model.SearchFilter
;
...
...
@@ -38,18 +37,12 @@ import org.testng.annotations.DataProvider;
import
org.testng.annotations.Guice
;
import
org.testng.annotations.Test
;
import
java.util.Arrays
;
import
java.util.Collections
;
import
java.util.List
;
import
static
org
.
testng
.
Assert
.
assertEquals
;
import
static
org
.
testng
.
Assert
.
assertNotEquals
;
import
static
org
.
testng
.
Assert
.
assertNotNull
;
import
static
org
.
testng
.
Assert
.
assertNull
;
import
static
org
.
testng
.
Assert
.
assertTrue
;
import
static
org
.
testng
.
Assert
.
fail
;
import
static
org
.
testng
.
Assert
.*;
@Guice
(
modules
=
RepositoryMetadata
Module
.
class
)
@Guice
(
modules
=
TestOnly
Module
.
class
)
public
class
AtlasTypeDefGraphStoreTest
{
private
static
final
Logger
LOG
=
LoggerFactory
.
getLogger
(
AtlasTypeDefGraphStoreTest
.
class
);
...
...
repository/src/test/java/org/apache/atlas/repository/store/graph/v1/AtlasDeleteHandlerV1Test.java
View file @
235f4e9e
...
...
@@ -20,9 +20,8 @@ package org.apache.atlas.repository.store.graph.v1;
import
com.google.common.collect.ImmutableList
;
import
com.google.common.collect.ImmutableSet
;
import
org.apache.atlas.AtlasException
;
import
org.apache.atlas.RepositoryMetadataModule
;
import
org.apache.atlas.RequestContext
;
import
org.apache.atlas.RequestContextV1
;
import
org.apache.atlas.TestOnlyModule
;
import
org.apache.atlas.TestUtils
;
import
org.apache.atlas.TestUtilsV2
;
import
org.apache.atlas.exception.AtlasBaseException
;
...
...
@@ -38,7 +37,6 @@ import org.apache.atlas.model.typedef.AtlasEnumDef;
import
org.apache.atlas.model.typedef.AtlasStructDef
;
import
org.apache.atlas.model.typedef.AtlasTypesDef
;
import
org.apache.atlas.repository.Constants
;
import
org.apache.atlas.repository.RepositoryException
;
import
org.apache.atlas.repository.graph.AtlasEdgeLabel
;
import
org.apache.atlas.repository.graph.AtlasGraphProvider
;
import
org.apache.atlas.repository.graph.GraphBackedSearchIndexer
;
...
...
@@ -69,7 +67,6 @@ import org.testng.annotations.Guice;
import
org.testng.annotations.Test
;
import
javax.inject.Inject
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Collections
;
...
...
@@ -77,18 +74,14 @@ import java.util.HashMap;
import
java.util.List
;
import
java.util.Map
;
import
static
org
.
apache
.
atlas
.
TestUtils
.
COLUMNS_ATTR_NAME
;
import
static
org
.
apache
.
atlas
.
TestUtils
.
COLUMN_TYPE
;
import
static
org
.
apache
.
atlas
.
TestUtils
.
DEPARTMENT_TYPE
;
import
static
org
.
apache
.
atlas
.
TestUtils
.
NAME
;
import
static
org
.
apache
.
atlas
.
TestUtils
.
TABLE_TYPE
;
import
static
org
.
apache
.
atlas
.
TestUtils
.*;
import
static
org
.
mockito
.
Mockito
.
mock
;
import
static
org
.
testng
.
Assert
.
assertEquals
;
import
static
org
.
testng
.
Assert
.
assertNotEquals
;
import
static
org
.
testng
.
Assert
.
assertTrue
;
import
static
org
.
testng
.
Assert
.
fail
;
@Guice
(
modules
=
RepositoryMetadata
Module
.
class
)
@Guice
(
modules
=
TestOnly
Module
.
class
)
public
abstract
class
AtlasDeleteHandlerV1Test
{
@Inject
...
...
repository/src/test/java/org/apache/atlas/repository/store/graph/v1/AtlasEntityStoreV1Test.java
View file @
235f4e9e
...
...
@@ -20,8 +20,8 @@ package org.apache.atlas.repository.store.graph.v1;
import
com.google.common.collect.ImmutableSet
;
import
org.apache.atlas.AtlasErrorCode
;
import
org.apache.atlas.AtlasException
;
import
org.apache.atlas.RepositoryMetadataModule
;
import
org.apache.atlas.RequestContextV1
;
import
org.apache.atlas.TestOnlyModule
;
import
org.apache.atlas.TestUtils
;
import
org.apache.atlas.TestUtilsV2
;
import
org.apache.atlas.exception.AtlasBaseException
;
...
...
@@ -77,7 +77,7 @@ import static org.mockito.Mockito.mock;
import
static
org
.
testng
.
Assert
.
assertEquals
;
import
static
org
.
testng
.
Assert
.
assertTrue
;
@Guice
(
modules
=
RepositoryMetadata
Module
.
class
)
@Guice
(
modules
=
TestOnly
Module
.
class
)
public
class
AtlasEntityStoreV1Test
{
private
static
final
Logger
LOG
=
LoggerFactory
.
getLogger
(
AtlasEntityStoreV1Test
.
class
);
...
...
repository/src/test/java/org/apache/atlas/repository/store/graph/v1/InverseReferenceUpdateHardDeleteV1Test.java
View file @
235f4e9e
...
...
@@ -17,17 +17,16 @@
*/
package
org
.
apache
.
atlas
.
repository
.
store
.
graph
.
v1
;
import
static
org
.
testng
.
Assert
.
assertEquals
;
import
static
org
.
testng
.
Assert
.
assertTrue
;
import
java.util.Map
;
import
com.google.common.collect.ImmutableList
;
import
org.apache.atlas.model.instance.AtlasEntity
;
import
org.apache.atlas.model.instance.AtlasObjectId
;
import
org.apache.atlas.type.AtlasTypeRegistry
;
import
org.apache.atlas.type.AtlasTypeUtil
;
import
com.google.common.collect.ImmutableList
;
import
java.util.Map
;
import
static
org
.
testng
.
Assert
.
assertEquals
;
import
static
org
.
testng
.
Assert
.
assertTrue
;
/**
* Inverse reference update test with {@link HardDeleteHandlerV1}
...
...
repository/src/test/java/org/apache/atlas/repository/store/graph/v1/InverseReferenceUpdateSoftDeleteV1Test.java
View file @
235f4e9e
...
...
@@ -17,17 +17,16 @@
*/
package
org
.
apache
.
atlas
.
repository
.
store
.
graph
.
v1
;
import
static
org
.
testng
.
Assert
.
assertEquals
;
import
static
org
.
testng
.
Assert
.
assertTrue
;
import
java.util.Map
;
import
com.google.common.collect.ImmutableList
;
import
org.apache.atlas.model.instance.AtlasEntity
;
import
org.apache.atlas.model.instance.AtlasObjectId
;
import
org.apache.atlas.type.AtlasTypeRegistry
;
import
org.apache.atlas.type.AtlasTypeUtil
;
import
com.google.common.collect.ImmutableList
;
import
java.util.Map
;
import
static
org
.
testng
.
Assert
.
assertEquals
;
import
static
org
.
testng
.
Assert
.
assertTrue
;
/**
...
...
repository/src/test/java/org/apache/atlas/repository/store/graph/v1/InverseReferenceUpdateV1Test.java
View file @
235f4e9e
...
...
@@ -17,21 +17,10 @@
*/
package
org
.
apache
.
atlas
.
repository
.
store
.
graph
.
v1
;
import
static
org
.
apache
.
atlas
.
TestUtils
.
NAME
;
import
static
org
.
mockito
.
Mockito
.
mock
;
import
static
org
.
testng
.
Assert
.
assertEquals
;
import
static
org
.
testng
.
Assert
.
assertNull
;
import
static
org
.
testng
.
Assert
.
assertTrue
;
import
java.util.Collections
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
javax.inject.Inject
;
import
org.apache.atlas.RepositoryMetadataModule
;
import
com.google.common.collect.ImmutableList
;
import
com.google.common.collect.ImmutableMap
;
import
org.apache.atlas.RequestContextV1
;
import
org.apache.atlas.TestOnlyModule
;
import
org.apache.atlas.TestUtils
;
import
org.apache.atlas.TestUtilsV2
;
import
org.apache.atlas.model.instance.AtlasEntity
;
...
...
@@ -56,14 +45,23 @@ import org.testng.annotations.BeforeMethod;
import
org.testng.annotations.Guice
;
import
org.testng.annotations.Test
;
import
com.google.common.collect.ImmutableList
;
import
com.google.common.collect.ImmutableMap
;
import
javax.inject.Inject
;
import
java.util.Collections
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
static
org
.
apache
.
atlas
.
TestUtils
.
NAME
;
import
static
org
.
mockito
.
Mockito
.
mock
;
import
static
org
.
testng
.
Assert
.
assertEquals
;
import
static
org
.
testng
.
Assert
.
assertNull
;
import
static
org
.
testng
.
Assert
.
assertTrue
;
/**
* Test automatic inverse reference updating in V1 (V2?) code path.
*
*/
@Guice
(
modules
=
RepositoryMetadata
Module
.
class
)
@Guice
(
modules
=
TestOnly
Module
.
class
)
public
abstract
class
InverseReferenceUpdateV1Test
{
@Inject
...
...
repository/src/test/java/org/apache/atlas/repository/typestore/GraphBackedTypeStoreTest.java
View file @
235f4e9e
...
...
@@ -21,7 +21,7 @@ package org.apache.atlas.repository.typestore;
import
com.google.common.collect.ImmutableList
;
import
com.google.common.collect.ImmutableSet
;
import
org.apache.atlas.AtlasException
;
import
org.apache.atlas.
RepositoryMetadata
Module
;
import
org.apache.atlas.
TestOnly
Module
;
import
org.apache.atlas.TestUtils
;
import
org.apache.atlas.repository.RepositoryException
;
import
org.apache.atlas.repository.graph.AtlasGraphProvider
;
...
...
@@ -50,7 +50,7 @@ import static org.apache.atlas.typesystem.types.utils.TypesUtil.createOptionalAt
import
static
org
.
apache
.
atlas
.
typesystem
.
types
.
utils
.
TypesUtil
.
createRequiredAttrDef
;
import
static
org
.
apache
.
atlas
.
typesystem
.
types
.
utils
.
TypesUtil
.
createStructTypeDef
;
@Guice
(
modules
=
RepositoryMetadata
Module
.
class
)
@Guice
(
modules
=
TestOnly
Module
.
class
)
public
class
GraphBackedTypeStoreTest
{
private
static
final
String
DESCRIPTION
=
"_description"
;
...
...
repository/src/test/java/org/apache/atlas/repository/typestore/StoreBackedTypeCacheConfigurationTest.java
View file @
235f4e9e
...
...
@@ -17,19 +17,18 @@
*/
package
org
.
apache
.
atlas
.
repository
.
typestore
;
import
com.google.inject.Inject
;
import
org.apache.atlas.typesystem.types.cache.TypeCache
;
import
org.testng.Assert
;
import
org.testng.annotations.Guice
;
import
org.testng.annotations.Test
;
import
com.google.inject.Inject
;
/**
* Verify Guice can successfully instantiate and inject StoreBackTypeCache.
* StoreBackedTypeCacheTestModule Guice module uses Atlas configuration
* which has type cache implementation class set to {@link StoreBackedTypeCache}.
*/
@Guice
(
modules
=
StoreBackedTypeCacheTestModule
.
class
)
@Guice
(
modules
=
StoreBackedTypeCacheTest
Only
Module
.
class
)
public
class
StoreBackedTypeCacheConfigurationTest
{
@Inject
...
...
repository/src/test/java/org/apache/atlas/repository/typestore/StoreBackedTypeCacheTest.java
View file @
235f4e9e
...
...
@@ -17,13 +17,10 @@
*/
package
org
.
apache
.
atlas
.
repository
.
typestore
;
import
java.util.HashMap
;
import
java.util.Map
;
import
javax.inject.Inject
;
import
com.google.common.collect.ImmutableList
;
import
com.google.common.collect.ImmutableSet
;
import
org.apache.atlas.AtlasException
;
import
org.apache.atlas.
RepositoryMetadata
Module
;
import
org.apache.atlas.
TestOnly
Module
;
import
org.apache.atlas.TestUtils
;
import
org.apache.atlas.repository.graph.AtlasGraphProvider
;
import
org.apache.atlas.typesystem.types.AttributeInfo
;
...
...
@@ -41,14 +38,15 @@ import org.testng.annotations.BeforeMethod;
import
org.testng.annotations.Guice
;
import
org.testng.annotations.Test
;
import
com.google.common.collect.ImmutableList
;
import
com.google.common.collect.ImmutableSet
;
import
javax.inject.Inject
;
import
java.util.HashMap
;
import
java.util.Map
;
/**
* Unit test for {@link StoreBackedTypeCache}
*/
@Guice
(
modules
=
RepositoryMetadata
Module
.
class
)
@Guice
(
modules
=
TestOnly
Module
.
class
)
public
class
StoreBackedTypeCacheTest
{
@Inject
...
...
repository/src/test/java/org/apache/atlas/repository/typestore/StoreBackedTypeCacheTestModule.java
→
repository/src/test/java/org/apache/atlas/repository/typestore/StoreBackedTypeCacheTest
Only
Module.java
View file @
235f4e9e
...
...
@@ -19,7 +19,7 @@ package org.apache.atlas.repository.typestore;
import
org.apache.atlas.ApplicationProperties
;
import
org.apache.atlas.AtlasException
;
import
org.apache.atlas.
RepositoryMetadata
Module
;
import
org.apache.atlas.
TestOnly
Module
;
import
org.apache.atlas.util.AtlasRepositoryConfiguration
;
import
org.apache.commons.configuration.Configuration
;
...
...
@@ -28,7 +28,8 @@ import org.apache.commons.configuration.Configuration;
* Guice module which sets TypeCache implementation class configuration property to {@link StoreBackedTypeCache}.
*
*/
public
class
StoreBackedTypeCacheTestModule
extends
RepositoryMetadataModule
{
public
class
StoreBackedTypeCacheTestOnlyModule
extends
TestOnlyModule
{
@Override
protected
Configuration
getConfiguration
()
{
try
{
...
...
repository/src/test/java/org/apache/atlas/service/DefaultMetadataServiceTest.java
View file @
235f4e9e
...
...
@@ -18,36 +18,14 @@
package
org
.
apache
.
atlas
.
service
;
import
static
org
.
apache
.
atlas
.
TestUtils
.
COLUMNS_ATTR_NAME
;
import
static
org
.
apache
.
atlas
.
TestUtils
.
COLUMN_TYPE
;
import
static
org
.
apache
.
atlas
.
TestUtils
.
PII
;
import
static
org
.
apache
.
atlas
.
TestUtils
.
TABLE_TYPE
;
import
static
org
.
apache
.
atlas
.
TestUtils
.
createColumnEntity
;
import
static
org
.
apache
.
atlas
.
TestUtils
.
createDBEntity
;
import
static
org
.
apache
.
atlas
.
TestUtils
.
createInstance
;
import
static
org
.
apache
.
atlas
.
TestUtils
.
createTableEntity
;
import
static
org
.
apache
.
atlas
.
TestUtils
.
randomString
;
import
static
org
.
apache
.
atlas
.
typesystem
.
types
.
utils
.
TypesUtil
.
createClassTypeDef
;
import
static
org
.
apache
.
atlas
.
typesystem
.
types
.
utils
.
TypesUtil
.
createOptionalAttrDef
;
import
static
org
.
testng
.
Assert
.
assertEquals
;
import
static
org
.
testng
.
Assert
.
assertNotNull
;
import
static
org
.
testng
.
Assert
.
assertNull
;
import
static
org
.
testng
.
Assert
.
assertTrue
;
import
static
org
.
testng
.
Assert
.
fail
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Collection
;
import
java.util.Collections
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
com.google.common.collect.ImmutableList
;
import
com.google.common.collect.ImmutableSet
;
import
com.google.inject.Inject
;
import
org.apache.atlas.AtlasClient
;
import
org.apache.atlas.AtlasException
;
import
org.apache.atlas.EntityAuditEvent
;
import
org.apache.atlas.RepositoryMetadataModule
;
import
org.apache.atlas.RequestContext
;
import
org.apache.atlas.TestOnlyModule
;
import
org.apache.atlas.TestUtils
;
import
org.apache.atlas.discovery.graph.GraphBackedDiscoveryService
;
import
org.apache.atlas.exception.AtlasBaseException
;
...
...
@@ -94,11 +72,20 @@ import org.testng.annotations.BeforeTest;
import
org.testng.annotations.Guice
;
import
org.testng.annotations.Test
;
import
com.google.common.collect.ImmutableList
;
import
com.google.common.collect.ImmutableSet
;
import
com.google.inject.Inject
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Collection
;
import
java.util.Collections
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
static
org
.
apache
.
atlas
.
TestUtils
.*;
import
static
org
.
apache
.
atlas
.
typesystem
.
types
.
utils
.
TypesUtil
.
createClassTypeDef
;
import
static
org
.
apache
.
atlas
.
typesystem
.
types
.
utils
.
TypesUtil
.
createOptionalAttrDef
;
import
static
org
.
testng
.
Assert
.*;
@Guice
(
modules
=
RepositoryMetadata
Module
.
class
)
@Guice
(
modules
=
TestOnly
Module
.
class
)
public
class
DefaultMetadataServiceTest
{
@Inject
private
MetadataService
metadataService
;
...
...
repository/src/test/java/org/apache/atlas/service/StoreBackedTypeCacheMetadataServiceTest.java
View file @
235f4e9e
...
...
@@ -17,11 +17,14 @@
*/
package
org
.
apache
.
atlas
.
service
;
import
com.google.common.collect.ImmutableList
;
import
com.google.common.collect.ImmutableSet
;
import
com.google.inject.Inject
;
import
org.apache.atlas.TestUtils
;
import
org.apache.atlas.repository.graph.AtlasGraphProvider
;
import
org.apache.atlas.repository.typestore.ITypeStore
;
import
org.apache.atlas.repository.typestore.StoreBackedTypeCache
;
import
org.apache.atlas.repository.typestore.StoreBackedTypeCacheTestModule
;
import
org.apache.atlas.repository.typestore.StoreBackedTypeCacheTest
Only
Module
;
import
org.apache.atlas.services.MetadataService
;
import
org.apache.atlas.typesystem.TypesDef
;
import
org.apache.atlas.typesystem.json.TypesSerialization
;
...
...
@@ -41,19 +44,14 @@ import org.testng.annotations.BeforeMethod;
import
org.testng.annotations.Guice
;
import
org.testng.annotations.Test
;
import
com.google.common.collect.ImmutableList
;
import
com.google.common.collect.ImmutableSet
;
import
com.google.inject.Inject
;
/**
* Verify MetadataService type operations trigger StoreBackedTypeCache to load non-cached types from the store.
* StoreBackedTypeCacheTestModule Guice module sets Atlas configuration
* to use {@link StoreBackedTypeCache} as the TypeCache implementation class.
*/
@Guice
(
modules
=
StoreBackedTypeCacheTestModule
.
class
)
public
class
StoreBackedTypeCacheMetadataServiceTest
{
@Guice
(
modules
=
StoreBackedTypeCacheTestOnlyModule
.
class
)
public
class
StoreBackedTypeCacheMetadataServiceTest
{
@Inject
private
MetadataService
metadataService
;
...
...
repository/src/test/java/org/apache/atlas/util/CompiledQueryCacheKeyTest.java
View file @
235f4e9e
...
...
@@ -18,12 +18,12 @@
package
org
.
apache
.
atlas
.
util
;
import
static
org
.
testng
.
Assert
.
assertEquals
;
import
static
org
.
testng
.
Assert
.
assertNotSame
;
import
org.apache.atlas.query.QueryParams
;
import
org.testng.annotations.Test
;
import
static
org
.
testng
.
Assert
.
assertEquals
;
import
static
org
.
testng
.
Assert
.
assertNotSame
;
/**
* Tests hashcode/equals behavior of CompiledQueryCacheKey
*
...
...
repository/src/test/java/org/apache/atlas/utils/HiveModel.java
View file @
235f4e9e
...
...
@@ -18,13 +18,6 @@
package
org
.
apache
.
atlas
.
utils
;
import
java.lang.reflect.Field
;
import
java.lang.reflect.Modifier
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.Date
;
import
java.util.List
;
import
org.apache.atlas.TestUtils
;
import
org.apache.atlas.typesystem.ITypedReferenceableInstance
;
import
org.apache.atlas.typesystem.Referenceable
;
...
...
@@ -34,6 +27,13 @@ import org.apache.atlas.typesystem.types.ClassType;
import
org.apache.atlas.typesystem.types.Multiplicity
;
import
org.apache.atlas.typesystem.types.TypeSystem
;
import
java.lang.reflect.Field
;
import
java.lang.reflect.Modifier
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.Date
;
import
java.util.List
;
/**
* Allows easy creation of entities for classes in the hive test model.
*
...
...
repository/src/test/scala/org/apache/atlas/query/ExpressionTest.scala
View file @
235f4e9e
...
...
@@ -18,9 +18,10 @@
package
org.apache.atlas.query
import
org.apache.atlas.DBSandboxer
import
org.apache.atlas.query.Expressions._
import
org.apache.atlas.repository.BaseTest
import
org.testng.annotations.
{
BeforeMethod
,
Test
}
import
org.testng.annotations.
{
BeforeMethod
,
Listeners
,
Test
}
class
ExpressionTest
extends
BaseTest
{
...
...
repository/src/test/scala/org/apache/atlas/query/GremlinTest.scala
View file @
235f4e9e
...
...
@@ -23,10 +23,10 @@ import org.apache.atlas.discovery.graph.DefaultGraphPersistenceStrategy
import
org.apache.atlas.query.Expressions._
import
org.apache.atlas.repository.graph.
{
AtlasGraphProvider
,
GraphBackedMetadataRepository
}
import
org.apache.atlas.typesystem.types.TypeSystem
import
org.testng.annotations.
{
Test
,
BeforeClass
,
AfterClass
}
import
org.testng.annotations.
_
import
org.apache.atlas.repository.graph.AtlasGraphProvider
import
org.
testng.annotations.BeforeMethod
import
org.apache.atlas.
TestUtils
import
org.
apache.atlas.
{
DBSandboxer
,
TestUtils
}
import
org.apache.atlas.
graph.GraphSandboxUtil
class
GremlinTest
extends
BaseGremlinTest
{
...
...
@@ -41,10 +41,10 @@ class GremlinTest extends BaseGremlinTest {
@BeforeClass
def
beforeAll
()
{
TypeSystem
.
getInstance
().
reset
()
var
repo
=
new
GraphBackedMetadataRepository
(
null
)
;
TestUtils
.
setupGraphProvider
(
repo
)
;
var
repo
=
new
GraphBackedMetadataRepository
(
null
)
TestUtils
.
setupGraphProvider
(
repo
)
//force graph to be initialized first
AtlasGraphProvider
.
getGraphInstance
()
;
AtlasGraphProvider
.
getGraphInstance
()
//create types and indices up front. Without this, some of the property keys (particularly __traitNames and __superTypes)
//get ended up created implicitly with some graph backends with the wrong multiplicity. This also makes the queries
...
...
@@ -52,13 +52,12 @@ class GremlinTest extends BaseGremlinTest {
QueryTestsUtils
.
setupTypesAndIndices
()
gp
=
new
DefaultGraphPersistenceStrategy
(
repo
)
g
=
QueryTestsUtils
.
setupTestGraph
(
repo
)
g
}
g
=
QueryTestsUtils
.
setupTestGraph
(
repo
)
}
@AfterClass
def
afterAll
()
{
AtlasGraphProvider
.
cleanup
()
;
AtlasGraphProvider
.
cleanup
()
}
...
...
@@ -236,7 +235,7 @@ class GremlinTest extends BaseGremlinTest {
| "clusterName": "test"
| }
| ]
|}"""
.
stripMargin
)
;
|}"""
.
stripMargin
)
}
@Test
def
testFilter2
{
...
...
@@ -315,7 +314,7 @@ class GremlinTest extends BaseGremlinTest {
| "clusterName": "test"
| }
| ]
|}"""
.
stripMargin
)
;
|}"""
.
stripMargin
)
}
@Test
def
testSelect
{
...
...
@@ -361,7 +360,7 @@ class GremlinTest extends BaseGremlinTest {
| "_src1.name": "Reporting"
| }
| ]
|}"""
.
stripMargin
)
;
|}"""
.
stripMargin
)
}
@Test
def
testIsTrait
{
...
...
@@ -774,7 +773,7 @@ class GremlinTest extends BaseGremlinTest {
| "name":"sales_fact_monthly_mv"
| }
| ]
|}"""
.
stripMargin
)
;
|}"""
.
stripMargin
)
}
@Test
def
testBackReference
{
...
...
@@ -868,13 +867,13 @@ class GremlinTest extends BaseGremlinTest {
| "clusterName": "test"
| }
| ]
|}"""
.
stripMargin
)
;
|}"""
.
stripMargin
)
}
@Test
def
testJoinAndSelect1
{
val
r
=
QueryProcessor
.
evaluate
(
_class
(
"DB"
).
as
(
"db1"
).
where
(
id
(
"name"
).
`=`
(
string
(
"Sales"
))).
field
(
"Table"
).
as
(
"tab"
).
where
(
(
isTrait
(
"Dimension"
)
)).
where
(
isTrait
(
"Dimension"
)).
select
(
id
(
"db1"
).
field
(
"name"
).
as
(
"dbName"
),
id
(
"tab"
).
field
(
"name"
).
as
(
"tabName"
)),
g
,
gp
)
validateJson
(
r
,
"{\n \"query\":\"DB as db1 where (name = \\\"Sales\\\") Table as tab where DB as db1 where (name = \\\"Sales\\\") Table as tab is Dimension as _src1 select db1.name as dbName, tab.name as tabName\",\n \"dataType\":{\n \"typeName\":\"__tempQueryResultStruct5\",\n \"attributeDefinitions\":[\n {\n \"name\":\"dbName\",\n \"dataTypeName\":\"string\",\n \"multiplicity\":{\n \"lower\":0,\n \"upper\":1,\n \"isUnique\":false\n },\n \"isComposite\":false,\n \"isUnique\":false,\n \"isIndexable\":false,\n \"reverseAttributeName\":null\n },\n {\n \"name\":\"tabName\",\n \"dataTypeName\":\"string\",\n \"multiplicity\":{\n \"lower\":0,\n \"upper\":1,\n \"isUnique\":false\n },\n \"isComposite\":false,\n \"isUnique\":false,\n \"isIndexable\":false,\n \"reverseAttributeName\":null\n }\n ]\n },\n \"rows\":[\n {\n \"$typeName$\":\"__tempQueryResultStruct5\",\n \"dbName\":\"Sales\",\n \"tabName\":\"product_dim\"\n },\n {\n \"$typeName$\":\"__tempQueryResultStruct5\",\n \"dbName\":\"Sales\",\n \"tabName\":\"time_dim\"\n },\n {\n \"$typeName$\":\"__tempQueryResultStruct5\",\n \"dbName\":\"Sales\",\n \"tabName\":\"customer_dim\"\n }\n ]\n}"
)
...
...
@@ -902,7 +901,7 @@ class GremlinTest extends BaseGremlinTest {
@Test
def
testJoinAndSelect4
{
val
r
=
QueryProcessor
.
evaluate
(
_class
(
"DB"
).
as
(
"db1"
).
where
(
id
(
"name"
).
`=`
(
string
(
"Sales"
))).
field
(
"Table"
).
as
(
"tab"
).
where
(
(
isTrait
(
"Dimension"
)
)).
where
(
isTrait
(
"Dimension"
)).
select
(
id
(
"db1"
).
as
(
"dbO"
),
id
(
"tab"
).
field
(
"name"
).
as
(
"tabName"
)),
g
,
gp
)
validateJson
(
r
,
"{\n \"query\":\"DB as db1 where (name = \\\"Sales\\\") Table as tab where DB as db1 where (name = \\\"Sales\\\") Table as tab is Dimension as _src1 select db1 as dbO, tab.name as tabName\",\n \"dataType\":{\n \"typeName\":\"\",\n \"attributeDefinitions\":[\n {\n \"name\":\"dbO\",\n \"dataTypeName\":\"DB\",\n \"multiplicity\":{\n \"lower\":0,\n \"upper\":1,\n \"isUnique\":false\n },\n \"isComposite\":false,\n \"isUnique\":false,\n \"isIndexable\":false,\n \"reverseAttributeName\":null\n },\n {\n \"name\":\"tabName\",\n \"dataTypeName\":\"string\",\n \"multiplicity\":{\n \"lower\":0,\n \"upper\":1,\n \"isUnique\":false\n },\n \"isComposite\":false,\n \"isUnique\":false,\n \"isIndexable\":false,\n \"reverseAttributeName\":null\n }\n ]\n },\n \"rows\":[\n {\n \"$typeName$\":\"\",\n \"dbO\":{\n \"$typeName$\":\"DB\",\n \"version\":0\n },\n \"tabName\":\"product_dim\"\n },\n {\n \"$typeName$\":\"\",\n \"dbO\":{\n \"$typeName$\":\"DB\",\n \"version\":0\n },\n \"tabName\":\"time_dim\"\n },\n {\n \"$typeName$\":\"\",\n \"dbO\":{\n \"$typeName$\":\"DB\",\n \"version\":0\n },\n \"tabName\":\"customer_dim\"\n }\n ]\n}"
)
...
...
repository/src/test/scala/org/apache/atlas/query/GremlinTest2.scala
View file @
235f4e9e
...
...
@@ -18,7 +18,7 @@
package
org.apache.atlas.query
import
org.apache.atlas.
TestUtils
import
org.apache.atlas.
{
DBSandboxer
,
TestUtils
}
import
org.apache.atlas.discovery.graph.DefaultGraphPersistenceStrategy
import
org.apache.atlas.query.Expressions._class
import
org.apache.atlas.query.Expressions._trait
...
...
@@ -26,10 +26,7 @@ import org.apache.atlas.query.Expressions.id
import
org.apache.atlas.repository.graph.GraphBackedMetadataRepository
import
org.apache.atlas.repository.graphdb.AtlasGraph
import
org.apache.atlas.typesystem.types.TypeSystem
import
org.testng.annotations.AfterClass
import
org.testng.annotations.BeforeClass
import
org.testng.annotations.BeforeMethod
import
org.testng.annotations.Test
import
org.testng.annotations._
import
org.apache.atlas.repository.graph.AtlasGraphProvider
class
GremlinTest2
extends
BaseGremlinTest
{
...
...
@@ -152,8 +149,6 @@ class GremlinTest2 extends BaseGremlinTest {
println
(
r
.
toInstanceJson
)
}
private
def
getPersistenceStrategy
(
g
:
AtlasGraph
[
_
,
_
])
:
GraphPersistenceStrategies
=
{
return
GraphPersistenceStrategy1
(
g
);
}
private
def
getPersistenceStrategy
(
g
:
AtlasGraph
[
_
,
_
])
:
GraphPersistenceStrategies
=
return
GraphPersistenceStrategy1
(
g
)
}
\ No newline at end of file
repository/src/test/scala/org/apache/atlas/query/LexerTest.scala
View file @
235f4e9e
...
...
@@ -18,8 +18,9 @@
package
org.apache.atlas.query
import
org.apache.atlas.DBSandboxer
import
org.testng.Assert
import
org.testng.annotations.
Test
import
org.testng.annotations.
{
Listeners
,
Test
}
import
scala.util.parsing.input.CharArrayReader
...
...
repository/src/test/scala/org/apache/atlas/query/LineageQueryTest.scala
View file @
235f4e9e
...
...
@@ -18,7 +18,7 @@
package
org.apache.atlas.query
import
org.apache.atlas.
TestUtils
import
org.apache.atlas.
{
DBSandboxer
,
TestUtils
}
import
org.apache.atlas.discovery.graph.DefaultGraphPersistenceStrategy
import
org.apache.atlas.query.Expressions._class
import
org.apache.atlas.query.Expressions.id
...
...
@@ -27,10 +27,7 @@ import org.apache.atlas.repository.graph.AtlasGraphProvider
import
org.apache.atlas.repository.graph.GraphBackedMetadataRepository
import
org.apache.atlas.repository.graphdb.AtlasGraph
import
org.apache.atlas.typesystem.types.TypeSystem
import
org.testng.annotations.AfterClass
import
org.testng.annotations.BeforeClass
import
org.testng.annotations.BeforeMethod
import
org.testng.annotations.Test
import
org.testng.annotations._
class
LineageQueryTest
extends
BaseGremlinTest
{
...
...
repository/src/test/scala/org/apache/atlas/query/ParserTest.scala
View file @
235f4e9e
...
...
@@ -18,8 +18,9 @@
package
org.apache.atlas.query
import
org.apache.atlas.DBSandboxer
import
org.apache.atlas.repository.BaseTest
import
org.testng.annotations.
{
BeforeMethod
,
Test
}
import
org.testng.annotations.
{
BeforeMethod
,
Listeners
,
Test
}
class
ParserTest
extends
BaseTest
{
...
...
webapp/pom.xml
View file @
235f4e9e
...
...
@@ -391,6 +391,18 @@
<scope>
test
</scope>
</dependency>
<dependency>
<groupId>
org.apache.atlas
</groupId>
<artifactId>
atlas-repository
</artifactId>
<classifier>
tests
</classifier>
<scope>
test
</scope>
</dependency>
<dependency>
<groupId>
org.apache.atlas
</groupId>
<artifactId>
atlas-graphdb-common
</artifactId>
<classifier>
tests
</classifier>
<scope>
test
</scope>
</dependency>
<dependency>
<groupId>
com.nimbusds
</groupId>
<artifactId>
nimbus-jose-jwt
</artifactId>
<version>
3.9
</version>
...
...
webapp/src/test/java/org/apache/atlas/web/adapters/TestEntitiesREST.java
View file @
235f4e9e
...
...
@@ -18,9 +18,9 @@
package
org
.
apache
.
atlas
.
web
.
adapters
;
import
org.apache.atlas.AtlasClient
;
import
org.apache.atlas.RequestContextV1
;
import
org.apache.atlas.RepositoryMetadataModule
;
import
org.apache.atlas.RequestContext
;
import
org.apache.atlas.RequestContextV1
;
import
org.apache.atlas.TestOnlyModule
;
import
org.apache.atlas.TestUtilsV2
;
import
org.apache.atlas.model.instance.AtlasClassification
;
import
org.apache.atlas.model.instance.AtlasEntity
;
...
...
@@ -37,15 +37,14 @@ import org.apache.atlas.repository.store.bootstrap.AtlasTypeDefStoreInitializer;
import
org.apache.atlas.store.AtlasTypeDefStore
;
import
org.apache.atlas.type.AtlasType
;
import
org.apache.atlas.type.AtlasTypeRegistry
;
import
org.apache.atlas.type.AtlasTypeUtil
;
import
org.apache.atlas.web.rest.EntityREST
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.testng.Assert
;
import
org.testng.annotations.AfterClass
;
import
org.testng.annotations.AfterMethod
;
import
org.testng.annotations.BeforeClass
;
import
org.testng.annotations.AfterClass
;
import
org.testng.annotations.Guice
;
import
org.testng.annotations.Test
;
...
...
@@ -58,7 +57,7 @@ import java.util.List;
import
java.util.Map
;
@Guice
(
modules
=
{
RepositoryMetadata
Module
.
class
})
@Guice
(
modules
=
{
TestOnly
Module
.
class
})
public
class
TestEntitiesREST
{
private
static
final
Logger
LOG
=
LoggerFactory
.
getLogger
(
TestEntitiesREST
.
class
);
...
...
webapp/src/test/java/org/apache/atlas/web/adapters/TestEntityREST.java
View file @
235f4e9e
...
...
@@ -17,9 +17,9 @@
*/
package
org
.
apache
.
atlas
.
web
.
adapters
;
import
org.apache.atlas.RepositoryMetadataModule
;
import
org.apache.atlas.RequestContext
;
import
org.apache.atlas.RequestContextV1
;
import
org.apache.atlas.TestOnlyModule
;
import
org.apache.atlas.TestUtilsV2
;
import
org.apache.atlas.model.instance.AtlasClassification
;
import
org.apache.atlas.model.instance.AtlasClassification.AtlasClassifications
;
...
...
@@ -36,9 +36,9 @@ import org.apache.atlas.type.AtlasTypeUtil;
import
org.apache.atlas.web.rest.EntityREST
;
import
org.mockito.Mockito
;
import
org.testng.Assert
;
import
org.testng.annotations.AfterClass
;
import
org.testng.annotations.AfterMethod
;
import
org.testng.annotations.BeforeClass
;
import
org.testng.annotations.AfterClass
;
import
org.testng.annotations.Guice
;
import
org.testng.annotations.Test
;
...
...
@@ -50,7 +50,7 @@ import java.util.HashMap;
import
java.util.List
;
import
java.util.Map
;
@Guice
(
modules
=
{
RepositoryMetadata
Module
.
class
})
@Guice
(
modules
=
{
TestOnly
Module
.
class
})
public
class
TestEntityREST
{
@Inject
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment