Package org.apache.maven.archiva.model

Examples of org.apache.maven.archiva.model.RepositoryContentStatistics


        assertNotNull( "Stats: results (not null)", results );
        assertEquals( "Stats: results.size", 1, results.size() );

        Object o = results.get( 0 );
        assertTrue( "Stats: result[0] instanceof RepositoryScanStatistics", o instanceof RepositoryContentStatistics );
        RepositoryContentStatistics stats = (RepositoryContentStatistics) o;
        assertEquals( "Stats: id", "internal", stats.getRepositoryId() );
        assertEquals( "Stats: when gathered", "2007/02/21 10:00:00", fromDate( stats.getWhenGathered() ) );
        assertEquals( "Stats: duration", 20000, stats.getDuration() );
        assertEquals( "Stats: total file count", 12000, stats.getTotalFileCount() );
        assertEquals( "Stats: new file count", 400, stats.getNewFileCount() );
    }
View Full Code Here


                      unprocessedResultList.size() );

        // check correctness of new stats
        List<RepositoryContentStatistics> results =
            (List<RepositoryContentStatistics>) dao.query( new MostRecentRepositoryScanStatistics( TEST_REPO_ID ) );
        RepositoryContentStatistics newStats = results.get( 0 );
        assertEquals( 0, newStats.getNewFileCount() );
        assertEquals( TEST_REPO_ID, newStats.getRepositoryId() );
        assertEquals( 31, newStats.getTotalFileCount() );
        // TODO: can't test these as they weren't stored in the database
//        assertEquals( 8, newStats.getTotalArtifactCount() );
//        assertEquals( 3, newStats.getTotalGroupCount() );
//        assertEquals( 5, newStats.getTotalProjectCount() );
        assertEquals( 14159, newStats.getTotalSize() );

        File newArtifactGroup = new File( repoDir, "org/apache/archiva" );

        FileUtils.copyDirectoryStructure( new File( getBasedir(), "target/test-classes/test-repo/org/apache/archiva" ),
                                          newArtifactGroup );

        // update last modified date
        new File( newArtifactGroup, "archiva-index-methods-jar-test/1.0/pom.xml" ).setLastModified(
            Calendar.getInstance().getTimeInMillis() + 1000 );
        new File( newArtifactGroup,
                  "archiva-index-methods-jar-test/1.0/archiva-index-methods-jar-test-1.0.jar" ).setLastModified(
            Calendar.getInstance().getTimeInMillis() + 1000 );

        assertTrue( newArtifactGroup.exists() );

        taskExecutor.executeTask( repoTask );

        unprocessedResultList = adao.queryArtifacts( new ArtifactsProcessedConstraint( false ) );
        assertNotNull( unprocessedResultList );
        assertEquals( "Incorrect number of unprocessed artifacts detected. One new artifact should have been found.", 1,
                      unprocessedResultList.size() );

        // check correctness of new stats
        results =
            (List<RepositoryContentStatistics>) dao.query( new MostRecentRepositoryScanStatistics( TEST_REPO_ID ) );
        RepositoryContentStatistics updatedStats = results.get( 0 );
        assertEquals( 2, updatedStats.getNewFileCount() );
        assertEquals( TEST_REPO_ID, updatedStats.getRepositoryId() );
        assertEquals( 33, updatedStats.getTotalFileCount() );
        // TODO: can't test these as they weren't stored in the database
//        assertEquals( 8, newStats.getTotalArtifactCount() );
//        assertEquals( 3, newStats.getTotalGroupCount() );
//        assertEquals( 5, newStats.getTotalProjectCount() );
        assertEquals( 19301, updatedStats.getTotalSize() );
    }
View Full Code Here

                      unprocessedResultList.size() );

        // check correctness of new stats
        List<RepositoryContentStatistics> results =
            (List<RepositoryContentStatistics>) dao.query( new MostRecentRepositoryScanStatistics( TEST_REPO_ID ) );
        RepositoryContentStatistics newStats = results.get( 0 );
        assertEquals( 2, newStats.getNewFileCount() );
        assertEquals( TEST_REPO_ID, newStats.getRepositoryId() );
        assertEquals( 33, newStats.getTotalFileCount() );
        // TODO: can't test these as they weren't stored in the database
//        assertEquals( 8, newStats.getTotalArtifactCount() );
//        assertEquals( 3, newStats.getTotalGroupCount() );
//        assertEquals( 5, newStats.getTotalProjectCount() );
        assertEquals( 19301, newStats.getTotalSize() );
    }
View Full Code Here

                      unprocessedResultList.size() );

        // check correctness of new stats
        List<RepositoryContentStatistics> results =
            (List<RepositoryContentStatistics>) dao.query( new MostRecentRepositoryScanStatistics( TEST_REPO_ID ) );
        RepositoryContentStatistics newStats = results.get( 0 );
        assertEquals( 2, newStats.getNewFileCount() );
        assertEquals( TEST_REPO_ID, newStats.getRepositoryId() );
        assertEquals( 33, newStats.getTotalFileCount() );
        // TODO: can't test these as they weren't stored in the database
//        assertEquals( 8, newStats.getTotalArtifactCount() );
//        assertEquals( 3, newStats.getTotalGroupCount() );
//        assertEquals( 5, newStats.getTotalProjectCount() );
        assertEquals( 19301, newStats.getTotalSize() );
    }
View Full Code Here

        assertEquals( 19301, newStats.getTotalSize() );
    }

    private void createAndSaveTestStats()
    {
        RepositoryContentStatistics stats = new RepositoryContentStatistics();
        stats.setDuration( 1234567 );
        stats.setNewFileCount( 31 );
        stats.setRepositoryId( TEST_REPO_ID );
        stats.setTotalArtifactCount( 8 );
        stats.setTotalFileCount( 31 );
        stats.setTotalGroupCount( 3 );
        stats.setTotalProjectCount( 5 );
        stats.setTotalSize( 14159 );
        stats.setWhenGathered( Calendar.getInstance().getTime() );

        dao.getRepositoryContentStatisticsDAO().saveRepositoryContentStatistics( stats );
    }
View Full Code Here

        RepositoryTask repoTask = new RepositoryTask();

        repoTask.setRepositoryId( TEST_REPO_ID );
        repoTask.setScanAll( true );

        RepositoryContentStatistics stats = new RepositoryContentStatistics();
        stats.setDuration( 1234567 );
        stats.setNewFileCount( 8 );
        stats.setRepositoryId( TEST_REPO_ID );
        stats.setTotalArtifactCount( 8 );
        stats.setTotalFileCount( 8 );
        stats.setTotalGroupCount( 3 );
        stats.setTotalProjectCount( 5 );
        stats.setTotalSize( 999999 );
        stats.setWhenGathered( Calendar.getInstance().getTime() );

        dao.getRepositoryContentStatisticsDAO().saveRepositoryContentStatistics( stats );

        taskExecutor.executeTask( repoTask );
View Full Code Here

        InvalidScanConsumer badconsumer = new InvalidScanConsumer();
        invalidConsumers.add( badconsumer );

        RepositoryScanner scanner = lookupRepositoryScanner();

        RepositoryContentStatistics stats = scanner.scan( repository, knownConsumers, invalidConsumers, getIgnoreList(),
                                                          getTimestampAsMillis( "20061101.000000" ) );

        assertNotNull( "Stats should not be null.", stats );
        assertEquals( "Stats.totalFileCount", 4, stats.getTotalFileCount() );
        assertEquals( "Stats.newFileCount", 3, stats.getNewFileCount() );
        assertEquals( "Processed Count", 2, consumer.getProcessCount() );
        assertEquals( "Processed Count (of invalid items)", 1, badconsumer.getProcessCount() );
    }
View Full Code Here

        List<InvalidRepositoryContentConsumer> invalidConsumers = new ArrayList<InvalidRepositoryContentConsumer>();
        InvalidScanConsumer badconsumer = new InvalidScanConsumer();
        invalidConsumers.add( badconsumer );

        RepositoryScanner scanner = lookupRepositoryScanner();
        RepositoryContentStatistics stats =
            scanner.scan( repository, knownConsumers, invalidConsumers, getIgnoreList(), RepositoryScanner.FRESH_SCAN );

        assertNotNull( "Stats should not be null.", stats );
        assertEquals( "Stats.totalFileCount", 4, stats.getTotalFileCount() );
        assertEquals( "Stats.newFileCount", 4, stats.getNewFileCount() );
        assertEquals( "Processed Count", 3, consumer.getProcessCount() );
        assertEquals( "Processed Count (of invalid items)", 1, badconsumer.getProcessCount() );
    }
View Full Code Here

        List<InvalidRepositoryContentConsumer> invalidConsumers = new ArrayList<InvalidRepositoryContentConsumer>();
        InvalidScanConsumer badconsumer = new InvalidScanConsumer();
        invalidConsumers.add( badconsumer );

        RepositoryScanner scanner = lookupRepositoryScanner();
        RepositoryContentStatistics stats = scanner.scan( repository, knownConsumers, invalidConsumers, getIgnoreList(),
                                                          getTimestampAsMillis( "20061101.000000" ) );

        assertNotNull( "Stats should not be null.", stats );
        assertEquals( "Stats.totalFileCount", 4, stats.getTotalFileCount() );
        assertEquals( "Stats.newFileCount", 3, stats.getNewFileCount() );
        assertEquals( "Processed Count", 3, consumer.getProcessCount() );
        assertEquals( "Processed Count (of invalid items)", 1, badconsumer.getProcessCount() );
    }
View Full Code Here

        List<InvalidRepositoryContentConsumer> invalidConsumers = new ArrayList<InvalidRepositoryContentConsumer>();
        InvalidScanConsumer badconsumer = new InvalidScanConsumer();
        invalidConsumers.add( badconsumer );

        RepositoryScanner scanner = lookupRepositoryScanner();
        RepositoryContentStatistics stats =
            scanner.scan( repository, knownConsumers, invalidConsumers, getIgnoreList(), RepositoryScanner.FRESH_SCAN );

        assertNotNull( "Stats should not be null.", stats );
        assertMinimumHits( "Stats.totalFileCount", 17, stats.getTotalFileCount() );
        assertMinimumHits( "Processed Count", 17, consumer.getProcessCount() );
        assertEquals( "Processed Count (of invalid items)", 6, badconsumer.getProcessCount() );
    }
View Full Code Here

TOP

Related Classes of org.apache.maven.archiva.model.RepositoryContentStatistics

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.