Examples of InventoryManager


Examples of org.rhq.core.pc.inventory.InventoryManager

        im.executeServiceScanImmediately();
    }

    private ResourceContainer findApacheServerResource() throws Exception {
        InventoryManager im = PluginContainer.getInstance().getInventoryManager();
        ResourceTypes resourceTypes = new ResourceTypes(PluginLocation.APACHE_PLUGIN);
        ResourceType apacheServerResourceType = resourceTypes.findByName("Apache HTTP Server");

        return findApacheServerResource(im, apacheServerResourceType, im.getPlatform());
    }
View Full Code Here

Examples of org.rhq.core.pc.inventory.InventoryManager

    protected Resource findResourceWithOrdinal(ResType resType, int ordinal) {
        ResourceType resourceType = PluginContainer.getInstance().getPluginManager().getMetadataManager()
            .getType(resType.getResourceTypeName(), resType.getResourceTypePluginName());

        InventoryManager inventoryManager = PluginContainer.getInstance().getInventoryManager();
        Set<Resource> resources = inventoryManager.getResourcesWithType(resourceType);

        return findResourceWithOrdinal(resources, ordinal);
    }
View Full Code Here

Examples of org.rhq.core.pc.inventory.InventoryManager

        assertEquals(resources.size(), expectedSize, "The set of resources has unexpected size.");
        for(Resource res : resources) {
            assertFalse(res.getResourceKey().startsWith(UPGRADED_RESOURCE_KEY_PREFIX), "Resource " + res
                + " seems to be upgraded even though it shouldn't.");

            InventoryManager im = PluginContainer.getInstance().getInventoryManager();
            ResourceContainer rc = im.getResourceContainer(res);

            assertEquals(rc.getResourceComponentState(), ResourceContainer.ResourceComponentState.STOPPED,
                "A resource that has not been upgraded due to upgrade error in parent should be stopped.");

            //recurse, since the whole subtree under the failed resource should be not upgraded and stopped.
            Set<Resource> children = im.getContainerChildren(res, rc);
            checkResourcesNotUpgraded(children, children.size());
        }
    }
View Full Code Here

Examples of org.rhq.core.pc.inventory.InventoryManager

        Resource discoveredResource = resources.iterator().next();

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

Examples of org.rhq.core.pc.inventory.InventoryManager

        checkUpgradeInactive();
    }

    private void checkUpgradeInactive() {
        InventoryManager im = PluginContainer.getInstance().getInventoryManager();
        assertFalse(im.isResourceUpgradeActive(),
            "Resource upgrade shouldn't be active once plugin container has initialized");
    }
View Full Code Here

Examples of org.rhq.core.pc.inventory.InventoryManager

    //        }
    //    }

    private Resource getResource() {

        InventoryManager im = pluginContainer.getInventoryManager();
        Resource platform = im.getPlatform();
        Resource server = waitForResourceByTypeAndKey(platform, platform, STANDALONE_RESOURCE_TYPE,
            STANDALONE_RESOURCE_KEY);
        Resource bindings = waitForResourceByTypeAndKey(platform, server, RESOURCE_TYPE, RESOURCE_KEY);
        return bindings;
    }
View Full Code Here

Examples of org.rhq.core.pc.inventory.InventoryManager

     */
    private Resource getModuleOptionTypeResource(String optionAttributeType) {
        Resource moduleOptionResource = null;
        String securityDomainId = SECURITY_DOMAIN_RESOURCE_KEY + "=" + TEST_DOMAIN + "2";
        if (testSecurityDomain == null) {
            InventoryManager im = pluginContainer.getInventoryManager();
            Resource platform = im.getPlatform();
            if (platform != null)
                System.out.println("*** Found        Platform [" + platform.getResourceKey() + "]");
            //host controller
            Resource hostController = waitForResourceByTypeAndKey(platform, platform, DOMAIN_RESOURCE_TYPE,
                DOMAIN_RESOURCE_KEY);
            if (hostController != null)
                System.out.println("*** Found Host Controller [" + hostController.getResourceKey() + "]");

            //profile=full-ha
            ResourceType profileType = new ResourceType("Profile", PLUGIN_NAME, ResourceCategory.SERVICE, null);
            String key = PROFILE;
            Resource profile = waitForResourceByTypeAndKey(platform, hostController, profileType, key);
            if (profile != null)
                System.out.println("*** Found         Profile [" + platform.getResourceKey() + "]");

            //Security (Profile)
            ResourceType securityType = new ResourceType("Security (Profile)", PLUGIN_NAME, ResourceCategory.SERVICE,
                null);
            key += "," + SECURITY_RESOURCE_KEY;
            Resource security = waitForResourceByTypeAndKey(platform, profile, securityType, key);
            if (security != null)
                System.out.println("*** Found        Security [" + security.getResourceKey() + "]");

            //Security Domain (Profile)
            ResourceType domainType = new ResourceType("Security Domain (Profile)", PLUGIN_NAME,
                ResourceCategory.SERVICE, null);
            key += "," + securityDomainId;
            testSecurityDomainKey = key;
            testSecurityDomain = waitForResourceByTypeAndKey(platform, security, domainType, key);
            if (testSecurityDomain != null)
                System.out.println("*** Found          Domain [" + testSecurityDomain.getResourceKey() + "]");
        }

        //acl=classic
        String descriptorName = "";
        String moduleAttribute = "";
        //acl
        if (optionAttributeType.equals(ModuleOptionType.Acl.getAttribute())) {
            descriptorName = "ACL (Profile)";
            moduleAttribute = "acl=classic";
        } else if (optionAttributeType.equals(ModuleOptionType.Audit.getAttribute())) {
            descriptorName = "Audit (Profile)";
            moduleAttribute = "audit=classic";
        } else if (optionAttributeType.equals(ModuleOptionType.Authentication.getAttribute())) {
            descriptorName = "Authentication (Classic - Profile)";
            moduleAttribute = "authentication=classic";
        } else if (optionAttributeType.equals(ModuleOptionType.Authorization.getAttribute())) {
            descriptorName = "Authorization (Profile)";
            moduleAttribute = "authorization=classic";
        } else if (optionAttributeType.equals(ModuleOptionType.IdentityTrust.getAttribute())) {
            descriptorName = "Identity Trust (Profile)";
            moduleAttribute = "identity-trust=classic";
        } else if (optionAttributeType.equals(ModuleOptionType.Mapping.getAttribute())) {
            descriptorName = "Mapping (Profile)";
            moduleAttribute = "mapping=classic";
        }
        //Build the right Module Option Type. Ex. ACL (Profile), etc.
        ResourceType moduleOptionType = new ResourceType(descriptorName, PLUGIN_NAME, ResourceCategory.SERVICE, null);
        ConfigurationDefinition cdef = new ConfigurationDefinition(descriptorName, null);
        moduleOptionType.setResourceConfigurationDefinition(cdef);
        //Ex. profile=full-ha,subsystem=security,security-domain=testDomain2,identity-trust=classic
        String moduleOptionTypeKey = testSecurityDomainKey += "," + moduleAttribute;

        if (!testSecurityDomainKey.endsWith(securityDomainId)) {
            moduleOptionTypeKey = testSecurityDomainKey.substring(0, testSecurityDomainKey.indexOf(securityDomainId)
                + securityDomainId.length())
                + "," + moduleAttribute;
        }

        InventoryManager im = pluginContainer.getInventoryManager();
        Resource platform = im.getPlatform();

        moduleOptionResource = waitForResourceByTypeAndKey(platform, testSecurityDomain, moduleOptionType,
            moduleOptionTypeKey);
        if (moduleOptionResource != null)
            System.out.println("*** Found ModuleOption [" + moduleOptionResource.getResourceKey() + "]");
View Full Code Here

Examples of org.rhq.core.pc.inventory.InventoryManager

            descriptorName = "Mapping Modules (Profile)";
            moduleAttribute = "mapping=classic";
            moduleOptionsDescriptor = "Module Options (Mapping - Profile)";
        }

        InventoryManager im = pluginContainer.getInventoryManager();
        Resource platform = im.getPlatform();

        //Build the right Module Option Type. Ex. ACL Modules (Profile), etc.
        ResourceType modulesType = new ResourceType(descriptorName, PLUGIN_NAME, ResourceCategory.SERVICE, null);
        //Ex. profile=full-ha,subsystem=security,security-domain=testDomain2,acl=classic,acl-modules:0
        String sharedRoot = "profile=full-ha,subsystem=security,security-domain=testDomain2";
View Full Code Here

Examples of org.rhq.core.pc.inventory.InventoryManager

    private Resource getResource(Resource parentResource, String pluginDescriptorTypeName, String resourceKey) {
        Resource resource = null;
        if (((parentResource != null) & (pluginDescriptorTypeName != null) & (resourceKey != null))
            & (((!pluginDescriptorTypeName.isEmpty()) & (!resourceKey.isEmpty())))) {
            InventoryManager im = pluginContainer.getInventoryManager();
            Resource platform = im.getPlatform();

            ResourceType resourceType = buildResourceType(pluginDescriptorTypeName);
            resource = waitForResourceByTypeAndKey(platform, parentResource, resourceType, resourceKey);
        }
        return resource;
View Full Code Here

Examples of org.rhq.core.pc.inventory.InventoryManager

        // Change the baseDir prop.
        File originalBaseDir = serverPluginConfig.getBaseDir();
        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;
        }

        // Set the baseDir back to the original value and restart the component before making any assertions, to ensure
        // things aren't left in a corrupt state for remaining test methods.
        serverPluginConfig.setBaseDir(originalBaseDir);
        inventoryManager.activateResource(getServerResource(), serverContainer, true);

        Assert.assertNotNull(ipce, "InvalidPluginConfigurationException was not thrown by server component's "
            + "start() method due to invalid baseDir.");

        // Change the expectedRuntimeProductName property
        String originalExpectedRuntimeProductName = pluginConfig.getSimpleValue("expectedRuntimeProductName");
        if (originalExpectedRuntimeProductName.equals(JBossProductType.AS.PRODUCT_NAME)) {
            pluginConfig.setSimpleValue("expectedRuntimeProductName", JBossProductType.EAP.PRODUCT_NAME);
        } else {
            pluginConfig.setSimpleValue("expectedRuntimeProductName", JBossProductType.AS.PRODUCT_NAME);
        }

        // Restart the server ResourceComponent so it picks up the changes we just made to the plugin config.
        inventoryManager.deactivateResource(getServerResource());
        ipce = null;
        try {
            inventoryManager.activateResource(getServerResource(), serverContainer, true);
        } catch (InvalidPluginConfigurationException e) {
            ipce = e;
        }

        // Set the expectedRuntimeProductName property back to the original value and restart the component before
        // making any assertions, to ensure things aren't left in a corrupt state for remaining test methods.
        pluginConfig.setSimpleValue("expectedRuntimeProductName", originalExpectedRuntimeProductName);
        inventoryManager.activateResource(getServerResource(), serverContainer, true);

        Assert.assertNotNull(ipce, "InvalidPluginConfigurationException was not thrown by server component's "
            + "start() method due to invalid productType.");
    }
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.