Source:
public void testScriptRunChangeUserPasswordH2DB() throws Exception { final char[] dbPassword = {'w', 's', 'o', '2', 'c', 'a', 'r', 'b', 'o', 'n'}; serverPropertyMap.put("-DportOffset", Integer.toString(portOffset)); AutomationContext autoCtx = new AutomationContext(); CarbonTestServerManager server = new CarbonTestServerManager(autoCtx, System.getProperty("carbon.zip"), serverPropertyMap); carbonHome = server.startServer(); UserPopulator userPopulator = new UserPopulator("AS", "appServerInstance0002"); userPopulator.populateUsers(); server.stopServer(); String[] cmdArray; final String commandDirectory = carbonHome + File.separator + "bin"; if ((CarbonCommandToolsUtil.getCurrentOperatingSystem(). contains(OperatingSystems.WINDOWS.name().toLowerCase()))) { cmdArray = new String[] {"cmd.exe", "/c", "chpasswd.bat", "--db-url", "jdbc:h2:" + carbonHome + H2DB_URL, "--db-driver", "org.h2.Driver", "--db-username", "wso2carbon", "--db-password", String.valueOf(dbPassword), "--username", userName, "--new-password", String.valueOf(userNewPassword)}; } else { cmdArray = new String[] {"sh", "chpasswd.sh", "--db-url", "jdbc:h2:" + carbonHome + H2DB_URL, "--db-driver", "org.h2.Driver", "--db-username", "wso2carbon", "--db-password", String.valueOf(dbPassword), "--username", userName, "--new-password", String.valueOf(userNewPassword)}; } scriptRunStatus = CarbonCommandToolsUtil.isScriptRunSuccessfully(commandDirectory, cmdArray, "Password updated successfully"); log.info("Script running status : " + scriptRunStatus); assertTrue(scriptRunStatus, "Script executed unsuccessfully"); CarbonCommandToolsUtil.startServerUsingCarbonHome(carbonHome,1,context,null); }

Target:
public void testScriptRunChangeUserPasswordH2DB() throws Exception { serverPropertyMap.put("-DportOffset", Integer.toString(portOffset)); AutomationContext autoCtx = new AutomationContext(); CarbonTestServerManager server = new CarbonTestServerManager(autoCtx, System.getProperty("carbon.zip"), serverPropertyMap); String carbonHome = server.startServer(); UserPopulator userPopulator = new UserPopulator(ASIntegrationConstants.AS_PRODUCT_GROUP, ASIntegrationConstants.AS_INSTANCE_0002); userPopulator.populateUsers(); server.stopServer(); String[] cmdArray; final String commandDirectory = carbonHome + File.separator + "bin"; if ((CarbonCommandToolsUtil.getCurrentOperatingSystem().contains( OperatingSystems.WINDOWS.name().toLowerCase()))) { cmdArray = new String[]{ "cmd.exe", "/c", "chpasswd.bat", "--db-url", "jdbc:h2:" + carbonHome + dataSourceBean.getUrl(), "--db-driver", dataSourceBean.getDriverClassName(), "--db-username", dataSourceBean.getUserName(), "--db-password", String.valueOf(dataSourceBean.getPassWord()), "--username", userName, "--new-password", String.valueOf(userNewPassword)}; } else { cmdArray = new String[]{ "sh", "chpasswd.sh", "--db-url", "jdbc:h2:" + carbonHome + dataSourceBean.getUrl(), "--db-driver", "org.h2.Driver", "--db-username", "wso2carbon", "--db-password", String.valueOf(dataSourceBean.getPassWord()), "--username", userName, "--new-password", String.valueOf(userNewPassword)}; } boolean scriptRunStatus = CarbonCommandToolsUtil.isScriptRunSuccessfully(commandDirectory, cmdArray, "Password updated successfully"); log.info("Script running status : " + scriptRunStatus); assertTrue(scriptRunStatus, "Script executed unsuccessfully"); CarbonCommandToolsUtil.startServerUsingCarbonHome(carbonHome, 1, automationContext, null); }