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

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


        String securityDomainId = TEST_DOMAIN + "2";
        destination.addSegment(SECURITY_DOMAIN_RESOURCE_KEY + "=" + securityDomainId);

        ASConnection connection = getDomainControllerASConnection();
        Result result = new Result();
        Operation op = null;
        //delete old one if present to setup clean slate
        op = new Operation("remove", destination);
        result = connection.execute(op);

        //build/rebuild hierarchy
        op = new Operation("add", destination);
        result = connection.execute(op);
        assert result.getOutcome().equals("success") : "Add of Security Domain has failed: "
            + result.getFailureDescription();

        //Ex. profile=standalone-ha,subsystem=security,security-domain
View Full Code Here


        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

        private ObjectMapper objectMapper = new ObjectMapper();

        @Override
        protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
            Operation operation = objectMapper.readValue(req.getInputStream(), Operation.class);
            // Check if we recevied an operation which a real http management interface might interrupt
            if (operation.getOperation().equals("reload") || operation.getOperation().equals("shutdown")) {
                // Schedule a Jetty restart
                executorService.submit(new RestartJetty());
                // Then wait until Jetty is shutdown
                try {
                    Thread.sleep(Long.MAX_VALUE);
View Full Code Here

        } else if (name.equals("executeCommands") || name.equals("executeScript")) {
            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")) {
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;
                }
View Full Code Here

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

        Map<String, ?> attributes = (Map<String, ?>) readAttributeResult.getResult();

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

        Result removeDeploymentResult = getStandaloneASConnection().execute(new Operation("remove", deploymentAddress));

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

        Address address = new Address();
        address.add("subsystem", "web");
        address.add("connector", "http");

        Operation operation = new WriteAttribute(address, "socket-binding", "jndi");

        ObjectMapper mapper = new ObjectMapper();

        String result = mapper.writeValueAsString(operation);
        Operation op = mapper.readValue(result, Operation.class);
        assertNotSame(op, null);
        assertNotSame(op.getOperation(), null, "op.operation was null!");
        assertEquals(op.getOperation(), operation.getOperation(), "Operation is " + op.getOperation());
        assertNotSame(op.getName(), null, "op.getName is null");
        assertEquals("socket-binding", op.getName(), "attribute name  is " + op.getName() + " and not 'socket-binding'");
        assertEquals(op.getValue(), "jndi", "attribute value  is " + op.getValue());
        assertSame(op.getAddress().size(), 2, "Address did not contain 2 parts, but " + op.getAddress().size());

    }
View Full Code Here

        Map<String, Object> props = new HashMap<String, Object>();
        props.put("profile", "default");
        props.put("someBool", true);

        Operation operation = new Operation("add", address, props);
        operation.addAdditionalProperty("foo", "bar");

        ObjectMapper mapper = new ObjectMapper();

        String result = mapper.writeValueAsString(operation);

        assertFalse(result.contains("name"), "Result contains a name property but should not, " + result);
        assertFalse(result.contains("null"), "Result contains null values but should not, " + result);

        Operation op = mapper.readValue(result, Operation.class);
        assertEquals(op.getOperation(), operation.getOperation(), "Operation is " + op.getOperation());
        assertTrue(op.getAdditionalProperties().containsKey("someBool"), "Key someBool not found ");
        Object someBool = op.getAdditionalProperties().get("someBool");
        assertTrue((Boolean) someBool, "someBool was not true");

    }
View Full Code Here

        Map<String, Object> props = new HashMap<String, Object>();
        props.put("profile", "default");
        props.put("someBool", true);

        Operation operation = new Operation("add", address, props);
        operation.addAdditionalProperty("foo", "bar");

        ObjectMapper mapper = new ObjectMapper();

        String result = mapper.writeValueAsString(operation);

        assertFalse(result.contains("operation-headers"),
            "Result contains a operation-headers property but should not, " + result);

        operation.allowResourceServiceRestart();

        result = mapper.writeValueAsString(operation);

        assertTrue(result.contains("operation-headers"),
            "Result does not contain a operation-headers property but should, " + result);
View Full Code Here

TOP

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

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.