Package org.rhq.modules.plugins.jbossas7.json

Examples of org.rhq.modules.plugins.jbossas7.json.Result


        Address managedServerDeploymentAddress = new Address();
        managedServerDeploymentAddress.add("host", "master");
        managedServerDeploymentAddress.add("server", "server-one");
        managedServerDeploymentAddress.add("deployment", "javaee6-test-app.war");
        Result readAttributeResult = getDomainControllerASConnection().execute(
            new ReadResource(managedServerDeploymentAddress));

        assertTrue(readAttributeResult.isSuccess(), readAttributeResult.getFailureDescription());

        @SuppressWarnings("unchecked")
        Map<String, ?> attributes = (Map<String, ?>) readAttributeResult.getResult();

        assertEquals(attributes.get("enabled"), TRUE);
        assertEquals(attributes.get("runtime-name"), "javaee6-test-app.war");

        Address serverGroupDeploymentAddress = new Address();
        serverGroupDeploymentAddress.add("server-group", "main-server-group");
        serverGroupDeploymentAddress.add("deployment", "javaee6-test-app.war");
        Result removeDeploymentResult = getDomainControllerASConnection().execute(
            new Operation("remove", serverGroupDeploymentAddress));

        assertTrue(removeDeploymentResult.isSuccess(), "Could not clean domain controller deployment: "
            + removeDeploymentResult.getFailureDescription());
    }
View Full Code Here


                } catch (InterruptedException ignore) {
                }
                return;
            }
            // Standard operation. Return simple success
            Result result = new Result();
            result.setOutcome("success");
            objectMapper.writeValue(resp.getOutputStream(), result);
        }
View Full Code Here

        configuration.setSimpleValue(PATH_ATTRIBUTE, CONF_PATH);
        return configuration;
    }

    private Result createReadResourceResult() {
        Result result = new Result();
        result.setOutcome(SUCCESS);
        return result;
    }
View Full Code Here

        result.setOutcome(SUCCESS);
        return result;
    }

    private Result createReadAttributeResult() {
        Result result = new Result();
        result.setOutcome(SUCCESS);
        result.setResult("/" + WEBAPP);
        return result;
    }
View Full Code Here

        }

        // So we have an AS7/EAP6
        Address scanner = new Address("subsystem=deployment-scanner,scanner=default");
        ReadResource op = new ReadResource(scanner);
        Result res = getASConnection().execute(op);
        if (res.isSuccess()) {
            @SuppressWarnings("unchecked")
            Map<String, String> scannerMap = (Map<String, String>) res.getResult();
            String path = scannerMap.get("path");
            String relativeTo = scannerMap.get("relative-to");
            File basePath = resolveRelativePath(relativeTo);

            // It is safe to use File.separator, as the agent we are running in, will also lay down the plugins
View Full Code Here

    private File resolveRelativePath(String relativeTo) {

        Address addr = new Address("path", relativeTo);
        ReadResource op = new ReadResource(addr);
        Result res = getASConnection().execute(op);
        if (res.isSuccess()) {
            @SuppressWarnings("unchecked")
            Map<String, String> pathMap = (Map<String, String>) res.getResult();
            String path = pathMap.get("path");
            String relativeToProp = pathMap.get("relative-to");
            if (relativeToProp == null)
                return new File(path);
            else {
View Full Code Here

            return runCliCommand(parameters);
        }

        // reload, shutdown go to the remote server
        Operation op = new Operation(name, new Address());
        Result res = getASConnection().execute(op);

        OperationResult operationResult = postProcessResult(name, res);

        if (name.equals("shutdown")) {
            if (waitUntilDown()) {
View Full Code Here

    private boolean waitUntilReloaded() throws InterruptedException {
        boolean reloaded = false;
        while (!reloaded) {
            Operation op = new ReadAttribute(new Address(), "release-version");
            try {
                Result res = getASConnection().execute(op);
                if (res.isSuccess() && !res.isReloadRequired()) {
                    reloaded = true;
                }
            } catch (Exception e) {
                //do absolutely nothing
                //if an exception is thrown that means the server is still reloading, so consider this
View Full Code Here

        String runtimeName = contentUploader.getRuntimeName();
        String hash = contentUploader.getHash();

        Redeployer redeployer = new Redeployer(runtimeName, hash, getASConnection());
        if (redeployer.deploymentExists()) {
            Result result = redeployer.redeployOnServer();
            if (result.isRolledBack()) {
                return BundleHandoverResponse.failure(EXECUTION, result.getFailureDescription());
            }
            return BundleHandoverResponse.success();
        }

        Operation addDeploymentStep = new Operation("add", "deployment", filename);
        List<Object> addDeploymentContentProperty = new ArrayList<Object>(1);
        Map<String, Object> contentValues = new HashMap<String, Object>();
        contentValues.put("hash", new PROPERTY_VALUE("BYTES_VALUE", hash));
        addDeploymentContentProperty.add(contentValues);
        addDeploymentStep.addAdditionalProperty("content", addDeploymentContentProperty);
        addDeploymentStep.addAdditionalProperty("name", filename);
        addDeploymentStep.addAdditionalProperty("runtime-name", runtimeName);

        Operation deployStep = new Operation("deploy", addDeploymentStep.getAddress());

        CompositeOperation compositeOperation = new CompositeOperation();
        compositeOperation.addStep(addDeploymentStep);
        compositeOperation.addStep(deployStep);

        Result result = getASConnection().execute(compositeOperation, 300);
        if (!result.isSuccess()) {
            return BundleHandoverResponse.failure(EXECUTION, result.getFailureDescription());
        } else {
            return BundleHandoverResponse.success();
        }
    }
View Full Code Here

        assertTrue(response.isSuccess(), getFailureMessage(response));

        Address ejb3SubsystemAddress = new Address();
        ejb3SubsystemAddress.add("subsystem", "ejb3");
        Result readAttributeResult = getStandaloneASConnection().execute(
            new ReadAttribute(ejb3SubsystemAddress, "default-singleton-bean-access-timeout"));

        assertTrue(readAttributeResult.isSuccess(), readAttributeResult.getFailureDescription());

        Integer defaultSingletonBeanAccessTimeout = (Integer) readAttributeResult.getResult();

        assertEquals(defaultSingletonBeanAccessTimeout, Integer.valueOf(7777));
    }
View Full Code Here

TOP

Related Classes of org.rhq.modules.plugins.jbossas7.json.Result

Copyright © 2018 www.massapicom. 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.