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
b0d8bb90
Commit
b0d8bb90
authored
Jan 23, 2015
by
Ballistar13
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
https://github.com/hortonworks/metadata.git
parents
55febc44
9ec7ad37
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
38 additions
and
51 deletions
+38
-51
GuiceEnabledTestBase.java
...java/org/apache/hadoop/metadata/GuiceEnabledTestBase.java
+0
-23
RepositoryModuleBaseTest.java
.../org/apache/hadoop/metadata/RepositoryModuleBaseTest.java
+0
-7
RepositoryServiceLoadingTest.java
.../apache/hadoop/metadata/RepositoryServiceLoadingTest.java
+10
-8
GraphBackedMetadataRepositoryTest.java
.../metadata/services/GraphBackedMetadataRepositoryTest.java
+20
-8
TitanGraphServiceTest.java
...pache/hadoop/metadata/services/TitanGraphServiceTest.java
+8
-5
No files found.
repository/src/test/java/org/apache/hadoop/metadata/GuiceEnabledTestBase.java
deleted
100644 → 0
View file @
55febc44
package
org
.
apache
.
hadoop
.
metadata
;
import
com.google.inject.Guice
;
import
com.google.inject.Injector
;
import
com.google.inject.Module
;
public
abstract
class
GuiceEnabledTestBase
{
/*
* Guice.createInjector() takes your Modules, and returns a new Injector
* instance. Most applications will call this method exactly once, in their
* main() method.
*/
public
final
Injector
injector
;
GuiceEnabledTestBase
()
{
injector
=
Guice
.
createInjector
();
}
GuiceEnabledTestBase
(
Module
...
modules
)
{
injector
=
Guice
.
createInjector
(
modules
);
}
}
repository/src/test/java/org/apache/hadoop/metadata/RepositoryModuleBaseTest.java
deleted
100644 → 0
View file @
55febc44
package
org
.
apache
.
hadoop
.
metadata
;
public
abstract
class
RepositoryModuleBaseTest
extends
GuiceEnabledTestBase
{
public
RepositoryModuleBaseTest
()
{
super
(
new
RepositoryMetadataModule
());
}
}
repository/src/test/java/org/apache/hadoop/metadata/RepositoryServiceLoadingTest.java
View file @
b0d8bb90
package
org
.
apache
.
hadoop
.
metadata
;
package
org
.
apache
.
hadoop
.
metadata
;
import
javax.inject.Inject
;
import
junit.framework.Assert
;
import
junit.framework.Assert
;
import
org.apache.hadoop.metadata.repository.graph.GraphService
;
import
org.apache.hadoop.metadata.repository.graph.GraphService
;
import
org.testng.annotations.AfterClass
;
import
org.testng.annotations.AfterClass
;
import
org.testng.annotations.BeforeClass
;
import
org.testng.annotations.BeforeClass
;
import
org.testng.annotations.Guice
;
import
org.testng.annotations.Test
;
import
org.testng.annotations.Test
;
/**
/**
* Unit test for Guice injector service loading
* Unit test for Guice injector service loading
*
* Uses TestNG's Guice annotation to load the necessary modules and inject the
* objects from Guice
*/
*/
public
class
RepositoryServiceLoadingTest
extends
GuiceEnabledTestBase
{
@Guice
(
modules
=
RepositoryMetadataModule
.
class
)
public
class
RepositoryServiceLoadingTest
{
public
RepositoryServiceLoadingTest
()
{
@Inject
super
(
new
RepositoryMetadataModule
());
GraphService
gs
;
}
@BeforeClass
@BeforeClass
public
void
setUp
()
throws
Exception
{
public
void
setUp
()
throws
Exception
{
...
@@ -26,10 +32,6 @@ public class RepositoryServiceLoadingTest extends GuiceEnabledTestBase {
...
@@ -26,10 +32,6 @@ public class RepositoryServiceLoadingTest extends GuiceEnabledTestBase {
@Test
@Test
public
void
testGetGraphService
()
throws
Exception
{
public
void
testGetGraphService
()
throws
Exception
{
/*
* Now that we've got the injector, we can build objects.
*/
GraphService
gs
=
injector
.
getInstance
(
GraphService
.
class
);
Assert
.
assertNotNull
(
gs
);
Assert
.
assertNotNull
(
gs
);
}
}
}
}
repository/src/test/java/org/apache/hadoop/metadata/services/GraphBackedMetadataRepositoryTest.java
View file @
b0d8bb90
...
@@ -2,11 +2,14 @@ package org.apache.hadoop.metadata.services;
...
@@ -2,11 +2,14 @@ package org.apache.hadoop.metadata.services;
import
java.util.List
;
import
java.util.List
;
import
javax.inject.Inject
;
import
org.apache.hadoop.metadata.ITypedReferenceableInstance
;
import
org.apache.hadoop.metadata.ITypedReferenceableInstance
;
import
org.apache.hadoop.metadata.MetadataException
;
import
org.apache.hadoop.metadata.MetadataException
;
import
org.apache.hadoop.metadata.Referenceable
;
import
org.apache.hadoop.metadata.Referenceable
;
import
org.apache.hadoop.metadata.RepositoryM
oduleBaseTest
;
import
org.apache.hadoop.metadata.RepositoryM
etadataModule
;
import
org.apache.hadoop.metadata.repository.graph.GraphBackedMetadataRepository
;
import
org.apache.hadoop.metadata.repository.graph.GraphBackedMetadataRepository
;
import
org.apache.hadoop.metadata.repository.graph.GraphUtils
;
import
org.apache.hadoop.metadata.repository.graph.TitanGraphService
;
import
org.apache.hadoop.metadata.repository.graph.TitanGraphService
;
import
org.apache.hadoop.metadata.storage.IRepository
;
import
org.apache.hadoop.metadata.storage.IRepository
;
import
org.apache.hadoop.metadata.storage.memory.MemRepository
;
import
org.apache.hadoop.metadata.storage.memory.MemRepository
;
...
@@ -20,10 +23,10 @@ import org.apache.hadoop.metadata.types.Multiplicity;
...
@@ -20,10 +23,10 @@ import org.apache.hadoop.metadata.types.Multiplicity;
import
org.apache.hadoop.metadata.types.StructTypeDefinition
;
import
org.apache.hadoop.metadata.types.StructTypeDefinition
;
import
org.apache.hadoop.metadata.types.TraitType
;
import
org.apache.hadoop.metadata.types.TraitType
;
import
org.apache.hadoop.metadata.types.TypeSystem
;
import
org.apache.hadoop.metadata.types.TypeSystem
;
import
org.apache.hadoop.metadata.repository.graph.GraphUtils
;
import
org.testng.Assert
;
import
org.testng.Assert
;
import
org.testng.annotations.AfterClass
;
import
org.testng.annotations.AfterClass
;
import
org.testng.annotations.BeforeClass
;
import
org.testng.annotations.BeforeClass
;
import
org.testng.annotations.Guice
;
import
org.testng.annotations.Test
;
import
org.testng.annotations.Test
;
import
com.google.common.collect.ImmutableList
;
import
com.google.common.collect.ImmutableList
;
...
@@ -32,23 +35,32 @@ import com.tinkerpop.blueprints.Direction;
...
@@ -32,23 +35,32 @@ import com.tinkerpop.blueprints.Direction;
import
com.tinkerpop.blueprints.Edge
;
import
com.tinkerpop.blueprints.Edge
;
import
com.tinkerpop.blueprints.Vertex
;
import
com.tinkerpop.blueprints.Vertex
;
/**
* GraphBackedMetadataRepository test
*
* Guice loads the dependencies and injects the necessary objects
*
*/
@Test
(
enabled
=
false
)
@Test
(
enabled
=
false
)
public
class
GraphBackedMetadataRepositoryTest
extends
RepositoryModuleBaseTest
{
@Guice
(
modules
=
RepositoryMetadataModule
.
class
)
public
class
GraphBackedMetadataRepositoryTest
{
private
static
final
String
ENTITY_TYPE
=
"hive-table"
;
private
static
final
String
ENTITY_TYPE
=
"hive-table"
;
private
TitanGraphService
titanGraphService
;
@Inject
private
GraphBackedMetadataRepository
repositoryService
;
TitanGraphService
titanGraphService
;
@Inject
GraphBackedMetadataRepository
repositoryService
;
private
IRepository
repo
;
private
IRepository
repo
;
private
TypeSystem
ts
;
private
TypeSystem
ts
;
private
String
guid
;
private
String
guid
;
@BeforeClass
@BeforeClass
public
void
setUp
()
throws
Exception
{
public
void
setUp
()
throws
Exception
{
titanGraphService
=
super
.
injector
.
getInstance
(
TitanGraphService
.
class
);
// start the injected graph service
titanGraphService
.
start
();
titanGraphService
.
start
();
// start the injected repository service
repositoryService
=
super
.
injector
.
getInstance
(
GraphBackedMetadataRepository
.
class
);
repositoryService
.
start
();
repositoryService
.
start
();
ts
=
TypeSystem
.
getInstance
();
ts
=
TypeSystem
.
getInstance
();
...
...
repository/src/test/java/org/apache/hadoop/metadata/services/TitanGraphServiceTest.java
View file @
b0d8bb90
package
org
.
apache
.
hadoop
.
metadata
.
services
;
package
org
.
apache
.
hadoop
.
metadata
.
services
;
import
org.apache.hadoop.metadata.RepositoryModuleBaseTest
;
import
javax.inject.Inject
;
import
org.apache.hadoop.metadata.RepositoryMetadataModule
;
import
org.apache.hadoop.metadata.repository.graph.TitanGraphService
;
import
org.apache.hadoop.metadata.repository.graph.TitanGraphService
;
import
org.testng.Assert
;
import
org.testng.Assert
;
import
org.testng.annotations.AfterClass
;
import
org.testng.annotations.AfterClass
;
import
org.testng.annotations.BeforeClass
;
import
org.testng.annotations.BeforeClass
;
import
org.testng.annotations.Guice
;
import
org.testng.annotations.Test
;
import
org.testng.annotations.Test
;
/**
/**
* Unit test for TitanGraphService.
* Unit test for TitanGraphService.
*/
*/
public
class
TitanGraphServiceTest
extends
RepositoryModuleBaseTest
{
@Guice
(
modules
=
RepositoryMetadataModule
.
class
)
public
class
TitanGraphServiceTest
{
private
TitanGraphService
titanGraphService
;
@Inject
TitanGraphService
titanGraphService
;
@BeforeClass
@BeforeClass
public
void
setUp
()
throws
Exception
{
public
void
setUp
()
throws
Exception
{
titanGraphService
=
super
.
injector
.
getInstance
(
TitanGraphService
.
class
);
//titanGraphService = new TitanGraphService();
titanGraphService
.
start
();
titanGraphService
.
start
();
}
}
...
...
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