Package org.rhq.core.domain.resource

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


        assertTypeDeleted("ServerC.Child1");
        assertTypeDeleted("ServerD");
    }

    private ResourceType getPersistedTypeAndAssert(String typeName, String description, boolean isIgnored) {
        ResourceType rt = ignoreAndGetPersistedType(typeName, false);
        assertEquals(description, rt.getDescription());
        assertEquals(isIgnored, rt.isIgnored());
        return rt;
    }
View Full Code Here


                }

                // now dispose of other hibernate entities
                getTransactionManager().begin();

                ResourceType type = em.find(ResourceType.class, resource.getResourceType().getId());
                Agent agent = em.find(Agent.class, resource.getAgent().getId());
                if (null != agent) {
                    em.remove(agent);
                }
                if (null != type) {
View Full Code Here

        assert resourceType.getParentResourceTypes().iterator().next().getName().equals("OuterServerA");
    }

    private void checkChild2Plugin() throws Exception {
        // load the child #2 type and test to make sure it has been updated to what we expect
        ResourceType resourceType = loadResourceTypeFully(TYPE_NAME_CHILD2, PLUGIN_NAME_CHILD);
        assert resourceType.getName().equals(TYPE_NAME_CHILD2);
        assert resourceType.getPlugin().equals(PLUGIN_NAME_CHILD);
        assertVersion2(resourceType);

        // in our child #2 plugin, our extended type is actually a child of an outer parent.
        // here we want to make sure that hierarchy remains intact with our extended type - the parent
        // of our extended type should be this child's parent as defined in the child descriptor.
        assert resourceType.getParentResourceTypes() != null;
        assert resourceType.getParentResourceTypes().size() == 1;
        assert resourceType.getParentResourceTypes().iterator().next().getName().equals("OuterServerB");
    }
View Full Code Here

        c.addFilterPluginName(typePlugin);
        c.setStrict(true);
        c.fetchParentResourceTypes(true);
        c.fetchOperationDefinitions(true);
        List<ResourceType> t = resourceTypeMgr.findResourceTypesByCriteria(subjectMgr.getOverlord(), c);
        ResourceType resourceType = t.get(0);
        return resourceType;
    }
View Full Code Here

    }

    @Test(enabled = ENABLED)
    public void packageType() throws Exception {
        // Setup
        ResourceType resourceType = null;
        PackageType packageType = null;

        TransactionManager tx = getTransactionManager();
        try {
            tx.begin();
            EntityManager entityManager = getEntityManager();

            resourceType = new ResourceType("dynamicConfigPropBeanTestType", "foo", ResourceCategory.PLATFORM, null);
            entityManager.persist(resourceType);

            packageType = new PackageType("dynamicConfigPropBeanTestType", resourceType);
            entityManager.persist(packageType);
            tx.commit();
        } catch (Exception e) {
            if (tx.getStatus() == Status.STATUS_ACTIVE) {
                tx.rollback();
            }
        }

        int existingPackageTypes = countForQuery(PackageType.QUERY_FIND_ALL);
        assert existingPackageTypes > 0 : "Package type created in setup was not written correctly";

        // Test
        List<DynamicConfigurationPropertyValue> types = bean
            .lookupValues(PropertyExpressionEvaluator.KEY_PACKAGE_TYPES);

        // Verify
        assert types.size() == existingPackageTypes : "Expected: " + existingPackageTypes + ", Found: " + types.size();

        // Clean up
        tx = getTransactionManager();
        try {
            tx.begin();
            EntityManager entityManager = getEntityManager();

            resourceType = entityManager.find(ResourceType.class, resourceType.getId());
            entityManager.remove(resourceType);

            packageType = entityManager.find(PackageType.class, packageType.getId());
            entityManager.remove(packageType);
View Full Code Here

                lge.agent = SessionTestHelper.createNewAgent(em, "LargeGroupTestAgent");

                // create the platform resource type and server resource type
                // the server type will have both a plugin configuration definition and resource config def
                if (lge.platformType == null) {
                    lge.platformType = new ResourceType("LargeGroupTestPlatformType", "testPlugin",
                        ResourceCategory.PLATFORM, null);
                    em.persist(lge.platformType);
                } else {
                    lge.platformType = em.find(ResourceType.class, lge.platformType.getId());
                }

                if (lge.serverType == null) {
                    lge.serverType = new ResourceType("LargeGroupTestServerType", "testPlugin",
                        ResourceCategory.SERVER, lge.platformType);
                    lge.serverPluginConfiguration = new ConfigurationDefinition("LargeGroupTestPCDef", "pc desc");
                    lge.serverPluginConfiguration.put(new PropertyDefinitionSimple(PC_PROP1_NAME, "pc prop1desc",
                        false, PropertySimpleType.STRING));
                    lge.serverPluginConfiguration.put(new PropertyDefinitionSimple(PC_PROP2_NAME, "pc prop2desc",
View Full Code Here

        if (!keepTypes) {
            // purge the resource types
            executeInTransaction(false, new TransactionCallback() {
                public void execute() throws Exception {
                    ResourceType pType = em.getReference(ResourceType.class, lge.platformResource.getResourceType()
                        .getId());
                    ResourceType sType = em.getReference(ResourceType.class, lge.compatibleGroup.getResourceType()
                        .getId());
                    em.remove(sType);
                    em.remove(pType);
                }
            });
View Full Code Here

            packageType.getDeploymentConfigurationDefinition());
    }

    @Test(groups = { "plugin.metadata", "Content.UpgradePlugin" }, dependsOnMethods = { "upgradeContentPlugin" })
    public void updateBundleType() {
        ResourceType resourceType = loadResourceTypeWithBundleType("ContentServer7",
            "ContentMetadataManagerBeanTestPlugin");
        BundleType bundleType = resourceType.getBundleType();

        assertNotNull("Failed to upgrade bundle type", bundleType);
        assertEquals("Failed to upgrade bundle type correctly. The bundle type name is wrong",
            "ContentServer.Bundle.2", bundleType.getName());
    }
View Full Code Here

            "ContentServer.Bundle.2", bundleType.getName());
    }

    @Test(groups = { "plugin.metadata", "Content.UpgradePlugin" }, dependsOnMethods = { "upgradeContentPlugin" })
    public void addBundleTypeThatOnlyExistsInNewResourceType() {
        ResourceType resourceType = loadResourceTypeWithBundleType("ContentServer6",
            "ContentMetadataManagerBeanTestPlugin");
        BundleType bundleType = resourceType.getBundleType();

        assertNotNull("Expected to find bundle type added during upgrade", bundleType);
        assertEquals("Failed to correctly add bundle type during upgrade", "ContentServer6.Bundle.1",
            bundleType.getName());
    }
View Full Code Here

        createPlugin("parent-plugin.jar", "1.0", "parent_plugin_v1.xml");
        if (ignoreTypes) {
            ignoreType(TYPE_NAME_PARENT, PLUGIN_NAME_PARENT);
        }

        ResourceType resourceType = loadResourceTypeFully(TYPE_NAME_PARENT, PLUGIN_NAME_PARENT);
        assert resourceType.getName().equals(TYPE_NAME_PARENT);
        assert resourceType.getPlugin().equals(PLUGIN_NAME_PARENT);
        assert resourceType.isIgnored() == ignoreTypes;
        assertVersion1(resourceType);
    }
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.