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
01224ddd
Commit
01224ddd
authored
Jun 08, 2015
by
Shwetha GS
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
BUG-37449 create a type return can be improved to return better json
parent
e24e0265
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
1 deletion
+23
-1
DataTypes.java
...rg/apache/hadoop/metadata/typesystem/types/DataTypes.java
+2
-1
EntityJerseyResourceIT.java
...hadoop/metadata/web/resources/EntityJerseyResourceIT.java
+21
-0
No files found.
typesystem/src/main/java/org/apache/hadoop/metadata/typesystem/types/DataTypes.java
View file @
01224ddd
...
...
@@ -22,6 +22,7 @@ import com.google.common.collect.ImmutableCollection;
import
com.google.common.collect.ImmutableList
;
import
com.google.common.collect.ImmutableMap
;
import
com.google.common.collect.ImmutableSet
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.hadoop.metadata.MetadataException
;
import
org.apache.hadoop.metadata.typesystem.IReferenceableInstance
;
import
org.apache.hadoop.metadata.typesystem.persistence.Id
;
...
...
@@ -455,7 +456,7 @@ public class DataTypes {
@Override
public
String
convert
(
Object
val
,
Multiplicity
m
)
throws
MetadataException
{
if
(
val
!=
null
)
{
if
(
StringUtils
.
isNotBlank
((
CharSequence
)
val
)
)
{
return
val
.
toString
();
}
return
convertNull
(
m
);
...
...
webapp/src/test/java/org/apache/hadoop/metadata/web/resources/EntityJerseyResourceIT.java
View file @
01224ddd
...
...
@@ -51,6 +51,7 @@ import org.slf4j.Logger;
import
org.slf4j.LoggerFactory
;
import
org.testng.Assert
;
import
org.testng.annotations.BeforeClass
;
import
org.testng.annotations.DataProvider
;
import
org.testng.annotations.Test
;
import
javax.ws.rs.HttpMethod
;
...
...
@@ -95,6 +96,26 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
}
}
@DataProvider
public
Object
[][]
invalidAttrValues
()
{
return
new
Object
[][]{
{
null
},
{
""
},
{
" "
}};
}
@Test
(
dataProvider
=
"invalidAttrValues"
)
public
void
testEntityInvalidValue
(
String
value
)
throws
Exception
{
Referenceable
databaseInstance
=
new
Referenceable
(
DATABASE_TYPE
);
databaseInstance
.
set
(
"name"
,
randomString
());
databaseInstance
.
set
(
"description"
,
value
);
try
{
createInstance
(
databaseInstance
);
Assert
.
fail
(
"Exptected MetadataServiceException"
);
}
catch
(
MetadataServiceException
e
)
{
Assert
.
assertEquals
(
e
.
getStatus
(),
ClientResponse
.
Status
.
BAD_REQUEST
);
}
}
@Test
public
void
testSubmitEntityWithBadDateFormat
()
throws
Exception
{
...
...
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