Examples of OperationResult


Examples of org.rhq.core.pluginapi.operation.OperationResult

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

            sleep(SECONDS.toMillis(5));
            if (resourceContext.getComponentInvocationContext().isInterrupted()) {
                caughtInterruptedComponentInvocation = true;
                throw new InterruptedException();
            }
            return new OperationResult(OPERATION_RESULT);
        }
View Full Code Here

Examples of org.rhq.core.pluginapi.operation.OperationResult

            }
        } finally {
            Thread.currentThread().setContextClassLoader(originalCL);
        }

        OperationResult info = new OperationResult();
        PropertyList list = new PropertyList("plugins");
        info.getComplexResults().put(list);

        for (String plugin : deploymentOrder) {
            PropertyMap map = new PropertyMap("plugin");
            map.put(new PropertySimple("name", plugin));
            map.put(new PropertySimple("dependencies", dependencies.get(plugin)));
View Full Code Here

Examples of org.rhq.core.pluginapi.operation.OperationResult

            classloaders = clm.getPluginClassLoaders();
        } finally {
            Thread.currentThread().setContextClassLoader(originalCL);
        }

        OperationResult info = new OperationResult();
        PropertySimple numClassLoaders = new PropertySimple("numberOfClassLoaders", String.valueOf(classloaders.size()));
        PropertyList list = new PropertyList("classloaders");
        info.getComplexResults().put(numClassLoaders);
        info.getComplexResults().put(list);

        for (Map.Entry<String, ClassLoader> entry : classloaders.entrySet()) {
            String pluginName = entry.getKey();
            ClassLoader classloader = entry.getValue();
            PropertyMap map = new PropertyMap("classloader");
View Full Code Here

Examples of org.rhq.core.pluginapi.operation.OperationResult

            classloaders = clm.getDiscoveryClassLoaders();
        } finally {
            Thread.currentThread().setContextClassLoader(originalCL);
        }

        OperationResult info = new OperationResult();
        PropertySimple numClassLoaders = new PropertySimple("numberOfClassLoaders", String.valueOf(classloaders.size()));
        PropertyList list = new PropertyList("classloaders");
        info.getComplexResults().put(numClassLoaders);
        info.getComplexResults().put(list);

        for (Map.Entry<String, ClassLoader> entry : classloaders.entrySet()) {
            String id = entry.getKey();
            ClassLoader classloader = entry.getValue();
            PropertyMap map = new PropertyMap("classloader");
View Full Code Here

Examples of org.rhq.core.pluginapi.operation.OperationResult

            }
        } finally {
            Thread.currentThread().setContextClassLoader(originalCL);
        }

        OperationResult info = new OperationResult();
        PropertySimple numClassLoaders = new PropertySimple("numberOfResources", String.valueOf(classloaders.size()));
        PropertyList list = new PropertyList("classloaders");
        info.getComplexResults().put(numClassLoaders);
        info.getComplexResults().put(list);

        for (Entry<CanonicalResourceKey, ClassLoader> entry : classloaders.entrySet()) {
            CanonicalResourceKey canonicalId = entry.getKey();
            ClassLoader classloader = entry.getValue();
            String[] data = canonicalIdMap.get(canonicalId);
View Full Code Here

Examples of org.rhq.core.pluginapi.operation.OperationResult

            classloaders.clear(); // don't need this shallow copy anymore, help the GC clean up
        } finally {
            Thread.currentThread().setContextClassLoader(originalCL);
        }

        OperationResult info = new OperationResult();
        PropertySimple numClassLoaders = new PropertySimple("numberOfClassLoaders", String.valueOf(classloaderCounts
            .size()));
        PropertyList list = new PropertyList("classloaders");
        info.getComplexResults().put(numClassLoaders);
        info.getComplexResults().put(list);

        for (Map.Entry<ClassLoader, AtomicInteger> entry : classloaderCounts.entrySet()) {
            ClassLoader classloader = entry.getKey();
            AtomicInteger count = entry.getValue();
            PropertyMap map = new PropertyMap("classloader");
View Full Code Here

Examples of org.rhq.core.pluginapi.operation.OperationResult

    private void testServiceSimpleMethodInvocation(Resource resource) throws InterruptedException, Exception {
        ResourceComponent resourceComponent = PluginContainer.getInstance().getInventoryManager()
            .getResourceComponent(resource);

        Configuration config = new Configuration();
        OperationResult result = ((OperationFacet) resourceComponent).invokeOperation("enable", config);
        log.info("Result of operation enable was: " + result.getSimpleResult());
        assert result.getSimpleResult().equals("true") : "The operation execution failed!";

        result = ((OperationFacet) resourceComponent).invokeOperation("disable", config);
        log.info("Result of operation disable was: " + result.getSimpleResult());
        assert result.getSimpleResult().equals("true") : "The operation execution failed!";
    }
View Full Code Here

Examples of org.rhq.core.pluginapi.operation.OperationResult

            .getResourceComponent(resource);

        Configuration config = new Configuration();
        config.put(new PropertySimple("p1", "1"));
        config.put(new PropertySimple("p2", java.util.concurrent.TimeUnit.SECONDS));
        OperationResult result = ((OperationFacet) resourceComponent).invokeOperation("stop", config);
        log.info("Result of operation stop was: " + result.getSimpleResult());
    }
View Full Code Here

Examples of org.rhq.core.pluginapi.operation.OperationResult

        ResourceComponent resourceComponent = PluginContainer.getInstance().getInventoryManager()
            .getResourceComponent(resource);

        if (resourceComponent instanceof OperationFacet) {
            for (String operationName : new String[] { "reset", "refresh" }) {
                OperationResult result = ((OperationFacet) resourceComponent).invokeOperation(operationName,
                    new Configuration());
                log.info("Result of operation " + operationName + " was: " + result);

                //need to wait for the reset to finish, this is a long operation
                Thread.sleep(5000);
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.