Package org.apache.maven.archiva.model

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


        List invalidConsumers = new ArrayList();
        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", actualArtifactPaths.size(), stats.getTotalFileCount() );
        assertMinimumHits( "Processed Count", actualArtifactPaths.size(), consumer.getProcessCount() );
    }
View Full Code Here


        List invalidConsumers = new ArrayList();
        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", actualMetadataPaths.size(), stats.getTotalFileCount() );
        assertMinimumHits( "Processed Count", actualMetadataPaths.size(), knownConsumer.getProcessCount() );
    }
View Full Code Here

        List invalidConsumers = new ArrayList();
        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", actualProjectPaths.size(), stats.getTotalFileCount() );
        assertMinimumHits( "Processed Count", actualProjectPaths.size(), consumer.getProcessCount() );
    }
View Full Code Here

        List invalidConsumers = new ArrayList();
        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", actualArtifactPaths.size(), stats.getTotalFileCount() );
        assertMinimumHits( "Processed Count", actualArtifactPaths.size(), consumer.getProcessCount() );
    }
View Full Code Here

        ArtifactDAO artifactDao = dao.getArtifactDAO();   
       
        List<RepositoryStatistics> repoStatisticsList = new ArrayList<RepositoryStatistics>();
        for( int i = start; i <= end; i++ )
        {  
            RepositoryContentStatistics repoContentStat = (RepositoryContentStatistics) repoContentStats.get( i );
            RepositoryStatistics repoStatistics = new RepositoryStatistics();
            repoStatistics.setRepositoryId( repository );
           
            // get only the latest               
            repoStatistics.setArtifactCount( repoContentStat.getTotalArtifactCount() );
            repoStatistics.setGroupCount( repoContentStat.getTotalGroupCount() );
            repoStatistics.setProjectCount( repoContentStat.getTotalProjectCount() );
            repoStatistics.setTotalSize( repoContentStat.getTotalSize() );
            repoStatistics.setFileCount( repoContentStat.getTotalFileCount() );
            repoStatistics.setDateOfScan( repoContentStat.getWhenGathered() );
               
            try
            {
                //TODO use the repo content stats whenGathered date instead of endDate for single repo reports
                List<ArchivaArtifact> types = artifactDao.queryArtifacts(
View Full Code Here

        return (List<RepositoryContentStatistics>) jdo.queryObjects( RepositoryContentStatistics.class, constraint );
    }

    public RepositoryContentStatistics saveRepositoryContentStatistics( RepositoryContentStatistics stats )
    {
        RepositoryContentStatistics savedStats = (RepositoryContentStatistics) jdo.saveObject( stats );
       
        return savedStats;
    }
View Full Code Here

            Assert.assertEquals( RepositoryContentStatistics.class, constraint.getResultClass() );

            List<RepositoryContentStatistics> stats = new ArrayList<RepositoryContentStatistics>();
            for ( String repo : configuration.getConfiguration().getManagedRepositoriesAsMap().keySet() )
            {
                RepositoryContentStatistics statistics = new RepositoryContentStatistics();
                statistics.setRepositoryId( repo );
                stats.add( statistics );
            }
            return stats;
        }
    }
View Full Code Here

            List<RepositoryContentStatistics> results = dao.query( new MostRecentRepositoryScanStatistics( arepo.getId() ) );

            if ( CollectionUtils.isNotEmpty( results ) )
            {
                RepositoryContentStatistics lastStats = results.get( 0 );
                sinceWhen = lastStats.getWhenGathered().getTime() + lastStats.getDuration();
            }

            RepositoryScanStatistics stats = repoScanner.scan( arepo, sinceWhen );

            log.info( "Finished repository task: " + stats.toDump( arepo ) );
           
            // I hate jpox and modello
            RepositoryContentStatistics dbstats = new RepositoryContentStatistics();
            dbstats.setDuration( stats.getDuration() );
            dbstats.setNewFileCount( stats.getNewFileCount() );
            dbstats.setRepositoryId( stats.getRepositoryId() );
            dbstats.setTotalFileCount( stats.getTotalFileCount() );
            dbstats.setWhenGathered( stats.getWhenGathered() );
           
            dao.getRepositoryContentStatisticsDAO().saveRepositoryContentStatistics( dbstats );
        }
        catch ( RepositoryException e )
        {
View Full Code Here

        throws Exception
    {
        RepositoryContentStatisticsDAO repoContentStatisticsDAO = dao.getRepositoryContentStatisticsDAO();

        // create
        RepositoryContentStatistics savedStats =
           repoContentStatisticsDAO.saveRepositoryContentStatistics( createStats( "internal", "2007/10/21 8:00:00",
           20000, 12000, 400 ) );
        assertNotNull( savedStats );

        String savedKeyId = JDOHelper.getObjectId( savedStats ).toString();
        assertEquals( "1[OID]org.apache.maven.archiva.model.RepositoryContentStatistics", savedKeyId );

        // query
        List results =
           repoContentStatisticsDAO.queryRepositoryContentStatistics( new RepositoryContentStatisticsByRepositoryConstraint(
                                                                                                                              "internal" ) );
        assertNotNull( results );
        assertEquals( 1, results.size() );

        RepositoryContentStatistics stats = (RepositoryContentStatistics) results.get( 0 );
        assertEquals( "internal", stats.getRepositoryId() );

        // delete
        repoContentStatisticsDAO.deleteRepositoryContentStatistics( stats );

        assertEquals( 0, repoContentStatisticsDAO.queryRepositoryContentStatistics(
View Full Code Here

    private RepositoryContentStatistics createStats( String repoId, String timestamp, long duration, long totalfiles,
                                                     long newfiles )
        throws Exception
    {
        RepositoryContentStatistics stats = new RepositoryContentStatistics();
        stats.setRepositoryId( repoId );
        stats.setDuration( duration );
        stats.setNewFileCount( newfiles );
        stats.setTotalFileCount( totalfiles );
        stats.setWhenGathered( toDate( timestamp ) );

        return stats;
    }
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.