本文整理汇总了Java中org.wildfly.plugin.core.UndeployDescription类的典型用法代码示例。如果您正苦于以下问题:Java UndeployDescription类的具体用法?Java UndeployDescription怎么用?Java UndeployDescription使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
UndeployDescription类属于org.wildfly.plugin.core包,在下文中一共展示了UndeployDescription类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: enableDisableDeployment
import org.wildfly.plugin.core.UndeployDescription; //导入依赖的package包/类
private void enableDisableDeployment(String name, boolean enable, Set<String> serverGroups) throws Exception {
if (serverGroups == null) {
serverGroups = Collections.emptySet();
}
DeploymentManager dm = DeploymentManager.Factory.create(getModelControllerClient());
DeploymentResult result;
if (enable) {
SimpleDeploymentDescription sdd = SimpleDeploymentDescription.of(name);
sdd.addServerGroups(serverGroups);
result = dm.deployToRuntime(sdd);
} else {
UndeployDescription ud = UndeployDescription.of(name);
ud.addServerGroups(serverGroups);
ud.setRemoveContent(false);
result = dm.undeploy(ud);
}
if (!result.successful()) {
throw new FailureException(result.getFailureMessage());
}
return; // everything is OK
}
示例2: testDeploy
import org.wildfly.plugin.core.UndeployDescription; //导入依赖的package包/类
@Test
public void testDeploy() throws Exception {
// Make sure the archive is not deployed
if (deploymentManager.hasDeployment(DEPLOYMENT_NAME)) {
deploymentManager.undeploy(UndeployDescription.of(DEPLOYMENT_NAME));
}
final AbstractDeployment deployMojo = lookupMojoAndVerify("deploy", "deploy-webarchive-pom.xml");
deployMojo.execute();
// Verify deployed
assertTrue("Deployment " + DEPLOYMENT_NAME + " was not deployed", deploymentManager.hasDeployment(DEPLOYMENT_NAME));
// /deployment=test.war :read-attribute(name=status)
final ModelNode address = ServerOperations.createAddress("deployment", DEPLOYMENT_NAME);
final ModelNode op = ServerOperations.createReadAttributeOperation(address, "status");
final ModelNode result = executeOperation(op);
assertEquals("OK", ServerOperations.readResultAsString(result));
deploymentManager.undeploy(UndeployDescription.of(DEPLOYMENT_NAME));
}
示例3: testForceDeploy
import org.wildfly.plugin.core.UndeployDescription; //导入依赖的package包/类
@Test
public void testForceDeploy() throws Exception {
// Make sure the archive is not deployed
if (!deploymentManager.hasDeployment(DEPLOYMENT_NAME)) {
deploymentManager.deploy(getDeployment());
}
final AbstractDeployment deployMojo = lookupMojoAndVerify("deploy", "deploy-webarchive-pom.xml");
deployMojo.execute();
// Verify deployed
assertTrue("Deployment " + DEPLOYMENT_NAME + " was not deployed", deploymentManager.hasDeployment(DEPLOYMENT_NAME));
// /deployment=test.war :read-attribute(name=status)
final ModelNode address = ServerOperations.createAddress("deployment", DEPLOYMENT_NAME);
final ModelNode op = ServerOperations.createReadAttributeOperation(address, "status");
final ModelNode result = executeOperation(op);
assertEquals("OK", ServerOperations.readResultAsString(result));
deploymentManager.undeploy(UndeployDescription.of(DEPLOYMENT_NAME));
}
示例4: testRedeploy
import org.wildfly.plugin.core.UndeployDescription; //导入依赖的package包/类
@Test
public void testRedeploy() throws Exception {
// Make sure the archive is deployed
if (!deploymentManager.hasDeployment(DEPLOYMENT_NAME)) {
deploymentManager.deploy(getDeployment());
}
final AbstractDeployment deployMojo = lookupMojoAndVerify("redeploy", "redeploy-webarchive-pom.xml");
deployMojo.execute();
// Verify deployed
assertTrue("Deployment " + DEPLOYMENT_NAME + " was not deployed", deploymentManager.hasDeployment(DEPLOYMENT_NAME));
// /deployment=test.war :read-attribute(name=status)
final ModelNode address = ServerOperations.createAddress("deployment", DEPLOYMENT_NAME);
final ModelNode op = ServerOperations.createReadAttributeOperation(address, "status");
final ModelNode result = executeOperation(op);
assertEquals("OK", ServerOperations.readResultAsString(result));
deploymentManager.undeploy(UndeployDescription.of(DEPLOYMENT_NAME));
}
示例5: testDeploy
import org.wildfly.plugin.core.UndeployDescription; //导入依赖的package包/类
@Test
public void testDeploy() throws Exception {
// Make sure the archive is not deployed
if (deploymentManager.hasDeployment(DEPLOYMENT_NAME)) {
deploymentManager.undeploy(UndeployDescription.of(DEPLOYMENT_NAME));
}
final AbstractDeployment deployMojo = lookupMojoAndVerify("deploy-only", "deploy-only-webarchive-pom.xml");
deployMojo.execute();
// Verify deployed
assertTrue("Deployment " + DEPLOYMENT_NAME + " was not deployed", deploymentManager.hasDeployment(DEPLOYMENT_NAME));
// /deployment=test.war :read-attribute(name=status)
final ModelNode address = ServerOperations.createAddress("deployment", DEPLOYMENT_NAME);
final ModelNode op = ServerOperations.createReadAttributeOperation(address, "status");
final ModelNode result = executeOperation(op);
assertEquals("OK", ServerOperations.readResultAsString(result));
}
示例6: testDeployUrl
import org.wildfly.plugin.core.UndeployDescription; //导入依赖的package包/类
@Test
public void testDeployUrl() throws Exception {
// Make sure the archive is not deployed
if (deploymentManager.hasDeployment(DEPLOYMENT_NAME)) {
deploymentManager.undeploy(UndeployDescription.of(DEPLOYMENT_NAME));
}
final AbstractDeployment deployMojo = getUrlDeploymentMojo("deploy-only", "deploy-only-webarchive-pom.xml");
deployMojo.execute();
// Verify deployed
assertTrue("Deployment " + DEPLOYMENT_NAME + " was not deployed", deploymentManager.hasDeployment(DEPLOYMENT_NAME));
// /deployment=test.war :read-attribute(name=status)
final ModelNode address = ServerOperations.createAddress("deployment", DEPLOYMENT_NAME);
final ModelNode op = ServerOperations.createReadAttributeOperation(address, "status");
final ModelNode result = executeOperation(op);
assertEquals("OK", ServerOperations.readResultAsString(result));
}
示例7: testDeploy
import org.wildfly.plugin.core.UndeployDescription; //导入依赖的package包/类
private void testDeploy(final DeployArtifactMojo mojo, final String classifier) throws Exception {
if (deploymentManager.hasDeployment(artifactName)) {
deploymentManager.undeploy(UndeployDescription.of(artifactName));
}
mojo.project.setDependencyArtifacts(Collections.singleton(createArtifact(classifier)));
mojo.execute();
// Verify deployed
assertTrue("Deployment " + artifactName + " was not deployed", deploymentManager.hasDeployment(artifactName));
// /deployment=test.war :read-attribute(name=status)
final ModelNode address = ServerOperations.createAddress("deployment", artifactName);
final ModelNode op = ServerOperations.createReadAttributeOperation(address, "status");
final ModelNode result = executeOperation(op);
assertEquals("OK", ServerOperations.readResultAsString(result));
}
示例8: testDeployWithCommands
import org.wildfly.plugin.core.UndeployDescription; //导入依赖的package包/类
@Test
public void testDeployWithCommands() throws Exception {
// Make sure the archive is not deployed
if (deploymentManager.hasDeployment(DEPLOYMENT_NAME, DEFAULT_SERVER_GROUP)) {
deploymentManager.undeploy(UndeployDescription.of(DEPLOYMENT_NAME).addServerGroups(DEFAULT_SERVER_GROUPS));
}
executeAndVerifyDeploymentExists("deploy", "deploy-webarchive-with-commands-pom.xml");
// Ensure that org.jboss.as.logging exists and foo does not
ModelNode address = ServerOperations.createAddress("profile", "full", "subsystem", "logging", "logger", "foo");
ModelNode op = ServerOperations.createReadResourceOperation(address);
ModelNode result = client.execute(op);
assertFalse("Logger foo was not removed", ServerOperations.isSuccessfulOutcome(result));
address = ServerOperations.createAddress("profile", "full", "subsystem", "logging", "logger", "org.jboss.as.logging");
op = ServerOperations.createReadResourceOperation(address);
result = client.execute(op);
assertTrue("Logger org.jboss.as.logging was not added", ServerOperations.isSuccessfulOutcome(result));
// Remove the logger to clean-up
op = ServerOperations.createRemoveOperation(address);
executeOperation(op);
deploymentManager.undeploy(UndeployDescription.of(DEPLOYMENT_NAME).addServerGroups(DEFAULT_SERVER_GROUPS));
}
示例9: testDeployOnlyWithCommands
import org.wildfly.plugin.core.UndeployDescription; //导入依赖的package包/类
@Test
public void testDeployOnlyWithCommands() throws Exception {
// Make sure the archive is not deployed
if (deploymentManager.hasDeployment(DEPLOYMENT_NAME, DEFAULT_SERVER_GROUP)) {
deploymentManager.undeploy(UndeployDescription.of(DEPLOYMENT_NAME).addServerGroups(DEFAULT_SERVER_GROUPS));
}
executeAndVerifyDeploymentExists("deploy-only", "deploy-webarchive-with-commands-pom.xml");
// Ensure that org.jboss.as.logging exists and foo does not
ModelNode address = ServerOperations.createAddress("profile", "full", "subsystem", "logging", "logger", "foo");
ModelNode op = ServerOperations.createReadResourceOperation(address);
ModelNode result = client.execute(op);
assertFalse("Logger foo was not removed", ServerOperations.isSuccessfulOutcome(result));
address = ServerOperations.createAddress("profile", "full", "subsystem", "logging", "logger", "org.jboss.as.logging");
op = ServerOperations.createReadResourceOperation(address);
result = client.execute(op);
assertTrue("Logger org.jboss.as.logging was not added", ServerOperations.isSuccessfulOutcome(result));
// Remove the logger to clean-up
op = ServerOperations.createRemoveOperation(address);
executeOperation(op);
deploymentManager.undeploy(UndeployDescription.of(DEPLOYMENT_NAME).addServerGroups(DEFAULT_SERVER_GROUPS));
}
示例10: testDeployNewServerGroup
import org.wildfly.plugin.core.UndeployDescription; //导入依赖的package包/类
@Test
public void testDeployNewServerGroup() throws Exception {
// Make sure the deployment is deployed to the main-server-group and not deployed to the other-server-group
if (!deploymentManager.hasDeployment(DEPLOYMENT_NAME, "main-server-group")) {
deploymentManager.deploy(getDeployment().addServerGroup("main-server-group"));
}
if (deploymentManager.hasDeployment(DEPLOYMENT_NAME, "other-server-group")) {
deploymentManager.undeploy(UndeployDescription.of(DEPLOYMENT_NAME).addServerGroup("other-deployment-group"));
}
// Set up the other-server-group servers to ensure the full deployment process works correctly
final ModelNode op = ServerOperations.createOperation("start-servers", ServerOperations.createAddress(ClientConstants.SERVER_GROUP, "other-server-group"));
op.get("blocking").set(true);
executeOperation(op);
// Deploy to both server groups and ensure the deployment exists on both, it should already be on the
// main-server-group and should have been added to the other-server-group
final Set<String> serverGroups = new HashSet<>(Arrays.asList("main-server-group", "other-server-group"));
executeAndVerifyDeploymentExists("deploy", "deploy-multi-server-group-pom.xml", null, serverGroups);
deploymentManager.undeploy(UndeployDescription.of(DEPLOYMENT_NAME).addServerGroups(serverGroups));
}
示例11: undeploy
import org.wildfly.plugin.core.UndeployDescription; //导入依赖的package包/类
/**
* Undeploys the content specified by the {@code runtimeName} from the server groups.
*
* @param runtimeName the name of the deployment
* @param serverGroups the server groups to undeploy to
*
* @throws DeploymentException if an error occurs during undeployment
*/
public void undeploy(String runtimeName, Set<String> serverGroups) throws DeploymentException {
if (serverGroups.isEmpty()) {
throw new DeploymentException("No target server groups to deploy to.");
}
try {
if (deploymentManager != null) {
final DeploymentResult result = deploymentManager.undeploy(UndeployDescription.of(runtimeName)
.addServerGroups(serverGroups));
if (!result.successful()) {
log.warnf("Cannot undeploy %s: %s", runtimeName, result.getFailureMessage());
}
} else {
DeploymentPlanBuilder builder = deploymentManagerDeprecated.newDeploymentPlan();
UndeployDeploymentPlanBuilder undeployBuilder = builder.undeploy(runtimeName);
ServerGroupDeploymentPlanBuilder serverGroupBuilder = null;
for (String target : serverGroups) {
serverGroupBuilder = (serverGroupBuilder == null ? undeployBuilder.toServerGroup(target) : serverGroupBuilder.toServerGroup(target));
}
@SuppressWarnings("ConstantConditions")
DeploymentPlan plan = serverGroupBuilder.build();
Future<DeploymentPlanResult> future = deploymentManagerDeprecated.execute(plan);
future.get();
}
} catch (Exception ex) {
log.warnf("Cannot undeploy %s: %s", runtimeName, ex.getLocalizedMessage());
}
}
示例12: undeploy
import org.wildfly.plugin.core.UndeployDescription; //导入依赖的package包/类
/**
* Removes an archive from the running container.
* <p>
* All exceptions are caught and logged as a warning. {@link Error Errors} will still be thrown however.
* </p>
*
* @param runtimeName the runtime name for the deployment
* @param failOnMissing {@code true} if the undeploy should fail if the deployment was not found on the server,
* {@code false} if the deployment does not exist and the undeploy should be ignored
*/
@SuppressWarnings("SameParameterValue")
public void undeploy(final String runtimeName, final boolean failOnMissing) {
checkState();
try {
final DeploymentResult result = deploymentManager.undeploy(UndeployDescription.of(runtimeName).setFailOnMissing(failOnMissing));
if (!result.successful()) {
log.warnf("Failed to undeploy %s: %s", runtimeName, result.getFailureMessage());
}
} catch (Exception ex) {
log.warnf(ex, "Cannot undeploy: %s", runtimeName);
}
}
示例13: testDeployWithRuntimeName
import org.wildfly.plugin.core.UndeployDescription; //导入依赖的package包/类
@Test
public void testDeployWithRuntimeName() throws Exception {
// Make sure the archive is not deployed
if (deploymentManager.hasDeployment(DEPLOYMENT_NAME)) {
deploymentManager.undeploy(UndeployDescription.of(DEPLOYMENT_NAME));
}
final AbstractDeployment deployMojo = lookupMojoAndVerify("deploy", "deploy-webarchive-with-runtime-name-pom.xml");
deployMojo.execute();
// Verify deployed
assertTrue("Deployment " + DEPLOYMENT_NAME + " was not deployed", deploymentManager.hasDeployment(DEPLOYMENT_NAME));
// /deployment=test.war :read-attribute(name=status)
final ModelNode address = ServerOperations.createAddress("deployment", DEPLOYMENT_NAME);
final ModelNode op = ServerOperations.createReadResourceOperation(address);
op.get(ClientConstants.INCLUDE_RUNTIME).set(true);
final ModelNode result = executeOperation(op);
if (!ServerOperations.isSuccessfulOutcome(result)) {
fail(ServerOperations.getFailureDescriptionAsString(result));
}
assertEquals("OK", ServerOperations.readResult(result).get("status").asString());
assertEquals("test-runtime.war", ServerOperations.readResult(result).get("runtime-name").asString());
deploymentManager.undeploy(UndeployDescription.of(DEPLOYMENT_NAME));
}
示例14: testDeployWithCommands
import org.wildfly.plugin.core.UndeployDescription; //导入依赖的package包/类
@Test
public void testDeployWithCommands() throws Exception {
// Make sure the archive is not deployed
if (deploymentManager.hasDeployment(DEPLOYMENT_NAME)) {
deploymentManager.undeploy(UndeployDescription.of(DEPLOYMENT_NAME));
}
final AbstractDeployment deployMojo = lookupMojoAndVerify("deploy", "deploy-webarchive-with-commands-pom.xml");
deployMojo.execute();
// /deployment=test.war :read-attribute(name=status)
ModelNode address = ServerOperations.createAddress("deployment", DEPLOYMENT_NAME);
ModelNode op = ServerOperations.createReadAttributeOperation(address, "status");
ModelNode result = executeOperation(op);
assertEquals("OK", ServerOperations.readResultAsString(result));
// Ensure that org.jboss.as.logging exists and foo does not
address = ServerOperations.createAddress("subsystem", "logging", "logger", "foo");
op = ServerOperations.createReadResourceOperation(address);
result = client.execute(op);
assertFalse("Logger foo was not removed", ServerOperations.isSuccessfulOutcome(result));
address = ServerOperations.createAddress("subsystem", "logging", "logger", "org.jboss.as.logging");
op = ServerOperations.createReadResourceOperation(address);
result = client.execute(op);
assertTrue("Logger org.jboss.as.logging was not added", ServerOperations.isSuccessfulOutcome(result));
// Remove the logger to clean-up
op = ServerOperations.createRemoveOperation(address);
executeOperation(op);
deploymentManager.undeploy(UndeployDescription.of(DEPLOYMENT_NAME));
}
示例15: testDeployWithCommands
import org.wildfly.plugin.core.UndeployDescription; //导入依赖的package包/类
@Test
public void testDeployWithCommands() throws Exception {
// Make sure the archive is not deployed
if (deploymentManager.hasDeployment(DEPLOYMENT_NAME)) {
deploymentManager.undeploy(UndeployDescription.of(DEPLOYMENT_NAME));
}
final AbstractDeployment deployMojo = lookupMojoAndVerify("deploy-only", "deploy-only-webarchive-with-commands-pom.xml");
deployMojo.execute();
// /deployment=test.war :read-attribute(name=status)
ModelNode address = ServerOperations.createAddress("deployment", DEPLOYMENT_NAME);
ModelNode op = ServerOperations.createReadAttributeOperation(address, "status");
ModelNode result = executeOperation(op);
assertEquals("OK", ServerOperations.readResultAsString(result));
// Ensure that org.jboss.as.logging exists and foo does not
address = ServerOperations.createAddress("subsystem", "logging", "logger", "foo");
op = ServerOperations.createReadResourceOperation(address);
result = client.execute(op);
assertFalse("Logger foo was not removed", ServerOperations.isSuccessfulOutcome(result));
address = ServerOperations.createAddress("subsystem", "logging", "logger", "org.jboss.as.logging");
op = ServerOperations.createReadResourceOperation(address);
result = client.execute(op);
assertTrue("Logger org.jboss.as.logging was not added", ServerOperations.isSuccessfulOutcome(result));
// Remove the logger to clean-up
op = ServerOperations.createRemoveOperation(address);
executeOperation(op);
}