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
68a324e3
Commit
68a324e3
authored
Feb 16, 2017
by
Suma Shivaprasad
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ATLAS-1547 Added tests for Hard delete(sumasai)
parent
90f1566a
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
50 additions
and
56 deletions
+50
-56
release-log.txt
release-log.txt
+2
-1
AtlasEntityStoreV1.java
...e/atlas/repository/store/graph/v1/AtlasEntityStoreV1.java
+1
-1
DeleteHandlerV1.java
...ache/atlas/repository/store/graph/v1/DeleteHandlerV1.java
+2
-2
AtlasDeleteHandlerV1Test.java
...s/repository/store/graph/v1/AtlasDeleteHandlerV1Test.java
+16
-29
SoftDeleteHandlerV1Test.java
...as/repository/store/graph/v1/SoftDeleteHandlerV1Test.java
+29
-22
RequestContextV1.java
...-api/src/main/java/org/apache/atlas/RequestContextV1.java
+0
-1
No files found.
release-log.txt
View file @
68a324e3
...
@@ -9,6 +9,7 @@ ATLAS-1060 Add composite indexes for exact match performance improvements for al
...
@@ -9,6 +9,7 @@ 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-1547 Added tests for hard delete (mneethiraj)
ATLAS-1546 (ATLAS-1546.3.patch)Hive hook should choose appropriate JAAS config if host uses kerberos ticket-cache (nixonrodrigues via kevalbhat)
ATLAS-1546 (ATLAS-1546.3.patch)Hive hook should choose appropriate JAAS config if host uses kerberos ticket-cache (nixonrodrigues via kevalbhat)
ATLAS-1503 Export/import support to copy data between Atlas instances (ashutoshm via mneethiraj)
ATLAS-1503 Export/import support to copy data between Atlas instances (ashutoshm via mneethiraj)
ATLAS-1554 v2 EntityREST implementation for entity partial update (sarathkumarsubramanian via mneethiraj)
ATLAS-1554 v2 EntityREST implementation for entity partial update (sarathkumarsubramanian via mneethiraj)
...
@@ -16,7 +17,7 @@ ATLAS-1547 Fix DeleteHandlerV1 for new model changes and add tests (mneethiraj)
...
@@ -16,7 +17,7 @@ ATLAS-1547 Fix DeleteHandlerV1 for new model changes and add tests (mneethiraj)
ATLAS-1556 Edit entity button not working from search table of tag detail page. (kevalbhatt)
ATLAS-1556 Edit entity button not working from search table of tag detail page. (kevalbhatt)
ATLAS-1559 Regression - If a new tag is created then the earlier tags doesn't render properly (kevalbhatt)
ATLAS-1559 Regression - If a new tag is created then the earlier tags doesn't render properly (kevalbhatt)
ATLAS-1508 Make AtlasADAuthenticationProvider like Ranger ADLdap Methods (gss2002 via mneethiraj)
ATLAS-1508 Make AtlasADAuthenticationProvider like Ranger ADLdap Methods (gss2002 via mneethiraj)
ATLAS-1547 Add tests for DeleteHandlerV1 (sumasai
via mneethiraj
)
ATLAS-1547 Add tests for DeleteHandlerV1 (sumasai)
ATLAS-1557 IDBased resolver should attempt unique-attribute match as well (mneethiraj)
ATLAS-1557 IDBased resolver should attempt unique-attribute match as well (mneethiraj)
ATLAS-1555 Move classification endpoint from Entities API to Entity API and remove Entities API (svimal2106)
ATLAS-1555 Move classification endpoint from Entities API to Entity API and remove Entities API (svimal2106)
ATLAS-1548 Create entity : Change PUT and POST object structure based on new API Changes (kevalbhatt)
ATLAS-1548 Create entity : Change PUT and POST object structure based on new API Changes (kevalbhatt)
...
...
repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasEntityStoreV1.java
View file @
68a324e3
...
@@ -204,7 +204,7 @@ public class AtlasEntityStoreV1 implements AtlasEntityStore {
...
@@ -204,7 +204,7 @@ public class AtlasEntityStoreV1 implements AtlasEntityStore {
@GraphTransaction
@GraphTransaction
public
EntityMutationResponse
deleteByIds
(
final
List
<
String
>
guids
)
throws
AtlasBaseException
{
public
EntityMutationResponse
deleteByIds
(
final
List
<
String
>
guids
)
throws
AtlasBaseException
{
if
(
CollectionUtils
.
isEmpty
(
guids
))
{
if
(
CollectionUtils
.
isEmpty
(
guids
))
{
throw
new
AtlasBaseException
(
AtlasErrorCode
.
IN
STANCE_GUID_NOT_FOUND
,
guids
);
throw
new
AtlasBaseException
(
AtlasErrorCode
.
IN
VALID_PARAMETERS
,
"Guid(s) not specified"
);
}
}
Collection
<
AtlasVertex
>
deletionCandidates
=
new
ArrayList
<>();
Collection
<
AtlasVertex
>
deletionCandidates
=
new
ArrayList
<>();
...
...
repository/src/main/java/org/apache/atlas/repository/store/graph/v1/DeleteHandlerV1.java
View file @
68a324e3
...
@@ -243,9 +243,9 @@ public abstract class DeleteHandlerV1 {
...
@@ -243,9 +243,9 @@ public abstract class DeleteHandlerV1 {
return
!
softDelete
||
forceDelete
;
return
!
softDelete
||
forceDelete
;
}
}
protected
void
deleteEdge
(
AtlasEdge
edge
,
boolean
update
Re
verseAttribute
,
boolean
force
)
throws
AtlasBaseException
{
protected
void
deleteEdge
(
AtlasEdge
edge
,
boolean
update
In
verseAttribute
,
boolean
force
)
throws
AtlasBaseException
{
//update inverse attribute
//update inverse attribute
if
(
update
Re
verseAttribute
)
{
if
(
update
In
verseAttribute
)
{
AtlasEdgeLabel
atlasEdgeLabel
=
new
AtlasEdgeLabel
(
edge
.
getLabel
());
AtlasEdgeLabel
atlasEdgeLabel
=
new
AtlasEdgeLabel
(
edge
.
getLabel
());
AtlasType
parentType
=
typeRegistry
.
getType
(
atlasEdgeLabel
.
getTypeName
());
AtlasType
parentType
=
typeRegistry
.
getType
(
atlasEdgeLabel
.
getTypeName
());
...
...
repository/src/test/java/org/apache/atlas/repository/store/graph/v1/AtlasDeleteHandlerV1Test.java
View file @
68a324e3
...
@@ -25,8 +25,10 @@ import org.apache.atlas.RepositoryMetadataModule;
...
@@ -25,8 +25,10 @@ import org.apache.atlas.RepositoryMetadataModule;
import
org.apache.atlas.RequestContextV1
;
import
org.apache.atlas.RequestContextV1
;
import
org.apache.atlas.TestUtils
;
import
org.apache.atlas.TestUtils
;
import
org.apache.atlas.TestUtilsV2
;
import
org.apache.atlas.TestUtilsV2
;
import
org.apache.atlas.exception.AtlasBaseException
;
import
org.apache.atlas.model.instance.AtlasEntity
;
import
org.apache.atlas.model.instance.AtlasEntity
;
import
org.apache.atlas.model.instance.AtlasEntityHeader
;
import
org.apache.atlas.model.instance.AtlasEntityHeader
;
import
org.apache.atlas.model.instance.AtlasObjectId
;
import
org.apache.atlas.model.instance.AtlasStruct
;
import
org.apache.atlas.model.instance.AtlasStruct
;
import
org.apache.atlas.model.instance.EntityMutationResponse
;
import
org.apache.atlas.model.instance.EntityMutationResponse
;
import
org.apache.atlas.model.instance.EntityMutations
;
import
org.apache.atlas.model.instance.EntityMutations
;
...
@@ -142,11 +144,7 @@ public abstract class AtlasDeleteHandlerV1Test {
...
@@ -142,11 +144,7 @@ public abstract class AtlasDeleteHandlerV1Test {
@BeforeTest
@BeforeTest
public
void
init
()
throws
Exception
{
public
void
init
()
throws
Exception
{
DeleteHandlerV1
deleteHandler
=
getDeleteHandler
(
typeRegistry
);
final
Class
<?
extends
DeleteHandlerV1
>
deleteHandlerImpl
=
AtlasRepositoryConfiguration
.
getDeleteHandlerV1Impl
();
final
Constructor
<?
extends
DeleteHandlerV1
>
deleteHandlerImplConstructor
=
deleteHandlerImpl
.
getConstructor
(
AtlasTypeRegistry
.
class
);
DeleteHandlerV1
deleteHandler
=
deleteHandlerImplConstructor
.
newInstance
(
typeRegistry
);
entityStore
=
new
AtlasEntityStoreV1
(
deleteHandler
,
typeRegistry
);
entityStore
=
new
AtlasEntityStoreV1
(
deleteHandler
,
typeRegistry
);
RequestContextV1
.
clear
();
RequestContextV1
.
clear
();
...
@@ -185,7 +183,6 @@ public abstract class AtlasDeleteHandlerV1Test {
...
@@ -185,7 +183,6 @@ public abstract class AtlasDeleteHandlerV1Test {
EntityMutationResponse
newCreationResponse
=
entityStore
.
createOrUpdate
(
new
AtlasEntityStream
(
newDBEntity
),
false
);
EntityMutationResponse
newCreationResponse
=
entityStore
.
createOrUpdate
(
new
AtlasEntityStream
(
newDBEntity
),
false
);
assertNotEquals
(
newCreationResponse
.
getFirstEntityCreated
().
getGuid
(),
response
.
getFirstEntityCreated
().
getGuid
());
assertNotEquals
(
newCreationResponse
.
getFirstEntityCreated
().
getGuid
(),
response
.
getFirstEntityCreated
().
getGuid
());
//TODO - Enable after GET is ready
//get by unique attribute should return the new entity
//get by unique attribute should return the new entity
ITypedReferenceableInstance
instance
=
metadataService
.
getEntityDefinitionReference
(
TestUtils
.
DATABASE_TYPE
,
"name"
,
(
String
)
dbEntity
.
getAttribute
(
"name"
));
ITypedReferenceableInstance
instance
=
metadataService
.
getEntityDefinitionReference
(
TestUtils
.
DATABASE_TYPE
,
"name"
,
(
String
)
dbEntity
.
getAttribute
(
"name"
));
assertEquals
(
instance
.
getId
().
_getId
(),
newCreationResponse
.
getFirstEntityCreated
().
getGuid
());
assertEquals
(
instance
.
getId
().
_getId
(),
newCreationResponse
.
getFirstEntityCreated
().
getGuid
());
...
@@ -220,9 +217,7 @@ public abstract class AtlasDeleteHandlerV1Test {
...
@@ -220,9 +217,7 @@ public abstract class AtlasDeleteHandlerV1Test {
assertEntityDeleted
(
columnCreated
.
getGuid
());
assertEntityDeleted
(
columnCreated
.
getGuid
());
//TODO - Fix after GET is ready
assertColumnForTestDeleteReference
(
entityStore
.
getById
(
tableCreated
.
getGuid
()));
// ITypedReferenceableInstance tableInstance = repositoryService.getEntityDefinition(tableId);
// assertColumnForTestDeleteReference(tableInstance);
//Deleting table should update process
//Deleting table should update process
AtlasEntity
process
=
TestUtilsV2
.
createProcessEntity
(
null
,
Arrays
.
asList
(
tableCreated
.
getAtlasObjectId
()));
AtlasEntity
process
=
TestUtilsV2
.
createProcessEntity
(
null
,
Arrays
.
asList
(
tableCreated
.
getAtlasObjectId
()));
...
@@ -281,11 +276,11 @@ public abstract class AtlasDeleteHandlerV1Test {
...
@@ -281,11 +276,11 @@ public abstract class AtlasDeleteHandlerV1Test {
assertEquals
(
deletionResponse
.
getUpdatedEntities
().
get
(
0
).
getGuid
(),
tableId
);
assertEquals
(
deletionResponse
.
getUpdatedEntities
().
get
(
0
).
getGuid
(),
tableId
);
assertEntityDeleted
(
colId
);
assertEntityDeleted
(
colId
);
tableInstance
=
metadataService
.
getEntityDefinitionReference
(
TestUtils
.
TABLE_TYPE
,
NAME
,
(
String
)
tableEntity
.
getAttribute
(
NAME
)
);
final
AtlasEntity
.
AtlasEntityWithExtInfo
tableEntityCreated
=
entityStore
.
getById
(
tableId
);
assertDeletedColumn
(
table
Instance
);
assertDeletedColumn
(
table
EntityCreated
);
assertTestDisconnectUnidirectionalArrayReferenceFromClassType
(
assertTestDisconnectUnidirectionalArrayReferenceFromClassType
(
(
List
<
ITypedReferenceableInstance
>)
tableInstance
.
get
(
"columns"
),
colId
);
(
List
<
AtlasObjectId
>)
tableEntityCreated
.
getEntity
().
getAttribute
(
COLUMNS_ATTR_NAME
),
colId
);
//update by removing a column - col1
//update by removing a column - col1
final
AtlasEntity
tableEntity1
=
TestUtilsV2
.
createTableEntity
(
dbEntity
,
(
String
)
tableEntity
.
getAttribute
(
NAME
));
final
AtlasEntity
tableEntity1
=
TestUtilsV2
.
createTableEntity
(
dbEntity
,
(
String
)
tableEntity
.
getAttribute
(
NAME
));
...
@@ -298,7 +293,6 @@ public abstract class AtlasDeleteHandlerV1Test {
...
@@ -298,7 +293,6 @@ public abstract class AtlasDeleteHandlerV1Test {
init
();
init
();
deletionResponse
=
entityStore
.
createOrUpdate
(
new
AtlasEntityStream
(
entitiesInfo1
),
false
);
deletionResponse
=
entityStore
.
createOrUpdate
(
new
AtlasEntityStream
(
entitiesInfo1
),
false
);
//TODO - enable after fixing unique atribute resolver
assertEquals
(
deletionResponse
.
getDeletedEntities
().
size
(),
1
);
assertEquals
(
deletionResponse
.
getDeletedEntities
().
size
(),
1
);
assertEquals
(
deletionResponse
.
getDeletedEntities
().
get
(
0
).
getGuid
(),
column2Created
.
getGuid
());
assertEquals
(
deletionResponse
.
getDeletedEntities
().
get
(
0
).
getGuid
(),
column2Created
.
getGuid
());
assertEntityDeleted
(
colId
);
assertEntityDeleted
(
colId
);
...
@@ -320,18 +314,17 @@ public abstract class AtlasDeleteHandlerV1Test {
...
@@ -320,18 +314,17 @@ public abstract class AtlasDeleteHandlerV1Test {
// Verify that tables and their composite columns have been deleted from the graph Repository.
// Verify that tables and their composite columns have been deleted from the graph Repository.
assertEntityDeleted
(
tableDeleted
.
getGuid
());
assertEntityDeleted
(
tableDeleted
.
getGuid
());
assertEntityDeleted
(
colDeleted
.
getGuid
());
assertEntityDeleted
(
colDeleted
.
getGuid
());
assertTestDeleteEntities
(
tableInstance
);
}
}
protected
abstract
void
assertDeletedColumn
(
ITypedReferenceableInstance
tableInstance
)
throws
Atlas
Exception
;
protected
abstract
void
assertDeletedColumn
(
AtlasEntity
.
AtlasEntityWithExtInfo
tableInstance
)
throws
AtlasException
,
AtlasBase
Exception
;
protected
abstract
void
assertTestDeleteEntities
(
ITypedReferenceableInstance
tableInstance
)
throws
Exception
;
protected
abstract
void
assertTestDeleteEntities
(
AtlasEntity
.
AtlasEntityWithExtInfo
tableInstance
)
throws
Exception
;
protected
abstract
void
assertTableForTestDeleteReference
(
String
tableId
)
throws
Exception
;
protected
abstract
void
assertTableForTestDeleteReference
(
String
tableId
)
throws
Exception
;
protected
abstract
void
assertColumnForTestDeleteReference
(
AtlasEntity
tableInstance
)
protected
abstract
void
assertColumnForTestDeleteReference
(
AtlasEntity
.
AtlasEntityWithExtInfo
tableInstance
)
throws
AtlasException
;
throws
Atlas
Base
Exception
;
protected
abstract
void
assertProcessForTestDeleteReference
(
AtlasEntityHeader
processInstance
)
throws
Exception
;
protected
abstract
void
assertProcessForTestDeleteReference
(
AtlasEntityHeader
processInstance
)
throws
Exception
;
...
@@ -354,9 +347,6 @@ public abstract class AtlasDeleteHandlerV1Test {
...
@@ -354,9 +347,6 @@ public abstract class AtlasDeleteHandlerV1Test {
final
AtlasEntityHeader
janeEmployeeCreated
=
hrDeptCreationResponse
.
getCreatedEntityByTypeNameAndAttribute
(
TestUtilsV2
.
MANAGER_TYPE
,
NAME
,
"Jane"
);
final
AtlasEntityHeader
janeEmployeeCreated
=
hrDeptCreationResponse
.
getCreatedEntityByTypeNameAndAttribute
(
TestUtilsV2
.
MANAGER_TYPE
,
NAME
,
"Jane"
);
final
AtlasEntityHeader
juliusEmployeeCreated
=
hrDeptCreationResponse
.
getUpdatedEntityByTypeNameAndAttribute
(
TestUtilsV2
.
MANAGER_TYPE
,
NAME
,
"Julius"
);
final
AtlasEntityHeader
juliusEmployeeCreated
=
hrDeptCreationResponse
.
getUpdatedEntityByTypeNameAndAttribute
(
TestUtilsV2
.
MANAGER_TYPE
,
NAME
,
"Julius"
);
// ITypedReferenceableInstance hrDeptInstance = metadataService.getEntityDefinition(hrDeptCreationResponse.getFirstCreatedEntityByTypeName(DEPARTMENT_TYPE).getGuid());
// Map<String, String> nameGuidMap = getEmployeeNameGuidMap(hrDeptInstance);
ITypedReferenceableInstance
max
=
metadataService
.
getEntityDefinition
(
maxEmployeeCreated
.
getGuid
());
ITypedReferenceableInstance
max
=
metadataService
.
getEntityDefinition
(
maxEmployeeCreated
.
getGuid
());
String
maxGuid
=
max
.
getId
().
_getId
();
String
maxGuid
=
max
.
getId
().
_getId
();
AtlasVertex
vertex
=
GraphHelper
.
getInstance
().
getVertexForGUID
(
maxGuid
);
AtlasVertex
vertex
=
GraphHelper
.
getInstance
().
getVertexForGUID
(
maxGuid
);
...
@@ -451,7 +441,7 @@ public abstract class AtlasDeleteHandlerV1Test {
...
@@ -451,7 +441,7 @@ public abstract class AtlasDeleteHandlerV1Test {
}
}
return
null
;
return
null
;
}
}
//
protected
abstract
void
assertTestUpdateEntity_MultiplicityOneNonCompositeReference
(
String
janeGuid
)
throws
Exception
;
protected
abstract
void
assertTestUpdateEntity_MultiplicityOneNonCompositeReference
(
String
janeGuid
)
throws
Exception
;
/**
/**
...
@@ -513,8 +503,8 @@ public abstract class AtlasDeleteHandlerV1Test {
...
@@ -513,8 +503,8 @@ public abstract class AtlasDeleteHandlerV1Test {
assertEntityDeleted
(
janeEmployee
.
getGuid
());
assertEntityDeleted
(
janeEmployee
.
getGuid
());
john
=
metadataService
.
getEntityDefinitionReference
(
TestUtilsV2
.
EMPLOYEE_TYPE
,
NAME
,
"John"
);
final
AtlasEntity
.
AtlasEntityWithExtInfo
johnUpdated
=
entityStore
.
getById
(
johnEmployee
.
getGuid
()
);
assertJohnForTestDisconnectBidirectionalReferences
(
john
,
janeEmployee
.
getGuid
());
assertJohnForTestDisconnectBidirectionalReferences
(
john
Updated
,
janeEmployee
.
getGuid
());
}
}
protected
List
<
String
>
extractGuids
(
final
List
<
AtlasEntityHeader
>
updatedEntities
)
{
protected
List
<
String
>
extractGuids
(
final
List
<
AtlasEntityHeader
>
updatedEntities
)
{
...
@@ -525,14 +515,14 @@ public abstract class AtlasDeleteHandlerV1Test {
...
@@ -525,14 +515,14 @@ public abstract class AtlasDeleteHandlerV1Test {
return
guids
;
return
guids
;
}
}
protected
abstract
void
assertJohnForTestDisconnectBidirectionalReferences
(
ITypedReferenceableInstance
john
,
protected
abstract
void
assertJohnForTestDisconnectBidirectionalReferences
(
AtlasEntity
.
AtlasEntityWithExtInfo
john
,
String
janeGuid
)
throws
Exception
;
String
janeGuid
)
throws
Exception
;
protected
abstract
void
assertMaxForTestDisconnectBidirectionalReferences
(
Map
<
String
,
String
>
nameGuidMap
)
protected
abstract
void
assertMaxForTestDisconnectBidirectionalReferences
(
Map
<
String
,
String
>
nameGuidMap
)
throws
Exception
;
throws
Exception
;
protected
abstract
void
assertTestDisconnectUnidirectionalArrayReferenceFromClassType
(
protected
abstract
void
assertTestDisconnectUnidirectionalArrayReferenceFromClassType
(
List
<
ITypedReferenceableInstance
>
columns
,
String
columnGuid
)
;
List
<
AtlasObjectId
>
columns
,
String
columnGuid
)
throws
AtlasBaseException
;
/**
/**
* Verify deleting entities that are the target of a unidirectional class array reference
* Verify deleting entities that are the target of a unidirectional class array reference
...
@@ -768,9 +758,6 @@ public abstract class AtlasDeleteHandlerV1Test {
...
@@ -768,9 +758,6 @@ public abstract class AtlasDeleteHandlerV1Test {
assertEquals
(
deletionResponse
.
getUpdatedEntities
().
size
(),
1
);
assertEquals
(
deletionResponse
.
getUpdatedEntities
().
size
(),
1
);
assertEquals
(
deletionResponse
.
getUpdatedEntities
().
get
(
0
).
getGuid
(),
tableId
);
assertEquals
(
deletionResponse
.
getUpdatedEntities
().
get
(
0
).
getGuid
(),
tableId
);
assertEntityDeleted
(
colId
);
assertEntityDeleted
(
colId
);
tableInstance
=
metadataService
.
getEntityDefinitionReference
(
TestUtils
.
TABLE_TYPE
,
NAME
,
(
String
)
tableEntity
.
getAttribute
(
NAME
));
assertDeletedColumn
(
tableInstance
);
}
}
protected
abstract
void
assertTestDisconnectUnidirectionalArrayReferenceFromStructAndTraitTypes
(
protected
abstract
void
assertTestDisconnectUnidirectionalArrayReferenceFromStructAndTraitTypes
(
...
...
repository/src/test/java/org/apache/atlas/repository/store/graph/v1/SoftDeleteHandlerV1Test.java
View file @
68a324e3
...
@@ -19,7 +19,7 @@ package org.apache.atlas.repository.store.graph.v1;
...
@@ -19,7 +19,7 @@ package org.apache.atlas.repository.store.graph.v1;
import
org.apache.atlas.AtlasClient
;
import
org.apache.atlas.AtlasClient
;
import
org.apache.atlas.
Atlas
Exception
;
import
org.apache.atlas.
exception.AtlasBase
Exception
;
import
org.apache.atlas.model.instance.AtlasEntity
;
import
org.apache.atlas.model.instance.AtlasEntity
;
import
org.apache.atlas.model.instance.AtlasEntityHeader
;
import
org.apache.atlas.model.instance.AtlasEntityHeader
;
import
org.apache.atlas.model.instance.AtlasObjectId
;
import
org.apache.atlas.model.instance.AtlasObjectId
;
...
@@ -28,6 +28,7 @@ import org.apache.atlas.repository.graph.GraphHelper;
...
@@ -28,6 +28,7 @@ import org.apache.atlas.repository.graph.GraphHelper;
import
org.apache.atlas.repository.graphdb.AtlasVertex
;
import
org.apache.atlas.repository.graphdb.AtlasVertex
;
import
org.apache.atlas.services.MetadataService
;
import
org.apache.atlas.services.MetadataService
;
import
org.apache.atlas.type.AtlasTypeRegistry
;
import
org.apache.atlas.type.AtlasTypeRegistry
;
import
org.apache.atlas.typesystem.IReferenceableInstance
;
import
org.apache.atlas.typesystem.IStruct
;
import
org.apache.atlas.typesystem.IStruct
;
import
org.apache.atlas.typesystem.ITypedReferenceableInstance
;
import
org.apache.atlas.typesystem.ITypedReferenceableInstance
;
import
org.apache.atlas.typesystem.ITypedStruct
;
import
org.apache.atlas.typesystem.ITypedStruct
;
...
@@ -54,19 +55,25 @@ public class SoftDeleteHandlerV1Test extends AtlasDeleteHandlerV1Test {
...
@@ -54,19 +55,25 @@ public class SoftDeleteHandlerV1Test extends AtlasDeleteHandlerV1Test {
}
}
@Override
@Override
protected
void
assertDeletedColumn
(
final
ITypedReferenceableInstance
tableInstance
)
throws
AtlasException
{
protected
void
assertDeletedColumn
(
final
AtlasEntity
.
AtlasEntityWithExtInfo
tableInstance
)
throws
AtlasBaseException
{
final
List
<
AtlasObjectId
>
columns
=
(
List
<
AtlasObjectId
>)
tableInstance
.
getEntity
().
getAttribute
(
COLUMNS_ATTR_NAME
);
Assert
.
assertEquals
(
columns
.
size
(),
3
);
final
AtlasEntity
.
AtlasEntityWithExtInfo
colDeleted
=
entityStore
.
getById
(
columns
.
get
(
0
).
getGuid
());
assertEquals
(
colDeleted
.
getEntity
().
getStatus
(),
AtlasEntity
.
Status
.
DELETED
);
}
}
@Override
@Override
protected
void
assertTestDeleteEntities
(
final
ITypedReferenceableInstance
tableInstance
)
throws
Exception
{
protected
void
assertTestDeleteEntities
(
final
AtlasEntity
.
AtlasEntityWithExtInfo
tableInstance
)
throws
Exception
{
//Assert that the deleted table can be fully constructed back
List
<
IReferenceableInstance
>
columns
=
(
List
<
IReferenceableInstance
>)
tableInstance
.
getEntity
().
getAttribute
(
COLUMNS_ATTR_NAME
);
assertEquals
(
columns
.
size
(),
3
);
assertNotNull
(
tableInstance
.
getEntity
().
getAttribute
(
"database"
));
}
}
@Override
@Override
protected
void
assertTableForTestDeleteReference
(
final
String
tableId
)
throws
Exception
{
protected
void
assertTableForTestDeleteReference
(
final
String
tableId
)
throws
Exception
{
//TODO - Fix after GET is ready
ITypedReferenceableInstance
table
=
metadataService
.
getEntityDefinition
(
tableId
);
ITypedReferenceableInstance
table
=
metadataService
.
getEntityDefinition
(
tableId
);
assertNotNull
(
table
.
get
(
NAME
));
assertNotNull
(
table
.
get
(
NAME
));
assertNotNull
(
table
.
get
(
"description"
));
assertNotNull
(
table
.
get
(
"description"
));
...
@@ -84,14 +91,12 @@ public class SoftDeleteHandlerV1Test extends AtlasDeleteHandlerV1Test {
...
@@ -84,14 +91,12 @@ public class SoftDeleteHandlerV1Test extends AtlasDeleteHandlerV1Test {
}
}
@Override
@Override
protected
void
assertColumnForTestDeleteReference
(
final
AtlasEntity
tableInstance
)
throws
AtlasException
{
protected
void
assertColumnForTestDeleteReference
(
final
AtlasEntity
.
AtlasEntityWithExtInfo
tableInstance
)
throws
AtlasBaseException
{
List
<
AtlasObjectId
>
columns
=
(
List
<
AtlasObjectId
>)
tableInstance
.
getEntity
().
getAttribute
(
COLUMNS_ATTR_NAME
);
List
<
AtlasObjectId
>
columns
=
(
List
<
AtlasObjectId
>)
tableInstance
.
getAttribute
(
COLUMNS_ATTR_NAME
);
assertEquals
(
columns
.
size
(),
1
);
assertEquals
(
columns
.
size
(),
1
);
//TODO - Enable after GET is ready
final
AtlasEntity
.
AtlasEntityWithExtInfo
byId
=
entityStore
.
getById
(
columns
.
get
(
0
).
getGuid
());
ITypedReferenceableInstance
colInst
=
metadataService
.
getEntityDefinition
(
columns
.
get
(
0
).
getGuid
());
assertEquals
(
byId
.
getEntity
().
getStatus
(),
AtlasEntity
.
Status
.
DELETED
);
assertEquals
(
colInst
.
getId
().
getState
(),
Id
.
EntityState
.
DELETED
);
}
}
@Override
@Override
...
@@ -108,8 +113,6 @@ public class SoftDeleteHandlerV1Test extends AtlasDeleteHandlerV1Test {
...
@@ -108,8 +113,6 @@ public class SoftDeleteHandlerV1Test extends AtlasDeleteHandlerV1Test {
@Override
@Override
protected
void
assertEntityDeleted
(
final
String
id
)
throws
Exception
{
protected
void
assertEntityDeleted
(
final
String
id
)
throws
Exception
{
// ITypedReferenceableInstance entity = metadataService.getEntityDefinition(id);
// assertEquals(entity.getId().getState(), Id.EntityState.DELETED);
final
AtlasEntity
.
AtlasEntityWithExtInfo
byId
=
entityStore
.
getById
(
id
);
final
AtlasEntity
.
AtlasEntityWithExtInfo
byId
=
entityStore
.
getById
(
id
);
assertEquals
(
byId
.
getEntity
().
getStatus
(),
AtlasEntity
.
Status
.
DELETED
);
assertEquals
(
byId
.
getEntity
().
getStatus
(),
AtlasEntity
.
Status
.
DELETED
);
}
}
...
@@ -123,11 +126,14 @@ public class SoftDeleteHandlerV1Test extends AtlasDeleteHandlerV1Test {
...
@@ -123,11 +126,14 @@ public class SoftDeleteHandlerV1Test extends AtlasDeleteHandlerV1Test {
}
}
@Override
@Override
protected
void
assertJohnForTestDisconnectBidirectionalReferences
(
final
ITypedReferenceableInstance
john
,
final
String
janeGuid
)
throws
Exception
{
protected
void
assertJohnForTestDisconnectBidirectionalReferences
(
final
AtlasEntity
.
AtlasEntityWithExtInfo
john
,
final
String
janeGuid
)
throws
Exception
{
Id
mgr
=
(
Id
)
john
.
get
(
"manager"
);
AtlasObjectId
mgr
=
(
AtlasObjectId
)
john
.
getEntity
().
getAttribute
(
"manager"
);
assertNotNull
(
mgr
);
assertNotNull
(
mgr
);
assertEquals
(
mgr
.
_getId
(),
janeGuid
);
assertEquals
(
mgr
.
getGuid
(),
janeGuid
);
assertEquals
(
mgr
.
getState
(),
Id
.
EntityState
.
DELETED
);
final
AtlasEntity
.
AtlasEntityWithExtInfo
mgrEntity
=
entityStore
.
getById
(
mgr
.
getGuid
());
assertEquals
(
mgrEntity
.
getEntity
().
getStatus
(),
AtlasEntity
.
Status
.
DELETED
);
}
}
@Override
@Override
...
@@ -164,13 +170,14 @@ public class SoftDeleteHandlerV1Test extends AtlasDeleteHandlerV1Test {
...
@@ -164,13 +170,14 @@ public class SoftDeleteHandlerV1Test extends AtlasDeleteHandlerV1Test {
}
}
@Override
@Override
protected
void
assertTestDisconnectUnidirectionalArrayReferenceFromClassType
(
final
List
<
ITypedReferenceableInstance
>
columns
,
final
String
columnGuid
)
{
protected
void
assertTestDisconnectUnidirectionalArrayReferenceFromClassType
(
final
List
<
AtlasObjectId
>
columns
,
final
String
columnGuid
)
throws
AtlasBaseException
{
Assert
.
assertEquals
(
columns
.
size
(),
3
);
Assert
.
assertEquals
(
columns
.
size
(),
3
);
for
(
ITypedReferenceableInstance
column
:
columns
)
{
for
(
AtlasObjectId
column
:
columns
)
{
if
(
column
.
getId
().
_getId
().
equals
(
columnGuid
))
{
AtlasEntity
.
AtlasEntityWithExtInfo
columnEntity
=
entityStore
.
getById
(
column
.
getGuid
());
assertEquals
(
column
.
getId
().
getState
(),
Id
.
EntityState
.
DELETED
);
if
(
column
.
getGuid
().
equals
(
columnGuid
))
{
assertEquals
(
columnEntity
.
getEntity
().
getStatus
(),
AtlasEntity
.
Status
.
DELETED
);
}
else
{
}
else
{
assertEquals
(
column
.
getId
().
getState
(),
Id
.
EntityState
.
ACTIVE
);
assertEquals
(
column
Entity
.
getEntity
().
getStatus
(),
AtlasEntity
.
Status
.
ACTIVE
);
}
}
}
}
}
}
...
...
server-api/src/main/java/org/apache/atlas/RequestContextV1.java
View file @
68a324e3
...
@@ -94,7 +94,6 @@ public class RequestContextV1 {
...
@@ -94,7 +94,6 @@ public class RequestContextV1 {
this
.
updatedEntityIds
.
add
(
entityId
);
this
.
updatedEntityIds
.
add
(
entityId
);
}
}
public
void
recordEntityDelete
(
AtlasObjectId
entityId
)
{
public
void
recordEntityDelete
(
AtlasObjectId
entityId
)
{
deletedEntityIds
.
add
(
entityId
);
deletedEntityIds
.
add
(
entityId
);
}
}
...
...
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