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(