Examples of PackageSyncReport


Examples of org.rhq.enterprise.server.plugin.pc.content.PackageSyncReport

            repo = repoManager.createRepo(overlord, repo);
            repoId = repo.getId();

            // this report will add a mapping to PV->CS
            // we didn't set up any mappings like that yet - this will be the first one
            PackageSyncReport report = new PackageSyncReport();
            ContentProviderPackageDetailsKey key = new ContentProviderPackageDetailsKey("testCreateContentSourceFoo",
                "testCreateContentSourceVer", packageType1.getName(), architecture1.getName(), resourceType1.getName(),
                resourceType1.getPlugin());
            ContentProviderPackageDetails details = new ContentProviderPackageDetails(key);
            details.setLocation("dummy-location");
            details.setMetadata("dummy-metadata".getBytes());
            details.addResourceVersion("1.0.0");
            details.addResourceVersion("2.0.0");
            report.addNewPackage(details);
            Map<ContentProviderPackageDetailsKey, PackageVersionContentSource> previous;
            previous = new HashMap<ContentProviderPackageDetailsKey, PackageVersionContentSource>();

            // merge the report!
            RepoSyncResults results = new RepoSyncResults(repo);
View Full Code Here

Examples of org.rhq.enterprise.server.plugin.pc.content.PackageSyncReport

            RepoSyncResults results = new RepoSyncResults(repo);
            results = repoManager.persistRepoSyncResults(results);
            assert results != null;

            // this report will add a mapping to PV->CS
            PackageSyncReport report = new PackageSyncReport();
            ContentProviderPackageDetailsKey key = new ContentProviderPackageDetailsKey("testARUFoo", "testARUVer",
                packageType1.getName(), architecture1.getName(), resourceType1.getName(), resourceType1.getPlugin());
            ContentProviderPackageDetails details = new ContentProviderPackageDetails(key);
            details.setLocation("dummy-location-aru");
            details.setFileSize(1234L); // lazy load is on, this should not matter
            report.addNewPackage(details);
            Map<ContentProviderPackageDetailsKey, PackageVersionContentSource> previous;
            previous = new HashMap<ContentProviderPackageDetailsKey, PackageVersionContentSource>();

            // ADD: merge the report!
            results = contentSourceManager.mergePackageSyncReport(contentSource, repo, report, previous, results);
            assert results != null;

            // see the package version has been assigned to the content source
            inCS = contentSourceManager.getPackageVersionsFromContentSource(overlord, contentSourceId, pc);
            assert inCS != null;
            assert inCS.size() == 1 : inCS;

            // confirm that we didn't load the bits yet
            List<PackageVersionContentSource> unloaded;
            unloaded = contentSourceManager.getUnloadedPackageVersionsFromContentSourceInRepo(overlord,
                contentSourceId, repoId, pc);
            assert unloaded != null;
            assert unloaded.size() == 1;

            // check the count
            long pvcscount = contentSourceManager.getPackageVersionCountFromContentSource(overlord, contentSourceId);
            assert (pvcscount == 1) : "-->" + pvcscount;

            // this is the new one we just added - we'll pass this to our next merge as the previous state
            PackageVersionContentSource addedPVCS = unloaded.get(0);
            assert addedPVCS.getPackageVersionContentSourcePK().getPackageVersion().getFileSize() == 1234L;
            previous.put(key, addedPVCS);

            System.out.println("content source merge ADD works!");

            // create a new report that updates the one we just added
            report = new PackageSyncReport();
            details.setFileSize(9999L);
            report.addUpdatedPackage(details);

            // UPDATE: merge the report!
            results = contentSourceManager.mergePackageSyncReport(contentSource, repo, report, previous, results);
            assert results != null;

            // see the package version is still assigned to the content source
            inCS = contentSourceManager.getPackageVersionsFromContentSource(overlord, contentSourceId, pc);
            assert inCS != null;
            assert inCS.size() == 1 : inCS;

            // it should still be unloaded, make sure and check that it really was updated
            unloaded = contentSourceManager.getUnloadedPackageVersionsFromContentSourceInRepo(overlord,
                contentSourceId, repoId, pc);
            assert unloaded != null;
            assert unloaded.size() == 1;
            assert unloaded.get(0).getPackageVersionContentSourcePK().getPackageVersion().getFileSize() == 9999L;

            System.out.println("content source merge UPDATE works!");

            // create a report that removes the one we added/updated, our 'previous' map is still valid
            report = new PackageSyncReport();
            report.addDeletePackage(details);

            // REMOVE: merge the report!
            results = contentSourceManager.mergePackageSyncReport(contentSource, repo, report, previous, results);
            assert results != null;
View Full Code Here

Examples of org.rhq.enterprise.server.plugin.pc.content.PackageSyncReport

            RepoSyncResults results = new RepoSyncResults(repo);
            results = repoManager.persistRepoSyncResults(results);
            assert results != null;

            // this report will add a mapping to PV->CS
            PackageSyncReport report = new PackageSyncReport();
            ContentProviderPackageDetailsKey key = new ContentProviderPackageDetailsKey("testARU2Foo", "testARU2Ver",
                packageType1.getName(), architecture1.getName(), resourceType1.getName(), resourceType1.getPlugin());
            ContentProviderPackageDetails details = new ContentProviderPackageDetails(key);
            details.setLocation("dummy-location-aru");
            report.addNewPackage(details);
            Map<ContentProviderPackageDetailsKey, PackageVersionContentSource> previous;
            previous = new HashMap<ContentProviderPackageDetailsKey, PackageVersionContentSource>();

            // ADD: merge the report!
            results = contentSourceManager.mergePackageSyncReport(contentSource, repo, report, previous, results);
            assert results != null;

            List<PackageVersionContentSource> unloaded;
            unloaded = contentSourceManager.getUnloadedPackageVersionsFromContentSourceInRepo(overlord,
                contentSourceId, repoId, pc);
            assert unloaded != null;
            assert unloaded.size() == 1;

            // check the count to make sure the pv was added to the repo
            assert 1 == contentSourceManager.getPackageVersionCountFromContentSource(overlord, contentSourceId);
            assert 1 == repoManager.getPackageVersionCountFromRepo(overlord, repoId);

            // this is the new one we just added - we'll pass this to our next merge as the previous state
            PackageVersionContentSource addedPVCS = unloaded.get(0);
            previous.put(key, addedPVCS);

            // create a report that removes the one we added
            report = new PackageSyncReport();
            report.addDeletePackage(details);

            // REMOVE: merge the report!
            results = contentSourceManager.mergePackageSyncReport(contentSource, repo, report, previous, results);
            assert results != null;
View Full Code Here

Examples of org.rhq.enterprise.server.plugin.pc.content.PackageSyncReport

            repoManager.addContentSourcesToRepo(overlord, repo.getId(), new int[] { contentSourceId });

            // this report will add a mapping to PV->CS
            // we didn't set up any mappings like that yet - this will be the first one
            // since a repo has this CS - the repo->PV will also get mapped
            PackageSyncReport report = new PackageSyncReport();
            ContentProviderPackageDetailsKey key = new ContentProviderPackageDetailsKey("testMergeWithRepofoo",
                "testMergeWithRepo-Version", packageType1.getName(), architecture1.getName(), resourceType1.getName(),
                resourceType1.getPlugin());
            ContentProviderPackageDetails details = new ContentProviderPackageDetails(key);
            details.setExtraProperties(new Configuration());
            details.getExtraProperties().put(new PropertySimple("hello", "world"));
            details.setLocation("dummy-location");
            details.setFileSize(0L); // under the covers this ends up allowing us to create a package bits of size 0
            report.addNewPackage(details);
            Map<ContentProviderPackageDetailsKey, PackageVersionContentSource> previous;
            previous = new HashMap<ContentProviderPackageDetailsKey, PackageVersionContentSource>();

            RepoSyncResults results = new RepoSyncResults(repo);
            results = repoManager.persistRepoSyncResults(results);
View Full Code Here

Examples of org.rhq.enterprise.server.plugin.pc.content.PackageSyncReport

        // Ask source to do the sync
        // --------------------------------------------
        start = System.currentTimeMillis();

        PackageSyncReport report = new PackageSyncReport();
        packageSource.synchronizePackages(repo.getName(), report, allDetails);
        tracker.setPackageSyncCount(report.getNewPackages().size() + report.getUpdatedPackages().size());

        log.info("Synchronize Packages: [" + source.getName() + "]: got sync report from adapter=[" + report + "] ("
            + (System.currentTimeMillis() - start) + ")ms.  Have: " + tracker.getPackageSyncCount()
            + " packages to sync");
View Full Code Here

Examples of org.rhq.enterprise.server.plugin.pc.content.PackageSyncReport

        // Setup
        JBossSoftwareContentSourceAdapter adapter = new JBossSoftwareContentSourceAdapter();
        adapter.initialize(CONFIGURATION);

        // Test
        PackageSyncReport report = new PackageSyncReport();

        adapter.synchronizePackages(null, report, null);

        // Verify
        assert report.getNewPackages().size() > 0 : "No packages were parsed from the live feed";

        log.info("Number of new packages found in liveConnection: " + report.getNewPackages().size());
    }
View Full Code Here

Examples of org.rhq.enterprise.server.plugin.pc.content.PackageSyncReport

        // Setup
        JBossSoftwareContentSourceAdapter adapter = new JBossSoftwareContentSourceAdapter();
        adapter.initialize(PROXY_CONFIGURATION);

        // Test
        PackageSyncReport report = new PackageSyncReport();

        adapter.synchronizePackages(null, report, null);

        // Verify
        assert report.getNewPackages().size() > 0 : "No packages were parsed from the live feed";

        log.info("Number of new packages found in proxyConnection: " + report.getNewPackages().size());
    }
View Full Code Here

Examples of org.rhq.enterprise.server.plugin.pc.content.PackageSyncReport

        // Setup
        JBossSoftwareContentSourceAdapter adapter = new JBossSoftwareContentSourceAdapter();
        adapter.initialize(AUTHENTICATING_PROXY_CONFIGURATION);

        // Test
        PackageSyncReport report = new PackageSyncReport();

        adapter.synchronizePackages(null, report, null);

        // Verify
        assert report.getNewPackages().size() > 0 : "No packages were parsed from the live feed";

        log.info("Number of new packages found in proxyConnection: " + report.getNewPackages().size());
    }
View Full Code Here

Examples of org.rhq.enterprise.server.plugin.pc.content.PackageSyncReport

        JBossSoftwareContentSourceAdapter adapter = new JBossSoftwareContentSourceAdapter();
        adapter.initialize(invalidLoginConfiguration);

        // Test
        PackageSyncReport report = new PackageSyncReport();

        try {
            adapter.synchronizePackages(null, report, null);
        }
        catch (Exception e) {
View Full Code Here

Examples of org.rhq.enterprise.server.plugin.pc.content.PackageSyncReport

        JBossSoftwareContentSourceAdapter adapter = new JBossSoftwareContentSourceAdapter();
        adapter.initialize(invalidUrlConfiguration);

        // Test
        PackageSyncReport report = new PackageSyncReport();

        try {
            adapter.synchronizePackages(null, report, null);
        }
        catch (Exception e) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.