Package org.rhq.core.domain.resource

Examples of org.rhq.core.domain.resource.ResourceType


    }

    private void registerParentPluginV1() throws Exception {
        // register the plugin, load the new type and test to make sure its what we expect
        createPlugin("parent-plugin.jar", "1.0", "parent_plugin_v1.xml");
        ResourceType resourceType = loadResourceTypeFully(TYPE_NAME_PARENT, PLUGIN_NAME_PARENT);
        assert resourceType.getName().equals(TYPE_NAME_PARENT);
        assert resourceType.getPlugin().equals(PLUGIN_NAME_PARENT);
        assertVersion1(resourceType);
    }
View Full Code Here


    }

    private void registerChildPluginV1() throws Exception {
        // register the plugin, load the new type and test to make sure its what we expect
        createPlugin("child-plugin.jar", "1.0", "child_plugin_v1.xml");
        ResourceType resourceType = loadResourceTypeFully(TYPE_NAME_CHILD, PLUGIN_NAME_CHILD);
        assert resourceType.getName().equals(TYPE_NAME_CHILD);
        assert resourceType.getPlugin().equals(PLUGIN_NAME_CHILD);
        assertVersion1(resourceType);
    }
View Full Code Here

    }

    private void registerParentPluginV2() throws Exception {
        // register the plugin, load the new type and test to make sure its what we expect
        createPlugin("parent-plugin.jar", "2.0", "parent_plugin_v2.xml");
        ResourceType resourceType = loadResourceTypeFully(TYPE_NAME_PARENT, PLUGIN_NAME_PARENT);
        assert resourceType.getName().equals(TYPE_NAME_PARENT);
        assert resourceType.getPlugin().equals(PLUGIN_NAME_PARENT);
        assertVersion2(resourceType);
    }
View Full Code Here

        assertVersion2(resourceType);
    }

    private void checkChildPlugin() throws Exception {
        // load the child type and test to make sure it has been updated to what we expect
        ResourceType resourceType = loadResourceTypeFully(TYPE_NAME_CHILD, PLUGIN_NAME_CHILD);
        assert resourceType.getName().equals(TYPE_NAME_CHILD);
        assert resourceType.getPlugin().equals(PLUGIN_NAME_CHILD);
        assertVersion2(resourceType);
    }
View Full Code Here

        c.fetchEventDefinitions(true);
        c.fetchResourceConfigurationDefinition(true);
        c.fetchDriftDefinitionTemplates(true);
        c.fetchBundleConfiguration(true);
        List<ResourceType> t = resourceTypeMgr.findResourceTypesByCriteria(subjectMgr.getOverlord(), c);
        ResourceType resourceType = t.get(0);
        return resourceType;
    }
View Full Code Here

     */
    @Test
    public void testProcessScans() throws Exception {
        try {
            registerPlugin("update5-v1_0.xml");
            ResourceType platform1 = getResourceType("myPlatform5");
            getTransactionManager().begin();
            platform1 = em.find(ResourceType.class, platform1.getId());

            Set<ResourceType> servers = platform1.getChildResourceTypes();
            assert servers.size() == 1 : "Expected to find 1 server in v1, but got " + servers.size();
            ResourceType server1 = servers.iterator().next();

            /*
             * TODO check process scans as well
             */
            Set<ProcessScan> scans1 = server1.getProcessScans();
            assert scans1.size() == 3 : "Expected to find 3 process scans in v1, but got " + scans1.size();
            int found = 0;
            for (ProcessScan ps : scans1) {
                if (containedIn(ps.getName(), new String[] { "JBoss4", "JBoss5", "JBoss6" })) {
                    found++;
                }
            }

            assert found == 3 : "Expected to find 3 process scans in v1";
            // TODO also check query
            getTransactionManager().rollback();

            /*
             * check process scans in v2 as well
             */
            registerPlugin("update5-v2_0.xml");
            ResourceType platform2 = getResourceType("myPlatform5");
            getTransactionManager().begin();

            platform2 = em.find(ResourceType.class, platform2.getId());
            Set<ResourceType> servers2 = platform2.getChildResourceTypes();
            assert servers2.size() == 1 : "Expected to find 1 server in v2, but got " + servers2.size();
            ResourceType server2 = servers2.iterator().next();

            Set<ProcessScan> scans2 = server2.getProcessScans();
            assert scans2.size() == 3 : "Expected to find 3 process scans in v2, but got " + scans2.size();
            found = 0;
            for (ProcessScan ps : scans2) {
                if (containedIn(ps.getName(), new String[] { "JBoss5", "JBoss6", "Hibernate" })) {
                    found++;
View Full Code Here

        final ArrayList<MeasurementDefinition> measurementDefinitions = new ArrayList<MeasurementDefinition>();

        if (resourceGroup.getGroupCategory() == GroupCategory.COMPATIBLE) {
            // Load the fully fetched ResourceType.
            ResourceType groupType = resourceGroup.getResourceType();
            ResourceTypeRepository.Cache.getInstance().getResourceTypes(
                    groupType.getId(),
                    EnumSet.of(ResourceTypeRepository.MetadataType.measurements),
                    new ResourceTypeRepository.TypeLoadedCallback() {
                        public void onTypesLoaded(ResourceType type) {
                            resourceGroup.setResourceType(type);
View Full Code Here

            }

            getTransactionManager().begin();

            try {
                ResourceType type = em.find(ResourceType.class, newResource1.getResourceType().getId());

                em.remove(type);

                getTransactionManager().commit();
            } catch (Exception e) {
View Full Code Here

        Subject overlord = LookupUtil.getSubjectManager().getOverlord();

        try {
            // this is simulating what the UI would be doing, build the config and call the server-side API
            // we'll pretend the user is the overlord - another test will check a real user to see permission errors
            ResourceType newResource1Type = resource.getResourceType();
            ConfigurationDefinition initialDefinition = newResource1Type.getResourceConfigurationDefinition();
            int loadCount = 300;
            HashSet<String> parsedNames = new HashSet<String>();
            for (int i = 0; i < loadCount; i++) {
                String name = "fakeProperty_" + i;
                initialDefinition
                    .put(new PropertyDefinitionSimple(name, "fake_" + i, false, PropertySimpleType.BOOLEAN));
                parsedNames.add(name);
            }
            newResource1Type.setResourceConfigurationDefinition(initialDefinition);
            newResource1Type = em.merge(newResource1Type);
            em.flush(); // so that slsb calls below will see the change reflected in the db

            ConfigurationDefinition configurationDefinition = newResource1Type.getResourceConfigurationDefinition();
            assert configurationDefinition != null : "Configuration Definition could not be located.";
            //retrieve the options for ConfigurationDefinition
            ConfigurationDefinition options = configurationManager.getOptionsForConfigurationDefinition(overlord,
                newResource1.getId(), -1, configurationDefinition);
            assert options != null : "Unable able to retrieve options for resource with id [" + newResource1.getId()
View Full Code Here

            true, definition);

        executeInTransaction(false, new TransactionCallback() {
            @Override
            public void execute() throws Exception {
                ResourceType updatedType = em.find(ResourceType.class, resourceType.getId());

                assertEquals("Failed to add new drift definition to resource type", 1, updatedType
                    .getDriftDefinitionTemplates().size());

                DriftDefinitionTemplate expectedTemplate = new DriftDefinitionTemplate();
                expectedTemplate.setTemplateDefinition(definition);
                expectedTemplate.setUserDefined(true);
View Full Code Here

TOP

Related Classes of org.rhq.core.domain.resource.ResourceType

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.