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
47619ee6
Commit
47619ee6
authored
9 years ago
by
Suma Shivaprasad
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ATLAS-605 Hook Notifications for DELETE entity needs to be supported (sumasai)
parent
ef9ef3c1
master
No related merge requests found
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
91 additions
and
1 deletion
+91
-1
AtlasClient.java
client/src/main/java/org/apache/atlas/AtlasClient.java
+0
-0
NotificationHookConsumer.java
...g/apache/atlas/notification/NotificationHookConsumer.java
+8
-0
HookNotification.java
.../org/apache/atlas/notification/hook/HookNotification.java
+41
-1
release-log.txt
release-log.txt
+1
-0
EntityNotificationIT.java
...a/org/apache/atlas/notification/EntityNotificationIT.java
+19
-0
NotificationHookConsumerIT.java
...apache/atlas/notification/NotificationHookConsumerIT.java
+22
-0
No files found.
client/src/main/java/org/apache/atlas/AtlasClient.java
View file @
47619ee6
This diff is collapsed.
Click to expand it.
notification/src/main/java/org/apache/atlas/notification/NotificationHookConsumer.java
View file @
47619ee6
...
...
@@ -202,6 +202,14 @@ public class NotificationHookConsumer implements Service, ActiveStateChangeHandl
partialUpdateRequest
.
getAttributeValue
(),
partialUpdateRequest
.
getEntity
());
break
;
case
ENTITY_DELETE:
HookNotification
.
EntityDeleteRequest
deleteRequest
=
(
HookNotification
.
EntityDeleteRequest
)
message
;
atlasClient
.
deleteEntity
(
deleteRequest
.
getTypeName
(),
deleteRequest
.
getAttribute
(),
deleteRequest
.
getAttributeValue
());
break
;
case
ENTITY_FULL_UPDATE:
HookNotification
.
EntityUpdateRequest
updateRequest
=
(
HookNotification
.
EntityUpdateRequest
)
message
;
...
...
This diff is collapsed.
Click to expand it.
notification/src/main/java/org/apache/atlas/notification/hook/HookNotification.java
View file @
47619ee6
...
...
@@ -54,6 +54,9 @@ public class HookNotification implements JsonDeserializer<HookNotification.HookN
case
ENTITY_PARTIAL_UPDATE:
return
context
.
deserialize
(
json
,
EntityPartialUpdateRequest
.
class
);
case
ENTITY_DELETE:
return
context
.
deserialize
(
json
,
EntityDeleteRequest
.
class
);
case
TYPE_CREATE:
case
TYPE_UPDATE:
return
context
.
deserialize
(
json
,
TypeRequest
.
class
);
...
...
@@ -67,7 +70,7 @@ public class HookNotification implements JsonDeserializer<HookNotification.HookN
* Type of the hook message.
*/
public
enum
HookNotificationType
{
TYPE_CREATE
,
TYPE_UPDATE
,
ENTITY_CREATE
,
ENTITY_PARTIAL_UPDATE
,
ENTITY_FULL_UPDATE
TYPE_CREATE
,
TYPE_UPDATE
,
ENTITY_CREATE
,
ENTITY_PARTIAL_UPDATE
,
ENTITY_FULL_UPDATE
,
ENTITY_DELETE
}
/**
...
...
@@ -208,4 +211,41 @@ public class HookNotification implements JsonDeserializer<HookNotification.HookN
return
attributeValue
;
}
}
/**
* Hook message for creating new entities.
*/
public
static
class
EntityDeleteRequest
extends
HookNotificationMessage
{
private
String
typeName
;
private
String
attribute
;
private
String
attributeValue
;
private
EntityDeleteRequest
()
{
}
public
EntityDeleteRequest
(
String
user
,
String
typeName
,
String
attribute
,
String
attributeValue
)
{
this
(
HookNotificationType
.
ENTITY_DELETE
,
user
,
typeName
,
attribute
,
attributeValue
);
}
protected
EntityDeleteRequest
(
HookNotificationType
type
,
String
user
,
String
typeName
,
String
attribute
,
String
attributeValue
)
{
super
(
type
,
user
);
this
.
typeName
=
typeName
;
this
.
attribute
=
attribute
;
this
.
attributeValue
=
attributeValue
;
}
public
String
getTypeName
()
{
return
typeName
;
}
public
String
getAttribute
()
{
return
attribute
;
}
public
String
getAttributeValue
()
{
return
attributeValue
;
}
}
}
This diff is collapsed.
Click to expand it.
release-log.txt
View file @
47619ee6
...
...
@@ -13,6 +13,7 @@ ATLAS-409 Atlas will not import avro tables with schema read from a file (dosset
ATLAS-379 Create sqoop and falcon metadata addons (venkatnrangan,bvellanki,sowmyaramesh via shwethags)
ALL CHANGES:
ATLAS-605 Hook Notifications for DELETE entity needs to be supported (sumasai)
ATLAS-607 Add Support for delete entity through a qualifiedName (sumasai via yhemanth)
ATLAS-571 Modify Atlas client for necessary changes in context of HA (yhemanth via sumasai)
ATLAS-620 Disable hbase based entity audit (shwethags)
...
...
This diff is collapsed.
Click to expand it.
webapp/src/test/java/org/apache/atlas/notification/EntityNotificationIT.java
View file @
47619ee6
...
...
@@ -104,6 +104,25 @@ public class EntityNotificationIT extends BaseResourceIT {
newNotificationPredicate
(
EntityNotification
.
OperationType
.
ENTITY_UPDATE
,
HIVE_TABLE_TYPE
,
guid
));
}
@Test
public
void
testDeleteEntity
()
throws
Exception
{
final
String
tableName
=
"table-"
+
randomString
();
Referenceable
tableInstance
=
createHiveTableInstance
(
DATABASE_NAME
,
tableName
);
final
Id
tableId
=
createInstance
(
tableInstance
);
final
String
guid
=
tableId
.
_getId
();
waitForNotification
(
notificationConsumer
,
MAX_WAIT_TIME
,
newNotificationPredicate
(
EntityNotification
.
OperationType
.
ENTITY_CREATE
,
HIVE_TABLE_TYPE
,
guid
));
final
String
property
=
"name"
;
final
String
name
=
(
String
)
tableInstance
.
get
(
property
);
serviceClient
.
deleteEntity
(
HIVE_TABLE_TYPE
,
property
,
name
);
waitForNotification
(
notificationConsumer
,
MAX_WAIT_TIME
,
newNotificationPredicate
(
EntityNotification
.
OperationType
.
ENTITY_DELETE
,
HIVE_TABLE_TYPE
,
guid
));
}
@Test
(
dependsOnMethods
=
"testCreateEntity"
)
public
void
testAddTrait
()
throws
Exception
{
String
superSuperTraitName
=
"SuperTrait"
+
randomString
();
...
...
This diff is collapsed.
Click to expand it.
webapp/src/test/java/org/apache/atlas/notification/NotificationHookConsumerIT.java
View file @
47619ee6
...
...
@@ -126,6 +126,26 @@ public class NotificationHookConsumerIT extends BaseResourceIT {
}
@Test
public
void
testDeleteByQualifiedName
()
throws
Exception
{
final
Referenceable
entity
=
new
Referenceable
(
DATABASE_TYPE
);
final
String
dbName
=
"db"
+
randomString
();
entity
.
set
(
"name"
,
dbName
);
entity
.
set
(
"description"
,
randomString
());
serviceClient
.
createEntity
(
entity
);
sendHookMessage
(
new
HookNotification
.
EntityDeleteRequest
(
TEST_USER
,
DATABASE_TYPE
,
"name"
,
dbName
));
waitFor
(
MAX_WAIT_TIME
,
new
Predicate
()
{
@Override
public
boolean
evaluate
()
throws
Exception
{
JSONArray
results
=
serviceClient
.
searchByDSL
(
String
.
format
(
"%s where name='%s'"
,
DATABASE_TYPE
,
dbName
));
return
results
.
length
()
==
0
;
}
});
}
@Test
public
void
testUpdateEntityFullUpdate
()
throws
Exception
{
Referenceable
entity
=
new
Referenceable
(
DATABASE_TYPE
);
final
String
dbName
=
"db"
+
randomString
();
...
...
@@ -153,4 +173,6 @@ public class NotificationHookConsumerIT extends BaseResourceIT {
assertEquals
(
actualEntity
.
get
(
"description"
),
newEntity
.
get
(
"description"
));
assertEquals
(
actualEntity
.
get
(
"owner"
),
newEntity
.
get
(
"owner"
));
}
}
This diff is collapsed.
Click to expand it.
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