Package org.rhq.core.domain.configuration

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


    private String getDiscoveryDelayConfigurationValue() {
        // This could be the value from either recipe or the default one
        Integer rValue = Integer.valueOf(30);

        // If user wanted to override the value in recipe, allow it
        Property discoveryDelayProperty = wizard.getNewDeploymentConfig().get("org.rhq.discoveryDelay");

        if(discoveryDelayProperty == null) {
            // If there was no recipe value, assume the current value is the default one and check live-deployment
            BundleDeployment liveDeployment = wizard.getLiveDeployment();
View Full Code Here


    }

    public void print(PropertyMap p, int depth) {
        out.println(indent(depth) + p.getName() + " [" + p.getMap().size() + "] {");
        for (String key : p.getMap().keySet()) {
            Property entry = p.getMap().get(key);
            if (entry instanceof PropertySimple) {
                print((PropertySimple) entry, depth + 1);
            } else if (entry instanceof PropertyMap) {
                print((PropertyMap) entry, depth + 1);
            }
View Full Code Here

            generateProperty(propertyDefinition, configuration);
        return configuration;
    }

    private static void generateProperty(PropertyDefinition propertyDefinition, AbstractPropertyMap parentPropertyMap) {
        Property property;
        if (propertyDefinition instanceof PropertyDefinitionSimple) {
            property = generatePropertySimple((PropertyDefinitionSimple) propertyDefinition);
        } else if (propertyDefinition instanceof PropertyDefinitionMap) {
            property = generatePropertyMap((PropertyDefinitionMap) propertyDefinition);
        } else if (propertyDefinition instanceof PropertyDefinitionList) {
View Full Code Here

        when(mockConfigurationDefinition.getDefaultTemplate()).thenReturn(mockConfigurationTemplate);

        Configuration mockConfiguration = mock(Configuration.class);
        when(mockConfigurationTemplate.getConfiguration()).thenReturn(mockConfiguration);

        Property mockProperty = mock(Property.class);
        when(mockConfiguration.get(eq("__type"))).thenReturn(mockProperty);

        Map<String, PropertyDefinition> mockMap = (Map<String, PropertyDefinition>) mock(Map.class);
        when(mockConfigurationDefinition.getPropertyDefinitions()).thenReturn(mockMap);
View Full Code Here

        when(mockConfigurationDefinition.getDefaultTemplate()).thenReturn(mockConfigurationTemplate);

        Configuration mockConfiguration = mock(Configuration.class);
        when(mockConfigurationTemplate.getConfiguration()).thenReturn(mockConfiguration);

        Property mockProperty = mock(Property.class);
        when(mockConfiguration.get("_type")).thenReturn(null);
        when(mockConfiguration.get(eq("__name"))).thenReturn(mockProperty);


        Map<String, PropertyDefinition> mockMap = (Map<String, PropertyDefinition>) mock(Map.class);
View Full Code Here

        when(mockConfigurationDefinitionCopy.getDefaultTemplate()).thenReturn(mockConfigurationTemplate);

        Configuration mockConfiguration = mock(Configuration.class);
        when(mockConfigurationTemplate.getConfiguration()).thenReturn(mockConfiguration);

        Property mockProperty = mock(Property.class);
        when(mockConfiguration.get(eq("__type"))).thenReturn(mockProperty);

        Map<String, PropertyDefinition> mockMap = (Map<String, PropertyDefinition>) mock(Map.class);
        when(mockConfigurationDefinitionCopy.getPropertyDefinitions()).thenReturn(mockMap);
View Full Code Here

        when(mockConfigurationDefinitionCopy.getDefaultTemplate()).thenReturn(mockConfigurationTemplate);

        Configuration mockConfiguration = mock(Configuration.class);
        when(mockConfigurationTemplate.getConfiguration()).thenReturn(mockConfiguration);

        Property mockProperty = mock(Property.class);
        when(mockConfiguration.get(eq("__type"))).thenReturn(null);
        when(mockConfiguration.get(eq("__name"))).thenReturn(mockProperty);

        Map<String, PropertyDefinition> mockMap = (Map<String, PropertyDefinition>) mock(Map.class);
        when(mockConfigurationDefinitionCopy.getPropertyDefinitions()).thenReturn(mockMap);
View Full Code Here

        assertEquals(configuration.getSimpleValue("jndi-name"), "java:jboss/datasources/" + getTestDatasourceName());
        PropertyList connectionPropertiesListWrapper = configuration.getList("*1");
        assertNotNull(connectionPropertiesListWrapper, "Connection properties list wrapper is null");
        List<Property> connectionPropertiesList = connectionPropertiesListWrapper.getList();
        assertEquals(connectionPropertiesList.size(), 1);
        Property property = connectionPropertiesList.iterator().next();
        assertTrue(property instanceof PropertyMap, "Connection properties should be a list of maps");
        PropertyMap propertyMap = (PropertyMap) property;
        String pname = propertyMap.getSimpleValue("pname", null);
        assertNotNull(pname, "Connection property key is null");
        assertEquals(pname, "DatasourceTestKey");
View Full Code Here

            String code = null;
            String type = null;
            String flag = null;
            //populate the associated attributes if it's supported.
            for (String key : loadedConfiguration.getAllProperties().keySet()) {
                Property property = loadedConfiguration.getAllProperties().get(key);
                if (key.equals("code")) {
                    code = ((PropertySimple) property).getStringValue();
                } else if (key.equals("flag")) {
                    flag = ((PropertySimple) property).getStringValue();
                } else {//Ex. type.
                    type = ((PropertySimple) property).getStringValue();
                }
            }

            //retrieve module options as well.
            String jsonContent = jsonMap.get(attribute);
            Result result = new Result();
            try {
                // loading jsonMap contents for Ex. 'login-module'
                JsonNode node = mapper.readTree(jsonContent);
                Object obj = mapper.treeToValue(node, Object.class);
                result.setResult(obj);
                result.setOutcome("success");
            } catch (JsonProcessingException e) {
                e.printStackTrace();
                assert false;
            } catch (IOException e) {
                e.printStackTrace();
                assert false;
            }

            //populate the Value component complete with module Options.
            List<Value> moduleTypeValue = populateSecurityDomainModuleOptions(result, loadModuleOptionType(attribute));
            Value moduleOptionType = moduleTypeValue.get(0);
            //Ex. retrieve the acl-modules component and assert values.
            //always test 'code'
            assert moduleOptionType.getCode().equals(code) : "Module Option 'code' value is not correct. Expected '"
                + code + "' but was '" + moduleOptionType.getCode() + "'";
            if (attribute.equals(ModuleOptionType.Mapping.getAttribute())) {
                assert moduleOptionType.getType().equals(type) : "Mapping Module 'type' value is not correct. Expected '"
                    + type + "' but was '" + moduleOptionType.getType() + "'";
            } else if (!attribute.equals(ModuleOptionType.Audit.getAttribute())) {//Audit has no second parameter
                assert moduleOptionType.getFlag().equals(flag) : "Provider Module 'flag' value is not correct. Expected '"
                    + flag + "' but was '" + moduleOptionType.getFlag() + "'";
            }

            //Retrieve Module Options and test
            //Ex. Module Options  for (Acl Modules - Profile)
            Resource moduleOptionsResource = getModuleOptionsResource(moduleOptionsTypeResource, attribute);
            //assert non-zero id returned
            assert moduleOptionsResource.getId() != 0 : "The resource was not properly initialized. Expected id != 0";
            //fetch configuration for module options
            //Now request the resource complete with resource config
            Configuration loadedOptionsConfiguration = testConfigurationManager
                .loadResourceConfiguration(moduleOptionsResource.getId());
            for (String key : loadedOptionsConfiguration.getAllProperties().keySet()) {
                //retrieve the open map of Module Options
                PropertyMap map = ((PropertyMap) loadedOptionsConfiguration.getAllProperties().get(key));
                LinkedHashMap<String, Object> options = moduleOptionType.getOptions();
                for (String optionKey : map.getMap().keySet()) {
                    PropertySimple property = (PropertySimple) map.getMap().get(optionKey);
                    //test the key
                    assert options.containsKey(optionKey) : "Unable to find expected option key '" + optionKey
                        + "'. Check hierarchy.";
                    //now the value.
                    String value = String.valueOf(options.get(optionKey));
                    assert value.equals(property.getStringValue()) : "Unable to find expected Module Option mapping.  Key '"
                        + optionKey
                        + "' did not map to expected value '"
                        + value
                        + "' but was '"
                        + property.getStringValue() + "'.";
                }
            }
        }
    }
View Full Code Here

        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;
            }
View Full Code Here

TOP

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

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.