@Test public void alterPartitionEventMetadataOnly() { when(alterPartitionEvent.getEventType()).thenReturn(EventType.ALTER_PARTITION); when(alterPartitionEvent.getOldPartitionLocation()).thenReturn(OLD_LOCATION); when(alterPartitionEvent.getPartitionLocation()).thenReturn(OLD_LOCATION); boolean filter = locationOnlyUpdateListenerEventFilter.isFiltered(alterPartitionEvent, UNREFERENCED); assertThat(filter).isTrue(); }
@Override public boolean isFiltered(ListenerEvent listenerEvent, LifecycleEventType lifecycleEventType) { EventType eventType = listenerEvent.getEventType(); switch (eventType) { case ALTER_PARTITION: AlterPartitionEvent alterPartitionEvent = (AlterPartitionEvent) listenerEvent; return isLocationSame(alterPartitionEvent.getOldPartitionLocation(), alterPartitionEvent.getPartitionLocation()); case ALTER_TABLE: AlterTableEvent alterTableEvent = (AlterTableEvent) listenerEvent; return isLocationSame(alterTableEvent.getOldTableLocation(), alterTableEvent.getTableLocation()); default: return false; } }
LocationOnlyUpdateListenerEventFilter implements ListenerEventFilter { @Override public boolean isFiltered(ListenerEvent listenerEvent, LifecycleEventType lifecycleEventType) { EventType eventType = listenerEvent.getEventType(); switch (eventType) { case ALTER_PARTITION: AlterPartitionEvent alterPartitionEvent = (AlterPartitionEvent) listenerEvent; return isLocationSame(alterPartitionEvent.getOldPartitionLocation(), alterPartitionEvent.getPartitionLocation()); case ALTER_TABLE: AlterTableEvent alterTableEvent = (AlterTableEvent) listenerEvent; return isLocationSame(alterTableEvent.getOldTableLocation(), alterTableEvent.getTableLocation()); default: return false; } } }
LocationOnlyUpdateListenerEventFilter implements ListenerEventFilter { @Override public boolean isFiltered(ListenerEvent listenerEvent, LifecycleEventType lifecycleEventType) { EventType eventType = listenerEvent.getEventType(); switch (eventType) { case ALTER_PARTITION: AlterPartitionEvent alterPartitionEvent = (AlterPartitionEvent) listenerEvent; return isLocationSame(alterPartitionEvent.getOldPartitionLocation(), alterPartitionEvent.getPartitionLocation()); case ALTER_TABLE: AlterTableEvent alterTableEvent = (AlterTableEvent) listenerEvent; return isLocationSame(alterTableEvent.getOldTableLocation(), alterTableEvent.getTableLocation()); default: return false; } }  }
LocationOnlyUpdateListenerEventFilter implements ListenerEventFilter { @Override public boolean isFiltered(ListenerEvent listenerEvent, LifecycleEventType lifecycleEventType) { EventType eventType = listenerEvent.getEventType(); switch (eventType) { case ALTER_PARTITION: AlterPartitionEvent alterPartitionEvent = (AlterPartitionEvent) listenerEvent; return isLocationSame(alterPartitionEvent.getOldPartitionLocation(), alterPartitionEvent.getPartitionLocation()); case ALTER_TABLE: AlterTableEvent alterTableEvent = (AlterTableEvent) listenerEvent; return isLocationSame(alterTableEvent.getOldTableLocation(), alterTableEvent.getTableLocation()); default: return false; } }  @Override boolean isFiltered(ListenerEvent listenerEvent, LifecycleEventType lifecycleEventType); }
LocationOnlyUpdateListenerEventFilter implements ListenerEventFilter { @Override public boolean isFiltered(ListenerEvent listenerEvent, LifecycleEventType lifecycleEventType) { EventType eventType = listenerEvent.getEventType(); switch (eventType) { case ALTER_PARTITION: AlterPartitionEvent alterPartitionEvent = (AlterPartitionEvent) listenerEvent; return isLocationSame(alterPartitionEvent.getOldPartitionLocation(), alterPartitionEvent.getPartitionLocation()); case ALTER_TABLE: AlterTableEvent alterTableEvent = (AlterTableEvent) listenerEvent; return isLocationSame(alterTableEvent.getOldTableLocation(), alterTableEvent.getTableLocation()); default: return false; } }  @Override boolean isFiltered(ListenerEvent listenerEvent, LifecycleEventType lifecycleEventType);  }