aboutsummaryrefslogtreecommitdiffstats
path: root/archiva-modules/plugins/repository-statistics/src
diff options
context:
space:
mode:
authorOlivier Lamy <olamy@apache.org>2012-07-02 07:36:23 +0000
committerOlivier Lamy <olamy@apache.org>2012-07-02 07:36:23 +0000
commit1484a3316addf47d88f4f05191ae4e570871eda7 (patch)
tree596b70b3f0975c00274bc3d2b2580092cc1390f5 /archiva-modules/plugins/repository-statistics/src
parente3885c59da2e4748e2ba494f3901902be0470067 (diff)
downloadarchiva-1484a3316addf47d88f4f05191ae4e570871eda7.tar.gz
archiva-1484a3316addf47d88f4f05191ae4e570871eda7.zip
[MRM-1638] Improve unit test for archiva build
Based on patch provided by Eric Barboni. git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1356091 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'archiva-modules/plugins/repository-statistics/src')
-rw-r--r--archiva-modules/plugins/repository-statistics/src/test/java/org/apache/archiva/metadata/repository/stats/JcrRepositoryStatisticsGatheringTest.java14
-rw-r--r--archiva-modules/plugins/repository-statistics/src/test/java/org/apache/archiva/metadata/repository/stats/RepositoryStatisticsManagerTest.java18
2 files changed, 28 insertions, 4 deletions
diff --git a/archiva-modules/plugins/repository-statistics/src/test/java/org/apache/archiva/metadata/repository/stats/JcrRepositoryStatisticsGatheringTest.java b/archiva-modules/plugins/repository-statistics/src/test/java/org/apache/archiva/metadata/repository/stats/JcrRepositoryStatisticsGatheringTest.java
index b8105daec..9e51faeb9 100644
--- a/archiva-modules/plugins/repository-statistics/src/test/java/org/apache/archiva/metadata/repository/stats/JcrRepositoryStatisticsGatheringTest.java
+++ b/archiva-modules/plugins/repository-statistics/src/test/java/org/apache/archiva/metadata/repository/stats/JcrRepositoryStatisticsGatheringTest.java
@@ -39,9 +39,14 @@ import java.io.IOException;
import java.util.Calendar;
import java.util.Date;
import java.util.zip.GZIPInputStream;
+import org.apache.archiva.test.ArchivaBlockJUnit4ClassRunner;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
import static org.mockito.Mockito.*;
-
+@RunWith( ArchivaBlockJUnit4ClassRunner.class )
public class JcrRepositoryStatisticsGatheringTest
extends TestCase
{
@@ -58,7 +63,8 @@ public class JcrRepositoryStatisticsGatheringTest
private Session session;
@Override
- protected void setUp()
+ @Before
+ public void setUp()
throws Exception
{
super.setUp();
@@ -100,7 +106,8 @@ public class JcrRepositoryStatisticsGatheringTest
}
@Override
- protected void tearDown()
+ @After
+ public void tearDown()
throws Exception
{
session.logout();
@@ -108,6 +115,7 @@ public class JcrRepositoryStatisticsGatheringTest
super.tearDown();
}
+ @Test
public void testJcrStatisticsQuery()
throws Exception
{
diff --git a/archiva-modules/plugins/repository-statistics/src/test/java/org/apache/archiva/metadata/repository/stats/RepositoryStatisticsManagerTest.java b/archiva-modules/plugins/repository-statistics/src/test/java/org/apache/archiva/metadata/repository/stats/RepositoryStatisticsManagerTest.java
index b7e4fae0d..31903a6ca 100644
--- a/archiva-modules/plugins/repository-statistics/src/test/java/org/apache/archiva/metadata/repository/stats/RepositoryStatisticsManagerTest.java
+++ b/archiva-modules/plugins/repository-statistics/src/test/java/org/apache/archiva/metadata/repository/stats/RepositoryStatisticsManagerTest.java
@@ -35,7 +35,12 @@ import java.util.List;
import java.util.Map;
import java.util.TimeZone;
import javax.jcr.Session;
+import org.apache.archiva.test.ArchivaBlockJUnit4ClassRunner;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+@RunWith( ArchivaBlockJUnit4ClassRunner.class )
public class RepositoryStatisticsManagerTest
extends TestCase
{
@@ -63,7 +68,8 @@ public class RepositoryStatisticsManagerTest
}
@Override
- protected void setUp()
+ @Before
+ public void setUp()
throws Exception
{
super.setUp();
@@ -74,6 +80,7 @@ public class RepositoryStatisticsManagerTest
metadataRepository = (MetadataRepository) metadataRepositoryControl.getMock();
}
+ @Test
public void testGetLatestStats()
throws Exception
{
@@ -113,6 +120,7 @@ public class RepositoryStatisticsManagerTest
metadataRepositoryControl.verify();
}
+ @Test
public void testGetLatestStatsWhenEmpty()
throws Exception
{
@@ -127,6 +135,7 @@ public class RepositoryStatisticsManagerTest
metadataRepositoryControl.verify();
}
+ @Test
public void testAddNewStats()
throws Exception
{
@@ -165,6 +174,7 @@ public class RepositoryStatisticsManagerTest
metadataRepositoryControl.verify();
}
+ @Test
public void testDeleteStats()
throws Exception
{
@@ -210,6 +220,7 @@ public class RepositoryStatisticsManagerTest
metadataRepositoryControl.verify();
}
+ @Test
public void testDeleteStatsWhenEmpty()
throws Exception
{
@@ -229,6 +240,7 @@ public class RepositoryStatisticsManagerTest
metadataRepositoryControl.verify();
}
+ @Test
public void testGetStatsRangeInside()
throws Exception
{
@@ -272,6 +284,7 @@ public class RepositoryStatisticsManagerTest
metadataRepositoryControl.verify();
}
+ @Test
public void testGetStatsRangeUpperOutside()
throws Exception
{
@@ -320,6 +333,7 @@ public class RepositoryStatisticsManagerTest
metadataRepositoryControl.verify();
}
+ @Test
public void testGetStatsRangeLowerOutside()
throws Exception
{
@@ -368,6 +382,7 @@ public class RepositoryStatisticsManagerTest
metadataRepositoryControl.verify();
}
+ @Test
public void testGetStatsRangeLowerAndUpperOutside()
throws Exception
{
@@ -422,6 +437,7 @@ public class RepositoryStatisticsManagerTest
metadataRepositoryControl.verify();
}
+ @Test
public void testGetStatsRangeNotInside()
throws Exception
{