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
28410df5
Commit
28410df5
authored
Dec 08, 2016
by
apoorvnaik
Committed by
Suma Shivaprasad
Dec 08, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ATLAS-1357: Fixes for test failures from ATLAS-1307
parent
2c881a46
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
170 additions
and
140 deletions
+170
-140
AtlasBaseClient.java
client/src/main/java/org/apache/atlas/AtlasBaseClient.java
+28
-8
AtlasClient.java
client/src/main/java/org/apache/atlas/AtlasClient.java
+22
-21
SearchFilter.java
intg/src/main/java/org/apache/atlas/model/SearchFilter.java
+17
-12
release-log.txt
release-log.txt
+2
-1
AdminJerseyResourceIT.java
...org/apache/atlas/web/resources/AdminJerseyResourceIT.java
+1
-1
DataSetLineageJerseyResourceIT.java
...e/atlas/web/resources/DataSetLineageJerseyResourceIT.java
+5
-5
EntityJerseyResourceIT.java
...rg/apache/atlas/web/resources/EntityJerseyResourceIT.java
+42
-34
EntityLineageJerseyResourceIT.java
...he/atlas/web/resources/EntityLineageJerseyResourceIT.java
+15
-14
MetadataDiscoveryJerseyResourceIT.java
...tlas/web/resources/MetadataDiscoveryJerseyResourceIT.java
+23
-23
TypedefsJerseyResourceIT.java
.../apache/atlas/web/resources/TypedefsJerseyResourceIT.java
+10
-16
TypesJerseyResourceIT.java
...org/apache/atlas/web/resources/TypesJerseyResourceIT.java
+5
-5
No files found.
client/src/main/java/org/apache/atlas/AtlasBaseClient.java
View file @
28410df5
...
@@ -38,6 +38,7 @@ import org.slf4j.LoggerFactory;
...
@@ -38,6 +38,7 @@ import org.slf4j.LoggerFactory;
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.MultivaluedMap
;
import
javax.ws.rs.core.Response
;
import
javax.ws.rs.core.Response
;
import
javax.ws.rs.core.UriBuilder
;
import
javax.ws.rs.core.UriBuilder
;
import
java.io.IOException
;
import
java.io.IOException
;
...
@@ -398,7 +399,7 @@ public abstract class AtlasBaseClient {
...
@@ -398,7 +399,7 @@ public abstract class AtlasBaseClient {
return
callAPIWithResource
(
api
,
getResource
(
api
,
params
),
requestObject
,
responseType
);
return
callAPIWithResource
(
api
,
getResource
(
api
,
params
),
requestObject
,
responseType
);
}
}
public
<
T
>
T
callAPI
(
APIInfo
api
,
Class
<
T
>
responseType
,
Map
<
String
,
String
>
queryParams
,
String
...
params
)
public
<
T
>
T
callAPI
(
APIInfo
api
,
Class
<
T
>
responseType
,
M
ultivaluedM
ap
<
String
,
String
>
queryParams
,
String
...
params
)
throws
AtlasServiceException
{
throws
AtlasServiceException
{
WebResource
resource
=
getResource
(
api
,
queryParams
,
params
);
WebResource
resource
=
getResource
(
api
,
queryParams
,
params
);
return
callAPIWithResource
(
api
,
resource
,
null
,
responseType
);
return
callAPIWithResource
(
api
,
resource
,
null
,
responseType
);
...
@@ -415,12 +416,27 @@ public abstract class AtlasBaseClient {
...
@@ -415,12 +416,27 @@ public abstract class AtlasBaseClient {
return
resource
;
return
resource
;
}
}
public
<
T
>
T
callAPI
(
APIInfo
api
,
Class
<
T
>
responseType
,
Map
<
String
,
String
>
queryParams
)
public
<
T
>
T
callAPI
(
APIInfo
api
,
Class
<
T
>
responseType
,
M
ultivaluedM
ap
<
String
,
String
>
queryParams
)
throws
AtlasServiceException
{
throws
AtlasServiceException
{
return
callAPIWithResource
(
api
,
getResource
(
api
,
queryParams
),
null
,
responseType
);
return
callAPIWithResource
(
api
,
getResource
(
api
,
queryParams
),
null
,
responseType
);
}
}
protected
WebResource
getResource
(
APIInfo
api
,
Map
<
String
,
String
>
queryParams
,
String
...
pathParams
)
{
public
<
T
>
T
callAPI
(
APIInfo
api
,
Class
<
T
>
responseType
,
String
queryParamKey
,
List
<
String
>
queryParamValues
)
throws
AtlasServiceException
{
return
callAPIWithResource
(
api
,
getResource
(
api
,
queryParamKey
,
queryParamValues
),
null
,
responseType
);
}
private
WebResource
getResource
(
APIInfo
api
,
String
queryParamKey
,
List
<
String
>
queryParamValues
)
{
WebResource
resource
=
service
.
path
(
api
.
getPath
());
for
(
String
queryParamValue
:
queryParamValues
)
{
if
(
StringUtils
.
isNotBlank
(
queryParamKey
)
&&
StringUtils
.
isNotBlank
(
queryParamValue
))
{
resource
=
resource
.
queryParam
(
queryParamKey
,
queryParamValue
);
}
}
return
resource
;
}
protected
WebResource
getResource
(
APIInfo
api
,
MultivaluedMap
<
String
,
String
>
queryParams
,
String
...
pathParams
)
{
WebResource
resource
=
service
.
path
(
api
.
getPath
());
WebResource
resource
=
service
.
path
(
api
.
getPath
());
resource
=
appendPathParams
(
resource
,
pathParams
);
resource
=
appendPathParams
(
resource
,
pathParams
);
resource
=
appendQueryParams
(
queryParams
,
resource
);
resource
=
appendQueryParams
(
queryParams
,
resource
);
...
@@ -436,21 +452,25 @@ public abstract class AtlasBaseClient {
...
@@ -436,21 +452,25 @@ public abstract class AtlasBaseClient {
return
resource
;
return
resource
;
}
}
protected
WebResource
getResource
(
APIInfo
api
,
Map
<
String
,
String
>
queryParams
)
{
protected
WebResource
getResource
(
APIInfo
api
,
M
ultivaluedM
ap
<
String
,
String
>
queryParams
)
{
return
getResource
(
service
,
api
,
queryParams
);
return
getResource
(
service
,
api
,
queryParams
);
}
}
// Modify URL to include the query params
// Modify URL to include the query params
private
WebResource
getResource
(
WebResource
service
,
APIInfo
api
,
Map
<
String
,
String
>
queryParams
)
{
private
WebResource
getResource
(
WebResource
service
,
APIInfo
api
,
M
ultivaluedM
ap
<
String
,
String
>
queryParams
)
{
WebResource
resource
=
service
.
path
(
api
.
getPath
());
WebResource
resource
=
service
.
path
(
api
.
getPath
());
resource
=
appendQueryParams
(
queryParams
,
resource
);
resource
=
appendQueryParams
(
queryParams
,
resource
);
return
resource
;
return
resource
;
}
}
private
WebResource
appendQueryParams
(
Map
<
String
,
String
>
queryParams
,
WebResource
resource
)
{
private
WebResource
appendQueryParams
(
M
ultivaluedM
ap
<
String
,
String
>
queryParams
,
WebResource
resource
)
{
if
(
null
!=
queryParams
&&
!
queryParams
.
isEmpty
())
{
if
(
null
!=
queryParams
&&
!
queryParams
.
isEmpty
())
{
for
(
Map
.
Entry
<
String
,
String
>
entry
:
queryParams
.
entrySet
())
{
for
(
Map
.
Entry
<
String
,
List
<
String
>>
entry
:
queryParams
.
entrySet
())
{
resource
=
resource
.
queryParam
(
entry
.
getKey
(),
entry
.
getValue
());
for
(
String
value
:
entry
.
getValue
())
{
if
(
StringUtils
.
isNotBlank
(
value
))
{
resource
=
resource
.
queryParam
(
entry
.
getKey
(),
value
);
}
}
}
}
}
}
return
resource
;
return
resource
;
...
...
client/src/main/java/org/apache/atlas/AtlasClient.java
View file @
28410df5
...
@@ -42,6 +42,7 @@ import org.slf4j.Logger;
...
@@ -42,6 +42,7 @@ import org.slf4j.Logger;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
javax.ws.rs.HttpMethod
;
import
javax.ws.rs.HttpMethod
;
import
javax.ws.rs.core.MultivaluedMap
;
import
javax.ws.rs.core.Response
;
import
javax.ws.rs.core.Response
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Arrays
;
...
@@ -301,7 +302,7 @@ public class AtlasClient extends AtlasBaseClient {
...
@@ -301,7 +302,7 @@ public class AtlasClient extends AtlasBaseClient {
*/
*/
public
List
<
String
>
createType
(
String
typeAsJson
)
throws
AtlasServiceException
{
public
List
<
String
>
createType
(
String
typeAsJson
)
throws
AtlasServiceException
{
LOG
.
debug
(
"Creating type definition: {}"
,
typeAsJson
);
LOG
.
debug
(
"Creating type definition: {}"
,
typeAsJson
);
JSONObject
response
=
callAPI
(
API
.
CREATE_TYPE
,
typeAsJson
);
JSONObject
response
=
callAPI
WithBody
(
API
.
CREATE_TYPE
,
typeAsJson
);
List
<
String
>
results
=
extractResults
(
response
,
AtlasClient
.
TYPES
,
new
ExtractOperation
<
String
,
JSONObject
>()
{
List
<
String
>
results
=
extractResults
(
response
,
AtlasClient
.
TYPES
,
new
ExtractOperation
<
String
,
JSONObject
>()
{
@Override
@Override
String
extractElement
(
JSONObject
element
)
throws
JSONException
{
String
extractElement
(
JSONObject
element
)
throws
JSONException
{
...
@@ -357,7 +358,7 @@ public class AtlasClient extends AtlasBaseClient {
...
@@ -357,7 +358,7 @@ public class AtlasClient extends AtlasBaseClient {
*/
*/
public
List
<
String
>
updateType
(
String
typeAsJson
)
throws
AtlasServiceException
{
public
List
<
String
>
updateType
(
String
typeAsJson
)
throws
AtlasServiceException
{
LOG
.
debug
(
"Updating type definition: {}"
,
typeAsJson
);
LOG
.
debug
(
"Updating type definition: {}"
,
typeAsJson
);
JSONObject
response
=
callAPI
(
API
.
UPDATE_TYPE
,
typeAsJson
);
JSONObject
response
=
callAPI
WithBody
(
API
.
UPDATE_TYPE
,
typeAsJson
);
List
<
String
>
results
=
extractResults
(
response
,
AtlasClient
.
TYPES
,
new
ExtractOperation
<
String
,
JSONObject
>()
{
List
<
String
>
results
=
extractResults
(
response
,
AtlasClient
.
TYPES
,
new
ExtractOperation
<
String
,
JSONObject
>()
{
@Override
@Override
String
extractElement
(
JSONObject
element
)
throws
JSONException
{
String
extractElement
(
JSONObject
element
)
throws
JSONException
{
...
@@ -384,7 +385,7 @@ public class AtlasClient extends AtlasBaseClient {
...
@@ -384,7 +385,7 @@ public class AtlasClient extends AtlasBaseClient {
* @throws AtlasServiceException
* @throws AtlasServiceException
*/
*/
public
List
<
String
>
listTypes
()
throws
AtlasServiceException
{
public
List
<
String
>
listTypes
()
throws
AtlasServiceException
{
final
JSONObject
jsonObject
=
callAPI
(
API
.
LIST_TYPES
,
null
);
final
JSONObject
jsonObject
=
callAPI
WithQueryParams
(
API
.
LIST_TYPES
,
null
);
return
extractResults
(
jsonObject
,
AtlasClient
.
RESULTS
,
new
ExtractOperation
<
String
,
String
>());
return
extractResults
(
jsonObject
,
AtlasClient
.
RESULTS
,
new
ExtractOperation
<
String
,
String
>());
}
}
...
@@ -435,7 +436,7 @@ public class AtlasClient extends AtlasBaseClient {
...
@@ -435,7 +436,7 @@ public class AtlasClient extends AtlasBaseClient {
public
TypesDef
getType
(
String
typeName
)
throws
AtlasServiceException
{
public
TypesDef
getType
(
String
typeName
)
throws
AtlasServiceException
{
try
{
try
{
JSONObject
response
=
callAPI
(
API
.
GET_TYPE
,
null
,
typeName
);
;
JSONObject
response
=
callAPI
WithBodyAndParams
(
API
.
GET_TYPE
,
null
,
typeName
)
;
String
typeJson
=
response
.
getString
(
DEFINITION
);
String
typeJson
=
response
.
getString
(
DEFINITION
);
return
TypesSerialization
.
fromJson
(
typeJson
);
return
TypesSerialization
.
fromJson
(
typeJson
);
}
catch
(
AtlasServiceException
e
)
{
}
catch
(
AtlasServiceException
e
)
{
...
@@ -456,7 +457,7 @@ public class AtlasClient extends AtlasBaseClient {
...
@@ -456,7 +457,7 @@ public class AtlasClient extends AtlasBaseClient {
*/
*/
protected
List
<
String
>
createEntity
(
JSONArray
entities
)
throws
AtlasServiceException
{
protected
List
<
String
>
createEntity
(
JSONArray
entities
)
throws
AtlasServiceException
{
LOG
.
debug
(
"Creating entities: {}"
,
entities
);
LOG
.
debug
(
"Creating entities: {}"
,
entities
);
JSONObject
response
=
callAPI
(
API
.
CREATE_ENTITY
,
entities
.
toString
());
JSONObject
response
=
callAPI
WithBody
(
API
.
CREATE_ENTITY
,
entities
.
toString
());
List
<
String
>
results
=
extractEntityResult
(
response
).
getCreatedEntities
();
List
<
String
>
results
=
extractEntityResult
(
response
).
getCreatedEntities
();
LOG
.
debug
(
"Create entities returned results: {}"
,
results
);
LOG
.
debug
(
"Create entities returned results: {}"
,
results
);
return
results
;
return
results
;
...
@@ -506,7 +507,7 @@ public class AtlasClient extends AtlasBaseClient {
...
@@ -506,7 +507,7 @@ public class AtlasClient extends AtlasBaseClient {
protected
EntityResult
updateEntities
(
JSONArray
entities
)
throws
AtlasServiceException
{
protected
EntityResult
updateEntities
(
JSONArray
entities
)
throws
AtlasServiceException
{
LOG
.
debug
(
"Updating entities: {}"
,
entities
);
LOG
.
debug
(
"Updating entities: {}"
,
entities
);
JSONObject
response
=
callAPI
(
API
.
UPDATE_ENTITY
,
entities
.
toString
());
JSONObject
response
=
callAPI
WithBody
(
API
.
UPDATE_ENTITY
,
entities
.
toString
());
EntityResult
results
=
extractEntityResult
(
response
);
EntityResult
results
=
extractEntityResult
(
response
);
LOG
.
debug
(
"Update entities returned results: {}"
,
results
);
LOG
.
debug
(
"Update entities returned results: {}"
,
results
);
return
results
;
return
results
;
...
@@ -548,7 +549,7 @@ public class AtlasClient extends AtlasBaseClient {
...
@@ -548,7 +549,7 @@ public class AtlasClient extends AtlasBaseClient {
public
EntityResult
updateEntity
(
String
guid
,
Referenceable
entity
)
throws
AtlasServiceException
{
public
EntityResult
updateEntity
(
String
guid
,
Referenceable
entity
)
throws
AtlasServiceException
{
String
entityJson
=
InstanceSerialization
.
toJson
(
entity
,
true
);
String
entityJson
=
InstanceSerialization
.
toJson
(
entity
,
true
);
LOG
.
debug
(
"Updating entity id {} with {}"
,
guid
,
entityJson
);
LOG
.
debug
(
"Updating entity id {} with {}"
,
guid
,
entityJson
);
JSONObject
response
=
callAPI
(
API
.
UPDATE_ENTITY_PARTIAL
,
entityJson
,
guid
);
JSONObject
response
=
callAPI
WithBodyAndParams
(
API
.
UPDATE_ENTITY_PARTIAL
,
entityJson
,
guid
);
return
extractEntityResult
(
response
);
return
extractEntityResult
(
response
);
}
}
...
@@ -561,7 +562,7 @@ public class AtlasClient extends AtlasBaseClient {
...
@@ -561,7 +562,7 @@ public class AtlasClient extends AtlasBaseClient {
public
void
addTrait
(
String
guid
,
Struct
traitDefinition
)
throws
AtlasServiceException
{
public
void
addTrait
(
String
guid
,
Struct
traitDefinition
)
throws
AtlasServiceException
{
String
traitJson
=
InstanceSerialization
.
toJson
(
traitDefinition
,
true
);
String
traitJson
=
InstanceSerialization
.
toJson
(
traitDefinition
,
true
);
LOG
.
debug
(
"Adding trait to entity with id {} {}"
,
guid
,
traitJson
);
LOG
.
debug
(
"Adding trait to entity with id {} {}"
,
guid
,
traitJson
);
callAPI
(
API
.
ADD_TRAITS
,
traitJson
,
guid
,
URI_TRAITS
);
callAPI
WithBodyAndParams
(
API
.
ADD_TRAITS
,
traitJson
,
guid
,
URI_TRAITS
);
}
}
/**
/**
...
@@ -571,7 +572,7 @@ public class AtlasClient extends AtlasBaseClient {
...
@@ -571,7 +572,7 @@ public class AtlasClient extends AtlasBaseClient {
* @throws AtlasServiceException
* @throws AtlasServiceException
*/
*/
public
void
deleteTrait
(
String
guid
,
String
traitName
)
throws
AtlasServiceException
{
public
void
deleteTrait
(
String
guid
,
String
traitName
)
throws
AtlasServiceException
{
callAPI
(
API
.
DELETE_TRAITS
,
null
,
guid
,
TRAITS
,
traitName
);
callAPI
WithBodyAndParams
(
API
.
DELETE_TRAITS
,
null
,
guid
,
TRAITS
,
traitName
);
}
}
/**
/**
...
@@ -666,7 +667,7 @@ public class AtlasClient extends AtlasBaseClient {
...
@@ -666,7 +667,7 @@ public class AtlasClient extends AtlasBaseClient {
* @throws AtlasServiceException
* @throws AtlasServiceException
*/
*/
public
Referenceable
getEntity
(
String
guid
)
throws
AtlasServiceException
{
public
Referenceable
getEntity
(
String
guid
)
throws
AtlasServiceException
{
JSONObject
jsonResponse
=
callAPI
(
API
.
GET_ENTITY
,
null
,
guid
);
JSONObject
jsonResponse
=
callAPI
WithBodyAndParams
(
API
.
GET_ENTITY
,
null
,
guid
);
try
{
try
{
String
entityInstanceDefinition
=
jsonResponse
.
getString
(
AtlasClient
.
DEFINITION
);
String
entityInstanceDefinition
=
jsonResponse
.
getString
(
AtlasClient
.
DEFINITION
);
return
InstanceSerialization
.
fromJsonReferenceable
(
entityInstanceDefinition
,
true
);
return
InstanceSerialization
.
fromJsonReferenceable
(
entityInstanceDefinition
,
true
);
...
@@ -736,7 +737,7 @@ public class AtlasClient extends AtlasBaseClient {
...
@@ -736,7 +737,7 @@ public class AtlasClient extends AtlasBaseClient {
* @throws AtlasServiceException
* @throws AtlasServiceException
*/
*/
public
List
<
String
>
listTraits
(
final
String
guid
)
throws
AtlasServiceException
{
public
List
<
String
>
listTraits
(
final
String
guid
)
throws
AtlasServiceException
{
JSONObject
jsonResponse
=
callAPI
(
API
.
LIST_TRAITS
,
null
,
guid
,
URI_TRAITS
);
JSONObject
jsonResponse
=
callAPI
WithBodyAndParams
(
API
.
LIST_TRAITS
,
null
,
guid
,
URI_TRAITS
);
return
extractResults
(
jsonResponse
,
AtlasClient
.
RESULTS
,
new
ExtractOperation
<
String
,
String
>());
return
extractResults
(
jsonResponse
,
AtlasClient
.
RESULTS
,
new
ExtractOperation
<
String
,
String
>());
}
}
...
@@ -747,7 +748,7 @@ public class AtlasClient extends AtlasBaseClient {
...
@@ -747,7 +748,7 @@ public class AtlasClient extends AtlasBaseClient {
* @throws AtlasServiceException
* @throws AtlasServiceException
*/
*/
public
List
<
Struct
>
listTraitDefinitions
(
final
String
guid
)
throws
AtlasServiceException
{
public
List
<
Struct
>
listTraitDefinitions
(
final
String
guid
)
throws
AtlasServiceException
{
JSONObject
jsonResponse
=
callAPI
(
API
.
GET_ALL_TRAIT_DEFINITIONS
,
null
,
guid
,
TRAIT_DEFINITIONS
);
JSONObject
jsonResponse
=
callAPI
WithBodyAndParams
(
API
.
GET_ALL_TRAIT_DEFINITIONS
,
null
,
guid
,
TRAIT_DEFINITIONS
);
List
<
JSONObject
>
traitDefList
=
extractResults
(
jsonResponse
,
AtlasClient
.
RESULTS
,
new
ExtractOperation
<
JSONObject
,
JSONObject
>());
List
<
JSONObject
>
traitDefList
=
extractResults
(
jsonResponse
,
AtlasClient
.
RESULTS
,
new
ExtractOperation
<
JSONObject
,
JSONObject
>());
ArrayList
<
Struct
>
traitStructList
=
new
ArrayList
<>();
ArrayList
<
Struct
>
traitStructList
=
new
ArrayList
<>();
for
(
JSONObject
traitDef:
traitDefList
){
for
(
JSONObject
traitDef:
traitDefList
){
...
@@ -765,7 +766,7 @@ public class AtlasClient extends AtlasBaseClient {
...
@@ -765,7 +766,7 @@ public class AtlasClient extends AtlasBaseClient {
* @throws AtlasServiceException
* @throws AtlasServiceException
*/
*/
public
Struct
getTraitDefinition
(
final
String
guid
,
final
String
traitName
)
throws
AtlasServiceException
{
public
Struct
getTraitDefinition
(
final
String
guid
,
final
String
traitName
)
throws
AtlasServiceException
{
JSONObject
jsonResponse
=
callAPI
(
API
.
GET_TRAIT_DEFINITION
,
null
,
guid
,
TRAIT_DEFINITIONS
,
traitName
);
JSONObject
jsonResponse
=
callAPI
WithBodyAndParams
(
API
.
GET_TRAIT_DEFINITION
,
null
,
guid
,
TRAIT_DEFINITIONS
,
traitName
);
try
{
try
{
return
InstanceSerialization
.
fromJsonStruct
(
jsonResponse
.
getString
(
AtlasClient
.
RESULTS
),
false
);
return
InstanceSerialization
.
fromJsonStruct
(
jsonResponse
.
getString
(
AtlasClient
.
RESULTS
),
false
);
...
@@ -909,7 +910,7 @@ public class AtlasClient extends AtlasBaseClient {
...
@@ -909,7 +910,7 @@ public class AtlasClient extends AtlasBaseClient {
}
}
public
JSONObject
getInputGraph
(
String
datasetName
)
throws
AtlasServiceException
{
public
JSONObject
getInputGraph
(
String
datasetName
)
throws
AtlasServiceException
{
JSONObject
response
=
callAPI
(
API
.
NAME_LINEAGE_INPUTS_GRAPH
,
null
,
datasetName
,
"/inputs/graph"
);
JSONObject
response
=
callAPI
WithBodyAndParams
(
API
.
NAME_LINEAGE_INPUTS_GRAPH
,
null
,
datasetName
,
"/inputs/graph"
);
try
{
try
{
return
response
.
getJSONObject
(
AtlasClient
.
RESULTS
);
return
response
.
getJSONObject
(
AtlasClient
.
RESULTS
);
}
catch
(
JSONException
e
)
{
}
catch
(
JSONException
e
)
{
...
@@ -918,7 +919,7 @@ public class AtlasClient extends AtlasBaseClient {
...
@@ -918,7 +919,7 @@ public class AtlasClient extends AtlasBaseClient {
}
}
public
JSONObject
getOutputGraph
(
String
datasetName
)
throws
AtlasServiceException
{
public
JSONObject
getOutputGraph
(
String
datasetName
)
throws
AtlasServiceException
{
JSONObject
response
=
callAPI
(
API
.
NAME_LINEAGE_OUTPUTS_GRAPH
,
null
,
datasetName
,
"/outputs/graph"
);
JSONObject
response
=
callAPI
WithBodyAndParams
(
API
.
NAME_LINEAGE_OUTPUTS_GRAPH
,
null
,
datasetName
,
"/outputs/graph"
);
try
{
try
{
return
response
.
getJSONObject
(
AtlasClient
.
RESULTS
);
return
response
.
getJSONObject
(
AtlasClient
.
RESULTS
);
}
catch
(
JSONException
e
)
{
}
catch
(
JSONException
e
)
{
...
@@ -927,7 +928,7 @@ public class AtlasClient extends AtlasBaseClient {
...
@@ -927,7 +928,7 @@ public class AtlasClient extends AtlasBaseClient {
}
}
public
JSONObject
getInputGraphForEntity
(
String
entityId
)
throws
AtlasServiceException
{
public
JSONObject
getInputGraphForEntity
(
String
entityId
)
throws
AtlasServiceException
{
JSONObject
response
=
callAPI
(
API
.
LINEAGE_INPUTS_GRAPH
,
null
,
entityId
,
"/inputs/graph"
);
JSONObject
response
=
callAPI
WithBodyAndParams
(
API
.
LINEAGE_INPUTS_GRAPH
,
null
,
entityId
,
"/inputs/graph"
);
try
{
try
{
return
response
.
getJSONObject
(
AtlasClient
.
RESULTS
);
return
response
.
getJSONObject
(
AtlasClient
.
RESULTS
);
}
catch
(
JSONException
e
)
{
}
catch
(
JSONException
e
)
{
...
@@ -936,7 +937,7 @@ public class AtlasClient extends AtlasBaseClient {
...
@@ -936,7 +937,7 @@ public class AtlasClient extends AtlasBaseClient {
}
}
public
JSONObject
getOutputGraphForEntity
(
String
datasetId
)
throws
AtlasServiceException
{
public
JSONObject
getOutputGraphForEntity
(
String
datasetId
)
throws
AtlasServiceException
{
JSONObject
response
=
callAPI
(
API
.
LINEAGE_OUTPUTS_GRAPH
,
null
,
datasetId
,
"/outputs/graph"
);
JSONObject
response
=
callAPI
WithBodyAndParams
(
API
.
LINEAGE_OUTPUTS_GRAPH
,
null
,
datasetId
,
"/outputs/graph"
);
try
{
try
{
return
response
.
getJSONObject
(
AtlasClient
.
RESULTS
);
return
response
.
getJSONObject
(
AtlasClient
.
RESULTS
);
}
catch
(
JSONException
e
)
{
}
catch
(
JSONException
e
)
{
...
@@ -945,7 +946,7 @@ public class AtlasClient extends AtlasBaseClient {
...
@@ -945,7 +946,7 @@ public class AtlasClient extends AtlasBaseClient {
}
}
public
JSONObject
getSchemaForEntity
(
String
datasetId
)
throws
AtlasServiceException
{
public
JSONObject
getSchemaForEntity
(
String
datasetId
)
throws
AtlasServiceException
{
JSONObject
response
=
callAPI
(
API
.
LINEAGE_OUTPUTS_GRAPH
,
null
,
datasetId
,
"/schema"
);
JSONObject
response
=
callAPI
WithBodyAndParams
(
API
.
LINEAGE_OUTPUTS_GRAPH
,
null
,
datasetId
,
"/schema"
);
try
{
try
{
return
response
.
getJSONObject
(
AtlasClient
.
RESULTS
);
return
response
.
getJSONObject
(
AtlasClient
.
RESULTS
);
}
catch
(
JSONException
e
)
{
}
catch
(
JSONException
e
)
{
...
@@ -965,17 +966,17 @@ public class AtlasClient extends AtlasBaseClient {
...
@@ -965,17 +966,17 @@ public class AtlasClient extends AtlasBaseClient {
}
}
@VisibleForTesting
@VisibleForTesting
public
JSONObject
callAPI
(
API
api
,
Object
requestObject
)
throws
AtlasServiceException
{
public
JSONObject
callAPI
WithBody
(
API
api
,
Object
requestObject
)
throws
AtlasServiceException
{
return
callAPI
(
toAPIInfo
(
api
),
requestObject
,
JSONObject
.
class
,
(
String
[])
null
);
return
callAPI
(
toAPIInfo
(
api
),
requestObject
,
JSONObject
.
class
,
(
String
[])
null
);
}
}
@VisibleForTesting
@VisibleForTesting
public
JSONObject
callAPI
(
API
api
,
Object
requestObject
,
String
...
params
)
throws
AtlasServiceException
{
public
JSONObject
callAPI
WithBodyAndParams
(
API
api
,
Object
requestObject
,
String
...
params
)
throws
AtlasServiceException
{
return
callAPI
(
toAPIInfo
(
api
),
requestObject
,
JSONObject
.
class
,
params
);
return
callAPI
(
toAPIInfo
(
api
),
requestObject
,
JSONObject
.
class
,
params
);
}
}
@VisibleForTesting
@VisibleForTesting
public
JSONObject
callAPI
(
API
api
,
Map
<
String
,
String
>
queryParams
)
throws
AtlasServiceException
{
public
JSONObject
callAPI
WithQueryParams
(
API
api
,
Multivalued
Map
<
String
,
String
>
queryParams
)
throws
AtlasServiceException
{
return
callAPI
(
toAPIInfo
(
api
),
JSONObject
.
class
,
queryParams
);
return
callAPI
(
toAPIInfo
(
api
),
JSONObject
.
class
,
queryParams
);
}
}
...
...
intg/src/main/java/org/apache/atlas/model/SearchFilter.java
View file @
28410df5
...
@@ -17,18 +17,19 @@
...
@@ -17,18 +17,19 @@
*/
*/
package
org
.
apache
.
atlas
.
model
;
package
org
.
apache
.
atlas
.
model
;
import
java.util.HashMap
;
import
com.sun.jersey.core.util.MultivaluedMapImpl
;
import
java.util.Map
;
import
org.codehaus.jackson.annotate.JsonAutoDetect
;
import
org.codehaus.jackson.annotate.JsonAutoDetect
;
import
static
org
.
codehaus
.
jackson
.
annotate
.
JsonAutoDetect
.
Visibility
.
PUBLIC_ONLY
;
import
static
org
.
codehaus
.
jackson
.
annotate
.
JsonAutoDetect
.
Visibility
.
NONE
;
import
org.codehaus.jackson.annotate.JsonIgnoreProperties
;
import
org.codehaus.jackson.annotate.JsonIgnoreProperties
;
import
org.codehaus.jackson.map.annotate.JsonSerialize
;
import
org.codehaus.jackson.map.annotate.JsonSerialize
;
import
javax.ws.rs.core.MultivaluedMap
;
import
javax.xml.bind.annotation.XmlAccessType
;
import
javax.xml.bind.annotation.XmlAccessType
;
import
javax.xml.bind.annotation.XmlAccessorType
;
import
javax.xml.bind.annotation.XmlAccessorType
;
import
javax.xml.bind.annotation.XmlRootElement
;
import
javax.xml.bind.annotation.XmlRootElement
;
import
java.util.List
;
import
static
org
.
codehaus
.
jackson
.
annotate
.
JsonAutoDetect
.
Visibility
.
NONE
;
import
static
org
.
codehaus
.
jackson
.
annotate
.
JsonAutoDetect
.
Visibility
.
PUBLIC_ONLY
;
/**
/**
* Generic filter, to specify search criteria using name/value pairs.
* Generic filter, to specify search criteria using name/value pairs.
...
@@ -48,7 +49,7 @@ public class SearchFilter {
...
@@ -48,7 +49,7 @@ public class SearchFilter {
*/
*/
public
enum
SortType
{
NONE
,
ASC
,
DESC
};
public
enum
SortType
{
NONE
,
ASC
,
DESC
};
private
Map
<
String
,
String
>
params
=
null
;
private
M
ultivaluedM
ap
<
String
,
String
>
params
=
null
;
private
long
startIndex
=
0
;
private
long
startIndex
=
0
;
private
long
maxRows
=
Long
.
MAX_VALUE
;
private
long
maxRows
=
Long
.
MAX_VALUE
;
private
boolean
getCount
=
true
;
private
boolean
getCount
=
true
;
...
@@ -59,20 +60,24 @@ public class SearchFilter {
...
@@ -59,20 +60,24 @@ public class SearchFilter {
setParams
(
null
);
setParams
(
null
);
}
}
public
SearchFilter
(
Map
<
String
,
String
>
params
)
{
public
SearchFilter
(
M
ultivaluedM
ap
<
String
,
String
>
params
)
{
setParams
(
params
);
setParams
(
params
);
}
}
public
Map
<
String
,
String
>
getParams
()
{
public
M
ultivaluedM
ap
<
String
,
String
>
getParams
()
{
return
params
;
return
params
;
}
}
public
void
setParams
(
Map
<
String
,
String
>
params
)
{
public
void
setParams
(
M
ultivaluedM
ap
<
String
,
String
>
params
)
{
this
.
params
=
params
;
this
.
params
=
params
;
}
}
public
String
getParam
(
String
name
)
{
public
String
getParam
(
String
name
)
{
String
ret
=
null
;
return
getParams
(
name
).
get
(
0
);
}
public
List
<
String
>
getParams
(
String
name
)
{
List
<
String
>
ret
=
null
;
if
(
name
!=
null
&&
params
!=
null
)
{
if
(
name
!=
null
&&
params
!=
null
)
{
ret
=
params
.
get
(
name
);
ret
=
params
.
get
(
name
);
...
@@ -84,10 +89,10 @@ public class SearchFilter {
...
@@ -84,10 +89,10 @@ public class SearchFilter {
public
void
setParam
(
String
name
,
String
value
)
{
public
void
setParam
(
String
name
,
String
value
)
{
if
(
name
!=
null
)
{
if
(
name
!=
null
)
{
if
(
params
==
null
)
{
if
(
params
==
null
)
{
params
=
new
HashMap
<
String
,
String
>
();
params
=
new
MultivaluedMapImpl
();
}
}
params
.
put
(
name
,
value
);
params
.
add
(
name
,
value
);
}
}
}
}
...
...
release-log.txt
View file @
28410df5
...
@@ -9,7 +9,8 @@ ATLAS-1060 Add composite indexes for exact match performance improvements for al
...
@@ -9,7 +9,8 @@ ATLAS-1060 Add composite indexes for exact match performance improvements for al
ATLAS-1127 Modify creation and modification timestamps to Date instead of Long(sumasai)
ATLAS-1127 Modify creation and modification timestamps to Date instead of Long(sumasai)
ALL CHANGES:
ALL CHANGES:
ATLAS-1307: Integration test calls routing via the Client. ((apoorvnaik via sumasai)
ATLAS-1357: Fixes for test failures from ATLAS-1307 (apoorvnaik via sumasai)
ATLAS-1307: Integration test calls routing via the Client. (apoorvnaik via sumasai)
ATLAS-1355: Fix for bad error translation from V2 API (apoorvnaik via sumasai)
ATLAS-1355: Fix for bad error translation from V2 API (apoorvnaik via sumasai)
ATLAS-1351 HiveHook fails with NPE for hive process registration (vimalsharma via sumasai)
ATLAS-1351 HiveHook fails with NPE for hive process registration (vimalsharma via sumasai)
ATLAS-1342 Titan Solrclient - Add timeouts for zookeeper connect and session (sumasai)
ATLAS-1342 Titan Solrclient - Add timeouts for zookeeper connect and session (sumasai)
...
...
webapp/src/test/java/org/apache/atlas/web/resources/AdminJerseyResourceIT.java
View file @
28410df5
...
@@ -37,7 +37,7 @@ public class AdminJerseyResourceIT extends BaseResourceIT {
...
@@ -37,7 +37,7 @@ public class AdminJerseyResourceIT extends BaseResourceIT {
@Test
@Test
public
void
testGetVersion
()
throws
Exception
{
public
void
testGetVersion
()
throws
Exception
{
JSONObject
response
=
serviceClient
.
callAPI
(
AtlasClient
.
API
.
VERSION
,
null
,
(
String
[])
null
);
JSONObject
response
=
serviceClient
.
callAPI
WithBodyAndParams
(
AtlasClient
.
API
.
VERSION
,
null
,
(
String
[])
null
);
Assert
.
assertNotNull
(
response
);
Assert
.
assertNotNull
(
response
);
PropertiesConfiguration
buildConfiguration
=
new
PropertiesConfiguration
(
"atlas-buildinfo.properties"
);
PropertiesConfiguration
buildConfiguration
=
new
PropertiesConfiguration
(
"atlas-buildinfo.properties"
);
...
...
webapp/src/test/java/org/apache/atlas/web/resources/DataSetLineageJerseyResourceIT.java
View file @
28410df5
...
@@ -59,7 +59,7 @@ public class DataSetLineageJerseyResourceIT extends BaseResourceIT {
...
@@ -59,7 +59,7 @@ public class DataSetLineageJerseyResourceIT extends BaseResourceIT {
@Test
@Test
public
void
testInputsGraph
()
throws
Exception
{
public
void
testInputsGraph
()
throws
Exception
{
JSONObject
response
=
serviceClient
.
callAPI
(
AtlasClient
.
API
.
NAME_LINEAGE_INPUTS_GRAPH
,
null
,
salesMonthlyTable
,
"inputs"
,
"graph"
);
JSONObject
response
=
serviceClient
.
callAPI
WithBodyAndParams
(
AtlasClient
.
API
.
NAME_LINEAGE_INPUTS_GRAPH
,
null
,
salesMonthlyTable
,
"inputs"
,
"graph"
);
Assert
.
assertNotNull
(
response
);
Assert
.
assertNotNull
(
response
);
System
.
out
.
println
(
"inputs graph = "
+
response
);
System
.
out
.
println
(
"inputs graph = "
+
response
);
...
@@ -95,7 +95,7 @@ public class DataSetLineageJerseyResourceIT extends BaseResourceIT {
...
@@ -95,7 +95,7 @@ public class DataSetLineageJerseyResourceIT extends BaseResourceIT {
@Test
@Test
public
void
testOutputsGraph
()
throws
Exception
{
public
void
testOutputsGraph
()
throws
Exception
{
JSONObject
response
=
serviceClient
.
callAPI
(
AtlasClient
.
API
.
NAME_LINEAGE_OUTPUTS_GRAPH
,
null
,
salesFactTable
,
"outputs"
,
"graph"
);
JSONObject
response
=
serviceClient
.
callAPI
WithBodyAndParams
(
AtlasClient
.
API
.
NAME_LINEAGE_OUTPUTS_GRAPH
,
null
,
salesFactTable
,
"outputs"
,
"graph"
);
Assert
.
assertNotNull
(
response
);
Assert
.
assertNotNull
(
response
);
System
.
out
.
println
(
"outputs graph= "
+
response
);
System
.
out
.
println
(
"outputs graph= "
+
response
);
...
@@ -131,7 +131,7 @@ public class DataSetLineageJerseyResourceIT extends BaseResourceIT {
...
@@ -131,7 +131,7 @@ public class DataSetLineageJerseyResourceIT extends BaseResourceIT {
@Test
@Test
public
void
testSchema
()
throws
Exception
{
public
void
testSchema
()
throws
Exception
{
JSONObject
response
=
serviceClient
.
callAPI
(
AtlasClient
.
API
.
NAME_LINEAGE_SCHEMA
,
null
,
salesFactTable
,
"schema"
);
JSONObject
response
=
serviceClient
.
callAPI
WithBodyAndParams
(
AtlasClient
.
API
.
NAME_LINEAGE_SCHEMA
,
null
,
salesFactTable
,
"schema"
);
Assert
.
assertNotNull
(
response
);
Assert
.
assertNotNull
(
response
);
System
.
out
.
println
(
"schema = "
+
response
);
System
.
out
.
println
(
"schema = "
+
response
);
...
@@ -175,12 +175,12 @@ public class DataSetLineageJerseyResourceIT extends BaseResourceIT {
...
@@ -175,12 +175,12 @@ public class DataSetLineageJerseyResourceIT extends BaseResourceIT {
@Test
(
expectedExceptions
=
AtlasServiceException
.
class
)
@Test
(
expectedExceptions
=
AtlasServiceException
.
class
)
public
void
testSchemaForInvalidTable
()
throws
Exception
{
public
void
testSchemaForInvalidTable
()
throws
Exception
{
JSONObject
response
=
serviceClient
.
callAPI
(
AtlasClient
.
API
.
NAME_LINEAGE_SCHEMA
,
null
,
"blah"
,
"schema"
);
JSONObject
response
=
serviceClient
.
callAPI
WithBodyAndParams
(
AtlasClient
.
API
.
NAME_LINEAGE_SCHEMA
,
null
,
"blah"
,
"schema"
);
}
}
@Test
(
expectedExceptions
=
AtlasServiceException
.
class
)
@Test
(
expectedExceptions
=
AtlasServiceException
.
class
)
public
void
testSchemaForDB
()
throws
Exception
{
public
void
testSchemaForDB
()
throws
Exception
{
JSONObject
response
=
serviceClient
.
callAPI
(
AtlasClient
.
API
.
NAME_LINEAGE_SCHEMA
,
null
,
salesDBName
,
"schema"
);
JSONObject
response
=
serviceClient
.
callAPI
WithBodyAndParams
(
AtlasClient
.
API
.
NAME_LINEAGE_SCHEMA
,
null
,
salesDBName
,
"schema"
);
}
}
private
void
setupInstances
()
throws
Exception
{
private
void
setupInstances
()
throws
Exception
{
...
...
webapp/src/test/java/org/apache/atlas/web/resources/EntityJerseyResourceIT.java
View file @
28410df5
...
@@ -24,6 +24,7 @@ import com.google.gson.Gson;
...
@@ -24,6 +24,7 @@ import com.google.gson.Gson;
import
com.google.gson.JsonSyntaxException
;
import
com.google.gson.JsonSyntaxException
;
import
com.google.inject.Inject
;
import
com.google.inject.Inject
;
import
com.sun.jersey.api.client.ClientResponse
;
import
com.sun.jersey.api.client.ClientResponse
;
import
com.sun.jersey.core.util.MultivaluedMapImpl
;
import
org.apache.atlas.AtlasClient
;
import
org.apache.atlas.AtlasClient
;
import
org.apache.atlas.AtlasServiceException
;
import
org.apache.atlas.AtlasServiceException
;
import
org.apache.atlas.EntityAuditEvent
;
import
org.apache.atlas.EntityAuditEvent
;
...
@@ -60,6 +61,7 @@ import org.testng.annotations.DataProvider;
...
@@ -60,6 +61,7 @@ import org.testng.annotations.DataProvider;
import
org.testng.annotations.Guice
;
import
org.testng.annotations.Guice
;
import
org.testng.annotations.Test
;
import
org.testng.annotations.Test
;
import
javax.ws.rs.core.MultivaluedMap
;
import
javax.ws.rs.core.Response
;
import
javax.ws.rs.core.Response
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.HashMap
;
...
@@ -169,7 +171,7 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
...
@@ -169,7 +171,7 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
databaseInstance
.
set
(
"location"
,
"/tmp"
);
databaseInstance
.
set
(
"location"
,
"/tmp"
);
JSONObject
response
=
serviceClient
JSONObject
response
=
serviceClient
.
callAPI
(
AtlasClient
.
API
.
CREATE_ENTITY
,
InstanceSerialization
.
toJson
(
databaseInstance
,
true
));
.
callAPI
WithBody
(
AtlasClient
.
API
.
CREATE_ENTITY
,
InstanceSerialization
.
toJson
(
databaseInstance
,
true
));
assertNotNull
(
response
);
assertNotNull
(
response
);
Assert
.
assertNotNull
(
response
.
get
(
AtlasClient
.
REQUEST_ID
));
Assert
.
assertNotNull
(
response
.
get
(
AtlasClient
.
REQUEST_ID
));
...
@@ -322,7 +324,7 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
...
@@ -322,7 +324,7 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
String
description
=
"bar table - new desc"
;
String
description
=
"bar table - new desc"
;
addProperty
(
guid
,
"description"
,
description
);
addProperty
(
guid
,
"description"
,
description
);
JSONObject
response
=
serviceClient
.
callAPI
(
AtlasClient
.
API
.
GET_ENTITY
,
null
,
guid
);
JSONObject
response
=
serviceClient
.
callAPI
WithBodyAndParams
(
AtlasClient
.
API
.
GET_ENTITY
,
null
,
guid
);
Assert
.
assertNotNull
(
response
);
Assert
.
assertNotNull
(
response
);
tableInstance
.
set
(
"description"
,
description
);
tableInstance
.
set
(
"description"
,
description
);
...
@@ -338,7 +340,7 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
...
@@ -338,7 +340,7 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
String
currentTime
=
String
.
valueOf
(
new
DateTime
()
);
String
currentTime
=
String
.
valueOf
(
new
DateTime
()
);
addProperty
(
guid
,
"createTime"
,
currentTime
);
addProperty
(
guid
,
"createTime"
,
currentTime
);
response
=
serviceClient
.
callAPI
(
AtlasClient
.
API
.
GET_ENTITY
,
null
,
guid
);
response
=
serviceClient
.
callAPI
WithBodyAndParams
(
AtlasClient
.
API
.
GET_ENTITY
,
null
,
guid
);
Assert
.
assertNotNull
(
response
);
Assert
.
assertNotNull
(
response
);
tableInstance
.
set
(
"createTime"
,
currentTime
);
tableInstance
.
set
(
"createTime"
,
currentTime
);
...
@@ -390,7 +392,7 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
...
@@ -390,7 +392,7 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
@Test
(
dependsOnMethods
=
"testSubmitEntity"
)
@Test
(
dependsOnMethods
=
"testSubmitEntity"
)
public
void
testGetEntityDefinition
()
throws
Exception
{
public
void
testGetEntityDefinition
()
throws
Exception
{
final
String
guid
=
tableId
.
_getId
();
final
String
guid
=
tableId
.
_getId
();
JSONObject
response
=
serviceClient
.
callAPI
(
AtlasClient
.
API
.
GET_ENTITY
,
null
,
guid
);
JSONObject
response
=
serviceClient
.
callAPI
WithBodyAndParams
(
AtlasClient
.
API
.
GET_ENTITY
,
null
,
guid
);
Assert
.
assertNotNull
(
response
);
Assert
.
assertNotNull
(
response
);
Assert
.
assertNotNull
(
response
.
get
(
AtlasClient
.
REQUEST_ID
));
Assert
.
assertNotNull
(
response
.
get
(
AtlasClient
.
REQUEST_ID
));
...
@@ -410,7 +412,7 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
...
@@ -410,7 +412,7 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
@Test
(
expectedExceptions
=
AtlasServiceException
.
class
)
@Test
(
expectedExceptions
=
AtlasServiceException
.
class
)
public
void
testGetInvalidEntityDefinition
()
throws
Exception
{
public
void
testGetInvalidEntityDefinition
()
throws
Exception
{
JSONObject
response
=
serviceClient
.
callAPI
(
AtlasClient
.
API
.
GET_ENTITY
,
null
,
"blah"
);
JSONObject
response
=
serviceClient
.
callAPI
WithBodyAndParams
(
AtlasClient
.
API
.
GET_ENTITY
,
null
,
"blah"
);
Assert
.
assertNotNull
(
response
);
Assert
.
assertNotNull
(
response
);
...
@@ -430,7 +432,7 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
...
@@ -430,7 +432,7 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
Map
<
String
,
String
>
queryParams
=
new
HashMap
<>();
Map
<
String
,
String
>
queryParams
=
new
HashMap
<>();
queryParams
.
put
(
"type"
,
"blah"
);
queryParams
.
put
(
"type"
,
"blah"
);
JSONObject
response
=
serviceClient
.
callAPI
(
AtlasClient
.
API
.
GET_ENTITY
,
queryParams
);
JSONObject
response
=
serviceClient
.
callAPI
WithBody
(
AtlasClient
.
API
.
GET_ENTITY
,
queryParams
);
assertNotNull
(
response
);
assertNotNull
(
response
);
Assert
.
assertNotNull
(
response
.
get
(
AtlasClient
.
ERROR
));
Assert
.
assertNotNull
(
response
.
get
(
AtlasClient
.
ERROR
));
Assert
.
assertNotNull
(
response
.
get
(
AtlasClient
.
STACKTRACE
));
Assert
.
assertNotNull
(
response
.
get
(
AtlasClient
.
STACKTRACE
));
...
@@ -441,10 +443,10 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
...
@@ -441,10 +443,10 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
public
void
testGetEntityListForNoInstances
()
throws
Exception
{
public
void
testGetEntityListForNoInstances
()
throws
Exception
{
String
typeName
=
addNewType
();
String
typeName
=
addNewType
();
M
ap
<
String
,
String
>
queryParams
=
new
HashMap
<>
();
M
ultivaluedMap
<
String
,
String
>
queryParams
=
new
MultivaluedMapImpl
();
queryParams
.
put
(
"type"
,
typeName
);
queryParams
.
add
(
"type"
,
typeName
);
JSONObject
response
=
serviceClient
.
callAPI
(
AtlasClient
.
API
.
GET_ENTITY
,
queryParams
);
JSONObject
response
=
serviceClient
.
callAPI
WithQueryParams
(
AtlasClient
.
API
.
GET_ENTITY
,
queryParams
);
assertNotNull
(
response
);
assertNotNull
(
response
);
Assert
.
assertNotNull
(
response
.
get
(
AtlasClient
.
REQUEST_ID
));
Assert
.
assertNotNull
(
response
.
get
(
AtlasClient
.
REQUEST_ID
));
...
@@ -468,7 +470,7 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
...
@@ -468,7 +470,7 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
public
void
testGetTraitNames
()
throws
Exception
{
public
void
testGetTraitNames
()
throws
Exception
{
final
String
guid
=
tableId
.
_getId
();
final
String
guid
=
tableId
.
_getId
();
JSONObject
response
=
serviceClient
.
callAPI
(
AtlasClient
.
API
.
LIST_TRAITS
,
null
,
guid
,
TRAITS
);
JSONObject
response
=
serviceClient
.
callAPI
WithBodyAndParams
(
AtlasClient
.
API
.
LIST_TRAITS
,
null
,
guid
,
TRAITS
);
assertNotNull
(
response
);
assertNotNull
(
response
);
Assert
.
assertNotNull
(
response
.
get
(
AtlasClient
.
REQUEST_ID
));
Assert
.
assertNotNull
(
response
.
get
(
AtlasClient
.
REQUEST_ID
));
...
@@ -490,7 +492,7 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
...
@@ -490,7 +492,7 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
LOG
.
debug
(
"traitInstanceAsJSON = "
+
traitInstanceAsJSON
);
LOG
.
debug
(
"traitInstanceAsJSON = "
+
traitInstanceAsJSON
);
final
String
guid
=
tableId
.
_getId
();
final
String
guid
=
tableId
.
_getId
();
JSONObject
response
=
serviceClient
.
callAPI
(
AtlasClient
.
API
.
ADD_TRAITS
,
traitInstanceAsJSON
,
guid
,
TRAITS
);
JSONObject
response
=
serviceClient
.
callAPI
WithBodyAndParams
(
AtlasClient
.
API
.
ADD_TRAITS
,
traitInstanceAsJSON
,
guid
,
TRAITS
);
assertNotNull
(
response
);
assertNotNull
(
response
);
Assert
.
assertNotNull
(
response
.
get
(
AtlasClient
.
REQUEST_ID
));
Assert
.
assertNotNull
(
response
.
get
(
AtlasClient
.
REQUEST_ID
));
...
@@ -511,7 +513,7 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
...
@@ -511,7 +513,7 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
LOG
.
debug
(
"traitInstanceAsJSON = "
+
traitInstanceAsJSON
);
LOG
.
debug
(
"traitInstanceAsJSON = "
+
traitInstanceAsJSON
);
final
String
guid
=
tableId
.
_getId
();
final
String
guid
=
tableId
.
_getId
();
JSONObject
response
=
serviceClient
.
callAPI
(
AtlasClient
.
API
.
ADD_TRAITS
,
traitInstanceAsJSON
,
guid
,
TRAITS
);
JSONObject
response
=
serviceClient
.
callAPI
WithBodyAndParams
(
AtlasClient
.
API
.
ADD_TRAITS
,
traitInstanceAsJSON
,
guid
,
TRAITS
);
assertNotNull
(
response
);
assertNotNull
(
response
);
Struct
traitDef
=
serviceClient
.
getTraitDefinition
(
guid
,
traitName
);
Struct
traitDef
=
serviceClient
.
getTraitDefinition
(
guid
,
traitName
);
System
.
out
.
println
(
traitDef
.
toString
());
System
.
out
.
println
(
traitDef
.
toString
());
...
@@ -533,7 +535,7 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
...
@@ -533,7 +535,7 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
LOG
.
debug
(
"traitInstanceAsJSON = "
+
traitInstanceAsJSON
);
LOG
.
debug
(
"traitInstanceAsJSON = "
+
traitInstanceAsJSON
);
final
String
guid
=
tableId
.
_getId
();
final
String
guid
=
tableId
.
_getId
();
JSONObject
response
=
serviceClient
.
callAPI
(
AtlasClient
.
API
.
ADD_TRAITS
,
traitInstanceAsJSON
,
guid
,
TRAITS
);
JSONObject
response
=
serviceClient
.
callAPI
WithBodyAndParams
(
AtlasClient
.
API
.
ADD_TRAITS
,
traitInstanceAsJSON
,
guid
,
TRAITS
);
assertNotNull
(
response
);
assertNotNull
(
response
);
}
}
...
@@ -553,12 +555,12 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
...
@@ -553,12 +555,12 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
LOG
.
debug
(
"traitInstanceAsJSON = "
+
traitInstanceAsJSON
);
LOG
.
debug
(
"traitInstanceAsJSON = "
+
traitInstanceAsJSON
);
final
String
guid
=
tableId
.
_getId
();
final
String
guid
=
tableId
.
_getId
();
JSONObject
response
=
serviceClient
.
callAPI
(
AtlasClient
.
API
.
ADD_TRAITS
,
traitInstanceAsJSON
,
guid
,
TRAITS
);
JSONObject
response
=
serviceClient
.
callAPI
WithBodyAndParams
(
AtlasClient
.
API
.
ADD_TRAITS
,
traitInstanceAsJSON
,
guid
,
TRAITS
);
assertNotNull
(
response
);
assertNotNull
(
response
);
Assert
.
assertNotNull
(
response
.
get
(
AtlasClient
.
REQUEST_ID
));
Assert
.
assertNotNull
(
response
.
get
(
AtlasClient
.
REQUEST_ID
));
// verify the response
// verify the response
response
=
serviceClient
.
callAPI
(
AtlasClient
.
API
.
GET_ENTITY
,
null
,
guid
);
response
=
serviceClient
.
callAPI
WithBodyAndParams
(
AtlasClient
.
API
.
GET_ENTITY
,
null
,
guid
);
Assert
.
assertNotNull
(
response
.
get
(
AtlasClient
.
REQUEST_ID
));
Assert
.
assertNotNull
(
response
.
get
(
AtlasClient
.
REQUEST_ID
));
final
String
definition
=
response
.
getString
(
AtlasClient
.
DEFINITION
);
final
String
definition
=
response
.
getString
(
AtlasClient
.
DEFINITION
);
...
@@ -581,14 +583,14 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
...
@@ -581,14 +583,14 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
String
traitInstanceAsJSON
=
InstanceSerialization
$
.
MODULE
$
.
toJson
(
traitInstance
,
true
);
String
traitInstanceAsJSON
=
InstanceSerialization
$
.
MODULE
$
.
toJson
(
traitInstance
,
true
);
LOG
.
debug
(
"traitInstanceAsJSON = "
+
traitInstanceAsJSON
);
LOG
.
debug
(
"traitInstanceAsJSON = "
+
traitInstanceAsJSON
);
JSONObject
response
=
serviceClient
.
callAPI
(
AtlasClient
.
API
.
CREATE_ENTITY
,
traitInstanceAsJSON
,
"random"
,
TRAITS
);
JSONObject
response
=
serviceClient
.
callAPI
WithBodyAndParams
(
AtlasClient
.
API
.
CREATE_ENTITY
,
traitInstanceAsJSON
,
"random"
,
TRAITS
);
}
}
@Test
(
dependsOnMethods
=
"testAddTrait"
)
@Test
(
dependsOnMethods
=
"testAddTrait"
)
public
void
testDeleteTrait
()
throws
Exception
{
public
void
testDeleteTrait
()
throws
Exception
{
final
String
guid
=
tableId
.
_getId
();
final
String
guid
=
tableId
.
_getId
();
JSONObject
response
=
serviceClient
.
callAPI
(
AtlasClient
.
API
.
DELETE_TRAITS
,
null
,
guid
,
TRAITS
,
traitName
);
JSONObject
response
=
serviceClient
.
callAPI
WithBodyAndParams
(
AtlasClient
.
API
.
DELETE_TRAITS
,
null
,
guid
,
TRAITS
,
traitName
);
Assert
.
assertNotNull
(
response
.
get
(
AtlasClient
.
REQUEST_ID
));
Assert
.
assertNotNull
(
response
.
get
(
AtlasClient
.
REQUEST_ID
));
Assert
.
assertNotNull
(
response
.
get
(
"traitName"
));
Assert
.
assertNotNull
(
response
.
get
(
"traitName"
));
assertEntityAudit
(
guid
,
EntityAuditEvent
.
EntityAuditAction
.
TAG_DELETE
);
assertEntityAudit
(
guid
,
EntityAuditEvent
.
EntityAuditAction
.
TAG_DELETE
);
...
@@ -597,7 +599,7 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
...
@@ -597,7 +599,7 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
@Test
(
expectedExceptions
=
AtlasServiceException
.
class
)
@Test
(
expectedExceptions
=
AtlasServiceException
.
class
)
public
void
testDeleteTraitNonExistent
()
throws
Exception
{
public
void
testDeleteTraitNonExistent
()
throws
Exception
{
final
String
traitName
=
"blah_trait"
;
final
String
traitName
=
"blah_trait"
;
JSONObject
response
=
serviceClient
.
callAPI
(
AtlasClient
.
API
.
DELETE_TRAITS
,
null
,
"random"
,
TRAITS
);
JSONObject
response
=
serviceClient
.
callAPI
WithBodyAndParams
(
AtlasClient
.
API
.
DELETE_TRAITS
,
null
,
"random"
,
TRAITS
);
Assert
.
assertNotNull
(
response
.
get
(
AtlasClient
.
ERROR
));
Assert
.
assertNotNull
(
response
.
get
(
AtlasClient
.
ERROR
));
Assert
.
assertEquals
(
response
.
getString
(
AtlasClient
.
ERROR
),
Assert
.
assertEquals
(
response
.
getString
(
AtlasClient
.
ERROR
),
...
@@ -616,9 +618,14 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
...
@@ -616,9 +618,14 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
String
traitDefinitionAsJSON
=
TypesSerialization
$
.
MODULE
$
.
toJson
(
piiTrait
,
true
);
String
traitDefinitionAsJSON
=
TypesSerialization
$
.
MODULE
$
.
toJson
(
piiTrait
,
true
);
createType
(
traitDefinitionAsJSON
);
createType
(
traitDefinitionAsJSON
);
JSONObject
response
=
serviceClient
.
callAPI
(
AtlasClient
.
API
.
DELETE_TRAITS
,
null
,
"random"
,
TRAITS
);
try
{
Assert
.
assertNotNull
(
response
.
get
(
AtlasClient
.
ERROR
));
JSONObject
response
=
serviceClient
.
callAPIWithBodyAndParams
(
AtlasClient
.
API
.
DELETE_TRAITS
,
null
,
guid
,
TRAITS
,
traitName
);
Assert
.
assertNotNull
(
response
.
get
(
AtlasClient
.
STACKTRACE
));
fail
(
"Call should've failed for deletion of invalid trait"
);
}
catch
(
AtlasServiceException
e
)
{
assertNotNull
(
e
);
assertNotNull
(
e
.
getStatus
());
assertEquals
(
e
.
getStatus
(),
ClientResponse
.
Status
.
NOT_FOUND
);
}
}
}
private
String
random
()
{
private
String
random
()
{
...
@@ -643,8 +650,8 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
...
@@ -643,8 +650,8 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
instance
.
set
(
attrName
,
attrValue
);
instance
.
set
(
attrName
,
attrValue
);
Id
guid
=
createInstance
(
instance
);
Id
guid
=
createInstance
(
instance
);
JSONObject
response
=
serviceClient
.
callAPI
(
AtlasClient
.
API
.
GET_ENTITY
,
null
,
guid
.
_getId
());
JSONObject
response
=
serviceClient
.
callAPI
WithBodyAndParams
(
AtlasClient
.
API
.
GET_ENTITY
,
null
,
guid
.
_getId
());
Referenceable
getReferenceable
=
InstanceSerialization
.
fromJsonReferenceable
(
response
.
toString
(
),
true
);
Referenceable
getReferenceable
=
InstanceSerialization
.
fromJsonReferenceable
(
response
.
getString
(
AtlasClient
.
DEFINITION
),
true
);
Assert
.
assertEquals
(
getReferenceable
.
get
(
attrName
),
attrValue
);
Assert
.
assertEquals
(
getReferenceable
.
get
(
attrName
),
attrValue
);
}
}
...
@@ -674,8 +681,8 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
...
@@ -674,8 +681,8 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
assertEquals
(
entityResult
.
getUpdateEntities
().
size
(),
1
);
assertEquals
(
entityResult
.
getUpdateEntities
().
size
(),
1
);
assertEquals
(
entityResult
.
getUpdateEntities
().
get
(
0
),
tableId
.
_getId
());
assertEquals
(
entityResult
.
getUpdateEntities
().
get
(
0
),
tableId
.
_getId
());
JSONObject
response
=
serviceClient
.
callAPI
(
AtlasClient
.
API
.
GET_ENTITY
,
null
,
tableId
.
_getId
());
JSONObject
response
=
serviceClient
.
callAPI
WithBodyAndParams
(
AtlasClient
.
API
.
GET_ENTITY
,
null
,
tableId
.
_getId
());
Referenceable
getReferenceable
=
InstanceSerialization
.
fromJsonReferenceable
(
response
.
toString
(
),
true
);
Referenceable
getReferenceable
=
InstanceSerialization
.
fromJsonReferenceable
(
response
.
getString
(
AtlasClient
.
DEFINITION
),
true
);
List
<
Referenceable
>
refs
=
(
List
<
Referenceable
>)
getReferenceable
.
get
(
"columns"
);
List
<
Referenceable
>
refs
=
(
List
<
Referenceable
>)
getReferenceable
.
get
(
"columns"
);
Assert
.
assertTrue
(
refs
.
get
(
0
).
equalsContents
(
columns
.
get
(
0
)));
Assert
.
assertTrue
(
refs
.
get
(
0
).
equalsContents
(
columns
.
get
(
0
)));
...
@@ -694,8 +701,8 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
...
@@ -694,8 +701,8 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
assertEquals
(
entityResult
.
getUpdateEntities
().
size
(),
2
);
assertEquals
(
entityResult
.
getUpdateEntities
().
size
(),
2
);
assertEquals
(
entityResult
.
getUpdateEntities
().
get
(
0
),
tableId
.
_getId
());
assertEquals
(
entityResult
.
getUpdateEntities
().
get
(
0
),
tableId
.
_getId
());
response
=
serviceClient
.
callAPI
(
AtlasClient
.
API
.
GET_ENTITY
,
null
,
tableId
.
_getId
());
response
=
serviceClient
.
callAPI
WithBodyAndParams
(
AtlasClient
.
API
.
GET_ENTITY
,
null
,
tableId
.
_getId
());
getReferenceable
=
InstanceSerialization
.
fromJsonReferenceable
(
response
.
toString
(
),
true
);
getReferenceable
=
InstanceSerialization
.
fromJsonReferenceable
(
response
.
getString
(
AtlasClient
.
DEFINITION
),
true
);
refs
=
(
List
<
Referenceable
>)
getReferenceable
.
get
(
"columns"
);
refs
=
(
List
<
Referenceable
>)
getReferenceable
.
get
(
"columns"
);
Assert
.
assertTrue
(
refs
.
get
(
0
).
getValuesMap
().
equals
(
values
));
Assert
.
assertTrue
(
refs
.
get
(
0
).
getValuesMap
().
equals
(
values
));
...
@@ -736,7 +743,7 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
...
@@ -736,7 +743,7 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
entityArray
.
put
(
entityJson
);
entityArray
.
put
(
entityJson
);
LOG
.
debug
(
"Replacing entity= "
+
tableInstance
);
LOG
.
debug
(
"Replacing entity= "
+
tableInstance
);
JSONObject
response
=
serviceClient
.
callAPI
(
AtlasClient
.
API
.
UPDATE_ENTITY
,
entityArray
);
JSONObject
response
=
serviceClient
.
callAPI
WithBody
(
AtlasClient
.
API
.
UPDATE_ENTITY
,
entityArray
);
// ATLAS-586: verify response entity can be parsed by GSON.
// ATLAS-586: verify response entity can be parsed by GSON.
Gson
gson
=
new
Gson
();
Gson
gson
=
new
Gson
();
...
@@ -747,8 +754,9 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
...
@@ -747,8 +754,9 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
Assert
.
fail
(
"Response entity from not parse-able by GSON"
,
e
);
Assert
.
fail
(
"Response entity from not parse-able by GSON"
,
e
);
}
}
response
=
serviceClient
.
callAPI
(
AtlasClient
.
API
.
GET_ENTITY
,
null
,
tableId
.
_getId
());
response
=
serviceClient
.
callAPIWithBodyAndParams
(
AtlasClient
.
API
.
GET_ENTITY
,
null
,
tableId
.
_getId
());
Referenceable
getReferenceable
=
InstanceSerialization
.
fromJsonReferenceable
(
response
.
toString
(),
true
);
LOG
.
info
(
"Response = {}"
,
response
.
toString
());
Referenceable
getReferenceable
=
InstanceSerialization
.
fromJsonReferenceable
(
response
.
getString
(
AtlasClient
.
DEFINITION
),
true
);
List
<
Referenceable
>
refs
=
(
List
<
Referenceable
>)
getReferenceable
.
get
(
"columns"
);
List
<
Referenceable
>
refs
=
(
List
<
Referenceable
>)
getReferenceable
.
get
(
"columns"
);
Assert
.
assertEquals
(
refs
.
size
(),
2
);
Assert
.
assertEquals
(
refs
.
size
(),
2
);
...
@@ -795,11 +803,11 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
...
@@ -795,11 +803,11 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
Id
db2Id
=
createInstance
(
db2
);
Id
db2Id
=
createInstance
(
db2
);
// Delete the database entities
// Delete the database entities
M
ap
<
String
,
String
>
queryParams
=
new
HashMap
<>
();
M
ultivaluedMap
<
String
,
String
>
queryParams
=
new
MultivaluedMapImpl
();
queryParams
.
put
(
AtlasClient
.
GUID
.
toLowerCase
(),
db1Id
.
_getId
());
queryParams
.
add
(
AtlasClient
.
GUID
.
toLowerCase
(),
db1Id
.
_getId
());
queryParams
.
put
(
AtlasClient
.
GUID
.
toLowerCase
(),
db2Id
.
_getId
());
queryParams
.
add
(
AtlasClient
.
GUID
.
toLowerCase
(),
db2Id
.
_getId
());
JSONObject
response
=
serviceClient
.
callAPI
(
AtlasClient
.
API
.
DELETE_ENTITIES
,
queryParams
);
JSONObject
response
=
serviceClient
.
callAPI
WithQueryParams
(
AtlasClient
.
API
.
DELETE_ENTITIES
,
queryParams
);
List
<
String
>
deletedGuidsList
=
AtlasClient
.
EntityResult
.
fromString
(
response
.
toString
()).
getDeletedEntities
();
List
<
String
>
deletedGuidsList
=
AtlasClient
.
EntityResult
.
fromString
(
response
.
toString
()).
getDeletedEntities
();
Assert
.
assertTrue
(
deletedGuidsList
.
contains
(
db1Id
.
_getId
()));
Assert
.
assertTrue
(
deletedGuidsList
.
contains
(
db1Id
.
_getId
()));
Assert
.
assertTrue
(
deletedGuidsList
.
contains
(
db2Id
.
_getId
()));
Assert
.
assertTrue
(
deletedGuidsList
.
contains
(
db2Id
.
_getId
()));
...
...
webapp/src/test/java/org/apache/atlas/web/resources/EntityLineageJerseyResourceIT.java
View file @
28410df5
...
@@ -20,6 +20,7 @@ package org.apache.atlas.web.resources;
...
@@ -20,6 +20,7 @@ package org.apache.atlas.web.resources;
import
com.google.common.collect.ImmutableList
;
import
com.google.common.collect.ImmutableList
;
import
com.google.gson.Gson
;
import
com.google.gson.Gson
;
import
com.sun.jersey.core.util.MultivaluedMapImpl
;
import
org.apache.atlas.AtlasClient
;
import
org.apache.atlas.AtlasClient
;
import
org.apache.atlas.model.instance.AtlasEntityHeader
;
import
org.apache.atlas.model.instance.AtlasEntityHeader
;
import
org.apache.atlas.model.lineage.AtlasLineageInfo
;
import
org.apache.atlas.model.lineage.AtlasLineageInfo
;
...
@@ -30,8 +31,8 @@ import org.testng.Assert;
...
@@ -30,8 +31,8 @@ import org.testng.Assert;
import
org.testng.annotations.BeforeClass
;
import
org.testng.annotations.BeforeClass
;
import
org.testng.annotations.Test
;
import
org.testng.annotations.Test
;
import
javax.ws.rs.core.MultivaluedMap
;
import
javax.ws.rs.core.Response
;
import
javax.ws.rs.core.Response
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.Set
;
import
java.util.Set
;
...
@@ -42,7 +43,7 @@ import static org.apache.atlas.AtlasBaseClient.APIInfo;
...
@@ -42,7 +43,7 @@ import static org.apache.atlas.AtlasBaseClient.APIInfo;
* Entity Lineage v2 Integration Tests.
* Entity Lineage v2 Integration Tests.
*/
*/
public
class
EntityLineageJerseyResourceIT
extends
DataSetLineageJerseyResourceIT
{
public
class
EntityLineageJerseyResourceIT
extends
DataSetLineageJerseyResourceIT
{
private
static
final
String
BASE_URI
=
"api/atlas/v2/lineage
/
"
;
private
static
final
String
BASE_URI
=
"api/atlas/v2/lineage"
;
private
static
final
APIInfo
LINEAGE_V2_API
=
new
APIInfo
(
BASE_URI
,
"GET"
,
Response
.
Status
.
OK
);
private
static
final
APIInfo
LINEAGE_V2_API
=
new
APIInfo
(
BASE_URI
,
"GET"
,
Response
.
Status
.
OK
);
private
static
final
String
INPUT_DIRECTION
=
"INPUT"
;
private
static
final
String
INPUT_DIRECTION
=
"INPUT"
;
private
static
final
String
OUTPUT_DIRECTION
=
"OUTPUT"
;
private
static
final
String
OUTPUT_DIRECTION
=
"OUTPUT"
;
...
@@ -68,10 +69,10 @@ public class EntityLineageJerseyResourceIT extends DataSetLineageJerseyResourceI
...
@@ -68,10 +69,10 @@ public class EntityLineageJerseyResourceIT extends DataSetLineageJerseyResourceI
String
tableId
=
serviceClient
.
getEntity
(
HIVE_TABLE_TYPE
,
String
tableId
=
serviceClient
.
getEntity
(
HIVE_TABLE_TYPE
,
AtlasClient
.
REFERENCEABLE_ATTRIBUTE_NAME
,
salesMonthlyTable
).
getId
().
_getId
();
AtlasClient
.
REFERENCEABLE_ATTRIBUTE_NAME
,
salesMonthlyTable
).
getId
().
_getId
();
M
ap
<
String
,
String
>
queryParams
=
new
HashMap
<>
();
M
ultivaluedMap
<
String
,
String
>
queryParams
=
new
MultivaluedMapImpl
();
queryParams
.
put
(
DIRECTION_PARAM
,
INPUT_DIRECTION
);
queryParams
.
add
(
DIRECTION_PARAM
,
INPUT_DIRECTION
);
queryParams
.
put
(
DEPTH_PARAM
,
"5"
);
queryParams
.
add
(
DEPTH_PARAM
,
"5"
);
JSONObject
response
=
serviceClient
.
callAPI
(
LINEAGE_V2_API
,
JSONObject
.
class
,
queryParams
);
JSONObject
response
=
serviceClient
.
callAPI
(
LINEAGE_V2_API
,
JSONObject
.
class
,
queryParams
,
tableId
);
Assert
.
assertNotNull
(
response
);
Assert
.
assertNotNull
(
response
);
System
.
out
.
println
(
"input lineage info = "
+
response
System
.
out
.
println
(
"input lineage info = "
+
response
);
);
...
@@ -96,10 +97,10 @@ public class EntityLineageJerseyResourceIT extends DataSetLineageJerseyResourceI
...
@@ -96,10 +97,10 @@ public class EntityLineageJerseyResourceIT extends DataSetLineageJerseyResourceI
String
tableId
=
serviceClient
.
getEntity
(
HIVE_TABLE_TYPE
,
String
tableId
=
serviceClient
.
getEntity
(
HIVE_TABLE_TYPE
,
AtlasClient
.
REFERENCEABLE_ATTRIBUTE_NAME
,
salesFactTable
).
getId
().
_getId
();
AtlasClient
.
REFERENCEABLE_ATTRIBUTE_NAME
,
salesFactTable
).
getId
().
_getId
();
M
ap
<
String
,
String
>
queryParams
=
new
HashMap
<>
();
M
ultivaluedMap
<
String
,
String
>
queryParams
=
new
MultivaluedMapImpl
();
queryParams
.
put
(
DIRECTION_PARAM
,
OUTPUT_DIRECTION
);
queryParams
.
add
(
DIRECTION_PARAM
,
OUTPUT_DIRECTION
);
queryParams
.
put
(
DEPTH_PARAM
,
"5"
);
queryParams
.
add
(
DEPTH_PARAM
,
"5"
);
JSONObject
response
=
serviceClient
.
callAPI
(
LINEAGE_V2_API
,
JSONObject
.
class
,
queryParams
);
JSONObject
response
=
serviceClient
.
callAPI
(
LINEAGE_V2_API
,
JSONObject
.
class
,
queryParams
,
tableId
);
Assert
.
assertNotNull
(
response
);
Assert
.
assertNotNull
(
response
);
System
.
out
.
println
(
"output lineage info = "
+
response
);
System
.
out
.
println
(
"output lineage info = "
+
response
);
...
@@ -124,10 +125,10 @@ public class EntityLineageJerseyResourceIT extends DataSetLineageJerseyResourceI
...
@@ -124,10 +125,10 @@ public class EntityLineageJerseyResourceIT extends DataSetLineageJerseyResourceI
String
tableId
=
serviceClient
.
getEntity
(
HIVE_TABLE_TYPE
,
String
tableId
=
serviceClient
.
getEntity
(
HIVE_TABLE_TYPE
,
AtlasClient
.
REFERENCEABLE_ATTRIBUTE_NAME
,
salesMonthlyTable
).
getId
().
_getId
();
AtlasClient
.
REFERENCEABLE_ATTRIBUTE_NAME
,
salesMonthlyTable
).
getId
().
_getId
();
M
ap
<
String
,
String
>
queryParams
=
new
HashMap
<>
();
M
ultivaluedMap
<
String
,
String
>
queryParams
=
new
MultivaluedMapImpl
();
queryParams
.
put
(
DIRECTION_PARAM
,
BOTH_DIRECTION
);
queryParams
.
add
(
DIRECTION_PARAM
,
BOTH_DIRECTION
);
queryParams
.
put
(
DEPTH_PARAM
,
"5"
);
queryParams
.
add
(
DEPTH_PARAM
,
"5"
);
JSONObject
response
=
serviceClient
.
callAPI
(
LINEAGE_V2_API
,
JSONObject
.
class
,
queryParams
);
JSONObject
response
=
serviceClient
.
callAPI
(
LINEAGE_V2_API
,
JSONObject
.
class
,
queryParams
,
tableId
);
Assert
.
assertNotNull
(
response
);
Assert
.
assertNotNull
(
response
);
System
.
out
.
println
(
"both lineage info = "
+
response
);
System
.
out
.
println
(
"both lineage info = "
+
response
);
...
...
webapp/src/test/java/org/apache/atlas/web/resources/MetadataDiscoveryJerseyResourceIT.java
View file @
28410df5
...
@@ -21,6 +21,7 @@ package org.apache.atlas.web.resources;
...
@@ -21,6 +21,7 @@ package org.apache.atlas.web.resources;
import
com.google.common.collect.ImmutableList
;
import
com.google.common.collect.ImmutableList
;
import
com.google.common.collect.ImmutableSet
;
import
com.google.common.collect.ImmutableSet
;
import
com.sun.jersey.api.client.ClientResponse
;
import
com.sun.jersey.api.client.ClientResponse
;
import
com.sun.jersey.core.util.MultivaluedMapImpl
;
import
org.apache.atlas.AtlasBaseClient
;
import
org.apache.atlas.AtlasBaseClient
;
import
org.apache.atlas.AtlasClient
;
import
org.apache.atlas.AtlasClient
;
import
org.apache.atlas.AtlasServiceException
;
import
org.apache.atlas.AtlasServiceException
;
...
@@ -41,10 +42,9 @@ import org.testng.Assert;
...
@@ -41,10 +42,9 @@ import org.testng.Assert;
import
org.testng.annotations.BeforeClass
;
import
org.testng.annotations.BeforeClass
;
import
org.testng.annotations.Test
;
import
org.testng.annotations.Test
;
import
javax.ws.rs.core.MultivaluedMap
;
import
javax.ws.rs.core.Response
;
import
javax.ws.rs.core.Response
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
static
org
.
testng
.
Assert
.
assertEquals
;
import
static
org
.
testng
.
Assert
.
assertEquals
;
import
static
org
.
testng
.
Assert
.
assertNotNull
;
import
static
org
.
testng
.
Assert
.
assertNotNull
;
...
@@ -73,9 +73,9 @@ public class MetadataDiscoveryJerseyResourceIT extends BaseResourceIT {
...
@@ -73,9 +73,9 @@ public class MetadataDiscoveryJerseyResourceIT extends BaseResourceIT {
@Test
@Test
public
void
testSearchByDSL
()
throws
Exception
{
public
void
testSearchByDSL
()
throws
Exception
{
String
dslQuery
=
"from "
+
DATABASE_TYPE
+
" qualifiedName=\""
+
dbName
+
"\""
;
String
dslQuery
=
"from "
+
DATABASE_TYPE
+
" qualifiedName=\""
+
dbName
+
"\""
;
M
ap
<
String
,
String
>
queryParams
=
new
HashMap
<>
();
M
ultivaluedMap
<
String
,
String
>
queryParams
=
new
MultivaluedMapImpl
();
queryParams
.
put
(
"query"
,
dslQuery
);
queryParams
.
add
(
"query"
,
dslQuery
);
JSONObject
response
=
serviceClient
.
callAPI
(
AtlasClient
.
API
.
SEARCH_DSL
,
queryParams
);
JSONObject
response
=
serviceClient
.
callAPI
WithQueryParams
(
AtlasClient
.
API
.
SEARCH_DSL
,
queryParams
);
Assert
.
assertNotNull
(
response
);
Assert
.
assertNotNull
(
response
);
Assert
.
assertNotNull
(
response
.
get
(
AtlasClient
.
REQUEST_ID
));
Assert
.
assertNotNull
(
response
.
get
(
AtlasClient
.
REQUEST_ID
));
...
@@ -96,9 +96,9 @@ public class MetadataDiscoveryJerseyResourceIT extends BaseResourceIT {
...
@@ -96,9 +96,9 @@ public class MetadataDiscoveryJerseyResourceIT extends BaseResourceIT {
//search without new parameters of limit and offset should work
//search without new parameters of limit and offset should work
String
dslQuery
=
"from "
+
DATABASE_TYPE
+
" qualifiedName=\""
+
dbName
+
"\""
;
String
dslQuery
=
"from "
+
DATABASE_TYPE
+
" qualifiedName=\""
+
dbName
+
"\""
;
M
ap
<
String
,
String
>
queryParams
=
new
HashMap
<>
();
M
ultivaluedMap
<
String
,
String
>
queryParams
=
new
MultivaluedMapImpl
();
queryParams
.
put
(
"query"
,
dslQuery
);
queryParams
.
add
(
"query"
,
dslQuery
);
JSONObject
response
=
serviceClient
.
callAPI
(
AtlasClient
.
API
.
SEARCH_DSL
,
queryParams
);
JSONObject
response
=
serviceClient
.
callAPI
WithQueryParams
(
AtlasClient
.
API
.
SEARCH_DSL
,
queryParams
);
assertNotNull
(
response
);
assertNotNull
(
response
);
//higher limit, all results returned
//higher limit, all results returned
...
@@ -145,19 +145,19 @@ public class MetadataDiscoveryJerseyResourceIT extends BaseResourceIT {
...
@@ -145,19 +145,19 @@ public class MetadataDiscoveryJerseyResourceIT extends BaseResourceIT {
@Test
(
expectedExceptions
=
AtlasServiceException
.
class
)
@Test
(
expectedExceptions
=
AtlasServiceException
.
class
)
public
void
testSearchByDSLForUnknownType
()
throws
Exception
{
public
void
testSearchByDSLForUnknownType
()
throws
Exception
{
String
dslQuery
=
"from blah"
;
String
dslQuery
=
"from blah"
;
M
ap
<
String
,
String
>
queryParams
=
new
HashMap
<>
();
M
ultivaluedMap
<
String
,
String
>
queryParams
=
new
MultivaluedMapImpl
();
queryParams
.
put
(
"query"
,
dslQuery
);
queryParams
.
add
(
"query"
,
dslQuery
);
JSONObject
response
=
serviceClient
.
callAPI
(
AtlasClient
.
API
.
SEARCH_DSL
,
queryParams
);
JSONObject
response
=
serviceClient
.
callAPI
WithQueryParams
(
AtlasClient
.
API
.
SEARCH_DSL
,
queryParams
);
}
}
@Test
@Test
public
void
testSearchUsingGremlin
()
throws
Exception
{
public
void
testSearchUsingGremlin
()
throws
Exception
{
String
query
=
"g.V.has('type', 'hive_db').toList()"
;
String
query
=
"g.V.has('type', 'hive_db').toList()"
;
M
ap
<
String
,
String
>
queryParams
=
new
HashMap
<>
();
M
ultivaluedMap
<
String
,
String
>
queryParams
=
new
MultivaluedMapImpl
();
queryParams
.
put
(
"query"
,
query
);
queryParams
.
add
(
"query"
,
query
);
JSONObject
response
=
serviceClient
.
callAPI
(
AtlasClient
.
API
.
GREMLIN_SEARCH
,
queryParams
);
JSONObject
response
=
serviceClient
.
callAPI
WithQueryParams
(
AtlasClient
.
API
.
GREMLIN_SEARCH
,
queryParams
);
assertNotNull
(
response
);
assertNotNull
(
response
);
Assert
.
assertNotNull
(
response
.
get
(
AtlasClient
.
REQUEST_ID
));
Assert
.
assertNotNull
(
response
.
get
(
AtlasClient
.
REQUEST_ID
));
...
@@ -170,9 +170,9 @@ public class MetadataDiscoveryJerseyResourceIT extends BaseResourceIT {
...
@@ -170,9 +170,9 @@ public class MetadataDiscoveryJerseyResourceIT extends BaseResourceIT {
public
void
testSearchUsingDSL
()
throws
Exception
{
public
void
testSearchUsingDSL
()
throws
Exception
{
//String query = "from dsl_test_type";
//String query = "from dsl_test_type";
String
query
=
"from "
+
DATABASE_TYPE
+
" qualifiedName=\""
+
dbName
+
"\""
;
String
query
=
"from "
+
DATABASE_TYPE
+
" qualifiedName=\""
+
dbName
+
"\""
;
M
ap
<
String
,
String
>
queryParams
=
new
HashMap
<>
();
M
ultivaluedMap
<
String
,
String
>
queryParams
=
new
MultivaluedMapImpl
();
queryParams
.
put
(
"query"
,
query
);
queryParams
.
add
(
"query"
,
query
);
JSONObject
response
=
serviceClient
.
callAPI
(
AtlasClient
.
API
.
SEARCH_DSL
,
queryParams
);
JSONObject
response
=
serviceClient
.
callAPI
WithQueryParams
(
AtlasClient
.
API
.
SEARCH
,
queryParams
);
Assert
.
assertNotNull
(
response
);
Assert
.
assertNotNull
(
response
);
Assert
.
assertNotNull
(
response
.
get
(
AtlasClient
.
REQUEST_ID
));
Assert
.
assertNotNull
(
response
.
get
(
AtlasClient
.
REQUEST_ID
));
...
@@ -184,9 +184,9 @@ public class MetadataDiscoveryJerseyResourceIT extends BaseResourceIT {
...
@@ -184,9 +184,9 @@ public class MetadataDiscoveryJerseyResourceIT extends BaseResourceIT {
@Test
@Test
public
void
testSearchFullTextOnDSLFailure
()
throws
Exception
{
public
void
testSearchFullTextOnDSLFailure
()
throws
Exception
{
String
query
=
"*"
;
String
query
=
"*"
;
M
ap
<
String
,
String
>
queryParams
=
new
HashMap
<>
();
M
ultivaluedMap
<
String
,
String
>
queryParams
=
new
MultivaluedMapImpl
();
queryParams
.
put
(
"query"
,
query
);
queryParams
.
add
(
"query"
,
query
);
JSONObject
response
=
serviceClient
.
callAPI
(
AtlasClient
.
API
.
SEARCH_DSL
,
queryParams
);
JSONObject
response
=
serviceClient
.
callAPI
WithQueryParams
(
AtlasClient
.
API
.
SEARCH
,
queryParams
);
Assert
.
assertNotNull
(
response
);
Assert
.
assertNotNull
(
response
);
Assert
.
assertNotNull
(
response
.
get
(
AtlasClient
.
REQUEST_ID
));
Assert
.
assertNotNull
(
response
.
get
(
AtlasClient
.
REQUEST_ID
));
...
@@ -216,9 +216,9 @@ public class MetadataDiscoveryJerseyResourceIT extends BaseResourceIT {
...
@@ -216,9 +216,9 @@ public class MetadataDiscoveryJerseyResourceIT extends BaseResourceIT {
//API works without limit and offset
//API works without limit and offset
String
query
=
dbName
;
String
query
=
dbName
;
M
ap
<
String
,
String
>
queryParams
=
new
HashMap
<>
();
M
ultivaluedMap
<
String
,
String
>
queryParams
=
new
MultivaluedMapImpl
();
queryParams
.
put
(
"query"
,
query
);
queryParams
.
add
(
"query"
,
query
);
response
=
serviceClient
.
callAPI
(
AtlasClient
.
API
.
SEARCH_FULL_TEXT
,
queryParams
);
response
=
serviceClient
.
callAPI
WithQueryParams
(
AtlasClient
.
API
.
SEARCH_FULL_TEXT
,
queryParams
);
results
=
response
.
getJSONArray
(
AtlasClient
.
RESULTS
);
results
=
response
.
getJSONArray
(
AtlasClient
.
RESULTS
);
assertEquals
(
results
.
length
(),
1
);
assertEquals
(
results
.
length
(),
1
);
...
...
webapp/src/test/java/org/apache/atlas/web/resources/TypedefsJerseyResourceIT.java
View file @
28410df5
...
@@ -19,7 +19,7 @@
...
@@ -19,7 +19,7 @@
package
org
.
apache
.
atlas
.
web
.
resources
;
package
org
.
apache
.
atlas
.
web
.
resources
;
import
com.google.common.collect.ImmutableSet
;
import
com.google.common.collect.ImmutableSet
;
import
com.sun.jersey.core.util.MultivaluedMapImpl
;
import
org.apache.atlas.AtlasServiceException
;
import
org.apache.atlas.AtlasServiceException
;
import
org.apache.atlas.AtlasTypedefClientV2
;
import
org.apache.atlas.AtlasTypedefClientV2
;
import
org.apache.atlas.model.SearchFilter
;
import
org.apache.atlas.model.SearchFilter
;
...
@@ -41,19 +41,13 @@ import org.testng.annotations.AfterClass;
...
@@ -41,19 +41,13 @@ import org.testng.annotations.AfterClass;
import
org.testng.annotations.BeforeClass
;
import
org.testng.annotations.BeforeClass
;
import
org.testng.annotations.Test
;
import
org.testng.annotations.Test
;
import
java.util.Collections
;
import
javax.ws.rs.core.MultivaluedMap
;
import
java.util.HashMap
;
import
java.util.Map
;
import
javax.ws.rs.core.Response
;
import
javax.ws.rs.core.Response
;
import
java.util.Collections
;
import
static
org
.
apache
.
atlas
.
model
.
typedef
.
AtlasStructDef
.
AtlasAttributeDef
.
Cardinality
;
import
static
org
.
apache
.
atlas
.
model
.
typedef
.
AtlasStructDef
.
AtlasAttributeDef
.
Cardinality
;
import
static
org
.
apache
.
atlas
.
type
.
AtlasTypeUtil
.
createClassTypeDef
;
import
static
org
.
apache
.
atlas
.
type
.
AtlasTypeUtil
.
createClassTypeDef
;
import
static
org
.
testng
.
Assert
.
assertEquals
;
import
static
org
.
testng
.
Assert
.*;
import
static
org
.
testng
.
Assert
.
assertFalse
;
import
static
org
.
testng
.
Assert
.
assertNotNull
;
import
static
org
.
testng
.
Assert
.
assertTrue
;
import
static
org
.
testng
.
Assert
.
fail
;
/**
/**
* Integration test for types jersey resource.
* Integration test for types jersey resource.
...
@@ -136,8 +130,8 @@ public class TypedefsJerseyResourceIT extends BaseResourceIT {
...
@@ -136,8 +130,8 @@ public class TypedefsJerseyResourceIT extends BaseResourceIT {
assertEquals
(
updatedTypeDefs
.
getEntityDefs
().
size
(),
atlasTypesDef
.
getEntityDefs
().
size
());
assertEquals
(
updatedTypeDefs
.
getEntityDefs
().
size
(),
atlasTypesDef
.
getEntityDefs
().
size
());
assertEquals
(
updatedTypeDefs
.
getEntityDefs
().
get
(
0
).
getName
(),
atlasTypesDef
.
getEntityDefs
().
get
(
0
).
getName
());
assertEquals
(
updatedTypeDefs
.
getEntityDefs
().
get
(
0
).
getName
(),
atlasTypesDef
.
getEntityDefs
().
get
(
0
).
getName
());
M
ap
<
String
,
String
>
filterParams
=
new
HashMap
<>
();
M
ultivaluedMap
<
String
,
String
>
filterParams
=
new
MultivaluedMapImpl
();
filterParams
.
put
(
SearchFilter
.
PARAM_TYPE
,
"ENTITY"
);
filterParams
.
add
(
SearchFilter
.
PARAM_TYPE
,
"ENTITY"
);
AtlasTypesDef
allTypeDefs
=
clientV2
.
getAllTypeDefs
(
new
SearchFilter
(
filterParams
));
AtlasTypesDef
allTypeDefs
=
clientV2
.
getAllTypeDefs
(
new
SearchFilter
(
filterParams
));
assertNotNull
(
allTypeDefs
);
assertNotNull
(
allTypeDefs
);
Boolean
entityDefFound
=
false
;
Boolean
entityDefFound
=
false
;
...
@@ -265,15 +259,15 @@ public class TypedefsJerseyResourceIT extends BaseResourceIT {
...
@@ -265,15 +259,15 @@ public class TypedefsJerseyResourceIT extends BaseResourceIT {
assertNotNull
(
created
);
assertNotNull
(
created
);
assertEquals
(
created
.
getEntityDefs
().
size
(),
atlasTypesDef
.
getEntityDefs
().
size
());
assertEquals
(
created
.
getEntityDefs
().
size
(),
atlasTypesDef
.
getEntityDefs
().
size
());
M
ap
<
String
,
String
>
searchParams
=
new
HashMap
<>
();
M
ultivaluedMap
<
String
,
String
>
searchParams
=
new
MultivaluedMapImpl
();
searchParams
.
put
(
SearchFilter
.
PARAM_TYPE
,
"CLASS"
);
searchParams
.
add
(
SearchFilter
.
PARAM_TYPE
,
"CLASS"
);
searchParams
.
put
(
SearchFilter
.
PARAM_SUPERTYPE
,
classDefA
.
getName
());
searchParams
.
add
(
SearchFilter
.
PARAM_SUPERTYPE
,
classDefA
.
getName
());
SearchFilter
searchFilter
=
new
SearchFilter
(
searchParams
);
SearchFilter
searchFilter
=
new
SearchFilter
(
searchParams
);
AtlasTypesDef
searchDefs
=
clientV2
.
getAllTypeDefs
(
searchFilter
);
AtlasTypesDef
searchDefs
=
clientV2
.
getAllTypeDefs
(
searchFilter
);
assertNotNull
(
searchDefs
);
assertNotNull
(
searchDefs
);
assertEquals
(
searchDefs
.
getEntityDefs
().
size
(),
2
);
assertEquals
(
searchDefs
.
getEntityDefs
().
size
(),
2
);
searchParams
.
put
(
SearchFilter
.
PARAM_NOT_SUPERTYPE
,
classDefB
.
getName
());
searchParams
.
add
(
SearchFilter
.
PARAM_NOT_SUPERTYPE
,
classDefB
.
getName
());
searchFilter
=
new
SearchFilter
(
searchParams
);
searchFilter
=
new
SearchFilter
(
searchParams
);
searchDefs
=
clientV2
.
getAllTypeDefs
(
searchFilter
);
searchDefs
=
clientV2
.
getAllTypeDefs
(
searchFilter
);
assertNotNull
(
searchDefs
);
assertNotNull
(
searchDefs
);
...
...
webapp/src/test/java/org/apache/atlas/web/resources/TypesJerseyResourceIT.java
View file @
28410df5
...
@@ -81,7 +81,7 @@ public class TypesJerseyResourceIT extends BaseResourceIT {
...
@@ -81,7 +81,7 @@ public class TypesJerseyResourceIT extends BaseResourceIT {
String
typesAsJSON
=
TypesSerialization
.
toJson
(
typeDefinition
,
false
);
String
typesAsJSON
=
TypesSerialization
.
toJson
(
typeDefinition
,
false
);
System
.
out
.
println
(
"typesAsJSON = "
+
typesAsJSON
);
System
.
out
.
println
(
"typesAsJSON = "
+
typesAsJSON
);
JSONObject
response
=
serviceClient
.
callAPI
(
AtlasClient
.
API
.
CREATE_TYPE
,
typesAsJSON
);
JSONObject
response
=
serviceClient
.
callAPI
WithBody
(
AtlasClient
.
API
.
CREATE_TYPE
,
typesAsJSON
);
Assert
.
assertNotNull
(
response
);
Assert
.
assertNotNull
(
response
);
...
@@ -142,7 +142,7 @@ public class TypesJerseyResourceIT extends BaseResourceIT {
...
@@ -142,7 +142,7 @@ public class TypesJerseyResourceIT extends BaseResourceIT {
for
(
HierarchicalTypeDefinition
typeDefinition
:
typeDefinitions
)
{
for
(
HierarchicalTypeDefinition
typeDefinition
:
typeDefinitions
)
{
System
.
out
.
println
(
"typeName = "
+
typeDefinition
.
typeName
);
System
.
out
.
println
(
"typeName = "
+
typeDefinition
.
typeName
);
JSONObject
response
=
serviceClient
.
callAPI
(
AtlasClient
.
API
.
LIST_TYPES
,
null
,
typeDefinition
.
typeName
);
JSONObject
response
=
serviceClient
.
callAPI
WithBodyAndParams
(
AtlasClient
.
API
.
LIST_TYPES
,
null
,
typeDefinition
.
typeName
);
Assert
.
assertNotNull
(
response
);
Assert
.
assertNotNull
(
response
);
Assert
.
assertNotNull
(
response
.
get
(
AtlasClient
.
DEFINITION
));
Assert
.
assertNotNull
(
response
.
get
(
AtlasClient
.
DEFINITION
));
...
@@ -164,12 +164,12 @@ public class TypesJerseyResourceIT extends BaseResourceIT {
...
@@ -164,12 +164,12 @@ public class TypesJerseyResourceIT extends BaseResourceIT {
@Test
(
expectedExceptions
=
AtlasServiceException
.
class
)
@Test
(
expectedExceptions
=
AtlasServiceException
.
class
)
public
void
testGetDefinitionForNonexistentType
()
throws
Exception
{
public
void
testGetDefinitionForNonexistentType
()
throws
Exception
{
JSONObject
response
=
serviceClient
.
callAPI
(
AtlasClient
.
API
.
LIST_TYPES
,
null
,
"blah"
);
JSONObject
response
=
serviceClient
.
callAPI
WithBodyAndParams
(
AtlasClient
.
API
.
LIST_TYPES
,
null
,
"blah"
);
}
}
@Test
(
dependsOnMethods
=
"testSubmit"
)
@Test
(
dependsOnMethods
=
"testSubmit"
)
public
void
testGetTypeNames
()
throws
Exception
{
public
void
testGetTypeNames
()
throws
Exception
{
JSONObject
response
=
serviceClient
.
callAPI
(
AtlasClient
.
API
.
LIST_TYPES
,
null
,
(
String
[])
null
);
JSONObject
response
=
serviceClient
.
callAPI
WithBodyAndParams
(
AtlasClient
.
API
.
LIST_TYPES
,
null
,
(
String
[])
null
);
Assert
.
assertNotNull
(
response
);
Assert
.
assertNotNull
(
response
);
Assert
.
assertNotNull
(
response
.
get
(
AtlasClient
.
REQUEST_ID
));
Assert
.
assertNotNull
(
response
.
get
(
AtlasClient
.
REQUEST_ID
));
...
@@ -190,7 +190,7 @@ public class TypesJerseyResourceIT extends BaseResourceIT {
...
@@ -190,7 +190,7 @@ public class TypesJerseyResourceIT extends BaseResourceIT {
Map
<
String
,
String
>
queryParams
=
new
HashMap
<>();
Map
<
String
,
String
>
queryParams
=
new
HashMap
<>();
queryParams
.
put
(
"type"
,
DataTypes
.
TypeCategory
.
TRAIT
.
name
());
queryParams
.
put
(
"type"
,
DataTypes
.
TypeCategory
.
TRAIT
.
name
());
JSONObject
response
=
serviceClient
.
callAPI
(
AtlasClient
.
API
.
LIST_TYPES
,
queryParams
);
JSONObject
response
=
serviceClient
.
callAPI
WithBody
(
AtlasClient
.
API
.
LIST_TYPES
,
queryParams
);
Assert
.
assertNotNull
(
response
);
Assert
.
assertNotNull
(
response
);
Assert
.
assertNotNull
(
response
.
get
(
AtlasClient
.
REQUEST_ID
));
Assert
.
assertNotNull
(
response
.
get
(
AtlasClient
.
REQUEST_ID
));
...
...
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