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
59f83fc0
Commit
59f83fc0
authored
7 years ago
by
apoorvnaik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ATLAS-2201: Test dependency, plugin version and test code fixes
parent
a3bafb1e
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
118 additions
and
130 deletions
+118
-130
InMemoryJAASConfigurationTest.java
.../apache/atlas/security/InMemoryJAASConfigurationTest.java
+7
-15
InMemoryJAASConfigurationTicketBasedKafkaClientTest.java
.../InMemoryJAASConfigurationTicketBasedKafkaClientTest.java
+7
-16
pom.xml
pom.xml
+11
-6
GraphBackedMetadataRepositoryTest.java
...s/repository/graph/GraphBackedMetadataRepositoryTest.java
+89
-89
AtlasTypeDefGraphStoreTest.java
...as/repository/store/graph/AtlasTypeDefGraphStoreTest.java
+4
-4
No files found.
intg/src/test/java/org/apache/atlas/security/InMemoryJAASConfigurationTest.java
View file @
59f83fc0
...
@@ -18,32 +18,24 @@
...
@@ -18,32 +18,24 @@
package
org
.
apache
.
atlas
.
security
;
package
org
.
apache
.
atlas
.
security
;
import
javax.security.auth.login.AppConfigurationEntry
;
import
javax.security.auth.login.Configuration
;
import
junit.framework.Assert
;
import
junit.framework.TestCase
;
import
org.apache.hadoop.util.StringUtils
;
import
org.apache.hadoop.util.StringUtils
;
import
org.testng.Assert
;
import
org.testng.annotations.BeforeClass
;
import
org.testng.annotations.Test
;
import
org.testng.annotations.Test
;
import
javax.security.auth.login.AppConfigurationEntry
;
import
javax.security.auth.login.Configuration
;
//Unstable test. Disabling
//Unstable test. Disabling
@Test
(
enabled
=
false
)
@Test
(
enabled
=
false
)
public
class
InMemoryJAASConfigurationTest
extends
TestCase
{
public
class
InMemoryJAASConfigurationTest
{
private
static
final
String
ATLAS_JAAS_PROP_FILE
=
"atlas-jaas.properties"
;
private
static
final
String
ATLAS_JAAS_PROP_FILE
=
"atlas-jaas.properties"
;
@BeforeClass
protected
void
setUp
()
throws
Exception
{
protected
void
setUp
()
throws
Exception
{
super
.
setUp
();
try
{
InMemoryJAASConfiguration
.
init
(
ATLAS_JAAS_PROP_FILE
);
InMemoryJAASConfiguration
.
init
(
ATLAS_JAAS_PROP_FILE
);
}
catch
(
Throwable
t
)
{
fail
(
"InMemoryJAASConfiguration.init() is not expected to throw Exception:"
+
t
);
}
}
protected
void
tearDown
()
throws
Exception
{
super
.
tearDown
();
}
}
@Test
(
enabled
=
false
)
@Test
(
enabled
=
false
)
...
...
This diff is collapsed.
Click to expand it.
intg/src/test/java/org/apache/atlas/security/InMemoryJAASConfigurationTicketBasedKafkaClientTest.java
View file @
59f83fc0
...
@@ -18,34 +18,25 @@
...
@@ -18,34 +18,25 @@
package
org
.
apache
.
atlas
.
security
;
package
org
.
apache
.
atlas
.
security
;
import
org.testng.Assert
;
import
org.testng.annotations.BeforeClass
;
import
org.testng.annotations.Test
;
import
javax.security.auth.login.AppConfigurationEntry
;
import
javax.security.auth.login.AppConfigurationEntry
;
import
javax.security.auth.login.Configuration
;
import
javax.security.auth.login.Configuration
;
import
junit.framework.Assert
;
import
junit.framework.TestCase
;
import
org.testng.annotations.Test
;
@Test
@Test
public
class
InMemoryJAASConfigurationTicketBasedKafkaClientTest
extends
TestCase
{
public
class
InMemoryJAASConfigurationTicketBasedKafkaClientTest
{
private
static
final
String
ATLAS_JAAS_PROP_FILE
=
"atlas-jaas.properties"
;
private
static
final
String
ATLAS_JAAS_PROP_FILE
=
"atlas-jaas.properties"
;
protected
void
setUp
()
throws
Exception
{
@BeforeClass
super
.
setUp
();
public
void
setUp
()
throws
Exception
{
try
{
InMemoryJAASConfiguration
.
init
(
ATLAS_JAAS_PROP_FILE
);
InMemoryJAASConfiguration
.
init
(
ATLAS_JAAS_PROP_FILE
);
InMemoryJAASConfiguration
.
setConfigSectionRedirect
(
"KafkaClient"
,
"ticketBased-KafkaClient"
);
InMemoryJAASConfiguration
.
setConfigSectionRedirect
(
"KafkaClient"
,
"ticketBased-KafkaClient"
);
}
catch
(
Throwable
t
)
{
fail
(
"InMemoryJAASConfiguration.init() is not expected to throw Exception:"
+
t
);
}
}
}
protected
void
tearDown
()
throws
Exception
{
super
.
tearDown
();
}
@Test
@Test
public
void
testGetAppConfigurationEntryStringForticketBasedKafkaClient
()
{
public
void
testGetAppConfigurationEntryStringForticketBasedKafkaClient
()
{
...
...
This diff is collapsed.
Click to expand it.
pom.xml
View file @
59f83fc0
...
@@ -586,10 +586,14 @@
...
@@ -586,10 +586,14 @@
<titan.index.backend>
elasticsearch
</titan.index.backend>
<titan.index.backend>
elasticsearch
</titan.index.backend>
<entity.repository.impl>
org.apache.atlas.repository.audit.InMemoryEntityAuditRepository
</entity.repository.impl>
<entity.repository.impl>
org.apache.atlas.repository.audit.InMemoryEntityAuditRepository
</entity.repository.impl>
<graphdb.backend.impl>
org.apache.atlas.repository.graphdb.titan0.Titan0GraphDatabase
</graphdb.backend.impl>
<graphdb.backend.impl>
org.apache.atlas.repository.graphdb.titan0.Titan0GraphDatabase
</graphdb.backend.impl>
<surefire.version>
2.18.1
</surefire.version>
<surefire.forkCount>
2C
</surefire.forkCount>
<failsafe.version>
2.18.1
</failsafe.version>
<atlas.surefire.options></atlas.surefire.options>
<atlas.surefire.options></atlas.surefire.options>
<aspectj.runtime.version>
1.8.7
</aspectj.runtime.version>
<aspectj.runtime.version>
1.8.7
</aspectj.runtime.version>
<project.build.dashboardv2.gruntBuild>
build-minify
</project.build.dashboardv2.gruntBuild>
<project.build.dashboardv2.gruntBuild>
build-minify
</project.build.dashboardv2.gruntBuild>
<testng.version>
6.9.4
</testng.version>
</properties>
</properties>
<profiles>
<profiles>
...
@@ -1382,6 +1386,7 @@
...
@@ -1382,6 +1386,7 @@
<groupId>
org.apache.atlas
</groupId>
<groupId>
org.apache.atlas
</groupId>
<artifactId>
atlas-client
</artifactId>
<artifactId>
atlas-client
</artifactId>
<version>
${project.version}
</version>
<version>
${project.version}
</version>
<type>
pom
</type>
</dependency>
</dependency>
<dependency>
<dependency>
...
@@ -1655,7 +1660,7 @@
...
@@ -1655,7 +1660,7 @@
<dependency>
<dependency>
<groupId>
org.testng
</groupId>
<groupId>
org.testng
</groupId>
<artifactId>
testng
</artifactId>
<artifactId>
testng
</artifactId>
<version>
6.1.1
</version>
<version>
${testng.version}
</version>
<scope>
test
</scope>
<scope>
test
</scope>
</dependency>
</dependency>
...
@@ -1805,13 +1810,13 @@
...
@@ -1805,13 +1810,13 @@
<plugin>
<plugin>
<groupId>
org.apache.maven.plugins
</groupId>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-surefire-plugin
</artifactId>
<artifactId>
maven-surefire-plugin
</artifactId>
<version>
2.16
</version>
<version>
${surefire.version}
</version>
</plugin>
</plugin>
<plugin>
<plugin>
<groupId>
org.apache.maven.plugins
</groupId>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-failsafe-plugin
</artifactId>
<artifactId>
maven-failsafe-plugin
</artifactId>
<version>
2.18.1
</version>
<version>
${failsafe.version}
</version>
</plugin>
</plugin>
<plugin>
<plugin>
...
@@ -1934,7 +1939,7 @@
...
@@ -1934,7 +1939,7 @@
<plugin>
<plugin>
<groupId>
org.apache.maven.plugins
</groupId>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-surefire-plugin
</artifactId>
<artifactId>
maven-surefire-plugin
</artifactId>
<version>
2.18.1
</version>
<version>
${surefire.version}
</version>
<configuration>
<configuration>
<systemProperties>
<systemProperties>
<user.dir>
${project.basedir}
</user.dir>
<user.dir>
${project.basedir}
</user.dir>
...
@@ -1942,7 +1947,7 @@
...
@@ -1942,7 +1947,7 @@
<log4j.configuration>
atlas-log4j.xml
</log4j.configuration>
<log4j.configuration>
atlas-log4j.xml
</log4j.configuration>
</systemProperties>
</systemProperties>
<skipTests>
${skipTests}
</skipTests>
<skipTests>
${skipTests}
</skipTests>
<forkCount>
2C
</forkCount>
<forkCount>
${surefire.forkCount}
</forkCount>
<reuseForks>
false
</reuseForks>
<reuseForks>
false
</reuseForks>
<redirectTestOutputToFile>
true
</redirectTestOutputToFile>
<redirectTestOutputToFile>
true
</redirectTestOutputToFile>
<argLine>
-Djava.awt.headless=true -Dproject.version=${project.version}
<argLine>
-Djava.awt.headless=true -Dproject.version=${project.version}
...
@@ -1963,7 +1968,7 @@
...
@@ -1963,7 +1968,7 @@
<plugin>
<plugin>
<groupId>
org.apache.maven.plugins
</groupId>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-failsafe-plugin
</artifactId>
<artifactId>
maven-failsafe-plugin
</artifactId>
<version>
2.19.1
</version>
<version>
${failsafe.version}
</version>
<configuration>
<configuration>
<systemPropertyVariables>
<systemPropertyVariables>
<projectBaseDir>
${projectBaseDir}
</projectBaseDir>
<projectBaseDir>
${projectBaseDir}
</projectBaseDir>
...
...
This diff is collapsed.
Click to expand it.
repository/src/test/java/org/apache/atlas/repository/graph/GraphBackedMetadataRepositoryTest.java
View file @
59f83fc0
...
@@ -124,7 +124,7 @@ public class GraphBackedMetadataRepositoryTest {
...
@@ -124,7 +124,7 @@ public class GraphBackedMetadataRepositoryTest {
}
}
@AfterClass
@AfterClass
public
void
tearDown
()
throws
Exception
{
public
void
tearDown
()
{
TypeSystem
.
getInstance
().
reset
();
TypeSystem
.
getInstance
().
reset
();
// AtlasGraphProvider.cleanup();
// AtlasGraphProvider.cleanup();
}
}
...
@@ -180,19 +180,6 @@ public class GraphBackedMetadataRepositoryTest {
...
@@ -180,19 +180,6 @@ public class GraphBackedMetadataRepositoryTest {
assertTrue
(
validated1
|
validated2
);
assertTrue
(
validated1
|
validated2
);
}
}
private
boolean
assertEdge
(
String
id
,
String
typeName
)
throws
Exception
{
AtlasGraph
graph
=
TestUtils
.
getGraph
();
Iterable
<
AtlasVertex
>
vertices
=
graph
.
query
().
has
(
Constants
.
GUID_PROPERTY_KEY
,
id
).
vertices
();
AtlasVertex
AtlasVertex
=
vertices
.
iterator
().
next
();
Iterable
<
AtlasEdge
>
edges
=
AtlasVertex
.
getEdges
(
AtlasEdgeDirection
.
OUT
,
Constants
.
INTERNAL_PROPERTY_KEY_PREFIX
+
typeName
+
".ref"
);
if
(!
edges
.
iterator
().
hasNext
())
{
ITypedReferenceableInstance
entity
=
repositoryService
.
getEntityDefinition
(
id
);
assertNotNull
(
entity
.
get
(
"ref"
));
return
true
;
}
return
false
;
}
@Test
@Test
public
void
testSubmitEntity
()
throws
Exception
{
public
void
testSubmitEntity
()
throws
Exception
{
ITypedReferenceableInstance
hrDept
=
TestUtils
.
createDeptEg1
(
typeSystem
);
ITypedReferenceableInstance
hrDept
=
TestUtils
.
createDeptEg1
(
typeSystem
);
...
@@ -363,22 +350,6 @@ public class GraphBackedMetadataRepositoryTest {
...
@@ -363,22 +350,6 @@ public class GraphBackedMetadataRepositoryTest {
validateGuidMapping
(
toVerify
,
result
);
validateGuidMapping
(
toVerify
,
result
);
}
}
private
void
validateGuidMapping
(
List
<
Referenceable
>
toVerify
,
CreateUpdateEntitiesResult
result
)
throws
AtlasException
{
Map
<
String
,
String
>
guids
=
result
.
getGuidMapping
().
getGuidAssignments
();
TestUtils
.
assertContentsSame
(
result
.
getCreatedEntities
(),
guids
.
values
());
assertEquals
(
guids
.
size
(),
toVerify
.
size
());
for
(
Referenceable
r
:
toVerify
)
{
loadAndDoSimpleValidation
(
guids
.
get
(
r
.
getId
().
_getId
()),
r
);
}
}
private
ITypedReferenceableInstance
loadAndDoSimpleValidation
(
String
guid
,
Referenceable
inst
)
throws
AtlasException
{
return
TestUtils
.
loadAndDoSimpleValidation
(
guid
,
inst
,
repositoryService
);
}
@Test
(
dependsOnMethods
=
"testSubmitEntity"
)
@Test
(
dependsOnMethods
=
"testSubmitEntity"
)
public
void
testGetEntityDefinitionForDepartment
()
throws
Exception
{
public
void
testGetEntityDefinitionForDepartment
()
throws
Exception
{
ITypedReferenceableInstance
entity
=
repositoryService
.
getEntityDefinition
(
guid
);
ITypedReferenceableInstance
entity
=
repositoryService
.
getEntityDefinition
(
guid
);
...
@@ -452,41 +423,6 @@ public class GraphBackedMetadataRepositoryTest {
...
@@ -452,41 +423,6 @@ public class GraphBackedMetadataRepositoryTest {
System
.
out
.
println
(
"*** table = "
+
table
);
System
.
out
.
println
(
"*** table = "
+
table
);
}
}
private
List
<
String
>
createEntities
(
ITypedReferenceableInstance
...
instances
)
throws
Exception
{
RequestContext
.
createContext
();
return
repositoryService
.
createEntities
(
instances
).
getCreatedEntities
();
}
private
List
<
String
>
createEntity
(
Referenceable
entity
)
throws
Exception
{
ClassType
type
=
typeSystem
.
getDataType
(
ClassType
.
class
,
entity
.
getTypeName
());
ITypedReferenceableInstance
instance
=
type
.
convert
(
entity
,
Multiplicity
.
REQUIRED
);
return
createEntities
(
instance
);
}
@GraphTransaction
String
getGUID
()
{
AtlasVertex
tableVertex
=
getTableEntityVertex
();
String
guid
=
GraphHelper
.
getSingleValuedProperty
(
tableVertex
,
Constants
.
GUID_PROPERTY_KEY
,
String
.
class
);
if
(
guid
==
null
)
{
Assert
.
fail
();
}
return
guid
;
}
AtlasVertex
getTableEntityVertex
()
{
AtlasGraph
graph
=
TestUtils
.
getGraph
();
AtlasGraphQuery
query
=
graph
.
query
().
has
(
Constants
.
ENTITY_TYPE_PROPERTY_KEY
,
ComparisionOperator
.
EQUAL
,
TestUtils
.
TABLE_TYPE
);
Iterator
<
AtlasVertex
>
results
=
query
.
vertices
().
iterator
();
// returning one since guid should be unique
AtlasVertex
tableVertex
=
results
.
hasNext
()
?
results
.
next
()
:
null
;
if
(
tableVertex
==
null
)
{
Assert
.
fail
();
}
return
tableVertex
;
}
@Test
(
dependsOnMethods
=
"testCreateEntity"
)
@Test
(
dependsOnMethods
=
"testCreateEntity"
)
public
void
testGetTraitNames
()
throws
Exception
{
public
void
testGetTraitNames
()
throws
Exception
{
final
List
<
String
>
traitNames
=
repositoryService
.
getTraitNames
(
getGUID
());
final
List
<
String
>
traitNames
=
repositoryService
.
getTraitNames
(
getGUID
());
...
@@ -593,7 +529,7 @@ public class GraphBackedMetadataRepositoryTest {
...
@@ -593,7 +529,7 @@ public class GraphBackedMetadataRepositoryTest {
Assert
.
assertEquals
(
type
,
"SSN"
);
Assert
.
assertEquals
(
type
,
"SSN"
);
}
}
@Test
(
expectedExceptions
=
NullPointerException
.
class
)
@Test
(
dependsOnMethods
=
"testCreateEntity"
,
expectedExceptions
=
NullPointerException
.
class
)
public
void
testAddTraitWithNullInstance
()
throws
Exception
{
public
void
testAddTraitWithNullInstance
()
throws
Exception
{
repositoryService
.
addTrait
(
getGUID
(),
null
);
repositoryService
.
addTrait
(
getGUID
(),
null
);
Assert
.
fail
();
Assert
.
fail
();
...
@@ -798,7 +734,8 @@ public class GraphBackedMetadataRepositoryTest {
...
@@ -798,7 +734,8 @@ public class GraphBackedMetadataRepositoryTest {
//verify limit and offset
//verify limit and offset
//higher limit should return all results
//higher limit should return all results
results
=
new
JSONArray
(
discoveryService
.
searchByFullText
(
"Department"
,
queryParams
));
results
=
new
JSONArray
(
discoveryService
.
searchByFullText
(
"Department"
,
queryParams
));
assertEquals
(
results
.
length
(),
5
);
assertTrue
(
results
.
length
()
>
0
);
int
maxResults
=
results
.
length
();
//smaller limit should return those many rows
//smaller limit should return those many rows
results
=
new
JSONArray
(
discoveryService
.
searchByFullText
(
"Department"
,
new
QueryParams
(
2
,
0
)));
results
=
new
JSONArray
(
discoveryService
.
searchByFullText
(
"Department"
,
new
QueryParams
(
2
,
0
)));
...
@@ -806,11 +743,94 @@ public class GraphBackedMetadataRepositoryTest {
...
@@ -806,11 +743,94 @@ public class GraphBackedMetadataRepositoryTest {
//offset should offset the results
//offset should offset the results
results
=
new
JSONArray
(
discoveryService
.
searchByFullText
(
"Department"
,
new
QueryParams
(
5
,
2
)));
results
=
new
JSONArray
(
discoveryService
.
searchByFullText
(
"Department"
,
new
QueryParams
(
5
,
2
)));
assertEquals
(
results
.
length
(),
3
);
assertEquals
(
results
.
length
(),
maxResults
>
5
?
5
:
Math
.
min
((
maxResults
-
2
)
%
5
,
5
)
);
//higher offset shouldn't return any rows
//higher offset shouldn't return any rows
results
=
new
JSONArray
(
discoveryService
.
searchByFullText
(
"Department"
,
new
QueryParams
(
2
,
6
)));
results
=
new
JSONArray
(
discoveryService
.
searchByFullText
(
"Department"
,
new
QueryParams
(
2
,
6
)));
assertEquals
(
results
.
length
(),
0
);
assertEquals
(
results
.
length
(),
maxResults
>
6
?
Math
.
min
(
maxResults
-
6
,
2
)
:
0
);
}
@Test
public
void
testUTFValues
()
throws
Exception
{
Referenceable
hrDept
=
new
Referenceable
(
"Department"
);
Referenceable
john
=
new
Referenceable
(
"Person"
);
john
.
set
(
"name"
,
randomUTF
());
john
.
set
(
"department"
,
hrDept
);
hrDept
.
set
(
"name"
,
randomUTF
());
hrDept
.
set
(
"employees"
,
ImmutableList
.
of
(
john
));
ClassType
deptType
=
typeSystem
.
getDataType
(
ClassType
.
class
,
"Department"
);
ITypedReferenceableInstance
hrDept2
=
deptType
.
convert
(
hrDept
,
Multiplicity
.
REQUIRED
);
List
<
String
>
guids
=
repositoryService
.
createEntities
(
hrDept2
).
getCreatedEntities
();
Assert
.
assertNotNull
(
guids
);
Assert
.
assertEquals
(
guids
.
size
(),
2
);
Assert
.
assertNotNull
(
guids
.
get
(
0
));
Assert
.
assertNotNull
(
guids
.
get
(
1
));
}
@GraphTransaction
String
getGUID
()
{
AtlasVertex
tableVertex
=
getTableEntityVertex
();
String
guid
=
GraphHelper
.
getSingleValuedProperty
(
tableVertex
,
Constants
.
GUID_PROPERTY_KEY
,
String
.
class
);
if
(
guid
==
null
)
{
Assert
.
fail
();
}
return
guid
;
}
AtlasVertex
getTableEntityVertex
()
{
AtlasGraph
graph
=
TestUtils
.
getGraph
();
AtlasGraphQuery
query
=
graph
.
query
().
has
(
Constants
.
ENTITY_TYPE_PROPERTY_KEY
,
ComparisionOperator
.
EQUAL
,
TestUtils
.
TABLE_TYPE
);
Iterator
<
AtlasVertex
>
results
=
query
.
vertices
().
iterator
();
// returning one since guid should be unique
AtlasVertex
tableVertex
=
results
.
hasNext
()
?
results
.
next
()
:
null
;
if
(
tableVertex
==
null
)
{
Assert
.
fail
();
}
return
tableVertex
;
}
private
boolean
assertEdge
(
String
id
,
String
typeName
)
throws
Exception
{
AtlasGraph
graph
=
TestUtils
.
getGraph
();
Iterable
<
AtlasVertex
>
vertices
=
graph
.
query
().
has
(
Constants
.
GUID_PROPERTY_KEY
,
id
).
vertices
();
AtlasVertex
AtlasVertex
=
vertices
.
iterator
().
next
();
Iterable
<
AtlasEdge
>
edges
=
AtlasVertex
.
getEdges
(
AtlasEdgeDirection
.
OUT
,
Constants
.
INTERNAL_PROPERTY_KEY_PREFIX
+
typeName
+
".ref"
);
if
(!
edges
.
iterator
().
hasNext
())
{
ITypedReferenceableInstance
entity
=
repositoryService
.
getEntityDefinition
(
id
);
assertNotNull
(
entity
.
get
(
"ref"
));
return
true
;
}
return
false
;
}
private
void
validateGuidMapping
(
List
<
Referenceable
>
toVerify
,
CreateUpdateEntitiesResult
result
)
throws
AtlasException
{
Map
<
String
,
String
>
guids
=
result
.
getGuidMapping
().
getGuidAssignments
();
TestUtils
.
assertContentsSame
(
result
.
getCreatedEntities
(),
guids
.
values
());
assertEquals
(
guids
.
size
(),
toVerify
.
size
());
for
(
Referenceable
r
:
toVerify
)
{
loadAndDoSimpleValidation
(
guids
.
get
(
r
.
getId
().
_getId
()),
r
);
}
}
private
ITypedReferenceableInstance
loadAndDoSimpleValidation
(
String
guid
,
Referenceable
inst
)
throws
AtlasException
{
return
TestUtils
.
loadAndDoSimpleValidation
(
guid
,
inst
,
repositoryService
);
}
private
List
<
String
>
createEntities
(
ITypedReferenceableInstance
...
instances
)
throws
Exception
{
RequestContext
.
createContext
();
return
repositoryService
.
createEntities
(
instances
).
getCreatedEntities
();
}
private
List
<
String
>
createEntity
(
Referenceable
entity
)
throws
Exception
{
ClassType
type
=
typeSystem
.
getDataType
(
ClassType
.
class
,
entity
.
getTypeName
());
ITypedReferenceableInstance
instance
=
type
.
convert
(
entity
,
Multiplicity
.
REQUIRED
);
return
createEntities
(
instance
);
}
}
private
ITypedReferenceableInstance
createHiveTableInstance
(
Referenceable
databaseInstance
)
throws
Exception
{
private
ITypedReferenceableInstance
createHiveTableInstance
(
Referenceable
databaseInstance
)
throws
Exception
{
...
@@ -891,24 +911,4 @@ public class GraphBackedMetadataRepositoryTest {
...
@@ -891,24 +911,4 @@ public class GraphBackedMetadataRepositoryTest {
private
String
randomString
()
{
private
String
randomString
()
{
return
TestUtils
.
randomString
(
10
);
return
TestUtils
.
randomString
(
10
);
}
}
@Test
public
void
testUTFValues
()
throws
Exception
{
Referenceable
hrDept
=
new
Referenceable
(
"Department"
);
Referenceable
john
=
new
Referenceable
(
"Person"
);
john
.
set
(
"name"
,
randomUTF
());
john
.
set
(
"department"
,
hrDept
);
hrDept
.
set
(
"name"
,
randomUTF
());
hrDept
.
set
(
"employees"
,
ImmutableList
.
of
(
john
));
ClassType
deptType
=
typeSystem
.
getDataType
(
ClassType
.
class
,
"Department"
);
ITypedReferenceableInstance
hrDept2
=
deptType
.
convert
(
hrDept
,
Multiplicity
.
REQUIRED
);
List
<
String
>
guids
=
repositoryService
.
createEntities
(
hrDept2
).
getCreatedEntities
();
Assert
.
assertNotNull
(
guids
);
Assert
.
assertEquals
(
guids
.
size
(),
2
);
Assert
.
assertNotNull
(
guids
.
get
(
0
));
Assert
.
assertNotNull
(
guids
.
get
(
1
));
}
}
}
This diff is collapsed.
Click to expand it.
repository/src/test/java/org/apache/atlas/repository/store/graph/AtlasTypeDefGraphStoreTest.java
View file @
59f83fc0
...
@@ -57,7 +57,7 @@ public class AtlasTypeDefGraphStoreTest {
...
@@ -57,7 +57,7 @@ public class AtlasTypeDefGraphStoreTest {
RequestContextV1
.
get
().
setUser
(
TestUtilsV2
.
TEST_USER
);
RequestContextV1
.
get
().
setUser
(
TestUtilsV2
.
TEST_USER
);
}
}
@Test
(
priority
=
1
)
@Test
public
void
testGet
()
{
public
void
testGet
()
{
try
{
try
{
AtlasTypesDef
typesDef
=
typeDefStore
.
searchTypesDef
(
new
SearchFilter
());
AtlasTypesDef
typesDef
=
typeDefStore
.
searchTypesDef
(
new
SearchFilter
());
...
@@ -73,7 +73,7 @@ public class AtlasTypeDefGraphStoreTest {
...
@@ -73,7 +73,7 @@ public class AtlasTypeDefGraphStoreTest {
}
}
}
}
@Test
(
dataProvider
=
"invalidGetProvider"
,
priority
=
2
)
@Test
(
dataProvider
=
"invalidGetProvider"
,
dependsOnMethods
=
"testGet"
)
public
void
testInvalidGet
(
String
name
,
String
guid
){
public
void
testInvalidGet
(
String
name
,
String
guid
){
try
{
try
{
assertNull
(
typeDefStore
.
getEnumDefByName
(
name
));
assertNull
(
typeDefStore
.
getEnumDefByName
(
name
));
...
@@ -540,7 +540,7 @@ public class AtlasTypeDefGraphStoreTest {
...
@@ -540,7 +540,7 @@ public class AtlasTypeDefGraphStoreTest {
}
}
}
}
@Test
@Test
(
dependsOnMethods
=
"testGet"
)
public
void
testTypeDeletionAndRecreate
()
{
public
void
testTypeDeletionAndRecreate
()
{
AtlasClassificationDef
aTag
=
new
AtlasClassificationDef
(
"testTag"
);
AtlasClassificationDef
aTag
=
new
AtlasClassificationDef
(
"testTag"
);
AtlasAttributeDef
attributeDef
=
new
AtlasAttributeDef
(
"testAttribute"
,
"string"
,
true
,
AtlasAttributeDef
attributeDef
=
new
AtlasAttributeDef
(
"testAttribute"
,
"string"
,
true
,
...
@@ -579,7 +579,7 @@ public class AtlasTypeDefGraphStoreTest {
...
@@ -579,7 +579,7 @@ public class AtlasTypeDefGraphStoreTest {
}
}
}
}
@Test
@Test
(
dependsOnMethods
=
"testGet"
)
public
void
testTypeRegistryIsUpdatedAfterGraphStorage
()
throws
AtlasBaseException
{
public
void
testTypeRegistryIsUpdatedAfterGraphStorage
()
throws
AtlasBaseException
{
String
classificationDef
=
"{"
String
classificationDef
=
"{"
+
"\"name\":\"test_classification_11\","
+
"\"name\":\"test_classification_11\","
...
...
This diff is collapsed.
Click to expand it.
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