UpgradeCatalog221 extends AbstractUpgradeCatalog { @Override protected void executeDMLUpdates() throws AmbariException, SQLException { addNewConfigurationsFromXml(); updateAlerts(); updateOozieConfigs(); updateTezConfigs(); updateRangerKmsDbksConfigs(); updateAMSConfigs(); } @Inject  UpgradeCatalog221(Injector injector); @Override String getTargetVersion(); @Override String getSourceVersion();  }
@Test public void testExecuteDMLUpdates() throws Exception { Method addNewConfigurationsFromXml = AbstractUpgradeCatalog.class.getDeclaredMethod("addNewConfigurationsFromXml"); Method updateAlerts = UpgradeCatalog221.class.getDeclaredMethod("updateAlerts"); Method updateOozieConfigs = UpgradeCatalog221.class.getDeclaredMethod("updateOozieConfigs"); Method updateTezConfigs = UpgradeCatalog221.class.getDeclaredMethod("updateTezConfigs"); Method updateRangerKmsDbksConfigs = UpgradeCatalog221.class.getDeclaredMethod("updateRangerKmsDbksConfigs"); Method updateAMSConfigs = UpgradeCatalog221.class.getDeclaredMethod("updateAMSConfigs"); UpgradeCatalog221 upgradeCatalog221 = createMockBuilder(UpgradeCatalog221.class) .addMockedMethod(addNewConfigurationsFromXml) .addMockedMethod(updateAlerts) .addMockedMethod(updateOozieConfigs) .addMockedMethod(updateTezConfigs) .addMockedMethod(updateRangerKmsDbksConfigs) .addMockedMethod(updateAMSConfigs) .createMock(); upgradeCatalog221.addNewConfigurationsFromXml(); expectLastCall().once(); upgradeCatalog221.updateAlerts(); expectLastCall().once(); upgradeCatalog221.updateOozieConfigs(); expectLastCall().once(); upgradeCatalog221.updateTezConfigs(); expectLastCall().once(); upgradeCatalog221.updateRangerKmsDbksConfigs(); expectLastCall().once(); upgradeCatalog221.updateAMSConfigs(); expectLastCall().once(); replay(upgradeCatalog221); upgradeCatalog221.executeDMLUpdates(); verify(upgradeCatalog221); }