Package org.rhq.enterprise.server.plugin.pc.content

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


     * @throws Exception if any errors are hit
     */
    @Test
    public void parse() throws Exception {
        // Setup
        PackageSyncReport report = new PackageSyncReport();

        assert rssDocument1 != null : "Rss Document was not read properly in set up";

        // Test #1 - Initial call with no prior server knowledge
        parser.parseResults(rssDocument1, report, null);

        // Verify
        Set<ContentProviderPackageDetails> newPackages = report.getNewPackages();

        assert newPackages.size() == 59 : "Incorrect number of cumulative patches found. Expected: 59, Found: "
            + newPackages.size();
        assert report.getDeletedPackages().size() == 0 : "Incorrect number of deleted packages. Expected: 0, Found: "
            + report.getDeletedPackages().size();
        assert report.getUpdatedPackages().size() == 0 : "Incorrect number of updated packages. Expected: 0, Found: "
            + report.getUpdatedPackages().size();

        int totalNumVersions = 0;
        for (ContentProviderPackageDetails pkg : newPackages) {
            totalNumVersions += pkg.getResourceVersions().size();

            Assert.assertEquals("[sha256=" + pkg.getSHA256() + "]", pkg.getKey().getVersion());
        }

        assert totalNumVersions == 282 : "Incorrect number of total versions represented. Expected: 282, Found: "
            + totalNumVersions;

        // Test #2 - Call again using the previous results as the existing package list, simulating the server passing in
        //           its knowledge of the package list
        report = new PackageSyncReport();
        parser.parseResults(rssDocument1, report, newPackages);

        // Verify
        assert report.getNewPackages().size() == 0 : "New packages incorrectly reported. Expected: 0, Found: "
            + report.getNewPackages().size();
        assert report.getDeletedPackages().size() == 0 : "Incorrect number of deleted packages. Expected: 0, Found: "
            + report.getDeletedPackages().size();
        assert report.getUpdatedPackages().size() == 0 : "Incorrect number of updated packages. Expected: 0, Found: "
            + report.getUpdatedPackages().size();

        // Test #3 - Use second example set to trigger a deleted package
        report = new PackageSyncReport();
        parser.parseResults(rssDocument2, report, newPackages);

        assert report.getNewPackages().size() == 1 : "New packages incorrectly reported. Expected: 1, Found: "
            + report.getNewPackages().size();
        assert report.getDeletedPackages().size() == 1 : "Incorrect number of deleted packages. Expected: 0, Found: "
            + report.getDeletedPackages().size();
        assert report.getUpdatedPackages().size() == 0 : "Incorrect number of updated packages. Expected: 0, Found: "
            + report.getUpdatedPackages().size();

        for (ContentProviderPackageDetails pkg : report.getNewPackages()) {
            Assert.assertEquals("[sha256=" + pkg.getSHA256() + "]", pkg.getKey().getVersion());
        }
    }
View Full Code Here


        // Example set 3
        URL exampleFeedUrl = this.getClass().getClassLoader().getResource(EXAMPLE_FILE_3);
        assert exampleFeedUrl != null : "Could not load " + EXAMPLE_FILE_3;

        // Setup
        PackageSyncReport report = new PackageSyncReport();

        RssDocument rssDocument3 = loadDocument(exampleFeedUrl);

        parser.parseResults(rssDocument3, report, null);

        Set<ContentProviderPackageDetails> newPackages = report.getNewPackages();

        for (Iterator iterator = newPackages.iterator(); iterator.hasNext();) {
            ContentProviderPackageDetails contentSourcePackageDetails = (ContentProviderPackageDetails) iterator.next();
            String installIns = new String(contentSourcePackageDetails.getMetadata());
View Full Code Here

    @Test
    public void noPackageDiscoveredOnDisk() throws Exception {

        //set all the method call arguments
        String repoName = "testRepo";
        PackageSyncReport mockPackageSyncReport = mock(PackageSyncReport.class);
        Collection<ContentProviderPackageDetails> mockCollection = mock(Collection.class);

        //tell the method story as it happens: mock dependencies and configure
        //those dependencies to get the method under test to completion.
        Configuration mockConfiguration = mock(Configuration.class);
View Full Code Here

    @Test
    public void onePackageDiscoveredOnDisk() throws Exception {

        //set all the method call arguments
        String repoName = "testRepo";
        PackageSyncReport mockPackageSyncReport = mock(PackageSyncReport.class);
        Collection<ContentProviderPackageDetails> mockCollection = mock(Collection.class);

        //tell the method story as it happens: mock dependencies and configure
        //those dependencies to get the method under test to completion.
        Configuration mockConfiguration = mock(Configuration.class);
View Full Code Here

    @Test
    public void onePackageDiscoveredOnDiskWithRedundantSubfolder() throws Exception {

        //set all the method call arguments
        String repoName = "testRepo";
        PackageSyncReport mockPackageSyncReport = mock(PackageSyncReport.class);
        Collection<ContentProviderPackageDetails> mockCollection = mock(Collection.class);

        //tell the method story as it happens: mock dependencies and configure
        //those dependencies to get the method under test to completion.
        Configuration mockConfiguration = mock(Configuration.class);
View Full Code Here

TOP

Related Classes of org.rhq.enterprise.server.plugin.pc.content.PackageSyncReport

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.