Package org.rhq.core.clientapi.agent.configuration

Examples of org.rhq.core.clientapi.agent.configuration.ConfigurationUpdateRequest


        ps = new PropertySimple(MULTICAST_PORT_EXPR, "${foo.bar.baz:12356}");
        map.put(ps);
        PropertyList pl = (PropertyList) configuration.get("*");
        pl.add(map);

        ConfigurationUpdateRequest request = new ConfigurationUpdateRequest(1, configuration, getResource().getId());
        ConfigurationUpdateResponse response = pluginContainer.getConfigurationManager()
            .executeUpdateResourceConfigurationImmediately(request);
        assert response != null;
        assert response.getErrorMessage() == null : "Config add resulted in this error: " + response.getErrorMessage();

        configuration = loadConfig();
        map = null;
        pl = (PropertyList) configuration.get("*");
        for (Property prop : pl.getList()) {
            PropertyMap pm = (PropertyMap) prop;
            PropertySimple ps2 = pm.getSimple("name");
            if (!ps2.getStringValue().equals("bla2"))
                continue;

            map = pm;
        }
        assert map != null : "Did not find 'bla2' in the returned config";
        map.put(new PropertySimple(PORT_EXPR, 22355));
        map.put(new PropertySimple("fixed-port", true));
        request = new ConfigurationUpdateRequest(2, configuration, getResource().getId());
        response = pluginContainer.getConfigurationManager().executeUpdateResourceConfigurationImmediately(request);
        assert response != null;
        assert response.getErrorMessage() == null : "Config update resulted in this error: "
            + response.getErrorMessage();

View Full Code Here


        map.put(ps);
        PropertyList pl = (PropertyList) configuration.get("*");
        int count = pl.getList().size();
        pl.add(map);

        ConfigurationUpdateRequest request = new ConfigurationUpdateRequest(1, configuration, getResource().getId());
        ConfigurationUpdateResponse response = pluginContainer.getConfigurationManager()
            .executeUpdateResourceConfigurationImmediately(request);
        assert response != null;
        assert response.getErrorMessage() == null : "Config add resulted in this error: " + response.getErrorMessage();

        configuration = loadConfig();
        pl = (PropertyList) configuration.get("*");
        assert pl.getList().size() == count + 1;

        Iterator<Property> iter = pl.getList().iterator();
        while (iter.hasNext()) {
            Property prop = iter.next();
            PropertyMap pm = (PropertyMap) prop;
            if (pm.getSimpleValue("name", "xxx").equals("bla3")) {
                iter.remove();
                break;
            }
        }
        assert pl.getList().size() == count;

        request = new ConfigurationUpdateRequest(3, configuration, getResource().getId());
        response = pluginContainer.getConfigurationManager().executeUpdateResourceConfigurationImmediately(request);
        assert response != null;
        assert response.getErrorMessage() == null : "Property removal resulted in this error: "
            + response.getErrorMessage();
    }
View Full Code Here

        PropertySimple ps = configuration.getSimple("port-offset");
        String original = ps.getStringValue();

        configuration.put(new PropertySimple("port-offset", 0));

        ConfigurationUpdateRequest request = new ConfigurationUpdateRequest(1, configuration, getResource().getId());
        ConfigurationUpdateResponse response = pluginContainer.getConfigurationManager()
            .executeUpdateResourceConfigurationImmediately(request);
        assert response != null;
        assert response.getErrorMessage() == null : "Changing the port-offset resulted in this error: "
            + response.getErrorMessage();

        configuration = loadConfig();
        ps = configuration.getSimple("port-offset");
        assert ps != null;
        assert ps.getIntegerValue() != null;
        assert ps.getIntegerValue() == 0;

        configuration.put(new PropertySimple("port-offset", original));

        request = new ConfigurationUpdateRequest(2, configuration, getResource().getId());
        response = pluginContainer.getConfigurationManager().executeUpdateResourceConfigurationImmediately(request);
        assert response != null;
        assert response.getErrorMessage() == null : "Changing the port-offset back resulted in this error: "
            + response.getErrorMessage();
View Full Code Here

        map.put(ps);
        ps = new PropertySimple(MULTICAST_PORT_EXPR, "${foo.bar.baz:12346}");
        map.put(ps);
        pl.add(map);

        ConfigurationUpdateRequest request = new ConfigurationUpdateRequest(1, configuration, getResource().getId());
        ConfigurationUpdateResponse response = pluginContainer.getConfigurationManager()
            .executeUpdateResourceConfigurationImmediately(request);
        assert response != null;
        assert response.getConfigurationUpdateId() == 1 : "Expected update id 1, but got "
            + response.getConfigurationUpdateId();
View Full Code Here

        ps = new PropertySimple(MULTICAST_PORT_EXPR, "${foo.bar.baz:12356}");
        map.put(ps);
        PropertyList pl = (PropertyList) configuration.get("*");
        pl.add(map);

        ConfigurationUpdateRequest request = new ConfigurationUpdateRequest(2, configuration, getResource().getId());
        ConfigurationUpdateResponse response = pluginContainer.getConfigurationManager()
            .executeUpdateResourceConfigurationImmediately(request);
        assert response != null;
        assert response.getErrorMessage() == null : "Config add resulted in this error: " + response.getErrorMessage();

        configuration = loadConfig();
        map = null;
        pl = (PropertyList) configuration.get("*");
        for (Property prop : pl.getList()) {
            PropertyMap pm = (PropertyMap) prop;
            PropertySimple ps2 = pm.getSimple("name");
            if (!ps2.getStringValue().equals("bla2"))
                continue;

            map = pm;
        }
        assert map != null : "Did not find 'bla2' in the returned config";
        map.put(new PropertySimple(PORT_EXPR, 22355));
        map.put(new PropertySimple("fixed-port", true));
        request = new ConfigurationUpdateRequest(3, configuration, getResource().getId());
        response = pluginContainer.getConfigurationManager().executeUpdateResourceConfigurationImmediately(request);
        assert response != null;
        assert response.getErrorMessage() == null : "Config update resulted in this error: "
            + response.getErrorMessage();

View Full Code Here

        map.put(ps);
        PropertyList pl = (PropertyList) configuration.get("*");
        int count = pl.getList().size();
        pl.add(map);

        ConfigurationUpdateRequest request = new ConfigurationUpdateRequest(4, configuration, getResource().getId());
        ConfigurationUpdateResponse response = pluginContainer.getConfigurationManager()
            .executeUpdateResourceConfigurationImmediately(request);
        assert response != null;
        assert response.getErrorMessage() == null : "Config add resulted in this error: " + response.getErrorMessage();

        configuration = loadConfig();
        pl = (PropertyList) configuration.get("*");
        assert pl.getList().size() == count + 1;

        Iterator<Property> iter = pl.getList().iterator();
        while (iter.hasNext()) {
            Property prop = iter.next();
            PropertyMap pm = (PropertyMap) prop;
            if (pm.getSimpleValue("name", "xxx").equals("bla3")) {
                iter.remove();
                break;
            }
        }
        assert pl.getList().size() == count;

        request = new ConfigurationUpdateRequest(5, configuration, getResource().getId());
        response = pluginContainer.getConfigurationManager().executeUpdateResourceConfigurationImmediately(request);
        assert response != null;
        assert response.getErrorMessage() == null : "Property removal resulted in this error: "
            + response.getErrorMessage();
    }
View Full Code Here

        // Change a value and update
        //configuration = configuration.deepCopy();
        configuration.put(new PropertySimple("jndi-name", "TestDS"));
        configuration.put(new PropertySimple("max-pool-size", "100"));
        ConfigurationUpdateRequest cur = new ConfigurationUpdateRequest(0, configuration, defaultDs.getId());

        configService.updateResourceConfiguration(cur);

        // Verify changes are in place
        configuration = configService.loadResourceConfiguration(defaultDs.getId());

        assert configuration.getSimple("jndi-name").getStringValue().equals("TestDS") : "Updated property jndiName was incorrect";
        assert configuration.getSimple("max-pool-size").getStringValue().equals("100") : "Updated property max-pool-size was incorrect";
        // Rollback changes (find a better way of doing this)
        configuration.put(new PropertySimple("jndi-name", "DefaultDS"));
        configuration.put(new PropertySimple("max-pool-size", "20"));
        cur.setConfiguration(configuration);
        configService.updateResourceConfiguration(cur);
    }
View Full Code Here

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

    }

    protected static Configuration updateResourceConfiguration(Resource resource, Configuration newConfiguration)
        throws Exception {
        ConfigurationManager configurationManager = PluginContainer.getInstance().getConfigurationManager();
        ConfigurationUpdateRequest configurationUpdateRequest = new ConfigurationUpdateRequest(0, newConfiguration,
            resource.getId());
        configurationManager.updateResourceConfiguration(configurationUpdateRequest);

        //give the component and the managed resource some time to properly persist the update
        Thread.sleep(500);
View Full Code Here

                }

                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.clientapi.agent.configuration.ConfigurationUpdateRequest

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.