Skip to content

Commit

Permalink
[WFCORE-4919] Minor formatting fixes, minor improvements for code rea…
Browse files Browse the repository at this point in the history
…dbility
  • Loading branch information
yersan committed May 29, 2024
1 parent 7db065b commit b9eaad7
Showing 1 changed file with 10 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,17 @@
*/
public class ModelParserUtils {
// Timeout for the embedded Server / Host Controller to fully start, in seconds.
private final static long EMBEDDED_FULLY_STARTED_TIMEOUT = TimeoutUtil.adjust(5*60);
private static final long EMBEDDED_FULLY_STARTED_TIMEOUT = TimeoutUtil.adjust(5*60);

/**
* Tests the ability to boot an admin-only server using the given config, persist the config,
* reload it, and confirm that the configuration model from the original boot matches the model
* from the reload.
*
* @param originalConfig the config file to use
* @param jbossHome directory to use as $JBOSS_HOME
* @param jbossHome directory to use as $JBOSS_HOME
* @return the configuration model read after the reload
* @throws Exception
* @throws Exception if an error occurs
*/
public static ModelNode standaloneXmlTest(File originalConfig, File jbossHome) throws Exception {
File serverDir = new File(jbossHome, "standalone");
Expand Down Expand Up @@ -80,9 +80,9 @@ public static ModelNode standaloneXmlTest(File originalConfig, File jbossHome) t
* from the reload.
*
* @param originalConfig the config file to use for the host model
* @param jbossHome directory to use as $JBOSS_HOME
* @param jbossHome directory to use as $JBOSS_HOME
* @return the host subtree from the configuration model read after the reload
* @throws Exception
* @throws Exception if an error occurs
*/
public static ModelNode hostXmlTest(final File originalConfig, File jbossHome) throws Exception {
return hostControllerTest(originalConfig, jbossHome, true);
Expand Down Expand Up @@ -140,15 +140,15 @@ private static ModelNode pruneDomainModel(ModelNode model, boolean forHost) {
* from the reload.
*
* @param originalConfig the config file to use for the domain model
* @param jbossHome directory to use as $JBOSS_HOME
* @param jbossHome directory to use as $JBOSS_HOME
* @return the configuration model read after the reload, excluding the host subtree
* @throws Exception
* @throws Exception if an error occurs
*/
public static ModelNode domainXmlTest(File originalConfig, File jbossHome) throws Exception {
return hostControllerTest(originalConfig, jbossHome, false);
}

private static void assertProcessState(CLIWrapper cli, String expected, int timeout, boolean forHost) throws IOException, InterruptedException {
private static void assertProcessState(CLIWrapper cli, String expected, int timeout, boolean forHost) throws InterruptedException {
long done = timeout < 1 ? 0 : System.currentTimeMillis() + timeout;
StringBuilder historyBuf = new StringBuilder();
String state = null;
Expand All @@ -157,8 +157,7 @@ private static void assertProcessState(CLIWrapper cli, String expected, int time
state = forHost ? getHostState(cli) : getServerState(cli);
historyBuf.append(state).append("\n");
} catch (Exception ignored) {
//
historyBuf.append(ignored.toString()).append("--").append(cli.readOutput()).append("\n");
historyBuf.append(ignored).append("--").append(cli.readOutput()).append("\n");
}
if (expected.equals(state)) {
return;
Expand Down Expand Up @@ -193,7 +192,7 @@ private static String getHostState(CLIWrapper cli) throws IOException {
private static ModelNode readResourceTree(CLIWrapper cli) {
cli.sendLine("/:read-resource(recursive=true)");
ModelNode response = ModelNode.fromString(cli.readOutput());
assertTrue(response.toString(), SUCCESS.equals(response.get(OUTCOME).asString()));
assertEquals(response.toString(), SUCCESS, response.get(OUTCOME).asString());
ModelNode firstResult = response.get(RESULT);
assertTrue(response.toString(), firstResult.isDefined());
return firstResult;
Expand Down

0 comments on commit b9eaad7

Please sign in to comment.