Package org.rhq.core.pc

Examples of org.rhq.core.pc.ServerServices


        RhqAgentPluginContainer rpc = rhqAgentPluginContainer.get();
        if (rpc == null) {
            throw new RuntimeException("To inject a ServerServices object, at least one RhqAgentPluginContainer must be configured.");
        }

        ServerServices serverServices = rpc.getConfiguration().getServerServices();
        if (serverServices == null) {
            throw new RuntimeException("To inject a ServerServices object, the \"serverServicesImplementationClassName\" property must be set in the container's configuration.");
        }

        return serverServices;
View Full Code Here


     * Returns the server service implementation used to notify of a task completion.
     *
     * @return server service if one is registered; <code>null</code> otherwise
     */
    ResourceFactoryServerService getServerService() {
        ServerServices serverServices = configuration.getServerServices();
        if (serverServices == null) {
            return null;
        }

        ResourceFactoryServerService resourceFactoryServerService = serverServices.getResourceFactoryServerService();
        return resourceFactoryServerService;
    }
View Full Code Here

     *
     * @return server service implementation if one is registered; <code>null</code> otherwise
     */
    ContentServerService getContentServerService() {
        ContentServerService serverService = null;
        ServerServices serverServices = configuration.getServerServices();
        if (serverServices != null) {
            serverService = serverServices.getContentServerService();
        }
        return serverService;
    }
View Full Code Here

    private static final String BUNDLE_CONFIG_LOCATION_RC = getPath("/resourceconfig/base/dir");
    private static final String BUNDLE_CONFIG_LOCATION_MT = getPath("/trait/base/dir");

    @BeforeMethod
    public void beforeMethod() {
        ServerServices serverServices = new ServerServices();
        serverServices.setBundleServerService(new MockBundleServerService());

        PluginLifecycleListenerManager pluginLifecycleListenerManager = new PluginLifecycleListenerManagerImpl();
        pcConfig = new PluginContainerConfiguration();
        pcConfig.setStartManagementBean(false);
        pcConfig.setServerServices(serverServices);
View Full Code Here

        conf.setEventSenderInitialDelay(Long.MAX_VALUE);
        conf.setMeasurementCollectionInitialDelay(Long.MAX_VALUE);
        conf.setServerDiscoveryInitialDelay(Long.MAX_VALUE);
        conf.setServiceDiscoveryInitialDelay(Long.MAX_VALUE);

        ServerServices serverServices = new ServerServices();
        serverServices.setBundleServerService(context.mock(BundleServerService.class));
        serverServices.setConfigurationServerService(context.mock(ConfigurationServerService.class));
        serverServices.setContentServerService(context.mock(ContentServerService.class));
        serverServices.setCoreServerService(context.mock(CoreServerService.class));
        serverServices.setDiscoveryServerService(context.mock(DiscoveryServerService.class));
        serverServices.setEventServerService(context.mock(EventServerService.class));
        serverServices.setMeasurementServerService(context.mock(MeasurementServerService.class));
        serverServices.setOperationServerService(context.mock(OperationServerService.class));
        serverServices.setResourceFactoryServerService(context.mock(ResourceFactoryServerService.class));
        serverServices.setDriftServerService(context.mock(DriftServerService.class));

        conf.setServerServices(serverServices);

        return conf;
    }
View Full Code Here

        return this;
    }

    @SuppressWarnings("unchecked")
    public void addDefaultExpectations(Expectations expectations) throws Exception {
        ServerServices ss = PluginContainerTest.getCurrentPluginContainerConfiguration().getServerServices();

        //only import the apache servers we actually care about - we can't assume another apache won't be present
        //on the machine running the test...
        final ResourceType serverResourceType = apacheResourceTypes.findByName("Apache HTTP Server");
        expectations.allowing(ss.getDiscoveryServerService()).mergeInventoryReport(
            expectations.with(Expectations.any(InventoryReport.class)));
        expectations.will(fakeInventory.mergeInventoryReport(new FakeServerInventory.InventoryStatusJudge() {
            @Override
            public InventoryStatus judge(Resource resource) {
                if (serverResourceType.equals(resource.getResourceType())) {
                    return deploymentConfig.serverRoot.equals(resource.getPluginConfiguration().getSimpleValue(
                        ApacheServerComponent.PLUGIN_CONFIG_PROP_SERVER_ROOT)) ? InventoryStatus.COMMITTED
                        : InventoryStatus.IGNORED;
                } else {
                    return InventoryStatus.COMMITTED;
                }
            }
        }));

        expectations.allowing(ss.getDiscoveryServerService()).getResourceSyncInfo(
            expectations.with(Expectations.any(Integer.class)));
        expectations.will(fakeInventory.getResourceSyncInfo());

        expectations.allowing(ss.getDiscoveryServerService()).upgradeResources(
            expectations.with(Expectations.any(Set.class)));
        expectations.will(fakeInventory.upgradeResources());

        expectations.allowing(ss.getDiscoveryServerService()).getResources(
            expectations.with(Expectations.any(Set.class)), expectations.with(Expectations.any(boolean.class)));
        expectations.will(fakeInventory.getResources());

        expectations.allowing(ss.getDiscoveryServerService()).setResourceError(expectations.with(Expectations.any(ResourceError.class)));
        expectations.will(fakeInventory.setResourceError());

        expectations.allowing(ss.getDiscoveryServerService()).mergeAvailabilityReport(
            expectations.with(Expectations.any(AvailabilityReport.class)));

        expectations.allowing(ss.getDiscoveryServerService()).postProcessNewlyCommittedResources(
            expectations.with(Expectations.any(Set.class)));

        expectations.allowing(ss.getDiscoveryServerService()).clearResourceConfigError(
            expectations.with(Expectations.any(int.class)));

        expectations.allowing(ss.getDiscoveryServerService()).setResourceEnablement(
            expectations.with(Expectations.any(int.class)), expectations.with(Expectations.any(boolean.class)));

        expectations.allowing(ss.getDiscoveryServerService()).updateResourceVersion(
            expectations.with(Expectations.any(int.class)), expectations.with(Expectations.any(String.class)));

        expectations.allowing(ss.getDriftServerService()).getDriftDefinitions(expectations.with(Expectations.any(Set.class)));
        expectations.will(Expectations.returnValue(Collections.emptyMap()));

        expectations.allowing(ss.getDiscoveryServerService()).getResourcesAsList(expectations.with(Expectations.any(Integer[].class)));
        expectations.will(fakeInventory.getResourcesAsList());

        expectations.ignoring(ss.getBundleServerService());
        expectations.ignoring(ss.getConfigurationServerService());
        expectations.ignoring(ss.getContentServerService());
        expectations.ignoring(ss.getCoreServerService());
        expectations.ignoring(ss.getEventServerService());
        expectations.ignoring(ss.getMeasurementServerService());
        expectations.ignoring(ss.getOperationServerService());
        expectations.ignoring(ss.getResourceFactoryServerService());
    }
View Full Code Here

    public void testReadingConfigurationsDoesNotLeakAugeasReferences(final String installDir, final String exePath,
        int configurationReadingInvocationCount) throws Exception {
        final FakeServerInventory fakeInventory = new FakeServerInventory();
        PluginContainerTest.getCurrentMockContext().checking(new Expectations() {
            {
                ServerServices ss = PluginContainerTest.getCurrentPluginContainerConfiguration().getServerServices();

                allowing(ss.getDiscoveryServerService()).mergeInventoryReport(with(any(InventoryReport.class)));
                will(fakeInventory.mergeInventoryReport(InventoryStatus.COMMITTED));

                allowing(ss.getDiscoveryServerService()).getResources(with(any(Set.class)), with(any(boolean.class)));
                will(fakeInventory.getResources());

                allowing(ss.getDiscoveryServerService()).mergeAvailabilityReport(with(any(AvailabilityReport.class)));
                allowing(ss.getDiscoveryServerService()).postProcessNewlyCommittedResources(with(any(Set.class)));

                allowing(ss.getDiscoveryServerService()).setResourceEnablement(with(any(int.class)),
                    with(any(boolean.class)));

                ignoring(ss.getBundleServerService());
                ignoring(ss.getConfigurationServerService());
                ignoring(ss.getContentServerService());
                ignoring(ss.getCoreServerService());
                ignoring(ss.getEventServerService());
                ignoring(ss.getMeasurementServerService());
                ignoring(ss.getOperationServerService());
                ignoring(ss.getResourceFactoryServerService());
            }
        });

        boolean apacheStarted = false;
        try {
View Full Code Here

*/
public abstract class ResourceUpgradeTestBase extends PluginContainerTest {

    @SuppressWarnings("unchecked")
    protected void defineDefaultExpectations(FakeServerInventory inventory, Expectations expectations) {
        ServerServices ss = pluginContainerConfiguration.getServerServices();
       
        expectations.ignoring(ss.getBundleServerService());
        expectations.ignoring(ss.getConfigurationServerService());
        expectations.ignoring(ss.getContentServerService());
        expectations.ignoring(ss.getCoreServerService());
        expectations.ignoring(ss.getDriftServerService());
        expectations.ignoring(ss.getEventServerService());
        expectations.ignoring(ss.getMeasurementServerService());
        expectations.ignoring(ss.getOperationServerService());
        expectations.ignoring(ss.getResourceFactoryServerService());

        //just ignore these invocations if we get a availability scan in the PC...
        expectations.allowing(ss.getDiscoveryServerService()).mergeAvailabilityReport(
            expectations.with(Expectations.any(AvailabilityReport.class)));

        expectations.allowing(ss.getDiscoveryServerService()).getResources(
            expectations.with(Expectations.any(Set.class)), expectations.with(Expectations.any(boolean.class)));
        expectations.will(inventory.getResources());

        expectations.allowing(ss.getDiscoveryServerService()).postProcessNewlyCommittedResources(
            expectations.with(Expectations.any(Set.class)));
    }
View Full Code Here

    @SuppressWarnings("unchecked")
    protected void defineDefaultExpectations(FakeServerInventory inventory, Expectations expectations) {
        super.defineDefaultExpectations(inventory, expectations);
        try {
            ServerServices ss = pluginContainerConfiguration.getServerServices();
            expectations.allowing(ss.getDiscoveryServerService()).mergeInventoryReport(
                expectations.with(Expectations.any(InventoryReport.class)));
            expectations.will(inventory.mergeInventoryReport(InventoryStatus.COMMITTED));

            expectations.allowing(ss.getDiscoveryServerService()).getResourceSyncInfo(
                expectations.with(Expectations.any(Integer.class)));
            expectations.will(inventory.getResourceSyncInfo());

            expectations.allowing(ss.getDiscoveryServerService()).upgradeResources(
                expectations.with(Expectations.any(Set.class)));
            expectations.will(inventory.upgradeResources());
        } catch (InvalidInventoryReportException e) {
            //this is not going to happen because we're mocking the invocation
        }
View Full Code Here

    @PluginContainerSetup(plugins = { PLUGIN_V2_FILENAME }, sharedGroup = INCLUDE_UNCOMMITTED_RESOURCES_TEST, clearInventoryDat = false)
    @SuppressWarnings("unchecked")
    public void testIncludeUncommittedResources_V2() throws Exception {
        final FakeServerInventory inv = (FakeServerInventory) PluginContainerTest
            .getServerSideFake(INCLUDE_UNCOMMITTED_RESOURCES_TEST);
        final ServerServices ss = PluginContainerTest.getCurrentPluginContainerConfiguration().getServerServices();

        PluginContainerTest.getCurrentMockContext().checking(new Expectations() {
            {
                defineDefaultExpectations(inv, this);

                allowing(ss.getDiscoveryServerService()).mergeInventoryReport(with(any(InventoryReport.class)));
                will(inv.mergeInventoryReport(InventoryStatus.COMMITTED));

                allowing(ss.getDiscoveryServerService()).getResourceSyncInfo(with(any(Integer.class)));
                will(inv.getResourceSyncInfo());

                oneOf(ss.getDiscoveryServerService()).upgradeResources(with(any(Set.class)));
                will(inv.upgradeResources());
            }
        });

        PluginContainerTest.startConfiguredPluginContainer();
View Full Code Here

TOP

Related Classes of org.rhq.core.pc.ServerServices

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.