Examples of invokeOperation()


Examples of org.rhq.core.pluginapi.operation.OperationFacet.invokeOperation()

    public void testInterruptedComponentInvocationContext() throws Exception {
        ResourceContainer resourceContainer = getResourceContainer();
        OperationFacet proxy = resourceContainer.createResourceComponentProxy(OperationFacet.class,
            FacetLockType.WRITE, SECONDS.toMillis(1L), true, false, true);
        try {
            proxy.invokeOperation("op", new Configuration());
            fail("Expected invokeOperation to throw a TimeoutException");
        } catch (TimeoutException e) {
            if (LOG.isDebugEnabled()) {
                LOG.debug("Caught expected TimeoutException: " + e.getMessage());
            }
View Full Code Here

Examples of org.rhq.core.pluginapi.operation.OperationFacet.invokeOperation()

    public void testUninterruptedComponentInvocationContext() throws Exception {
        ResourceContainer resourceContainer = getResourceContainer();
        OperationFacet proxy = resourceContainer.createResourceComponentProxy(OperationFacet.class,
            FacetLockType.WRITE, SECONDS.toMillis(10L), true, false, true);
        try {
            OperationResult op = proxy.invokeOperation("op", new Configuration());
            assertTrue(op.getSimpleResult().equals(MockResourceComponent.OPERATION_RESULT));
        } catch (Exception e) {
            fail("Caught unexpected Exception: " + e.getClass().getName());
            assertFalse(((MockResourceComponent) resourceContainer.getResourceComponent())
                    .caughtInterruptedComponentInvocation());
View Full Code Here

Examples of org.rhq.core.pluginapi.operation.OperationFacet.invokeOperation()

        OperationDefinition disableOperation = getOperationDefinition("disable");
        Configuration disableOperationParams = disableOperation.getParametersConfigurationDefinition()
            .getDefaultTemplate().createConfiguration();
        disableOperationParams.setSimpleValue("allow-resource-service-restart", TRUE.toString());
        OperationFacet operationFacet = getOperationFacet(datasourceTestResource);
        OperationResult operationResult = operationFacet.invokeOperation(disableOperation.getName(),
            disableOperationParams);
        assertNull(operationResult.getErrorMessage(),
            "Disable operation failed with error: " + operationResult.getErrorMessage());

        // Then update properties which can only be changed when datasource is in disabled state
View Full Code Here

Examples of org.rhq.core.pluginapi.operation.OperationFacet.invokeOperation()

        // Now re-enable datasource
        OperationDefinition enableOperation = getOperationDefinition("enable");
        Configuration enableOperationParams = enableOperation.getParametersConfigurationDefinition()
            .getDefaultTemplate().createConfiguration();
        operationResult = operationFacet.invokeOperation(enableOperation.getName(), enableOperationParams);
        assertNull(operationResult.getErrorMessage(),
            "Enable operation failed with error: " + operationResult.getErrorMessage());

        // Check server state
        configuration = pluginContainer.getConfigurationManager().loadResourceConfiguration(
View Full Code Here

Examples of org.rhq.core.pluginapi.operation.OperationFacet.invokeOperation()

    public static OperationResult invokeOperation(Resource resource, String operationName, Configuration parameters)
        throws Exception {

        OperationFacet operationFacet = getResourceComponentFacet(resource, OperationFacet.class);
        OperationResult operationResult = operationFacet.invokeOperation(operationName, parameters);

        if (operationResult != null && operationResult.getErrorMessage() != null) {
            fail("Operation (" + operationName + ") failed : " + operationResult.getErrorMessage());
        }
        return operationResult;
View Full Code Here

Examples of org.rhq.core.pluginapi.operation.OperationFacet.invokeOperation()

        for (Resource resource : resources) {
            OperationFacet operationFacet = getOperationFacet(resource);
            Configuration parameters = new Configuration();
            parameters.setSimpleValue("batchSize", "50");
            parameters.setSimpleValue("managementQueryTimeout", "180");
            OperationResult operationResult = operationFacet.invokeOperation("viewQueries", parameters);
            String errorMessage = operationResult.getErrorMessage();
            assertNull(errorMessage, errorMessage);
            Configuration complexResults = operationResult.getComplexResults();
            assertNotNull(complexResults, "ComplexResults is null");
            PropertyList queriesPropList = complexResults.getList("queries");
View Full Code Here

Examples of org.rhq.core.pluginapi.operation.OperationFacet.invokeOperation()

                    //the 3 seconds to finish. Otherwise all the operations would have to finish in 3 secs
                    //which can be a bit harsh limit.
                    OperationFacet operationFacet = ComponentUtil.getComponent(resource.getId(), OperationFacet.class,
                        FacetLockType.WRITE, OPERATION_FACET_METHOD_TIMEOUT, true, true, true);
                    //String name = operationDefinition.getName();
                    OperationResult result = operationFacet.invokeOperation(name, getTestOperationParameters(name));
                    System.out.println("Validating operation '" + name + "' result (" + result + ")...");
                    validateOperationResult(name, result, resource);
                }
            }
        }
View Full Code Here

Examples of org.rhq.core.pluginapi.operation.OperationFacet.invokeOperation()

            if (resource.getName().equals(getDestinationName())) {
                foundDestination = true;
                OperationFacet operationFacet = ComponentUtil.getComponent(resource.getId(), OperationFacet.class,
                    FacetLockType.WRITE, 3000, true, true, true);
                String name = "removeAllMessages";
                operationFacet.invokeOperation(name, getTestOperationParameters(name));
            }
        }
        if (!foundDestination)
            throw new Exception("cannot find " + getDestinationName());
        Thread.sleep(4000);
View Full Code Here

Examples of org.rhq.core.pluginapi.operation.OperationFacet.invokeOperation()

            true, true, true);

        for (OperationDefinition operationDefinition : operationDefinitions) {
          String name = operationDefinition.getName();

          OperationResult result = operationFacet.invokeOperation(
              name, new Configuration());

          log.info("Validating operation '" + name + "' result ("
              + result + ")...");
View Full Code Here

Examples of org.rhq.core.pluginapi.operation.OperationServices.invokeOperation()

        Configuration config = null;
        if (tokens.length > 2)
            config = createConfigurationFromString(tokens[2]);

        OperationServicesResult res = operationServices.invokeOperation(operationContext, tokens[1], config, 2000);
        if (res.getResultCode() == OperationServicesResultCode.FAILURE) {
            System.err.println("Failure executing the operation: \n" + res.getErrorStackTrace());
        } else if (res.getResultCode() == OperationServicesResultCode.TIMED_OUT) {
            System.err.println("Operation timed out ");
        } else if (res.getResultCode() == OperationServicesResultCode.CANCELED) {
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.