@@ -1093,6 +1093,7 @@ public void testHiveRefreshOnConfChange() throws Throwable{
10931093 assertTrue (prevHiveObj != newHiveObj );
10941094 }
10951095
1096+ @ Test
10961097 public void testFireInsertEvent () throws Throwable {
10971098 Hive hiveDb = Hive .getWithFastCheck (hiveConf , false );
10981099 String tableName = "test_fire_insert_event" ;
@@ -1101,6 +1102,18 @@ public void testFireInsertEvent() throws Throwable {
11011102 HiveIgnoreKeyTextOutputFormat .class );
11021103 Table table = hiveDb .getTable (tableName );
11031104 Path tablePath = table .getDataLocation ();
1105+
1106+ // Fire the InsertEvent with empty folder
1107+ hiveDb .fireInsertEvent (table , null , false ,
1108+ Lists .newArrayList (new FileStatus (5 , true , 1 , 64 , 100 , tablePath )));
1109+ // Get the last Metastore event
1110+ InsertEvent insertEvent1 = DummyFireInsertListener .getLastEvent ();
1111+ // Check the event
1112+ Assert .assertNotNull (insertEvent1 );
1113+ // getFiles should be empty and not null
1114+ Assert .assertNotNull (insertEvent1 .getFiles ());
1115+ Assert .assertTrue (insertEvent1 .getFiles ().isEmpty ());
1116+
11041117 // Create some files that "inserted"
11051118 FileSystem fileSystem = tablePath .getFileSystem (hiveConf );
11061119 fileSystem .deleteOnExit (tablePath );
@@ -1144,17 +1157,6 @@ public void testFireInsertEvent() throws Throwable {
11441157 Path insertedPath = new Path (insertEvent .getFiles ().get (i ));
11451158 Assert .assertEquals (expectedCheckSums .get (insertedPath .getName ()), checkSums .get (i ));
11461159 }
1147-
1148- // Fire the InsertEvent with empty folder
1149- hiveDb .fireInsertEvent (table , null , false ,
1150- Lists .newArrayList (new FileStatus (5 , true , 1 , 64 , 100 , tablePath )));
1151- // Get the last Metastore event
1152- InsertEvent insertEvent1 = DummyFireInsertListener .getLastEvent ();
1153- // Check the event
1154- Assert .assertNotNull (insertEvent1 );
1155- // getFiles should be empty and not null
1156- Assert .assertNotNull (insertEvent1 .getFiles ());
1157- Assert .assertTrue (insertEvent1 .getFiles ().isEmpty ());
11581160 }
11591161
11601162 private String getFileCheckSum (FileSystem fileSystem , Path p ) throws Exception {
0 commit comments