Examples of ConfigurationTemplate


Examples of org.rhq.core.domain.configuration.definition.ConfigurationTemplate

        ScheduledJobDefinition job = null;

        // if the definition is not a map, it can't be a schedule
        if (mapDef instanceof PropertyDefinitionMap) {
            PropertyDefinitionMap jobMapDef = (PropertyDefinitionMap) mapDef;
            ConfigurationTemplate defaultTemplate = jobMapDef.getConfigurationDefinition().getDefaultTemplate();
            PropertyMap defaults = defaultTemplate.getConfiguration().getMap(mapDef.getName());
            // prepare some defaults if the schedule didn't define some of these
            // we assume:
            //    the map name is the methodName that will be invoked
            //    the class name is null, which means its the stateful plugin component to be invoked
            //    the schedule is always enabled
View Full Code Here

Examples of org.rhq.core.domain.configuration.definition.ConfigurationTemplate

            ResourceType platform = getResourceType("myPlatform7");
            getTransactionManager().begin();
            platform = em.find(ResourceType.class, platform.getId());

            ConfigurationDefinition cd = platform.getResourceConfigurationDefinition();
            ConfigurationTemplate defaultTemplate = cd.getDefaultTemplate();
            assert defaultTemplate != null;
            Configuration config = defaultTemplate.getConfiguration();
            PropertySimple ps = config.getSimple("six");
            assert "foo".equals(ps.getStringValue()) : "Expected 'foo', but got " + ps.getStringValue();
            getTransactionManager().rollback();

            registerPlugin("updateDefaultTemplate2.xml");
            platform = getResourceType("myPlatform7");
            getTransactionManager().begin();
            em = getEntityManager();
            platform = em.find(ResourceType.class, platform.getId());

            cd = platform.getResourceConfigurationDefinition();
            defaultTemplate = cd.getDefaultTemplate();
            assert defaultTemplate != null;
            config = defaultTemplate.getConfiguration();
            ps = config.getSimple("six");
            assert "bar".equals(ps.getStringValue()) : "Expected 'bar', but got " + ps.getStringValue();
            getTransactionManager().rollback();

        } finally {
View Full Code Here

Examples of org.rhq.core.domain.configuration.definition.ConfigurationTemplate

    @Test(enabled = ENABLED)
    public void testAddDeleteTemplate() throws Exception {
        try {
            ResourceType platform;
            ConfigurationTemplate defaultTemplate;
            ConfigurationDefinition cd;
            Map<String, ConfigurationTemplate> templateMap;
            ConfigurationTemplate template;
            PropertySimple ps;

            registerPlugin("addDeleteTemplate1.xml");
            platform = getResourceType("myPlatform7");
            getTransactionManager().begin();
            platform = em.find(ResourceType.class, platform.getId());

            cd = platform.getResourceConfigurationDefinition();
            defaultTemplate = cd.getDefaultTemplate();
            assert defaultTemplate != null;
            templateMap = cd.getTemplates();
            assert templateMap.size() == 1 : "Expected only the 1 default template but got " + templateMap.size();
            getTransactionManager().rollback();

            System.out.println("Done with v1");

            registerPlugin("addDeleteTemplate2.xml");
            platform = getResourceType("myPlatform7");
            getTransactionManager().begin();
            em = getEntityManager();
            platform = em.find(ResourceType.class, platform.getId());
            cd = platform.getResourceConfigurationDefinition();
            defaultTemplate = cd.getDefaultTemplate();
            templateMap = cd.getTemplates();
            assert defaultTemplate != null;
            assert templateMap.size() == 2 : "Expected 2 templates but got " + templateMap;
            template = templateMap.get("additional");
            assert template != null;
            ps = template.getConfiguration().getSimple("second_one");
            assert ps.getStringValue().equals("Bart") : "Expected 'Bart', but got " + ps.getStringValue();
            getTransactionManager().rollback();

            System.out.println("Done with v2");

            registerPlugin("addDeleteTemplate3.xml");
            platform = getResourceType("myPlatform7");
            getTransactionManager().begin();
            em = getEntityManager();
            platform = em.find(ResourceType.class, platform.getId());
            cd = platform.getResourceConfigurationDefinition();
            defaultTemplate = cd.getDefaultTemplate();
            templateMap = cd.getTemplates();
            assert defaultTemplate != null;
            assert templateMap.size() == 2 : "Expected 2 templates but got " + templateMap;
            template = templateMap.get("additional");
            assert template != null;
            ps = template.getConfiguration().getSimple("second_one");
            assert ps.getStringValue().equals("Bart Simpson") : "Expected 'Bart Simpson', but got "
                + ps.getStringValue();
            getTransactionManager().rollback();

            System.out.println("Done with v3");
View Full Code Here

Examples of org.rhq.core.domain.configuration.definition.ConfigurationTemplate

                VLayout horizontalSpacer = new VLayout();
                horizontalSpacer.setWidth(FIRST_COLUMN_WIDTH);
                this.operationParametersConfigurationHolder.addMember(horizontalSpacer);

                if (isNewRecord()) {
                    ConfigurationTemplate defaultTemplate = parametersDefinition.getDefaultTemplate();
                    switch (operationNameChangeContext) {
                    case INIT:
                    case RESET:
                        OperationHistory operationExample = getOperationExample();
                        if (operationExample != null) {
                            Configuration exampleParameters = operationExample.getParameters();
                            if (exampleParameters == null) {
                                Message message = new Message(
                                    MSG.view_operationScheduleDetails_example_null_parameters(), Severity.Warning);
                                CoreGUI.getMessageCenter().notify(message);
                            } else if (!ConfigurationUtility.validateConfiguration(exampleParameters,
                                parametersDefinition).isEmpty()) {
                                Message message = new Message(
                                    MSG.view_operationScheduleDetails_example_parameters_invalid(), Severity.Warning);
                                CoreGUI.getMessageCenter().notify(message);
                            } else {
                                operationParameters = exampleParameters.deepCopy(false);
                                break;
                            }
                        }
                    default:
                        operationParameters = (defaultTemplate != null) ? defaultTemplate.createConfiguration()
                            : new Configuration();
                    }
                }

                ConfigurationGWTServiceAsync configurationService = GWTServiceLookup.getConfigurationService();
View Full Code Here

Examples of org.rhq.core.domain.configuration.definition.ConfigurationTemplate

    public void setNewResourceConfigurationDefinition(ConfigurationDefinition newResourceConfigurationDefinition) {
        if (null == this.newResourceConfigurationDefinition
            || !this.newResourceConfigurationDefinition.equals(newResourceConfigurationDefinition)) {
            this.newResourceConfigurationDefinition = newResourceConfigurationDefinition;
            if (newResourceConfigurationDefinition != null) {
                ConfigurationTemplate defaultTemplate = this.newResourceConfigurationDefinition.getDefaultTemplate();
                this.newResourceStartingConfiguration = (defaultTemplate != null) ?
                        defaultTemplate.createConfiguration() : new Configuration();
            }
        }
    }
View Full Code Here

Examples of org.rhq.core.domain.configuration.definition.ConfigurationTemplate

        when(mockResourceContext.getResourceType()).thenReturn(mockResourceType);

        ConfigurationDefinition mockConfigurationDefinition = mock(ConfigurationDefinition.class);
        when(mockResourceType.getResourceConfigurationDefinition()).thenReturn(mockConfigurationDefinition);

        ConfigurationTemplate mockConfigurationTemplate = mock(ConfigurationTemplate.class);
        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);
View Full Code Here

Examples of org.rhq.core.domain.configuration.definition.ConfigurationTemplate

        when(mockResourceContext.getResourceType()).thenReturn(mockResourceType);

        ConfigurationDefinition mockConfigurationDefinition = mock(ConfigurationDefinition.class);
        when(mockResourceType.getResourceConfigurationDefinition()).thenReturn(mockConfigurationDefinition);

        ConfigurationTemplate mockConfigurationTemplate = mock(ConfigurationTemplate.class);
        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);
View Full Code Here

Examples of org.rhq.core.domain.configuration.definition.ConfigurationTemplate

        when(mockResourceType.getResourceConfigurationDefinition()).thenReturn(mockConfigurationDefinition);

        ConfigurationDefinition mockConfigurationDefinitionCopy = mock(ConfigurationDefinition.class);
        when(mockConfigurationDefinition.copy()).thenReturn(mockConfigurationDefinitionCopy);

        ConfigurationTemplate mockConfigurationTemplate = mock(ConfigurationTemplate.class);
        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);
View Full Code Here

Examples of org.rhq.core.domain.configuration.definition.ConfigurationTemplate

        when(mockResourceType.getResourceConfigurationDefinition()).thenReturn(mockConfigurationDefinition);

        ConfigurationDefinition mockConfigurationDefinitionCopy = mock(ConfigurationDefinition.class);
        when(mockConfigurationDefinition.copy()).thenReturn(mockConfigurationDefinitionCopy);

        ConfigurationTemplate mockConfigurationTemplate = mock(ConfigurationTemplate.class);
        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);
View Full Code Here

Examples of org.rhq.core.domain.configuration.definition.ConfigurationTemplate

    public void testManualAdd() throws Exception {
        ResourceType jmxServerType = getPluginManager().getMetadataManager().getType(SERVER_TYPE_NAME, PLUGIN_NAME);
        assertNotNull(jmxServerType);

        ConfigurationDefinition pluginConfigurationDefinition = jmxServerType.getPluginConfigurationDefinition();
        ConfigurationTemplate template = pluginConfigurationDefinition.getTemplate(getPluginConfigTemplateName());
        assertNotNull(template);

        Configuration pluginConfig = template.createConfiguration();
        setupTemplatedPluginConfig(pluginConfig);

        MergeResourceResponse response = getInventoryManager().manuallyAddResource(jmxServerType,
            getPlatform().getId(), pluginConfig, -1);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.