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
e0423116
Commit
e0423116
authored
Jan 09, 2015
by
Dan Markwat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Duplication of the repository module's tests. Tests were fundamentally
similar and could easily be performed inside of the repository module
parent
402e3680
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
0 additions
and
130 deletions
+0
-130
GraphRepositoryServiceIT.java
.../org/apache/hadoop/metadata/GraphRepositoryServiceIT.java
+0
-69
TitanGraphServiceIT.java
.../java/org/apache/hadoop/metadata/TitanGraphServiceIT.java
+0
-61
No files found.
webapp/src/test/java/org/apache/hadoop/metadata/GraphRepositoryServiceIT.java
deleted
100644 → 0
View file @
402e3680
package
org
.
apache
.
hadoop
.
metadata
;
import
org.apache.hadoop.metadata.service.Services
;
import
org.apache.hadoop.metadata.services.GraphBackedMetadataRepositoryService
;
import
org.apache.hadoop.metadata.services.TitanGraphService
;
import
org.json.simple.JSONValue
;
import
org.testng.Assert
;
import
org.testng.annotations.AfterClass
;
import
org.testng.annotations.BeforeClass
;
import
org.testng.annotations.Test
;
import
java.util.HashMap
;
import
java.util.Map
;
public
class
GraphRepositoryServiceIT
{
private
static
final
String
ENTITY_NAME
=
"clicks-table"
;
private
static
final
String
ENTITY_TYPE
=
"hive-table"
;
private
static
final
String
DATABASE_NAME
=
"ads"
;
private
static
final
String
TABLE_NAME
=
"clicks-table"
;
@BeforeClass
public
void
setUp
()
throws
Exception
{
TitanGraphService
titanGraphService
=
new
TitanGraphService
();
titanGraphService
.
start
();
Services
.
get
().
register
(
titanGraphService
);
GraphBackedMetadataRepositoryService
repositoryService
=
new
GraphBackedMetadataRepositoryService
();
repositoryService
.
start
();
Services
.
get
().
register
(
repositoryService
);
}
@AfterClass
public
void
tearDown
()
throws
Exception
{
Services
.
get
().
getService
(
GraphBackedMetadataRepositoryService
.
NAME
).
close
();
Services
.
get
().
getService
(
TitanGraphService
.
NAME
).
close
();
Services
.
get
().
reset
();
}
@Test
public
void
testRepository
()
throws
Exception
{
GraphBackedMetadataRepositoryService
repositoryService
=
Services
.
get
().
getService
(
GraphBackedMetadataRepositoryService
.
NAME
);
String
entityStream
=
getTestEntityJSON
();
String
guid
=
repositoryService
.
submitEntity
(
entityStream
,
ENTITY_TYPE
);
Assert
.
assertNotNull
(
guid
);
String
entity
=
repositoryService
.
getEntityDefinition
(
ENTITY_NAME
,
ENTITY_TYPE
);
@SuppressWarnings
(
"unchecked"
)
Map
<
String
,
String
>
entityProperties
=
(
Map
<
String
,
String
>)
JSONValue
.
parseWithException
(
entity
);
Assert
.
assertEquals
(
entityProperties
.
get
(
"guid"
),
guid
);
Assert
.
assertEquals
(
entityProperties
.
get
(
"entityName"
),
ENTITY_NAME
);
Assert
.
assertEquals
(
entityProperties
.
get
(
"entityType"
),
ENTITY_TYPE
);
Assert
.
assertEquals
(
entityProperties
.
get
(
"database"
),
DATABASE_NAME
);
Assert
.
assertEquals
(
entityProperties
.
get
(
"table"
),
TABLE_NAME
);
}
private
String
getTestEntityJSON
()
{
Map
<
String
,
String
>
props
=
new
HashMap
<>();
props
.
put
(
"entityName"
,
ENTITY_NAME
);
props
.
put
(
"entityType"
,
ENTITY_TYPE
);
props
.
put
(
"database"
,
DATABASE_NAME
);
props
.
put
(
"table"
,
TABLE_NAME
);
return
JSONValue
.
toJSONString
(
props
);
}
}
webapp/src/test/java/org/apache/hadoop/metadata/TitanGraphServiceIT.java
deleted
100644 → 0
View file @
402e3680
package
org
.
apache
.
hadoop
.
metadata
;
import
com.tinkerpop.blueprints.GraphQuery
;
import
com.tinkerpop.blueprints.TransactionalGraph
;
import
com.tinkerpop.blueprints.Vertex
;
import
org.apache.hadoop.metadata.services.TitanGraphService
;
import
org.apache.hadoop.metadata.util.GraphUtils
;
import
org.testng.annotations.Test
;
import
java.util.Iterator
;
import
java.util.UUID
;
/**
* End to end graph put/get test.
*/
public
class
TitanGraphServiceIT
{
@Test
public
void
testTitanGraph
()
throws
Exception
{
TitanGraphService
titanGraphService
=
new
TitanGraphService
();
titanGraphService
.
start
();
try
{
String
guid
=
UUID
.
randomUUID
().
toString
();
final
TransactionalGraph
graph
=
titanGraphService
.
getTransactionalGraph
();
System
.
out
.
println
(
"graph = "
+
graph
);
System
.
out
.
println
(
"graph.getVertices() = "
+
graph
.
getVertices
());
Vertex
entityVertex
=
null
;
try
{
graph
.
rollback
();
entityVertex
=
graph
.
addVertex
(
null
);
entityVertex
.
setProperty
(
"guid"
,
guid
);
entityVertex
.
setProperty
(
"entityName"
,
"entityName"
);
entityVertex
.
setProperty
(
"entityType"
,
"entityType"
);
}
catch
(
Exception
e
)
{
graph
.
rollback
();
e
.
printStackTrace
();
}
finally
{
graph
.
commit
();
}
System
.
out
.
println
(
"vertex = "
+
GraphUtils
.
vertexString
(
entityVertex
));
GraphQuery
query
=
graph
.
query
()
.
has
(
"entityName"
,
"entityName"
)
.
has
(
"entityType"
,
"entityType"
);
Iterator
<
Vertex
>
results
=
query
.
vertices
().
iterator
();
if
(
results
.
hasNext
())
{
Vertex
vertexFromQuery
=
results
.
next
();
System
.
out
.
println
(
"vertex = "
+
GraphUtils
.
vertexString
(
vertexFromQuery
));
}
}
finally
{
Thread
.
sleep
(
1000
);
titanGraphService
.
stop
();
}
}
}
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