Examples of ConfigurationUpdateResponse


Examples of org.rhq.core.clientapi.server.configuration.ConfigurationUpdateResponse

            if (resourceUnderTest.getResourceType().getResourceConfigurationDefinition() != null) {
                Configuration configUnderTest = configManager.loadResourceConfiguration(resourceUnderTest.getId());

                ConfigurationUpdateRequest updateRequest = new ConfigurationUpdateRequest(1, configUnderTest,
                    resourceUnderTest.getId());
                ConfigurationUpdateResponse updateResponse = configManager
                    .executeUpdateResourceConfigurationImmediately(updateRequest);

                if (updateResponse == null) {
                    errorCount++;
                    log.error("------------------------------");
                    log.error(resourceUnderTest);
                    log.error("Update Response is NULL!!!!");
                    log.error("------------------------------\n");
                }
                if (updateResponse.getErrorMessage() != null) {
                    errorCount++;
                    log.error("------------------------------");
                    log.error(resourceUnderTest);
                    log.error(updateResponse.getErrorMessage());
                    log.error("------------------------------\n");
                }
            }
        }
View Full Code Here

Examples of org.rhq.core.clientapi.server.configuration.ConfigurationUpdateResponse

                    try {
                        PropertySimple mysleep = request.getConfiguration().getSimple("mysleep");
                        PropertySimple mybool = request.getConfiguration().getSimple("myboolean");
                        assert mybool != null;

                        ConfigurationUpdateResponse response;

                        if (mybool.getStringValue().equalsIgnoreCase("true")) {
                            savedConfiguration = request.getConfiguration();

                            // tests need us to sleep AFTER we save the config
                            if (mysleep != null) {
                                Thread.sleep(mysleep.getLongValue());
                            }

                            response = new ConfigurationUpdateResponse(request.getConfigurationUpdateId(), null,
                                ConfigurationUpdateStatus.SUCCESS, null);
                        } else if (mybool.getStringValue().equalsIgnoreCase("false")) {
                            savedConfiguration = request.getConfiguration();

                            // tests need us to sleep AFTER we save the config
                            if (mysleep != null) {
                                Thread.sleep(mysleep.getLongValue());
                            }

                            response = new ConfigurationUpdateResponse(request.getConfigurationUpdateId(), null,
                                ConfigurationUpdateStatus.SUCCESS, null);
                        } else {
                            mybool.setErrorMessage(ThrowableUtil.getStackAsString(new IllegalArgumentException(
                                "Not a valid boolean")));
                            response = new ConfigurationUpdateResponse(request.getConfigurationUpdateId(),
                                request.getConfiguration(), new NullPointerException("This simulates a failed update"));
                        }

                        LookupUtil.getConfigurationManager().completeResourceConfigurationUpdate(response);
                    } catch (Throwable t) {
View Full Code Here

Examples of org.rhq.core.clientapi.server.configuration.ConfigurationUpdateResponse

        public void updateResourceConfiguration(ConfigurationUpdateRequest request) {
            try {
                synchronized (configs) {
                    configs.put(request.getResourceId(), request.getConfiguration());
                }
                ConfigurationUpdateResponse response = new ConfigurationUpdateResponse(
                    request.getConfigurationUpdateId(), request.getConfiguration(), ConfigurationUpdateStatus.SUCCESS,
                    null);
                // simulate agent calling into the server to complete the update
                ConfigurationServerService server = new ConfigurationServerServiceImpl();
                server.completeConfigurationUpdate(response);
View Full Code Here

Examples of org.rhq.core.clientapi.server.configuration.ConfigurationUpdateResponse

        }
    }

    @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

Examples of org.rhq.core.clientapi.server.configuration.ConfigurationUpdateResponse

        UpdateResourceConfigurationRunner updateRunner = new UpdateResourceConfigurationRunner(configServerService,
            resourceType, configMgmt, updateRequest);
        updateRunner.setConfigUtilService(configUtilityService);

        final ConfigurationUpdateResponse successResponse = new ConfigurationUpdateResponse(configUpdateId, null,
            SUCCESS, null);

        context.checking(new Expectations() {{
            oneOf(configMgmt).executeUpdate(resourceId, config);

            oneOf(configUtilityService).normalizeConfiguration(config, resourceType.getResourceConfigurationDefinition());
            oneOf(configUtilityService).validateConfiguration(config, resourceType.getResourceConfigurationDefinition());

            oneOf(configServerService).completeConfigurationUpdate(with(matchingResponse(successResponse)));
        }});

        ConfigurationUpdateResponse actualResponse = updateRunner.call();

        assertConfigurationUpdateResponseMatches(successResponse, actualResponse, "Expected a success response");
    }
View Full Code Here

Examples of org.rhq.core.clientapi.server.configuration.ConfigurationUpdateResponse

        UpdateResourceConfigurationRunner updateRunner = new UpdateResourceConfigurationRunner(null, resourceType,
            configMgmt, updateRequest);
        updateRunner.setConfigUtilService(configUtilityService);

        final ConfigurationUpdateResponse successResponse = new ConfigurationUpdateResponse(configUpdateId, null,
            SUCCESS, null);

        context.checking(new Expectations() {{
            oneOf(configMgmt).executeUpdate(resourceId, config);

            oneOf(configUtilityService).normalizeConfiguration(config, resourceType.getResourceConfigurationDefinition());
            oneOf(configUtilityService).validateConfiguration(config, resourceType.getResourceConfigurationDefinition());

        }});

        ConfigurationUpdateResponse actualResponse = updateRunner.call();

        assertConfigurationUpdateResponseMatches(successResponse, actualResponse, "Expected a success response");
    }
View Full Code Here

Examples of org.rhq.core.clientapi.server.configuration.ConfigurationUpdateResponse

            resourceType, configMgmt, updateRequest);
        updateRunner.setConfigUtilService(configUtilityService);

        String errorMsg = "Configuration facet did not indicate success or failure - assuming failure.";

        final ConfigurationUpdateResponse failureResponse = new ConfigurationUpdateResponse(configUpdateId, config,
            FAILURE, errorMsg);

        context.checking(new Expectations() {{
            oneOf(configMgmt).executeUpdate(resourceId, config); will(throwException(new UpdateInProgressException()));

            oneOf(configUtilityService).normalizeConfiguration(config, resourceType.getResourceConfigurationDefinition());
            oneOf(configUtilityService).validateConfiguration(config, resourceType.getResourceConfigurationDefinition());

            oneOf(configServerService).completeConfigurationUpdate(with(matchingResponse(failureResponse)));
        }});

        ConfigurationUpdateResponse actualResponse = updateRunner.call();

        assertConfigurationUpdateResponseMatches(failureResponse, actualResponse, "Expected a failure response");
    }
View Full Code Here

Examples of org.rhq.core.clientapi.server.configuration.ConfigurationUpdateResponse

        String errorMsg = "Configuration update failed.";

        final ConfigurationUpdateException exception = new ConfigurationUpdateException(errorMsg);

        final ConfigurationUpdateResponse failureResponse = new ConfigurationUpdateResponse(configUpdateId, config,
            FAILURE, errorMsg);

        context.checking(new Expectations() {{
            oneOf(configMgmt).executeUpdate(resourceId, config); will(throwExceptionFromFacet(exception));

            oneOf(configUtilityService).normalizeConfiguration(config, resourceType.getResourceConfigurationDefinition());
            oneOf(configUtilityService).validateConfiguration(config, resourceType.getResourceConfigurationDefinition());

            oneOf(configServerService).completeConfigurationUpdate(with(matchingResponse(failureResponse)));
        }});

        ConfigurationUpdateResponse actualResponse = updateRunner.call();

        assertConfigurationUpdateResponseMatches(failureResponse, actualResponse, "Expected a failure response");
    }
View Full Code Here

Examples of org.rhq.core.clientapi.server.configuration.ConfigurationUpdateResponse

        String errorMsg = "Configuration update failed.";

        final ConfigurationUpdateException exception = new ConfigurationUpdateException(errorMsg);

        final ConfigurationUpdateResponse failureResponse = new ConfigurationUpdateResponse(configUpdateId, config,
            FAILURE, errorMsg);

        context.checking(new Expectations() {{
            oneOf(configMgmt).executeUpdate(resourceId, config); will(throwExceptionFromFacet(exception));

            oneOf(configUtilityService).normalizeConfiguration(config, resourceType.getResourceConfigurationDefinition());
            oneOf(configUtilityService).validateConfiguration(config, resourceType.getResourceConfigurationDefinition());
        }});

        ConfigurationUpdateResponse actualResponse = updateRunner.call();

        assertConfigurationUpdateResponseMatches(failureResponse, actualResponse, "Expected a failure response");
    }
View Full Code Here

Examples of org.rhq.core.clientapi.server.configuration.ConfigurationUpdateResponse

        UpdateResourceConfigurationRunner updateRunner = new UpdateResourceConfigurationRunner(configServerService,
            resourceType, configMgmt, updateRequest);

        final NullPointerException exception = new NullPointerException("Unexpected error during update");

        final ConfigurationUpdateResponse failureResponse = new ConfigurationUpdateResponse(configUpdateId, config,
            exception);

        context.checking(new Expectations() {{
            oneOf(configMgmt).executeUpdate(resourceId, config); will(throwExceptionFromFacet(exception));

            oneOf(configServerService).completeConfigurationUpdate(with(matchingResponse(failureResponse)));
        }});

        ConfigurationUpdateResponse actualResponse = updateRunner.call();

        assertConfigurationUpdateResponseMatches(failureResponse, actualResponse, "Expected a failure response");
    }
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.