Package org.rhq.core.pc

Examples of org.rhq.core.pc.PluginContainer


    public void testDump()
            throws Exception
    {
        LOG.info("########################  Running testDump()");
        PluginContainer pc = PluginContainer.getInstance();
        ConfigurationAgentService configService = pc.getConfigurationAgentService();

        Resource platform = discoverPlatform();

        LOG.info("Loaded Servers");
        for (Resource server : platform.getChildResources())
View Full Code Here


    public void testConfigurationDefinition()
            throws Exception
    {
        LOG.info("########################  Running testConfigurationDefinition()");
        PluginContainer pluginContainer = PluginContainer.getInstance();
        PluginMetadataManager metadataManager = pluginContainer.getPluginManager().getMetadataManager();
        ResourceType noTxDatasourceResourceType =
                metadataManager.getType("No Transaction", ResourceCategory.SERVICE);


        ConfigurationDefinition noTxConfigurationDefinition = noTxDatasourceResourceType.getResourceConfigurationDefinition();
View Full Code Here

        Resource platform = discoverPlatform();
        // This only tests a datasource, will need to test other service types
        Resource defaultDs = findService("DefaultDS", SERVER_NAME, platform);


        PluginContainer pc = PluginContainer.getInstance();
        ConfigurationAgentService configService = pc.getConfigurationAgentService();

        Configuration configuration = configService.loadResourceConfiguration(defaultDs.getId());

        assert configuration != null : "Configuration for DefaultDS was null";
View Full Code Here

        // Not sure how well this actually works, cannot see the change
        // .being made into the DefaultDS.xml file
        Resource platform = discoverPlatform();
        Resource defaultDs = findService("DefaultDS", SERVER_NAME, platform);

        PluginContainer pc = PluginContainer.getInstance();
        ConfigurationAgentService configService = pc.getConfigurationAgentService();

        Configuration configuration = configService.loadResourceConfiguration(defaultDs.getId());

        // Sanity check, to make sure jndi name is as we expect it
        assert configuration != null : "Configuration for Default DS was null";
View Full Code Here

    {
        Resource platform = discoverPlatform();
        Resource defaultDS = findService("DefaultDS", SERVER_NAME, platform);
        String operationName = "flush";

        PluginContainer pc = PluginContainer.getInstance();
        OperationAgentService operationAgentService = pc.getOperationAgentService();
        operationAgentService.invokeOperation("1", defaultDS.getId(), operationName, null);
    }
View Full Code Here

            throws Exception
    {
        Resource platform = discoverPlatform();
        Resource defaultDS = findService("DefaultDS", SERVER_NAME, platform);

        PluginContainer pc = PluginContainer.getInstance();
        Set<MeasurementDefinition> definitions = defaultDS.getResourceType().getMetricDefinitions();

        List<MeasurementDataRequest> requests = new ArrayList<MeasurementDataRequest>();
        for (MeasurementDefinition definition : definitions) {
            requests.add(new MeasurementDataRequest(definition));
        }
        Set<MeasurementData> data = pc.getMeasurementAgentService().getRealTimeMeasurementValue(defaultDS.getId(),
            requests);
        assert data.size() > 0 : "We should be getting some kind of measurement data back";
    }
View Full Code Here

    // Private  --------------------------------------------

    private Resource discoverPlatform()
            throws Exception
    {
        PluginContainer pc = PluginContainer.getInstance();

        DiscoveryAgentService discovery = pc.getDiscoveryAgentService();

        discovery.executeServerScanImmediately();
        discovery.executeServiceScanImmediately();

        return discovery.getPlatform();
View Full Code Here

    private void createDatasource(String dsName, String min, String max)
            throws Exception
    {
        LOG.info("########################  Running testCreateService()");
        PluginContainer pc = PluginContainer.getInstance();
        ResourceFactoryAgentService resourceFactoryAgentService = pc.getResourceFactoryAgentService();

        Resource platform = discoverPlatform();
        // There should only be one server.
        Resource as5Server = findServer(SERVER_NAME, platform);
        ResourceType dsType =
                pc.getPluginManager().getMetadataManager().getType("Local Transaction", ResourceCategory.SERVICE);

        //Puts a String, Long String, Integer, Boolean, and Map into the DS config
        Configuration config = new Configuration();
        config.put(new PropertySimple("jndi-name", dsName));
        config.put(new PropertySimple("connection-url", "jdbc:hsqldb:."));
        config.put(new PropertySimple("user-name", "userJoe"));
        config.put(new PropertySimple("password", "password"));
        // Min and Max are not being put into the xml file.
        config.put(new PropertySimple("min-pool-size", min));
        config.put(new PropertySimple("max-pool-size", max));
        config.put(new PropertySimple("driver-class", "org.hsqldb.jdbcDriver"));
        config.put(new PropertySimple("share-prepared-statements", false));
        config.put(new PropertySimple("prepared-statement-cache-size", max));
        config.put(new PropertySimple("new-connection-sql", "Select count(*) from dual;"));

        PropertyMap connectionProperies = new PropertyMap("connectionProperties");
        PropertySimple simple1 = new PropertySimple("ConnProp1", "FirstValue");
        PropertySimple simple2 = new PropertySimple("ConnProp2", "SecondValue");
        connectionProperies.put(simple1);
        connectionProperies.put(simple2);
        config.put(connectionProperies);

        CreateResourceRequest request = new CreateResourceRequest(1, as5Server.getId(), "newResource", dsType.getName(), dsType.getPlugin(), null, config);

        resourceFactoryAgentService.executeCreateResourceImmediately(request);

        platform = discoverPlatform();

        Resource testDs = findService(dsName, SERVER_NAME, platform);

        pc = PluginContainer.getInstance();
        ConfigurationAgentService configService = pc.getConfigurationAgentService();

        Configuration configuration = configService.loadResourceConfiguration(testDs.getId());

        assert configuration.getSimple("jndi-name").getStringValue().equals(dsName) : "Property jndi-name was incorrect";
        assert configuration.getSimple("connection-url").getStringValue().equals("jdbc:hsqldb:hsql://${jboss.bind.address}:1701")
View Full Code Here

        Resource platform = discoverPlatform();
        Resource deleteMe = findService(dsName, SERVER_NAME, platform);

        assert deleteMe != null : "Could not find datasource to be deleted";

        PluginContainer pc = PluginContainer.getInstance();
        ResourceFactoryAgentService resourceFactoryAgentService = pc.getResourceFactoryAgentService();

        DeleteResourceRequest deleteRequest = new DeleteResourceRequest(1, deleteMe.getId());

        try
        {
            resourceFactoryAgentService.executeDeleteResourceImmediately(deleteRequest);
        }
        catch (PluginContainerException e)
        {
            fail();
        }

        InventoryManager inventoryManager = pc.getInventoryManager();
        assert inventoryManager.getResourceComponent(deleteMe) == null : "Resource component was not deleted from inventory manager";

        Resource deleteMe2 = findService(dsName, SERVER_NAME, platform);

        assert deleteMe2 == null : "found datasource that was supposed to be deleted";
View Full Code Here

    File pluginDir = new File("target/itest/plugins");
    PluginContainerConfiguration pcConfig = new PluginContainerConfiguration();
    pcConfig.setPluginFinder(new FileSystemPluginFinder(pluginDir));
    pcConfig.setPluginDirectory(pluginDir);
    pcConfig.setInsideAgent(false);
    PluginContainer container = PluginContainer.getInstance();
    PluginContainer.getInstance().setConfiguration(pcConfig);
    System.out.println("Starting PC...");
    PluginContainer.getInstance().initialize();
    Set<String> pluginNames = PluginContainer.getInstance()
        .getPluginManager().getMetadataManager().getPluginNames();
View Full Code Here

TOP

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

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.