Package org.rhq.core.pluginapi.configuration

Examples of org.rhq.core.pluginapi.configuration.ConfigurationUpdateReport


         report = super.createResource(report);

        // Since our properties are can be added at parent resource creation time, we have to make sure they are added.
        if (report.getStatus() == CreateResourceStatus.SUCCESS) {
            // Now we have to send this as an update, so the properties are created properly
            ConfigurationUpdateReport updateReport = new ConfigurationUpdateReport(report.getResourceConfiguration());
            ConfigurationDefinition configDef = report.getResourceType().getResourceConfigurationDefinition();
            Address address = new Address(getAddress());
            address.add(report.getPluginConfiguration().getSimpleValue("path"),report.getUserSpecifiedResourceName());
            ConfigurationWriteDelegate delegate = new ConfigurationWriteDelegate(configDef, getASConnection(), address);
            delegate.updateResourceConfiguration(updateReport);

            if (updateReport.getStatus() != ConfigurationUpdateStatus.SUCCESS) {
                report.setErrorMessage(updateReport.getErrorMessage());
                report.setStatus(CreateResourceStatus.FAILURE);
            }
        }
        return report;
    }
View Full Code Here


            description.appendText("Updating status of " + ConfigurationUpdateReport.class.getSimpleName() + " to " +
                status);
        }

        public Object invoke(Invocation invocation) throws Throwable {
            ConfigurationUpdateReport report = (ConfigurationUpdateReport) invocation.getParameter(0);
            report.setStatus(status);
            return null;
        }
View Full Code Here

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

        final ConfigurationUpdateReport updateReport = new ConfigurationUpdateReport(config);

        final boolean isDaemonThread = false;

        context.checking(new Expectations() {{
            atLeast(1).of(componentService).getComponent(resourceId,
View Full Code Here

    @Test(expectedExceptions = UpdateInProgressException.class)
    public void exceptionShouldBeThrownWhenUpdateDoesNotComplete() throws Exception {
        final Configuration config = new Configuration();

        final ConfigurationUpdateReport updateReport = new ConfigurationUpdateReport(config);

        final boolean isDaemonThread = false;

        context.checking(new Expectations() {{
            atLeast(1).of(componentService).getComponent(resourceId,
View Full Code Here

    @Test(expectedExceptions = ConfigurationUpdateException.class)
    public void exceptionShouldBeThrownWhenUpdateFails() throws Exception {
        final Configuration config = new Configuration();

        final ConfigurationUpdateReport updateReport = new ConfigurationUpdateReport(config);

        final boolean isDaemonThread = false;

        context.checking(new Expectations() {{
            atLeast(1).of(componentService).getComponent(resourceId,
View Full Code Here

            public void describeTo(Description description) {
                description.appendText("Updates " + ConfigurationUpdateReport.class.getSimpleName() + " to " + status);
            }

            public Object invoke(Invocation invocation) throws Throwable {
                ConfigurationUpdateReport report = (ConfigurationUpdateReport) invocation.getParameter(0);
                report.setStatus(status);
                return null;
            }
        };
    }
View Full Code Here

        System.out.println("=== Updating Resource config for " + resource + "...");
        ResourceContainer resourceContainer = this.pluginContainer.getInventoryManager().getResourceContainer(resource);
        long timeoutMillis = 5000;
        ConfigurationFacet configurationFacet = resourceContainer.createResourceComponentProxy(
            ConfigurationFacet.class, FacetLockType.WRITE, timeoutMillis, false, false, false);
        ConfigurationUpdateReport report = new ConfigurationUpdateReport(resourceConfig);
        configurationFacet.updateResourceConfiguration(report);
        return report;
    }
View Full Code Here

    }

    public void executeUpdate(int resourceId, Configuration configuration)
        throws PluginContainerException {
        ConfigurationFacet facet = loadConfigurationFacet(resourceId, WRITE);
        ConfigurationUpdateReport report = new ConfigurationUpdateReport(configuration);

        facet.updateResourceConfiguration(report);

        if (ConfigurationUpdateStatus.SUCCESS == report.getStatus()) {
            return;
        }

        if (ConfigurationUpdateStatus.INPROGRESS == report.getStatus()) {
            throw new UpdateInProgressException();
        }

        if (ConfigurationUpdateStatus.FAILURE == report.getStatus()) {
            throw new ConfigurationUpdateException(report.getErrorMessage());
        }
    }
View Full Code Here

        when(mockConfiguration.get(eq("__type"))).thenReturn(mockProperty);

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

        ConfigurationUpdateReport mockReport = mock(ConfigurationUpdateReport.class);
        when(mockReport.getConfiguration()).thenReturn(mockConfiguration);

        ConfigurationWriteDelegate mockConfigurationWriteDelegate = mock(ConfigurationWriteDelegate.class);
        PowerMockito.whenNew(ConfigurationWriteDelegate.class)
            .withParameterTypes(ConfigurationDefinition.class, ASConnection.class, Address.class)
            .withArguments(any(ConfigurationDefinition.class), any(ASConnection.class), any(Address.class))
View Full Code Here

        when(mockConfiguration.get(eq("__name"))).thenReturn(mockProperty);

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

        ConfigurationUpdateReport mockReport = mock(ConfigurationUpdateReport.class);
        when(mockReport.getConfiguration()).thenReturn(mockConfiguration);

        ConfigurationWriteDelegate mockConfigurationWriteDelegate = mock(ConfigurationWriteDelegate.class);
        PowerMockito.whenNew(ConfigurationWriteDelegate.class)
            .withParameterTypes(ConfigurationDefinition.class, ASConnection.class, Address.class)
            .withArguments(any(ConfigurationDefinition.class), any(ASConnection.class), any(Address.class))
View Full Code Here

TOP

Related Classes of org.rhq.core.pluginapi.configuration.ConfigurationUpdateReport

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.