Package org.rhq.core.domain.configuration

Examples of org.rhq.core.domain.configuration.RawConfiguration


        }
        return null;
    }

    public void setCurrentPath(String path) {
        RawConfiguration raw = getModified().get(path);
        if (null == raw) {
            raw = getRaws().get(path);
        }
        if (null != raw) {
            current = raw;
View Full Code Here


        prepareConfigForMergeIntoRaws(configuration, rawConfigs);

        Queue<RawConfiguration> queue = new LinkedList<RawConfiguration>(rawConfigs);

        while (!queue.isEmpty()) {
            RawConfiguration originalRaw = queue.poll();
            RawConfiguration mergedRaw = facet.mergeRawConfiguration(configuration, originalRaw);
            if (mergedRaw != null) {
                //TODO bypass validation of structured config for template values
                String contents = mergedRaw.getContents();
                String sha256 = new MessageDigestGenerator(MessageDigestGenerator.SHA_256).calcDigestString(contents);
                mergedRaw.setContents(contents, sha256);
                updateRawConfig(configuration, originalRaw, mergedRaw);
            }
        }
    }
View Full Code Here

    }

    @Test
    public void updateResourceConfigShouldTranslateRawWhenRawConfigHasEdits() throws Exception {
        final ResourceConfigUpdateFixture fixture = newStructuredAndRawResourceConfigUpdateFixture();
        fixture.configuration.addRawConfiguration(new RawConfiguration());

        final Configuration translatedConfig = fixture.configuration.deepCopy();
        translatedConfig.put(new PropertySimple("x", "y"));

        final ResourceConfigurationUpdate expectedUpdate = new ResourceConfigurationUpdate(fixture.resource,
View Full Code Here

    }

    public Set<RawConfiguration> loadRawConfigurations() {
        try {
            Set<RawConfiguration> configs = new HashSet<RawConfiguration>();
            RawConfiguration modules = new RawConfiguration();
            modules.setPath(MODULES_PATH);
            String contents = FileUtils.readFileToString(new File(MODULES_PATH));
            String sha256 = new MessageDigestGenerator(MessageDigestGenerator.SHA_256).calcDigestString(contents);
            modules.setContents(contents, sha256);
            configs.add(modules);

            RawConfiguration settings = new RawConfiguration();
            settings.setPath(SETTINGS_PATH);
            contents = FileUtils.readFileToString(new File(SETTINGS_PATH));
            sha256 = new MessageDigestGenerator(MessageDigestGenerator.SHA_256).calcDigestString(contents);
            settings.setContents(contents, sha256);
            configs.add(settings);
            return configs;
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
View Full Code Here

        }
    }

    public RawConfiguration mergeRawConfiguration(Configuration from, RawConfiguration to) {
        try {
            RawConfiguration config = new RawConfiguration();
            rawConfigHelper.mergeRawConfig(from, to, config);
            return config;
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
View Full Code Here

    }

    public Set<RawConfiguration> loadRawConfigurations() {

        Set<RawConfiguration> raws = new HashSet<RawConfiguration>();
        RawConfiguration raw = new RawConfiguration();

        raw.setPath(ETC_NSSWITCH_CONF);

        String contents = getContents(new File(raw.getPath()));
        String sha256 = new MessageDigestGenerator(MessageDigestGenerator.SHA_256).calcDigestString(contents);
        raw.setContents(contents, sha256);

        raws.add(raw);
        return raws;
    }
View Full Code Here

    public void verifyPersistSavesRawConfiguration() throws Exception {

        executeInTransaction(new TransactionCallback() {
            public void execute() throws Exception {

                RawConfiguration rawConfig = createRawConfiguration();

                Configuration config = new Configuration();
                config.addRawConfiguration(rawConfig);

                em.persist(config);

                assertTrue("Failed to cascade save to " + RawConfiguration.class.getSimpleName(),
                    rawConfig.getId() != 0);
            }
        });

    }
View Full Code Here

    public void verifyOrphanedRawConfigurationDeletedFromDatabase() throws Exception {

        executeInTransaction(new TransactionCallback() {
            public void execute() throws Exception {

                RawConfiguration rawConfiguration = createRawConfiguration();

                Configuration config = new Configuration();
                config.addRawConfiguration(rawConfiguration);

                em.persist(config);

                config.removeRawConfiguration(rawConfiguration);

                config = em.merge(config);

                em.flush();
                em.clear();

                assertNull("Failed to remove the orphaned " + RawConfiguration.class.getSimpleName()
                    + " from the persistence context.", em.find(RawConfiguration.class, rawConfiguration.getId()));
            }
        });
    }
View Full Code Here

            }
        });
    }

    RawConfiguration createRawConfiguration() {
        RawConfiguration rawConfig = new RawConfiguration();
        String contents = "contents";
        String sha256 = new MessageDigestGenerator(MessageDigestGenerator.SHA_256).calcDigestString(contents);
        rawConfig.setContents(contents, sha256);
        rawConfig.setPath("/tmp/foo");

        return rawConfig;
    }
View Full Code Here

TOP

Related Classes of org.rhq.core.domain.configuration.RawConfiguration

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.