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
3943a640
Commit
3943a640
authored
Jun 05, 2015
by
Venkatesh Seetharam
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
BUG-38897 return consistent content type header for all calls
parent
666d92e9
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
90 additions
and
81 deletions
+90
-81
MetadataServiceClient.java
...ava/org/apache/hadoop/metadata/MetadataServiceClient.java
+8
-6
AdminResource.java
...g/apache/hadoop/metadata/web/resources/AdminResource.java
+1
-1
Servlets.java
...in/java/org/apache/hadoop/metadata/web/util/Servlets.java
+2
-4
AdminJerseyResourceIT.java
.../hadoop/metadata/web/resources/AdminJerseyResourceIT.java
+3
-3
BaseResourceIT.java
.../apache/hadoop/metadata/web/resources/BaseResourceIT.java
+3
-3
EntityJerseyResourceIT.java
...hadoop/metadata/web/resources/EntityJerseyResourceIT.java
+37
-28
HiveLineageJerseyResourceIT.java
...p/metadata/web/resources/HiveLineageJerseyResourceIT.java
+11
-11
MetadataDiscoveryJerseyResourceIT.java
...data/web/resources/MetadataDiscoveryJerseyResourceIT.java
+9
-9
RexsterGraphJerseyResourceIT.java
.../metadata/web/resources/RexsterGraphJerseyResourceIT.java
+5
-5
TypesJerseyResourceIT.java
.../hadoop/metadata/web/resources/TypesJerseyResourceIT.java
+11
-11
No files found.
client/src/main/java/org/apache/hadoop/metadata/MetadataServiceClient.java
View file @
3943a640
...
...
@@ -75,6 +75,8 @@ public class MetadataServiceClient {
public
static
final
String
DATA_SET_SUPER_TYPE
=
"DataSet"
;
public
static
final
String
PROCESS_SUPER_TYPE
=
"Process"
;
public
static
final
String
JSON_MEDIA_TYPE
=
MediaType
.
APPLICATION_JSON
+
"; charset=UTF-8"
;
private
WebResource
service
;
public
MetadataServiceClient
(
String
baseUrl
)
{
...
...
@@ -213,9 +215,9 @@ public class MetadataServiceClient {
/**
* Updates property for the entity corresponding to guid
* @param guid
* @param property
* @param value
* @param guid
guid
* @param property
property key
* @param value
property value
*/
public
JSONObject
updateEntity
(
String
guid
,
String
property
,
String
value
)
throws
MetadataServiceException
{
WebResource
resource
=
getResource
(
API
.
UPDATE_ENTITY
,
guid
);
...
...
@@ -314,11 +316,11 @@ public class MetadataServiceClient {
private
JSONObject
callAPIWithResource
(
API
api
,
WebResource
resource
,
Object
requestObject
)
throws
MetadataServiceException
{
ClientResponse
clientResponse
=
resource
.
accept
(
MediaType
.
APPLICATION_JSON
)
.
type
(
MediaType
.
APPLICATION_JSON
)
.
accept
(
JSON_MEDIA_TYPE
)
.
type
(
JSON_MEDIA_TYPE
)
.
method
(
api
.
getMethod
(),
ClientResponse
.
class
,
requestObject
);
Response
.
Status
expectedStatus
=
(
api
.
getMethod
()
==
HttpMethod
.
POST
)
Response
.
Status
expectedStatus
=
HttpMethod
.
POST
.
equals
(
api
.
getMethod
()
)
?
Response
.
Status
.
CREATED
:
Response
.
Status
.
OK
;
if
(
clientResponse
.
getStatus
()
==
expectedStatus
.
getStatusCode
())
{
String
responseAsString
=
clientResponse
.
getEntity
(
String
.
class
);
...
...
webapp/src/main/java/org/apache/hadoop/metadata/web/resources/AdminResource.java
View file @
3943a640
...
...
@@ -76,7 +76,7 @@ public class AdminResource {
*/
@GET
@Path
(
"version"
)
@Produces
(
MediaType
.
APPLICATION_JSON
)
@Produces
(
Servlets
.
JSON_MEDIA_TYPE
)
public
Response
getVersion
()
{
if
(
version
==
null
)
{
try
{
...
...
webapp/src/main/java/org/apache/hadoop/metadata/web/util/Servlets.java
View file @
3943a640
...
...
@@ -18,7 +18,6 @@
package
org
.
apache
.
hadoop
.
metadata
.
web
.
util
;
import
com.google.common.base.Preconditions
;
import
org.apache.commons.io.IOUtils
;
import
org.apache.commons.lang3.StringEscapeUtils
;
import
org.apache.commons.lang3.StringUtils
;
...
...
@@ -41,14 +40,13 @@ import java.io.StringWriter;
*/
public
final
class
Servlets
{
public
static
final
String
QUOTE
=
"\""
;
private
static
final
Logger
LOG
=
LoggerFactory
.
getLogger
(
Servlets
.
class
);
private
Servlets
()
{
/* singleton */
}
public
static
final
String
JSON_MEDIA_TYPE
=
MediaType
.
APPLICATION_JSON
+
"; charset=UTF-8"
;
/**
* Returns the user of the given request.
*
...
...
@@ -133,7 +131,7 @@ public final class Servlets {
return
Response
.
status
(
status
)
.
entity
(
errorEntity
)
.
type
(
MediaType
.
APPLICATION_JSON
)
.
type
(
JSON_MEDIA_TYPE
)
.
build
();
}
...
...
webapp/src/test/java/org/apache/hadoop/metadata/web/resources/AdminJerseyResourceIT.java
View file @
3943a640
...
...
@@ -21,13 +21,13 @@ package org.apache.hadoop.metadata.web.resources;
import
com.sun.jersey.api.client.ClientResponse
;
import
com.sun.jersey.api.client.WebResource
;
import
org.apache.commons.configuration.PropertiesConfiguration
;
import
org.apache.hadoop.metadata.web.util.Servlets
;
import
org.codehaus.jettison.json.JSONObject
;
import
org.testng.Assert
;
import
org.testng.annotations.BeforeClass
;
import
org.testng.annotations.Test
;
import
javax.ws.rs.HttpMethod
;
import
javax.ws.rs.core.MediaType
;
import
javax.ws.rs.core.Response
;
/**
...
...
@@ -46,8 +46,8 @@ public class AdminJerseyResourceIT extends BaseResourceIT {
.
path
(
"api/metadata/admin/version"
);
ClientResponse
clientResponse
=
resource
.
accept
(
MediaType
.
APPLICATION_JSON
)
.
type
(
MediaType
.
APPLICATION_JSON
)
.
accept
(
Servlets
.
JSON_MEDIA_TYPE
)
.
type
(
Servlets
.
JSON_MEDIA_TYPE
)
.
method
(
HttpMethod
.
GET
,
ClientResponse
.
class
);
Assert
.
assertEquals
(
clientResponse
.
getStatus
(),
Response
.
Status
.
OK
.
getStatusCode
());
...
...
webapp/src/test/java/org/apache/hadoop/metadata/web/resources/BaseResourceIT.java
View file @
3943a640
...
...
@@ -30,12 +30,12 @@ import org.apache.hadoop.metadata.typesystem.json.TypesSerialization;
import
org.apache.hadoop.metadata.typesystem.persistence.Id
;
import
org.apache.hadoop.metadata.typesystem.types.ClassType
;
import
org.apache.hadoop.metadata.typesystem.types.HierarchicalTypeDefinition
;
import
org.apache.hadoop.metadata.web.util.Servlets
;
import
org.codehaus.jettison.json.JSONObject
;
import
org.testng.Assert
;
import
org.testng.annotations.BeforeClass
;
import
javax.ws.rs.HttpMethod
;
import
javax.ws.rs.core.MediaType
;
import
javax.ws.rs.core.Response
;
import
javax.ws.rs.core.UriBuilder
;
...
...
@@ -73,8 +73,8 @@ public abstract class BaseResourceIT {
.
path
(
"api/metadata/types"
);
ClientResponse
clientResponse
=
resource
.
accept
(
MediaType
.
APPLICATION_JSON
)
.
type
(
MediaType
.
APPLICATION_JSON
)
.
accept
(
Servlets
.
JSON_MEDIA_TYPE
)
.
type
(
Servlets
.
JSON_MEDIA_TYPE
)
.
method
(
HttpMethod
.
POST
,
ClientResponse
.
class
,
typesAsJSON
);
Assert
.
assertEquals
(
clientResponse
.
getStatus
(),
Response
.
Status
.
CREATED
.
getStatusCode
());
...
...
webapp/src/test/java/org/apache/hadoop/metadata/web/resources/EntityJerseyResourceIT.java
View file @
3943a640
...
...
@@ -33,8 +33,18 @@ import org.apache.hadoop.metadata.typesystem.json.InstanceSerialization$;
import
org.apache.hadoop.metadata.typesystem.json.TypesSerialization
;
import
org.apache.hadoop.metadata.typesystem.json.TypesSerialization
$
;
import
org.apache.hadoop.metadata.typesystem.persistence.Id
;
import
org.apache.hadoop.metadata.typesystem.types.*
;
import
org.apache.hadoop.metadata.typesystem.types.AttributeDefinition
;
import
org.apache.hadoop.metadata.typesystem.types.ClassType
;
import
org.apache.hadoop.metadata.typesystem.types.DataTypes
;
import
org.apache.hadoop.metadata.typesystem.types.EnumTypeDefinition
;
import
org.apache.hadoop.metadata.typesystem.types.EnumValue
;
import
org.apache.hadoop.metadata.typesystem.types.HierarchicalTypeDefinition
;
import
org.apache.hadoop.metadata.typesystem.types.Multiplicity
;
import
org.apache.hadoop.metadata.typesystem.types.StructTypeDefinition
;
import
org.apache.hadoop.metadata.typesystem.types.TraitType
;
import
org.apache.hadoop.metadata.typesystem.types.TypeUtils
;
import
org.apache.hadoop.metadata.typesystem.types.utils.TypesUtil
;
import
org.apache.hadoop.metadata.web.util.Servlets
;
import
org.codehaus.jettison.json.JSONArray
;
import
org.codehaus.jettison.json.JSONObject
;
import
org.slf4j.Logger
;
...
...
@@ -44,7 +54,6 @@ import org.testng.annotations.BeforeClass;
import
org.testng.annotations.Test
;
import
javax.ws.rs.HttpMethod
;
import
javax.ws.rs.core.MediaType
;
import
javax.ws.rs.core.Response
;
import
java.util.List
;
import
java.util.UUID
;
...
...
@@ -209,8 +218,8 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
.
path
(
guid
);
return
resource
.
queryParam
(
"property"
,
property
).
queryParam
(
"value"
,
value
)
.
accept
(
MediaType
.
APPLICATION_JSON
)
.
type
(
MediaType
.
APPLICATION_JSON
)
.
accept
(
Servlets
.
JSON_MEDIA_TYPE
)
.
type
(
Servlets
.
JSON_MEDIA_TYPE
)
.
method
(
HttpMethod
.
PUT
,
ClientResponse
.
class
);
}
...
...
@@ -218,8 +227,8 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
WebResource
resource
=
service
.
path
(
"api/metadata/entities"
)
.
path
(
guid
);
return
resource
.
accept
(
MediaType
.
APPLICATION_JSON
)
.
type
(
MediaType
.
APPLICATION_JSON
)
return
resource
.
accept
(
Servlets
.
JSON_MEDIA_TYPE
)
.
type
(
Servlets
.
JSON_MEDIA_TYPE
)
.
method
(
HttpMethod
.
GET
,
ClientResponse
.
class
);
}
...
...
@@ -239,8 +248,8 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
.
path
(
"blah"
);
ClientResponse
clientResponse
=
resource
.
accept
(
MediaType
.
APPLICATION_JSON
)
.
type
(
MediaType
.
APPLICATION_JSON
)
.
accept
(
Servlets
.
JSON_MEDIA_TYPE
)
.
type
(
Servlets
.
JSON_MEDIA_TYPE
)
.
method
(
HttpMethod
.
GET
,
ClientResponse
.
class
);
Assert
.
assertEquals
(
clientResponse
.
getStatus
(),
Response
.
Status
.
NOT_FOUND
.
getStatusCode
());
...
...
@@ -257,8 +266,8 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
ClientResponse
clientResponse
=
service
.
path
(
"api/metadata/entities"
)
.
queryParam
(
"type"
,
TABLE_TYPE
)
.
accept
(
MediaType
.
APPLICATION_JSON
)
.
type
(
MediaType
.
APPLICATION_JSON
)
.
accept
(
Servlets
.
JSON_MEDIA_TYPE
)
.
type
(
Servlets
.
JSON_MEDIA_TYPE
)
.
method
(
HttpMethod
.
GET
,
ClientResponse
.
class
);
Assert
.
assertEquals
(
clientResponse
.
getStatus
(),
Response
.
Status
.
OK
.
getStatusCode
());
...
...
@@ -278,8 +287,8 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
ClientResponse
clientResponse
=
service
.
path
(
"api/metadata/entities"
)
.
queryParam
(
"type"
,
"blah"
)
.
accept
(
MediaType
.
APPLICATION_JSON
)
.
type
(
MediaType
.
APPLICATION_JSON
)
.
accept
(
Servlets
.
JSON_MEDIA_TYPE
)
.
type
(
Servlets
.
JSON_MEDIA_TYPE
)
.
method
(
HttpMethod
.
GET
,
ClientResponse
.
class
);
Assert
.
assertEquals
(
clientResponse
.
getStatus
(),
Response
.
Status
.
BAD_REQUEST
.
getStatusCode
());
...
...
@@ -299,8 +308,8 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
ClientResponse
clientResponse
=
service
.
path
(
"api/metadata/entities"
)
.
queryParam
(
"type"
,
"test"
)
.
accept
(
MediaType
.
APPLICATION_JSON
)
.
type
(
MediaType
.
APPLICATION_JSON
)
.
accept
(
Servlets
.
JSON_MEDIA_TYPE
)
.
type
(
Servlets
.
JSON_MEDIA_TYPE
)
.
method
(
HttpMethod
.
GET
,
ClientResponse
.
class
);
Assert
.
assertEquals
(
clientResponse
.
getStatus
(),
Response
.
Status
.
OK
.
getStatusCode
());
...
...
@@ -331,8 +340,8 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
.
path
(
"api/metadata/entities"
)
.
path
(
guid
)
.
path
(
TRAITS
)
.
accept
(
MediaType
.
APPLICATION_JSON
)
.
type
(
MediaType
.
APPLICATION_JSON
)
.
accept
(
Servlets
.
JSON_MEDIA_TYPE
)
.
type
(
Servlets
.
JSON_MEDIA_TYPE
)
.
method
(
HttpMethod
.
GET
,
ClientResponse
.
class
);
Assert
.
assertEquals
(
clientResponse
.
getStatus
(),
Response
.
Status
.
OK
.
getStatusCode
());
...
...
@@ -365,8 +374,8 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
.
path
(
"api/metadata/entities"
)
.
path
(
guid
)
.
path
(
TRAITS
)
.
accept
(
MediaType
.
APPLICATION_JSON
)
.
type
(
MediaType
.
APPLICATION_JSON
)
.
accept
(
Servlets
.
JSON_MEDIA_TYPE
)
.
type
(
Servlets
.
JSON_MEDIA_TYPE
)
.
method
(
HttpMethod
.
POST
,
ClientResponse
.
class
,
traitInstanceAsJSON
);
Assert
.
assertEquals
(
clientResponse
.
getStatus
(),
Response
.
Status
.
CREATED
.
getStatusCode
());
...
...
@@ -391,8 +400,8 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
.
path
(
"api/metadata/entities"
)
.
path
(
guid
)
.
path
(
TRAITS
)
.
accept
(
MediaType
.
APPLICATION_JSON
)
.
type
(
MediaType
.
APPLICATION_JSON
)
.
accept
(
Servlets
.
JSON_MEDIA_TYPE
)
.
type
(
Servlets
.
JSON_MEDIA_TYPE
)
.
method
(
HttpMethod
.
POST
,
ClientResponse
.
class
,
traitInstanceAsJSON
);
Assert
.
assertEquals
(
clientResponse
.
getStatus
(),
Response
.
Status
.
BAD_REQUEST
.
getStatusCode
());
}
...
...
@@ -417,8 +426,8 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
.
path
(
"api/metadata/entities"
)
.
path
(
guid
)
.
path
(
TRAITS
)
.
accept
(
MediaType
.
APPLICATION_JSON
)
.
type
(
MediaType
.
APPLICATION_JSON
)
.
accept
(
Servlets
.
JSON_MEDIA_TYPE
)
.
type
(
Servlets
.
JSON_MEDIA_TYPE
)
.
method
(
HttpMethod
.
POST
,
ClientResponse
.
class
,
traitInstanceAsJSON
);
Assert
.
assertEquals
(
clientResponse
.
getStatus
(),
Response
.
Status
.
CREATED
.
getStatusCode
());
...
...
@@ -461,8 +470,8 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
.
path
(
"api/metadata/entities"
)
.
path
(
"random"
)
.
path
(
TRAITS
)
.
accept
(
MediaType
.
APPLICATION_JSON
)
.
type
(
MediaType
.
APPLICATION_JSON
)
.
accept
(
Servlets
.
JSON_MEDIA_TYPE
)
.
type
(
Servlets
.
JSON_MEDIA_TYPE
)
.
method
(
HttpMethod
.
POST
,
ClientResponse
.
class
,
traitInstanceAsJSON
);
Assert
.
assertEquals
(
clientResponse
.
getStatus
(),
Response
.
Status
.
BAD_REQUEST
.
getStatusCode
());
}
...
...
@@ -476,8 +485,8 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
.
path
(
guid
)
.
path
(
TRAITS
)
.
path
(
traitName
)
.
accept
(
MediaType
.
APPLICATION_JSON
)
.
type
(
MediaType
.
APPLICATION_JSON
)
.
accept
(
Servlets
.
JSON_MEDIA_TYPE
)
.
type
(
Servlets
.
JSON_MEDIA_TYPE
)
.
method
(
HttpMethod
.
DELETE
,
ClientResponse
.
class
);
Assert
.
assertEquals
(
clientResponse
.
getStatus
(),
Response
.
Status
.
OK
.
getStatusCode
());
...
...
@@ -499,8 +508,8 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
.
path
(
"random"
)
.
path
(
TRAITS
)
.
path
(
traitName
)
.
accept
(
MediaType
.
APPLICATION_JSON
)
.
type
(
MediaType
.
APPLICATION_JSON
)
.
accept
(
Servlets
.
JSON_MEDIA_TYPE
)
.
type
(
Servlets
.
JSON_MEDIA_TYPE
)
.
method
(
HttpMethod
.
DELETE
,
ClientResponse
.
class
);
Assert
.
assertEquals
(
clientResponse
.
getStatus
(),
Response
.
Status
.
BAD_REQUEST
.
getStatusCode
());
...
...
webapp/src/test/java/org/apache/hadoop/metadata/web/resources/HiveLineageJerseyResourceIT.java
View file @
3943a640
...
...
@@ -37,6 +37,7 @@ import org.apache.hadoop.metadata.typesystem.types.StructTypeDefinition;
import
org.apache.hadoop.metadata.typesystem.types.TraitType
;
import
org.apache.hadoop.metadata.typesystem.types.TypeUtils
;
import
org.apache.hadoop.metadata.typesystem.types.utils.TypesUtil
;
import
org.apache.hadoop.metadata.web.util.Servlets
;
import
org.codehaus.jettison.json.JSONArray
;
import
org.codehaus.jettison.json.JSONObject
;
import
org.testng.Assert
;
...
...
@@ -44,7 +45,6 @@ import org.testng.annotations.BeforeClass;
import
org.testng.annotations.Test
;
import
javax.ws.rs.HttpMethod
;
import
javax.ws.rs.core.MediaType
;
import
javax.ws.rs.core.Response
;
import
java.util.List
;
...
...
@@ -72,8 +72,8 @@ public class HiveLineageJerseyResourceIT extends BaseResourceIT {
.
path
(
"graph"
);
ClientResponse
clientResponse
=
resource
.
accept
(
MediaType
.
APPLICATION_JSON
)
.
type
(
MediaType
.
APPLICATION_JSON
)
.
accept
(
Servlets
.
JSON_MEDIA_TYPE
)
.
type
(
Servlets
.
JSON_MEDIA_TYPE
)
.
method
(
HttpMethod
.
GET
,
ClientResponse
.
class
);
Assert
.
assertEquals
(
clientResponse
.
getStatus
(),
Response
.
Status
.
OK
.
getStatusCode
());
...
...
@@ -106,8 +106,8 @@ public class HiveLineageJerseyResourceIT extends BaseResourceIT {
.
path
(
"graph"
);
ClientResponse
clientResponse
=
resource
.
accept
(
MediaType
.
APPLICATION_JSON
)
.
type
(
MediaType
.
APPLICATION_JSON
)
.
accept
(
Servlets
.
JSON_MEDIA_TYPE
)
.
type
(
Servlets
.
JSON_MEDIA_TYPE
)
.
method
(
HttpMethod
.
GET
,
ClientResponse
.
class
);
Assert
.
assertEquals
(
clientResponse
.
getStatus
(),
Response
.
Status
.
OK
.
getStatusCode
());
...
...
@@ -139,8 +139,8 @@ public class HiveLineageJerseyResourceIT extends BaseResourceIT {
.
path
(
"schema"
);
ClientResponse
clientResponse
=
resource
.
accept
(
MediaType
.
APPLICATION_JSON
)
.
type
(
MediaType
.
APPLICATION_JSON
)
.
accept
(
Servlets
.
JSON_MEDIA_TYPE
)
.
type
(
Servlets
.
JSON_MEDIA_TYPE
)
.
method
(
HttpMethod
.
GET
,
ClientResponse
.
class
);
Assert
.
assertEquals
(
clientResponse
.
getStatus
(),
Response
.
Status
.
OK
.
getStatusCode
());
...
...
@@ -174,8 +174,8 @@ public class HiveLineageJerseyResourceIT extends BaseResourceIT {
.
path
(
"schema"
);
ClientResponse
clientResponse
=
resource
.
accept
(
MediaType
.
APPLICATION_JSON
)
.
type
(
MediaType
.
APPLICATION_JSON
)
.
accept
(
Servlets
.
JSON_MEDIA_TYPE
)
.
type
(
Servlets
.
JSON_MEDIA_TYPE
)
.
method
(
HttpMethod
.
GET
,
ClientResponse
.
class
);
Assert
.
assertEquals
(
clientResponse
.
getStatus
(),
Response
.
Status
.
NOT_FOUND
.
getStatusCode
());
...
...
@@ -189,8 +189,8 @@ public class HiveLineageJerseyResourceIT extends BaseResourceIT {
.
path
(
"schema"
);
ClientResponse
clientResponse
=
resource
.
accept
(
MediaType
.
APPLICATION_JSON
)
.
type
(
MediaType
.
APPLICATION_JSON
)
.
accept
(
Servlets
.
JSON_MEDIA_TYPE
)
.
type
(
Servlets
.
JSON_MEDIA_TYPE
)
.
method
(
HttpMethod
.
GET
,
ClientResponse
.
class
);
Assert
.
assertEquals
(
clientResponse
.
getStatus
(),
Response
.
Status
.
NOT_FOUND
.
getStatusCode
());
...
...
webapp/src/test/java/org/apache/hadoop/metadata/web/resources/MetadataDiscoveryJerseyResourceIT.java
View file @
3943a640
...
...
@@ -34,6 +34,7 @@ import org.apache.hadoop.metadata.typesystem.types.StructTypeDefinition;
import
org.apache.hadoop.metadata.typesystem.types.TraitType
;
import
org.apache.hadoop.metadata.typesystem.types.TypeUtils
;
import
org.apache.hadoop.metadata.typesystem.types.utils.TypesUtil
;
import
org.apache.hadoop.metadata.web.util.Servlets
;
import
org.codehaus.jettison.json.JSONArray
;
import
org.codehaus.jettison.json.JSONObject
;
import
org.testng.Assert
;
...
...
@@ -41,7 +42,6 @@ import org.testng.annotations.BeforeClass;
import
org.testng.annotations.Test
;
import
javax.ws.rs.HttpMethod
;
import
javax.ws.rs.core.MediaType
;
import
javax.ws.rs.core.Response
;
import
java.util.List
;
...
...
@@ -66,8 +66,8 @@ public class MetadataDiscoveryJerseyResourceIT extends BaseResourceIT {
.
queryParam
(
"query"
,
dslQuery
);
ClientResponse
clientResponse
=
resource
.
accept
(
MediaType
.
APPLICATION_JSON
)
.
type
(
MediaType
.
APPLICATION_JSON
)
.
accept
(
Servlets
.
JSON_MEDIA_TYPE
)
.
type
(
Servlets
.
JSON_MEDIA_TYPE
)
.
method
(
HttpMethod
.
GET
,
ClientResponse
.
class
);
Assert
.
assertEquals
(
clientResponse
.
getStatus
(),
Response
.
Status
.
OK
.
getStatusCode
());
...
...
@@ -99,8 +99,8 @@ public class MetadataDiscoveryJerseyResourceIT extends BaseResourceIT {
.
queryParam
(
"query"
,
dslQuery
);
ClientResponse
clientResponse
=
resource
.
accept
(
MediaType
.
APPLICATION_JSON
)
.
type
(
MediaType
.
APPLICATION_JSON
)
.
accept
(
Servlets
.
JSON_MEDIA_TYPE
)
.
type
(
Servlets
.
JSON_MEDIA_TYPE
)
.
method
(
HttpMethod
.
GET
,
ClientResponse
.
class
);
Assert
.
assertEquals
(
clientResponse
.
getStatus
(),
Response
.
Status
.
BAD_REQUEST
.
getStatusCode
());
...
...
@@ -114,8 +114,8 @@ public class MetadataDiscoveryJerseyResourceIT extends BaseResourceIT {
.
queryParam
(
"query"
,
query
);
ClientResponse
clientResponse
=
resource
.
accept
(
MediaType
.
APPLICATION_JSON
)
.
type
(
MediaType
.
APPLICATION_JSON
)
.
accept
(
Servlets
.
JSON_MEDIA_TYPE
)
.
type
(
Servlets
.
JSON_MEDIA_TYPE
)
.
method
(
HttpMethod
.
GET
,
ClientResponse
.
class
);
Assert
.
assertEquals
(
clientResponse
.
getStatus
(),
Response
.
Status
.
OK
.
getStatusCode
());
...
...
@@ -137,8 +137,8 @@ public class MetadataDiscoveryJerseyResourceIT extends BaseResourceIT {
.
queryParam
(
"query"
,
query
);
ClientResponse
clientResponse
=
resource
.
accept
(
MediaType
.
APPLICATION_JSON
)
.
type
(
MediaType
.
APPLICATION_JSON
)
.
accept
(
Servlets
.
JSON_MEDIA_TYPE
)
.
type
(
Servlets
.
JSON_MEDIA_TYPE
)
.
method
(
HttpMethod
.
GET
,
ClientResponse
.
class
);
Assert
.
assertEquals
(
clientResponse
.
getStatus
(),
Response
.
Status
.
OK
.
getStatusCode
());
...
...
webapp/src/test/java/org/apache/hadoop/metadata/web/resources/RexsterGraphJerseyResourceIT.java
View file @
3943a640
...
...
@@ -20,12 +20,12 @@ package org.apache.hadoop.metadata.web.resources;
import
com.sun.jersey.api.client.ClientResponse
;
import
com.sun.jersey.api.client.WebResource
;
import
org.apache.hadoop.metadata.web.util.Servlets
;
import
org.testng.Assert
;
import
org.testng.annotations.BeforeClass
;
import
org.testng.annotations.Test
;
import
javax.ws.rs.HttpMethod
;
import
javax.ws.rs.core.MediaType
;
import
javax.ws.rs.core.Response
;
/**
...
...
@@ -49,8 +49,8 @@ public class RexsterGraphJerseyResourceIT extends BaseResourceIT {
.
path
(
"0"
);
ClientResponse
clientResponse
=
resource
.
accept
(
MediaType
.
APPLICATION_JSON
)
.
type
(
MediaType
.
APPLICATION_JSON
)
.
accept
(
Servlets
.
JSON_MEDIA_TYPE
)
.
type
(
Servlets
.
JSON_MEDIA_TYPE
)
.
method
(
HttpMethod
.
GET
,
ClientResponse
.
class
);
Assert
.
assertEquals
(
clientResponse
.
getStatus
(),
Response
.
Status
.
OK
.
getStatusCode
());
String
response
=
clientResponse
.
getEntity
(
String
.
class
);
...
...
@@ -62,8 +62,8 @@ public class RexsterGraphJerseyResourceIT extends BaseResourceIT {
.
path
(
"api/metadata/graph/vertices/blah"
);
ClientResponse
clientResponse
=
resource
.
accept
(
MediaType
.
APPLICATION_JSON
)
.
type
(
MediaType
.
APPLICATION_JSON
)
.
accept
(
Servlets
.
JSON_MEDIA_TYPE
)
.
type
(
Servlets
.
JSON_MEDIA_TYPE
)
.
method
(
HttpMethod
.
GET
,
ClientResponse
.
class
);
Assert
.
assertEquals
(
clientResponse
.
getStatus
(),
Response
.
Status
.
NOT_FOUND
.
getStatusCode
());
}
...
...
webapp/src/test/java/org/apache/hadoop/metadata/web/resources/TypesJerseyResourceIT.java
View file @
3943a640
...
...
@@ -32,6 +32,7 @@ import org.apache.hadoop.metadata.typesystem.types.HierarchicalTypeDefinition;
import
org.apache.hadoop.metadata.typesystem.types.Multiplicity
;
import
org.apache.hadoop.metadata.typesystem.types.TraitType
;
import
org.apache.hadoop.metadata.typesystem.types.utils.TypesUtil
;
import
org.apache.hadoop.metadata.web.util.Servlets
;
import
org.codehaus.jettison.json.JSONArray
;
import
org.codehaus.jettison.json.JSONObject
;
import
org.testng.Assert
;
...
...
@@ -40,7 +41,6 @@ import org.testng.annotations.BeforeClass;
import
org.testng.annotations.Test
;
import
javax.ws.rs.HttpMethod
;
import
javax.ws.rs.core.MediaType
;
import
javax.ws.rs.core.Response
;
import
java.util.ArrayList
;
import
java.util.List
;
...
...
@@ -74,8 +74,8 @@ public class TypesJerseyResourceIT extends BaseResourceIT {
.
path
(
"api/metadata/types"
);
ClientResponse
clientResponse
=
resource
.
accept
(
MediaType
.
APPLICATION_JSON
)
.
type
(
MediaType
.
APPLICATION_JSON
)
.
accept
(
Servlets
.
JSON_MEDIA_TYPE
)
.
type
(
Servlets
.
JSON_MEDIA_TYPE
)
.
method
(
HttpMethod
.
POST
,
ClientResponse
.
class
,
typesAsJSON
);
Assert
.
assertEquals
(
clientResponse
.
getStatus
(),
Response
.
Status
.
CREATED
.
getStatusCode
());
...
...
@@ -98,8 +98,8 @@ public class TypesJerseyResourceIT extends BaseResourceIT {
.
path
(
typeDefinition
.
typeName
);
ClientResponse
clientResponse
=
resource
.
accept
(
MediaType
.
APPLICATION_JSON
)
.
type
(
MediaType
.
APPLICATION_JSON
)
.
accept
(
Servlets
.
JSON_MEDIA_TYPE
)
.
type
(
Servlets
.
JSON_MEDIA_TYPE
)
.
method
(
HttpMethod
.
GET
,
ClientResponse
.
class
);
Assert
.
assertEquals
(
clientResponse
.
getStatus
(),
Response
.
Status
.
OK
.
getStatusCode
());
...
...
@@ -130,8 +130,8 @@ public class TypesJerseyResourceIT extends BaseResourceIT {
.
path
(
"blah"
);
ClientResponse
clientResponse
=
resource
.
accept
(
MediaType
.
APPLICATION_JSON
)
.
type
(
MediaType
.
APPLICATION_JSON
)
.
accept
(
Servlets
.
JSON_MEDIA_TYPE
)
.
type
(
Servlets
.
JSON_MEDIA_TYPE
)
.
method
(
HttpMethod
.
GET
,
ClientResponse
.
class
);
Assert
.
assertEquals
(
clientResponse
.
getStatus
(),
Response
.
Status
.
NOT_FOUND
.
getStatusCode
());
}
...
...
@@ -142,8 +142,8 @@ public class TypesJerseyResourceIT extends BaseResourceIT {
.
path
(
"api/metadata/types"
);
ClientResponse
clientResponse
=
resource
.
accept
(
MediaType
.
APPLICATION_JSON
)
.
type
(
MediaType
.
APPLICATION_JSON
)
.
accept
(
Servlets
.
JSON_MEDIA_TYPE
)
.
type
(
Servlets
.
JSON_MEDIA_TYPE
)
.
method
(
HttpMethod
.
GET
,
ClientResponse
.
class
);
Assert
.
assertEquals
(
clientResponse
.
getStatus
(),
Response
.
Status
.
OK
.
getStatusCode
());
...
...
@@ -166,8 +166,8 @@ public class TypesJerseyResourceIT extends BaseResourceIT {
ClientResponse
clientResponse
=
resource
.
queryParam
(
"type"
,
DataTypes
.
TypeCategory
.
TRAIT
.
name
())
.
accept
(
MediaType
.
APPLICATION_JSON
)
.
type
(
MediaType
.
APPLICATION_JSON
)
.
accept
(
Servlets
.
JSON_MEDIA_TYPE
)
.
type
(
Servlets
.
JSON_MEDIA_TYPE
)
.
method
(
HttpMethod
.
GET
,
ClientResponse
.
class
);
Assert
.
assertEquals
(
clientResponse
.
getStatus
(),
Response
.
Status
.
OK
.
getStatusCode
());
...
...
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