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

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


    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();

        String result = mapper.writeValueAsString(operation);
View Full Code Here


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

* @author Heiko W. Rupp
*/
public class MiscTest extends AbstractIntegrationTest {

    public void testSetRollback() throws Exception {
        Operation op = new Operation("foo", new Address());
        Result res = getDomainControllerASConnection().execute(op);
        assertNotNull(res);
        assertFalse(res.isSuccess(), "Response outcome was success.");
        assertTrue(res.isRolledBack(), "Response was not rolled back: " + res);
        assertTrue(res.getFailureDescription().endsWith("rolled-back=true"), "Unexpected failure description: " + res);
View Full Code Here

    }

    public void testCompositeReadAttribute() throws Exception {
        Address a = new Address("profile=default,subsystem=web,connector=http");
        CompositeOperation cop = new CompositeOperation();
        Operation step1 = new ReadAttribute(a, "maxTime");
        cop.addStep(step1);
        Operation step2 = new ReadAttribute(a, "processingTime");
        cop.addStep(step2);

        ComplexResult res = getDomainControllerASConnection().executeComplex(cop);
        assertNotNull(res);
        assertTrue(res.isSuccess(), "Response outcome was failure.");
View Full Code Here

        }
        return false;
    }

    Result redeployOnServer() {
        Operation op = new Operation("full-replace-deployment", new Address());
        op.addAdditionalProperty("name", runtimeName);
        List<Object> content = new ArrayList<Object>(1);
        Map<String, Object> contentValues = new HashMap<String, Object>();
        contentValues.put("hash", new PROPERTY_VALUE("BYTES_VALUE", hash));
        content.add(contentValues);
        op.addAdditionalProperty("content", content);
        return connection.execute(op);
    }
View Full Code Here

        if (templatedComponentUpdate) {
            //For templated resources we need to parse only the specific subset of attributes
            //supported by this component
            Map<String, Object> currentAttributeList = null;
            Operation currentAttributesOp = new ReadResource(address);
            Map<String, Object> additionalProperties = new HashMap<String, Object>();
            //includes operation request attributes applicable to 6.0 & 6.1
            additionalProperties.put("proxies", "true");
            additionalProperties.put("include-runtime", "true");
            additionalProperties.put("include-defaults", "true");
            additionalProperties.put("attributes-only", "true");
            currentAttributesOp.setAdditionalProperties(additionalProperties);
            Result currentAttributes = getASConnection().execute(currentAttributesOp);
            if (currentAttributes.isSuccess()) {
                currentAttributeList = (Map<String, Object>) currentAttributes.getResult();
            }
View Full Code Here

            log.error("Path plugin config is null for ResourceType [" + context.getResourceType().getName() + "].");
            return entities;
        }

        Address addr = new Address(path);
        Operation op = new Operation(PROXY_INFO_OPERATION, addr);
        Result result = connection.execute(op);
        //get ProxyInfo and parse
        rawProxyInfo = extractRawProxyInfo(result);
        ProxyInfo proxyInfo = new ProxyInfo(rawProxyInfo);
View Full Code Here

    @Override
    public OperationResult invokeOperation(String name, Configuration parameters) throws InterruptedException,
        Exception {
        OperationResult operationResult = new OperationResult();
        Address address = new Address(path);
        Operation operation = new Operation(name, address);
        Result asResult = getASConnection().execute(operation, false, JdrReportRunner.JDR_OPERATION_TIMEOUT);

        if (!asResult.isSuccess()) {
            operationResult.setErrorMessage(asResult.getFailureDescription());
            return operationResult;
View Full Code Here

            } else if (explicitExpressions != null && explicitExpressions.contains(reqName)) {
                resolveExpression = true;
            }

            ComplexRequest complexRequest = null;
            Operation op;
            if (reqName.contains(":")) {
                complexRequest = ComplexRequest.create(reqName);
                op = new ReadAttribute(address, complexRequest.getProp());
            } else {
                op = new ReadAttribute(address, reqName);
View Full Code Here

        ConfigurationLoadDelegate delegate = new ConfigurationLoadDelegate(configDef, getASConnection(), address,
            includeRuntime);
        Configuration configuration = delegate.loadResourceConfiguration();

        // Read server state
        Operation op = new Operation("whoami", getAddress());
        Result res = getASConnection().execute(op);

        //:whoami might fail host controller resources, in that case use :read-resource operation
        //which is slower due to larger content returned but more reliable since every resource has it.
        if (!res.isSuccess()) {
            op = new Operation("read-resource", getAddress());
            res = getASConnection().execute(op);
        }
        includeOOBMessages(res, configuration);
        return configuration;
    }
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.