Package org.rhq.core.domain.configuration

Examples of org.rhq.core.domain.configuration.Configuration$Builder$MapInList


        Resource resource = newResource1;

        Subject overlord = LookupUtil.getSubjectManager().getOverlord();

        // create a couple configs in history
        Configuration configuration1 = new Configuration();
        configuration1.put(new PropertySimple("myboolean", "true"));

        Configuration configuration2 = new Configuration();
        configuration2.put(new PropertySimple("myboolean", "true"));

        configurationManager.updateResourceConfiguration(overlord, resource.getId(), configuration1);
        Thread.sleep(6000); // wait for the test agent to complete the request
        configurationManager.updateResourceConfiguration(overlord, resource.getId(), configuration2);
        Thread.sleep(6000); // wait for the test agent to complete the request
View Full Code Here


        Resource resource = newResource1;

        Subject overlord = LookupUtil.getSubjectManager().getOverlord();

        // create a couple configs in history
        Configuration configuration1 = new Configuration();
        configuration1.put(new PropertySimple("myboolean", "true"));

        Configuration configuration2 = new Configuration();
        configuration2.put(new PropertySimple("myboolean", "false"));

        ResourceConfigurationUpdate up;
        up = configurationManager.updateResourceConfiguration(overlord, resource.getId(), configuration1);
        Thread.sleep(2000); // wait for the test agent to complete the request
        assert configuration1.equals(configurationManager.getResourceConfiguration(resource.getId()));
        up = configurationManager.updateResourceConfiguration(overlord, resource.getId(), configuration2);
        Thread.sleep(2000); // wait for the test agent to complete the request
        assert configuration2.equals(configurationManager.getResourceConfiguration(resource.getId()));

        // at this point in time, the round trip messaging is done and we have the agent response
        List<ResourceConfigurationUpdate> requests;

        requests = configurationManager.findResourceConfigurationUpdates(overlord, resource.getId(), null, null, false,
View Full Code Here

        Resource resource = newResource1;

        Subject overlord = LookupUtil.getSubjectManager().getOverlord();

        // create a couple update/requests in history - one request will fail, so only a single config in history will be there
        Configuration configuration1 = new Configuration();
        configuration1.put(new PropertySimple("myboolean", "invalid-boolean"));

        Configuration configuration2 = new Configuration();
        configuration2.put(new PropertySimple("myboolean", "true"));

        Configuration activeConfigurationBefore = configurationManager.getResourceConfiguration(resource.getId());

        configurationManager.updateResourceConfiguration(overlord, resource.getId(), configuration1);
        Thread.sleep(2000); // wait for the test agent to complete the request

        Configuration activeConfigurationAfter = configurationManager.getResourceConfiguration(resource.getId());
        assert activeConfigurationBefore.equals(activeConfigurationAfter) : "ActiveResourceConfiguration was not supposed to change for a failed update -- old was: "
            + activeConfigurationBefore + ", new was: " + activeConfigurationAfter;

        configurationManager.updateResourceConfiguration(overlord, resource.getId(), configuration2);
        Thread.sleep(2000); // wait for the test agent to complete the request

        Configuration activeConfiguration = configurationManager.getResourceConfiguration(resource.getId());
        assert activeConfiguration != null : "ActiveResourceConfiguration was not updated with configuration2";
        Map<String, PropertySimple> activeProperties = activeConfiguration.getSimpleProperties();
        assert activeProperties.size() == 1;
        assert activeProperties.containsKey("myboolean");
        PropertySimple activeProperty = activeProperties.get("myboolean");
        assert activeProperty.getName().equals("myboolean");
        assert "true".equals(activeProperty.getStringValue());
View Full Code Here

        try {
            noPermSubject = LookupUtil.getSubjectManager().createSubject(superuser, noPermSubject);
            noPermSubject = createSession(noPermSubject);

            try {
                configurationManager.updateResourceConfiguration(noPermSubject, resource.getId(), new Configuration());
                assert false : "Should not have been updated - user didn't have permissions";
            } catch (PermissionException expected) {
                System.out.println("This was expected and OK:\n" + expected);
            }

            try {
                configurationManager.updatePluginConfiguration(noPermSubject, resource.getId(), new Configuration());
                assert false : "Should not have been updated - user didn't have permissions";
            } catch (PermissionException expected) {
                System.out.println("This was expected and OK:\n" + expected);
                expected.printStackTrace();
            }
View Full Code Here

        }
    }

    @Test(enabled = ENABLE_TESTS)
    public void testInvalidUpdateCallback() throws Exception {
        ConfigurationUpdateResponse response = new ConfigurationUpdateResponse(Integer.MAX_VALUE, new Configuration(),
            ConfigurationUpdateStatus.SUCCESS, null);

        try {
            configurationManager.completeResourceConfigurationUpdate(response);
            assert false : "Should not have been able to process an unknown request - we didn't persist it yet";
View Full Code Here

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

    void delete(Configuration configuration) {
        Configuration managedConfig = em.find(Configuration.class, configuration.getId());
        em.remove(managedConfig);
    }
View Full Code Here

        assertEquals(propDef.getDefaultValue(), "8080");
        assertEquals(propDef.getDescription(), "This is where the product will listen for incoming messages");
        assertTrue(propDef.isRequired());

        // make sure our test infrastruction setup the input properties correctly
        Configuration config = project.getConfiguration();
        assertEquals(config.getProperties().size(), 1, String.valueOf(config.getProperties()));
        assertEquals(config.getSimpleValue("listener.port", null), "10000", String.valueOf(config.getProperties()));

        String preinstallTargetExecuted = (String) project.getProperties().get("preinstallTargetExecuted");
        assertEquals(preinstallTargetExecuted, "1a");
        String postinstallTargetExecuted = (String) project.getProperties().get("postinstallTargetExecuted");
        assertEquals(postinstallTargetExecuted, "1b");
View Full Code Here

        assertEquals(propDef.getDefaultValue(), "9090");
        assertEquals(propDef.getDescription(), "This is where the product will listen for incoming messages");
        assertTrue(propDef.isRequired());

        // make sure our test infrastruction setup the input properties correctly
        Configuration config = project.getConfiguration();
        assertEquals(config.getProperties().size(), 1);
        assertEquals(config.getSimpleValue("listener.port", null), "20000", String.valueOf(config.getProperties()));

        String preinstallTargetExecuted = (String) project.getProperties().get("preinstallTargetExecuted");
        assertEquals(preinstallTargetExecuted, "2a");
        String postinstallTargetExecuted = (String) project.getProperties().get("postinstallTargetExecuted");
        assertEquals(postinstallTargetExecuted, "2b");
View Full Code Here

        assertEquals(propDef.getDefaultValue(), "9090");
        assertEquals(propDef.getDescription(), "This is where the product will listen for incoming messages");
        assertTrue(propDef.isRequired());

        // make sure our test infrastruction setup the input properties correctly
        Configuration config = project.getConfiguration();
        assertEquals(config.getProperties().size(), 1);
        assertEquals(config.getSimpleValue("listener.port", null), "20000", String.valueOf(config.getProperties()));

        String preinstallTargetExecuted = (String) project.getProperties().get("preinstallTargetExecuted");
        assertEquals(preinstallTargetExecuted, "2a");
        String postinstallTargetExecuted = (String) project.getProperties().get("postinstallTargetExecuted");
        assertEquals(postinstallTargetExecuted, "2b");
View Full Code Here

        assertNull(project.getBundleDescription());

        // while we are here, let's see that we have 0 config props
        ConfigurationDefinition configDef = project.getConfigurationDefinition();
        assertEquals(configDef.getPropertyDefinitions().size(), 0, String.valueOf(configDef.getPropertyDefinitions()));
        Configuration config = project.getConfiguration();
        assertEquals(config.getProperties().size(), 0, String.valueOf(config.getProperties()));

        if (!dryRun) {
            assertTrue(new File(DEPLOY_DIR, "file.zip").exists(), "should be here, we told it to stay compressed");
        } else {
            assertFalse(new File(DEPLOY_DIR, "file.zip").exists(), "dry run - should not be here");
View Full Code Here

TOP

Related Classes of org.rhq.core.domain.configuration.Configuration$Builder$MapInList

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.