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
7fb09b0f
Commit
7fb09b0f
authored
7 years ago
by
Madhan Neethiraj
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ATLAS-1981: fix for unit test failures
parent
de251913
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
10 deletions
+19
-10
AtlasStructType.java
.../src/main/java/org/apache/atlas/type/AtlasStructType.java
+13
-4
EntityDiscoveryServiceTest.java
...org/apache/atlas/services/EntityDiscoveryServiceTest.java
+6
-6
No files found.
intg/src/main/java/org/apache/atlas/type/AtlasStructType.java
View file @
7fb09b0f
...
...
@@ -34,11 +34,12 @@ import org.apache.commons.lang.StringUtils;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
java.util.Collection
;
import
java.util.Collections
;
import
java.util.HashMap
;
import
java.util.Iterator
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Set
;
/**
* class that implements behaviour of a struct-type.
...
...
@@ -714,13 +715,21 @@ public class AtlasStructType extends AtlasType {
return
key
;
}
public
static
String
escapeIndexQueryValue
(
Set
<
String
>
values
)
{
public
static
String
escapeIndexQueryValue
(
Collection
<
String
>
values
)
{
StringBuilder
sb
=
new
StringBuilder
();
sb
.
append
(
BRACE_OPEN_CHAR
);
for
(
String
value
:
values
)
{
sb
.
append
(
escapeIndexQueryValue
(
value
)).
append
(
SPACE_CHAR
);
if
(
CollectionUtils
.
isNotEmpty
(
values
))
{
Iterator
<
String
>
iter
=
values
.
iterator
();
sb
.
append
(
escapeIndexQueryValue
(
iter
.
next
()));
while
(
iter
.
hasNext
())
{
sb
.
append
(
SPACE_CHAR
).
append
(
escapeIndexQueryValue
(
iter
.
next
()));
}
}
sb
.
append
(
BRACE_CLOSE_CHAR
);
return
sb
.
toString
();
...
...
This diff is collapsed.
Click to expand it.
repository/src/test/java/org/apache/atlas/services/EntityDiscoveryServiceTest.java
View file @
7fb09b0f
...
...
@@ -50,7 +50,7 @@ public class EntityDiscoveryServiceTest {
AtlasEntityDef
typeTest3
=
null
;
AtlasEntityDef
typeWithSubTypes
=
null
;
private
final
int
maxTypes
CountInIdxQuery
=
10
;
private
final
int
maxTypes
StrLengthInIdxQuery
=
55
;
@Inject
EntityDiscoveryService
discoveryService
;
...
...
@@ -81,17 +81,17 @@ public class EntityDiscoveryServiceTest {
@Test
public
void
getSubTypesForType_NullStringReturnsEmptyString
()
throws
Exception
{
invokeGetSubTypesForType
(
null
,
maxTypes
Count
InIdxQuery
);
invokeGetSubTypesForType
(
null
,
maxTypes
StrLength
InIdxQuery
);
}
@Test
public
void
getSubTypesForType_BlankStringReturnsEmptyString
()
throws
Exception
{
invokeGetSubTypesForType
(
" "
,
maxTypes
Count
InIdxQuery
);
invokeGetSubTypesForType
(
" "
,
maxTypes
StrLength
InIdxQuery
);
}
@Test
public
void
getSubTypesForType_EmptyStringReturnsEmptyString
()
throws
Exception
{
invokeGetSubTypesForType
(
""
,
maxTypes
Count
InIdxQuery
);
invokeGetSubTypesForType
(
""
,
maxTypes
StrLength
InIdxQuery
);
}
@Test
...
...
@@ -103,7 +103,7 @@ public class EntityDiscoveryServiceTest {
@Test
public
void
getSubTypeForTypeWithSubTypes_ReturnsOrClause
()
throws
Exception
{
String
s
=
invokeGetSubTypesForType
(
TEST_TYPE_WITH_SUB_TYPES
,
maxTypes
Count
InIdxQuery
);
String
s
=
invokeGetSubTypesForType
(
TEST_TYPE_WITH_SUB_TYPES
,
maxTypes
StrLength
InIdxQuery
);
assertTrue
(
s
.
startsWith
(
"("
));
assertTrue
(
s
.
contains
(
TEST_TYPE_WITH_SUB_TYPES
));
...
...
@@ -115,7 +115,7 @@ public class EntityDiscoveryServiceTest {
@Test
public
void
getSubTypeForTypeWithSubTypes_ReturnsEmptyString
()
throws
Exception
{
String
s
=
invokeGetSubTypesForType
(
TEST_TYPE_WITH_SUB_TYPES
,
2
);
String
s
=
invokeGetSubTypesForType
(
TEST_TYPE_WITH_SUB_TYPES
,
2
0
);
assertTrue
(
StringUtils
.
isBlank
(
s
));
}
...
...
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