Package org.rhq.enterprise.server.resource

Examples of org.rhq.enterprise.server.resource.ResourceTypeManagerLocal


    private static final long serialVersionUID = 1L;

    @Override
    public void setResourceTypeIgnoreFlag(int resourceTypeId, boolean ignoreFlag) throws RuntimeException {
        try {
            ResourceTypeManagerLocal typeManager = LookupUtil.getResourceTypeManager();
            typeManager.setResourceTypeIgnoreFlagAndUninventoryResources(getSessionSubject(), resourceTypeId,
                ignoreFlag);
        } catch (Throwable t) {
            throw getExceptionToThrowToClient(t);
        }
    }
View Full Code Here


    }

    @Override
    public void setResourceTypeMissingPolicy(int resourceTypeId, MissingPolicy policy) throws RuntimeException {
        try {
            ResourceTypeManagerLocal typeManager = LookupUtil.getResourceTypeManager();
            typeManager.setResourceTypeMissingPolicy(getSessionSubject(), resourceTypeId, policy);
        } catch (Throwable t) {
            throw getExceptionToThrowToClient(t);
        }
    }
View Full Code Here

    }

    @Override
    public PageList<ResourceType> findResourceTypesByCriteria(ResourceTypeCriteria criteria) throws RuntimeException {
        try {
            ResourceTypeManagerLocal typeManager = LookupUtil.getResourceTypeManager();

            return SerialUtility.prepare(typeManager.findResourceTypesByCriteria(getSessionSubject(), criteria),
                "ResourceTypes.findResourceTypesByCriteria");
        } catch (Throwable t) {
            throw getExceptionToThrowToClient(t);
        }
    }
View Full Code Here

    }

    @Override
    public ArrayList<ResourceType> getAllResourceTypeAncestors(int resourceTypeId) throws RuntimeException {
        try {
            ResourceTypeManagerLocal typeManager = LookupUtil.getResourceTypeManager();
            List<ResourceType> list = typeManager.getAllResourceTypeAncestors(getSessionSubject(), resourceTypeId);
            return SerialUtility
                .prepare(new ArrayList<ResourceType>(list), "ResourceTypes.getAllResourceTypeAncestors");
        } catch (Throwable t) {
            throw getExceptionToThrowToClient(t);
        }
View Full Code Here

    @Override
    public HashMap<Integer, String> getResourceTypeDescendantsWithOperations(int resourceTypeId)
        throws RuntimeException {
        try {
            ResourceTypeManagerLocal typeManager = LookupUtil.getResourceTypeManager();
            HashMap<Integer, String> map = typeManager.getResourceTypeDescendantsWithOperations(getSessionSubject(),
                resourceTypeId);
            return SerialUtility.prepare(map, "ResourceTypes.getResourceTypeDescendantsWithOperations");
        } catch (Throwable t) {
            throw getExceptionToThrowToClient(t);
        }
View Full Code Here

    }

    @Override
    public Map<Integer, ResourceTypeTemplateCountComposite> getTemplateCountCompositeMap() throws RuntimeException {
        try {
            ResourceTypeManagerLocal typeManager = LookupUtil.getResourceTypeManager();
            Map<Integer, ResourceTypeTemplateCountComposite> map = typeManager.getTemplateCountCompositeMap();
            return SerialUtility.prepare(map, "ResourceTypes.getTemplateCountCompositeMap");
        } catch (Throwable t) {
            throw getExceptionToThrowToClient(t);
        }
    }
View Full Code Here

        return rt;
    }

    // this will ignore the resource type if "ignore" is true - if ignore is false, this just returns the type
    private ResourceType ignoreAndGetPersistedType(String typeName, boolean ignore) {
        ResourceTypeManagerLocal typeMgr = LookupUtil.getResourceTypeManager();

        ResourceType rt = typeMgr.getResourceTypeByNameAndPlugin(typeName, PLUGIN_NAME);
        if (rt == null) {
            fail("The following type was not found: " + typeName);
        }

        if (ignore) {
            SubjectManagerLocal subjectMgr = LookupUtil.getSubjectManager();
            typeMgr.setResourceTypeIgnoreFlagAndUninventoryResources(subjectMgr.getOverlord(), rt.getId(), true);
            rt = typeMgr.getResourceTypeByNameAndPlugin(typeName, PLUGIN_NAME);
            if (rt == null) {
                fail("Failed to reload type after ignoring it: " + typeName);
            }
            assert rt.isIgnored() : "Somehow the type didn't get ignored: " + rt;
        }
View Full Code Here

        return rt;
    }

    private void assertTypeDeleted(String typeName) {
        ResourceTypeManagerLocal resourceTypeMgr = LookupUtil.getResourceTypeManager();
        ResourceType rt = resourceTypeMgr.getResourceTypeByNameAndPlugin(typeName, PLUGIN_NAME);
        if (rt != null) {
            fail("The following type was supposed to be deleted: " + typeName);
        }
        return;
    }
View Full Code Here

        assertTrue("Expected plugin status to be set to DELETED", plugin2.getStatus() == PluginStatusType.DELETED);
    }

    @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

    @Test(dependsOnMethods = { "registerPlugins", "isPluginReadyForPurge" })
    public void pluginPurgeCheckShouldUseExactMatchesInQuery() throws Exception {
        // 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?",
View Full Code Here

TOP

Related Classes of org.rhq.enterprise.server.resource.ResourceTypeManagerLocal

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.