@Test public void testVerifyUpgradePath() throws Exception{ Method verifyUpgradePath = schemaUpgradeHelper.getClass().getDeclaredMethod("verifyUpgradePath", String.class, String.class); verifyUpgradePath.setAccessible(true); boolean failToVerify = (boolean)verifyUpgradePath.invoke(schemaUpgradeHelper, "0.3.0", "0.2.0"); boolean verifyPassed = (boolean)verifyUpgradePath.invoke(schemaUpgradeHelper, "0.1.0", "0.2.0"); Assert.assertTrue(verifyPassed); Assert.assertFalse(failToVerify); }
private boolean verifyUpgradePath(String minUpgradeVersion, String sourceVersion){ if (null == minUpgradeVersion){ return false; } return VersionUtils.compareVersions(sourceVersion, minUpgradeVersion) >= 0; }
SchemaUpgradeHelper { private boolean verifyUpgradePath(String minUpgradeVersion, String sourceVersion){ if (null == minUpgradeVersion){ return false; } return VersionUtils.compareVersions(sourceVersion, minUpgradeVersion) >= 0; } }
SchemaUpgradeHelper { private boolean verifyUpgradePath(String minUpgradeVersion, String sourceVersion){ if (null == minUpgradeVersion){ return false; } return VersionUtils.compareVersions(sourceVersion, minUpgradeVersion) >= 0; } @Inject  SchemaUpgradeHelper(Set<UpgradeCatalog> allUpgradeCatalogs,
                             PersistService persistService,
                             DBAccessor dbAccessor,
                             Configuration configuration); }
SchemaUpgradeHelper { private boolean verifyUpgradePath(String minUpgradeVersion, String sourceVersion){ if (null == minUpgradeVersion){ return false; } return VersionUtils.compareVersions(sourceVersion, minUpgradeVersion) >= 0; } @Inject  SchemaUpgradeHelper(Set<UpgradeCatalog> allUpgradeCatalogs,
                             PersistService persistService,
                             DBAccessor dbAccessor,
                             Configuration configuration); void startPersistenceService(); void stopPersistenceService(); Set<UpgradeCatalog> getAllUpgradeCatalogs(); String readSourceVersion(); void executeUpgrade(List<UpgradeCatalog> upgradeCatalogs); void executePreDMLUpdates(List<UpgradeCatalog> upgradeCatalogs); void executeDMLUpdates(List<UpgradeCatalog> upgradeCatalogs, String ambariUpgradeConfigUpdatesFileName); void executeOnPostUpgrade(List<UpgradeCatalog> upgradeCatalogs); void resetUIState(); void cleanUpRCATables(); static void main(String[] args); }
SchemaUpgradeHelper { private boolean verifyUpgradePath(String minUpgradeVersion, String sourceVersion){ if (null == minUpgradeVersion){ return false; } return VersionUtils.compareVersions(sourceVersion, minUpgradeVersion) >= 0; } @Inject  SchemaUpgradeHelper(Set<UpgradeCatalog> allUpgradeCatalogs,
                             PersistService persistService,
                             DBAccessor dbAccessor,
                             Configuration configuration); void startPersistenceService(); void stopPersistenceService(); Set<UpgradeCatalog> getAllUpgradeCatalogs(); String readSourceVersion(); void executeUpgrade(List<UpgradeCatalog> upgradeCatalogs); void executePreDMLUpdates(List<UpgradeCatalog> upgradeCatalogs); void executeDMLUpdates(List<UpgradeCatalog> upgradeCatalogs, String ambariUpgradeConfigUpdatesFileName); void executeOnPostUpgrade(List<UpgradeCatalog> upgradeCatalogs); void resetUIState(); void cleanUpRCATables(); static void main(String[] args);  }