diff options
author | Maria Odea B. Ching <oching@apache.org> | 2010-01-11 10:17:18 +0000 |
---|---|---|
committer | Maria Odea B. Ching <oching@apache.org> | 2010-01-11 10:17:18 +0000 |
commit | 160afaa19970cff285ba5014f62da0d8d5cacf5c (patch) | |
tree | e4c3b7414de6072c346b5bd294075a155200ea2e /archiva-modules | |
parent | c0a8edaac5292a246e28d5012efcb6161f0f2f06 (diff) | |
download | archiva-160afaa19970cff285ba5014f62da0d8d5cacf5c.tar.gz archiva-160afaa19970cff285ba5014f62da0d8d5cacf5c.zip |
[MRM-1185] Archiva Reporting Modification Request
submitted by Maria Catherine Tan
o add ears, dlls, exes and zips count to generated repo statistics report
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@897827 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'archiva-modules')
5 files changed, 132 insertions, 9 deletions
diff --git a/archiva-modules/archiva-reporting/archiva-report-manager/src/main/java/org/apache/maven/archiva/reporting/RepositoryStatistics.java b/archiva-modules/archiva-reporting/archiva-report-manager/src/main/java/org/apache/maven/archiva/reporting/RepositoryStatistics.java index 5427440db..ab99e2aa5 100644 --- a/archiva-modules/archiva-reporting/archiva-report-manager/src/main/java/org/apache/maven/archiva/reporting/RepositoryStatistics.java +++ b/archiva-modules/archiva-reporting/archiva-report-manager/src/main/java/org/apache/maven/archiva/reporting/RepositoryStatistics.java @@ -52,9 +52,11 @@ public class RepositoryStatistics private long dllCount = 0; private long exeCount = 0; - + private long pomCount = 0; - + + private long zipCount = 0; + private long deploymentCount = 0; private long downloadCount = 0; @@ -201,6 +203,16 @@ public class RepositoryStatistics this.pomCount = pomCount; } + public long getZipCount() + { + return zipCount; + } + + public void setZipCount( long zipCount ) + { + this.zipCount = zipCount; + } + public long getDeploymentCount() { return deploymentCount; diff --git a/archiva-modules/archiva-reporting/archiva-report-manager/src/main/java/org/apache/maven/archiva/reporting/RepositoryStatisticsReportGenerator.java b/archiva-modules/archiva-reporting/archiva-report-manager/src/main/java/org/apache/maven/archiva/reporting/RepositoryStatisticsReportGenerator.java index 27569efea..083e3ac1f 100644 --- a/archiva-modules/archiva-reporting/archiva-report-manager/src/main/java/org/apache/maven/archiva/reporting/RepositoryStatisticsReportGenerator.java +++ b/archiva-modules/archiva-reporting/archiva-report-manager/src/main/java/org/apache/maven/archiva/reporting/RepositoryStatisticsReportGenerator.java @@ -36,7 +36,15 @@ public interface RepositoryStatisticsReportGenerator public static final String WAR_TYPE = "war"; public static final String POM_TYPE = "pom"; - + + public static final String EAR_TYPE = "ear"; + + public static final String DLL_TYPE = "dll"; + + public static final String EXE_TYPE = "exe"; + + public static final String ZIP_TYPE = "distribution-zip"; + public static final String MAVEN_PLUGIN = "maven-plugin"; public static final String ARCHETYPE = "archetype"; diff --git a/archiva-modules/archiva-reporting/archiva-report-manager/src/main/java/org/apache/maven/archiva/reporting/SimpleRepositoryStatisticsReportGenerator.java b/archiva-modules/archiva-reporting/archiva-report-manager/src/main/java/org/apache/maven/archiva/reporting/SimpleRepositoryStatisticsReportGenerator.java index 21db21184..6d958815f 100644 --- a/archiva-modules/archiva-reporting/archiva-report-manager/src/main/java/org/apache/maven/archiva/reporting/SimpleRepositoryStatisticsReportGenerator.java +++ b/archiva-modules/archiva-reporting/archiva-report-manager/src/main/java/org/apache/maven/archiva/reporting/SimpleRepositoryStatisticsReportGenerator.java @@ -133,7 +133,22 @@ public class SimpleRepositoryStatisticsReportGenerator types = artifactDao.queryArtifacts( new ArtifactsByRepositoryConstraint( repository, MAVEN_PLUGIN, endDate, "whenGathered" ) ); repoStatistics.setPluginCount( types.size() ); - + + types = artifactDao.queryArtifacts( + new ArtifactsByRepositoryConstraint( repository, EAR_TYPE, endDate, "whenGathered" ) ); + repoStatistics.setEarCount( types.size() ); + + types = artifactDao.queryArtifacts( + new ArtifactsByRepositoryConstraint( repository, DLL_TYPE, endDate, "whenGathered" ) ); + repoStatistics.setDllCount( types.size() ); + + types = artifactDao.queryArtifacts( + new ArtifactsByRepositoryConstraint( repository, EXE_TYPE, endDate, "whenGathered" ) ); + repoStatistics.setExeCount( types.size() ); + + types = artifactDao.queryArtifacts( + new ArtifactsByRepositoryConstraint( repository, ZIP_TYPE, endDate, "whenGathered" ) ); + repoStatistics.setZipCount( types.size() ); // TODO: must need to be able to track archetypes. possible way of identifying an // archetype is by checking if archetype.xml exists in src/main/resources/META-INF/ diff --git a/archiva-modules/archiva-reporting/archiva-report-manager/src/test/java/org/apache/maven/archiva/reporting/SimpleRepositoryStatisticsReportGeneratorTest.java b/archiva-modules/archiva-reporting/archiva-report-manager/src/test/java/org/apache/maven/archiva/reporting/SimpleRepositoryStatisticsReportGeneratorTest.java index c5bedea3e..45aae75e4 100644 --- a/archiva-modules/archiva-reporting/archiva-report-manager/src/test/java/org/apache/maven/archiva/reporting/SimpleRepositoryStatisticsReportGeneratorTest.java +++ b/archiva-modules/archiva-reporting/archiva-report-manager/src/test/java/org/apache/maven/archiva/reporting/SimpleRepositoryStatisticsReportGeneratorTest.java @@ -160,7 +160,11 @@ public class SimpleRepositoryStatisticsReportGeneratorTest List<ArchivaArtifact> jarArtifacts = createArtifacts( RepositoryStatisticsReportGenerator.JAR_TYPE ); List<ArchivaArtifact> warArtifacts = createArtifacts( RepositoryStatisticsReportGenerator.WAR_TYPE ); List<ArchivaArtifact> mavenPlugins = createArtifacts( RepositoryStatisticsReportGenerator.MAVEN_PLUGIN ); - + List<ArchivaArtifact> exeArtifacts = createArtifacts( RepositoryStatisticsReportGenerator.EXE_TYPE ); + List<ArchivaArtifact> earArtifacts = createArtifacts( RepositoryStatisticsReportGenerator.EAR_TYPE ); + List<ArchivaArtifact> dllArtifacts = createArtifacts( RepositoryStatisticsReportGenerator.DLL_TYPE ); + List<ArchivaArtifact> zipArtifacts = createArtifacts( RepositoryStatisticsReportGenerator.ZIP_TYPE ); + List<RepositoryContentStatistics> repoContentStats = createStatisticsHistoryForSingleRepositoryTest( REPO ); // get first page @@ -174,7 +178,19 @@ public class SimpleRepositoryStatisticsReportGeneratorTest artifactDaoControl.expectAndReturn( artifactDao.queryArtifacts( new ArtifactsByRepositoryConstraint( REPO, RepositoryStatisticsReportGenerator.MAVEN_PLUGIN, endDate, "whenGathered") ), mavenPlugins, 5 ); - + + artifactDaoControl.expectAndReturn( artifactDao.queryArtifacts( + new ArtifactsByRepositoryConstraint( REPO, RepositoryStatisticsReportGenerator.EAR_TYPE, endDate, "whenGathered" ) ), earArtifacts, 5 ); + + artifactDaoControl.expectAndReturn( artifactDao.queryArtifacts( + new ArtifactsByRepositoryConstraint( REPO, RepositoryStatisticsReportGenerator.EXE_TYPE, endDate, "whenGathered" ) ), exeArtifacts, 5 ); + + artifactDaoControl.expectAndReturn( artifactDao.queryArtifacts( + new ArtifactsByRepositoryConstraint( REPO, RepositoryStatisticsReportGenerator.DLL_TYPE, endDate, "whenGathered" ) ), dllArtifacts, 5 ); + + artifactDaoControl.expectAndReturn( artifactDao.queryArtifacts( + new ArtifactsByRepositoryConstraint( REPO, RepositoryStatisticsReportGenerator.ZIP_TYPE, endDate, "whenGathered" ) ), zipArtifacts, 5 ); + daoControl.replay(); artifactDaoControl.replay(); @@ -191,6 +207,10 @@ public class SimpleRepositoryStatisticsReportGeneratorTest assertEquals( 5, stats.getJarCount() ); assertEquals( 5, stats.getWarCount() ); assertEquals( 5, stats.getPluginCount() ); + assertEquals( 5, stats.getEarCount() ); + assertEquals( 5, stats.getExeCount() ); + assertEquals( 5, stats.getDllCount() ); + assertEquals( 5, stats.getZipCount() ); assertEquals( toDate( 2008, 11, 1, 0, 0, 0 ).getTime(), stats.getDateOfScan().getTime() ); assertEquals( toDate( 2008, 9, 1, 0, 0, 0 ).getTime(), ( (RepositoryStatistics) data.get( 4 ) ).getDateOfScan().getTime() ); @@ -212,7 +232,19 @@ public class SimpleRepositoryStatisticsReportGeneratorTest artifactDaoControl.expectAndReturn( artifactDao.queryArtifacts( new ArtifactsByRepositoryConstraint( REPO, RepositoryStatisticsReportGenerator.MAVEN_PLUGIN, endDate, "whenGathered") ), mavenPlugins ); - + + artifactDaoControl.expectAndReturn( artifactDao.queryArtifacts( + new ArtifactsByRepositoryConstraint( REPO, RepositoryStatisticsReportGenerator.EAR_TYPE, endDate, "whenGathered" ) ), earArtifacts ); + + artifactDaoControl.expectAndReturn( artifactDao.queryArtifacts( + new ArtifactsByRepositoryConstraint( REPO, RepositoryStatisticsReportGenerator.EXE_TYPE, endDate, "whenGathered" ) ), exeArtifacts ); + + artifactDaoControl.expectAndReturn( artifactDao.queryArtifacts( + new ArtifactsByRepositoryConstraint( REPO, RepositoryStatisticsReportGenerator.DLL_TYPE, endDate, "whenGathered" ) ), dllArtifacts ); + + artifactDaoControl.expectAndReturn( artifactDao.queryArtifacts( + new ArtifactsByRepositoryConstraint( REPO, RepositoryStatisticsReportGenerator.ZIP_TYPE, endDate, "whenGathered" ) ), zipArtifacts ); + daoControl.replay(); artifactDaoControl.replay(); @@ -241,6 +273,10 @@ public class SimpleRepositoryStatisticsReportGeneratorTest List<ArchivaArtifact> jarArtifacts = createArtifacts( RepositoryStatisticsReportGenerator.JAR_TYPE ); List<ArchivaArtifact> warArtifacts = createArtifacts( RepositoryStatisticsReportGenerator.WAR_TYPE ); List<ArchivaArtifact> mavenPlugins = createArtifacts( RepositoryStatisticsReportGenerator.MAVEN_PLUGIN ); + List<ArchivaArtifact> exeArtifacts = createArtifacts( RepositoryStatisticsReportGenerator.EXE_TYPE ); + List<ArchivaArtifact> earArtifacts = createArtifacts( RepositoryStatisticsReportGenerator.EAR_TYPE ); + List<ArchivaArtifact> dllArtifacts = createArtifacts( RepositoryStatisticsReportGenerator.DLL_TYPE ); + List<ArchivaArtifact> zipArtifacts = createArtifacts( RepositoryStatisticsReportGenerator.ZIP_TYPE ); List<RepositoryContentStatistics> repoContentStats = createStatisticsHistoryForSingleRepositoryTest( REPO ); @@ -255,7 +291,19 @@ public class SimpleRepositoryStatisticsReportGeneratorTest artifactDaoControl.expectAndReturn( artifactDao.queryArtifacts( new ArtifactsByRepositoryConstraint( REPO, RepositoryStatisticsReportGenerator.MAVEN_PLUGIN, endDate, "whenGathered") ), mavenPlugins, 21 ); - + + artifactDaoControl.expectAndReturn( artifactDao.queryArtifacts( + new ArtifactsByRepositoryConstraint( REPO, RepositoryStatisticsReportGenerator.EAR_TYPE, endDate, "whenGathered" ) ), earArtifacts, 21 ); + + artifactDaoControl.expectAndReturn( artifactDao.queryArtifacts( + new ArtifactsByRepositoryConstraint( REPO, RepositoryStatisticsReportGenerator.EXE_TYPE, endDate, "whenGathered" ) ), exeArtifacts, 21 ); + + artifactDaoControl.expectAndReturn( artifactDao.queryArtifacts( + new ArtifactsByRepositoryConstraint( REPO, RepositoryStatisticsReportGenerator.DLL_TYPE, endDate, "whenGathered" ) ), dllArtifacts, 21 ); + + artifactDaoControl.expectAndReturn( artifactDao.queryArtifacts( + new ArtifactsByRepositoryConstraint( REPO, RepositoryStatisticsReportGenerator.ZIP_TYPE, endDate, "whenGathered" ) ), zipArtifacts, 21 ); + daoControl.replay(); artifactDaoControl.replay(); @@ -272,6 +320,10 @@ public class SimpleRepositoryStatisticsReportGeneratorTest assertEquals( 5, stats.getJarCount() ); assertEquals( 5, stats.getWarCount() ); assertEquals( 5, stats.getPluginCount() ); + assertEquals( 5, stats.getEarCount() ); + assertEquals( 5, stats.getExeCount() ); + assertEquals( 5, stats.getDllCount() ); + assertEquals( 5, stats.getZipCount() ); assertEquals( toDate( 2008, 11, 1, 0, 0, 0 ).getTime(), stats.getDateOfScan().getTime() ); assertEquals( toDate( 2008, 1, 1, 0, 0, 0 ).getTime(), ( (RepositoryStatistics) data.get( 20 ) ).getDateOfScan().getTime() ); } @@ -291,6 +343,10 @@ public class SimpleRepositoryStatisticsReportGeneratorTest List<ArchivaArtifact> jarArtifacts = new ArrayList<ArchivaArtifact>(); List<ArchivaArtifact> warArtifacts = new ArrayList<ArchivaArtifact>(); List<ArchivaArtifact> mavenPlugins = new ArrayList<ArchivaArtifact>(); + List<ArchivaArtifact> earArtifacts = new ArrayList<ArchivaArtifact>(); + List<ArchivaArtifact> exeArtifacts = new ArrayList<ArchivaArtifact>(); + List<ArchivaArtifact> dllArtifacts = new ArrayList<ArchivaArtifact>(); + List<ArchivaArtifact> zipArtifacts = new ArrayList<ArchivaArtifact>(); List<RepositoryContentStatistics> repoContentStats = createStatisticsHistoryForSingleRepositoryTest( REPO ); @@ -304,7 +360,19 @@ public class SimpleRepositoryStatisticsReportGeneratorTest artifactDaoControl.expectAndReturn( artifactDao.queryArtifacts( new ArtifactsByRepositoryConstraint( REPO, RepositoryStatisticsReportGenerator.MAVEN_PLUGIN, endDate, "whenGathered") ), mavenPlugins, 5 ); - + + artifactDaoControl.expectAndReturn( artifactDao.queryArtifacts( + new ArtifactsByRepositoryConstraint( REPO, RepositoryStatisticsReportGenerator.EAR_TYPE, endDate, "whenGathered" ) ), earArtifacts, 5 ); + + artifactDaoControl.expectAndReturn( artifactDao.queryArtifacts( + new ArtifactsByRepositoryConstraint( REPO, RepositoryStatisticsReportGenerator.EXE_TYPE, endDate, "whenGathered" ) ), exeArtifacts, 5 ); + + artifactDaoControl.expectAndReturn( artifactDao.queryArtifacts( + new ArtifactsByRepositoryConstraint( REPO, RepositoryStatisticsReportGenerator.DLL_TYPE, endDate, "whenGathered" ) ), dllArtifacts, 5 ); + + artifactDaoControl.expectAndReturn( artifactDao.queryArtifacts( + new ArtifactsByRepositoryConstraint( REPO, RepositoryStatisticsReportGenerator.ZIP_TYPE, endDate, "whenGathered" ) ), zipArtifacts, 5 ); + daoControl.replay(); artifactDaoControl.replay(); @@ -321,6 +389,10 @@ public class SimpleRepositoryStatisticsReportGeneratorTest assertEquals( 0, stats.getJarCount() ); assertEquals( 0, stats.getWarCount() ); assertEquals( 0, stats.getPluginCount() ); + assertEquals( 0, stats.getEarCount() ); + assertEquals( 0, stats.getExeCount() ); + assertEquals( 0, stats.getDllCount() ); + assertEquals( 0, stats.getZipCount() ); assertEquals( toDate( 2008, 11, 1, 0, 0, 0 ).getTime(), stats.getDateOfScan().getTime() ); assertEquals( toDate( 2008, 9, 1, 0, 0, 0 ).getTime(), ( (RepositoryStatistics) data.get( 4 ) ).getDateOfScan().getTime() ); // no results found when ArtifactDAO was queried diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/reports/statisticsReport.jsp b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/reports/statisticsReport.jsp index 5e052473e..152cdec39 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/reports/statisticsReport.jsp +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/reports/statisticsReport.jsp @@ -154,6 +154,10 @@ <th>Archetypes</th> <th>Jars</th> <th>Wars</th> + <th>Ears</th> + <th>Exes</th> + <th>Dlls</th> + <th>Zips</th> <th>Deployments</th> <th>Downloads</th> </tr> @@ -170,6 +174,10 @@ <td align="right">${stats.archetypeCount}</td> <td align="right">${stats.jarCount}</td> <td align="right">${stats.warCount}</td> + <td align="right">${stats.earCount}</td> + <td align="right">${stats.exeCount}</td> + <td align="right">${stats.dllCount}</td> + <td align="right">${stats.zipCount}</td> <td align="right">${stats.deploymentCount}</td> <td align="right">${stats.downloadCount}</td> </tr> @@ -191,6 +199,10 @@ <th>Archetypes</th> <th>Jars</th> <th>Wars</th> + <th>Ears</th> + <th>Exes</th> + <th>Dlls</th> + <th>Zips</th> <th>Deployments</th> <th>Downloads</th> </tr> @@ -207,6 +219,10 @@ <td align="right">${stats.archetypeCount}</td> <td align="right">${stats.jarCount}</td> <td align="right">${stats.warCount}</td> + <td align="right">${stats.earCount}</td> + <td align="right">${stats.exeCount}</td> + <td align="right">${stats.dllCount}</td> + <td align="right">${stats.zipCount}</td> <td align="right">${stats.deploymentCount}</td> <td align="right">${stats.downloadCount}</td> </tr> |