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

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


        System.out.println("Add to /deploy done " + ret);
        System.out.flush();

        assert ret.toString().contains("success") : ret;

        Address serverGroupAddress = new Address();
        serverGroupAddress.add("server-group", "main-server-group");
        serverGroupAddress.add("deployment", TEST_WAR_FILE_NAME);

        Operation attach = new Operation("add", serverGroupAddress);
        attach.addAdditionalProperty("enabled", true);
        System.out.flush();
        ret = connection.executeRaw(attach);
View Full Code Here


        String bytes_value = uploadToAs(TEST_WAR_PATH);

        System.out.println("Prepare done");
        System.out.flush();

        Address deploymentsAddress = new Address();
        deploymentsAddress.add("deployment", TEST_WAR_FILE_NAME);
        Operation step1 = new Operation("add", deploymentsAddress);
        List<Object> content = new ArrayList<Object>(1);
        Map<String, Object> contentValues = new HashMap<String, Object>();
        contentValues.put("hash", new PROPERTY_VALUE("BYTES_VALUE", bytes_value));
        content.add(contentValues);
        step1.addAdditionalProperty("content", content);
        step1.addAdditionalProperty("name", TEST_WAR_FILE_NAME); // this needs to be unique per upload

        Address serverGroupAddress = new Address();
        serverGroupAddress.add("server-group", "main-server-group");
        serverGroupAddress.add("deployment", TEST_WAR_FILE_NAME);
        Operation step2 = new Operation("add", serverGroupAddress);// ,"enabled","true");
        Operation step2a = new Operation("deploy", serverGroupAddress);

        Operation step3 = new Operation("undeploy", serverGroupAddress);
        Operation step3a = new Operation("remove", serverGroupAddress);
View Full Code Here

        String bytes_value = uploadToAs(TEST_WAR_PATH);

        System.out.println("Prepare done");
        System.out.flush();

        Address deploymentsAddress = new Address("deployment", TEST_WAR_FILE_NAME);
        Operation step1 = new Operation("add", deploymentsAddress);
        List<Object> content = new ArrayList<Object>(1);
        Map<String, Object> contentValues = new HashMap<String, Object>();
        contentValues.put("hash", new PROPERTY_VALUE("BYTES_VALUE", bytes_value));
        content.add(contentValues);
View Full Code Here

            assert report.getStatus() != null : "Report did not contain a status";
            assert report.getStatus() == CreateResourceStatus.SUCCESS : "Status was no success";
            assert report.getResourceName().equals(TEST_WAR_FILE_NAME);
            assert report.getResourceKey().equals("server-group=main-server-group,deployment=" + TEST_WAR_FILE_NAME) : "Resource key was wrong";
        } finally {
            Address sgd = new Address("server-group", "main-server-group");
            sgd.add("deployment", TEST_WAR_FILE_NAME);
            Remove r = new Remove(sgd);
            getDomainControllerASConnection().execute(r);
            r = new Remove("deployment", TEST_WAR_FILE_NAME);
            getDomainControllerASConnection().execute(r);
        }
View Full Code Here

        if (path.startsWith(","))
            path = path.substring(1);
        PropertySimple ps = new PropertySimple("path", path);

        //discover the node if it's available.
        Result result = connection.execute(new ReadResource(new Address(path)));
        if (result.isSuccess()) {

            String resKey = path;
            //strip off subsystem
            String name = resKey.substring(resKey.lastIndexOf("=") + 1);
View Full Code Here

@Test(groups = "unit")
public class OperationJsonTest {

    public void operationSerDeserTest() throws Exception {

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

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

        ObjectMapper mapper = new ObjectMapper();
View Full Code Here

        assertEquals(pv.getValue(), "myValue", "Value is " + pv.getValue());
    }

    public void anyPayloadTest() throws Exception {

        Address address = new Address();
        address.add("/server-group", "newOne");

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

        assertTrue((Boolean) someBool, "someBool was not true");

    }

    public void operationHeadersTest() throws Exception {
        Address address = new Address();
        address.add("/server-group", "newOne");

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

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

    public void addPropsTest() throws Exception {
        Address address = new Address();
        address.add("/server-group", "newOne");

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

        ObjectMapper mapper = new ObjectMapper();
View Full Code Here

    }

    @Override
    public CreateResourceReport createResource(CreateResourceReport report) {
        report.setStatus(CreateResourceStatus.INVALID_CONFIGURATION);
        Address createAddress = new Address(this.address);

        String path = report.getPluginConfiguration().getSimpleValue("path", "");
        String resourceName;
        if (!path.contains("=")) {
            //this is not a singleton subsystem
            //resources like  example=test1 and example=test2 can be created
            resourceName = report.getUserSpecifiedResourceName();
        } else {
            //this is a request to create a true singleton subsystem
            //both the path and the name are set at resource level configuration
            resourceName = path.substring(path.indexOf('=') + 1);
            path = path.substring(0, path.indexOf('='));
        }

        createAddress.add(path, resourceName);

        Operation op = new Operation("add", createAddress);
        for (Property prop : report.getResourceConfiguration().getProperties()) {
            SimpleEntry<String, ?> entry = null;

            boolean isEntryEligible = true;
            if (prop instanceof PropertySimple) {
                PropertySimple propertySimple = (PropertySimple) prop;
                PropertyDefinitionSimple propertyDefinition = this.configurationDefinition
                    .getPropertyDefinitionSimple(propertySimple.getName());

                if (propertyDefinition == null
                    || (!propertyDefinition.isRequired() && propertySimple.getStringValue() == null)) {
                    isEntryEligible = false;
                } else {
                    entry = preparePropertySimple(propertySimple, propertyDefinition);
                }
            } else if (prop instanceof PropertyList) {
                PropertyList propertyList = (PropertyList) prop;
                PropertyDefinitionList propertyDefinition = this.configurationDefinition
                    .getPropertyDefinitionList(propertyList.getName());

                if (!propertyDefinition.isRequired() && propertyList.getList().size() == 0) {
                    isEntryEligible = false;
                } else {
                    entry = preparePropertyList(propertyList, propertyDefinition);
                }
            } else if (prop instanceof PropertyMap) {
                PropertyMap propertyMap = (PropertyMap) prop;
                PropertyDefinitionMap propertyDefinition = this.configurationDefinition
                    .getPropertyDefinitionMap(propertyMap.getName());

                if (!propertyDefinition.isRequired() && propertyMap.getMap().size() == 0) {
                    isEntryEligible = false;
                } else {
                    entry = preparePropertyMap(propertyMap, propertyDefinition);
                    isEntryEligible = !((Map<String, Object>) entry.getValue()).isEmpty();
                }
            }

            if (isEntryEligible) {
                op.addAdditionalProperty(entry.getKey(), entry.getValue());
            }
        }

        Result result = this.connection.execute(op);
        if (result.isSuccess()) {
            report.setStatus(CreateResourceStatus.SUCCESS);
            report.setResourceKey(createAddress.getPath());
            report.setResourceName(report.getUserSpecifiedResourceName());
        } else {
            report.setStatus(CreateResourceStatus.FAILURE);
            report.setErrorMessage(result.getFailureDescription());
        }
View Full Code Here

TOP

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

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.