Package org.rhq.core.pc

Examples of org.rhq.core.pc.ServerServices


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

        inv.setFailing(true);

        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());

                never(ss.getDiscoveryServerService()).upgradeResources(with(any(Set.class)));
            }
        });

        PluginContainerTest.startConfiguredPluginContainer();
View Full Code Here


    @SuppressWarnings("unchecked")
    public void testUpgradeWithPlatformDeletedOnServer_V2() throws Exception {

        final FakeServerInventory inv = (FakeServerInventory) PluginContainerTest
            .getServerSideFake(UPGRADE_WITH_PLATFORM_DELETED_ON_SERVER_TEST);
        final ServerServices ss = PluginContainerTest.getCurrentPluginContainerConfiguration().getServerServices();

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

                //the first merge will be triggered from within the upgrade process and we are
                //going to report null sync.
                oneOf(ss.getDiscoveryServerService()).mergeInventoryReport(with(any(InventoryReport.class)));
                will(inv.clearPlatform());

                //the rest of the inventory merges are executed by discoveries, so let's import the
                //discovered stuff into the server-side inventory.
                allowing(ss.getDiscoveryServerService()).mergeInventoryReport(with(any(InventoryReport.class)));
                will(inv.mergeInventoryReport(InventoryStatus.COMMITTED));

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

                never(ss.getDiscoveryServerService()).upgradeResources(with(any(Set.class)));
            }
        });

        PluginContainerTest.startConfiguredPluginContainer();
View Full Code Here

    @PluginContainerSetup(plugins = FAILING_PLUGIN_FILE_NAME, sharedGroup = UPGRADE_FAILURE_HANDLING, clearInventoryDat = false)
    @SuppressWarnings("unchecked")
    public void testUpgradeFailureHandling_V2() throws Exception {
        final FakeServerInventory inv = (FakeServerInventory) PluginContainerTest
            .getServerSideFake(UPGRADE_FAILURE_HANDLING);
        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

    private FakeServerInventory initialSyncAndDiscovery(String key, final InventoryStatus requiredInventoryStatus)
        throws Exception {
        final FakeServerInventory inv = new FakeServerInventory();
        PluginContainerTest.setServerSideFake(key, inv);
        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(requiredInventoryStatus));

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

        PluginContainerTest.startConfiguredPluginContainer();
View Full Code Here

    }

    @SuppressWarnings("unchecked")
    private void upgradeTest(String key) throws Exception {
        final FakeServerInventory serverInventory = (FakeServerInventory) PluginContainerTest.getServerSideFake(key);
        final ServerServices ss = PluginContainerTest.getCurrentPluginContainerConfiguration().getServerServices();

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

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

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

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

        PluginContainerTest.startConfiguredPluginContainer();
View Full Code Here

                public MergeResourceResponse answer(InvocationOnMock invocation) throws Throwable {
                    return new MergeResourceResponse(resourceIdGenerator.decrementAndGet(), System.currentTimeMillis(),
                        false);
                }
            });
        ServerServices serverServices = new ServerServices();
        serverServices.setDiscoveryServerService(discoveryServerService);
        containerConfig.setServerServices(serverServices);
        pluginContainer = PluginContainer.getInstance();
        pluginContainer.setConfiguration(containerConfig);
        pluginContainer.initialize();
        inventoryManager = pluginContainer.getInventoryManager();
View Full Code Here

                public MergeResourceResponse answer(InvocationOnMock invocation) throws Throwable {
                    return new MergeResourceResponse(resourceIdGenerator.decrementAndGet(), System.currentTimeMillis(),
                        false);
                }
            });
        ServerServices serverServices = new ServerServices();
        serverServices.setDiscoveryServerService(discoveryServerService);
        containerConfig.setServerServices(serverServices);
        pluginContainer = PluginContainer.getInstance();
        pluginContainer.setConfiguration(containerConfig);
        pluginContainer.initialize();
        inventoryManager = pluginContainer.getInventoryManager();
View Full Code Here

        PluginContainerConfiguration config = new PluginContainerConfiguration();
        config.setPluginFinder(new FileSystemPluginFinder(pluginDir));
        config.setPluginDirectory(pluginDir);

        ServerServices services = new ServerServices();
        OperationServerServiceImpl callbackListener = new OperationServerServiceImpl();
        callbackListener.setHistoryBean(historyManager);

        services.setOperationServerService(callbackListener);
        config.setServerServices(services);

        PluginContainer container = PluginContainer.getInstance();
        container.setConfiguration(config);
View Full Code Here

        PluginContainerConfiguration config = new PluginContainerConfiguration();
        config.setPluginFinder(createPluginFinder());
        setPluginContainerDataDirectory(config);
        config.setTemporaryDirectory(initTempDir());
        config.setContentDiscoveryPeriod(0);
        ServerServices services = new ServerServices();

        // Create operation listener
        OperationServerServiceImpl callbackListener = new OperationServerServiceImpl();
        callbackListener.setHistoryBean(this.historyManager);

        // Create content listener
        ContentServerServiceImpl contentListener = new ContentServerServiceImpl();
        contentListener.setHistoryBean(this.contentHistoryManager);

        // Add listeners to ServerServices
        services.setOperationServerService(callbackListener);
        services.setContentServerService(contentListener);
        config.setServerServices(services);
        return config;
    }
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.