Package org.rhq.core.domain.content

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


    @Override
    public Architecture getNoArchitecture() {
        Query q = entityManager.createNamedQuery(Architecture.QUERY_FIND_BY_NAME);
        q.setParameter("name", "noarch");
        Architecture architecture = (Architecture) q.getSingleResult();

        return architecture;
    }
View Full Code Here


            }

            return existingPackageVersion;
        }

        Architecture architecture = entityManager.find(Architecture.class, architectureId);
        PackageType packageType = entityManager.find(PackageType.class, packageTypeId);

        //check the validity of the provided data
        try {
            PackageTypeBehavior behavior = ContentManagerHelper.getPackageTypeBehavior(packageTypeId);
            ValidatablePackageDetailsKey key = new ValidatablePackageDetailsKey(packageName, version,
                packageType.getName(), architecture.getName());
            behavior.validateDetails(key, subject);

            packageName = key.getName();
            version = key.getVersion();
            if (!architecture.getName().equals(key.getArchitectureName())) {
                Query q = entityManager.createNamedQuery(Architecture.QUERY_FIND_BY_NAME);
                q.setParameter("name", key.getArchitectureName());
                architecture = (Architecture) q.getSingleResult();
            }
        } catch (PackageDetailsValidationException e) {
View Full Code Here

        //default version to 1.0 if is null, not provided for any reason.
        if ((version == null) || (version.trim().length() == 0)) {
            version = "1.0";
        }

        Architecture architecture = entityManager.find(Architecture.class, architectureId);
        PackageType packageType = entityManager.find(PackageType.class, packageTypeId);

        // See if package version already exists for the resource package
        Query packageVersionQuery = null;

        if (packageType.getResourceType() != null) {
            packageVersionQuery = entityManager
                .createNamedQuery(PackageVersion.QUERY_FIND_BY_PACKAGE_DETAILS_KEY_WITH_NON_NULL_RESOURCE_TYPE);
            packageVersionQuery.setParameter("resourceTypeId", packageType.getResourceType().getId());

        } else {
            packageVersionQuery = entityManager.createNamedQuery(PackageVersion.QUERY_FIND_BY_PACKAGE_DETAILS_KEY);
            packageVersionQuery.setParameter("resourceType", null);
        }

        packageVersionQuery.setFlushMode(FlushModeType.COMMIT);
        packageVersionQuery.setParameter("packageName", packageName);

        packageVersionQuery.setParameter("packageTypeName", packageType.getName());

        packageVersionQuery.setParameter("architectureName", architecture.getName());
        packageVersionQuery.setParameter("version", version);

        // Result of the query should be either 0 or 1
        List<PackageVersion> existingPackageVersionList = packageVersionQuery.getResultList();

        if (existingPackageVersionList.size() > 0) {
            packageVersion = existingPackageVersionList.get(0);
        }

        try {
            PackageTypeBehavior behavior = ContentManagerHelper.getPackageTypeBehavior(packageTypeId);

            if (behavior != null) {
                String packageTypeName = packageType.getName();
                String archName = architecture.getName();
                ValidatablePackageDetailsKey key = new ValidatablePackageDetailsKey(packageName, version,
                    packageTypeName, archName);
                behavior.validateDetails(key, subject);

                //update the details from the validation results
                packageName = key.getName();
                version = key.getVersion();

                if (!architecture.getName().equals(key.getArchitectureName())) {
                    Query q = entityManager.createNamedQuery(Architecture.QUERY_FIND_BY_NAME);
                    q.setParameter("name", key.getArchitectureName());
                    architecture = (Architecture) q.getSingleResult();
                }
            }
View Full Code Here

        when(mockEntityManager.createNamedQuery(eq(PackageVersion.QUERY_FIND_BY_PACKAGE_VER_ARCH))).thenReturn(
            mockQuery);
        List mockList = mock(List.class);
        when(mockQuery.getResultList()).thenReturn(mockList);

        Architecture mockArchitecture = mock(Architecture.class);
        when(mockArchitecture.getName()).thenReturn("ArchitectureName");
        when(mockEntityManager.find(eq(Architecture.class), anyInt())).thenReturn(mockArchitecture);

        PackageType mockPackageType = mock(PackageType.class);
        when(mockEntityManager.find(eq(PackageType.class), eq(1))).thenReturn(mockPackageType);
View Full Code Here

            }
        });

        Package mockPackage = mock(Package.class);
        when(mockPackageVersion.getGeneralPackage()).thenReturn(mockPackage);
        Architecture mockArchitecture = mock(Architecture.class);
        when(mockPackageVersion.getArchitecture()).thenReturn(mockArchitecture);
        when(mockPackageVersion.getExtraProperties()).thenReturn(null);

        //create object to test and inject required dependencies
        ContentManagerBean objectUnderTest = new ContentManagerBean();
View Full Code Here

@Test
public class SerializableTest {
    public void testSerialization() {
        List<Serializable> objects = new ArrayList<Serializable>();
        Serializable[] simpleObjects = new Serializable[] { new AvailabilityReport("fakeAgent"), new PackageType(),
            new Architecture(), new Repo(), new ContentServiceRequest(), new ContentSource(), new ContentSourceType(),
            new InstalledPackage(), new Package(), new PackageInstallationStep(), new PackageType(),
            new PackageVersion() };
        objects.addAll(Arrays.asList(simpleObjects));

        ResourceType resourceType = new ResourceType("name", "plugin", ResourceCategory.PLATFORM, null);
View Full Code Here

        try {

            ResourceType rt = new ResourceType("testCSResourceType", "testPlugin", ResourceCategory.PLATFORM, null);
            Resource resource = new Resource("testCSResource", "testCSResource", rt);
            resource.setUuid("" + new Random().nextInt());
            Architecture arch = new Architecture("testCSInsertArch");
            PackageType pt = new PackageType("testCSInsertPT", resource.getResourceType());
            Package pkg = new Package("testCSInsertPackage", pt);
            PackageVersion pv = new PackageVersion(pkg, "version", arch);
            ContentSourceType cst = new ContentSourceType("testCSContentSourceType");
            ContentSource cs = new ContentSource("testCSContentSource", cst);
View Full Code Here

        getTransactionManager().begin();
        try {
            ResourceType rt = new ResourceType("testCSResourceType", "testPlugin", ResourceCategory.PLATFORM, null);
            Resource resource = new Resource("testCSResource", "testCSResource", rt);
            resource.setUuid("" + new Random().nextInt());
            Architecture arch = new Architecture("testCSInsertArch");
            PackageType pt = new PackageType("testCSInsertPT", resource.getResourceType());
            Package pkg = new Package("testCSInsertPackage", pt);
            PackageVersion pv = new PackageVersion(pkg, "version", arch);
            ContentSourceType cst = new ContentSourceType("testCSContentSourceType");
            cst.setDefaultSyncSchedule(null);
View Full Code Here

        getTransactionManager().begin();
        try {
            ResourceType rt = new ResourceType("testCSResourceType", "testPlugin", ResourceCategory.PLATFORM, null);
            Resource resource = new Resource("testCSResource", "testCSResource", rt);
            resource.setUuid("" + new Random().nextInt());
            Architecture arch = new Architecture("testCSInsertArch");
            PackageType pt = new PackageType("testCSInsertPT", resource.getResourceType());
            Package pkg = new Package("testCSInsertPackage", pt);
            PackageVersion pv = new PackageVersion(pkg, "version", arch);
            ContentSourceType cst = new ContentSourceType("testCSContentSourceType");
            cst.setDefaultSyncSchedule("");
View Full Code Here

            EntityManager em = getEntityManager();

            ResourceType rt = new ResourceType("testCSResourceType", "testPlugin", ResourceCategory.PLATFORM, null);
            Resource resource = new Resource("testCSResource", "testCSResource", rt);
            resource.setUuid("" + new Random().nextInt());
            Architecture arch = new Architecture("testCSInsertArch");
            PackageType pt = new PackageType("testCSInsertPT", resource.getResourceType());
            Package pkg = new Package("testCSInsertPackage", pt);
            PackageVersion pv = new PackageVersion(pkg, "version", arch);
            ContentSourceType cst = new ContentSourceType("testCSContentSourceType");
            ContentSource cs = new ContentSource("testCSContentSource", cst);
View Full Code Here

TOP

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

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.