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
bbc46662
Commit
bbc46662
authored
May 06, 2015
by
Suma Shivaprasad
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
BUG_36056 - Fixed first set of issues in ITs
parent
d7807410
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
32 additions
and
48 deletions
+32
-48
EntityResource.java
.../apache/hadoop/metadata/web/resources/EntityResource.java
+5
-3
HiveLineageResource.java
...he/hadoop/metadata/web/resources/HiveLineageResource.java
+3
-6
TypesResource.java
...g/apache/hadoop/metadata/web/resources/TypesResource.java
+17
-32
BaseResourceIT.java
.../apache/hadoop/metadata/web/resources/BaseResourceIT.java
+1
-1
EntityJerseyResourceIT.java
...hadoop/metadata/web/resources/EntityJerseyResourceIT.java
+5
-5
TypesJerseyResourceIT.java
.../hadoop/metadata/web/resources/TypesJerseyResourceIT.java
+1
-1
No files found.
webapp/src/main/java/org/apache/hadoop/metadata/web/resources/EntityResource.java
View file @
bbc46662
...
...
@@ -53,6 +53,8 @@ public class EntityResource {
private
static
final
String
GUID
=
"GUID"
;
private
static
final
String
TRAIT_NAME
=
"traitName"
;
static
final
String
TRAITS
=
"traits"
;
static
final
String
TRAIT
=
"trait"
;
private
final
MetadataService
metadataService
;
...
...
@@ -281,7 +283,7 @@ public class EntityResource {
* @param traitName name of the trait
*/
@DELETE
@Path
(
"{guid}/trait
s
/{traitName}"
)
@Path
(
"{guid}/trait/{traitName}"
)
@Consumes
(
MediaType
.
APPLICATION_JSON
)
@Produces
(
MediaType
.
APPLICATION_JSON
)
public
Response
deleteTrait
(
@Context
HttpServletRequest
request
,
...
...
@@ -301,11 +303,11 @@ public class EntityResource {
return
Response
.
ok
(
response
).
build
();
}
catch
(
MetadataException
|
IllegalArgumentException
e
)
{
LOG
.
error
(
"Unable to
add
trait name={} for entity={}"
,
traitName
,
guid
,
e
);
LOG
.
error
(
"Unable to
delete
trait name={} for entity={}"
,
traitName
,
guid
,
e
);
throw
new
WebApplicationException
(
Servlets
.
getErrorResponse
(
e
,
Response
.
Status
.
BAD_REQUEST
));
}
catch
(
JSONException
e
)
{
LOG
.
error
(
"Unable to
add
trait name={} for entity={}"
,
traitName
,
guid
,
e
);
LOG
.
error
(
"Unable to
delete
trait name={} for entity={}"
,
traitName
,
guid
,
e
);
throw
new
WebApplicationException
(
Servlets
.
getErrorResponse
(
e
,
Response
.
Status
.
INTERNAL_SERVER_ERROR
));
}
...
...
webapp/src/main/java/org/apache/hadoop/metadata/web/resources/HiveLineageResource.java
View file @
bbc46662
...
...
@@ -31,12 +31,7 @@ import org.slf4j.LoggerFactory;
import
javax.inject.Inject
;
import
javax.inject.Singleton
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.ws.rs.Consumes
;
import
javax.ws.rs.GET
;
import
javax.ws.rs.Path
;
import
javax.ws.rs.PathParam
;
import
javax.ws.rs.Produces
;
import
javax.ws.rs.WebApplicationException
;
import
javax.ws.rs.*
;
import
javax.ws.rs.core.Context
;
import
javax.ws.rs.core.MediaType
;
import
javax.ws.rs.core.Response
;
...
...
@@ -108,6 +103,7 @@ public class HiveLineageResource {
@Produces
(
MediaType
.
APPLICATION_JSON
)
public
Response
outputs
(
@Context
HttpServletRequest
request
,
@PathParam
(
"tableName"
)
String
tableName
)
{
Preconditions
.
checkNotNull
(
tableName
,
"table name cannot be null"
);
LOG
.
info
(
"Fetching lineage outputs for tableName={}"
,
tableName
);
...
...
@@ -142,6 +138,7 @@ public class HiveLineageResource {
@Produces
(
MediaType
.
APPLICATION_JSON
)
public
Response
schema
(
@Context
HttpServletRequest
request
,
@PathParam
(
"tableName"
)
String
tableName
)
{
Preconditions
.
checkNotNull
(
tableName
,
"table name cannot be null"
);
LOG
.
info
(
"Fetching schema for tableName={}"
,
tableName
);
...
...
webapp/src/main/java/org/apache/hadoop/metadata/web/resources/TypesResource.java
View file @
bbc46662
...
...
@@ -54,9 +54,10 @@ public class TypesResource {
private
final
MetadataService
metadataService
;
static
final
String
TRAIT
=
"trait"
;
static
final
String
CLASS
=
"class"
;
static
final
String
STRUCT
=
"struct"
;
static
final
String
TYPE_ALL
=
"all"
;
static
final
String
TYPE_TRAIT
=
"trait"
;
static
final
String
TYPE_CLASS
=
"class"
;
static
final
String
TYPE_STRUCT
=
"struct"
;
@Inject
public
TypesResource
(
MetadataService
metadataService
)
{
...
...
@@ -120,44 +121,28 @@ public class TypesResource {
}
/**
* Gets the list of type names registered in the type system.
*/
@GET
@Produces
(
MediaType
.
APPLICATION_JSON
)
public
Response
getTypeNames
(
@Context
HttpServletRequest
request
)
{
try
{
final
List
<
String
>
typeNamesList
=
metadataService
.
getTypeNamesList
();
JSONObject
response
=
new
JSONObject
();
response
.
put
(
MetadataServiceClient
.
RESULTS
,
new
JSONArray
(
typeNamesList
));
response
.
put
(
MetadataServiceClient
.
TOTAL_SIZE
,
typeNamesList
.
size
());
response
.
put
(
MetadataServiceClient
.
REQUEST_ID
,
Servlets
.
getRequestId
());
return
Response
.
ok
(
response
).
build
();
}
catch
(
Exception
e
)
{
LOG
.
error
(
"Unable to get types list"
,
e
);
throw
new
WebApplicationException
(
Servlets
.
getErrorResponse
(
e
,
Response
.
Status
.
BAD_REQUEST
));
}
}
/**
* Gets the list of trait type names registered in the type system.
*/
@GET
@Produces
(
MediaType
.
APPLICATION_JSON
)
public
Response
getTypesByFilter
(
@Context
HttpServletRequest
request
,
@DefaultValue
(
T
RAIT
)
@QueryParam
(
"type"
)
String
type
)
{
@DefaultValue
(
T
YPE_ALL
)
@QueryParam
(
"type"
)
String
type
)
{
try
{
Preconditions
.
checkNotNull
(
type
,
"type cannot be null"
);
List
<
String
>
result
=
null
;
switch
(
type
)
{
case
TRAIT
:
case
TYPE_ALL
:
result
=
metadataService
.
getTypeNamesList
();
break
;
case
TYPE_TRAIT
:
result
=
metadataService
.
getTraitNamesList
();
case
STRUCT
:
case
CLASS
:
//TBD for ÇLASS, STRUCT
throw
new
UnsupportedOperationException
(
"Unsupported operation on "
+
type
);
break
;
case
TYPE_STRUCT
:
case
TYPE_CLASS
:
//TODO for ÇLASS, STRUCT
default
:
LOG
.
error
(
"Unsupported typeName while retrieving type list {}"
,
type
);
throw
new
WebApplicationException
(
Servlets
.
getErrorResponse
(
"Unsupported type "
+
type
,
Response
.
Status
.
BAD_REQUEST
));
}
JSONObject
response
=
new
JSONObject
();
...
...
webapp/src/test/java/org/apache/hadoop/metadata/web/resources/BaseResourceIT.java
View file @
bbc46662
...
...
@@ -65,7 +65,7 @@ public abstract class BaseResourceIT {
protected
void
createType
(
String
typesAsJSON
)
throws
Exception
{
WebResource
resource
=
service
.
path
(
"api/metadata/types
/submit
"
);
.
path
(
"api/metadata/types"
);
ClientResponse
clientResponse
=
resource
.
accept
(
MediaType
.
APPLICATION_JSON
)
...
...
webapp/src/test/java/org/apache/hadoop/metadata/web/resources/EntityJerseyResourceIT.java
View file @
bbc46662
...
...
@@ -268,7 +268,7 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
ClientResponse
clientResponse
=
service
.
path
(
"api/metadata/entities"
)
.
path
(
guid
)
.
path
(
"traits"
)
.
path
(
EntityResource
.
TRAITS
)
.
accept
(
MediaType
.
APPLICATION_JSON
)
.
type
(
MediaType
.
APPLICATION_JSON
)
.
method
(
HttpMethod
.
GET
,
ClientResponse
.
class
);
...
...
@@ -302,7 +302,7 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
ClientResponse
clientResponse
=
service
.
path
(
"api/metadata/entities"
)
.
path
(
guid
)
.
path
(
"traits"
)
.
path
(
EntityResource
.
TRAITS
)
.
accept
(
MediaType
.
APPLICATION_JSON
)
.
type
(
MediaType
.
APPLICATION_JSON
)
.
method
(
HttpMethod
.
POST
,
ClientResponse
.
class
,
traitInstanceAsJSON
);
...
...
@@ -332,7 +332,7 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
ClientResponse
clientResponse
=
service
.
path
(
"api/metadata/entities"
)
.
path
(
"random"
)
.
path
(
"traits"
)
.
path
(
EntityResource
.
TRAITS
)
.
accept
(
MediaType
.
APPLICATION_JSON
)
.
type
(
MediaType
.
APPLICATION_JSON
)
.
method
(
HttpMethod
.
POST
,
ClientResponse
.
class
,
traitInstanceAsJSON
);
...
...
@@ -348,7 +348,7 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
ClientResponse
clientResponse
=
service
.
path
(
"api/metadata/entities"
)
.
path
(
guid
)
.
path
(
"traits"
)
.
path
(
EntityResource
.
TRAIT
)
.
path
(
traitName
)
.
accept
(
MediaType
.
APPLICATION_JSON
)
.
type
(
MediaType
.
APPLICATION_JSON
)
...
...
@@ -371,7 +371,7 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
ClientResponse
clientResponse
=
service
.
path
(
"api/metadata/entities"
)
.
path
(
"random"
)
.
path
(
"traits"
)
.
path
(
EntityResource
.
TRAIT
)
.
path
(
traitName
)
.
accept
(
MediaType
.
APPLICATION_JSON
)
.
type
(
MediaType
.
APPLICATION_JSON
)
...
...
webapp/src/test/java/org/apache/hadoop/metadata/web/resources/TypesJerseyResourceIT.java
View file @
bbc46662
...
...
@@ -153,7 +153,7 @@ public class TypesJerseyResourceIT extends BaseResourceIT {
.
path
(
"api/metadata/types"
);
ClientResponse
clientResponse
=
resource
.
queryParam
(
"type"
,
TypesResource
.
TRAIT
)
.
queryParam
(
"type"
,
TypesResource
.
T
YPE_T
RAIT
)
.
accept
(
MediaType
.
APPLICATION_JSON
)
.
type
(
MediaType
.
APPLICATION_JSON
)
.
method
(
HttpMethod
.
GET
,
ClientResponse
.
class
);
...
...
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