Repository: sentry
Updated Branches:
  refs/heads/master 782d132ce -> 2de4adff9


http://git-wip-us.apache.org/repos/asf/sentry/blob/2de4adff/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/NotificationProcessor.java
----------------------------------------------------------------------
diff --git 
a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/NotificationProcessor.java
 
b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/NotificationProcessor.java
index d92f23e..d09da5f 100644
--- 
a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/NotificationProcessor.java
+++ 
b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/NotificationProcessor.java
@@ -25,7 +25,7 @@ import com.google.common.collect.Lists;
 import org.apache.commons.lang.StringUtils;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.hive.metastore.api.NotificationEvent;
-import org.apache.hive.hcatalog.messaging.HCatEventMessage.EventType;
+import org.apache.hadoop.hive.metastore.messaging.EventMessage.EventType;
 import 
org.apache.sentry.binding.metastore.messaging.json.SentryJSONAddPartitionMessage;
 import 
org.apache.sentry.binding.metastore.messaging.json.SentryJSONAlterPartitionMessage;
 import 
org.apache.sentry.binding.metastore.messaging.json.SentryJSONAlterTableMessage;

http://git-wip-us.apache.org/repos/asf/sentry/blob/2de4adff/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/SentryHMSClient.java
----------------------------------------------------------------------
diff --git 
a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/SentryHMSClient.java
 
b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/SentryHMSClient.java
index 6ec163b..eccb40f 100644
--- 
a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/SentryHMSClient.java
+++ 
b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/SentryHMSClient.java
@@ -28,6 +28,7 @@ import 
org.apache.hadoop.hive.metastore.api.CurrentNotificationEventId;
 import org.apache.hadoop.hive.metastore.api.MetaException;
 import org.apache.hadoop.hive.metastore.api.NotificationEvent;
 import org.apache.hadoop.hive.metastore.api.NotificationEventResponse;
+import org.apache.hadoop.hive.metastore.messaging.MessageDeserializer;
 import 
org.apache.sentry.binding.metastore.messaging.json.SentryJSONMessageDeserializer;
 import org.apache.sentry.provider.db.service.persistent.PathsImage;
 import org.apache.sentry.provider.db.service.persistent.SentryStore;
@@ -171,7 +172,7 @@ class SentryHMSClient implements AutoCloseable {
       // While we were taking snapshot, HMS made some changes, so now we need 
to apply all
       // extra events to the snapshot
       long currentEventId = eventIdBefore.getEventId();
-      SentryJSONMessageDeserializer deserializer = new 
SentryJSONMessageDeserializer();
+      MessageDeserializer deserializer = new SentryJSONMessageDeserializer();
 
       while (currentEventId < eventIdAfter.getEventId()) {
         NotificationEventResponse response =

http://git-wip-us.apache.org/repos/asf/sentry/blob/2de4adff/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/persistent/TestHMSFollowerSentryStoreIntegration.java
----------------------------------------------------------------------
diff --git 
a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/persistent/TestHMSFollowerSentryStoreIntegration.java
 
b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/persistent/TestHMSFollowerSentryStoreIntegration.java
index 928d0c8..501898b 100644
--- 
a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/persistent/TestHMSFollowerSentryStoreIntegration.java
+++ 
b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/persistent/TestHMSFollowerSentryStoreIntegration.java
@@ -29,8 +29,8 @@ import org.apache.hadoop.hive.metastore.api.*;
 import org.apache.hadoop.security.alias.CredentialProvider;
 import org.apache.hadoop.security.alias.CredentialProviderFactory;
 import org.apache.hadoop.security.alias.UserProvider;
-import org.apache.hive.hcatalog.messaging.HCatEventMessage;
-import org.apache.hive.hcatalog.messaging.HCatEventMessage.EventType;
+import org.apache.hadoop.hive.metastore.messaging.EventMessage;
+import org.apache.hadoop.hive.metastore.messaging.EventMessage.EventType;
 import 
org.apache.sentry.binding.metastore.messaging.json.SentryJSONMessageFactory;
 
 import org.apache.sentry.provider.db.service.thrift.TSentryPrivilege;
@@ -186,7 +186,7 @@ public class TestHMSFollowerSentryStoreIntegration {
     // Create notification events to drop the table
     StorageDescriptor sd = new StorageDescriptor();
     sd.setLocation("hdfs:///db1.db/table1");
-    NotificationEvent notificationEvent = new NotificationEvent(1, 0, 
HCatEventMessage.EventType.DROP_TABLE.toString(),
+    NotificationEvent notificationEvent = new NotificationEvent(1, 0, 
EventMessage.EventType.DROP_TABLE.toString(),
         messageFactory.buildDropTableMessage(new Table(tableName1, dbName1, 
null, 0, 0, 0, sd, null, null, null, null, null)).toString());
     List<NotificationEvent> events = new ArrayList<>();
     events.add(notificationEvent);

http://git-wip-us.apache.org/repos/asf/sentry/blob/2de4adff/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/service/thrift/TestFullUpdateModifier.java
----------------------------------------------------------------------
diff --git 
a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/service/thrift/TestFullUpdateModifier.java
 
b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/service/thrift/TestFullUpdateModifier.java
index 4f90c3e..c6be80d 100644
--- 
a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/service/thrift/TestFullUpdateModifier.java
+++ 
b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/service/thrift/TestFullUpdateModifier.java
@@ -19,7 +19,10 @@
 package org.apache.sentry.service.thrift;
 
 import org.apache.hadoop.hive.metastore.api.NotificationEvent;
-import org.apache.hive.hcatalog.messaging.MessageDeserializer;
+import org.apache.hadoop.hive.metastore.api.Partition;
+import org.apache.hadoop.hive.metastore.api.StorageDescriptor;
+import org.apache.hadoop.hive.metastore.api.Table;
+import org.apache.hadoop.hive.metastore.messaging.MessageDeserializer;
 import 
org.apache.sentry.binding.metastore.messaging.json.SentryJSONAddPartitionMessage;
 import 
org.apache.sentry.binding.metastore.messaging.json.SentryJSONAlterPartitionMessage;
 import 
org.apache.sentry.binding.metastore.messaging.json.SentryJSONAlterTableMessage;
@@ -39,7 +42,7 @@ import java.util.HashSet;
 import java.util.Map;
 import java.util.Set;
 
-import static org.apache.hive.hcatalog.messaging.HCatEventMessage.EventType.*;
+import static 
org.apache.hadoop.hive.metastore.messaging.EventMessage.EventType.*;
 import static org.junit.Assert.*;
 
 public class TestFullUpdateModifier {
@@ -51,6 +54,9 @@ public class TestFullUpdateModifier {
   private static final String PATH = "foo/bar";
   private static final String LOCATION = uri(PATH);
 
+  private static final Table TABLE_OBJ = new Table(TABLE, DB, "", 0, 0, 0,
+      buildStorageDescriptor(LOCATION), null, null, "", "", "");
+
   /**
    * Convert path to HDFS URI
    */
@@ -59,6 +65,29 @@ public class TestFullUpdateModifier {
   }
 
   /**
+   * Creates a StorageDescriptor using the location as parameter.
+   *
+   * @param location The location string for the StorageDescriptor
+   * @return A StorageDescriptor object
+   */
+  private static StorageDescriptor buildStorageDescriptor(String location) {
+    return new StorageDescriptor(null, location, "", "", false, 0, null, null, 
null, null);
+  }
+
+  /**
+   * Creates a Table object using the db name, table name and table location 
as parameters.
+   *
+   * @param dbName The database name string.
+   * @param tableName The table name string.
+   * @param location The table location string.
+   * @return A Table object
+   */
+  private static Table buildTable(String dbName, String tableName, String 
location) {
+    return new Table(tableName, dbName, "", 0, 0, 0,
+        buildStorageDescriptor(location), null, null, "", "", "");
+  }
+
+  /**
    * Test create database event. It should add database and its location.
    * As a result we should have entry {"db1": {foo/bar}}
    * @throws Exception
@@ -155,7 +184,7 @@ public class TestFullUpdateModifier {
     MessageDeserializer deserializer = 
Mockito.mock(SentryJSONMessageDeserializer.class);
 
     SentryJSONCreateTableMessage message =
-            new SentryJSONCreateTableMessage(SERVER, PRINCIPAL, DB, TABLE, 0L, 
LOCATION);
+            new SentryJSONCreateTableMessage(SERVER, PRINCIPAL, TABLE_OBJ, 
Collections.emptyIterator(), 0L);
     Mockito.when(deserializer.getCreateTableMessage("")).thenReturn(message);
     FullUpdateModifier.applyEvent(update, event, deserializer);
     Map<String, Set<String>> expected = new HashMap<>();
@@ -221,9 +250,9 @@ public class TestFullUpdateModifier {
     String partLocation = uri(partPath);
 
     SentryJSONAddPartitionMessage message =
-            new SentryJSONAddPartitionMessage(SERVER, PRINCIPAL, DB, TABLE,
-                    Collections.<Map<String,String>>emptyList(), 0L,
-                    Collections.singletonList(partLocation));
+            new SentryJSONAddPartitionMessage(SERVER, PRINCIPAL, TABLE_OBJ,
+                Collections.emptyIterator(), Collections.emptyIterator(),
+                0L, Collections.singletonList(partLocation));
     Mockito.when(deserializer.getAddPartitionMessage("")).thenReturn(message);
     FullUpdateModifier.applyEvent(update, event, deserializer);
     Set<String> expected = new HashSet<>(2);
@@ -250,7 +279,7 @@ public class TestFullUpdateModifier {
     MessageDeserializer deserializer = 
Mockito.mock(SentryJSONMessageDeserializer.class);
 
     SentryJSONDropPartitionMessage message =
-            new SentryJSONDropPartitionMessage(SERVER, PRINCIPAL, DB, TABLE,
+            new SentryJSONDropPartitionMessage(SERVER, PRINCIPAL, TABLE_OBJ,
                     Collections.<Map<String,String>>emptyList(), 0L, 
Collections.singletonList(partLocation));
     Mockito.when(deserializer.getDropPartitionMessage("")).thenReturn(message);
     FullUpdateModifier.applyEvent(update, event, deserializer);
@@ -278,9 +307,12 @@ public class TestFullUpdateModifier {
     NotificationEvent event = new NotificationEvent(0, 0, 
ALTER_PARTITION.toString(), "");
     MessageDeserializer deserializer = 
Mockito.mock(SentryJSONMessageDeserializer.class);
 
+    Partition partitionObjBefore = new Partition(null, DB, TABLE, 0, 0, 
buildStorageDescriptor(partLocation), null);
+    Partition partitionObjAfter = new Partition(null, DB, TABLE, 0, 0, 
buildStorageDescriptor(newLocation), null);
+
     SentryJSONAlterPartitionMessage message =
-            new SentryJSONAlterPartitionMessage(SERVER, PRINCIPAL, DB, TABLE,
-                    0L, partLocation, newLocation);
+            new SentryJSONAlterPartitionMessage(SERVER, PRINCIPAL, TABLE_OBJ,
+                    partitionObjBefore, partitionObjAfter, 0L);
 
     
Mockito.when(deserializer.getAlterPartitionMessage("")).thenReturn(message);
     FullUpdateModifier.applyEvent(update, event, deserializer);
@@ -308,8 +340,7 @@ public class TestFullUpdateModifier {
     MessageDeserializer deserializer = 
Mockito.mock(SentryJSONMessageDeserializer.class);
 
     SentryJSONAlterTableMessage message =
-            new SentryJSONAlterTableMessage(SERVER, PRINCIPAL, DB, TABLE, 0L,
-                    LOCATION, LOCATION);
+            new SentryJSONAlterTableMessage(SERVER, PRINCIPAL, TABLE_OBJ, 
TABLE_OBJ, 0L);
 
     Mockito.when(deserializer.getAlterTableMessage("")).thenReturn(message);
     FullUpdateModifier.applyEvent(update, event, deserializer);
@@ -340,8 +371,7 @@ public class TestFullUpdateModifier {
     MessageDeserializer deserializer = 
Mockito.mock(SentryJSONMessageDeserializer.class);
 
     SentryJSONAlterTableMessage message =
-            new SentryJSONAlterTableMessage(SERVER, PRINCIPAL, DB, TABLE, 0L,
-                    LOCATION, LOCATION);
+            new SentryJSONAlterTableMessage(SERVER, PRINCIPAL, TABLE_OBJ, 
TABLE_OBJ, 0L);
 
     Mockito.when(deserializer.getAlterTableMessage("")).thenReturn(message);
     FullUpdateModifier.applyEvent(update, event, deserializer);
@@ -373,8 +403,7 @@ public class TestFullUpdateModifier {
     MessageDeserializer deserializer = 
Mockito.mock(SentryJSONMessageDeserializer.class);
 
     SentryJSONAlterTableMessage message =
-            new SentryJSONAlterTableMessage(SERVER, PRINCIPAL, DB, TABLE, 0L,
-                    LOCATION, LOCATION);
+            new SentryJSONAlterTableMessage(SERVER, PRINCIPAL, TABLE_OBJ, 
TABLE_OBJ, 0L);
 
     Mockito.when(deserializer.getAlterTableMessage("")).thenReturn(message);
     FullUpdateModifier.applyEvent(update, event, deserializer);
@@ -405,9 +434,9 @@ public class TestFullUpdateModifier {
 
     MessageDeserializer deserializer = 
Mockito.mock(SentryJSONMessageDeserializer.class);
 
+    Table tableWithNewLocation = buildTable(DB, TABLE, newLocation);
     SentryJSONAlterTableMessage message =
-            new SentryJSONAlterTableMessage(SERVER, PRINCIPAL, DB, TABLE, 0L,
-                    LOCATION, newLocation);
+            new SentryJSONAlterTableMessage(SERVER, PRINCIPAL, TABLE_OBJ, 
tableWithNewLocation, 0L);
 
     Mockito.when(deserializer.getAlterTableMessage("")).thenReturn(message);
     FullUpdateModifier.applyEvent(update, event, deserializer);

http://git-wip-us.apache.org/repos/asf/sentry/blob/2de4adff/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/service/thrift/TestHMSFollower.java
----------------------------------------------------------------------
diff --git 
a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/service/thrift/TestHMSFollower.java
 
b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/service/thrift/TestHMSFollower.java
index 5dd9b1b..edde886 100644
--- 
a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/service/thrift/TestHMSFollower.java
+++ 
b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/service/thrift/TestHMSFollower.java
@@ -44,8 +44,8 @@ import 
org.apache.hadoop.hive.metastore.api.NotificationEventResponse;
 import org.apache.hadoop.hive.metastore.api.Partition;
 import org.apache.hadoop.hive.metastore.api.StorageDescriptor;
 import org.apache.hadoop.hive.metastore.api.Table;
-import org.apache.hive.hcatalog.messaging.HCatEventMessage;
-import org.apache.hive.hcatalog.messaging.HCatEventMessage.EventType;
+import org.apache.hadoop.hive.metastore.messaging.EventMessage;
+import org.apache.hadoop.hive.metastore.messaging.EventMessage.EventType;
 import org.apache.sentry.binding.hive.conf.HiveAuthzConf;
 import org.apache.sentry.binding.hive.conf.HiveAuthzConf.AuthzConfVars;
 import 
org.apache.sentry.binding.metastore.messaging.json.SentryJSONMessageFactory;
@@ -515,7 +515,7 @@ public class TestHMSFollower {
 
     // Create notification events
     NotificationEvent notificationEvent = new NotificationEvent(1, 0,
-        HCatEventMessage.EventType.CREATE_DATABASE.toString(),
+        EventMessage.EventType.CREATE_DATABASE.toString(),
         messageFactory.buildCreateDatabaseMessage(new Database(dbName, null, 
"hdfs:///db1", null))
             .toString());
     List<NotificationEvent> events = new ArrayList<>();
@@ -544,7 +544,7 @@ public class TestHMSFollower {
 
     // Create notification events
     NotificationEvent notificationEvent = new NotificationEvent(1, 0,
-        HCatEventMessage.EventType.DROP_DATABASE.toString(),
+        EventMessage.EventType.DROP_DATABASE.toString(),
         messageFactory.buildDropDatabaseMessage(new Database(dbName, null, 
"hdfs:///db1", null))
             .toString());
     List<NotificationEvent> events = new ArrayList<>();
@@ -577,10 +577,10 @@ public class TestHMSFollower {
     StorageDescriptor sd = new StorageDescriptor();
     sd.setLocation("hdfs:///db1.db/table1");
     NotificationEvent notificationEvent = new NotificationEvent(1, 0,
-        HCatEventMessage.EventType.CREATE_TABLE.toString(),
+        EventMessage.EventType.CREATE_TABLE.toString(),
         messageFactory.buildCreateTableMessage(
-            new Table(tableName, dbName, null, 0, 0, 0, sd, null, null, null, 
null, null))
-            .toString());
+            new Table(tableName, dbName, null, 0, 0, 0, sd, null, null, null, 
null, null),
+            Collections.emptyIterator()).toString());
     List<NotificationEvent> events = new ArrayList<>();
     events.add(notificationEvent);
 
@@ -612,7 +612,7 @@ public class TestHMSFollower {
     StorageDescriptor sd = new StorageDescriptor();
     sd.setLocation("hdfs:///db1.db/table1");
     NotificationEvent notificationEvent = new NotificationEvent(1, 0,
-        HCatEventMessage.EventType.DROP_TABLE.toString(),
+        EventMessage.EventType.DROP_TABLE.toString(),
         messageFactory.buildDropTableMessage(
             new Table(tableName, dbName, null, 0, 0, 0, sd, null, null, null, 
null, null))
             .toString());
@@ -650,7 +650,7 @@ public class TestHMSFollower {
     StorageDescriptor sd = new StorageDescriptor();
     sd.setLocation("hdfs:///db1.db/table1");
     NotificationEvent notificationEvent = new NotificationEvent(1, 0,
-        HCatEventMessage.EventType.ALTER_TABLE.toString(),
+        EventMessage.EventType.ALTER_TABLE.toString(),
         messageFactory.buildAlterTableMessage(
             new Table(tableName, dbName, null, 0, 0, 0, sd, null, null, null, 
null, null),
             new Table(newTableName, newDbName, null, 0, 0, 0, sd, null, null, 
null, null, null))
@@ -714,8 +714,8 @@ public class TestHMSFollower {
     Table table = new Table(tableName1, dbName, null, 0, 0, 0, sd, partCols, 
null, null, null,
         null);
     notificationEvent = new NotificationEvent(inputEventId, 0,
-        HCatEventMessage.EventType.CREATE_TABLE.toString(),
-        messageFactory.buildCreateTableMessage(table).toString());
+        EventMessage.EventType.CREATE_TABLE.toString(),
+        messageFactory.buildCreateTableMessage(table, 
Collections.emptyIterator()).toString());
     notificationEvent.setDbName(dbName);
     notificationEvent.setTableName(tableName1);
     events.add(notificationEvent);
@@ -739,7 +739,7 @@ public class TestHMSFollower {
         0, 0, sd, null);
     partitions.add(partition);
     notificationEvent = new NotificationEvent(inputEventId, 0, 
EventType.ADD_PARTITION.toString(),
-       messageFactory.buildAddPartitionMessage(table, partitions).toString());
+       messageFactory.buildAddPartitionMessage(table, partitions.iterator(), 
Collections.emptyIterator()).toString());
     notificationEvent.setDbName(dbName);
     notificationEvent.setTableName(tableName1);
     events.add(notificationEvent);
@@ -800,8 +800,8 @@ public class TestHMSFollower {
     Table table1 = new Table(tableName2, dbName, null, 0, 0, 0, sd, partCols, 
null, null, null,
         null);
     notificationEvent = new NotificationEvent(inputEventId, 0,
-        HCatEventMessage.EventType.CREATE_TABLE.toString(),
-        messageFactory.buildCreateTableMessage(table1).toString());
+        EventMessage.EventType.CREATE_TABLE.toString(),
+        messageFactory.buildCreateTableMessage(table1, 
Collections.emptyIterator()).toString());
     notificationEvent.setDbName(dbName);
     notificationEvent.setTableName(tableName2);
     events.add(notificationEvent);
@@ -854,8 +854,8 @@ public class TestHMSFollower {
     Table table = new Table(tableName1, dbName, null, 0, 0, 0, sd, partCols, 
null, null, null,
         null);
     notificationEvent = new NotificationEvent(inputEventId, 0,
-        HCatEventMessage.EventType.CREATE_TABLE.toString(),
-        messageFactory.buildCreateTableMessage(table).toString());
+        EventMessage.EventType.CREATE_TABLE.toString(),
+        messageFactory.buildCreateTableMessage(table, 
Collections.emptyIterator()).toString());
     notificationEvent.setDbName(dbName);
     notificationEvent.setTableName(tableName1);
     events.add(notificationEvent);
@@ -875,7 +875,7 @@ public class TestHMSFollower {
     // This notification should not be processed by sentry server
     // Notification should be persisted explicitly
     notificationEvent = new NotificationEvent(1, 0,
-        HCatEventMessage.EventType.ALTER_TABLE.toString(),
+        EventMessage.EventType.ALTER_TABLE.toString(),
         messageFactory.buildAlterTableMessage(
             new Table(tableName1, dbName, null, 0, 0, 0, sd, null, null, null, 
null, null),
             new Table(tableName1, dbName, null, 0, 0, 0, sd, null, null, null, 
null, null))
@@ -907,8 +907,8 @@ public class TestHMSFollower {
     Table table1 = new Table(tableName2, dbName, null, 0, 0, 0, sd, partCols, 
null, null, null,
         null);
     notificationEvent = new NotificationEvent(inputEventId, 0,
-        HCatEventMessage.EventType.CREATE_TABLE.toString(),
-        messageFactory.buildCreateTableMessage(table1).toString());
+        EventMessage.EventType.CREATE_TABLE.toString(),
+        messageFactory.buildCreateTableMessage(table1, 
Collections.emptyIterator()).toString());
     notificationEvent.setDbName(dbName);
     notificationEvent.setTableName(tableName2);
     events.add(notificationEvent);
@@ -946,20 +946,20 @@ public class TestHMSFollower {
     StorageDescriptor invalidSd = new StorageDescriptor();
     invalidSd.setLocation(null);
     NotificationEvent invalidNotificationEvent = new 
NotificationEvent(inputEventId, 0,
-        HCatEventMessage.EventType.CREATE_TABLE.toString(),
+        EventMessage.EventType.CREATE_TABLE.toString(),
         messageFactory.buildCreateTableMessage(
-            new Table(tableName, dbName, null, 0, 0, 0, invalidSd, null, null, 
null, null, null))
-            .toString());
+            new Table(tableName, dbName, null, 0, 0, 0, invalidSd, null, null, 
null, null, null),
+            Collections.emptyIterator()).toString());
 
     // Create valid notification event
     StorageDescriptor sd = new StorageDescriptor();
     sd.setLocation("hdfs://db1.db/table1");
     inputEventId += 1;
     NotificationEvent notificationEvent = new NotificationEvent(inputEventId, 
0,
-        HCatEventMessage.EventType.CREATE_TABLE.toString(),
+        EventMessage.EventType.CREATE_TABLE.toString(),
         messageFactory.buildCreateTableMessage(
-            new Table(tableName, dbName, null, 0, 0, 0, sd, null, null, null, 
null, null))
-            .toString());
+            new Table(tableName, dbName, null, 0, 0, 0, sd, null, null, null, 
null, null),
+            Collections.emptyIterator()).toString());
     List<NotificationEvent> events = new ArrayList<>();
     events.add(invalidNotificationEvent);
     events.add(notificationEvent);
@@ -1030,7 +1030,7 @@ public class TestHMSFollower {
     StorageDescriptor sd = new StorageDescriptor();
     sd.setLocation("hdfs:///db1.db/table1");
     NotificationEvent notificationEvent = new NotificationEvent(1, 0,
-        HCatEventMessage.EventType.ALTER_TABLE.toString(),
+        EventMessage.EventType.ALTER_TABLE.toString(),
         messageFactory.buildAlterTableMessage(
             new Table(tableName, dbName, null, 0, 0, 0, sd, null, null, null, 
null, null),
             new Table(newTableName, newDbName, null, 0, 0, 0, sd, null, null, 
null, null, null))

http://git-wip-us.apache.org/repos/asf/sentry/blob/2de4adff/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/service/thrift/TestNotificationProcessor.java
----------------------------------------------------------------------
diff --git 
a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/service/thrift/TestNotificationProcessor.java
 
b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/service/thrift/TestNotificationProcessor.java
index 00f9b39..964a56c 100644
--- 
a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/service/thrift/TestNotificationProcessor.java
+++ 
b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/service/thrift/TestNotificationProcessor.java
@@ -22,6 +22,7 @@ import static org.mockito.Mockito.times;
 import static org.mockito.Mockito.verify;
 
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.List;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.hive.metastore.api.Database;
@@ -29,7 +30,7 @@ import org.apache.hadoop.hive.metastore.api.FieldSchema;
 import org.apache.hadoop.hive.metastore.api.NotificationEvent;
 import org.apache.hadoop.hive.metastore.api.StorageDescriptor;
 import org.apache.hadoop.hive.metastore.api.Table;
-import org.apache.hive.hcatalog.messaging.HCatEventMessage;
+import org.apache.hadoop.hive.metastore.messaging.EventMessage;
 import 
org.apache.sentry.binding.metastore.messaging.json.SentryJSONMessageFactory;
 import org.apache.sentry.hdfs.UniquePathsUpdate;
 import org.apache.sentry.provider.db.service.persistent.SentryStore;
@@ -86,7 +87,7 @@ public class TestNotificationProcessor {
 
     // Create notification event
     notificationEvent = new NotificationEvent(seqNum, 0,
-        HCatEventMessage.EventType.CREATE_DATABASE.toString(),
+        EventMessage.EventType.CREATE_DATABASE.toString(),
         messageFactory.buildCreateDatabaseMessage(new Database(dbName,
             null, uriPrefix + location, null)).toString());
 
@@ -107,7 +108,7 @@ public class TestNotificationProcessor {
     notificationProcessor.setSyncStoreOnCreate(false);
     dbName = "db2";
     notificationEvent = new NotificationEvent(1, 0,
-        HCatEventMessage.EventType.CREATE_DATABASE.toString(),
+        EventMessage.EventType.CREATE_DATABASE.toString(),
         messageFactory.buildCreateDatabaseMessage(new Database(dbName,
             null, "hdfs:///db2", null)).toString());
 
@@ -141,7 +142,7 @@ public class TestNotificationProcessor {
 
     // Create notification event
     NotificationEvent notificationEvent = new NotificationEvent(1, 0,
-        HCatEventMessage.EventType.DROP_DATABASE.toString(),
+        EventMessage.EventType.DROP_DATABASE.toString(),
         messageFactory.buildDropDatabaseMessage(new Database(dbName, null,
             "hdfs:///db1", null)).toString());
 
@@ -163,7 +164,7 @@ public class TestNotificationProcessor {
     dbName = "db2";
     // Create notification event
     notificationEvent = new NotificationEvent(1, 0,
-        HCatEventMessage.EventType.DROP_DATABASE.toString(),
+        EventMessage.EventType.DROP_DATABASE.toString(),
         messageFactory.buildDropDatabaseMessage(new Database(dbName, null,
             "hdfs:///db2", null)).toString());
 
@@ -198,9 +199,10 @@ public class TestNotificationProcessor {
     StorageDescriptor sd = new StorageDescriptor();
     sd.setLocation("hdfs:///db1.db/table1");
     NotificationEvent notificationEvent =
-        new NotificationEvent(1, 0, 
HCatEventMessage.EventType.CREATE_TABLE.toString(),
+        new NotificationEvent(1, 0, 
EventMessage.EventType.CREATE_TABLE.toString(),
             messageFactory.buildCreateTableMessage(new Table(tableName,
-                dbName, null, 0, 0, 0, sd, null, null, null, null, 
null)).toString());
+                dbName, null, 0, 0, 0, sd, null, null, null, null, null),
+                Collections.emptyIterator()).toString());
 
     notificationProcessor.processNotificationEvent(notificationEvent);
 
@@ -226,9 +228,10 @@ public class TestNotificationProcessor {
     sd = new StorageDescriptor();
     sd.setLocation("hdfs:///db1.db/table2");
     notificationEvent =
-        new NotificationEvent(1, 0, 
HCatEventMessage.EventType.CREATE_TABLE.toString(),
+        new NotificationEvent(1, 0, 
EventMessage.EventType.CREATE_TABLE.toString(),
             messageFactory.buildCreateTableMessage(new Table(tableName,
-                dbName, null, 0, 0, 0, sd, null, null, null, null, 
null)).toString());
+                dbName, null, 0, 0, 0, sd, null, null, null, null, null),
+                Collections.emptyIterator()).toString());
 
     notificationProcessor.processNotificationEvent(notificationEvent);
 
@@ -268,7 +271,7 @@ public class TestNotificationProcessor {
     StorageDescriptor sd = new StorageDescriptor();
     sd.setLocation("hdfs:///db1.db/table1");
     NotificationEvent notificationEvent = new NotificationEvent(1, 0,
-        HCatEventMessage.EventType.DROP_TABLE.toString(),
+        EventMessage.EventType.DROP_TABLE.toString(),
         messageFactory.buildDropTableMessage(new Table(tableName,
             dbName, null, 0, 0, 0, sd, null, null, null, null, 
null)).toString());
 
@@ -310,7 +313,7 @@ public class TestNotificationProcessor {
     StorageDescriptor sd = new StorageDescriptor();
     sd.setLocation("hdfs:///db1.db/table1");
     NotificationEvent notificationEvent = new NotificationEvent(1, 0,
-        HCatEventMessage.EventType.ALTER_TABLE.toString(),
+        EventMessage.EventType.ALTER_TABLE.toString(),
         messageFactory.buildAlterTableMessage(
             new Table(tableName, dbName, null, 0, 0, 0, sd, null, null, null, 
null, null),
             new Table(newTableName, newDbName, null, 0, 0, 0, sd, null, null, 
null, null, null))
@@ -363,7 +366,7 @@ public class TestNotificationProcessor {
     StorageDescriptor new_sd = new StorageDescriptor();
     new_sd.setLocation("hdfs:///db1.db/table2");
     NotificationEvent notificationEvent = new NotificationEvent(1, 0,
-        HCatEventMessage.EventType.ALTER_TABLE.toString(),
+        EventMessage.EventType.ALTER_TABLE.toString(),
         messageFactory.buildAlterTableMessage(
             new Table(tableName, dbName, null, 0, 0, 0, sd, null, null, null, 
null, null),
             new Table(newTableName, newDbName, null, 0, 0, 0, new_sd, null, 
null, null, null, null))
@@ -424,8 +427,8 @@ public class TestNotificationProcessor {
     Table table = new Table(tableName1, dbName, null, 0, 0, 0, sd, partCols,
         null, null, null, null);
     notificationEvent = new NotificationEvent(inputEventId, 0,
-        HCatEventMessage.EventType.CREATE_TABLE.toString(),
-        messageFactory.buildCreateTableMessage(table).toString());
+        EventMessage.EventType.CREATE_TABLE.toString(),
+        messageFactory.buildCreateTableMessage(table, 
Collections.emptyIterator()).toString());
     notificationEvent.setDbName(dbName);
     notificationEvent.setTableName(tableName1);
     inputEventId += 1;
@@ -442,7 +445,7 @@ public class TestNotificationProcessor {
     // This notification should not be processed by sentry server
     // Notification should be persisted explicitly
     notificationEvent = new NotificationEvent(1, 0,
-        HCatEventMessage.EventType.ALTER_TABLE.toString(),
+        EventMessage.EventType.ALTER_TABLE.toString(),
         messageFactory.buildAlterTableMessage(
             new Table(tableName1, dbName, null, 0, 0, 0, sd, null, null, null, 
null, null),
             new Table(tableName1, dbName, null, 0, 0, 0, sd, null,
@@ -470,8 +473,8 @@ public class TestNotificationProcessor {
     Table table1 = new Table(tableName2, dbName, null, 0, 0, 0, sd,
         partCols, null, null, null, null);
     notificationEvent = new NotificationEvent(inputEventId, 0,
-        HCatEventMessage.EventType.CREATE_TABLE.toString(),
-        messageFactory.buildCreateTableMessage(table1).toString());
+        EventMessage.EventType.CREATE_TABLE.toString(),
+        messageFactory.buildCreateTableMessage(table1, 
Collections.emptyIterator()).toString());
     notificationEvent.setDbName(dbName);
     notificationEvent.setTableName(tableName2);
     // Process the notification

http://git-wip-us.apache.org/repos/asf/sentry/blob/2de4adff/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/hdfs/TestHDFSIntegrationBase.java
----------------------------------------------------------------------
diff --git 
a/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/hdfs/TestHDFSIntegrationBase.java
 
b/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/hdfs/TestHDFSIntegrationBase.java
index d9aec8b..c8eef09 100644
--- 
a/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/hdfs/TestHDFSIntegrationBase.java
+++ 
b/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/hdfs/TestHDFSIntegrationBase.java
@@ -586,8 +586,8 @@ public abstract class TestHDFSIntegrationBase {
         hiveConf.set("hive.metastore.authorization.storage.checks", "true");
         hiveConf.set("hive.metastore.uris", "thrift://localhost:" + hmsPort);
         hiveConf.set("hive.metastore.pre.event.listeners", 
"org.apache.sentry.binding.metastore.MetastoreAuthzBinding");
-        hiveConf.set("hive.metastore.transactional.event.listeners", 
"org.apache.sentry.binding.metastore.SentryMetastorePostEventListenerNotificationLog");
-        hiveConf.set("hcatalog.message.factory.impl.json", 
"org.apache.sentry.binding.metastore.messaging.json.SentryJSONMessageFactory");
+        hiveConf.set("hive.metastore.transactional.event.listeners", 
"org.apache.hive.hcatalog.listener.DbNotificationListener");
+        hiveConf.set("hive.metastore.event.message.factory", 
"org.apache.sentry.binding.metastore.messaging.json.SentryJSONMessageFactory");
         hiveConf.set("hive.security.authorization.task.factory", 
"org.apache.sentry.binding.hive.SentryHiveAuthorizationTaskFactoryImpl");
         hiveConf.set("hive.server2.session.hook", 
"org.apache.sentry.binding.hive.HiveAuthzBindingSessionHook");
         hiveConf.set("sentry.metastore.service.users", "hive");// queries made 
by hive user (beeline) skip meta store check

http://git-wip-us.apache.org/repos/asf/sentry/blob/2de4adff/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/hive/AbstractTestWithStaticConfiguration.java
----------------------------------------------------------------------
diff --git 
a/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/hive/AbstractTestWithStaticConfiguration.java
 
b/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/hive/AbstractTestWithStaticConfiguration.java
index 708733e..e529829 100644
--- 
a/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/hive/AbstractTestWithStaticConfiguration.java
+++ 
b/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/hive/AbstractTestWithStaticConfiguration.java
@@ -34,6 +34,8 @@ import java.util.Map;
 import java.util.HashSet;
 
 import com.google.common.collect.Sets;
+import org.apache.hive.hcatalog.listener.DbNotificationListener;
+import 
org.apache.sentry.binding.metastore.messaging.json.SentryJSONMessageFactory;
 import org.apache.sentry.tests.e2e.hive.fs.TestFSContants;
 import org.fest.reflect.core.Reflection;
 import org.junit.After;
@@ -51,7 +53,6 @@ import org.apache.hadoop.fs.permission.FsPermission;
 import org.apache.hadoop.hive.conf.HiveConf;
 import org.apache.hadoop.hive.conf.HiveConf.ConfVars;
 import org.apache.sentry.binding.hive.SentryHiveAuthorizationTaskFactoryImpl;
-import 
org.apache.sentry.binding.metastore.SentryMetastorePostEventListenerNotificationLog;
 import org.apache.sentry.core.model.db.DBModelAction;
 import org.apache.sentry.core.model.db.DBModelAuthorizable;
 import org.apache.sentry.core.model.db.DBModelAuthorizables;
@@ -132,7 +133,6 @@ public abstract class AbstractTestWithStaticConfiguration 
extends RulesForE2ETes
   protected static boolean defaultFSOnHdfs = false;
   protected static boolean useSentryService = false;
   protected static boolean setMetastoreListener = true;
-  protected static boolean useDbNotificationListener = false;
   protected static String testServerType = null;
   protected static boolean enableHiveConcurrency = false;
   // indicate if the database need to be clear for every test case in one test 
class
@@ -515,15 +515,10 @@ public abstract class AbstractTestWithStaticConfiguration 
extends RulesForE2ETes
     startSentryService();
     if (setMetastoreListener) {
       LOGGER.info("setMetastoreListener is enabled");
-      if (useDbNotificationListener) {
-        
properties.put(HiveConf.ConfVars.METASTORE_TRANSACTIONAL_EVENT_LISTENERS.varname,
-                "org.apache.hive.hcatalog.listener.DbNotificationListener");
-      } else {
-        
properties.put(HiveConf.ConfVars.METASTORE_TRANSACTIONAL_EVENT_LISTENERS.varname,
-            SentryMetastorePostEventListenerNotificationLog.class.getName());
-        properties.put("hcatalog.message.factory.impl.json",
-            
"org.apache.sentry.binding.metastore.messaging.json.SentryJSONMessageFactory");
-      }
+      
properties.put(HiveConf.ConfVars.METASTORE_TRANSACTIONAL_EVENT_LISTENERS.varname,
+          DbNotificationListener.class.getName());
+      properties.put(ConfVars.METASTORE_EVENT_MESSAGE_FACTORY.varname,
+          SentryJSONMessageFactory.class.getName());
     }
   }
 

http://git-wip-us.apache.org/repos/asf/sentry/blob/2de4adff/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/metastore/TestDBNotificationListenerInBuiltDeserializer.java
----------------------------------------------------------------------
diff --git 
a/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/metastore/TestDBNotificationListenerInBuiltDeserializer.java
 
b/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/metastore/TestDBNotificationListenerInBuiltDeserializer.java
index ea44e33..69ea512 100644
--- 
a/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/metastore/TestDBNotificationListenerInBuiltDeserializer.java
+++ 
b/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/metastore/TestDBNotificationListenerInBuiltDeserializer.java
@@ -21,18 +21,18 @@ package org.apache.sentry.tests.e2e.metastore;
 import com.google.common.collect.Lists;
 import org.apache.hadoop.hive.metastore.HiveMetaStoreClient;
 import org.apache.hadoop.hive.metastore.api.*;
-import org.apache.hive.hcatalog.messaging.CreateDatabaseMessage;
-import org.apache.hive.hcatalog.messaging.HCatEventMessage;
-import org.apache.hive.hcatalog.messaging.MessageDeserializer;
-import org.apache.hive.hcatalog.messaging.MessageFactory;
-import org.apache.hive.hcatalog.messaging.CreateTableMessage;
-import org.apache.hive.hcatalog.messaging.DropTableMessage;
-import org.apache.hive.hcatalog.messaging.AlterTableMessage;
-import org.apache.hive.hcatalog.messaging.AlterPartitionMessage;
-import org.apache.hive.hcatalog.messaging.DropDatabaseMessage;
-import org.apache.hive.hcatalog.messaging.AddPartitionMessage;
-import org.apache.hive.hcatalog.messaging.DropPartitionMessage;
+import org.apache.hadoop.hive.metastore.messaging.EventMessage;
+import org.apache.hadoop.hive.metastore.messaging.CreateDatabaseMessage;
+import org.apache.hadoop.hive.metastore.messaging.MessageDeserializer;
+import org.apache.hadoop.hive.metastore.messaging.CreateTableMessage;
+import org.apache.hadoop.hive.metastore.messaging.DropTableMessage;
+import org.apache.hadoop.hive.metastore.messaging.AlterTableMessage;
+import org.apache.hadoop.hive.metastore.messaging.AlterPartitionMessage;
+import org.apache.hadoop.hive.metastore.messaging.DropDatabaseMessage;
+import org.apache.hadoop.hive.metastore.messaging.AddPartitionMessage;
+import org.apache.hadoop.hive.metastore.messaging.DropPartitionMessage;
 import 
org.apache.sentry.binding.metastore.messaging.json.SentryJSONAlterPartitionMessage;
+import 
org.apache.sentry.binding.metastore.messaging.json.SentryJSONMessageDeserializer;
 import org.apache.sentry.tests.e2e.hive.StaticUserGroup;
 import org.apache.sentry.tests.e2e.hive.hiveserver.HiveServerFactory;
 import org.hamcrest.text.IsEqualIgnoringCase;
@@ -61,14 +61,16 @@ public class TestDBNotificationListenerInBuiltDeserializer 
extends AbstractMetas
   @BeforeClass
   public static void setupTestStaticConfiguration() throws Exception {
     setMetastoreListener = true;
-    useDbNotificationListener = true;
     beforeClass();
   }
 
   protected static void beforeClass() throws Exception {
     
AbstractMetastoreTestWithStaticConfiguration.setupTestStaticConfiguration();
     client = context.getMetaStoreClient(ADMIN1);
-    deserializer = MessageFactory.getDeserializer("json", "");
+
+    // The MessageFactory.getDeserializer() has a bug and we cannot use. Set 
this to the default
+    // Sentry deserializer instead.
+    deserializer = new SentryJSONMessageDeserializer();
     
writePolicyFile(setAdminOnServer1(ADMINGROUP).setUserGroupMapping(StaticUserGroup.getStaticMapping()));
   }
 
@@ -101,7 +103,7 @@ public class TestDBNotificationListenerInBuiltDeserializer 
extends AbstractMetas
     latestID = client.getCurrentNotificationEventId();
     response = client.getNextNotification(latestID.getEventId() - 1, 1, null);
     CreateDatabaseMessage createDatabaseMessage = 
deserializer.getCreateDatabaseMessage(response.getEvents().get(0).getMessage());
-    assertEquals(HCatEventMessage.EventType.CREATE_DATABASE, 
createDatabaseMessage.getEventType()); //Validate EventType
+    assertEquals(EventMessage.EventType.CREATE_DATABASE, 
createDatabaseMessage.getEventType()); //Validate EventType
     assertEquals(testDB, createDatabaseMessage.getDB()); //dbName
     //Location information is not available
 
@@ -117,7 +119,7 @@ public class TestDBNotificationListenerInBuiltDeserializer 
extends AbstractMetas
     assertEquals(previousID.getEventId() + 1, latestID.getEventId()); 
//Validate monotonically increasing eventID
     response = client.getNextNotification(latestID.getEventId() - 1, 1, null);
     DropDatabaseMessage dropDatabaseMessage = 
deserializer.getDropDatabaseMessage(response.getEvents().get(0).getMessage());
-    assertEquals(HCatEventMessage.EventType.DROP_DATABASE, 
dropDatabaseMessage.getEventType()); //Event type
+    assertEquals(EventMessage.EventType.DROP_DATABASE, 
dropDatabaseMessage.getEventType()); //Event type
     assertThat(dropDatabaseMessage.getDB(), 
IsEqualIgnoringCase.equalToIgnoringCase(testDB)); // dbName
     //Location information is not available, but we might not really need it 
as we can drop all paths associated with
     //the object when we drop
@@ -144,7 +146,7 @@ public class TestDBNotificationListenerInBuiltDeserializer 
extends AbstractMetas
     latestID = client.getCurrentNotificationEventId();
     response = client.getNextNotification(latestID.getEventId() - 1, 1, null);
     CreateTableMessage createTableMessage = 
deserializer.getCreateTableMessage(response.getEvents().get(0).getMessage());
-    assertEquals(HCatEventMessage.EventType.CREATE_TABLE, 
createTableMessage.getEventType());
+    assertEquals(EventMessage.EventType.CREATE_TABLE, 
createTableMessage.getEventType());
     assertEquals(testDB, createTableMessage.getDB()); //dbName
     assertEquals(testTable, createTableMessage.getTable()); //tableName
     //Location information is not available
@@ -160,7 +162,7 @@ public class TestDBNotificationListenerInBuiltDeserializer 
extends AbstractMetas
     assertEquals(previousID.getEventId() + 1, latestID.getEventId());
     response = client.getNextNotification(latestID.getEventId() - 1, 1, null);
     DropTableMessage dropTableMessage = 
deserializer.getDropTableMessage(response.getEvents().get(0).getMessage());
-    assertEquals(HCatEventMessage.EventType.DROP_TABLE, 
dropTableMessage.getEventType());
+    assertEquals(EventMessage.EventType.DROP_TABLE, 
dropTableMessage.getEventType());
     assertThat(dropTableMessage.getDB(), 
IsEqualIgnoringCase.equalToIgnoringCase(testDB));//dbName
     assertThat(dropTableMessage.getTable(), 
IsEqualIgnoringCase.equalToIgnoringCase(testTable));//tableName
     //Location information is not available, but we might not really need it 
as we can drop all paths associated with
@@ -186,7 +188,7 @@ public class TestDBNotificationListenerInBuiltDeserializer 
extends AbstractMetas
     latestID = client.getCurrentNotificationEventId();
     response = client.getNextNotification(latestID.getEventId() - 1, 1, null);
     CreateTableMessage createTableMessage = 
deserializer.getCreateTableMessage(response.getEvents().get(0).getMessage());
-    assertEquals(HCatEventMessage.EventType.CREATE_TABLE, 
createTableMessage.getEventType());
+    assertEquals(EventMessage.EventType.CREATE_TABLE, 
createTableMessage.getEventType());
     assertEquals(testDB, createTableMessage.getDB()); //dbName
     assertEquals(testTable, createTableMessage.getTable()); //tableName
     //Location information is not available
@@ -202,7 +204,7 @@ public class TestDBNotificationListenerInBuiltDeserializer 
extends AbstractMetas
     assertEquals(previousID.getEventId() + 1, latestID.getEventId());
     response = client.getNextNotification(latestID.getEventId() - 1, 1, null);
     DropTableMessage dropTableMessage = 
deserializer.getDropTableMessage(response.getEvents().get(0).getMessage());
-    assertEquals(HCatEventMessage.EventType.DROP_TABLE, 
dropTableMessage.getEventType());
+    assertEquals(EventMessage.EventType.DROP_TABLE, 
dropTableMessage.getEventType());
     assertThat(dropTableMessage.getDB(), 
IsEqualIgnoringCase.equalToIgnoringCase(testDB));//dbName
     assertThat(dropTableMessage.getTable(), 
IsEqualIgnoringCase.equalToIgnoringCase(testTable));//tableName
     //Location information is not available, but we might not really need it 
as we can drop all paths associated with
@@ -232,7 +234,7 @@ public class TestDBNotificationListenerInBuiltDeserializer 
extends AbstractMetas
     latestID = client.getCurrentNotificationEventId();
     response = client.getNextNotification(latestID.getEventId() - 1, 1, null);
     AddPartitionMessage addPartitionMessage = 
deserializer.getAddPartitionMessage(response.getEvents().get(0).getMessage());
-    assertEquals(HCatEventMessage.EventType.ADD_PARTITION, 
addPartitionMessage.getEventType());
+    assertEquals(EventMessage.EventType.ADD_PARTITION, 
addPartitionMessage.getEventType());
     assertThat(addPartitionMessage.getDB(), 
IsEqualIgnoringCase.equalToIgnoringCase(testDB));// dbName (returns lowered 
version)
     assertThat(addPartitionMessage.getTable(), 
IsEqualIgnoringCase.equalToIgnoringCase(testTable));// tableName (returns 
lowered version)
     //Location information is not available
@@ -248,7 +250,7 @@ public class TestDBNotificationListenerInBuiltDeserializer 
extends AbstractMetas
     assertEquals(previousID.getEventId() + 1, latestID.getEventId());
     response = client.getNextNotification(latestID.getEventId() - 1, 1, null);
     DropPartitionMessage dropPartitionMessage = 
deserializer.getDropPartitionMessage(response.getEvents().get(0).getMessage());
-    assertEquals(HCatEventMessage.EventType.DROP_PARTITION, 
dropPartitionMessage.getEventType());
+    assertEquals(EventMessage.EventType.DROP_PARTITION, 
dropPartitionMessage.getEventType());
     assertThat(dropPartitionMessage.getDB(), 
IsEqualIgnoringCase.equalToIgnoringCase(testDB)); //dbName
     assertThat(dropPartitionMessage.getTable(), 
IsEqualIgnoringCase.equalToIgnoringCase(testTable)); //tableName
     //Location information is not available
@@ -283,7 +285,7 @@ public class TestDBNotificationListenerInBuiltDeserializer 
extends AbstractMetas
     latestID = client.getCurrentNotificationEventId();
     response = client.getNextNotification(latestID.getEventId()-1, 1, null);
     AlterTableMessage alterTableMessage = 
deserializer.getAlterTableMessage(response.getEvents().get(0).getMessage());
-    assertEquals(HCatEventMessage.EventType.ALTER_TABLE, 
alterTableMessage.getEventType());
+    assertEquals(EventMessage.EventType.ALTER_TABLE, 
alterTableMessage.getEventType());
     assertThat(alterTableMessage.getDB(), 
IsEqualIgnoringCase.equalToIgnoringCase(testDB));//dbName
     assertThat(alterTableMessage.getTable(), 
IsEqualIgnoringCase.equalToIgnoringCase(testTable));//tableName
     //Old location is not available: This information is lost if not captured 
at the time of event.
@@ -307,7 +309,7 @@ public class TestDBNotificationListenerInBuiltDeserializer 
extends AbstractMetas
     assertEquals(previousID.getEventId() + 1, latestID.getEventId());
     response = client.getNextNotification(latestID.getEventId()-1, 1, null);
     alterTableMessage = 
deserializer.getAlterTableMessage(response.getEvents().get(0).getMessage());
-    assertEquals(HCatEventMessage.EventType.ALTER_TABLE, 
alterTableMessage.getEventType());
+    assertEquals(EventMessage.EventType.ALTER_TABLE, 
alterTableMessage.getEventType());
     assertThat(alterTableMessage.getDB(), 
IsEqualIgnoringCase.equalToIgnoringCase(testDB));//oldDbName
     assertThat(alterTableMessage.getTable(), 
IsEqualIgnoringCase.equalToIgnoringCase(testTable));//oldTableName
     assertThat(response.getEvents().get(0).getDbName(), 
IsEqualIgnoringCase.equalToIgnoringCase(newDBName));//newDbName
@@ -345,7 +347,7 @@ public class TestDBNotificationListenerInBuiltDeserializer 
extends AbstractMetas
     latestID = client.getCurrentNotificationEventId();
     response = client.getNextNotification(latestID.getEventId()-1, 1, null);
     AlterPartitionMessage alterPartitionMessage = 
deserializer.getAlterPartitionMessage(response.getEvents().get(0).getMessage());
-    assertEquals(HCatEventMessage.EventType.ALTER_PARTITION, 
alterPartitionMessage.getEventType());
+    assertEquals(EventMessage.EventType.ALTER_PARTITION, 
alterPartitionMessage.getEventType());
     assertThat(alterPartitionMessage.getDB(), 
IsEqualIgnoringCase.equalToIgnoringCase(testDB));// dbName
     assertThat(alterPartitionMessage.getTable(), 
IsEqualIgnoringCase.equalToIgnoringCase(testTable));// tableName
     assertEquals(partVals1, alterPartitionMessage.getKeyValues());
@@ -361,7 +363,7 @@ public class TestDBNotificationListenerInBuiltDeserializer 
extends AbstractMetas
     latestID = client.getCurrentNotificationEventId();
     response = client.getNextNotification(latestID.getEventId()-1, 1, null);
     alterPartitionMessage = 
deserializer.getAlterPartitionMessage(response.getEvents().get(0).getMessage());
-    assertEquals(HCatEventMessage.EventType.ALTER_PARTITION, 
alterPartitionMessage.getEventType());
+    assertEquals(EventMessage.EventType.ALTER_PARTITION, 
alterPartitionMessage.getEventType());
     assertThat(alterPartitionMessage.getDB(), 
IsEqualIgnoringCase.equalToIgnoringCase(testDB));// dbName
     assertThat(alterPartitionMessage.getTable(), 
IsEqualIgnoringCase.equalToIgnoringCase(testTable));// tableName
     assertEquals(partVals1, alterPartitionMessage.getKeyValues());

http://git-wip-us.apache.org/repos/asf/sentry/blob/2de4adff/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/metastore/TestDbNotificationListenerSentryDeserializer.java
----------------------------------------------------------------------
diff --git 
a/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/metastore/TestDbNotificationListenerSentryDeserializer.java
 
b/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/metastore/TestDbNotificationListenerSentryDeserializer.java
deleted file mode 100644
index 8e588b1..0000000
--- 
a/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/metastore/TestDbNotificationListenerSentryDeserializer.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.sentry.tests.e2e.metastore;
-
-import org.junit.BeforeClass;
-
-
-/**
- * Make sure we are able to capture all HMS object and path changes using 
Hive's DbNotificationListener and
- * Sentry's JSON deserializer. This would make sure Sentry is able to read the 
Notification logs written by
- * Hive's DBNotificationListener
- */
-public class TestDbNotificationListenerSentryDeserializer extends 
TestSentryListenerSentryDeserializer {
-
-  @BeforeClass
-  public static void setupTestStaticConfiguration() throws Exception {
-    setMetastoreListener = true;
-    useDbNotificationListener = true;
-    
AbstractMetastoreTestWithStaticConfiguration.setupTestStaticConfiguration();
-    setupClass();
-  }
-}
-

http://git-wip-us.apache.org/repos/asf/sentry/blob/2de4adff/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/metastore/TestSentryListenerInBuiltDeserializer.java
----------------------------------------------------------------------
diff --git 
a/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/metastore/TestSentryListenerInBuiltDeserializer.java
 
b/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/metastore/TestSentryListenerInBuiltDeserializer.java
deleted file mode 100644
index c4be62d..0000000
--- 
a/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/metastore/TestSentryListenerInBuiltDeserializer.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.sentry.tests.e2e.metastore;
-
-import org.junit.BeforeClass;
-
-/**
- * Make sure we are able to capture all HMS object and path changes using 
Sentry's SentryMetastorePostEventListener
- * and Hive's inbuilt Notification log deserializer. This would make sure 
Sentry is not breaking other users of
- * NotificationLog who might be using Hive's in built serializer
- */
-public class TestSentryListenerInBuiltDeserializer extends 
TestDBNotificationListenerInBuiltDeserializer {
-
-  @BeforeClass
-  public static void setupTestStaticConfiguration() throws Exception {
-    setMetastoreListener = true;
-    useDbNotificationListener = false;
-    beforeClass();
-  }
-}
-

http://git-wip-us.apache.org/repos/asf/sentry/blob/2de4adff/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/metastore/TestSentryListenerSentryDeserializer.java
----------------------------------------------------------------------
diff --git 
a/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/metastore/TestSentryListenerSentryDeserializer.java
 
b/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/metastore/TestSentryListenerSentryDeserializer.java
deleted file mode 100644
index 3a404dd..0000000
--- 
a/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/metastore/TestSentryListenerSentryDeserializer.java
+++ /dev/null
@@ -1,401 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.sentry.tests.e2e.metastore;
-
-import com.google.common.collect.Lists;
-import org.apache.hadoop.hive.metastore.HiveMetaStoreClient;
-import org.apache.hadoop.hive.metastore.api.*;
-import org.apache.hive.hcatalog.messaging.HCatEventMessage;
-import org.apache.sentry.binding.metastore.messaging.json.*;
-import org.apache.sentry.tests.e2e.hive.StaticUserGroup;
-import org.apache.sentry.tests.e2e.hive.hiveserver.HiveServerFactory;
-import org.hamcrest.text.IsEqualIgnoringCase;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThat;
-import static org.junit.Assert.assertTrue;
-
-import org.junit.*;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Random;
-
-/**
- * Make sure we are able to capture all HMS object and path changes using 
Sentry's SentryMetastorePostEventListener
- * and Sentry Notification log deserializer. Can be removed if we move to 
using DBNotificationListener
- */
-public class TestSentryListenerSentryDeserializer extends 
AbstractMetastoreTestWithStaticConfiguration {
-
-  protected static HiveMetaStoreClient client;
-  protected static SentryJSONMessageDeserializer deserializer;
-  protected static Random random = new Random();
-  private static String warehouseDir;
-  private static String testDB;
-
-
-  @BeforeClass
-  public static void setupTestStaticConfiguration() throws Exception {
-    setMetastoreListener = true;
-    useDbNotificationListener = false;
-    
AbstractMetastoreTestWithStaticConfiguration.setupTestStaticConfiguration();
-    setupClass();
-  }
-
-  protected static void setupClass() throws Exception{
-    client = context.getMetaStoreClient(ADMIN1);
-    deserializer = new SentryJSONMessageDeserializer();
-    warehouseDir = hiveServer.getProperty(HiveServerFactory.WAREHOUSE_DIR);
-    
writePolicyFile(setAdminOnServer1(ADMINGROUP).setUserGroupMapping(StaticUserGroup.getStaticMapping()));
-
-  }
-
-  @AfterClass
-  public static void cleanupAfterClass() throws Exception {
-    if (client != null) {
-      client.close();
-    }
-  }
-
-  @After
-  public void dropDBAfterTest() throws Exception {
-    if(client != null && testDB != null) {
-      dropMetastoreDBIfExists(client, testDB);
-    }
-  }
-
-  @Test
-  public void testCreateDropDatabase() throws Exception {
-    CurrentNotificationEventId latestID, previousID;
-    NotificationEventResponse response;
-
-    testDB = "N_db" + random.nextInt(Integer.SIZE - 1);
-
-    // Create database
-    // We need:
-    // - Dbname
-    // - location
-    createMetastoreDB(client, testDB);
-    latestID = client.getCurrentNotificationEventId();
-    response = client.getNextNotification(latestID.getEventId() - 1, 1, null);
-    SentryJSONCreateDatabaseMessage createDatabaseMessage = 
deserializer.getCreateDatabaseMessage(response.getEvents().get(0).getMessage());
-    assertEquals(HCatEventMessage.EventType.CREATE_DATABASE, 
createDatabaseMessage.getEventType()); //Validate EventType
-    assertEquals(testDB, createDatabaseMessage.getDB()); //dbName
-    String expectedLocation = warehouseDir + "/" + testDB + ".db";
-    if(!useDbNotificationListener) {
-      assertEquals(expectedLocation.toLowerCase(), 
createDatabaseMessage.getLocation());
-    }
-
-    //Alter database location and rename are not supported. See HIVE-4847
-
-    //Drop database
-    // We need:
-    // - dbName
-    // - location
-    client.dropDatabase(testDB);
-    previousID = latestID;
-    latestID = client.getCurrentNotificationEventId();
-    assertEquals(previousID.getEventId() + 1, latestID.getEventId()); 
//Validate monotonically increasing eventID
-    response = client.getNextNotification(latestID.getEventId() - 1, 1, null);
-    SentryJSONDropDatabaseMessage dropDatabaseMessage = 
deserializer.getDropDatabaseMessage(response.getEvents().get(0).getMessage());
-    assertEquals(HCatEventMessage.EventType.DROP_DATABASE, 
dropDatabaseMessage.getEventType()); //Event type
-    assertThat(dropDatabaseMessage.getDB(), 
IsEqualIgnoringCase.equalToIgnoringCase(testDB)); // dbName
-    if(!useDbNotificationListener) {
-      assertEquals(expectedLocation.toLowerCase(), 
dropDatabaseMessage.getLocation()); //location
-    }
-  }
-
-  @Test
-  public void testCreateDropTableWithPartition() throws Exception {
-    testDB = "N_db" + random.nextInt(Integer.SIZE - 1);
-    String testTable = "N_table" + random.nextInt(Integer.SIZE - 1);
-
-    NotificationEventResponse response;
-    CurrentNotificationEventId latestID, previousID;
-    // Create database
-    createMetastoreDB(client, testDB);
-
-    // Create table with partition
-    // We need:
-    // - dbname
-    // - tablename
-    // - location
-    createMetastoreTableWithPartition(client, testDB,
-        testTable, Lists.newArrayList(new FieldSchema("col1", "int", "")),
-        Lists.newArrayList(new FieldSchema("part_col1", "string", "")));
-    latestID = client.getCurrentNotificationEventId();
-    response = client.getNextNotification(latestID.getEventId() - 1, 1, null);
-    SentryJSONCreateTableMessage createTableMessage = 
deserializer.getCreateTableMessage(response.getEvents().get(0).getMessage());
-    assertEquals(HCatEventMessage.EventType.CREATE_TABLE, 
createTableMessage.getEventType());
-    assertEquals(testDB, createTableMessage.getDB()); //dbName
-    assertEquals(testTable, createTableMessage.getTable()); //tableName
-    String expectedLocation = warehouseDir + "/" + testDB + ".db/" + testTable;
-    if(!useDbNotificationListener) {
-      assertEquals(expectedLocation.toLowerCase(), 
createTableMessage.getLocation());
-    }
-
-
-    //Drop table
-    // We need:
-    // - dbName
-    // - tableName
-    // - location
-    client.dropTable(testDB, testTable);
-    previousID = latestID;
-    latestID = client.getCurrentNotificationEventId();
-    assertEquals(previousID.getEventId() + 1, latestID.getEventId());
-    response = client.getNextNotification(latestID.getEventId() - 1, 1, null);
-    SentryJSONDropTableMessage dropTableMessage = 
deserializer.getDropTableMessage(response.getEvents().get(0).getMessage());
-    assertEquals(HCatEventMessage.EventType.DROP_TABLE, 
dropTableMessage.getEventType());
-    assertThat(dropTableMessage.getDB(), 
IsEqualIgnoringCase.equalToIgnoringCase(testDB));//dbName
-    assertThat(dropTableMessage.getTable(), 
IsEqualIgnoringCase.equalToIgnoringCase(testTable));//tableName
-    if(!useDbNotificationListener) {
-      assertEquals(expectedLocation.toLowerCase(), 
dropTableMessage.getLocation()); //location
-    }
-  }
-
-  @Test
-  public void testCreateDropTableWithoutPartition() throws Exception {
-    testDB = "N_db" + random.nextInt(Integer.SIZE - 1);
-    String testTable = "N_table" + random.nextInt(Integer.SIZE - 1);
-
-    NotificationEventResponse response;
-    CurrentNotificationEventId latestID, previousID;
-    // Create database
-    createMetastoreDB(client, testDB);
-
-    // Create table without partition
-    // We need:
-    // - dbname
-    // - tablename
-    // - location
-    createMetastoreTable(client, testDB, testTable, Lists.newArrayList(new 
FieldSchema("col1", "int", "")));
-    latestID = client.getCurrentNotificationEventId();
-    response = client.getNextNotification(latestID.getEventId() - 1, 1, null);
-    SentryJSONCreateTableMessage createTableMessage = 
deserializer.getCreateTableMessage(response.getEvents().get(0).getMessage());
-    assertEquals(HCatEventMessage.EventType.CREATE_TABLE, 
createTableMessage.getEventType());
-    assertEquals(testDB, createTableMessage.getDB()); //dbName
-    assertEquals(testTable, createTableMessage.getTable()); //tableName
-    String expectedLocation = warehouseDir + "/" + testDB + ".db/" + testTable;
-    if(!useDbNotificationListener) {
-      assertEquals(expectedLocation.toLowerCase(), 
createTableMessage.getLocation());
-    }
-
-    //Drop table
-    // We need:
-    // - dbName
-    // - tableName
-    // - location
-    client.dropTable(testDB, testTable);
-    previousID = latestID;
-    latestID = client.getCurrentNotificationEventId();
-    assertEquals(previousID.getEventId() + 1, latestID.getEventId());
-    response = client.getNextNotification(latestID.getEventId() - 1, 1, null);
-    SentryJSONDropTableMessage dropTableMessage = 
deserializer.getDropTableMessage(response.getEvents().get(0).getMessage());
-    assertEquals(HCatEventMessage.EventType.DROP_TABLE, 
dropTableMessage.getEventType());
-    assertThat(dropTableMessage.getDB(), 
IsEqualIgnoringCase.equalToIgnoringCase(testDB));//dbName
-    assertThat(dropTableMessage.getTable(), 
IsEqualIgnoringCase.equalToIgnoringCase(testTable));//tableName
-    if(!useDbNotificationListener) {
-      assertEquals(expectedLocation.toLowerCase(), 
dropTableMessage.getLocation()); //location
-    }
-  }
-
-  @Test
-  public void testAddDropPartition() throws Exception {
-    testDB = "N_db" + random.nextInt(Integer.SIZE - 1);
-    String testTable = "N_table" + random.nextInt(Integer.SIZE - 1);
-    String partColName = "part_col1";
-    String partColValue = "part1";
-
-    NotificationEventResponse response;
-    CurrentNotificationEventId latestID, previousID;
-    // Create database and table
-    createMetastoreDB(client, testDB);
-    Table tbl1 = createMetastoreTableWithPartition(client, testDB, testTable, 
Lists.newArrayList(new FieldSchema("col1", "int", "")),
-        Lists.newArrayList(new FieldSchema(partColName, "string", "")));
-
-    ArrayList<String> partVals1 = Lists.newArrayList(partColValue);
-
-    //Add partition
-    // We need:
-    // - dbName
-    // - tableName
-    // - partition location
-    addPartition(client, testDB, testTable, partVals1, tbl1);
-    latestID = client.getCurrentNotificationEventId();
-    response = client.getNextNotification(latestID.getEventId() - 1, 1, null);
-    SentryJSONAddPartitionMessage addPartitionMessage = 
deserializer.getAddPartitionMessage(response.getEvents().get(0).getMessage());
-    assertEquals(HCatEventMessage.EventType.ADD_PARTITION, 
addPartitionMessage.getEventType());
-    assertThat(addPartitionMessage.getDB(), 
IsEqualIgnoringCase.equalToIgnoringCase(testDB));// dbName (returns lowered 
version)
-    assertThat(addPartitionMessage.getTable(), 
IsEqualIgnoringCase.equalToIgnoringCase(testTable));// tableName (returns 
lowered version)
-    String expectedLocation = warehouseDir + "/" + testDB + ".db/" + testTable 
+ "/" + partColName + "=" + partColValue;
-    if(!useDbNotificationListener) {
-      assertEquals(expectedLocation.toLowerCase(), 
addPartitionMessage.getLocations().get(0));
-    }
-
-    //Drop partition
-    // We need:
-    // - dbName
-    // - tableName
-    // - partition location
-    dropPartition(client, testDB, testTable, partVals1);
-    previousID = latestID;
-    latestID = client.getCurrentNotificationEventId();
-    assertEquals(previousID.getEventId() + 1, latestID.getEventId());
-    response = client.getNextNotification(latestID.getEventId() - 1, 1, null);
-    SentryJSONDropPartitionMessage dropPartitionMessage = 
deserializer.getDropPartitionMessage(response.getEvents().get(0).getMessage());
-    assertEquals(HCatEventMessage.EventType.DROP_PARTITION, 
dropPartitionMessage.getEventType());
-    assertThat(dropPartitionMessage.getDB(), 
IsEqualIgnoringCase.equalToIgnoringCase(testDB)); //dbName
-    assertThat(dropPartitionMessage.getTable(), 
IsEqualIgnoringCase.equalToIgnoringCase(testTable)); //tableName
-    if(!useDbNotificationListener) {
-      assertEquals(Arrays.asList(expectedLocation.toLowerCase()), 
dropPartitionMessage.getLocations());
-    }
-  }
-
-  @Test
-  public void testAlterTableWithPartition() throws Exception {
-    testDB = "N_db" + random.nextInt(Integer.SIZE - 1);
-    String testTable = "N_table" + random.nextInt(Integer.SIZE - 1);
-
-    NotificationEventResponse response;
-    CurrentNotificationEventId latestID, previousID;
-    // Create database
-    createMetastoreDB(client, testDB);
-
-    // Create table with partition
-    Table tbl1 = createMetastoreTableWithPartition(client, testDB,
-        testTable, Lists.newArrayList(new FieldSchema("col1", "int", "")),
-        Lists.newArrayList(new FieldSchema("part_col1", "string", "")));
-    String oldLocation = tbl1.getSd().getLocation();
-
-    //Alter table location
-    // We need:
-    // - dbName
-    // - tableName
-    // - old location
-    // - new location
-    String tabDir1 = hiveServer.getProperty(HiveServerFactory.WAREHOUSE_DIR)
-        + File.separator + random.nextInt(Integer.SIZE - 1);
-    alterTableWithLocation(client, tbl1, tabDir1);
-    latestID = client.getCurrentNotificationEventId();
-    response = client.getNextNotification(latestID.getEventId()-1, 1, null);
-    SentryJSONAlterTableMessage alterTableMessage = 
deserializer.getAlterTableMessage(response.getEvents().get(0).getMessage());
-    assertEquals(HCatEventMessage.EventType.ALTER_TABLE, 
alterTableMessage.getEventType());
-    assertThat(alterTableMessage.getDB(), 
IsEqualIgnoringCase.equalToIgnoringCase(testDB));//dbName
-    assertThat(alterTableMessage.getTable(), 
IsEqualIgnoringCase.equalToIgnoringCase(testTable));//tableName
-    if(!useDbNotificationListener) {
-      assertEquals(oldLocation, alterTableMessage.getOldLocation()); 
//oldLocation
-      assertEquals(tbl1.getSd().getLocation(), 
alterTableMessage.getNewLocation()); //newLocation
-    }
-
-    //Alter table rename managed table - location also changes
-    // We need:
-    // - oldDbName
-    // - newDbName
-    // - oldTableName
-    // - newTableName
-    // - old location
-    // - new location
-    oldLocation = tbl1.getSd().getLocation();
-    String newDBName = testDB + random.nextInt(Integer.SIZE - 1);
-    String newTableName = testTable + random.nextInt(Integer.SIZE - 1);
-    String newLocation = tabDir1 + random.nextInt(Integer.SIZE - 1);
-    createMetastoreDB(client, newDBName);
-    previousID = latestID;
-    latestID = client.getCurrentNotificationEventId();
-    assertEquals(previousID.getEventId() + 1, latestID.getEventId());
-    alterTableRename(client, tbl1, newDBName, newTableName, newLocation);
-    previousID = latestID;
-    latestID = client.getCurrentNotificationEventId();
-    assertEquals(previousID.getEventId() + 1, latestID.getEventId());
-    response = client.getNextNotification(latestID.getEventId()-1, 1, null);
-    alterTableMessage = 
deserializer.getAlterTableMessage(response.getEvents().get(0).getMessage());
-    assertEquals(HCatEventMessage.EventType.ALTER_TABLE, 
alterTableMessage.getEventType());
-    assertThat(alterTableMessage.getDB(), 
IsEqualIgnoringCase.equalToIgnoringCase(testDB));//oldDbName
-    assertThat(alterTableMessage.getTable(), 
IsEqualIgnoringCase.equalToIgnoringCase(testTable));//oldTableName
-    assertThat(response.getEvents().get(0).getDbName(), 
IsEqualIgnoringCase.equalToIgnoringCase(newDBName));//newDbName
-    assertThat(response.getEvents().get(0).getTableName(), 
IsEqualIgnoringCase.equalToIgnoringCase(newTableName));//newTableName
-    if(!useDbNotificationListener) {
-      assertEquals(oldLocation, alterTableMessage.getOldLocation()); 
//oldLocation
-      assertEquals(tbl1.getSd().getLocation(), 
alterTableMessage.getNewLocation()); //newLocation
-    }
-  }
-
-  @Test
-  public void testAlterPartition() throws Exception {
-    testDB = "N_db" + random.nextInt(Integer.SIZE - 1);
-    String testTable = "N_table" + random.nextInt(Integer.SIZE - 1);
-    String partColName = "part_col1";
-    String partColValue = "part1";
-
-    NotificationEventResponse response;
-    CurrentNotificationEventId latestID;
-    // Create database
-    createMetastoreDB(client, testDB);
-
-    // Create table with partition
-    Table tbl1 = createMetastoreTableWithPartition(client, testDB,
-        testTable, Lists.newArrayList(new FieldSchema("col1", "int", "")),
-        Lists.newArrayList(new FieldSchema(partColName, "string", "")));
-    ArrayList<String> partVals1 = Lists.newArrayList(partColValue);
-    Partition partition = addPartition(client, testDB, testTable, partVals1, 
tbl1);
-
-    //Alter partition with location
-    // We need:
-    // - dbName
-    // - tableName
-    // - partition location
-    String oldLocation = tbl1.getSd().getLocation()  + "/" + partColName + "=" 
+ partColValue;
-    String newLocation = warehouseDir + File.separator + "newpart";
-    alterPartitionWithLocation(client, partition, newLocation);
-    latestID = client.getCurrentNotificationEventId();
-    response = client.getNextNotification(latestID.getEventId()-1, 1, null);
-    SentryJSONAlterPartitionMessage alterPartitionMessage = 
deserializer.getAlterPartitionMessage(response.getEvents().get(0).getMessage());
-    assertEquals(HCatEventMessage.EventType.ALTER_PARTITION, 
alterPartitionMessage.getEventType());
-    assertThat(alterPartitionMessage.getDB(), 
IsEqualIgnoringCase.equalToIgnoringCase(testDB));// dbName
-    assertThat(alterPartitionMessage.getTable(), 
IsEqualIgnoringCase.equalToIgnoringCase(testTable));// tableName
-    if(!useDbNotificationListener) {
-      assertEquals(oldLocation.toLowerCase(), 
alterPartitionMessage.getOldLocation());
-      assertEquals(newLocation.toLowerCase(), 
alterPartitionMessage.getNewLocation());
-      
assertTrue(partVals1.containsAll(alterPartitionMessage.getKeyValues().values()) 
&&
-          
alterPartitionMessage.getKeyValues().values().containsAll(partVals1));
-      assertEquals(partVals1, alterPartitionMessage.getNewValues());
-    }
-
-    Partition newPartition = partition.deepCopy();
-    ArrayList<String> partVals2 = Lists.newArrayList("part2");
-    newPartition.setValues(partVals2);
-    renamePartition(client, partition, newPartition);
-    latestID = client.getCurrentNotificationEventId();
-    response = client.getNextNotification(latestID.getEventId() - 1, 1, null);
-    alterPartitionMessage = 
deserializer.getAlterPartitionMessage(response.getEvents().get(0).getMessage());
-    assertEquals(HCatEventMessage.EventType.ALTER_PARTITION, 
alterPartitionMessage.getEventType());
-    assertThat(alterPartitionMessage.getDB(), 
IsEqualIgnoringCase.equalToIgnoringCase(testDB));// dbName
-    assertThat(alterPartitionMessage.getTable(), 
IsEqualIgnoringCase.equalToIgnoringCase(testTable));// tableName
-    if(!useDbNotificationListener) {
-      
assertTrue(partVals1.containsAll(alterPartitionMessage.getKeyValues().values()) 
&&
-          
alterPartitionMessage.getKeyValues().values().containsAll(partVals1));
-      assertEquals(partVals2, alterPartitionMessage.getNewValues());
-    }
-
-    dropMetastoreDBIfExists(client, testDB);
-  }
-}
-

Reply via email to