[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
This commit is contained in:
Maria Odea B. Ching 2010-01-11 10:17:18 +00:00
parent c0a8edaac5
commit 160afaa199
5 changed files with 132 additions and 9 deletions

View File

@ -55,6 +55,8 @@ public class RepositoryStatistics
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;

View File

@ -37,6 +37,14 @@ public interface RepositoryStatisticsReportGenerator
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";

View File

@ -134,6 +134,21 @@ public class SimpleRepositoryStatisticsReportGenerator
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/

View File

@ -160,6 +160,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 );
@ -175,6 +179,18 @@ 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() );
@ -213,6 +233,18 @@ 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 );
@ -256,6 +292,18 @@ 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 );
@ -305,6 +361,18 @@ 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

View File

@ -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>