Package org.rhq.enterprise.server.resource

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


    public void persistBundleTargetConfigurations() throws Exception {
        String resourceTypeName = "ServerA";
        String plugin = PLUGIN_NAME;

        SubjectManagerLocal subjectMgr = LookupUtil.getSubjectManager();
        ResourceTypeManagerLocal resourceTypeMgr = LookupUtil.getResourceTypeManager();

        ResourceTypeCriteria criteria = new ResourceTypeCriteria();
        criteria.addFilterName(resourceTypeName);
        criteria.addFilterPluginName(plugin);
        criteria.fetchBundleConfiguration(true);
        List<ResourceType> resourceTypes = resourceTypeMgr.findResourceTypesByCriteria(subjectMgr.getOverlord(),
            criteria);
        assertEquals("too many types returned!", 1, resourceTypes.size());
        ResourceType resourceType = resourceTypes.get(0);

        ResourceTypeBundleConfiguration rtbc = resourceType.getResourceTypeBundleConfiguration();
View Full Code Here


    public void upgradeBundleTargetConfigurations() throws Exception {
        String resourceTypeName = "ServerA";
        String plugin = PLUGIN_NAME;

        SubjectManagerLocal subjectMgr = LookupUtil.getSubjectManager();
        ResourceTypeManagerLocal resourceTypeMgr = LookupUtil.getResourceTypeManager();

        ResourceTypeCriteria criteria = new ResourceTypeCriteria();
        criteria.addFilterName(resourceTypeName);
        criteria.addFilterPluginName(plugin);
        criteria.fetchBundleConfiguration(true);
        List<ResourceType> resourceTypes = resourceTypeMgr.findResourceTypesByCriteria(subjectMgr.getOverlord(),
            criteria);
        ResourceType resourceType = resourceTypes.get(0);

        ResourceTypeBundleConfiguration rtbc = resourceType.getResourceTypeBundleConfiguration();
        assertNotNull("missing bundle configuration", rtbc);
View Full Code Here

        addResourcesToGroup(rgFlat, resourcesServiceE4);

        createPlugin("remove-types-plugin", "2.0", "remove_types_v2.xml");

        //Removal of this resource type exceeds default criteria page size.
        ResourceTypeManagerLocal resourceTypeMgr = LookupUtil.getResourceTypeManager();
        SubjectManagerLocal subjectMgr = LookupUtil.getSubjectManager();
        ResourceTypeCriteria criteria = new ResourceTypeCriteria();
        criteria.addFilterName("ServiceE4");
        criteria.addFilterPluginName("RemoveTypesPlugin");

        long start = nanoTime();
        boolean allTypesRemoved = false;
        do {
            Thread.sleep(SECONDS.toMillis(5));
            allTypesRemoved = resourceTypeMgr.findResourceTypesByCriteria(subjectMgr.getOverlord(), criteria).size() == 0;
        } while (!allTypesRemoved && (nanoTime() - start) < MINUTES.toNanos(10));
        assertTrue("Resource type 'ServiceE4' not fully removed", allTypesRemoved);
    }
View Full Code Here

    @Test(dependsOnMethods = { "upgradePluginWithTypesRemoved" }, groups = { "plugin.resource.metadata.test",
        "RemoveTypes" })
    public void deleteParent() throws Exception {

        SubjectManagerLocal subjectMgr = LookupUtil.getSubjectManager();
        ResourceTypeManagerLocal resourceTypeMgr = LookupUtil.getResourceTypeManager();

        ResourceTypeCriteria criteria = new ResourceTypeCriteria();
        criteria.addFilterName("ServerD.GrandChild1");
        criteria.addFilterPluginName("RemoveTypesPlugin");
        criteria.fetchParentResourceTypes(true);

        List<ResourceType> types = resourceTypeMgr.findResourceTypesByCriteria(subjectMgr.getOverlord(), criteria);

        assertEquals("Expected to get back one resource type", 1, types.size());

        ResourceType type = types.get(0);
View Full Code Here

        }
    }

    void assertTypesPersisted(String msg, List<String> types, String plugin) {
        List<String> typesNotFound = new ArrayList<String>();
        ResourceTypeManagerLocal resourceTypeMgr = LookupUtil.getResourceTypeManager();

        for (String type : types) {
            if (resourceTypeMgr.getResourceTypeByNameAndPlugin(type, plugin) == null) {
                typesNotFound.add(type);
            }
        }

        if (!typesNotFound.isEmpty()) {
View Full Code Here

        }
    }

    void assertAssociationExists(String resourceTypeName, String propertyName) throws Exception {
        SubjectManagerLocal subjectMgr = LookupUtil.getSubjectManager();
        ResourceTypeManagerLocal resourceTypeMgr = LookupUtil.getResourceTypeManager();

        String fetch = "fetch" + WordUtils.capitalize(propertyName);
        ResourceTypeCriteria criteria = new ResourceTypeCriteria();
        criteria.addFilterName(resourceTypeName);
        criteria.addFilterPluginName(PLUGIN_NAME);
        MethodUtils.invokeMethod(criteria, fetch, true);

        List<ResourceType> resourceTypes = resourceTypeMgr.findResourceTypesByCriteria(subjectMgr.getOverlord(),
            criteria);
        ResourceType resourceType = resourceTypes.get(0);

        Object property = PropertyUtils.getProperty(resourceType, propertyName);
        assertNotNull("Failed to find $propertyName for type '$resourceTypeName'", property);
View Full Code Here

        assertNotNull("Failed to find $propertyName for type '$resourceTypeName'", property);
    }

    List<Resource> createResources(int count, String pluginName, String resourceTypeName, Resource parent)
        throws Exception {
        ResourceTypeManagerLocal resourceTypeMgr = LookupUtil.getResourceTypeManager();
        ResourceType resourceType = resourceTypeMgr.getResourceTypeByNameAndPlugin(resourceTypeName, pluginName);

        assertNotNull("Cannot create resources. Unable to find resource type for [name: " + resourceTypeName
            + ", plugin: " + pluginName + "]", resourceType);

        List<Resource> resources = new ArrayList<Resource>();
View Full Code Here

    void createBundle(String bundleName, String bundleTypeName, String resourceTypeName, String pluginName)
        throws Exception {
        SubjectManagerLocal subjectMgr = LookupUtil.getSubjectManager();
        BundleManagerLocal bundleMgr = LookupUtil.getBundleManager();
        ResourceTypeManagerLocal resourceTypeMgr = LookupUtil.getResourceTypeManager();
        ResourceType resourceType = resourceTypeMgr.getResourceTypeByNameAndPlugin(resourceTypeName, pluginName);

        assertNotNull("Cannot create bundle. Unable to find resource type for [name: " + resourceTypeName
            + ", plugin: " + pluginName + "]", resourceType);

        BundleType bundleType = bundleMgr.getBundleType(subjectMgr.getOverlord(), bundleTypeName);
View Full Code Here

    }

    ResourceGroup createResourceGroup(String groupName, String resourceTypeName, String pluginName, boolean recursive)
        throws Exception {
        SubjectManagerLocal subjectMgr = LookupUtil.getSubjectManager();
        ResourceTypeManagerLocal resourceTypeMgr = LookupUtil.getResourceTypeManager();
        ResourceGroupManagerLocal resourceGroupMgr = LookupUtil.getResourceGroupManager();

        ResourceType resourceType = resourceTypeMgr.getResourceTypeByNameAndPlugin(resourceTypeName, pluginName);

        assertNotNull("Cannot create resource group. Unable to find resource type for [name: " + resourceTypeName
            + ", plugin: " + pluginName + "]", resourceType);

        ResourceGroup resourceGroup = new ResourceGroup(groupName, resourceType);
View Full Code Here

        resourceGroupMgr.addResourcesToGroup(subjectMgr.getOverlord(), rg.getId(), ids);
    }

    void createAlertTemplate(String name, String resourceTypeName, String pluginName) throws Exception {
        SubjectManagerLocal subjectMgr = LookupUtil.getSubjectManager();
        ResourceTypeManagerLocal resourceTypeMgr = LookupUtil.getResourceTypeManager();
        AlertTemplateManagerLocal alertTemplateMgr = LookupUtil.getAlertTemplateManager();

        ResourceType resourceType = resourceTypeMgr.getResourceTypeByNameAndPlugin(resourceTypeName, pluginName);
        assertNotNull("Cannot create alert template. Unable to find resource type for [name: " + resourceTypeName
            + ", plugin: " + pluginName + "]", resourceType);

        AlertDefinition alertDef = new AlertDefinition();
        alertDef.setName(name);
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.