Source:
<code>private void testMoveOptimization(String primarydb, String replicadb, String replicatedDbName_CM, String tbl, String eventType, WarehouseInstance.Tuple tuple) throws Throwable { List<String> withConfigs = Arrays.asList("'hive.repl.enable.move.optimization'='true'"); BehaviourInjection<NotificationEvent, Boolean> callerVerifier = new BehaviourInjection<NotificationEvent, Boolean>() { @Nullable @Override public Boolean apply(@Nullable NotificationEvent entry) { if (entry.getEventType().equalsIgnoreCase(eventType) && entry.getTableName().equalsIgnoreCase(tbl)) { injectionPathCalled = true; LOG.warn("Verifier - DB: " + String.valueOf(entry.getDbName()) + " Table: " + String.valueOf(entry.getTableName()) + " Event: " + String.valueOf(entry.getEventType())); return false; } return true; } }; InjectableBehaviourObjectStore.setAddNotificationModifier(callerVerifier); <START> replica.loadFailure(replicadb, tuple.dumpLocation, withConfigs); <END> InjectableBehaviourObjectStore.resetAddNotificationModifier(); callerVerifier.assertInjectionsPerformed(true, false); replica.load(replicadb, tuple.dumpLocation, withConfigs); replica.run("use " + replicadb) .run("select country from " + tbl) .verifyResults(Arrays.asList("india")); primary.run("use " + primarydb) .run("drop table " + tbl); InjectableBehaviourObjectStore.setAddNotificationModifier(callerVerifier); replica.loadFailure(replicatedDbName_CM, tuple.dumpLocation, withConfigs); InjectableBehaviourObjectStore.resetAddNotificationModifier(); callerVerifier.assertInjectionsPerformed(true, false); replica.load(replicatedDbName_CM, tuple.dumpLocation, withConfigs); replica.run("use " + replicatedDbName_CM) .run("select country from " + tbl) .verifyResults(Arrays.asList("india")) .run(" drop database if exists " + replicatedDbName_CM + " cascade"); }</code><technical_language>Put in try catch block call InjectableBehaviourObjectStore.resetAddNotificationModifier in finally block</technical_language>

Target:
private void testMoveOptimization(String primarydb, String replicadb, String replicatedDbName_CM, String tbl, String eventType, WarehouseInstance.Tuple tuple) throws Throwable { List<String> withConfigs = Arrays.asList("'hive.repl.enable.move.optimization'='true'"); BehaviourInjection<NotificationEvent, Boolean> callerVerifier = new BehaviourInjection<NotificationEvent, Boolean>() { @Nullable @Override public Boolean apply(@Nullable NotificationEvent entry) { if (entry.getEventType().equalsIgnoreCase(eventType) && entry.getTableName().equalsIgnoreCase(tbl)) { injectionPathCalled = true; LOG.warn("Verifier - DB: " + String.valueOf(entry.getDbName()) + " Table: " + String.valueOf(entry.getTableName()) + " Event: " + String.valueOf(entry.getEventType())); return false; } return true; } }; InjectableBehaviourObjectStore.setAddNotificationModifier(callerVerifier); try { replica.loadFailure(replicadb, tuple.dumpLocation, withConfigs); } finally { InjectableBehaviourObjectStore.resetAddNotificationModifier(); } callerVerifier.assertInjectionsPerformed(true, false); replica.load(replicadb, tuple.dumpLocation, withConfigs); replica.run("use " + replicadb) .run("select country from " + tbl + " where country == 'india'") .verifyResults(Arrays.asList("india")); primary.run("use " + primarydb) .run("drop table " + tbl); InjectableBehaviourObjectStore.setAddNotificationModifier(callerVerifier); try { replica.loadFailure(replicatedDbName_CM, tuple.dumpLocation, withConfigs); } finally { InjectableBehaviourObjectStore.resetAddNotificationModifier(); } callerVerifier.assertInjectionsPerformed(true, false); replica.load(replicatedDbName_CM, tuple.dumpLocation, withConfigs); replica.run("use " + replicatedDbName_CM) .run("select country from " + tbl + " where country == 'india'") .verifyResults(Arrays.asList("india")) .run(" drop database if exists " + replicatedDbName_CM + " cascade"); }