Examples of DeploymentPlanBuilder


Examples of org.jboss.as.controller.client.helpers.standalone.DeploymentPlanBuilder

    }

    @Test
    public void testTimeoutException() throws IOException {
        ServerDeploymentManager sdm = new MockServerDeploymentManager(new TimeoutException());
        DeploymentPlanBuilder builder = sdm.newDeploymentPlan();
        builder = builder.add("test", createTempFile());
        DeploymentPlanImpl planImpl = getDeploymentPlanImpl(builder);
        safeGetWithTimeout(sdm, planImpl);
        InputStream is = getInputStream(planImpl);
        assertNotClosed(is);
    }
View Full Code Here

Examples of org.jboss.as.controller.client.helpers.standalone.DeploymentPlanBuilder

    }

    @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);
    }
View Full Code Here

Examples of org.jboss.as.controller.client.helpers.standalone.DeploymentPlanBuilder

    }

    @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);
    }
View Full Code Here

Examples of org.jboss.as.controller.client.helpers.standalone.DeploymentPlanBuilder

            DeploymentHolderService.addService(serviceTarget, contextName, dep);

            // Build and execute the deployment plan
            InputStream inputStream = dep.getRoot().openStream();
            try {
                DeploymentPlanBuilder builder = deploymentManager.newDeploymentPlan();
                builder = builder.add(contextName, inputStream).andDeploy();
                DeploymentPlan plan = builder.build();
                DeploymentAction deployAction = builder.getLastAction();
                executeDeploymentPlan(plan, deployAction);
            } finally {
                if(inputStream != null) try {
                    inputStream.close();
                } catch (IOException e) {
View Full Code Here

Examples of org.jboss.as.controller.client.helpers.standalone.DeploymentPlanBuilder

    public void uninstallBundle(Deployment dep) {
        ROOT_LOGGER.tracef("Uninstall deployment: %s", dep);

        try {
            // Undeploy through the deployment manager
            DeploymentPlanBuilder builder = deploymentManager.newDeploymentPlan();
            String contextName = DeploymentHolderService.getContextName(dep);
            builder = builder.undeploy(contextName).remove(contextName);
            DeploymentPlan plan = builder.build();
            DeploymentAction removeAction = builder.getLastAction();
            executeDeploymentPlan(plan, removeAction);
        } catch (Exception ex) {
            ROOT_LOGGER.cannotUndeployBundle(ex, dep);
        }
    }
View Full Code Here

Examples of org.jboss.as.controller.client.helpers.standalone.DeploymentPlanBuilder

    @Override
    public Status execute() throws DeploymentExecutionException, DeploymentFailureException {
        Status resultStatus = Status.SUCCESS;
        try {
            final ServerDeploymentManager manager = ServerDeploymentManager.Factory.create(client);
            final DeploymentPlanBuilder builder = manager.newDeploymentPlan();
            final DeploymentPlan plan = createPlan(builder);
            if (plan != null) {
                if (plan.getDeploymentActions().size() > 0) {
                    final ServerDeploymentPlanResult planResult = manager.execute(plan).get();
                    // Check the results
View Full Code Here

Examples of org.jboss.as.controller.client.helpers.standalone.DeploymentPlanBuilder

                                              final String matchPattern, final MatchPatternStrategy matchPatternStrategy) {
        return new StandaloneDeployment(client, content, name, type, matchPattern, matchPatternStrategy);
    }

    private DeploymentPlan createPlan(final DeploymentPlanBuilder builder) throws IOException, DeploymentFailureException {
        DeploymentPlanBuilder planBuilder = builder;

        List<String> existingDeployments = DeploymentInspector.getDeployments(client, name, matchPattern);

        switch (type) {
            case ADD: {
                planBuilder = builder.add(name, content);
                break;
            }
            case FORCE_ADD: {
                if (existingDeployments.contains(name)) {
                    planBuilder = builder.replace(name, content);
                } else {
                    planBuilder = builder.add(name, content);
                }
                break;
            }
            case DEPLOY: {
                planBuilder = builder.add(name, content).andDeploy();
                break;
            }
            case REDEPLOY: {
                planBuilder = builder.replace(name, content).redeploy(name);
                break;
            }
            case UNDEPLOY: {
                validateExistingDeployments(existingDeployments);
                planBuilder = undeployAndRemove(builder, existingDeployments);
                break;
            }
            case FORCE_DEPLOY: {
                if (existingDeployments.contains(name)) {
                    planBuilder = builder.replace(name, content).deploy(name);
                } else {
                    planBuilder = builder.add(name, content).andDeploy();
                }
                break;
            }
            case UNDEPLOY_IGNORE_MISSING: {
                validateExistingDeployments(existingDeployments);
                if (!existingDeployments.isEmpty()) {
                    planBuilder = undeployAndRemove(builder, existingDeployments);
                } else {
                    return null;
                }
                break;
            }
        }
        return planBuilder.build();
    }
View Full Code Here

Examples of org.jboss.as.controller.client.helpers.standalone.DeploymentPlanBuilder

        return planBuilder.build();
    }

    private DeploymentPlanBuilder undeployAndRemove(final DeploymentPlanBuilder builder, final List<String> deploymentNames) {

        DeploymentPlanBuilder planBuilder = builder;

        for (String deploymentName : deploymentNames) {
            planBuilder = planBuilder.undeploy(deploymentName).andRemoveUndeployed();

            if (matchPatternStrategy == MatchPatternStrategy.FIRST) {
                break;
            }
        }
View Full Code Here

Examples of org.jboss.as.controller.client.helpers.standalone.DeploymentPlanBuilder

    @Override
    public ContainerMethodExecutor deploy(Context context, Archive<?> archive) throws DeploymentException {
        try {
            InputStream input = archive.as(ZipExporter.class).exportZip();
            DeploymentPlanBuilder builder = deploymentManager.newDeploymentPlan().withRollback();
            builder = builder.add(archive.getName(), input).andDeploy();
            DeploymentPlan plan = builder.build();
            DeploymentAction deployAction = builder.getLastAction();
            executeDeploymentPlan(plan, deployAction,archive);

            return getContainerMethodExecutor(context);
        } catch (Exception e) {
            throw new DeploymentException("Could not deploy to container", e);
View Full Code Here

Examples of org.jboss.as.controller.client.helpers.standalone.DeploymentPlanBuilder

    @Override
    public void undeploy(Context context, Archive<?> archive) throws DeploymentException {
        String runtimeName = registry.remove(archive);
        if (runtimeName != null) {
            try {
                DeploymentPlanBuilder builder = deploymentManager.newDeploymentPlan().withRollback();
                DeploymentPlan plan = builder.undeploy(runtimeName).remove(runtimeName).build();
                Future<ServerDeploymentPlanResult> future = deploymentManager.execute(plan);
                future.get();
            } catch (Exception ex) {
                log.warning("Cannot undeploy: " + runtimeName + ":" + ex.getMessage());
            }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.