Package org.rhq.core.pluginapi.inventory

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


        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

        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

            .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

            }
        }
    }

    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

            }
        }
    }

    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

            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

    }

    @Test(enabled = false)
    // TODO GH: Disable until we fix the natives integration for sigar
    private void testResourceMeasurement(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>();
                metricList.add(new MeasurementScheduleRequest(1, def.getName(), 1000, true, def.getDataType()));
View Full Code Here

        Resource platform = PluginContainer.getInstance().getInventoryManager().getPlatform();
        for (Resource server : platform.getChildResources()) {
            List<Resource> services = new ArrayList<Resource>(server.getChildResources());
            Collections.sort(services);
            for (Resource service : services) {
                ResourceComponent serviceComponent = PluginContainer.getInstance().getInventoryManager()
                    .getResourceComponent(service);
                if (serviceComponent instanceof MeasurementFacet) {
                    Set<MeasurementScheduleRequest> metricList = new HashSet<MeasurementScheduleRequest>();
                    metricList.add(new MeasurementScheduleRequest(1, "numbackends", 1000, true, DataType.MEASUREMENT));
                    MeasurementReport report = new MeasurementReport();
View Full Code Here

        setupData(db);

        // Pooling < Non Pooling < Pooling hierarchy

        ResourceComponent level1 = add("Generic Query", db);
        assertUp(level1);
        checkAllMetrics("Generic Query", level1);

        ResourceComponent level2 = add("Generic Query Non Pooling", level1);
        assertUp(level2);
        checkAllMetrics("Generic Query Non Pooling", level2);

        ResourceComponent level3 = add("Nested Generic Query", level2);
        assertUp(level3);
        checkAllMetrics("Generic Query Non Pooling", level3);

        checkData(db);
    }
View Full Code Here

TOP

Related Classes of org.rhq.core.pluginapi.inventory.ResourceComponent

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.