Examples of CompositeOperation


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

        PropertyList propertyList = new PropertyList("foo", propertyMap);

        conf.put(propertyList);

        CompositeOperation cop = delegate.updateGenerateOperationFromProperties(conf, new Address());

        assert cop.numberOfSteps() == 1 : "#Steps should be 1 but were " + cop.numberOfSteps();
        Operation step1 = cop.step(0);
        assert step1.getOperation().equals("write-attribute");
        Map<String, Object> props = step1.getAdditionalProperties();
        assert props.size() == 2;
        List<Map<String, Object>> values = (List<Map<String, Object>>) props.get("value");
        assert values.size() == 1 : "Values had " + values.size() + " entries instead of 1"; // The optional null must not be present
View Full Code Here

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

        PropertyList propertyList = new PropertyList("*");
        propertyList.add(propertyMap);
        conf.put(propertyList);
        conf.put(new PropertySimple("port-offset", 0));

        CompositeOperation cop = delegate.updateGenerateOperationFromProperties(conf, new Address());

        assert cop.numberOfSteps() == 3 : "#Steps should be 3 but were " + cop.numberOfSteps();
        Operation step1 = cop.step(0);
        Operation step2 = cop.step(1);
        Operation step3 = cop.step(2);

        // As we do not specify a base address when creating the delegate 0 or 1 address element is ok.
        assert step1.getAddress().isEmpty();
        assert step2.getAddress().size() == 1;
        assert step3.getAddress().size() == 1;
View Full Code Here

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

        propertyList.add(propertyMap);

        conf.put(propertyList);
        conf.put(new PropertySimple("port-offset", 0));

        CompositeOperation cop = delegate.updateGenerateOperationFromProperties(conf, new Address());

        assert cop.numberOfSteps() == 5 : "#Steps should be 5 but were " + cop.numberOfSteps();
        Operation step1 = cop.step(0);
        Operation step2 = cop.step(1);
        Operation step3 = cop.step(2);
        Operation step4 = cop.step(3);
        Operation step5 = cop.step(4);

        // As we do not specify a base address when creating the delegate 0 or 1 address element is ok.
        assert step1.getAddress().isEmpty();
        assert step2.getAddress().size() == 1;
        assert step3.getAddress().size() == 1;
View Full Code Here

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

        conf.put(new PropertySimple("check-interval", 23));
        conf.put(new PropertySimple("disabled", true));
        conf.put(new PropertySimple("listings", false));
        conf.put(new PropertySimple("max-depth", 17));

        CompositeOperation cop = delegate.updateGenerateOperationFromProperties(conf, new Address());

        assert cop.numberOfSteps() == 5 : "#Steps should be 5 but were " + cop.numberOfSteps();

        Operation step1 = cop.step(0);
        Operation step2 = cop.step(1);
        Operation step3 = cop.step(2);
        Operation step4 = cop.step(3);
        Operation step5 = cop.step(4);

        assert step1.getAddress().isEmpty();
        assert step2.getAddress().size() == 1;
        assert step3.getAddress().size() == 1;
        assert step4.getAddress().size() == 1;
View Full Code Here

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

        propertyMap.put(new PropertySimple("name", "bar"));
        propertyMap.put(new PropertySimple("value", "42!"));
        propertyList.add(propertyMap);
        conf.put(propertyList);

        CompositeOperation cop = delegate.updateGenerateOperationFromProperties(conf, new Address());

        assert cop.numberOfSteps() == 3 : "#Steps should be 3 but were " + cop.numberOfSteps();

        Operation step1 = cop.step(0);
        Operation step2 = cop.step(1);
        Operation step3 = cop.step(2);

        assert step1.getAddress().size() == 1;
        assert step2.getAddress().size() == 1;
        assert step3.getAddress().size() == 1;
        assert step1.getAddress().get(0).equals("system-property=hulla");
View Full Code Here

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

        propertyMap.put(new PropertySimple("value", "42!"));
        propertyMap.setErrorMessage(ConfigurationWriteDelegate.LOGICAL_REMOVED);
        propertyList.add(propertyMap);
        conf.put(propertyList);

        CompositeOperation cop = delegate.updateGenerateOperationFromProperties(conf, new Address());

        assert cop.numberOfSteps() == 2 : "#Steps should be 2 but were " + cop.numberOfSteps();

        Operation step1 = cop.step(0);
        Operation step2 = cop.step(1);

        assert step1.getAddress().size() == 1;
        assert step2.getAddress().size() == 1;
        assert step1.getAddress().get(0).equals("system-property=hulla");
        assert step2.getAddress().get(0).equals("system-property=hello");
View Full Code Here

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

     * @param report Report containing the new configuration
     */
    public void updateResourceConfiguration(ConfigurationUpdateReport report) {

        Configuration conf = report.getConfiguration();
        CompositeOperation cop = updateGenerateOperationFromProperties(conf, address);

        Result result = connection.execute(cop);
        if (!result.isSuccess()) {
            report.setStatus(ConfigurationUpdateStatus.FAILURE);
            report.setErrorMessage(result.getFailureDescription());
View Full Code Here

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

            }
        }
    }

    protected CompositeOperation updateGenerateOperationFromProperties(Configuration conf, Address address) {
        CompositeOperation cop = new CompositeOperation();

        for (PropertyDefinition propDef : configurationDefinition.getNonGroupedProperties()) {
            updateProperty(conf, cop, propDef, address);
        }
View Full Code Here

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

        propertyMap.put(new PropertySimple("value", "42!"));
        propertyList.add(propertyMap);
        conf.put(propertyList);
        // 'hello' is not present -> needs to trigger a :remove for it

        CompositeOperation cop = delegate.updateGenerateOperationFromProperties(conf, new Address());

        assert cop.numberOfSteps() == 4 : "#Steps should be 4 but were " + cop.numberOfSteps();

        Operation step1 = cop.step(0);
        Operation step2 = cop.step(1);
        Operation step3 = cop.step(2);
        Operation step4 = cop.step(3);

        assert step1.getAddress().size() == 1;
        assert step2.getAddress().size() == 1;
        assert step3.getAddress().size() == 1;
        assert step4.getAddress().size() == 1;
View Full Code Here

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

        conf.put(new PropertySimple("foo:expr", 123));
        conf.put(new PropertySimple("foo2:expr", "${foo:42}"));
        conf.put(new PropertySimple("bar", 456));

        CompositeOperation cop = delegate.updateGenerateOperationFromProperties(conf, new Address());

        assert cop != null;
        assert cop.numberOfSteps() == 3;

        Map<String, Object> additionalProperties = cop.step(0).getAdditionalProperties();
        assert additionalProperties.get("name").equals("foo");
        assert additionalProperties.get("value").equals("123");

        additionalProperties = cop.step(1).getAdditionalProperties();
        assert additionalProperties.get("name").equals("foo2");
        assert additionalProperties.get("value") != null;
        assert additionalProperties.get("value") instanceof Map;
        Map<String, Object> map = (Map<String, Object>) additionalProperties.get("value");
        assert map.containsKey("EXPRESSION_VALUE");
        assert map.get("EXPRESSION_VALUE").equals("${foo:42}");

        additionalProperties = cop.step(2).getAdditionalProperties();
        assert additionalProperties.get("name").equals("bar");
        assert additionalProperties.get("value").equals(456);

    }
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.