Package org.rhq.core.domain.content

Examples of org.rhq.core.domain.content.PackageType


     */
    public static PackageType parseContentDescriptor(ContentDescriptor descriptor)
        throws InvalidPluginDescriptorException {
        PackageCategory category = translateCategory(descriptor.getCategory());

        PackageType type = new PackageType();
        type.setName(descriptor.getName());
        type.setDescription(descriptor.getDescription());
        type.setCategory(category);
        type.setSupportsArchitecture(descriptor.isSupportsArchitecture());

        String displayName = descriptor.getDisplayName();

        if ((displayName == null) || displayName.equals("")) {
            displayName = StringUtils.deCamelCase(descriptor.getName());
        }

        type.setDisplayName(displayName);

        type.setDiscoveryInterval(descriptor.getDiscoveryInterval());

        type.setCreationData(descriptor.isIsCreationType());

        ConfigurationDescriptor configurationDescriptor = descriptor.getConfiguration();
        ConfigurationDefinition configurationDefinition = ConfigurationMetadataParser.parse(descriptor.getName(),
            configurationDescriptor);
        type.setDeploymentConfigurationDefinition(configurationDefinition);

        return type;
    }
View Full Code Here


            resourceType1 = new ResourceType("platform-" + System.currentTimeMillis(), "TestPlugin",
                ResourceCategory.PLATFORM, null);
            em.persist(resourceType1);

            // Add package types to resource type
            packageType1 = new PackageType();
            packageType1.setName("package1-" + System.currentTimeMillis());
            packageType1.setDescription("");
            packageType1.setCategory(PackageCategory.DEPLOYABLE);
            packageType1.setDisplayName("TestResourcePackage");
            packageType1.setCreationData(true);
            packageType1.setResourceType(resourceType1);
            em.persist(packageType1);

            packageType2 = new PackageType();
            packageType2.setName("package2-" + System.currentTimeMillis());
            packageType2.setDescription("");
            packageType2.setCategory(PackageCategory.DEPLOYABLE);
            packageType2.setDisplayName("TestResourcePackage2");
            packageType2.setCreationData(true);
            packageType2.setResourceType(resourceType1);
            em.persist(packageType2);

            packageType3 = new PackageType();
            packageType3.setName("package3-" + System.currentTimeMillis());
            packageType3.setDescription("");
            packageType3.setCategory(PackageCategory.DEPLOYABLE);
            packageType3.setDisplayName("TestResourcePackage3");
            packageType3.setCreationData(true);
            packageType3.setResourceType(resourceType1);
            em.persist(packageType3);

            packageType4 = new PackageType();
            packageType4.setName("package4-" + System.currentTimeMillis());
            packageType4.setDescription("");
            packageType4.setCategory(PackageCategory.DEPLOYABLE);
            packageType4.setDisplayName("TestResourcePackage4");
            packageType4.setCreationData(true);
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);

            tx.commit();
        } catch (Exception e) {
            if (tx.getStatus() == Status.STATUS_ACTIVE) {
View Full Code Here

            asList("ContentServer4.Content.1", "ContentServer4.Content.2"));
    }

    @Test(groups = { "plugin.metadata", "Content.UpgradePlugin" }, dependsOnMethods = { "upgradeContentPlugin" })
    public void addNewDeploymentConfigurationDefinition() throws Exception {
        PackageType packageType = loadPackageType("ContentServer", "ContentMetadataManagerBeanTestPlugin",
            "ContentServer.Content.1");

        ConfigurationDefinition deploymentConfigDef = packageType.getDeploymentConfigurationDefinition();

        assertNotNull(
            "Failed to create new deployment configuration definition for package type that previously did not have one",
            deploymentConfigDef);
        assertEquals("Expected to find 1 property definition in new deployment configuration definition", 1,
View Full Code Here

            deploymentConfigDef.get("version"));
    }

    @Test(groups = { "plugin.metadata", "Content.UpgradePlugin" }, dependsOnMethods = { "upgradeContentPlugin" })
    public void updateDeploymentConfigDefThatExistsInOldAndNewResourceType() throws Exception {
        PackageType packageType = loadPackageType("ContentServer5", "ContentMetadataManagerBeanTestPlugin",
            "ContentServer5.Content.1");
        ConfigurationDefinition deploymentConfigDef = packageType.getDeploymentConfigurationDefinition();

        assertNotNull("Failed to update deployment configuration definition for package type", deploymentConfigDef);
        assertEquals("Expected to find 2 property definitions in updated deployment configuration definition", 2,
            deploymentConfigDef.getPropertyDefinitions().size());
        assertNotNull("Expected existing property definition to be retained across update",
View Full Code Here

        assertNotNull("Expected new property definition to be added during update", deploymentConfigDef.get("y"));
    }

    @Test(groups = { "plugin.metadata", "Content.UpgradePlugin" }, dependsOnMethods = { "upgradeContentPlugin" })
    public void deleteDeploymentConfigDefThatIsRemovedInNewResourceType() {
        PackageType packageType = loadPackageType("ContentServer5", "ContentMetadataManagerBeanTestPlugin",
            "ContentServer5.Content.2");

        assertNull(
            "Expected deployment configuration definition to be removed since it was removed from new resource type",
            packageType.getDeploymentConfigurationDefinition());
    }
View Full Code Here

    @Test(enabled = ENABLE_TESTS)
    public void testPersistSafely() throws Throwable {

        final String pkgName = "testPersistSafelyPackage";
        final String pvName = "testPersistSafelyPackageVersion version";
        final PackageType pkgType = packageType1;
        final Architecture arch = architecture1;

        // these will not have any JPA stubs inside them (i.e. no lazy exceptions will occur with these)
        Package pkgPojo = new Package(pkgName, pkgType);
        PackageVersion pvPojo = new PackageVersion(pkgPojo, pvName, arch);
View Full Code Here

            resourceType1 = new ResourceType("resourcetype-" + System.currentTimeMillis(), "TestPlugin",
                ResourceCategory.PLATFORM, null);
            em.persist(resourceType1);

            // Add package types to resource type
            packageType1 = new PackageType();
            packageType1.setName("package1-" + System.currentTimeMillis());
            packageType1.setDescription("");
            packageType1.setCategory(PackageCategory.DEPLOYABLE);
            packageType1.setDisplayName("TestResourcePackage");
            packageType1.setCreationData(true);
            packageType1.setResourceType(resourceType1);
            em.persist(packageType1);

            packageType2 = new PackageType();
            packageType2.setName("package2-" + System.currentTimeMillis());
            packageType2.setDescription("");
            packageType2.setCategory(PackageCategory.DEPLOYABLE);
            packageType2.setDisplayName("TestResourcePackage2");
            packageType2.setCreationData(true);
            packageType2.setResourceType(resourceType1);
            em.persist(packageType2);

            packageType3 = new PackageType();
            packageType3.setName("package3-" + System.currentTimeMillis());
            packageType3.setDescription("");
            packageType3.setCategory(PackageCategory.DEPLOYABLE);
            packageType3.setDisplayName("TestResourcePackage3");
            packageType3.setCreationData(true);
            packageType3.setResourceType(resourceType1);
            em.persist(packageType3);

            packageType4 = new PackageType();
            packageType4.setName("package4-" + System.currentTimeMillis());
            packageType4.setDescription("");
            packageType4.setCategory(PackageCategory.DEPLOYABLE);
            packageType4.setDisplayName("TestResourcePackage4");
            packageType4.setCreationData(true);
View Full Code Here

            productVersion2.setVersion("2.0");
            productVersion2.setResourceType(resourceType);
            em.persist(productVersion2);

            // Add package types to resource type
            packageType1 = new PackageType();
            packageType1.setName("package1-" + System.currentTimeMillis());
            packageType1.setDescription("");
            packageType1.setCategory(PackageCategory.DEPLOYABLE);
            packageType1.setDisplayName("TestResourcePackage");
            packageType1.setCreationData(true);
View Full Code Here

        em.flush();

        Architecture architecture1 = em.find(Architecture.class, 1);

        // Add package types to resource type
        packageType1 = new PackageType();
        packageType1.setName("package1-" + System.currentTimeMillis());
        packageType1.setDescription("");
        packageType1.setCategory(PackageCategory.DEPLOYABLE);
        packageType1.setDisplayName("TestResourcePackage");
        packageType1.setCreationData(true);
View Full Code Here

TOP

Related Classes of org.rhq.core.domain.content.PackageType

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.