Package org.rhq.core.clientapi.server.configuration

Examples of org.rhq.core.clientapi.server.configuration.ConfigurationUpdateResponse


        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();
        assert response.getConfigurationUpdateId() == 1;

        configuration = loadConfig();
        pl = (PropertyList) configuration.get("*");
        //        assert pl.getList().size() == count+1 : "Got only " + pl.getList().size() + " items, expected "+ (count+1);
    }
View Full Code Here


        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

        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

        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

        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();
        assert response.getErrorMessage() == null : "Config add resulted in this error: " + response.getErrorMessage();

        configuration = loadConfig();
        pl = (PropertyList) configuration.get("*");
        //      assert pl.getList().size() == count+1 : "Got only " + pl.getList().size() + " items, expected "+ (count+1);
    }
View Full Code Here

        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

        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

                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

        return response;
    }

    public ConfigurationUpdateResponse updateResource(Resource resource, Configuration configuration)
    {
        ConfigurationUpdateResponse response;
        try
        {
            ConfigurationUpdateRequest request = new ConfigurationUpdateRequest(0, configuration, resource.getId());
            response = getConfigService().executeUpdateResourceConfigurationImmediately(request);
            if (response.getStatus() == ConfigurationUpdateStatus.SUCCESS)
            {
                // As ccrouch recalls, we do a service scan to pickup any change to the updated Resource's name.
                discoverServicesSync();
                Events.instance().raiseEvent(ResourceManager.RESOURCE_UPDATED_EVENT, resource);
            }
View Full Code Here

    private String updateConfiguration()
    {
        String result;
        Configuration resourceConfig = getConfiguration();

        ConfigurationUpdateResponse pluginResponse = configurationManager.updateResource(this.listItem.getResource(),
                resourceConfig);

        switch (pluginResponse.getStatus())
        {
            case SUCCESS:
            {
                facesMessages.addFromResourceBundle(FacesMessage.SEVERITY_INFO, "resource.status.update.success",
                        this.listItem.getResource().getResourceType().getName(), this.listItem.getResource().getName());
                result = FacesOutcomes.SUCCESS;
                break;
            }
            default:
            {
                String baseMessage = this.messages.getString("resource.status.update.failure");
                addActionFailureMessageToFacesMessages(baseMessage, pluginResponse.getErrorMessage(),
                        pluginResponse.getConfiguration());
                result = FacesOutcomes.FAILURE;
            }
        }

        return result;
View Full Code Here

TOP

Related Classes of org.rhq.core.clientapi.server.configuration.ConfigurationUpdateResponse

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.