Package org.rhq.core.pluginapi.configuration

Examples of org.rhq.core.pluginapi.configuration.ConfigurationUpdateReport


        }

        // We have changed http port to 8081 and https to 9443, lets write back

        ConfigurationWriteDelegate cwd = new ConfigurationWriteDelegate(configDef, getDomainControllerASConnection(), a);
        ConfigurationUpdateReport report = new ConfigurationUpdateReport(conf);
        cwd.updateResourceConfiguration(report);
        assert report.getStatus() == ConfigurationUpdateStatus.SUCCESS;

        // now check the result (and change back)

        Configuration conf2 = loadDelegate.loadResourceConfiguration();
        assert conf2 != null : "Did not get a configuration back";
        List<Property> pl2 = conf.getList("*").getList();
        for (Property p : pl2) {
            PropertyMap pm = (PropertyMap) p;
            Map<String, Property> pmap = pm.getMap();
            PropertySimple name = (PropertySimple) pmap.get("name");
            assert name != null;
            assert name.getStringValue() != null;
            if ("http".equals(name.getStringValue())) {
                PropertySimple portProp = (PropertySimple) pmap.get("port");
                assert portProp != null;
                assert portProp.getStringValue() != null;

                portProp.setStringValue("8080");
            }
            if ("https".equals(name.getStringValue())) {
                PropertySimple portProp = (PropertySimple) pmap.get("port");
                assert portProp != null;
                assert portProp.getStringValue() != null;

                portProp.setStringValue("8443");
            }
        }
        report = new ConfigurationUpdateReport(conf);
        cwd.updateResourceConfiguration(report);
        assert report.getStatus() == ConfigurationUpdateStatus.SUCCESS;
    }
View Full Code Here


            for (PropertyDefinition propDef : propDefs) {
                loadProperty(propDef, resourceConfig, this.augeas, this.resourceConfigRootNode);
            }

            // This will add error messages to any PropertySimples with invalid values, so they can be displayed by the GUI.
            validateResourceConfiguration(new ConfigurationUpdateReport(resourceConfig));
            return resourceConfig;
        } finally {
            close();
        }
    }
View Full Code Here

//        config.put(new PropertySimple("heapDumpOnOOMError", true));
//        config.put(new PropertySimple("heapDumpDir", confDir()));
//        config.put(new PropertySimple("cqlPort", 9595));
//        config.put(new PropertySimple("gossipPort", 9696));

        ConfigurationUpdateReport report = new ConfigurationUpdateReport(config);

        configDelegate.updateResourceConfiguration(report);

        Properties properties = loadCassandraJvmProps();
View Full Code Here

        Configuration config = new Configuration();
        config.put(new PropertySimple("minHeapSize", "512M"));
        config.put(new PropertySimple("maxHeapSize", "768M"));

        ConfigurationUpdateReport report = new ConfigurationUpdateReport(config);

        configDelegate.updateResourceConfiguration(report);

        Properties properties = loadCassandraJvmProps();
View Full Code Here

    @Test
    public void disableHeapDumps() throws Exception {
        createDefaultConfig();

        ConfigurationUpdateReport report = new ConfigurationUpdateReport(Configuration.builder()
            .addSimple("heapDumpOnOOMError", false).build());

        configDelegate.updateResourceConfiguration(report);

        Properties properties = loadCassandraJvmProps();
View Full Code Here

    @Test
    public void updateShouldFailWhenMaxHeapSizeIsInvalid() throws Exception {
        createDefaultConfig();

        ConfigurationUpdateReport report = new ConfigurationUpdateReport(Configuration.builder()
            .addSimple("maxHeapSize", "256GB").build());

        configDelegate.updateResourceConfiguration(report);

        assertEquals(report.getStatus(), ConfigurationUpdateStatus.FAILURE, "The configuration update should fail " +
            "when [maxHeapSize] has an invalid value.");
    }
View Full Code Here

    @Test
    public void updateShouldFailWhenHeapNewSizeIsInvalid() throws Exception {
        createDefaultConfig();

        ConfigurationUpdateReport report = new ConfigurationUpdateReport(Configuration.builder()
            .addSimple("heapNewSize", "25^G").build());

        configDelegate.updateResourceConfiguration(report);

        assertEquals(report.getStatus(), ConfigurationUpdateStatus.FAILURE, "The configuration update should fail " +
            "when [heapNewSize] has an invalid value.");
    }
View Full Code Here

    @Test
    public void updateShouldFailWhenThreadStackSizeIsInvalid() throws Exception {
        createDefaultConfig();

        ConfigurationUpdateReport report = new ConfigurationUpdateReport(Configuration.builder()
            .addSimple("threadStackSize", "128M").build());

        configDelegate.updateResourceConfiguration(report);

        assertEquals(report.getStatus(), ConfigurationUpdateStatus.FAILURE, "The configuration update should fail " +
            "when [threadStackSize] has an invalid value.");
    }
View Full Code Here

        config.put(new PropertySimple("threadStackSize", params.getSimpleValue("threadStackSize")));

        String restartIfRequiredString = params.getSimpleValue("restartIfRequired");
        boolean restartIfRequired = restartIfRequiredString != null && Boolean.parseBoolean(restartIfRequiredString);

        ConfigurationUpdateReport configurationUpdateReport = new ConfigurationUpdateReport(config);
        StorageNodeConfigDelegate configDelegate = new StorageNodeConfigDelegate(getBasedir(), this);
        configDelegate.updateResourceConfigurationAndRestartIfNecessary(configurationUpdateReport, restartIfRequired);

        OperationResult result = new OperationResult("Configuration updated.");
        if (!configurationUpdateReport.getStatus().equals(ConfigurationUpdateStatus.SUCCESS)) {
            result.setErrorMessage(configurationUpdateReport.getErrorMessage());
        }

        return result;
    }
View Full Code Here

        config = this.createConfiguration(config.deepCopy(), datasourceName);
        PropertySimple property = config.getSimple("max-pool-size");
        property.setIntegerValue(100);

        ConfigurationUpdateReport report = new ConfigurationUpdateReport(config);

        DatasourceConfigurationEditor.updateDatasource(xmlFile, datasourceName, report);

        assert (report.getStatus().equals(ConfigurationUpdateStatus.SUCCESS)) : "Update report status should be successful";

        config = DatasourceConfigurationEditor.loadDatasource(xmlFile, datasourceName);
        assertLoadingOfConfiguration(config, datasourceName, testName);

        Map<String, String> valuesToCheck = new HashMap<String, String>();
View Full Code Here

TOP

Related Classes of org.rhq.core.pluginapi.configuration.ConfigurationUpdateReport

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.