-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #448 from jamezp/WFARQ-165
Upgrade WildFly Plugin Tools and add new utilities and behavior
- Loading branch information
Showing
32 changed files
with
2,654 additions
and
123 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,6 +20,7 @@ | |
import java.util.Collections; | ||
import java.util.Map; | ||
import java.util.Map.Entry; | ||
import java.util.Objects; | ||
import java.util.Set; | ||
import java.util.concurrent.Future; | ||
|
||
|
@@ -39,7 +40,6 @@ | |
import org.jboss.logging.Logger; | ||
import org.jboss.shrinkwrap.api.Archive; | ||
import org.jboss.shrinkwrap.api.exporter.ZipExporter; | ||
import org.wildfly.common.Assert; | ||
import org.wildfly.plugin.tools.Deployment; | ||
import org.wildfly.plugin.tools.DeploymentManager; | ||
import org.wildfly.plugin.tools.DeploymentResult; | ||
|
@@ -56,7 +56,7 @@ | |
* @author <a href="mailto:[email protected]">James R. Perkins</a> | ||
* @since 17-Nov-2010 | ||
*/ | ||
@SuppressWarnings({ "WeakerAccess", "TypeMayBeWeakened", "DeprecatedIsStillUsed", "deprecation", "unused" }) | ||
@SuppressWarnings({ "WeakerAccess", "TypeMayBeWeakened", "DeprecatedIsStillUsed", "unused" }) | ||
public class ArchiveDeployer { | ||
|
||
private static final Logger log = Logger.getLogger(ArchiveDeployer.class); | ||
|
@@ -77,8 +77,7 @@ public class ArchiveDeployer { | |
*/ | ||
@Deprecated | ||
public ArchiveDeployer(DomainDeploymentManager deploymentManager) { | ||
Assert.checkNotNullParam("deploymentManager", deploymentManager); | ||
this.deploymentManagerDeprecated = deploymentManager; | ||
this.deploymentManagerDeprecated = Objects.requireNonNull(deploymentManager, "The deploymentManager cannot be null"); | ||
this.deploymentManager = null; | ||
} | ||
|
||
|
@@ -88,7 +87,7 @@ public ArchiveDeployer(DomainDeploymentManager deploymentManager) { | |
* @param client the client used to communicate with the server | ||
*/ | ||
public ArchiveDeployer(final ManagementClient client) { | ||
Assert.checkNotNullParam("client", client); | ||
Objects.requireNonNull(client, "The client cannot be null"); | ||
deploymentManagerDeprecated = null; | ||
this.deploymentManager = DeploymentManager.Factory.create(client.getControllerClient()); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
129 changes: 129 additions & 0 deletions
129
common/src/main/java/org/jboss/as/arquillian/container/ArquillianServerManager.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,129 @@ | ||
/* | ||
* JBoss, Home of Professional Open Source. | ||
* | ||
* Copyright 2024 Red Hat, Inc., and individual contributors | ||
* as indicated by the @author tags. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.jboss.as.arquillian.container; | ||
|
||
import java.io.IOException; | ||
import java.util.concurrent.TimeUnit; | ||
|
||
import org.jboss.as.controller.client.ModelControllerClient; | ||
import org.jboss.dmr.ModelNode; | ||
import org.wildfly.plugin.tools.ContainerDescription; | ||
import org.wildfly.plugin.tools.DeploymentManager; | ||
import org.wildfly.plugin.tools.server.ServerManager; | ||
|
||
/** | ||
* A delegating implementation of a {@link ServerManager} which does not allow {@link #shutdown()} attempts. If either | ||
* shutdown method is invoked, an {@link UnsupportedOperationException} will be thrown. | ||
* | ||
* @author <a href="mailto:[email protected]">James R. Perkins</a> | ||
*/ | ||
class ArquillianServerManager implements ServerManager { | ||
|
||
private final ServerManager delegate; | ||
|
||
ArquillianServerManager(ServerManager delegate) { | ||
this.delegate = delegate; | ||
} | ||
|
||
@Override | ||
public ModelControllerClient client() { | ||
return delegate.client(); | ||
} | ||
|
||
@Override | ||
public String serverState() { | ||
return delegate.serverState(); | ||
} | ||
|
||
@Override | ||
public String launchType() { | ||
return delegate.launchType(); | ||
} | ||
|
||
@Override | ||
public String takeSnapshot() throws IOException { | ||
return delegate.takeSnapshot(); | ||
} | ||
|
||
@Override | ||
public ContainerDescription containerDescription() throws IOException { | ||
return delegate.containerDescription(); | ||
} | ||
|
||
@Override | ||
public DeploymentManager deploymentManager() { | ||
return delegate.deploymentManager(); | ||
} | ||
|
||
@Override | ||
public boolean isRunning() { | ||
return delegate.isRunning(); | ||
} | ||
|
||
@Override | ||
public boolean waitFor(final long startupTimeout) throws InterruptedException { | ||
return delegate.waitFor(startupTimeout); | ||
} | ||
|
||
@Override | ||
public boolean waitFor(final long startupTimeout, final TimeUnit unit) throws InterruptedException { | ||
return delegate.waitFor(startupTimeout, unit); | ||
} | ||
|
||
/** | ||
* Throws an {@link UnsupportedOperationException} as the server is managed by Arquillian | ||
* | ||
* @throws UnsupportedOperationException as the server is managed by Arquillian | ||
*/ | ||
@Override | ||
public void shutdown() throws UnsupportedOperationException { | ||
throw new UnsupportedOperationException("Cannot shutdown a server managed by Arquillian"); | ||
} | ||
|
||
/** | ||
* Throws an {@link UnsupportedOperationException} as the server is managed by Arquillian | ||
* | ||
* @throws UnsupportedOperationException s the server is managed by Arquillian | ||
*/ | ||
@Override | ||
public void shutdown(final long timeout) throws UnsupportedOperationException { | ||
throw new UnsupportedOperationException("Cannot shutdown a server managed by Arquillian"); | ||
} | ||
|
||
@Override | ||
public void executeReload() throws IOException { | ||
delegate.executeReload(); | ||
} | ||
|
||
@Override | ||
public void executeReload(final ModelNode reloadOp) throws IOException { | ||
delegate.executeReload(reloadOp); | ||
} | ||
|
||
@Override | ||
public void reloadIfRequired() throws IOException { | ||
delegate.reloadIfRequired(); | ||
} | ||
|
||
@Override | ||
public void reloadIfRequired(final long timeout, final TimeUnit unit) throws IOException { | ||
delegate.reloadIfRequired(timeout, unit); | ||
} | ||
} |
53 changes: 53 additions & 0 deletions
53
common/src/main/java/org/jboss/as/arquillian/container/CommonContainerArchiveAppender.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/* | ||
* JBoss, Home of Professional Open Source. | ||
* | ||
* Copyright 2024 Red Hat, Inc., and individual contributors | ||
* as indicated by the @author tags. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.jboss.as.arquillian.container; | ||
|
||
import org.jboss.arquillian.container.test.spi.client.deployment.AuxiliaryArchiveAppender; | ||
import org.jboss.as.arquillian.api.ServerSetup; | ||
import org.jboss.as.arquillian.api.ServerSetupTask; | ||
import org.jboss.as.arquillian.setup.ConfigureLoggingSetupTask; | ||
import org.jboss.shrinkwrap.api.Archive; | ||
import org.jboss.shrinkwrap.api.ShrinkWrap; | ||
import org.jboss.shrinkwrap.api.asset.StringAsset; | ||
import org.jboss.shrinkwrap.api.spec.JavaArchive; | ||
import org.wildfly.plugin.tools.OperationExecutionException; | ||
|
||
/** | ||
* Creates a library to add to deployments for common container based dependencies for in-container tests. | ||
* | ||
* @author <a href="mailto:[email protected]">James R. Perkins</a> | ||
*/ | ||
public class CommonContainerArchiveAppender implements AuxiliaryArchiveAppender { | ||
|
||
@Override | ||
public Archive<?> createAuxiliaryArchive() { | ||
return ShrinkWrap.create(JavaArchive.class, "wildfly-common-testencricher.jar") | ||
// These two types are added to avoid exceptions with class loading for in-container tests. These | ||
// shouldn't really be used for in-container tests. | ||
.addClasses(ServerSetupTask.class, ServerSetup.class) | ||
.addClasses(ManagementClient.class) | ||
// Add the setup task implementations | ||
.addPackage(ConfigureLoggingSetupTask.class.getPackage()) | ||
// Adds wildfly-plugin-tools, this exception itself is explicitly needed | ||
.addPackages(true, OperationExecutionException.class.getPackage()) | ||
.setManifest(new StringAsset("Manifest-Version: 1.0\n" | ||
+ "Dependencies: org.jboss.as.controller-client,org.jboss.dmr\n")); | ||
} | ||
} |
Oops, something went wrong.