Package org.rhq.core.pc.configuration

Examples of org.rhq.core.pc.configuration.ConfigurationManager


        }
    }

    @Test(groups = TEST_GROUP)
    public void testResourceConfigUpdate() throws Exception {
        ConfigurationManager configurationManager = PluginContainer.getInstance().getConfigurationManager();
        for (Resource resource : getResources()) {
            Configuration updatedResourceConfig = getUpdatedResourceConfig();
            ConfigurationUpdateRequest updateRequest = new ConfigurationUpdateRequest(0, updatedResourceConfig,
                resource.getId());
            configurationManager.executeUpdateResourceConfigurationImmediately(updateRequest);

            if (isResourceConfigSupported()) {
                Configuration resourceConfig = configurationManager.loadResourceConfiguration(resource.getId());
                assert resourceConfig.equals(updatedResourceConfig) :
                        "Unexpected Resource configuration - \nExpected:\n\t"
                    + updatedResourceConfig.toString(true) + "\nActual:\n\t" + resourceConfig.toString(true);
            }
        }
View Full Code Here


        server = waitForResourceByTypeAndKey(platform, platform, STANDALONE_RESOURCE_TYPE, STANDALONE_RESOURCE_KEY);
    }

    @Test(priority = 11)
    public void loadUpdateTemplatedResourceConfiguration() throws Exception {
        ConfigurationManager configurationManager = this.pluginContainer.getConfigurationManager();

        for (ResourceData resourceData : testResourceData) {
            ResourceType resourceType = new ResourceType(resourceData.resourceTypeName, PLUGIN_NAME,
                ResourceCategory.SERVICE, null);
            Resource subsystem = waitForResourceByTypeAndKey(platform, server, resourceType, resourceData.resourceKey);

            Assert.assertNotNull(subsystem);

            Queue<Resource> unparsedResources = new LinkedList<Resource>();
            unparsedResources.add(subsystem);

            List<Resource> foundResources = new ArrayList<Resource>();
            while (!unparsedResources.isEmpty()) {
                Resource currentResource = unparsedResources.poll();

                for (Resource childResource : currentResource.getChildResources()) {
                    unparsedResources.add(childResource);
                    if (childResource.getResourceType().getName().equals(resourceData.subResourceType)) {
                        foundResources.add(childResource);
                    }
                }
            }

            for (Resource resourceUnderTest : foundResources) {
                log.info(foundResources);

                assert resourceUnderTest.getId() != 0 : "Resource not properly initialized. Id = 0. Try extending sleep after discovery.";
                Configuration resourceUnderTestConfig = configurationManager
                    .loadResourceConfiguration(resourceUnderTest.getId());

                Assert.assertNotNull(resourceUnderTestConfig);
                Assert.assertFalse(resourceUnderTestConfig.getProperties().isEmpty());

                boolean specialPropertyFound = false;
                for (Property property : resourceUnderTestConfig.getProperties()) {
                    if (property.getName().equals(resourceData.specialConfigurationProperty)) {
                        Assert.assertNotNull(((PropertySimple) property).getStringValue());
                        specialPropertyFound = true;
                        break;
                    }
                }

                Assert.assertTrue(specialPropertyFound, resourceData.specialConfigurationProperty
                    + "property not found in the list of properties");

                ConfigurationUpdateRequest testUpdateRequest = new ConfigurationUpdateRequest(1,
                    resourceUnderTestConfig, resourceUnderTest.getId());
                ConfigurationUpdateResponse response = configurationManager
                    .executeUpdateResourceConfigurationImmediately(testUpdateRequest);

                Assert.assertNotNull(response);
            }
        }
View Full Code Here

TOP

Related Classes of org.rhq.core.pc.configuration.ConfigurationManager

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.