Package org.rhq.core.pc.inventory

Examples of org.rhq.core.pc.inventory.ResourceContainer$ResourceComponentInvocationHandler


        assertTrue(webRuntimeResources != null && !webRuntimeResources.isEmpty(),
            "Web Runtime resource should have been discovered");
        assertEquals(webRuntimeResources.size(), 1, "Found more than one Web Runtime resource: " + webRuntimeResources);

        Resource webRuntimeResource = webRuntimeResources.iterator().next();
        ResourceContainer webRuntimeResourceContainer = pluginContainer.getInventoryManager().getResourceContainer(
            webRuntimeResource);
        MeasurementFacet measurementFacet = webRuntimeResourceContainer.createResourceComponentProxy(
            MeasurementFacet.class, FacetLockType.READ, SECONDS.toMillis(5), false, false, false);
        MeasurementReport report = new MeasurementReport();
        Set<MeasurementScheduleRequest> measurementScheduleRequests = getMeasurementScheduleRequests(webRuntimeResource);
        measurementFacet.getValues(report, measurementScheduleRequests);
        assertEquals(report.getCallTimeData().size(), 0, "No calltime data was requested");
View Full Code Here


        serverPluginConfig.setBaseDir(new File(System.getProperty("java.io.tmpdir")));

        // Restart the server ResourceComponent so it picks up the changes we just made to the plugin config.
        InventoryManager inventoryManager = this.pluginContainer.getInventoryManager();
        inventoryManager.deactivateResource(getServerResource());
        ResourceContainer serverContainer = inventoryManager.getResourceContainer(getServerResource());
        InvalidPluginConfigurationException ipce = null;
        try {
            inventoryManager.activateResource(getServerResource(), serverContainer, true);
        } catch (InvalidPluginConfigurationException e) {
            ipce = e;
View Full Code Here

        startScriptConfig.setStartScriptArgs(args);

        // Restart the server ResourceComponent so it picks up the changes we just made to the plugin config.
        InventoryManager inventoryManager = this.pluginContainer.getInventoryManager();
        inventoryManager.deactivateResource(getServerResource());
        ResourceContainer serverContainer = inventoryManager.getResourceContainer(getServerResource());
        inventoryManager.activateResource(getServerResource(), serverContainer, true);

        // Finally restart it using the Start op and make sure it has come back up.
        invokeOperationAndAssertSuccess(getServerResource(), START_OPERATION_NAME, null);
        avail = getAvailability(getServerResource());
View Full Code Here

        System.out.println("Validating all resources have started...");
        assertAllResourceComponentsStarted(this.pluginContainer.getInventoryManager(), platform);
    }

    private void startComponent(InventoryManager im, Resource resource) {
        ResourceContainer container = im.getResourceContainer(resource);
        if (null == container) {
            throw new IllegalStateException("No container found for resource " + resource);
        }

        try {
View Full Code Here

    private void findNonStartedResourceComponentsRecursively(InventoryManager im, Resource resource,
        Map<ResourceType, ResourceContainer> nonStartedResourceContainersByType) throws Exception {
        ResourceType resourceType = resource.getResourceType();
        if (!nonStartedResourceContainersByType.containsKey(resourceType)) {
            ResourceContainer resourceContainer = im.getResourceContainer(resource);
            if (resourceContainer.getResourceComponentState() == ResourceContainer.ResourceComponentState.STARTING) {
                // give it 5s to finish starting
                try {
                    System.out.println("Resource is STARTING, Waiting 5s before checking for STARTED " + resource);
                    Thread.sleep(5000L);
                } catch (InterruptedException e) {
                    // keep going
                }
            }
            if (resourceContainer.getResourceComponentState() != ResourceContainer.ResourceComponentState.STARTED) {
                nonStartedResourceContainersByType.put(resourceType, resourceContainer);

            } else if (resourceContainer.getResourceComponent() == null) {
                System.err.println("****** Resource container " + resourceContainer
                    + " says its Resource component is started, but the component is null. ******");
                nonStartedResourceContainersByType.put(resourceType, resourceContainer);
            }
        }
View Full Code Here

    private void findNumericMetricsAndTraitsWithNullValuesRecursively(Resource resource,
        Map<ResourceType, Set<String>> metricsWithNullValuesByType) throws Exception {
        ResourceType resourceType = resource.getResourceType();
        // Only check metrics on types of Resources from the plugin under test.
        if (resourceType.getPlugin().equals(getPluginName())) {
            ResourceContainer resourceContainer = this.pluginContainer.getInventoryManager().getResourceContainer(
                resource);
            if (resourceContainer.getResourceComponentState() != ResourceContainer.ResourceComponentState.STARTED) {
                return;
            }

            Set<String> metricsWithNullValues = getNumericMetricsAndTraitsWithNullValues(resource);
            if (!metricsWithNullValues.isEmpty()) {
View Full Code Here

        ResourceType resourceType = resource.getResourceType();
        // Only check resource configs on types of Resources from the plugin under test.
        if (resourceType.getPlugin().equals(getPluginName())
            && (resourceType.getResourceConfigurationDefinition() != null)
            && !resourceConfigLoadExceptionsByType.containsKey(resourceType)) {
            ResourceContainer resourceContainer = this.pluginContainer.getInventoryManager().getResourceContainer(
                resource);
            if (resourceContainer.getResourceComponentState() != ResourceContainer.ResourceComponentState.STARTED) {
                return;
            }

            Exception exception = null;
            try {
View Full Code Here

        assertTrue(discoveredResource.getResourceErrors().size() > 0,
            "There should be upgrade errors persisted on the server side.");

        //the discovery of the failed resource mustn't have run
        ResourceContainer container = PluginContainer.getInstance().getInventoryManager()
            .getResourceContainer(discoveredResource);
        File dataDir = container.getResourceContext().getDataDirectory();

        File marker = new File(dataDir, "failing-discovery-ran");

        assertFalse(marker.exists(),
            "The discovery of the resource type with a failed upgraded resource must not be executed but it was.");
View Full Code Here

        assertEquals(discoveredResource.getName(), "resource-name-v1");
        assertEquals(discoveredResource.getDescription(), "resource-description-v1");

        InventoryManager im = PluginContainer.getInstance().getInventoryManager();
        ResourceContainer container = im.getResourceContainer(discoveredResource.getId());
        if (discoveredResource.getInventoryStatus() == InventoryStatus.COMMITTED) {
            assert container.getResourceComponentState() == ResourceComponentState.STARTED;
        } else {
            assert container.getResourceComponentState() == ResourceComponentState.STOPPED;
        }

        return inv;
    }
View Full Code Here

        assertEquals(discoveredResource.getResourceKey(), "resource-key-v2");
        assertEquals(discoveredResource.getName(), "resource-name-v2");
        assertEquals(discoveredResource.getDescription(), "resource-description-v2");
        assertEquals(discoveredResource.getPluginConfiguration().getSimpleValue("test-property"), "test-property-v2");

        ResourceContainer container = PluginContainer.getInstance().getInventoryManager()
            .getResourceContainer(discoveredResource);
        File dataDir = container.getResourceContext().getDataDirectory();

        File marker = new File(dataDir, "upgrade-succeeded");

        assertTrue(marker.exists(),
            "The upgrade success marker file wasn't found. This means the upgrade didn't actually run.");
View Full Code Here

TOP

Related Classes of org.rhq.core.pc.inventory.ResourceContainer$ResourceComponentInvocationHandler

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.