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
2b29e4a4
Commit
2b29e4a4
authored
Mar 31, 2019
by
shanjiaqi
Committed by
Madhan Neethiraj
Mar 31, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ATLAS-3109: added option to ignore relationshipAttributes in AtlasEntityStore.getByUniqueAttributes
Signed-off-by:
Madhan Neethiraj
<
madhan@apache.org
>
parent
07192bc8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
51 additions
and
29 deletions
+51
-29
AtlasClientV2.java
...ient-v2/src/main/java/org/apache/atlas/AtlasClientV2.java
+23
-1
AtlasServerService.java
...rg/apache/atlas/repository/impexp/AtlasServerService.java
+1
-1
AtlasEntityStore.java
...apache/atlas/repository/store/graph/AtlasEntityStore.java
+4
-3
AtlasEntityStoreV2.java
...e/atlas/repository/store/graph/v2/AtlasEntityStoreV2.java
+10
-11
EntityREST.java
...p/src/main/java/org/apache/atlas/web/rest/EntityREST.java
+6
-6
TestEntitiesREST.java
.../java/org/apache/atlas/web/adapters/TestEntitiesREST.java
+1
-1
TestEntityREST.java
...st/java/org/apache/atlas/web/adapters/TestEntityREST.java
+4
-4
TestEntityRESTDelete.java
...a/org/apache/atlas/web/adapters/TestEntityRESTDelete.java
+2
-2
No files found.
client/client-v2/src/main/java/org/apache/atlas/AtlasClientV2.java
View file @
2b29e4a4
...
@@ -259,12 +259,28 @@ public class AtlasClientV2 extends AtlasBaseClient {
...
@@ -259,12 +259,28 @@ public class AtlasClientV2 extends AtlasBaseClient {
}
}
public
AtlasEntityWithExtInfo
getEntityByGuid
(
String
guid
)
throws
AtlasServiceException
{
public
AtlasEntityWithExtInfo
getEntityByGuid
(
String
guid
)
throws
AtlasServiceException
{
return
callAPI
(
API_V2
.
GET_ENTITY_BY_GUID
,
AtlasEntityWithExtInfo
.
class
,
null
,
guid
);
return
getEntityByGuid
(
guid
,
false
,
false
);
}
public
AtlasEntityWithExtInfo
getEntityByGuid
(
String
guid
,
boolean
minExtInfo
,
boolean
ignoreRelationships
)
throws
AtlasServiceException
{
MultivaluedMap
<
String
,
String
>
queryParams
=
new
MultivaluedMapImpl
();
queryParams
.
add
(
"minExtInfo"
,
String
.
valueOf
(
minExtInfo
));
queryParams
.
add
(
"ignoreRelationships"
,
String
.
valueOf
(
ignoreRelationships
));
return
callAPI
(
API_V2
.
GET_ENTITY_BY_GUID
,
AtlasEntityWithExtInfo
.
class
,
queryParams
,
guid
);
}
}
public
AtlasEntityWithExtInfo
getEntityByAttribute
(
String
type
,
Map
<
String
,
String
>
attributes
)
throws
AtlasServiceException
{
public
AtlasEntityWithExtInfo
getEntityByAttribute
(
String
type
,
Map
<
String
,
String
>
attributes
)
throws
AtlasServiceException
{
return
getEntityByAttribute
(
type
,
attributes
,
false
,
false
);
}
public
AtlasEntityWithExtInfo
getEntityByAttribute
(
String
type
,
Map
<
String
,
String
>
attributes
,
boolean
minExtInfo
,
boolean
ignoreRelationship
)
throws
AtlasServiceException
{
MultivaluedMap
<
String
,
String
>
queryParams
=
attributesToQueryParams
(
attributes
);
MultivaluedMap
<
String
,
String
>
queryParams
=
attributesToQueryParams
(
attributes
);
queryParams
.
add
(
"minExtInfo"
,
String
.
valueOf
(
minExtInfo
));
queryParams
.
add
(
"ignoreRelationships"
,
String
.
valueOf
(
ignoreRelationship
));
return
callAPI
(
API_V2
.
GET_ENTITY_BY_ATTRIBUTE
,
AtlasEntityWithExtInfo
.
class
,
queryParams
,
type
);
return
callAPI
(
API_V2
.
GET_ENTITY_BY_ATTRIBUTE
,
AtlasEntityWithExtInfo
.
class
,
queryParams
,
type
);
}
}
...
@@ -298,9 +314,15 @@ public class AtlasClientV2 extends AtlasBaseClient {
...
@@ -298,9 +314,15 @@ public class AtlasClientV2 extends AtlasBaseClient {
}
}
public
AtlasEntitiesWithExtInfo
getEntitiesByGuids
(
List
<
String
>
guids
)
throws
AtlasServiceException
{
public
AtlasEntitiesWithExtInfo
getEntitiesByGuids
(
List
<
String
>
guids
)
throws
AtlasServiceException
{
return
getEntitiesByGuids
(
guids
,
false
,
false
);
}
public
AtlasEntitiesWithExtInfo
getEntitiesByGuids
(
List
<
String
>
guids
,
boolean
minExtInfo
,
boolean
ignoreRelationships
)
throws
AtlasServiceException
{
MultivaluedMap
<
String
,
String
>
queryParams
=
new
MultivaluedMapImpl
();
MultivaluedMap
<
String
,
String
>
queryParams
=
new
MultivaluedMapImpl
();
queryParams
.
put
(
"guid"
,
guids
);
queryParams
.
put
(
"guid"
,
guids
);
queryParams
.
add
(
"minExtInfo"
,
String
.
valueOf
(
minExtInfo
));
queryParams
.
add
(
"ignoreRelationships"
,
String
.
valueOf
(
ignoreRelationships
));
return
callAPI
(
API_V2
.
GET_ENTITIES_BY_GUIDS
,
AtlasEntitiesWithExtInfo
.
class
,
queryParams
);
return
callAPI
(
API_V2
.
GET_ENTITIES_BY_GUIDS
,
AtlasEntitiesWithExtInfo
.
class
,
queryParams
);
}
}
...
...
repository/src/main/java/org/apache/atlas/repository/impexp/AtlasServerService.java
View file @
2b29e4a4
...
@@ -105,7 +105,7 @@ public class AtlasServerService {
...
@@ -105,7 +105,7 @@ public class AtlasServerService {
AtlasObjectId
objectId
=
getObjectId
(
server
);
AtlasObjectId
objectId
=
getObjectId
(
server
);
for
(
String
guid
:
entityGuids
)
{
for
(
String
guid
:
entityGuids
)
{
AtlasEntity
.
AtlasEntityWithExtInfo
entityWithExtInfo
=
entityStore
.
getById
(
guid
,
false
);
AtlasEntity
.
AtlasEntityWithExtInfo
entityWithExtInfo
=
entityStore
.
getById
(
guid
,
false
,
true
);
updateAttribute
(
entityWithExtInfo
,
attributeName
,
objectId
);
updateAttribute
(
entityWithExtInfo
,
attributeName
,
objectId
);
}
}
}
}
...
...
repository/src/main/java/org/apache/atlas/repository/store/graph/AtlasEntityStore.java
View file @
2b29e4a4
...
@@ -61,7 +61,7 @@ public interface AtlasEntityStore {
...
@@ -61,7 +61,7 @@ public interface AtlasEntityStore {
* @param isMinExtInfo
* @param isMinExtInfo
* @return AtlasEntity
* @return AtlasEntity
*/
*/
AtlasEntityWithExtInfo
getById
(
String
guid
,
boolean
isMinExtInfo
)
throws
AtlasBaseException
;
AtlasEntityWithExtInfo
getById
(
String
guid
,
boolean
isMinExtInfo
,
boolean
ignoreRelationships
)
throws
AtlasBaseException
;
/**
/**
* Get entity header for the given GUID
* Get entity header for the given GUID
...
@@ -86,7 +86,7 @@ public interface AtlasEntityStore {
...
@@ -86,7 +86,7 @@ public interface AtlasEntityStore {
* @return
* @return
* @throws AtlasBaseException
* @throws AtlasBaseException
*/
*/
AtlasEntitiesWithExtInfo
getByIds
(
List
<
String
>
guid
,
boolean
isMinExtInfo
)
throws
AtlasBaseException
;
AtlasEntitiesWithExtInfo
getByIds
(
List
<
String
>
guid
,
boolean
isMinExtInfo
,
boolean
ignoreRelationships
)
throws
AtlasBaseException
;
/**
/**
*
*
...
@@ -104,9 +104,10 @@ public interface AtlasEntityStore {
...
@@ -104,9 +104,10 @@ public interface AtlasEntityStore {
* @param entityType type of the entity
* @param entityType type of the entity
* @param uniqAttributes Attributes that uniquely identify the entity
* @param uniqAttributes Attributes that uniquely identify the entity
* @param isMinExtInfo
* @param isMinExtInfo
* @param ignoreRelationships ignore relationship attributes
* @return EntityMutationResponse details of the updates performed by this call
* @return EntityMutationResponse details of the updates performed by this call
*/
*/
AtlasEntityWithExtInfo
getByUniqueAttributes
(
AtlasEntityType
entityType
,
Map
<
String
,
Object
>
uniqAttributes
,
boolean
isMinExtInfo
)
AtlasEntityWithExtInfo
getByUniqueAttributes
(
AtlasEntityType
entityType
,
Map
<
String
,
Object
>
uniqAttributes
,
boolean
isMinExtInfo
,
boolean
ignoreRelationships
)
throws
AtlasBaseException
;
throws
AtlasBaseException
;
/**
/**
...
...
repository/src/main/java/org/apache/atlas/repository/store/graph/v2/AtlasEntityStoreV2.java
View file @
2b29e4a4
...
@@ -104,17 +104,17 @@ public class AtlasEntityStoreV2 implements AtlasEntityStore {
...
@@ -104,17 +104,17 @@ public class AtlasEntityStoreV2 implements AtlasEntityStore {
@Override
@Override
@GraphTransaction
@GraphTransaction
public
AtlasEntityWithExtInfo
getById
(
String
guid
)
throws
AtlasBaseException
{
public
AtlasEntityWithExtInfo
getById
(
String
guid
)
throws
AtlasBaseException
{
return
getById
(
guid
,
false
);
return
getById
(
guid
,
false
,
false
);
}
}
@Override
@Override
@GraphTransaction
@GraphTransaction
public
AtlasEntityWithExtInfo
getById
(
final
String
guid
,
final
boolean
isMinExtInfo
)
throws
AtlasBaseException
{
public
AtlasEntityWithExtInfo
getById
(
final
String
guid
,
final
boolean
isMinExtInfo
,
boolean
ignoreRelationships
)
throws
AtlasBaseException
{
if
(
LOG
.
isDebugEnabled
())
{
if
(
LOG
.
isDebugEnabled
())
{
LOG
.
debug
(
"==> getById({}, {})"
,
guid
,
isMinExtInfo
);
LOG
.
debug
(
"==> getById({}, {})"
,
guid
,
isMinExtInfo
);
}
}
EntityGraphRetriever
entityRetriever
=
new
EntityGraphRetriever
(
typeRegistry
);
EntityGraphRetriever
entityRetriever
=
new
EntityGraphRetriever
(
typeRegistry
,
ignoreRelationships
);
AtlasEntityWithExtInfo
ret
=
entityRetriever
.
toAtlasEntityWithExtInfo
(
guid
,
isMinExtInfo
);
AtlasEntityWithExtInfo
ret
=
entityRetriever
.
toAtlasEntityWithExtInfo
(
guid
,
isMinExtInfo
);
...
@@ -158,17 +158,17 @@ public class AtlasEntityStoreV2 implements AtlasEntityStore {
...
@@ -158,17 +158,17 @@ public class AtlasEntityStoreV2 implements AtlasEntityStore {
@Override
@Override
@GraphTransaction
@GraphTransaction
public
AtlasEntitiesWithExtInfo
getByIds
(
List
<
String
>
guids
)
throws
AtlasBaseException
{
public
AtlasEntitiesWithExtInfo
getByIds
(
List
<
String
>
guids
)
throws
AtlasBaseException
{
return
getByIds
(
guids
,
false
);
return
getByIds
(
guids
,
false
,
false
);
}
}
@Override
@Override
@GraphTransaction
@GraphTransaction
public
AtlasEntitiesWithExtInfo
getByIds
(
List
<
String
>
guids
,
boolean
isMinExtInfo
)
throws
AtlasBaseException
{
public
AtlasEntitiesWithExtInfo
getByIds
(
List
<
String
>
guids
,
boolean
isMinExtInfo
,
boolean
ignoreRelationships
)
throws
AtlasBaseException
{
if
(
LOG
.
isDebugEnabled
())
{
if
(
LOG
.
isDebugEnabled
())
{
LOG
.
debug
(
"==> getByIds({}, {})"
,
guids
,
isMinExtInfo
);
LOG
.
debug
(
"==> getByIds({}, {})"
,
guids
,
isMinExtInfo
);
}
}
EntityGraphRetriever
entityRetriever
=
new
EntityGraphRetriever
(
typeRegistry
);
EntityGraphRetriever
entityRetriever
=
new
EntityGraphRetriever
(
typeRegistry
,
ignoreRelationships
);
AtlasEntitiesWithExtInfo
ret
=
entityRetriever
.
toAtlasEntitiesWithExtInfo
(
guids
,
isMinExtInfo
);
AtlasEntitiesWithExtInfo
ret
=
entityRetriever
.
toAtlasEntitiesWithExtInfo
(
guids
,
isMinExtInfo
);
...
@@ -191,26 +191,25 @@ public class AtlasEntityStoreV2 implements AtlasEntityStore {
...
@@ -191,26 +191,25 @@ public class AtlasEntityStoreV2 implements AtlasEntityStore {
@GraphTransaction
@GraphTransaction
public
AtlasEntityWithExtInfo
getByUniqueAttributes
(
AtlasEntityType
entityType
,
Map
<
String
,
Object
>
uniqAttributes
)
public
AtlasEntityWithExtInfo
getByUniqueAttributes
(
AtlasEntityType
entityType
,
Map
<
String
,
Object
>
uniqAttributes
)
throws
AtlasBaseException
{
throws
AtlasBaseException
{
return
getByUniqueAttributes
(
entityType
,
uniqAttributes
,
false
);
return
getByUniqueAttributes
(
entityType
,
uniqAttributes
,
false
,
false
);
}
}
@Override
@Override
@GraphTransaction
@GraphTransaction
public
AtlasEntityWithExtInfo
getByUniqueAttributes
(
AtlasEntityType
entityType
,
Map
<
String
,
Object
>
uniqAttributes
,
boolean
isMinExtInfo
)
public
AtlasEntityWithExtInfo
getByUniqueAttributes
(
AtlasEntityType
entityType
,
Map
<
String
,
Object
>
uniqAttributes
,
boolean
isMinExtInfo
,
boolean
ignoreRelationships
)
throws
AtlasBaseException
{
throws
AtlasBaseException
{
if
(
LOG
.
isDebugEnabled
())
{
if
(
LOG
.
isDebugEnabled
())
{
LOG
.
debug
(
"==> getByUniqueAttribute({}, {})"
,
entityType
.
getTypeName
(),
uniqAttributes
);
LOG
.
debug
(
"==> getByUniqueAttribute({}, {})"
,
entityType
.
getTypeName
(),
uniqAttributes
);
}
}
AtlasVertex
entityVertex
=
AtlasGraphUtilsV2
.
getVertexByUniqueAttributes
(
entityType
,
uniqAttributes
);
AtlasVertex
entityVertex
=
AtlasGraphUtilsV2
.
getVertexByUniqueAttributes
(
entityType
,
uniqAttributes
);
EntityGraphRetriever
entityRetriever
=
new
EntityGraphRetriever
(
typeRegistry
);
EntityGraphRetriever
entityRetriever
=
new
EntityGraphRetriever
(
typeRegistry
,
ignoreRelationships
);
AtlasEntityWithExtInfo
ret
=
entityRetriever
.
toAtlasEntityWithExtInfo
(
entityVertex
,
isMinExtInfo
);
AtlasEntityWithExtInfo
ret
=
entityRetriever
.
toAtlasEntityWithExtInfo
(
entityVertex
,
isMinExtInfo
);
if
(
ret
==
null
)
{
if
(
ret
==
null
)
{
throw
new
AtlasBaseException
(
AtlasErrorCode
.
INSTANCE_BY_UNIQUE_ATTRIBUTE_NOT_FOUND
,
entityType
.
getTypeName
(),
throw
new
AtlasBaseException
(
AtlasErrorCode
.
INSTANCE_BY_UNIQUE_ATTRIBUTE_NOT_FOUND
,
entityType
.
getTypeName
(),
uniqAttributes
.
toString
());
uniqAttributes
.
toString
());
}
}
AtlasAuthorizationUtils
.
verifyAccess
(
new
AtlasEntityAccessRequest
(
typeRegistry
,
AtlasPrivilege
.
ENTITY_READ
,
new
AtlasEntityHeader
(
ret
.
getEntity
())),
"read entity: typeName="
,
entityType
.
getTypeName
(),
", uniqueAttributes="
,
uniqAttributes
);
AtlasAuthorizationUtils
.
verifyAccess
(
new
AtlasEntityAccessRequest
(
typeRegistry
,
AtlasPrivilege
.
ENTITY_READ
,
new
AtlasEntityHeader
(
ret
.
getEntity
())),
"read entity: typeName="
,
entityType
.
getTypeName
(),
", uniqueAttributes="
,
uniqAttributes
);
...
...
webapp/src/main/java/org/apache/atlas/web/rest/EntityREST.java
View file @
2b29e4a4
...
@@ -105,7 +105,7 @@ public class EntityREST {
...
@@ -105,7 +105,7 @@ public class EntityREST {
*/
*/
@GET
@GET
@Path
(
"/guid/{guid}"
)
@Path
(
"/guid/{guid}"
)
public
AtlasEntityWithExtInfo
getById
(
@PathParam
(
"guid"
)
String
guid
,
@QueryParam
(
"minExtInfo"
)
@DefaultValue
(
"false"
)
boolean
minExtInfo
)
throws
AtlasBaseException
{
public
AtlasEntityWithExtInfo
getById
(
@PathParam
(
"guid"
)
String
guid
,
@QueryParam
(
"minExtInfo"
)
@DefaultValue
(
"false"
)
boolean
minExtInfo
,
@QueryParam
(
"ignoreRelationships"
)
@DefaultValue
(
"false"
)
boolean
ignoreRelationships
)
throws
AtlasBaseException
{
Servlets
.
validateQueryParamLength
(
"guid"
,
guid
);
Servlets
.
validateQueryParamLength
(
"guid"
,
guid
);
AtlasPerfTracer
perf
=
null
;
AtlasPerfTracer
perf
=
null
;
...
@@ -115,7 +115,7 @@ public class EntityREST {
...
@@ -115,7 +115,7 @@ public class EntityREST {
perf
=
AtlasPerfTracer
.
getPerfTracer
(
PERF_LOG
,
"EntityREST.getById("
+
guid
+
", "
+
minExtInfo
+
" )"
);
perf
=
AtlasPerfTracer
.
getPerfTracer
(
PERF_LOG
,
"EntityREST.getById("
+
guid
+
", "
+
minExtInfo
+
" )"
);
}
}
return
entitiesStore
.
getById
(
guid
,
minExtInfo
);
return
entitiesStore
.
getById
(
guid
,
minExtInfo
,
ignoreRelationships
);
}
finally
{
}
finally
{
AtlasPerfTracer
.
log
(
perf
);
AtlasPerfTracer
.
log
(
perf
);
}
}
...
@@ -165,7 +165,7 @@ public class EntityREST {
...
@@ -165,7 +165,7 @@ public class EntityREST {
@GET
@GET
@Path
(
"/uniqueAttribute/type/{typeName}"
)
@Path
(
"/uniqueAttribute/type/{typeName}"
)
public
AtlasEntityWithExtInfo
getByUniqueAttributes
(
@PathParam
(
"typeName"
)
String
typeName
,
@QueryParam
(
"minExtInfo"
)
@DefaultValue
(
"false"
)
boolean
minExtInfo
,
public
AtlasEntityWithExtInfo
getByUniqueAttributes
(
@PathParam
(
"typeName"
)
String
typeName
,
@QueryParam
(
"minExtInfo"
)
@DefaultValue
(
"false"
)
boolean
minExtInfo
,
@Context
HttpServletRequest
servletRequest
)
throws
AtlasBaseException
{
@
QueryParam
(
"ignoreRelationships"
)
@DefaultValue
(
"false"
)
boolean
ignoreRelationships
,
@
Context
HttpServletRequest
servletRequest
)
throws
AtlasBaseException
{
Servlets
.
validateQueryParamLength
(
"typeName"
,
typeName
);
Servlets
.
validateQueryParamLength
(
"typeName"
,
typeName
);
AtlasPerfTracer
perf
=
null
;
AtlasPerfTracer
perf
=
null
;
...
@@ -181,7 +181,7 @@ public class EntityREST {
...
@@ -181,7 +181,7 @@ public class EntityREST {
validateUniqueAttribute
(
entityType
,
attributes
);
validateUniqueAttribute
(
entityType
,
attributes
);
return
entitiesStore
.
getByUniqueAttributes
(
entityType
,
attributes
,
minExtInfo
);
return
entitiesStore
.
getByUniqueAttributes
(
entityType
,
attributes
,
minExtInfo
,
ignoreRelationships
);
}
finally
{
}
finally
{
AtlasPerfTracer
.
log
(
perf
);
AtlasPerfTracer
.
log
(
perf
);
}
}
...
@@ -586,7 +586,7 @@ public class EntityREST {
...
@@ -586,7 +586,7 @@ public class EntityREST {
*/
*/
@GET
@GET
@Path
(
"/bulk"
)
@Path
(
"/bulk"
)
public
AtlasEntitiesWithExtInfo
getByGuids
(
@QueryParam
(
"guid"
)
List
<
String
>
guids
,
@QueryParam
(
"minExtInfo"
)
@DefaultValue
(
"false"
)
boolean
minExtInfo
)
throws
AtlasBaseException
{
public
AtlasEntitiesWithExtInfo
getByGuids
(
@QueryParam
(
"guid"
)
List
<
String
>
guids
,
@QueryParam
(
"minExtInfo"
)
@DefaultValue
(
"false"
)
boolean
minExtInfo
,
@QueryParam
(
"ignoreRelationships"
)
@DefaultValue
(
"false"
)
boolean
ignoreRelationships
)
throws
AtlasBaseException
{
if
(
CollectionUtils
.
isNotEmpty
(
guids
))
{
if
(
CollectionUtils
.
isNotEmpty
(
guids
))
{
for
(
String
guid
:
guids
)
{
for
(
String
guid
:
guids
)
{
Servlets
.
validateQueryParamLength
(
"guid"
,
guid
);
Servlets
.
validateQueryParamLength
(
"guid"
,
guid
);
...
@@ -604,7 +604,7 @@ public class EntityREST {
...
@@ -604,7 +604,7 @@ public class EntityREST {
throw
new
AtlasBaseException
(
AtlasErrorCode
.
INSTANCE_GUID_NOT_FOUND
,
guids
);
throw
new
AtlasBaseException
(
AtlasErrorCode
.
INSTANCE_GUID_NOT_FOUND
,
guids
);
}
}
return
entitiesStore
.
getByIds
(
guids
,
minExtInfo
);
return
entitiesStore
.
getByIds
(
guids
,
minExtInfo
,
ignoreRelationships
);
}
finally
{
}
finally
{
AtlasPerfTracer
.
log
(
perf
);
AtlasPerfTracer
.
log
(
perf
);
}
}
...
...
webapp/src/test/java/org/apache/atlas/web/adapters/TestEntitiesREST.java
View file @
2b29e4a4
...
@@ -165,7 +165,7 @@ public class TestEntitiesREST {
...
@@ -165,7 +165,7 @@ public class TestEntitiesREST {
@Test
(
dependsOnMethods
=
"testCreateOrUpdateEntities"
)
@Test
(
dependsOnMethods
=
"testCreateOrUpdateEntities"
)
public
void
testGetEntities
()
throws
Exception
{
public
void
testGetEntities
()
throws
Exception
{
final
AtlasEntitiesWithExtInfo
response
=
entityREST
.
getByGuids
(
createdGuids
,
false
);
final
AtlasEntitiesWithExtInfo
response
=
entityREST
.
getByGuids
(
createdGuids
,
false
,
false
);
final
List
<
AtlasEntity
>
entities
=
response
.
getEntities
();
final
List
<
AtlasEntity
>
entities
=
response
.
getEntities
();
Assert
.
assertNotNull
(
entities
);
Assert
.
assertNotNull
(
entities
);
...
...
webapp/src/test/java/org/apache/atlas/web/adapters/TestEntityREST.java
View file @
2b29e4a4
...
@@ -100,7 +100,7 @@ public class TestEntityREST {
...
@@ -100,7 +100,7 @@ public class TestEntityREST {
@Test
@Test
public
void
testGetEntityById
()
throws
Exception
{
public
void
testGetEntityById
()
throws
Exception
{
createTestEntity
();
createTestEntity
();
AtlasEntityWithExtInfo
response
=
entityREST
.
getById
(
dbEntity
.
getGuid
(),
false
);
AtlasEntityWithExtInfo
response
=
entityREST
.
getById
(
dbEntity
.
getGuid
(),
false
,
false
);
Assert
.
assertNotNull
(
response
);
Assert
.
assertNotNull
(
response
);
Assert
.
assertNotNull
(
response
.
getEntity
());
Assert
.
assertNotNull
(
response
.
getEntity
());
...
@@ -184,7 +184,7 @@ public class TestEntityREST {
...
@@ -184,7 +184,7 @@ public class TestEntityREST {
@Test
(
dependsOnMethods
=
"testAddAndGetClassification"
)
@Test
(
dependsOnMethods
=
"testAddAndGetClassification"
)
public
void
testGetEntityWithAssociations
()
throws
Exception
{
public
void
testGetEntityWithAssociations
()
throws
Exception
{
AtlasEntityWithExtInfo
entity
=
entityREST
.
getById
(
dbEntity
.
getGuid
(),
false
);
AtlasEntityWithExtInfo
entity
=
entityREST
.
getById
(
dbEntity
.
getGuid
(),
false
,
false
);
final
List
<
AtlasClassification
>
retrievedClassifications
=
entity
.
getEntity
().
getClassifications
();
final
List
<
AtlasClassification
>
retrievedClassifications
=
entity
.
getEntity
().
getClassifications
();
Assert
.
assertNotNull
(
retrievedClassifications
);
Assert
.
assertNotNull
(
retrievedClassifications
);
...
@@ -316,7 +316,7 @@ public class TestEntityREST {
...
@@ -316,7 +316,7 @@ public class TestEntityREST {
Assert
.
assertEquals
(
response
.
getEntitiesByOperation
(
EntityMutations
.
EntityOperation
.
PARTIAL_UPDATE
).
get
(
0
).
getGuid
(),
dbGuid
);
Assert
.
assertEquals
(
response
.
getEntitiesByOperation
(
EntityMutations
.
EntityOperation
.
PARTIAL_UPDATE
).
get
(
0
).
getGuid
(),
dbGuid
);
//Get By unique attribute
//Get By unique attribute
AtlasEntityWithExtInfo
entity
=
entityREST
.
getByUniqueAttributes
(
TestUtilsV2
.
DATABASE_TYPE
,
false
,
toHttpServletRequest
(
TestUtilsV2
.
NAME
,
updatedDBName
));
AtlasEntityWithExtInfo
entity
=
entityREST
.
getByUniqueAttributes
(
TestUtilsV2
.
DATABASE_TYPE
,
false
,
false
,
toHttpServletRequest
(
TestUtilsV2
.
NAME
,
updatedDBName
));
Assert
.
assertNotNull
(
entity
);
Assert
.
assertNotNull
(
entity
);
Assert
.
assertNotNull
(
entity
.
getEntity
().
getGuid
());
Assert
.
assertNotNull
(
entity
.
getEntity
().
getGuid
());
Assert
.
assertEquals
(
entity
.
getEntity
().
getGuid
(),
dbGuid
);
Assert
.
assertEquals
(
entity
.
getEntity
().
getGuid
(),
dbGuid
);
...
@@ -341,7 +341,7 @@ public class TestEntityREST {
...
@@ -341,7 +341,7 @@ public class TestEntityREST {
Assert
.
assertEquals
(
response
.
getEntitiesByOperation
(
EntityMutations
.
EntityOperation
.
PARTIAL_UPDATE
).
get
(
0
).
getGuid
(),
dbGuid
);
Assert
.
assertEquals
(
response
.
getEntitiesByOperation
(
EntityMutations
.
EntityOperation
.
PARTIAL_UPDATE
).
get
(
0
).
getGuid
(),
dbGuid
);
//Get By unique attribute
//Get By unique attribute
AtlasEntityWithExtInfo
entity
=
entityREST
.
getByUniqueAttributes
(
TestUtilsV2
.
DATABASE_TYPE
,
false
,
toHttpServletRequest
(
TestUtilsV2
.
NAME
,
updatedDBName
));
AtlasEntityWithExtInfo
entity
=
entityREST
.
getByUniqueAttributes
(
TestUtilsV2
.
DATABASE_TYPE
,
false
,
false
,
toHttpServletRequest
(
TestUtilsV2
.
NAME
,
updatedDBName
));
Assert
.
assertNotNull
(
entity
);
Assert
.
assertNotNull
(
entity
);
Assert
.
assertNotNull
(
entity
.
getEntity
().
getGuid
());
Assert
.
assertNotNull
(
entity
.
getEntity
().
getGuid
());
Assert
.
assertEquals
(
entity
.
getEntity
().
getGuid
(),
dbGuid
);
Assert
.
assertEquals
(
entity
.
getEntity
().
getGuid
(),
dbGuid
);
...
...
webapp/src/test/java/org/apache/atlas/web/adapters/TestEntityRESTDelete.java
View file @
2b29e4a4
...
@@ -71,13 +71,13 @@ public class TestEntityRESTDelete {
...
@@ -71,13 +71,13 @@ public class TestEntityRESTDelete {
}
}
private
void
assertSoftDelete
(
String
guid
)
throws
AtlasBaseException
{
private
void
assertSoftDelete
(
String
guid
)
throws
AtlasBaseException
{
AtlasEntity
.
AtlasEntityWithExtInfo
entity
=
entityREST
.
getById
(
guid
,
false
);
AtlasEntity
.
AtlasEntityWithExtInfo
entity
=
entityREST
.
getById
(
guid
,
false
,
false
);
assertTrue
(
entity
!=
null
&&
entity
.
getEntity
().
getStatus
()
==
AtlasEntity
.
Status
.
DELETED
);
assertTrue
(
entity
!=
null
&&
entity
.
getEntity
().
getStatus
()
==
AtlasEntity
.
Status
.
DELETED
);
}
}
private
void
assertHardDelete
(
String
guid
)
{
private
void
assertHardDelete
(
String
guid
)
{
try
{
try
{
entityREST
.
getById
(
guid
,
false
);
entityREST
.
getById
(
guid
,
false
,
false
);
fail
(
"Entity should have been deleted. Exception should have been thrown."
);
fail
(
"Entity should have been deleted. Exception should have been thrown."
);
}
catch
(
AtlasBaseException
e
)
{
}
catch
(
AtlasBaseException
e
)
{
assertTrue
(
true
);
assertTrue
(
true
);
...
...
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