當前位置: 首頁>>代碼示例>>Java>>正文


Java UndeployDescription類代碼示例

本文整理匯總了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
}
 
開發者ID:hawkular,項目名稱:hawkular-agent,代碼行數:25,代碼來源:DeploymentJBossASClient.java

示例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));
}
 
開發者ID:wildfly,項目名稱:wildfly-maven-plugin,代碼行數:24,代碼來源:DeployTest.java

示例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));
}
 
開發者ID:wildfly,項目名稱:wildfly-maven-plugin,代碼行數:24,代碼來源:DeployTest.java

示例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));
}
 
開發者ID:wildfly,項目名稱:wildfly-maven-plugin,代碼行數:24,代碼來源:DeployTest.java

示例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));
}
 
開發者ID:wildfly,項目名稱:wildfly-maven-plugin,代碼行數:23,代碼來源:DeployOnlyTest.java

示例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));
}
 
開發者ID:wildfly,項目名稱:wildfly-maven-plugin,代碼行數:23,代碼來源:DeployOnlyTest.java

示例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));
}
 
開發者ID:wildfly,項目名稱:wildfly-maven-plugin,代碼行數:19,代碼來源:ArtifactDeploymentTest.java

示例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));
}
 
開發者ID:wildfly,項目名稱:wildfly-maven-plugin,代碼行數:27,代碼來源:DeployTest.java

示例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));
}
 
開發者ID:wildfly,項目名稱:wildfly-maven-plugin,代碼行數:27,代碼來源:DeployTest.java

示例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));
}
 
開發者ID:wildfly,項目名稱:wildfly-maven-plugin,代碼行數:21,代碼來源:DeployTest.java

示例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());
    }
}
 
開發者ID:wildfly,項目名稱:wildfly-arquillian,代碼行數:36,代碼來源:ArchiveDeployer.java

示例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);
    }
}
 
開發者ID:wildfly,項目名稱:wildfly-arquillian,代碼行數:23,代碼來源:ArchiveDeployer.java

示例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));
}
 
開發者ID:wildfly,項目名稱:wildfly-maven-plugin,代碼行數:29,代碼來源:DeployTest.java

示例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));
}
 
開發者ID:wildfly,項目名稱:wildfly-maven-plugin,代碼行數:36,代碼來源:DeployTest.java

示例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);
}
 
開發者ID:wildfly,項目名稱:wildfly-maven-plugin,代碼行數:35,代碼來源:DeployOnlyTest.java


注:本文中的org.wildfly.plugin.core.UndeployDescription類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。