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
935d30f7
Commit
935d30f7
authored
Jan 11, 2015
by
Dan Markwat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed json parsing issues - guid is now extracted from the JSON payload
and the test parses the GUID as expected
parent
c1af1456
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
11 deletions
+26
-11
pom.xml
webapp/pom.xml
+8
-2
EntityJerseyResourceIT.java
...hadoop/metadata/web/resources/EntityJerseyResourceIT.java
+18
-9
No files found.
webapp/pom.xml
View file @
935d30f7
...
@@ -133,6 +133,11 @@
...
@@ -133,6 +133,11 @@
<version>
3.0
</version>
<version>
3.0
</version>
</dependency>
</dependency>
<dependency>
<dependency>
<groupId>
com.google.code.gson
</groupId>
<artifactId>
gson
</artifactId>
<version>
2.3.1
</version>
</dependency>
<dependency>
<groupId>
com.sun.jersey.contribs
</groupId>
<groupId>
com.sun.jersey.contribs
</groupId>
<artifactId>
jersey-guice
</artifactId>
<artifactId>
jersey-guice
</artifactId>
<version>
1.18.3
</version>
<version>
1.18.3
</version>
...
@@ -206,15 +211,15 @@
...
@@ -206,15 +211,15 @@
<artifactId>
keytool-maven-plugin
</artifactId>
<artifactId>
keytool-maven-plugin
</artifactId>
<executions>
<executions>
<execution>
<execution>
<id>
clean
</id>
<phase>
generate-resources
</phase>
<phase>
generate-resources
</phase>
<id>
clean-server
</id>
<goals>
<goals>
<goal>
clean
</goal>
<goal>
clean
</goal>
</goals>
</goals>
</execution>
</execution>
<execution>
<execution>
<id>
genkey
</id>
<phase>
generate-resources
</phase>
<phase>
generate-resources
</phase>
<id>
server
</id>
<goals>
<goals>
<goal>
generateKeyPair
</goal>
<goal>
generateKeyPair
</goal>
</goals>
</goals>
...
@@ -251,6 +256,7 @@
...
@@ -251,6 +256,7 @@
</connector>
</connector>
</connectors>
</connectors>
<webApp>
${project.build.directory}/metadata-webapp-${project.version}
</webApp>
<webApp>
${project.build.directory}/metadata-webapp-${project.version}
</webApp>
<contextPath>
/
</contextPath>
<useTestClasspath>
true
</useTestClasspath>
<useTestClasspath>
true
</useTestClasspath>
<systemProperties>
<systemProperties>
<systemProperty>
<systemProperty>
...
...
webapp/src/test/java/org/apache/hadoop/metadata/web/resources/EntityJerseyResourceIT.java
View file @
935d30f7
...
@@ -18,18 +18,22 @@
...
@@ -18,18 +18,22 @@
package
org
.
apache
.
hadoop
.
metadata
.
web
.
resources
;
package
org
.
apache
.
hadoop
.
metadata
.
web
.
resources
;
import
com.sun.jersey.api.client.ClientResponse
;
import
java.util.HashMap
;
import
com.sun.jersey.api.client.WebResource
;
import
java.util.Map
;
import
org.json.simple.JSONValue
;
import
java.util.UUID
;
import
org.testng.Assert
;
import
org.testng.annotations.Test
;
import
javax.ws.rs.HttpMethod
;
import
javax.ws.rs.HttpMethod
;
import
javax.ws.rs.core.MediaType
;
import
javax.ws.rs.core.MediaType
;
import
javax.ws.rs.core.Response
;
import
javax.ws.rs.core.Response
;
import
java.util.HashMap
;
import
java.util.Map
;
import
org.json.simple.JSONValue
;
import
java.util.UUID
;
import
org.testng.Assert
;
import
org.testng.annotations.Test
;
import
com.google.gson.JsonElement
;
import
com.google.gson.JsonParser
;
import
com.sun.jersey.api.client.ClientResponse
;
import
com.sun.jersey.api.client.WebResource
;
/**
/**
* Integration tests for Entity Jersey Resource.
* Integration tests for Entity Jersey Resource.
...
@@ -44,6 +48,7 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
...
@@ -44,6 +48,7 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
@Test
@Test
public
void
testSubmitEntity
()
{
public
void
testSubmitEntity
()
{
String
entityStream
=
getTestEntityJSON
();
String
entityStream
=
getTestEntityJSON
();
JsonParser
parser
=
new
JsonParser
();
WebResource
resource
=
service
WebResource
resource
=
service
.
path
(
"api/metadata/entities/submit"
)
.
path
(
"api/metadata/entities/submit"
)
...
@@ -54,11 +59,15 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
...
@@ -54,11 +59,15 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
.
type
(
MediaType
.
APPLICATION_JSON
)
.
type
(
MediaType
.
APPLICATION_JSON
)
.
method
(
HttpMethod
.
POST
,
ClientResponse
.
class
,
entityStream
);
.
method
(
HttpMethod
.
POST
,
ClientResponse
.
class
,
entityStream
);
Assert
.
assertEquals
(
clientResponse
.
getStatus
(),
Response
.
Status
.
OK
.
getStatusCode
());
Assert
.
assertEquals
(
clientResponse
.
getStatus
(),
Response
.
Status
.
OK
.
getStatusCode
());
String
response
=
clientResponse
.
getEntity
(
String
.
class
);
String
response
=
clientResponse
.
getEntity
(
String
.
class
);
Assert
.
assertNotNull
(
response
);
Assert
.
assertNotNull
(
response
);
JsonElement
elem
=
parser
.
parse
(
response
);
String
guid
=
elem
.
getAsJsonObject
().
get
(
"GUID"
).
getAsString
();
try
{
try
{
Assert
.
assertNotNull
(
UUID
.
fromString
(
response
));
Assert
.
assertNotNull
(
UUID
.
fromString
(
guid
));
}
catch
(
IllegalArgumentException
e
)
{
}
catch
(
IllegalArgumentException
e
)
{
Assert
.
fail
(
"Response is not a guid, "
+
response
);
Assert
.
fail
(
"Response is not a guid, "
+
response
);
}
}
...
...
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