Package org.rhq.core.domain.plugin

Examples of org.rhq.core.domain.plugin.Plugin


        return;
    }

    @Test(dependsOnMethods = { "registerPlugins" })
    public void scanAndRegisterTest() throws Exception {
        Plugin plugin = getPlugin(PLUGIN_1);
        assertNotNull(plugin);
        pluginDeployed(PLUGIN_1);

        plugin = getPlugin(PLUGIN_2);
        assertNotNull(plugin);
View Full Code Here


        pluginDeployed(PLUGIN_3_1);
    }

    @Test(dependsOnMethods = { "registerPlugins" })
    public void disablePlugin() throws Exception {
        Plugin plugin = getPlugin(PLUGIN_3);
        assertTrue("Plugin should not already be disabled", plugin.isEnabled());

        pluginMgr.disablePlugins(subjectMgr.getOverlord(), asList(plugin.getId()));
        plugin = pluginMgr.getPlugin(PLUGIN_3);

        assertNotNull(plugin);
        assertFalse("Failed to disable plugin", plugin.isEnabled());
    }
View Full Code Here

        assertFalse("Failed to disable plugin", plugin.isEnabled());
    }

    @Test(dependsOnMethods = { "registerPlugins" })
    public void doNotDisablePluginIfDependentPluginsAreNotAlsoDisabled() throws Exception {
        Plugin plugin = getPlugin(PLUGIN_1);
        assertTrue("Plugin should not already be disabled", plugin.isEnabled());
        Plugin plugin2 = getPlugin(PLUGIN_2);
        assertTrue("Plugin should not already be disabled", plugin.isEnabled());

        Exception exception = null;

        try {
View Full Code Here

            exception.getCause() instanceof IllegalArgumentException);
    }

    @Test(dependsOnMethods = { "doNotDisablePluginIfDependentPluginsAreNotAlsoDisabled" })
    public void disablePluginAndDependentPlugins() throws Exception {
        Plugin plugin1 = getPlugin(PLUGIN_1);
        Plugin plugin2 = getPlugin(PLUGIN_2);

        pluginMgr.disablePlugins(subjectMgr.getOverlord(), asList(plugin1.getId(), plugin2.getId()));

        plugin1 = getPlugin(PLUGIN_1);
        plugin2 = getPlugin(PLUGIN_2);

        assertFalse("Failed to disable plugin", plugin1.isEnabled());
        assertFalse("Failed to disable plugin", plugin2.isEnabled());
    }
View Full Code Here

        assertFalse("Failed to disable plugin", plugin2.isEnabled());
    }

    @Test(groups = { "plugin.metadata", "PluginManagerBean" }, dependsOnMethods = { "disablePluginAndDependentPlugins" })
    public void enablePlugins() throws Exception {
        Plugin plugin1 = getPlugin(PLUGIN_1);
        Plugin plugin2 = getPlugin(PLUGIN_2);

        pluginMgr.enablePlugins(subjectMgr.getOverlord(), asList(plugin1.getId(), plugin2.getId()));

        plugin1 = getPlugin(PLUGIN_1);
        plugin2 = getPlugin(PLUGIN_2);

        assertTrue("Failed to enable plugin", plugin1.isEnabled());
        assertTrue("Failed to enable plugin", plugin2.isEnabled());
    }
View Full Code Here

        assertTrue("Failed to enable plugin", plugin2.isEnabled());
    }

    @Test(dependsOnMethods = { "enablePlugins" })
    public void doNotDeletePluginIfDependentPluginIsNotAlsoDeleted() throws Exception {
        Plugin plugin = getPlugin(PLUGIN_1);
        Exception exception = null;

        try {
            pluginMgr.deletePlugins(subjectMgr.getOverlord(), asList(plugin.getId()));
            fail("Expected an IllegalArgumentException when trying to delete a plugin with dependent plugins");

        } catch (IllegalArgumentException e) {
            // expected
        } catch (EJBException ee) {
View Full Code Here

        }
    }

    @Test(dependsOnMethods = { "doNotDeletePluginIfDependentPluginIsNotAlsoDeleted" })
    public void deletePlugins() throws Exception {
        Plugin plugin1 = getPlugin(PLUGIN_1);
        Plugin plugin2 = getPlugin(PLUGIN_2);

        pluginMgr.deletePlugins(subjectMgr.getOverlord(), asList(plugin1.getId(), plugin2.getId()));

        plugin1 = getPlugin(PLUGIN_1, "Deleting a plugin should not remove it from the database");
        plugin2 = getPlugin(PLUGIN_2, "Deleting a plugin should not remove it from the database");

        assertTrue("Expected plugin status to be set to DELETED", plugin1.getStatus() == PluginStatusType.DELETED);
        assertTrue("Expected plugin status to be set to DELETED", plugin2.getStatus() == PluginStatusType.DELETED);
    }
View Full Code Here

    @Test(dependsOnMethods = { "deletePlugins" })
    public void isPluginReadyForPurge() throws Exception {
        ResourceTypeManagerLocal resourceTypeManager = LookupUtil.getResourceTypeManager();
        InventoryManagerLocal inventoryManager = LookupUtil.getInventoryManager();

        Plugin plugin = getDeletedPlugin(PLUGIN_1);
        if (plugin == null) {
            //ok so there's no delete plugin like that. Let's check that there's no installed plugin either
            plugin = pluginMgr.getPlugin(PLUGIN_1);
            if (plugin != null) {
                fail(PLUGIN_1 + "should have been deleted in PluginManagerBeanTest#deletePlugins()");
            }

            //So there's no such plugin at all. This means that some other test intertwined between this test and
            //deletePlugins.
            //
            //Because tests are configured to clean up after themselves (mainly in the afterClassWork() method)
            //it may happen that the plugin we marked for deletion in deletePlugins has actually been deleted
            //by the clean up methods.
            //
            //The point of this test is in that case fulfilled anyway because by the plugin disappearing,
            //we proved that at some point in time between deletePlugins and this test it was indeed purgeable.
            return;
        }

        List<ResourceType> resourceTypes = resourceTypeManager.getResourceTypesByPlugin(plugin.getName());
        List<ResourceType> deletedTypes = inventoryManager.getDeletedTypes();

        boolean resourceTypesPurged = resourceTypes.isEmpty() && deletedTypes.isEmpty();

        //ack the plugins as deleted so that the only remaining condition for their
View Full Code Here

        // See https://bugzilla.redhat.com/show_bug.cgi?id=845700 for details on this test

        InventoryManagerLocal inventoryManager = LookupUtil.getInventoryManager();
        ResourceTypeManagerLocal resourceTypeManager = LookupUtil.getResourceTypeManager();

        Plugin plugin3 = getPlugin(PLUGIN_3);
        ResourceType resourceType = resourceTypeManager
            .getResourceTypeByNameAndPlugin("TestServer3", plugin3.getName());
        ResourceType resourceTypeIgnored = resourceTypeManager.getResourceTypeByNameAndPlugin("TestServer3Ignored",
            plugin3.getName());

        assertNotNull("Failed to find resource type. Did the resource type name in the plugin descriptor change?",
            resourceType);
        assertNotNull("Failed to find ignored resource type. Did the type name in the plugin descriptor change?",
            resourceTypeIgnored);

        pluginMgr.deletePlugins(subjectMgr.getOverlord(), asList(plugin3.getId()));
        inventoryManager.purgeDeletedResourceType(resourceType);
        inventoryManager.purgeDeletedResourceType(resourceTypeIgnored);

        ackDeletedPlugins();
View Full Code Here

        Assert.assertEquals(true, finished);
    }

    private Plugin getPlugin(String name) {
        Plugin plugin = pluginMgr.getPlugin(name);
        assertNotNull("Failed to find plugin [" + name + "].", plugin);

        return plugin;
    }
View Full Code Here

TOP

Related Classes of org.rhq.core.domain.plugin.Plugin

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.