@Test public void testCheckExistingIsSuperstate() throws Exception { String key1 = "key1"; String value1 = "value1"; String key2 = "key2"; String value2 = "value2"; State existingState = new State(); State newState = new State(); HiveRegistrationUnitComparator comparator = new HiveRegistrationUnitComparator<>(null, null); comparator.checkExistingIsSuperstate(existingState, newState); Assert.assertFalse(comparator.result); newState.setProp(key1, value1); comparator = new HiveRegistrationUnitComparator<>(null, null); comparator.checkExistingIsSuperstate(existingState, newState); Assert.assertTrue(comparator.result); existingState.setProp(key1, value2); comparator = new HiveRegistrationUnitComparator<>(null, null); comparator.checkExistingIsSuperstate(existingState, newState); Assert.assertTrue(comparator.result); existingState.setProp(key1, value1); existingState.setProp(key2, value2); comparator = new HiveRegistrationUnitComparator<>(null, null); comparator.checkExistingIsSuperstate(existingState, newState); Assert.assertFalse(comparator.result); }
protected void checkExistingIsSuperstate(State existingState, State newState) { checkExistingIsSuperset(existingState.getProperties().entrySet(), newState.getProperties().entrySet()); }
HiveRegistrationUnitComparator { protected void checkExistingIsSuperstate(State existingState, State newState) { checkExistingIsSuperset(existingState.getProperties().entrySet(), newState.getProperties().entrySet()); } }
HiveRegistrationUnitComparator { protected void checkExistingIsSuperstate(State existingState, State newState) { checkExistingIsSuperset(existingState.getProperties().entrySet(), newState.getProperties().entrySet()); } HiveRegistrationUnitComparator(HiveRegistrationUnit existingUnit, HiveRegistrationUnit newUnit); }
HiveRegistrationUnitComparator { protected void checkExistingIsSuperstate(State existingState, State newState) { checkExistingIsSuperset(existingState.getProperties().entrySet(), newState.getProperties().entrySet()); } HiveRegistrationUnitComparator(HiveRegistrationUnit existingUnit, HiveRegistrationUnit newUnit); @SuppressWarnings("unchecked") T compareRawLocation(); @SuppressWarnings("unchecked") T compareInputFormat(); @SuppressWarnings("unchecked") T compareOutputFormat(); @SuppressWarnings("unchecked") T compareIsCompressed(); @SuppressWarnings("unchecked") T compareNumBuckets(); @SuppressWarnings("unchecked") T compareBucketCols(); @SuppressWarnings("unchecked") T compareIsStoredAsSubDirs(); @SuppressWarnings("unchecked") T compareParameters(); @SuppressWarnings("unchecked") T compareAll(); boolean result(); }
HiveRegistrationUnitComparator { protected void checkExistingIsSuperstate(State existingState, State newState) { checkExistingIsSuperset(existingState.getProperties().entrySet(), newState.getProperties().entrySet()); } HiveRegistrationUnitComparator(HiveRegistrationUnit existingUnit, HiveRegistrationUnit newUnit); @SuppressWarnings("unchecked") T compareRawLocation(); @SuppressWarnings("unchecked") T compareInputFormat(); @SuppressWarnings("unchecked") T compareOutputFormat(); @SuppressWarnings("unchecked") T compareIsCompressed(); @SuppressWarnings("unchecked") T compareNumBuckets(); @SuppressWarnings("unchecked") T compareBucketCols(); @SuppressWarnings("unchecked") T compareIsStoredAsSubDirs(); @SuppressWarnings("unchecked") T compareParameters(); @SuppressWarnings("unchecked") T compareAll(); boolean result();  }