Package org.rhq.core.domain.configuration

Examples of org.rhq.core.domain.configuration.Configuration$PropertiesProxy


        writeFile(additionalDir1, "adddir1-custom-file3.xml", "1. custom file #3 XML");
        writeFile(additionalDir2, "adddir2-custom-file1.txt", "2. custom file #1");
        writeFile(additionalDir2, "adddir2-custom-file2.txt", "2. custom file #2");
        writeFile(additionalDir2, "adddir2-custom-file3.xml", "2. custom file #3 XML");

        Configuration config = new Configuration();
        config.put(new PropertySimple(SnapshotReport.PROP_BASE_DIRECTORY, baseDir.getAbsolutePath()));
        config.put(new PropertySimple(SnapshotReport.PROP_SNAPSHOT_CONFIG_FILES, "true"));
        config.put(new PropertySimple(SnapshotReport.PROP_SNAPSHOT_LOG_FILES, "true"));
        config.put(new PropertySimple(SnapshotReport.PROP_SNAPSHOT_ADDITIONAL_FILES, "true"));
        config.put(new PropertySimple(SnapshotReport.PROP_CONFIG_DIRECTORY, configDir.getName())); // relative path
        config.put(new PropertySimple(SnapshotReport.PROP_LOG_DIRECTORY, logDir.getName())); // relative path
        config.put(new PropertySimple(SnapshotReport.PROP_CONFIG_REGEX, ".*\\.config"));
        config.put(new PropertySimple(SnapshotReport.PROP_LOG_REGEX, ".*\\.log"));

        String dir1 = additionalDir1.getName();
        String dir2 = additionalDir2.getName();

        PropertyList additionalList = new PropertyList(SnapshotReport.PROP_ADDITIONAL_FILES_LIST);
        PropertyMap additionalFiles1 = new PropertyMap("map");
        PropertyMap additionalFiles2 = new PropertyMap("map");
        PropertyMap additionalFiles3 = new PropertyMap("map");
        PropertyMap additionalFiles4 = new PropertyMap("map");
        additionalFiles1.put(new PropertySimple(SnapshotReport.PROP_ADDITIONAL_FILES_DIRECTORY, dir1));
        additionalFiles1.put(new PropertySimple(SnapshotReport.PROP_ADDITIONAL_FILES_REGEX, ".*\\.txt"));
        additionalFiles1.put(new PropertySimple(SnapshotReport.PROP_SNAPSHOT_ADDITIONAL_FILES, "true"));
        additionalFiles2.put(new PropertySimple(SnapshotReport.PROP_ADDITIONAL_FILES_DIRECTORY, dir2));
        additionalFiles2.put(new PropertySimple(SnapshotReport.PROP_ADDITIONAL_FILES_REGEX, ".*\\.txt"));
        //additionalFiles2.put(new PropertySimple(SnapshotReport.PROP_SNAPSHOT_ADDITIONAL_FILES, "true")); // default should be true
        additionalFiles3.put(new PropertySimple(SnapshotReport.PROP_ADDITIONAL_FILES_DIRECTORY, dir1));
        additionalFiles3.put(new PropertySimple(SnapshotReport.PROP_ADDITIONAL_FILES_REGEX, ".*\\.xml"));
        additionalFiles3.put(new PropertySimple(SnapshotReport.PROP_SNAPSHOT_ADDITIONAL_FILES, "true"));
        additionalFiles4.put(new PropertySimple(SnapshotReport.PROP_ADDITIONAL_FILES_DIRECTORY, dir2));
        additionalFiles4.put(new PropertySimple(SnapshotReport.PROP_ADDITIONAL_FILES_REGEX, ".*\\.xml"));
        additionalFiles4.put(new PropertySimple(SnapshotReport.PROP_SNAPSHOT_ADDITIONAL_FILES, "false"));

        config.put(additionalList);
        additionalList.add(additionalFiles1);
        additionalList.add(additionalFiles2);
        additionalList.add(additionalFiles3);
        additionalList.add(additionalFiles4);

View Full Code Here


        result.getComplexResults().setVersion(222);
        result.getComplexResults().setNotes("my notes");
        result.getComplexResults().put(new PropertySimple("foo", "bar"));
        result.getComplexResults().put(new PropertyMap("foo", new PropertySimple("a", "b")));
        result.getComplexResults().put(new PropertyList("foo", new PropertySimple("c", "d")));
        Configuration config = result.getComplexResults().deepCopy();

        assert config != null;
        assert config != result.getComplexResults();
        assert config.equals(result.getComplexResults());
        assert config.getId() == 111;
        assert config.getVersion() == 222;
        assert config.getNotes().equals("my notes");
    }
View Full Code Here

        LinkedList<Property> propertyHierarchy = ConfigurationUtility.getPropertyHierarchy(property);

        StringBuilder identifier = new StringBuilder(ID_PREFIX);

        //noinspection ConstantConditions
        Configuration configuration = propertyHierarchy.getFirst().getConfiguration();

        // NOTE: Use the Configuration's id rather than its hash code, since the id will always be unique across multiple
        //       configs and will not change if the Configuration is modified.
        // TODO (embedded): id will always be zero - perhaps the id could be set to a unique identifier for the entity to
        //                  which the Configuration applies (e.g. for a Resource Configuration, the Resource's path).
        int configId = (configuration.getId() != 0) ? configuration.getId() : configuration.hashCode();
        identifier.append(configId);
        for (Property propertyNode : propertyHierarchy) {
            // NOTE: Use the hash code of the property name rather than the hash code of the property itself, since for
            //       lists and maps, this will be much more performant and just as effective for uniquely identifying a
            //       list or map within a given configuration.
View Full Code Here

@Test
public class StartScriptConfigurationTest {

    @Test
    public void testBasic() throws Exception {
        Configuration config = new Configuration();

        StartScriptConfiguration ssc = new StartScriptConfiguration(config);
        assert config.equals(ssc.getPluginConfig());

        File startScript = new File("run.sh");
        ssc.setStartScript(startScript);
        Assert.assertEquals(ssc.getStartScript(), startScript);
View Full Code Here

            .contains("default"));
    }

    @Test
    public void testLongEnvorArgs() throws Exception {
        Configuration config = new Configuration();

        StartScriptConfiguration ssc = new StartScriptConfiguration(config);
        assert config.equals(ssc.getPluginConfig());

        Map<String, String> startScriptEnv = new HashMap<String, String>();
        char[] maxArr = new char[PropertySimple.MAX_VALUE_LENGTH];
        Arrays.fill(maxArr, 'J');
        String maxString = new String(maxArr);
        char[] longArr = new char[500];
        Arrays.fill(longArr, 'S');
        String longString = new String(longArr);

        // First ensure we can store the MAX VALUE
        String maxVal = maxString.substring(0, PropertySimple.MAX_VALUE_LENGTH - 5); // MAX= and a line terminator
        startScriptEnv.put("MAX", maxVal);
        ssc.setStartScriptEnv(startScriptEnv);
        Assert.assertNotNull(ssc.getStartScriptEnv());
        Assert.assertEquals(ssc.getStartScriptEnv().get("MAX"), maxVal);
        PropertySimple prop = ssc.getPluginConfig().getSimple(StartScriptConfiguration.START_SCRIPT_ENV_PROP);
        Assert.assertNotNull(prop);
        Assert.assertNotNull(prop.getStringValue());
        Assert.assertEquals(prop.getStringValue().length(), PropertySimple.MAX_VALUE_LENGTH);
        Assert.assertNull(prop.getErrorMessage());

        List<String> startScriptArgs = new ArrayList<String>();
        startScriptArgs.add(maxString);
        ssc.setStartScriptArgs(startScriptArgs);
        Assert.assertNotNull(ssc.getStartScriptArgs());
        Assert.assertEquals(ssc.getStartScriptArgs().size(), 1);
        Assert.assertEquals(ssc.getStartScriptArgs().get(0), maxString);
        prop = ssc.getPluginConfig().getSimple(StartScriptConfiguration.START_SCRIPT_ARGS_PROP);
        Assert.assertNotNull(prop);
        Assert.assertNotNull(prop.getStringValue());
        Assert.assertNull(prop.getErrorMessage());

        // Now, break the camel
        config = new Configuration();
        ssc = new StartScriptConfiguration(config);
        assert config.equals(ssc.getPluginConfig());

        startScriptEnv.put("LONG2", longString);
        ssc.setStartScriptEnv(startScriptEnv);
        Assert.assertTrue(ssc.getStartScriptEnv().isEmpty());
        prop = ssc.getPluginConfig().getSimple(StartScriptConfiguration.START_SCRIPT_ENV_PROP);
View Full Code Here

    }

    @Nullable
    public Configuration getConfiguration() {
        //noinspection UnnecessaryLocalVariable
        Configuration config = FacesComponentUtility.getExpressionAttribute(this, CONFIGURATION_ATTRIBUTE,
            Configuration.class);
        return config;
    }
View Full Code Here

    /**
     * @see org.rhq.enterprise.server.auth.SubjectManagerLocal#loadUserConfiguration(Integer)
     */
    public Subject loadUserConfiguration(Integer subjectId) {
        Subject subject = entityManager.find(Subject.class, subjectId);
        Configuration config = subject.getUserConfiguration();
        if ((config != null) && (config.getProperties() != null)) {
            config.getProperties().size(); // force it to load
        }

        if (subject.getRoles() != null) {
            subject.getRoles().size();
        }
View Full Code Here

        // we are ignoring roles - anything the caller gave us is thrown out
        subject.setRoles(null);
        subject.setLdapRoles(null);
        subject.setOwnedGroups(null);
        Configuration configuration = subject.getUserConfiguration();
        if (configuration != null) {
            configuration = entityManager.merge(configuration);
            subject.setUserConfiguration(configuration);
        }
View Full Code Here

        Collection<ResourceSyncInfo> syncInfos = discoveryBoss.getResourceSyncInfo(resourceId);
        assert syncInfos != null;
        assert !syncInfos.isEmpty();

        Resource resource1 = discoveryBoss.manuallyAddResource(subjectManager.getOverlord(), serviceType2.getId(),
            resourceId, new Configuration());

        try {
            Resource resource2 = discoveryBoss.manuallyAddResource(subjectManager.getOverlord(), serviceType2.getId(),
                resourceId, new Configuration());
            fail("Manually adding a singleton that already existed succeeded: " + resource2);
        } catch (EJBException e) {
            assertEquals(String.valueOf(e.getCause()), RuntimeException.class, e.getCause().getClass());
            assertTrue(String.valueOf(e.getCause()), e.getCause().getMessage().contains("singleton"));
        }
View Full Code Here

                            subject = _login(subject.getName(), subjectPassword, false, false);

                            prepopulateLdapFields(subject);

                            //insert empty configuration to start
                            Configuration newUserConfig = new Configuration();
                            //set flag on user so that we know registration is still required.
                            PropertySimple simple = new PropertySimple("isNewUser", true);
                            newUserConfig.put(simple);
                            subject.setUserConfiguration(newUserConfig);
                        }
                    }

                    //Subject.id guaranteed to be > 0 then iii)authorization updates for ldap groups necessary
View Full Code Here

TOP

Related Classes of org.rhq.core.domain.configuration.Configuration$PropertiesProxy

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.