aboutsummaryrefslogtreecommitdiffstats
path: root/archiva-modules/plugins/audit
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/audit
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/audit')
-rw-r--r--archiva-modules/plugins/audit/pom.xml7
-rw-r--r--archiva-modules/plugins/audit/src/test/java/org/apache/archiva/audit/AuditManagerTest.java25
2 files changed, 27 insertions, 5 deletions
diff --git a/archiva-modules/plugins/audit/pom.xml b/archiva-modules/plugins/audit/pom.xml
index 52a4cfecc..6996d45c6 100644
--- a/archiva-modules/plugins/audit/pom.xml
+++ b/archiva-modules/plugins/audit/pom.xml
@@ -37,10 +37,11 @@
<artifactId>metadata-repository-api</artifactId>
</dependency>
<dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-simple</artifactId>
+ <groupId>org.apache.archiva</groupId>
+ <artifactId>archiva-testutil</artifactId>
+ <version>${project.version}</version>
<scope>test</scope>
- </dependency>
+ </dependency>
</dependencies>
<build>
diff --git a/archiva-modules/plugins/audit/src/test/java/org/apache/archiva/audit/AuditManagerTest.java b/archiva-modules/plugins/audit/src/test/java/org/apache/archiva/audit/AuditManagerTest.java
index 0a39c7738..19333ee14 100644
--- a/archiva-modules/plugins/audit/src/test/java/org/apache/archiva/audit/AuditManagerTest.java
+++ b/archiva-modules/plugins/audit/src/test/java/org/apache/archiva/audit/AuditManagerTest.java
@@ -35,7 +35,12 @@ import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.TimeZone;
+import org.apache.archiva.test.ArchivaBlockJUnit4ClassRunner;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+@RunWith( ArchivaBlockJUnit4ClassRunner.class )
public class AuditManagerTest
extends TestCase
{
@@ -69,7 +74,8 @@ public class AuditManagerTest
}
@Override
- protected void setUp()
+ @Before
+ public void setUp()
throws Exception
{
super.setUp();
@@ -83,7 +89,8 @@ public class AuditManagerTest
repository.setId( TEST_REPO_ID );
repository.setLocation( "" );
}
-
+
+ @Test
public void testGetMostRecentEvents()
throws Exception
{
@@ -122,6 +129,7 @@ public class AuditManagerTest
metadataRepositoryControl.verify();
}
+ @Test
public void testGetMostRecentEventsLessThan10()
throws Exception
{
@@ -159,6 +167,7 @@ public class AuditManagerTest
metadataRepositoryControl.verify();
}
+ @Test
public void testGetMostRecentEventsInterleavedRepositories()
throws Exception
{
@@ -207,6 +216,7 @@ public class AuditManagerTest
metadataRepositoryControl.verify();
}
+ @Test
public void testGetMostRecentEventsWhenEmpty()
throws Exception
@@ -222,6 +232,7 @@ public class AuditManagerTest
metadataRepositoryControl.verify();
}
+ @Test
public void testAddAuditEvent()
throws Exception
@@ -237,6 +248,7 @@ public class AuditManagerTest
metadataRepositoryControl.verify();
}
+ @Test
public void testAddAuditEventNoRepositoryId()
throws Exception
{
@@ -252,6 +264,7 @@ public class AuditManagerTest
metadataRepositoryControl.verify();
}
+ @Test
public void testDeleteStats()
throws Exception
@@ -265,6 +278,7 @@ public class AuditManagerTest
metadataRepositoryControl.verify();
}
+ @Test
public void testGetEventsRangeInside()
throws Exception
@@ -298,6 +312,7 @@ public class AuditManagerTest
metadataRepositoryControl.verify();
}
+ @Test
public void testGetEventsRangeUpperOutside()
throws Exception
{
@@ -335,6 +350,7 @@ public class AuditManagerTest
metadataRepositoryControl.verify();
}
+ @Test
public void testGetEventsRangeLowerOutside()
throws Exception
{
@@ -372,6 +388,7 @@ public class AuditManagerTest
metadataRepositoryControl.verify();
}
+ @Test
public void testGetEventsRangeLowerAndUpperOutside()
throws Exception
{
@@ -415,6 +432,7 @@ public class AuditManagerTest
metadataRepositoryControl.verify();
}
+ @Test
public void testGetEventsWithResource()
throws Exception
{
@@ -458,6 +476,7 @@ public class AuditManagerTest
metadataRepositoryControl.verify();
}
+ @Test
public void testGetEventsWithNonExistantResource()
throws Exception
{
@@ -497,6 +516,7 @@ public class AuditManagerTest
metadataRepositoryControl.verify();
}
+ @Test
public void testGetEventsRangeMultipleRepositories()
throws Exception
{
@@ -546,6 +566,7 @@ public class AuditManagerTest
metadataRepositoryControl.verify();
}
+ @Test
public void testGetEventsRangeNotInside()
throws Exception
{