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
4b2a4cae
Commit
4b2a4cae
authored
May 04, 2015
by
Shwetha GS
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed test failures - GraphBackedMetadataRepositoryTest#testFullTextSearch, DSLTest.test1
parent
8e73ed24
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
44 additions
and
55 deletions
+44
-55
GraphBackedMetadataRepository.java
...adata/repository/graph/GraphBackedMetadataRepository.java
+33
-38
GraphHelper.java
.../apache/hadoop/metadata/repository/graph/GraphHelper.java
+1
-1
GraphBackedMetadataRepositoryTest.java
...a/repository/graph/GraphBackedMetadataRepositoryTest.java
+4
-10
package.scala
.../scala/org/apache/hadoop/metadata/tools/dsl/package.scala
+1
-1
DSLTest.scala
.../scala/org/apache/hadoop/metadata/tools/dsl/DSLTest.scala
+1
-1
TypeSystem.java
...g/apache/hadoop/metadata/typesystem/types/TypeSystem.java
+4
-4
No files found.
repository/src/main/java/org/apache/hadoop/metadata/repository/graph/GraphBackedMetadataRepository.java
View file @
4b2a4cae
This diff is collapsed.
Click to expand it.
repository/src/main/java/org/apache/hadoop/metadata/repository/graph/GraphHelper.java
View file @
4b2a4cae
...
@@ -85,7 +85,7 @@ public final class GraphHelper {
...
@@ -85,7 +85,7 @@ public final class GraphHelper {
public
static
Edge
addEdge
(
TitanGraph
titanGraph
,
Vertex
fromVertex
,
Vertex
toVertex
,
public
static
Edge
addEdge
(
TitanGraph
titanGraph
,
Vertex
fromVertex
,
Vertex
toVertex
,
String
edgeLabel
)
{
String
edgeLabel
)
{
LOG
.
debug
(
"Adding edge for {} ->
struct label {} -> v
{}"
,
LOG
.
debug
(
"Adding edge for {} ->
label {} ->
{}"
,
fromVertex
,
edgeLabel
,
toVertex
);
fromVertex
,
edgeLabel
,
toVertex
);
return
titanGraph
.
addEdge
(
null
,
fromVertex
,
toVertex
,
edgeLabel
);
return
titanGraph
.
addEdge
(
null
,
fromVertex
,
toVertex
,
edgeLabel
);
...
...
repository/src/test/java/org/apache/hadoop/metadata/repository/graph/GraphBackedMetadataRepositoryTest.java
View file @
4b2a4cae
...
@@ -334,11 +334,6 @@ public class GraphBackedMetadataRepositoryTest {
...
@@ -334,11 +334,6 @@ public class GraphBackedMetadataRepositoryTest {
String
response
=
discoveryService
.
searchByFullText
(
"john"
);
String
response
=
discoveryService
.
searchByFullText
(
"john"
);
Assert
.
assertNotNull
(
response
);
Assert
.
assertNotNull
(
response
);
JSONArray
results
=
new
JSONArray
(
response
);
JSONArray
results
=
new
JSONArray
(
response
);
System
.
out
.
println
(
"Found the following results"
);
for
(
int
i
=
0
;
i
<
results
.
length
();
i
++)
{
JSONObject
myrow
=
results
.
getJSONObject
(
i
);
System
.
out
.
println
(
myrow
.
toString
());
}
Assert
.
assertEquals
(
results
.
length
(),
1
);
Assert
.
assertEquals
(
results
.
length
(),
1
);
JSONObject
row
=
(
JSONObject
)
results
.
get
(
0
);
JSONObject
row
=
(
JSONObject
)
results
.
get
(
0
);
Assert
.
assertEquals
(
row
.
get
(
"typeName"
),
"Person"
);
Assert
.
assertEquals
(
row
.
get
(
"typeName"
),
"Person"
);
...
@@ -346,11 +341,10 @@ public class GraphBackedMetadataRepositoryTest {
...
@@ -346,11 +341,10 @@ public class GraphBackedMetadataRepositoryTest {
//person in hr department who lives in santa clara
//person in hr department who lives in santa clara
response
=
discoveryService
.
searchByFullText
(
"Jane AND santa AND clara"
);
response
=
discoveryService
.
searchByFullText
(
"Jane AND santa AND clara"
);
Assert
.
assertNotNull
(
response
);
Assert
.
assertNotNull
(
response
);
// todo: enable this - temporarily commented this as its failing
results
=
new
JSONArray
(
response
);
// results = new JSONArray(response);
Assert
.
assertEquals
(
results
.
length
(),
1
);
// Assert.assertEquals(results.length(), 1);
row
=
(
JSONObject
)
results
.
get
(
0
);
// row = (JSONObject) results.get(0);
Assert
.
assertEquals
(
row
.
get
(
"typeName"
),
"Manager"
);
// Assert.assertEquals(row.get("typeName"), "Manager");
//search for person in hr department whose name starts is john/jahn
//search for person in hr department whose name starts is john/jahn
response
=
discoveryService
.
searchByFullText
(
"hr AND (john OR jahn)"
);
response
=
discoveryService
.
searchByFullText
(
"hr AND (john OR jahn)"
);
...
...
tools/src/main/scala/org/apache/hadoop/metadata/tools/dsl/package.scala
View file @
4b2a4cae
...
@@ -36,7 +36,7 @@ import scala.collection.JavaConversions._
...
@@ -36,7 +36,7 @@ import scala.collection.JavaConversions._
package
object
dsl
{
package
object
dsl
{
val
defFormat
=
new
DefaultFormats
{
val
defFormat
=
new
DefaultFormats
{
override
protected
def
dateFormatter
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
)
override
protected
def
dateFormatter
=
TypeSystem
.
getInstance
().
getDateFormat
;
override
val
typeHints
=
NoTypeHints
override
val
typeHints
=
NoTypeHints
}
}
...
...
tools/src/test/scala/org/apache/hadoop/metadata/tools/dsl/DSLTest.scala
View file @
4b2a4cae
...
@@ -120,7 +120,7 @@ class DSLTest {
...
@@ -120,7 +120,7 @@ class DSLTest {
Assert
.
assertEquals
(
s
"${i.o.asInstanceOf[java.util.Map[_, _]].keySet}"
,
"[b, a]"
)
Assert
.
assertEquals
(
s
"${i.o.asInstanceOf[java.util.Map[_, _]].keySet}"
,
"[b, a]"
)
// 5. Serialize mytype instance to Json
// 5. Serialize mytype instance to Json
Assert
.
assertEquals
(
s
"${pretty(render(i))}"
,
"{\n \"$typeName$\":\"mytype\",\n \"e\":1,"
+
"\n \"n\":[1,1.100000000000000088817841970012523233890533447265625],\n \"h\":1.0,\n \"b\":true,\n \"k\":1,\n \"j\":1,\n \"d\":2,\n \"m\":[1,1],\n \"g\":1,\n \"a\":1,\n \"i\":1.0,\n \"c\":1,\n \"l\":\"2014-12-0
2
\",\n \"f\":1,\n \"o\":{\n \"b\":2.0,\n \"a\":1.0\n }\n}"
)
Assert
.
assertEquals
(
s
"${pretty(render(i))}"
,
"{\n \"$typeName$\":\"mytype\",\n \"e\":1,"
+
"\n \"n\":[1,1.100000000000000088817841970012523233890533447265625],\n \"h\":1.0,\n \"b\":true,\n \"k\":1,\n \"j\":1,\n \"d\":2,\n \"m\":[1,1],\n \"g\":1,\n \"a\":1,\n \"i\":1.0,\n \"c\":1,\n \"l\":\"2014-12-0
3
\",\n \"f\":1,\n \"o\":{\n \"b\":2.0,\n \"a\":1.0\n }\n}"
)
}
}
@Test
def
test2
{
@Test
def
test2
{
...
...
typesystem/src/main/java/org/apache/hadoop/metadata/typesystem/types/TypeSystem.java
View file @
4b2a4cae
...
@@ -42,10 +42,10 @@ import java.util.concurrent.ConcurrentHashMap;
...
@@ -42,10 +42,10 @@ import java.util.concurrent.ConcurrentHashMap;
@InterfaceAudience
.
Private
@InterfaceAudience
.
Private
public
class
TypeSystem
{
public
class
TypeSystem
{
private
static
final
TypeSystem
INSTANCE
=
new
TypeSystem
();
private
static
final
TypeSystem
INSTANCE
=
new
TypeSystem
();
p
ublic
static
ThreadLocal
<
DateFormat
>
dateFormat
=
new
ThreadLocal
()
{
p
rivate
static
ThreadLocal
<
Simple
DateFormat
>
dateFormat
=
new
ThreadLocal
()
{
@Override
@Override
public
DateFormat
initialValue
()
{
public
Simple
DateFormat
initialValue
()
{
DateFormat
dateFormat
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
Simple
DateFormat
dateFormat
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
dateFormat
.
setTimeZone
(
TimeZone
.
getTimeZone
(
"UTC"
));
dateFormat
.
setTimeZone
(
TimeZone
.
getTimeZone
(
"UTC"
));
return
dateFormat
;
return
dateFormat
;
}
}
...
@@ -294,7 +294,7 @@ public class TypeSystem {
...
@@ -294,7 +294,7 @@ public class TypeSystem {
return
eT
;
return
eT
;
}
}
public
DateFormat
getDateFormat
()
{
public
Simple
DateFormat
getDateFormat
()
{
return
dateFormat
.
get
();
return
dateFormat
.
get
();
}
}
...
...
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