Skip to content

Commit

Permalink
Merge pull request #388 from jamezp/plugin-tools-upgrade
Browse files Browse the repository at this point in the history
Upgrade the wildfly-maven-plugin to 5.0.0.Final and the wildfly-plugi…
  • Loading branch information
jfdenise authored Apr 12, 2024
2 parents 497e99e + 2fc826b commit 72ff28a
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -91,14 +91,14 @@
import javax.security.sasl.RealmCallback;
import org.jboss.as.controller.client.OperationBuilder;
import org.wildfly.core.launcher.Launcher;
import org.wildfly.plugin.tools.server.ServerManager;
import org.wildfly.plugins.bootablejar.maven.common.Utils;
import org.wildfly.plugins.bootablejar.maven.goals.DevWatchContext.BootableAppEventHandler;
import org.wildfly.plugins.bootablejar.maven.goals.DevWatchContext.ProjectContext;
import org.jboss.as.controller.client.helpers.Operations;
import org.jboss.dmr.ModelNode;
import org.wildfly.core.launcher.BootableJarCommandBuilder;
import org.wildfly.plugin.common.PropertyNames;
import org.wildfly.plugin.tools.ServerHelper;

/**
* Build and start a bootable JAR for dev-watch mode. This goal monitors the
Expand Down Expand Up @@ -327,7 +327,7 @@ public void deploy(Path dir) throws Exception {
}
String name = dir.getFileName().toString();
try (ModelControllerClient client = createClient()) {
ServerHelper.waitForStandalone(client, timeout);
ServerManager.builder().client(client).process(process).standalone().waitFor(timeout, TimeUnit.SECONDS);
undeploy(client, name);
waitRemoved(client, name);
boolean success = deploy(client, dir);
Expand Down Expand Up @@ -373,7 +373,7 @@ public RemoteDeploymentController(String name) {
public void deploy(Path dir) throws Exception {
try (ModelControllerClient client = createClient()) {
getLog().debug("Trying to connect to the remote management API");
ServerHelper.waitForStandalone(client, timeout);
ServerManager.builder().client(client).process(process).standalone().waitFor(timeout, TimeUnit.SECONDS);
getLog().debug("Connection to the remote management API effective");
undeploy(client, name);
waitRemoved(client, name);
Expand Down Expand Up @@ -1296,7 +1296,7 @@ private void shutdownContainer() {
if (process.isAlive()) {
// Attempt to safely shutdown first
try (ModelControllerClient client = createClient()) {
ServerHelper.shutdownStandalone(client, timeout);
ServerManager.builder().client(client).process(process).standalone().shutdown(timeout);
} catch (Throwable ignore) {
process.destroy();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,15 @@
package org.wildfly.plugins.bootablejar.maven.goals;

import java.io.IOException;

import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.project.MavenProject;
import org.jboss.as.controller.client.ModelControllerClient;
import org.wildfly.plugin.common.AbstractServerConnection;
import org.wildfly.plugin.tools.ServerHelper;
import org.wildfly.plugin.tools.server.ServerManager;

/**
* Shutdown the bootable JAR. In order to be able to shutdown a running server,
Expand Down Expand Up @@ -53,7 +54,7 @@ public void execute() throws MojoExecutionException, MojoFailureException {
return;
}
try ( ModelControllerClient client = createClient()) {
ServerHelper.shutdownStandalone(client);
ServerManager.builder().client(client).standalone().shutdown(timeout);
} catch (IOException e) {
throw new MojoExecutionException(e.getMessage(), e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.TimeUnit;

import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.plugins.annotations.Mojo;
Expand All @@ -30,7 +32,7 @@
import org.wildfly.core.launcher.BootableJarCommandBuilder;
import org.wildfly.core.launcher.Launcher;
import org.wildfly.plugin.common.AbstractServerConnection;
import org.wildfly.plugin.tools.ServerHelper;
import org.wildfly.plugin.tools.server.ServerManager;
import org.wildfly.plugins.bootablejar.maven.common.Utils;

/**
Expand Down Expand Up @@ -128,7 +130,7 @@ private void doExecute(MavenProject project) throws MojoExecutionException, Mojo
final Process process = launcher.launch();
if (checkStarted) {
try (ModelControllerClient client = createClient()) {
ServerHelper.waitForStandalone(process, client, startupTimeout);
ServerManager.builder().client(client).process(process).standalone().waitFor(startupTimeout, TimeUnit.SECONDS);
}
}
} catch (Exception e) {
Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@
<version.org.jboss.galleon>6.0.0.Final</version.org.jboss.galleon>
<version.org.wildfly.core.wildfly-core>24.0.0.Beta3</version.org.wildfly.core.wildfly-core>
<version.org.wildfly.common>1.6.0.Final</version.org.wildfly.common>
<version.org.wildfly.plugins.wildfly-maven-plugin>5.0.0.Beta5</version.org.wildfly.plugins.wildfly-maven-plugin>
<version.org.wildfly.plugins.wildfly-plugin-tools>1.0.0.Final</version.org.wildfly.plugins.wildfly-plugin-tools>
<version.org.wildfly.plugins.wildfly-maven-plugin>5.0.0.Final</version.org.wildfly.plugins.wildfly-maven-plugin>
<version.org.wildfly.plugins.wildfly-plugin-tools>1.1.0.Final</version.org.wildfly.plugins.wildfly-plugin-tools>
<version.org.wildfly.channel>1.1.0.Final</version.org.wildfly.channel>
<version.org.wildfly.prospero>1.2.1.Final</version.org.wildfly.prospero>
<maven.surefire.plugin>3.0.0-M6</maven.surefire.plugin>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import org.wildfly.core.launcher.ProcessHelper;
import org.wildfly.plugin.tools.ServerHelper;
import org.wildfly.plugin.tools.bootablejar.BootableJarSupport;
import org.wildfly.plugin.tools.server.ServerManager;

/**
* @author jdenise
Expand Down Expand Up @@ -339,7 +339,7 @@ protected void checkURL(Path dir, String fileName, String url, boolean start, St
try (ModelControllerClient client = ModelControllerClient.Factory.create(TestEnvironment.getHost(),
TestEnvironment.getManagementPort())) {
// Wait for the server to start, this calls into the management interface.
ServerHelper.waitForStandalone(process, client, TestEnvironment.getTimeout());
ServerManager.builder().client(client).process(process).standalone().waitFor(TestEnvironment.getTimeout(), TimeUnit.SECONDS);
}

if (url == null) {
Expand Down Expand Up @@ -534,15 +534,17 @@ private static Collection<String> getJvmArgs(final boolean securityManager) {

private static void shutdown() throws IOException {
try (ModelControllerClient client = ModelControllerClient.Factory.create(TestEnvironment.getHost(), TestEnvironment.getManagementPort())) {
if (ServerHelper.isStandaloneRunning(client)) {
ServerHelper.shutdownStandalone(client, TestEnvironment.getTimeout());
final ServerManager serverManager = ServerManager.builder().client(client).standalone();
if (serverManager.isRunning()) {
serverManager.shutdown(TestEnvironment.getTimeout());
}
}
}

private static void shutdownAsync() throws IOException {
try (ModelControllerClient client = ModelControllerClient.Factory.create(TestEnvironment.getHost(), TestEnvironment.getManagementPort())) {
if (ServerHelper.isStandaloneRunning(client)) {
final ServerManager serverManager = ServerManager.builder().client(client).standalone();
if (serverManager.isRunning()) {
shutdownStandaloneAsync(client, TestEnvironment.getTimeout());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
import java.util.Locale;
import java.util.concurrent.TimeUnit;
import org.jboss.as.controller.client.ModelControllerClient;
import org.wildfly.plugin.tools.server.ServerManager;

import org.wildfly.plugin.tools.ServerHelper;
import static org.wildfly.plugins.bootablejar.maven.goals.DevWatchBootableJarMojo.TEST_PROPERTY_EXIT;

/**
Expand Down Expand Up @@ -134,7 +134,7 @@ public void run() {
goalThread.start();
Exception waitException = null;
try (ModelControllerClient client = ModelControllerClient.Factory.create(TestEnvironment.getHost(), TestEnvironment.getManagementPort())) {
ServerHelper.waitForStandalone(client, TestEnvironment.getTimeout() * 5);
ServerManager.builder().client(client).standalone().waitFor(TestEnvironment.getTimeout() * 5L, TimeUnit.SECONDS);
// Give some time for first deployment.
Thread.sleep(2000);
} catch (Exception ex) {
Expand Down

0 comments on commit 72ff28a

Please sign in to comment.