UpgradeUtil { public static boolean initiateUpgrade( final String upgradeId, final String upgradeBinaryFileName ) { String upgradeScript = HmsConfigHolder.getHMSConfigProperty( UPGRADE_SCRIPT ); final String upgradeDir = UpgradeUtil.getUpgradeDir( upgradeId ); if ( upgradeId != null && upgradeBinaryFileName != null && upgradeScript != null ) { String upgradeScriptAbsPath = FilenameUtils.concat( upgradeDir, upgradeScript ); try { List<String> cmdWithArgs = new ArrayList<String>(); cmdWithArgs.add( 0, upgradeScriptAbsPath ); cmdWithArgs.add( 1, upgradeId ); cmdWithArgs.add( 2, upgradeDir ); cmdWithArgs.add( 3, upgradeDir ); cmdWithArgs.add( 4, upgradeBinaryFileName ); cmdWithArgs.add( 5, upgradeBinaryFileName + ".md5" ); int exitValue = ProcessUtil.getCommandExitValue( cmdWithArgs ); if ( exitValue == 0 ) { return true; } } catch ( Exception e ) { logger.error( "Error while initiating upgrade using script '{}'.", upgradeScriptAbsPath, e ); } } return false; } private  UpgradeUtil(); static boolean initiateUpgrade( final String upgradeId, final String upgradeBinaryFileName ); static boolean rollbackUpgrade( RollbackSpec rollbackSpec ); static Response validateUpgradeRequest( OobUpgradeSpec upgradeSpec ); static Response validateUpgradeBinaryChecksum( final OobUpgradeSpec upgradeSpec ); static Response validateUpgradeScripts( final String upgradeId ); static void validateRollbackRequest( RollbackSpec rollbackSpec ); static String getFileName( final Map<String, List<InputPart>> formDataMap ); static String getUpgradeId( final Map<String, List<InputPart>> formDataMap ); static byte[] getFileContent( final Map<String, List<InputPart>> formDataMap ); static void deleteUpgradeFiles( final String upgradeId ); static String getHmsUpgradeDir(); static String getUpgradeDir( final String upgradeId );  }
@Test public void testInitUpgradeWithNullSpec() { assertFalse( UpgradeUtil.initiateUpgrade( null, null ) ); }