Examples of PluginContainerConfiguration


Examples of org.rhq.core.pc.PluginContainerConfiguration

        verifyThatPluginsAreLoaded(pluginMgr);
    }

    @Test
    public void pluginsShouldBeLoadedInCorrectOrder() throws Exception {
        PluginContainerConfiguration configuration = createConfiguration();

        FakePluginLifecycleListenerManager pluginLifecycleListenerMgr = new FakePluginLifecycleListenerManager();

        PluginManager pluginMgr = new PluginManager(configuration, pluginLifecycleListenerMgr);
View Full Code Here

Examples of org.rhq.core.pc.PluginContainerConfiguration

        verifyPluginsLoadedInCorrectOrder(pluginLifecycleListenerMgr);
    }

    @Test
    public void pluginsShouldBeShutdownInCorrectOrder() throws Exception {
        PluginContainerConfiguration configuration = createConfiguration();

        FakePluginLifecycleListenerManager pluginLifecycleListenerMgr = new FakePluginLifecycleListenerManager();

        PluginManager pluginMgr = new PluginManager(configuration, pluginLifecycleListenerMgr);
        pluginMgr.shutdown();
View Full Code Here

Examples of org.rhq.core.pc.PluginContainerConfiguration

        verifyPluginsShutdownInCorrectOrder(pluginLifecycleListenerMgr);
    }

    private PluginContainerConfiguration createConfiguration() {
        PluginContainerConfiguration configuration = new PluginContainerConfiguration();
        configuration.setPluginFinder(new PluginFinder() {
            public Collection<URL> findPlugins() {
                List<URL> pluginURLs = new ArrayList<URL>();
                pluginURLs.add(getClass().getResource(PLUGIN_A));
                pluginURLs.add(getClass().getResource(PLUGIN_B));
                pluginURLs.add(getClass().getResource(PLUGIN_C));
View Full Code Here

Examples of org.rhq.core.pc.PluginContainerConfiguration

        // Now we need to build our plugin container configuration.
        // All static configuration settings are retrieved directly from the agent configuration object,
        // but we also have to build our dynamic runtime objects that are also part of the PC config (which
        // includes things like the plugin finder object and the remoted services).
        PluginContainerConfiguration pc_config = m_configuration.getPluginContainerConfiguration();
        pc_config.setPluginFinder(new FileSystemPluginFinder(pc_config.getPluginDirectory()));

        try {
            LOG.debug(AgentI18NResourceKeys.CREATING_PLUGIN_CONTAINER_SERVER_SERVICES);

            //make the service container understand the requests for plugin container lifecycle events.
            getServiceContainer().addRemotePojo(new PluginContainerLifecycleListener(this),
                PluginContainerLifecycle.class);

            // Get remote pojo's for server access and make them accessible in the configuration object
            ClientRemotePojoFactory factory = m_clientSender.getClientRemotePojoFactory();
            CoreServerService coreServerService = factory.getRemotePojo(CoreServerService.class);
            DiscoveryServerService discoveryServerService = factory.getRemotePojo(DiscoveryServerService.class);
            MeasurementServerService measurementServerService = factory.getRemotePojo(MeasurementServerService.class);
            OperationServerService operationServerService = factory.getRemotePojo(OperationServerService.class);
            ConfigurationServerService configurationServerService = factory
                .getRemotePojo(ConfigurationServerService.class);
            ResourceFactoryServerService resourceFactoryServerSerfice = factory
                .getRemotePojo(ResourceFactoryServerService.class);
            ContentServerService contentServerService = factory.getRemotePojo(ContentServerService.class);
            EventServerService eventServerService = factory.getRemotePojo(EventServerService.class);
            BundleServerService bundleServerService = factory.getRemotePojo(BundleServerService.class);
            DriftServerService driftServerService = factory.getRemotePojo(DriftServerService.class);

            ServerServices serverServices = new ServerServices();
            serverServices.setCoreServerService(coreServerService);
            serverServices.setDiscoveryServerService(discoveryServerService);
            serverServices.setMeasurementServerService(measurementServerService);
            serverServices.setOperationServerService(operationServerService);
            serverServices.setConfigurationServerService(configurationServerService);
            serverServices.setResourceFactoryServerService(resourceFactoryServerSerfice);
            serverServices.setContentServerService(contentServerService);
            serverServices.setEventServerService(eventServerService);
            serverServices.setBundleServerService(bundleServerService);
            serverServices.setDriftServerService(driftServerService);

            pc_config.setServerServices(serverServices);
        } catch (Exception e) {
            LOG.error(e, AgentI18NResourceKeys.FAILED_TO_CREATE_PLUGIN_CONTAINER_SERVER_SERVICES, e);
            return false;
        }

        File plugin_dir = pc_config.getPluginDirectory();

        // we block until we get our plugins - there is no sense continuing until we have plugins
        // there may be instances, though, where we don't want to block (in unit tests for example)
        // so allow this to be configurable via the "update plugins at startup" flag.
        m_pluginUpdate = new PluginUpdate(pc_config.getServerServices().getCoreServerService(), pc_config);
        if (m_configuration.isUpdatePluginsAtStartupEnabled()) {
            LOG.info(AgentI18NResourceKeys.WAITING_FOR_PLUGINS_WITH_DIR, plugin_dir);
            getOut().println(MSG.getMsg(AgentI18NResourceKeys.WAITING_FOR_PLUGINS));
            for (;;) {
                try {
View Full Code Here

Examples of org.rhq.core.pc.PluginContainerConfiguration

        AgentMain agent = m_agentTest.createAgent(false);
        assert !agent.isStarted() : "The agent should not have been started";
        assert agent.getConfiguration() != null : "Configuration should be available";

        PluginContainerConfiguration plugin_config = agent.getConfiguration().getPluginContainerConfiguration();
        assert plugin_config != null;
        assert plugin_config.getServerDiscoveryPeriod() == 5555;
        assert plugin_config.getServerDiscoveryInitialDelay() == 11;
        assert plugin_config.getServiceDiscoveryPeriod() == 4444;
        assert plugin_config.getServiceDiscoveryInitialDelay() == 12;
        assert plugin_config.getAvailabilityScanPeriod() == 3333;
        assert plugin_config.getAvailabilityScanInitialDelay() == 13;
        assert plugin_config.getMeasurementCollectionInitialDelay() == 14;
        assert plugin_config.getMeasurementCollectionThreadPoolSize() == 3;
        assert plugin_config.getOperationInvokerThreadPoolSize() == 2;

        return;
    }
View Full Code Here

Examples of org.rhq.core.pc.PluginContainerConfiguration

            System.exit(1);
        }
    }

    public static boolean validatePlugins(PluginFinder finder) {
        PluginContainerConfiguration configuration = new PluginContainerConfiguration();
        configuration.setPluginFinder(finder);
        configuration.setTemporaryDirectory(new File(System.getProperty("java.io.tmpdir")));
        configuration.setDataDirectory(new File(System.getProperty("java.io.tmpdir")));

        PluginManager manager = new PluginManager(configuration, new PluginLifecycleListenerManagerImpl());

        boolean success = true; // assume all goes well; we'll set this to false if we hit any error
View Full Code Here

Examples of org.rhq.core.pc.PluginContainerConfiguration

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

        PluginLifecycleListenerManager pluginLifecycleListenerManager = new PluginLifecycleListenerManagerImpl();
        pcConfig = new PluginContainerConfiguration();
        pcConfig.setStartManagementBean(false);
        pcConfig.setServerServices(serverServices);
        ResourceContainer.initialize(pcConfig);
        pluginManager = new PluginManager(pcConfig, pluginLifecycleListenerManager);
        im = new MockInventoryManager();
View Full Code Here

Examples of org.rhq.core.pc.PluginContainerConfiguration

public class ResourceContainerTest {
    private static final Log LOG = LogFactory.getLog(ResourceContainerTest.class);

    @BeforeClass
    protected void beforeClass() {
        PluginContainerConfiguration config = new PluginContainerConfiguration();
        File dataDir = new File("target/PluginContainerTest");
        dataDir.mkdirs();
        config.setDataDirectory(dataDir);
        PluginContainer pc = PluginContainer.getInstance();
        pc.setConfiguration(config);
        pc.initialize();
    }
View Full Code Here

Examples of org.rhq.core.pc.PluginContainerConfiguration

    @BeforeSuite
    public void start() {
        try {
            File pluginDir = new File("target/testsetup/plugins");
            PluginContainerConfiguration pcConfig = new PluginContainerConfiguration();
            pcConfig.setPluginFinder(new FileSystemPluginFinder(pluginDir));
            pcConfig.setPluginDirectory(pluginDir);

            pcConfig.setInsideAgent(false);
            PluginContainer.getInstance().setConfiguration(pcConfig);
            PluginContainer.getInstance().initialize();
            log.info("PC started.");
            for (String plugin : PluginContainer.getInstance().getPluginManager().getMetadataManager().getPluginNames()) {
                log.info("...Loaded plugin: " + plugin);
View Full Code Here

Examples of org.rhq.core.pc.PluginContainerConfiguration

        // then it fails. It appears our arquillian test infrastructure is shutting down the PC / ResourceContainer
        // but the ResourceContainer is not getting reinitialized by the time this test class needs it. What then
        // happens is the avail thread pool in ResourceContainer is shutdown and will not accept any more tasks, causing failures.
        // We should try to figure out why the Arquillian infrastructure is doing this, but for now, to get tests
        // passing again, this one-line fix needs to be here.
        ResourceContainer.initialize(new PluginContainerConfiguration());
    }
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.