Examples of ResourceComponent


Examples of org.rhq.core.pluginapi.inventory.ResourceComponent

    public ResourceComponent buildResourceComponent(Resource resource) throws PluginContainerException,
        ResourceTypeNotEnabledException {

        ResourceType resourceType = resource.getResourceType();
        if (PluginMetadataManager.TEST_PLATFORM_TYPE.equals(resourceType)) {
            return new ResourceComponent() {
                public AvailabilityType getAvailability() {
                    return AvailabilityType.UP;
                }

                public void start(ResourceContext context) {
                }

                public void stop() {
                }
            };
        }
        String className = pluginManager.getMetadataManager().getComponentClass(resourceType);
        ResourceContainer resourceContainer = inventoryManager.getResourceContainer(resource);
        if (resourceContainer == null) {
            throw new PluginContainerException("Resource container not found for " + resource + " - cannot create ResourceComponent.");
        }
        ClassLoader resourceClassloader = resourceContainer.getResourceClassLoader();
        if (resourceClassloader == null) {
            throw new PluginContainerException("Resource classLoader not found for " + resource + " - cannot create ResourceComponent.");
        }
        ResourceComponent component = (ResourceComponent) instantiateClass(resourceClassloader, className);

        if (log.isDebugEnabled()) {
            log.debug("Created resource component [" + className + "] of resource type [" + resourceType + ']');
        }
        return component;
View Full Code Here

Examples of org.rhq.core.pluginapi.inventory.ResourceComponent

            LOG.debug("SUCCESS!");
        }
        if (LOG.isDebugEnabled()) {
            LOG.debug("Testing proxy call that should fail...");
        }
        ResourceComponent naughtyResourceComponent = new MockResourceComponent(true);
        resourceContainer.setResourceComponent(naughtyResourceComponent);
        resourceComponentProxy = resourceContainer.createResourceComponentProxy(AvailabilityFacet.class,
            FacetLockType.NONE, Long.MAX_VALUE, true, false, true);
        try {
            resourceComponentProxy.getAvailability();
View Full Code Here

Examples of org.rhq.core.pluginapi.inventory.ResourceComponent

        ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
        ResourceContainer resourceContainer = new ResourceContainer(resource, contextClassLoader);
        ResourceContext resourceContext = new ResourceContext(resource, null, null, null, null, null, null, null, null,
                null, null, null, null, null, new ComponentInvocationContextImpl());
        resourceContainer.setResourceContext(resourceContext);
        ResourceComponent resourceComponent = new MockResourceComponent(false);
        resourceContainer.setResourceComponent(resourceComponent);
        resourceComponent.start(resourceContext);
        return resourceContainer;
    }
View Full Code Here

Examples of org.rhq.core.pluginapi.inventory.ResourceComponent

            }
        }
    }

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

Examples of org.rhq.core.pluginapi.inventory.ResourceComponent

        log.info("Result of operation disable was: " + result.getSimpleResult());
        assert result.getSimpleResult().equals("true") : "The operation execution failed!";
    }

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

        Configuration config = new Configuration();
        config.put(new PropertySimple("p1", "1"));
        config.put(new PropertySimple("p2", java.util.concurrent.TimeUnit.SECONDS));
View Full Code Here

Examples of org.rhq.core.pluginapi.inventory.ResourceComponent

        OperationResult result = ((OperationFacet) resourceComponent).invokeOperation("stop", config);
        log.info("Result of operation stop was: " + result.getSimpleResult());
    }

    private void testLoadServiceConfiguration(Resource resource) throws Exception {
        ResourceComponent resourceComponent = PluginContainer.getInstance().getInventoryManager()
            .getResourceComponent(resource);
        ((ConfigurationFacet) resourceComponent).loadResourceConfiguration();
    }
View Full Code Here

Examples of org.rhq.core.pluginapi.inventory.ResourceComponent

            .getResourceComponent(resource);
        ((ConfigurationFacet) resourceComponent).loadResourceConfiguration();
    }

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

        if (resourceComponent instanceof MeasurementFacet) {
            for (MeasurementDefinition def : resource.getResourceType().getMetricDefinitions()) {
                Set<MeasurementScheduleRequest> metricList = new HashSet<MeasurementScheduleRequest>();
View Full Code Here

Examples of org.rhq.core.pluginapi.inventory.ResourceComponent

            }
        }
    }

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

        if (resourceComponent instanceof OperationFacet) {
            for (String operationName : new String[] { "reset", "refresh" }) {
                OperationResult result = ((OperationFacet) resourceComponent).invokeOperation(operationName,
View Full Code Here

Examples of org.rhq.core.pluginapi.inventory.ResourceComponent

            }
        }
    }

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

        if (resourceComponent instanceof OperationFacet) {
            try {
                OperationResult result = ((OperationFacet) resourceComponent).invokeOperation("enableContext", null);
View Full Code Here

Examples of org.rhq.core.pluginapi.inventory.ResourceComponent

            for (ResourceContainer c : cs) {
                c.setAvailabilityScheduleTime(0);
                c.updateAvailability(null);
                c.setAvailabilitySchedule(null);
                // reset state of res component
                ResourceComponent resourceComponent = c.getResourceComponent();
                resourceComponent.stop();
                resourceComponent.start(c.getResourceContext());
            }
        }

        // this is a hack to get this test to pass. If you run this test class on its own, it passes fine.
        // but if you run it in conjunction with other tests (e.g. mvn -Dtest=AvailTest,DiscoveryCallbackAbortTest)
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.