当前位置: 首页>>代码示例>>Java>>正文


Java ServerDeploymentManager类代码示例

本文整理汇总了Java中org.jboss.as.controller.client.helpers.standalone.ServerDeploymentManager的典型用法代码示例。如果您正苦于以下问题:Java ServerDeploymentManager类的具体用法?Java ServerDeploymentManager怎么用?Java ServerDeploymentManager使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ServerDeploymentManager类属于org.jboss.as.controller.client.helpers.standalone包,在下文中一共展示了ServerDeploymentManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setup

import org.jboss.as.controller.client.helpers.standalone.ServerDeploymentManager; //导入依赖的package包/类
@Override
public void setup(final ManagementClient managementClient, final String containerId) throws Exception {
	final ServerDeploymentManager manager = ServerDeploymentManager.Factory
			.create(managementClient.getControllerClient());
	final DeploymentPlan plan = manager.newDeploymentPlan()
			.add(new File("src/test/resources/isolations/" + TEST_DS_XML)).andDeploy().build();
	final Future<ServerDeploymentPlanResult> future = manager.execute(plan);
	final ServerDeploymentPlanResult result = future.get(20, SECONDS);
	final ServerDeploymentActionResult actionResult = result.getDeploymentActionResult(plan.getId());
	if (actionResult != null) {
		final Throwable deploymentException = actionResult.getDeploymentException();
		if (deploymentException != null) {
			throw new RuntimeException(deploymentException);
		}
	}
}
 
开发者ID:PacktPublishing,项目名称:Mastering-Java-EE-Development-with-WildFly,代码行数:17,代码来源:ReadUncommittedTestCase.java

示例2: setup

import org.jboss.as.controller.client.helpers.standalone.ServerDeploymentManager; //导入依赖的package包/类
@Override
public void setup(final ManagementClient managementClient, final String containerId) throws Exception {
	final ServerDeploymentManager manager = ServerDeploymentManager.Factory
			.create(managementClient.getControllerClient());
	final DeploymentPlan plan = manager.newDeploymentPlan()
			.add(new File("src/test/resources/distributed/" + TEXTS_DS_XML)).andDeploy().build();
	final Future<ServerDeploymentPlanResult> future = manager.execute(plan);
	final ServerDeploymentPlanResult result = future.get(20, SECONDS);
	final ServerDeploymentActionResult actionResult = result.getDeploymentActionResult(plan.getId());
	if (actionResult != null) {
		final Throwable deploymentException = actionResult.getDeploymentException();
		if (deploymentException != null) {
			throw new RuntimeException(deploymentException);
		}
	}
}
 
开发者ID:PacktPublishing,项目名称:Mastering-Java-EE-Development-with-WildFly,代码行数:17,代码来源:DistributedTestCase.java

示例3: setup

import org.jboss.as.controller.client.helpers.standalone.ServerDeploymentManager; //导入依赖的package包/类
@Override
public void setup(final ManagementClient managementClient, final String containerId) throws Exception {
	copy(new File("src/test/resources/application-users.properties").toPath(),
			new File("target/wildfly-10.1.0.Final/standalone/configuration/application-users.properties")
					.toPath(),
			REPLACE_EXISTING);
	copy(new File("src/test/resources/application-roles.properties").toPath(),
			new File("target/wildfly-10.1.0.Final/standalone/configuration/application-roles.properties")
					.toPath(),
			REPLACE_EXISTING);
	final ServerDeploymentManager manager = ServerDeploymentManager.Factory
			.create(managementClient.getControllerClient());
	final DeploymentPlan plan = manager.newDeploymentPlan().add(new File("src/test/resources/" + FORUMS_DS_XML))
			.andDeploy().build();
	final Future<ServerDeploymentPlanResult> future = manager.execute(plan);
	final ServerDeploymentPlanResult result = future.get(20, SECONDS);
	final ServerDeploymentActionResult actionResult = result.getDeploymentActionResult(plan.getId());
	if (actionResult != null) {
		final Throwable deploymentException = actionResult.getDeploymentException();
		if (deploymentException != null) {
			throw new RuntimeException(deploymentException);
		}
	}
}
 
开发者ID:PacktPublishing,项目名称:Mastering-Java-EE-Development-with-WildFly,代码行数:25,代码来源:ApplicationTestCase.java

示例4: deploy

import org.jboss.as.controller.client.helpers.standalone.ServerDeploymentManager; //导入依赖的package包/类
@SuppressWarnings("ThrowableResultOfMethodCallIgnored")
private static void deploy(ServerDeploymentManager deploymentManager, String runtimeName, InputStream input) throws Throwable {
    ServerDeploymentPlanResult planResult;
    List<DeploymentAction> actions = new ArrayList<>();
    DeploymentPlanBuilder builder = deploymentManager.newDeploymentPlan();
    AddDeploymentPlanBuilder addBuilder = builder.add(runtimeName, input);
    actions.add(addBuilder.getLastAction());
    builder = addBuilder.andDeploy();
    actions.add(builder.getLastAction());
    DeploymentPlan plan = builder.build();
    Future<ServerDeploymentPlanResult> future = deploymentManager.execute(plan);
    planResult = future.get();
    for (DeploymentAction action : actions) {
        ServerDeploymentActionResult actionResult = planResult.getDeploymentActionResult(action.getId());
        if (actionResult.getDeploymentException() != null) {
            throw actionResult.getDeploymentException();
        }
    }
}
 
开发者ID:fabric8io,项目名称:jube,代码行数:20,代码来源:Deployer.java

示例5: undeployAndRemoveDeployment

import org.jboss.as.controller.client.helpers.standalone.ServerDeploymentManager; //导入依赖的package包/类
private void undeployAndRemoveDeployment(String deploymentName) {
    final ModelControllerClient client = managementClient.getControllerClient();
    final ServerDeploymentManager manager = ServerDeploymentManager.Factory.create(client);

    Future<ServerDeploymentPlanResult> future = manager.execute(manager.newDeploymentPlan()
            .undeploy(deploymentName)
            .remove(deploymentName)
            .build());

    awaitDeploymentExecution(future);

    File deploymentFile = new File("target/archives/" + deploymentName);
    if (deploymentFile.exists()) {
        cleanFile(deploymentFile);
    }
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:17,代码来源:DeploymentOperationsTestCase.java

示例6: testDeployment

import org.jboss.as.controller.client.helpers.standalone.ServerDeploymentManager; //导入依赖的package包/类
@Test
public void testDeployment() throws Exception {
    final ModelControllerClient client = managementClient.getControllerClient();
    final ServerDeploymentManager manager = ServerDeploymentManager.Factory.create(client);

    //Deploy
    Future<?> future = manager.execute(
            manager.newDeploymentPlan().add(testDeploymentFile.getName(), testDeploymentFile.getFile()).deploy(testDeploymentFile.getName()).build());
    awaitDeploymentExecution(future);

    //Check there
    ModelNode findDeployment = Util.createEmptyOperation(READ_RESOURCE_OPERATION,
            PathAddress.pathAddress(DEPLOYMENT, testDeploymentFile.getName()));
    Assert.assertTrue(
            managementClient.executeForResult(findDeployment).isDefined());

    //Undeploy
    future = manager.execute(manager.newDeploymentPlan().undeploy(testDeploymentFile.getName()).remove(testDeploymentFile.getName()).build());
    awaitDeploymentExecution(future);

    //Check deployment is gone
    ModelNode result = client.execute(findDeployment);
    Assert.assertEquals(FAILED, result.get(OUTCOME).asString());
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:25,代码来源:ClientAgainstOldServerTestCase.java

示例7: testInterrupted

import org.jboss.as.controller.client.helpers.standalone.ServerDeploymentManager; //导入依赖的package包/类
@Test
public void testInterrupted() throws IOException {
    ServerDeploymentManager sdm = new MockServerDeploymentManager(new InterruptedException());
    DeploymentPlanBuilder builder = sdm.newDeploymentPlan();
    builder = builder.add("test", createTempFile());
    DeploymentPlanImpl planImpl = getDeploymentPlanImpl(builder);
    safeGet(sdm, planImpl);
    InputStream is = getInputStream(planImpl);
    assertNotClosed(is);

    builder = sdm.newDeploymentPlan();
    builder = builder.add("test", createTempFile());
    planImpl = getDeploymentPlanImpl(builder);
    safeGetWithTimeout(sdm, planImpl);
    is = getInputStream(planImpl);
    assertNotClosed(is);
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:18,代码来源:InputStreamCleanupTestCase.java

示例8: testExecutionException

import org.jboss.as.controller.client.helpers.standalone.ServerDeploymentManager; //导入依赖的package包/类
@Test
public void testExecutionException() throws IOException {
    ServerDeploymentManager sdm = new MockServerDeploymentManager(new ExecutionException(new Exception()));
    DeploymentPlanBuilder builder = sdm.newDeploymentPlan();
    builder = builder.add("test", createTempFile());
    DeploymentPlanImpl planImpl = getDeploymentPlanImpl(builder);
    safeGet(sdm, planImpl);
    InputStream is = getInputStream(planImpl);
    assertClosed(is);

    builder = sdm.newDeploymentPlan();
    builder = builder.add("test", createTempFile());
    planImpl = getDeploymentPlanImpl(builder);
    safeGetWithTimeout(sdm, planImpl);
    is = getInputStream(planImpl);
    assertClosed(is);
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:18,代码来源:InputStreamCleanupTestCase.java

示例9: testRuntimeException

import org.jboss.as.controller.client.helpers.standalone.ServerDeploymentManager; //导入依赖的package包/类
@Test
public void testRuntimeException() throws IOException {
    ServerDeploymentManager sdm = new MockServerDeploymentManager(new RuntimeException());
    DeploymentPlanBuilder builder = sdm.newDeploymentPlan();
    builder = builder.add("test", createTempFile());
    DeploymentPlanImpl planImpl = getDeploymentPlanImpl(builder);
    safeGet(sdm, planImpl);
    InputStream is = getInputStream(planImpl);
    assertClosed(is);

    builder = sdm.newDeploymentPlan();
    builder = builder.add("test", createTempFile());
    planImpl = getDeploymentPlanImpl(builder);
    safeGetWithTimeout(sdm, planImpl);
    is = getInputStream(planImpl);
    assertClosed(is);
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:18,代码来源:InputStreamCleanupTestCase.java

示例10: tearDown

import org.jboss.as.controller.client.helpers.standalone.ServerDeploymentManager; //导入依赖的package包/类
@Override
public void tearDown(final ManagementClient managementClient, final String containerId) throws Exception {
	final ServerDeploymentManager manager = ServerDeploymentManager.Factory
			.create(managementClient.getControllerClient());
	final DeploymentPlan undeployPlan = manager.newDeploymentPlan().undeploy(TEST_DS_XML).andRemoveUndeployed()
			.build();
	manager.execute(undeployPlan).get();
}
 
开发者ID:PacktPublishing,项目名称:Mastering-Java-EE-Development-with-WildFly,代码行数:9,代码来源:ReadUncommittedTestCase.java

示例11: tearDown

import org.jboss.as.controller.client.helpers.standalone.ServerDeploymentManager; //导入依赖的package包/类
@Override
public void tearDown(final ManagementClient managementClient, final String containerId) throws Exception {
	final ServerDeploymentManager manager = ServerDeploymentManager.Factory
			.create(managementClient.getControllerClient());
	final DeploymentPlan undeployPlan = manager.newDeploymentPlan().undeploy(TEXTS_DS_XML).andRemoveUndeployed()
			.build();
	manager.execute(undeployPlan).get();
}
 
开发者ID:PacktPublishing,项目名称:Mastering-Java-EE-Development-with-WildFly,代码行数:9,代码来源:DistributedTestCase.java

示例12: tearDown

import org.jboss.as.controller.client.helpers.standalone.ServerDeploymentManager; //导入依赖的package包/类
@Override
public void tearDown(final ManagementClient managementClient, final String containerId) throws Exception {
	final ServerDeploymentManager manager = ServerDeploymentManager.Factory
			.create(managementClient.getControllerClient());
	final DeploymentPlan undeployPlan = manager.newDeploymentPlan().undeploy(FORUMS_DS_XML)
			.andRemoveUndeployed().build();
	manager.execute(undeployPlan).get();
}
 
开发者ID:PacktPublishing,项目名称:Mastering-Java-EE-Development-with-WildFly,代码行数:9,代码来源:ApplicationTestCase.java

示例13: testUniqueRuntimeName

import org.jboss.as.controller.client.helpers.standalone.ServerDeploymentManager; //导入依赖的package包/类
@Test
public void testUniqueRuntimeName() throws Exception {
    final JavaArchive archive1 = ServiceActivatorDeploymentUtil.createServiceActivatorDeploymentArchive("test-deployment1.jar", properties);
    final JavaArchive archive2 = ServiceActivatorDeploymentUtil.createServiceActivatorDeploymentArchive("test-deployment2.jar", properties2);
    archive2.addAsManifestResource(DeploymentTestCase.class.getPackage(), "marker.txt", "marker.txt");

    final ModelControllerClient client = managementClient.getControllerClient();
    final ServerDeploymentManager manager = ServerDeploymentManager.Factory.create(client);
    try (InputStream is1 = archive1.as(ZipExporter.class).exportAsInputStream();
            InputStream is2 = archive2.as(ZipExporter.class).exportAsInputStream();) {
        Future<?> future = manager.execute(manager.newDeploymentPlan()
                .add("test-deployment1.jar", "test-deployment.jar", is1)
                .add("test-deployment2.jar", "test-deployment.jar", is2)
                .build());
        awaitDeploymentExecution(future);
        checkDeploymentStatus(client, "test-deployment1.jar", "STOPPED");
        checkDeploymentStatus(client, "test-deployment2.jar", "STOPPED");
        future = manager.execute(manager.newDeploymentPlan().deploy("test-deployment1.jar").build());
        awaitDeploymentExecution(future);
        future = manager.execute(manager.newDeploymentPlan().deploy("test-deployment2.jar").build());
        awaitDeploymentExecution(future);
        checkDeploymentStatus(client, "test-deployment1.jar", "OK");
        checkDeploymentStatus(client, "test-deployment2.jar", "STOPPED");
        future = manager.execute(manager.newDeploymentPlan()
                .undeploy("test-deployment1.jar")
                .remove("test-deployment1.jar")
                .undeploy("test-deployment2.jar")
                .remove("test-deployment2.jar")
                .build());
        awaitDeploymentExecution(future);
    }
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:33,代码来源:DeploymentTestCase.java

示例14: cleanUp

import org.jboss.as.controller.client.helpers.standalone.ServerDeploymentManager; //导入依赖的package包/类
private void cleanUp(String deployment) {
    ModelNode op = new ModelNode();
    op.get(OP).set(READ_RESOURCE_OPERATION);
    op.get(OP_ADDR).set(ModelDescriptionConstants.DEPLOYMENT, deployment);
    ModelControllerClient client = managementClient.getControllerClient();
    ModelNode result;
    try {
        result = client.execute(op);
    } catch (IOException e) {
        throw new RuntimeException(e);
    }
    if (result != null && Operations.isSuccessfulOutcome(result)) {
        ServerDeploymentManager manager = ServerDeploymentManager.Factory.create(client);
        Future<?> future = manager.execute(manager.newDeploymentPlan()
                .undeploy(deployment)
                .remove(deployment)
                .build());

        awaitDeploymentExecution(future);
    }

    String jbossBaseDir = System.getProperty("jboss.home");
    Assert.assertNotNull(jbossBaseDir);
    Path dataDir = new File(jbossBaseDir).toPath().resolve("standalone").resolve("data");
    if (Files.exists(dataDir)) { cleanFile(dataDir.resolve("managed-exploded").toFile()); }
    File archivesDir = new File("target", "archives");
    if (Files.exists(archivesDir.toPath())) { cleanFile(archivesDir); }
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:29,代码来源:DeploymentTestCase.java

示例15: explodeDeploymentContentAndGetOutcome

import org.jboss.as.controller.client.helpers.standalone.ServerDeploymentManager; //导入依赖的package包/类
private boolean explodeDeploymentContentAndGetOutcome(String deploymentName, String archivePath) throws IOException {
    final ModelControllerClient client = managementClient.getControllerClient();
    final ServerDeploymentManager manager = ServerDeploymentManager.Factory.create(client);
    DeploymentPlan plan = manager.newDeploymentPlan()
            .undeploy(deploymentName)
            .explodeDeploymentContent(deploymentName, archivePath)
            .deploy(deploymentName)
            .build();
    Future<ServerDeploymentPlanResult> future = manager.execute(plan);
    return awaitDeploymentExecution(future).getDeploymentActionResult(plan.getDeploymentActions().get(plan.getDeploymentActions().size() - 1).getId()).getResult() == ServerUpdateActionResult.Result.EXECUTED;
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:12,代码来源:DeploymentOperationsTestCase.java


注:本文中的org.jboss.as.controller.client.helpers.standalone.ServerDeploymentManager类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。