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
b557b98c
Commit
b557b98c
authored
May 25, 2017
by
apoorvnaik
Committed by
Sarath Subramanian
May 25, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ATLAS-1753: Fix for sandbox graph instance for each test
Signed-off-by:
Sarath Subramanian
<
ssubramanian@hortonworks.com
>
parent
cfc3436b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
8 deletions
+35
-8
GraphSandboxUtil.java
...rc/test/java/org/apache/atlas/graph/GraphSandboxUtil.java
+16
-7
DBSandboxer.java
repository/src/test/java/org/apache/atlas/DBSandboxer.java
+19
-1
No files found.
graphdb/common/src/test/java/org/apache/atlas/graph/GraphSandboxUtil.java
View file @
b557b98c
...
...
@@ -24,29 +24,38 @@ import org.slf4j.Logger;
import
org.slf4j.LoggerFactory
;
import
java.io.File
;
import
java.util.UUID
;
public
class
GraphSandboxUtil
{
private
static
final
Logger
LOG
=
LoggerFactory
.
getLogger
(
GraphSandboxUtil
.
class
);
public
static
void
create
()
{
public
static
void
create
(
String
sandboxName
)
{
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
;
File
.
separatorChar
+
"storage"
+
File
.
separatorChar
+
sandboxName
;
configuration
.
setProperty
(
"atlas.graph.storage.directory"
,
newStorageDir
);
String
newIndexerDir
=
System
.
getProperty
(
"atlas.data"
)
+
File
.
pathSeparator
+
"index"
+
File
.
pathSeparator
+
currentMillisecs
;
File
.
separatorChar
+
"index"
+
File
.
separatorChar
+
sandboxName
;
configuration
.
setProperty
(
"atlas.graph.index.search.directory"
,
newIndexerDir
);
LOG
.
debug
(
"New Storage dir : {}"
,
newStorageDir
);
LOG
.
debug
(
"New Indexer dir : {}"
,
newIndexerDir
);
}
catch
(
AtlasException
ignored
)
{}
}
public
static
void
create
()
{
// Append a suffix to isolate the database for each instance
UUID
uuid
=
UUID
.
randomUUID
();
create
(
uuid
.
toString
());
}
}
repository/src/test/java/org/apache/atlas/DBSandboxer.java
View file @
b557b98c
...
...
@@ -19,13 +19,31 @@ package org.apache.atlas;
import
org.apache.atlas.graph.GraphSandboxUtil
;
import
org.apache.atlas.repository.graph.AtlasGraphProvider
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.testng.ITestContext
;
import
org.testng.TestListenerAdapter
;
import
org.testng.xml.XmlClass
;
import
java.util.List
;
public
class
DBSandboxer
extends
TestListenerAdapter
{
@Override
public
void
onStart
(
ITestContext
context
)
{
GraphSandboxUtil
.
create
();
// This will only work if each test is run individually (test suite has only one running test)
// If there are multiple tests the the sandbox folder name is not provided and the GraphSandboxUtil provisions
// a unique name
List
<
XmlClass
>
testClassesToRun
=
context
.
getCurrentXmlTest
().
getClasses
();
if
(
CollectionUtils
.
isNotEmpty
(
testClassesToRun
)
&&
1
==
testClassesToRun
.
size
())
{
XmlClass
currentTestClass
=
testClassesToRun
.
get
(
0
);
if
(
null
!=
currentTestClass
&&
StringUtils
.
isNotEmpty
(
currentTestClass
.
getName
()))
{
GraphSandboxUtil
.
create
(
currentTestClass
.
getName
());
}
else
{
GraphSandboxUtil
.
create
();
}
}
else
{
GraphSandboxUtil
.
create
();
}
}
@Override
...
...
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