summaryrefslogtreecommitdiffstats
path: root/archiva-modules/archiva-web
diff options
context:
space:
mode:
Diffstat (limited to 'archiva-modules/archiva-web')
-rw-r--r--archiva-modules/archiva-web/archiva-applet/pom.xml2
-rw-r--r--archiva-modules/archiva-web/archiva-rss/pom.xml2
-rw-r--r--archiva-modules/archiva-web/archiva-security/pom.xml2
-rw-r--r--archiva-modules/archiva-web/archiva-security/src/main/java/org/apache/maven/archiva/security/ArchivaRoleConstants.java2
-rw-r--r--archiva-modules/archiva-web/archiva-security/src/main/resources/META-INF/redback/redback.xml11
-rw-r--r--archiva-modules/archiva-web/archiva-webapp-test/pom.xml2
-rw-r--r--archiva-modules/archiva-web/archiva-webapp-test/src/test/it-resources/appserver-base/data/repositories/internal/test/test/1.0/test-1.0.jarbin0 -> 1981 bytes
-rw-r--r--archiva-modules/archiva-web/archiva-webapp-test/src/test/it-resources/appserver-base/data/repositories/internal/test/test/1.0/test-1.0.jar.md51
-rw-r--r--archiva-modules/archiva-web/archiva-webapp-test/src/test/it-resources/appserver-base/data/repositories/internal/test/test/1.0/test-1.0.jar.sha11
-rw-r--r--archiva-modules/archiva-web/archiva-webapp-test/src/test/it-resources/appserver-base/data/repositories/internal/test/test/1.0/test-1.0.pom24
-rw-r--r--archiva-modules/archiva-web/archiva-webapp-test/src/test/it-resources/appserver-base/data/repositories/internal/test/test/1.0/test-1.0.pom.md51
-rw-r--r--archiva-modules/archiva-web/archiva-webapp-test/src/test/it-resources/appserver-base/data/repositories/internal/test/test/1.0/test-1.0.pom.sha11
-rw-r--r--archiva-modules/archiva-web/archiva-webapp-test/src/test/it-resources/appserver-base/data/repositories/internal/test/test/maven-metadata.xml12
-rw-r--r--archiva-modules/archiva-web/archiva-webapp-test/src/test/it-resources/appserver-base/data/repositories/internal/test/test/maven-metadata.xml.md51
-rw-r--r--archiva-modules/archiva-web/archiva-webapp-test/src/test/it-resources/appserver-base/data/repositories/internal/test/test/maven-metadata.xml.sha11
-rw-r--r--archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/config/testng.xml1
-rw-r--r--archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/ArtifactManagementTest.java22
-rw-r--r--archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/AuditLogsReportTest.java131
-rw-r--r--archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/BrowseTest.java2
-rw-r--r--archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/FindArtifactTest.java4
-rw-r--r--archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/ReportsTest.java6
-rw-r--r--archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/RepositoryScanningTest.java43
-rw-r--r--archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/RepositoryTest.java7
-rw-r--r--archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/SearchTest.java27
-rw-r--r--archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/VirtualRepositoryTest.java10
-rw-r--r--archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/listener/CaptureScreenShotsListener.java62
-rw-r--r--archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/parent/AbstractArtifactManagementTest.java2
-rw-r--r--archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/parent/AbstractRepositoryTest.java39
-rw-r--r--archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/parent/AbstractSearchTest.java8
-rw-r--r--archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/parent/AbstractSeleniumTest.java7
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/pom.xml15
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/PlexusActionSupport.java4
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/UploadAction.java4
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/reports/ViewAuditLogReportAction.java381
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/util/ContextUtils.java6
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/main/resources/struts.xml10
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/accessToNoRepos.jsp6
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/decorators/default.jsp9
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/reports/auditLogReport.jsp152
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/reports/statisticsReport.jsp16
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/main/webapp/css/site.css37
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/UploadActionTest.java20
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/DisableProxyConnectorActionTest.java2
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/repositories/AddManagedRepositoryActionTest.java5
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/repositories/DeleteManagedRepositoryActionTest.java11
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/repositories/EditManagedRepositoryActionTest.java4
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/action/admin/connectors/proxy/EditProxyConnectorActionTest.xml2
-rw-r--r--archiva-modules/archiva-web/archiva-webdav/pom.xml2
-rw-r--r--archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/ArchivaDavResource.java12
-rw-r--r--archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/ArchivaDavResourceFactory.java2
-rw-r--r--archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/maven/archiva/webdav/ArchivaDavResourceFactoryTest.java6
-rw-r--r--archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/maven/archiva/webdav/DavResourceTest.java5
-rw-r--r--archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/maven/archiva/webdav/RepositoryServletSecurityTest.java6
-rw-r--r--archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-api/pom.xml2
-rw-r--r--archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-client/pom.xml2
-rw-r--r--archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-security/pom.xml2
-rw-r--r--archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/pom.xml2
-rw-r--r--archiva-modules/archiva-web/archiva-xmlrpc/pom.xml2
-rw-r--r--archiva-modules/archiva-web/pom.xml2
59 files changed, 1006 insertions, 157 deletions
diff --git a/archiva-modules/archiva-web/archiva-applet/pom.xml b/archiva-modules/archiva-web/archiva-applet/pom.xml
index af8cc7de2..5a317b861 100644
--- a/archiva-modules/archiva-web/archiva-applet/pom.xml
+++ b/archiva-modules/archiva-web/archiva-applet/pom.xml
@@ -23,7 +23,7 @@
<parent>
<groupId>org.apache.archiva</groupId>
<artifactId>archiva-web</artifactId>
- <version>1.3-SNAPSHOT</version>
+ <version>1.4-SNAPSHOT</version>
</parent>
<artifactId>archiva-applet</artifactId>
<name>Archiva Web :: Applet</name>
diff --git a/archiva-modules/archiva-web/archiva-rss/pom.xml b/archiva-modules/archiva-web/archiva-rss/pom.xml
index b94aa75c7..fb8bf31ec 100644
--- a/archiva-modules/archiva-web/archiva-rss/pom.xml
+++ b/archiva-modules/archiva-web/archiva-rss/pom.xml
@@ -22,7 +22,7 @@
<parent>
<artifactId>archiva-web</artifactId>
<groupId>org.apache.archiva</groupId>
- <version>1.3-SNAPSHOT</version>
+ <version>1.4-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>archiva-rss</artifactId>
diff --git a/archiva-modules/archiva-web/archiva-security/pom.xml b/archiva-modules/archiva-web/archiva-security/pom.xml
index 7ad99695f..0affcaf62 100644
--- a/archiva-modules/archiva-web/archiva-security/pom.xml
+++ b/archiva-modules/archiva-web/archiva-security/pom.xml
@@ -22,7 +22,7 @@
<parent>
<groupId>org.apache.archiva</groupId>
<artifactId>archiva-web</artifactId>
- <version>1.3-SNAPSHOT</version>
+ <version>1.4-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>archiva-security</artifactId>
diff --git a/archiva-modules/archiva-web/archiva-security/src/main/java/org/apache/maven/archiva/security/ArchivaRoleConstants.java b/archiva-modules/archiva-web/archiva-security/src/main/java/org/apache/maven/archiva/security/ArchivaRoleConstants.java
index 7c6f7b76d..396f9250a 100644
--- a/archiva-modules/archiva-web/archiva-security/src/main/java/org/apache/maven/archiva/security/ArchivaRoleConstants.java
+++ b/archiva-modules/archiva-web/archiva-security/src/main/java/org/apache/maven/archiva/security/ArchivaRoleConstants.java
@@ -65,6 +65,8 @@ public class ArchivaRoleConstants
public static final String OPERATION_REPOSITORY_UPLOAD = "archiva-upload-repository";
public static final String OPERATION_REPOSITORY_DELETE = "archiva-delete-artifact";
+
+ public static final String OPERATION_VIEW_AUDIT_LOG = "archiva-view-audit-logs";
// Role templates
public static final String TEMPLATE_REPOSITORY_MANAGER = "archiva-repository-manager";
diff --git a/archiva-modules/archiva-web/archiva-security/src/main/resources/META-INF/redback/redback.xml b/archiva-modules/archiva-web/archiva-security/src/main/resources/META-INF/redback/redback.xml
index 235537e05..55b30e09e 100644
--- a/archiva-modules/archiva-web/archiva-security/src/main/resources/META-INF/redback/redback.xml
+++ b/archiva-modules/archiva-web/archiva-security/src/main/resources/META-INF/redback/redback.xml
@@ -66,6 +66,11 @@
<description>Access Archiva Repository</description>
</operation>
<operation>
+ <id>archiva-view-audit-logs</id>
+ <name>archiva-view-audit-logs</name>
+ <description>View Archiva Audit Logs</description>
+ </operation>
+ <operation>
<id>archiva-guest</id>
<name>archiva-guest</name>
<description>Active Archiva Guest</description>
@@ -219,6 +224,12 @@
<operation>archiva-upload-repository</operation>
<resource>${resource}</resource>
</permission>
+ <permission>
+ <id>archiva-view-audit-logs</id>
+ <name>Archiva View Audit Logs</name>
+ <operation>archiva-view-audit-logs</operation>
+ <resource>${resource}</resource>
+ </permission>
</permissions>
<childTemplates>
<childTemplate>archiva-repository-observer</childTemplate>
diff --git a/archiva-modules/archiva-web/archiva-webapp-test/pom.xml b/archiva-modules/archiva-web/archiva-webapp-test/pom.xml
index d70d16632..060823d68 100644
--- a/archiva-modules/archiva-web/archiva-webapp-test/pom.xml
+++ b/archiva-modules/archiva-web/archiva-webapp-test/pom.xml
@@ -23,7 +23,7 @@
<parent>
<groupId>org.apache.archiva</groupId>
<artifactId>archiva-web</artifactId>
- <version>1.3-SNAPSHOT</version>
+ <version>1.4-SNAPSHOT</version>
</parent>
<artifactId>archiva-webapp-test</artifactId>
<packaging>pom</packaging>
diff --git a/archiva-modules/archiva-web/archiva-webapp-test/src/test/it-resources/appserver-base/data/repositories/internal/test/test/1.0/test-1.0.jar b/archiva-modules/archiva-web/archiva-webapp-test/src/test/it-resources/appserver-base/data/repositories/internal/test/test/1.0/test-1.0.jar
new file mode 100644
index 000000000..d98bcfb34
--- /dev/null
+++ b/archiva-modules/archiva-web/archiva-webapp-test/src/test/it-resources/appserver-base/data/repositories/internal/test/test/1.0/test-1.0.jar
Binary files differ
diff --git a/archiva-modules/archiva-web/archiva-webapp-test/src/test/it-resources/appserver-base/data/repositories/internal/test/test/1.0/test-1.0.jar.md5 b/archiva-modules/archiva-web/archiva-webapp-test/src/test/it-resources/appserver-base/data/repositories/internal/test/test/1.0/test-1.0.jar.md5
new file mode 100644
index 000000000..7359be6f9
--- /dev/null
+++ b/archiva-modules/archiva-web/archiva-webapp-test/src/test/it-resources/appserver-base/data/repositories/internal/test/test/1.0/test-1.0.jar.md5
@@ -0,0 +1 @@
+ea7dea9244b2a0975cfa117dc34fe18e \ No newline at end of file
diff --git a/archiva-modules/archiva-web/archiva-webapp-test/src/test/it-resources/appserver-base/data/repositories/internal/test/test/1.0/test-1.0.jar.sha1 b/archiva-modules/archiva-web/archiva-webapp-test/src/test/it-resources/appserver-base/data/repositories/internal/test/test/1.0/test-1.0.jar.sha1
new file mode 100644
index 000000000..45ec67894
--- /dev/null
+++ b/archiva-modules/archiva-web/archiva-webapp-test/src/test/it-resources/appserver-base/data/repositories/internal/test/test/1.0/test-1.0.jar.sha1
@@ -0,0 +1 @@
+1039566ff5361d07eccd1243c45929b96441c7d6 \ No newline at end of file
diff --git a/archiva-modules/archiva-web/archiva-webapp-test/src/test/it-resources/appserver-base/data/repositories/internal/test/test/1.0/test-1.0.pom b/archiva-modules/archiva-web/archiva-webapp-test/src/test/it-resources/appserver-base/data/repositories/internal/test/test/1.0/test-1.0.pom
new file mode 100644
index 000000000..cbec59866
--- /dev/null
+++ b/archiva-modules/archiva-web/archiva-webapp-test/src/test/it-resources/appserver-base/data/repositories/internal/test/test/1.0/test-1.0.pom
@@ -0,0 +1,24 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>test</groupId>
+ <artifactId>test</artifactId>
+ <packaging>jar</packaging>
+ <version>1.0</version>
+ <name>test</name>
+ <url>http://maven.apache.org</url>
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+<distributionManagement>
+<repository>
+ <id>test</id>
+<url>file://localhost/Users/brett/scm/archiva/archiva/archiva-modules/archiva-web/archiva-webapp-test/src/test/it-resources/appserver-base/data/repositories/internal</url>
+</repository>
+</distributionManagement>
+</project>
diff --git a/archiva-modules/archiva-web/archiva-webapp-test/src/test/it-resources/appserver-base/data/repositories/internal/test/test/1.0/test-1.0.pom.md5 b/archiva-modules/archiva-web/archiva-webapp-test/src/test/it-resources/appserver-base/data/repositories/internal/test/test/1.0/test-1.0.pom.md5
new file mode 100644
index 000000000..3b20276cd
--- /dev/null
+++ b/archiva-modules/archiva-web/archiva-webapp-test/src/test/it-resources/appserver-base/data/repositories/internal/test/test/1.0/test-1.0.pom.md5
@@ -0,0 +1 @@
+f80c7c493716de649a99db00cd2ff34c \ No newline at end of file
diff --git a/archiva-modules/archiva-web/archiva-webapp-test/src/test/it-resources/appserver-base/data/repositories/internal/test/test/1.0/test-1.0.pom.sha1 b/archiva-modules/archiva-web/archiva-webapp-test/src/test/it-resources/appserver-base/data/repositories/internal/test/test/1.0/test-1.0.pom.sha1
new file mode 100644
index 000000000..d7c09225e
--- /dev/null
+++ b/archiva-modules/archiva-web/archiva-webapp-test/src/test/it-resources/appserver-base/data/repositories/internal/test/test/1.0/test-1.0.pom.sha1
@@ -0,0 +1 @@
+4b95c6fa09d1e02efdb69129f53f025e33bc8958 \ No newline at end of file
diff --git a/archiva-modules/archiva-web/archiva-webapp-test/src/test/it-resources/appserver-base/data/repositories/internal/test/test/maven-metadata.xml b/archiva-modules/archiva-web/archiva-webapp-test/src/test/it-resources/appserver-base/data/repositories/internal/test/test/maven-metadata.xml
new file mode 100644
index 000000000..68287fd4e
--- /dev/null
+++ b/archiva-modules/archiva-web/archiva-webapp-test/src/test/it-resources/appserver-base/data/repositories/internal/test/test/maven-metadata.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<metadata>
+ <groupId>test</groupId>
+ <artifactId>test</artifactId>
+ <version>1.0</version>
+ <versioning>
+ <versions>
+ <version>1.0</version>
+ </versions>
+ <lastUpdated>20100114015837</lastUpdated>
+ </versioning>
+</metadata>
diff --git a/archiva-modules/archiva-web/archiva-webapp-test/src/test/it-resources/appserver-base/data/repositories/internal/test/test/maven-metadata.xml.md5 b/archiva-modules/archiva-web/archiva-webapp-test/src/test/it-resources/appserver-base/data/repositories/internal/test/test/maven-metadata.xml.md5
new file mode 100644
index 000000000..4bb9667e4
--- /dev/null
+++ b/archiva-modules/archiva-web/archiva-webapp-test/src/test/it-resources/appserver-base/data/repositories/internal/test/test/maven-metadata.xml.md5
@@ -0,0 +1 @@
+dab1b8c2475fe839f387ceaef0d82b30 \ No newline at end of file
diff --git a/archiva-modules/archiva-web/archiva-webapp-test/src/test/it-resources/appserver-base/data/repositories/internal/test/test/maven-metadata.xml.sha1 b/archiva-modules/archiva-web/archiva-webapp-test/src/test/it-resources/appserver-base/data/repositories/internal/test/test/maven-metadata.xml.sha1
new file mode 100644
index 000000000..f00268387
--- /dev/null
+++ b/archiva-modules/archiva-web/archiva-webapp-test/src/test/it-resources/appserver-base/data/repositories/internal/test/test/maven-metadata.xml.sha1
@@ -0,0 +1 @@
+4e5b414d5419121ef75131cb52235a9abbf2095a \ No newline at end of file
diff --git a/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/config/testng.xml b/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/config/testng.xml
index c107bda61..e8607fb3b 100644
--- a/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/config/testng.xml
+++ b/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/config/testng.xml
@@ -33,6 +33,7 @@ under the License.
<include name= "reposcan" />
<include name= "artifactmanagement" />
<include name= "search" />
+ <include name= "auditlogsreport" />
<include name= "browse" />
<include name= "reports" />
<include name= "virtualrepository" />
diff --git a/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/ArtifactManagementTest.java b/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/ArtifactManagementTest.java
index ca03471de..1f60076bc 100644
--- a/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/ArtifactManagementTest.java
+++ b/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/ArtifactManagementTest.java
@@ -83,34 +83,36 @@ public class ArtifactManagementTest
assertTextPresent( "Please add a file to upload." );
}
+ @Test( enabled = false )
public void testAddArtifactValidValues()
{
- addArtifact( getGroupId() , getArtifactId(), getVersion(), getPackaging() , getArtifactFilePath(), getRepositoryId() );
+ // TODO: disable test on non *chrome browsers, there is no way to do file uploads (SEL-63)
+ addArtifact( getGroupId() , "testAddArtifactValidValues", getVersion(), getPackaging() , getArtifactFilePath(), getRepositoryId() );
assertTextPresent( "Artifact 'test:test:1.0' was successfully deployed to repository 'internal'" );
}
//MRM-747
- @Test(dependsOnMethods = { "testAddArtifactValidValues" } )
+ @Test( enabled = false )
public void testAddArtifactBlockRedeployments()
{
- addArtifact( getGroupId() , getArtifactId(), getVersion(), getPackaging() , getArtifactFilePath(), getRepositoryId() );
- assertTextPresent( "Overwriting released artifacts in repository '" + getRepositoryId() + "' is not allowed." );
+ // TODO: disable test on non *chrome browsers, there is no way to do file uploads (SEL-63)
+ addArtifact( getGroupId() , getArtifactId(), getVersion(), getPackaging() , getArtifactFilePath(), getRepositoryId() );
+ assertTextPresent( "Overwriting released artifacts in repository '" + getRepositoryId() + "' is not allowed." );
}
- public void testAddArtifactValidValues1()
+ @Test( enabled = false )
+ public void testDeleteArtifact()
{
+ //prep
String groupId = getProperty( "GROUPID1" );
String artifactId = getProperty( "ARTIFACTID1" );
String version = getProperty( "VERSION1" );
String packaging = getProperty( "PACKAGING1" );
String repositoryId = getProperty( "REPOSITORYID1" );
+ // TODO: do this differently as it only works in Firefox's chrome mode
addArtifact( groupId , artifactId, version, packaging , getArtifactFilePath(), repositoryId );
assertTextPresent( "Artifact 'delete:delete:1.0' was successfully deployed to repository 'internal'" );
- }
-
- @Test(dependsOnMethods = { "testAddArtifactValidValues1" } )
- public void testDeleteArtifact()
- {
+
deleteArtifact( "delete", "delete", "1.0", "internal");
assertTextPresent( "Artifact 'delete:delete:1.0' was successfully deleted from repository 'internal'" );
}
diff --git a/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/AuditLogsReportTest.java b/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/AuditLogsReportTest.java
new file mode 100644
index 000000000..daedc24a9
--- /dev/null
+++ b/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/AuditLogsReportTest.java
@@ -0,0 +1,131 @@
+package org.apache.archiva.web.test;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.archiva.web.test.parent.AbstractArchivaTest;
+import org.testng.annotations.Test;
+
+@Test( groups = { "auditlogsreport" }, dependsOnMethods = { "testWithCorrectUsernamePassword" } )
+public class AuditLogsReportTest
+ extends AbstractArchivaTest
+{
+ private void goToAuditLogReports()
+ {
+ clickLinkWithText( "Audit Log Report" );
+ }
+
+ private void assertAuditLogsReportPage()
+ {
+ assertPage( "Apache Archiva \\ Audit Log Report" );
+ assertTextPresent( "Audit Log Report" );
+
+ assertElementPresent( "repository" );
+ assertElementPresent( "groupId" );
+ assertElementPresent( "artifactId" );
+ assertElementPresent( "startDate" );
+ assertElementPresent( "endDate" );
+ assertElementPresent( "rowCount" );
+ assertButtonWithValuePresent( "View Audit Log" );
+ }
+
+ @Test(dependsOnMethods = { "testWithCorrectUsernamePassword" } )
+ public void testAuditLogsReport()
+ {
+ goToAuditLogReports();
+ assertAuditLogsReportPage();
+ assertTextPresent( "Latest Events" );
+ }
+
+ @Test(dependsOnMethods = { "testWithCorrectUsernamePassword" } )
+ public void testViewAuditLogsNoDataFound()
+ {
+ goToAuditLogReports();
+ assertAuditLogsReportPage();
+
+ setFieldValue( "groupId", "non.existing" );
+ submit();
+
+ assertPage( "Apache Archiva \\ Audit Log Report" );
+ assertTextPresent( "Results" );
+ assertTextPresent( "No audit logs found." );
+ }
+
+ // TODO: add test for adding via WebDAV
+ // TODO: disable if not running on *chrome
+ @Test (dependsOnMethods = { "testAddArtifactValidValues" }, enabled = false )
+ public void testViewAuditLogsDataFound()
+ {
+ goToAuditLogReports();
+ assertAuditLogsReportPage();
+
+ selectValue( "repository", "internal" );
+ setFieldValue( "groupId", "test" );
+ submit();
+
+ assertAuditLogsReportPage();
+ assertTextPresent( "Results" );
+ assertTextNotPresent( "No audit logs found." );
+ assertTextPresent( "test-1.0.jar" );
+ assertTextPresent( "Uploaded File" );
+ assertTextPresent( "internal" );
+ assertTextPresent( "admin" );
+ }
+
+ // TODO: add test for adding via WebDAV
+ // TODO: disable if not running on *chrome
+ @Test (dependsOnMethods = { "testAddArtifactValidValues" }, enabled = false )
+ public void testViewAuditLogsOnlyArtifactIdIsSpecified()
+ {
+ goToAuditLogReports();
+ assertAuditLogsReportPage();
+
+ selectValue( "repository", "internal" );
+ setFieldValue( "artifactId", "test" );
+ submit();
+
+ assertAuditLogsReportPage();
+ assertTextPresent( "Results" );
+ assertTextNotPresent( "No audit logs found." );
+ assertTextPresent( "test-1.0.jar" );
+ assertTextPresent( "Uploaded File" );
+ assertTextPresent( "internal" );
+ assertTextPresent( "admin" );
+ }
+
+ // TODO: add test for adding via WebDAV
+ // TODO: disable if not running on *chrome
+ @Test (dependsOnMethods = { "testAddArtifactValidValues" }, enabled = false )
+ public void testViewAuditLogsForAllRepositories()
+ {
+ goToAuditLogReports();
+ assertAuditLogsReportPage();
+
+ selectValue( "repository", "all" );
+ submit();
+
+ assertAuditLogsReportPage();
+ assertTextPresent( "Results" );
+ assertTextNotPresent( "No audit logs found." );
+ assertTextPresent( "test-1.0.jar" );
+ assertTextPresent( "Uploaded File" );
+ assertTextPresent( "internal" );
+ assertTextPresent( "admin" );
+ }
+}
diff --git a/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/BrowseTest.java b/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/BrowseTest.java
index ab6ba818a..c9c60ecce 100644
--- a/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/BrowseTest.java
+++ b/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/BrowseTest.java
@@ -45,6 +45,7 @@ public class BrowseTest
}
// MRM-1278
+ @Test( enabled = false )
public void testCorrectRepositoryInBrowse()
{
File artifact =
@@ -63,6 +64,7 @@ public class BrowseTest
String snapshotsRepo = getProperty( "SNAPSHOTS_REPOSITORY" );
+ // TODO: do this differently as uploading doesn't work on browsers other than *chrome (below as well)
// upload a snapshot artifact to repository 'releases'
addArtifact( "archiva", "archiva-webapp", "1.0-SNAPSHOT", "jar", artifact.getPath(),
releasesRepo );
diff --git a/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/FindArtifactTest.java b/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/FindArtifactTest.java
index 8d1e817e7..3431ebf9e 100644
--- a/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/FindArtifactTest.java
+++ b/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/FindArtifactTest.java
@@ -22,7 +22,7 @@ package org.apache.archiva.web.test;
import org.apache.archiva.web.test.parent.AbstractArchivaTest;
import org.testng.annotations.Test;
-@Test( groups = { "findartifact" }, dependsOnMethods = { "testAddArtifactValidValues1" }, sequential = true )
+@Test( groups = { "findartifact" }, sequential = true )
public class FindArtifactTest
extends AbstractArchivaTest
{
@@ -33,9 +33,9 @@ public class FindArtifactTest
assertTextPresent( "You must select a file, or enter the checksum. If the file was given and you receive this message, there may have been an error generating the checksum." );
}
- @Test( dependsOnMethods = { "testFindArtifactNullValues" })
public void testFindArtifactUsingChecksum()
{
+ goToFindArtifactPage();
setFieldValue( "checksumSearch_q" , "8e896baea663a45d7bd2737f8e464481" );
clickButtonWithValue( "Search" );
assertTextPresent( "No results found" );
diff --git a/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/ReportsTest.java b/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/ReportsTest.java
index d46c16907..756763fec 100644
--- a/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/ReportsTest.java
+++ b/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/ReportsTest.java
@@ -22,13 +22,12 @@ package org.apache.archiva.web.test;
import org.apache.archiva.web.test.parent.AbstractArtifactReportsTest;
import org.testng.annotations.Test;
-@Test( groups = { "reports" }, dependsOnMethods = { "testAddArtifactValidValues" } )
+@Test( groups = { "reports" }, dependsOnMethods = { "testWithCorrectUsernamePassword" } )
public class ReportsTest
extends AbstractArtifactReportsTest
{
//TODO Tests for repository with defects
-// @Test(dependsOnMethods = { "testAddArtifactValidValues" } )
public void testRepoStatisticsWithoutRepoCompared()
{
goToReportsPage();
@@ -57,7 +56,6 @@ public class ReportsTest
assertTextPresent( "Start Date must be earlier than the End Date" );
}
- @Test(dependsOnMethods = { "testAddArtifactValidValues" } )
public void testRepositoryStatistics()
{
String repositoryName = getProperty( "REPOSITORY_NAME" ) ;
@@ -78,7 +76,6 @@ public class ReportsTest
assertTextPresent( "Statistics Report" );
}
- @Test(dependsOnMethods = { "testAddArtifactValidValues" } )
public void testRepositoryHealthWithoutDefect()
{
goToReportsPage();
@@ -89,7 +86,6 @@ public class ReportsTest
assertTextPresent( "The operation generated an empty report." );
}
- @Test(dependsOnMethods = { "testAddArtifactValidValues" } )
public void testRepositoryHealthWithoutGroupId()
{
goToReportsPage();
diff --git a/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/RepositoryScanningTest.java b/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/RepositoryScanningTest.java
index c4d5bcad9..6d00d1a32 100644
--- a/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/RepositoryScanningTest.java
+++ b/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/RepositoryScanningTest.java
@@ -1,8 +1,5 @@
package org.apache.archiva.web.test;
-import org.apache.archiva.web.test.parent.AbstractRepositoryTest;
-import org.testng.annotations.Test;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -22,6 +19,10 @@ import org.testng.annotations.Test;
* under the License.
*/
+import org.apache.archiva.web.test.parent.AbstractRepositoryTest;
+import org.testng.annotations.Test;
+import org.testng.Assert;
+
@Test( groups = { "reposcan" }, dependsOnMethods = { "testWithCorrectUsernamePassword" }, sequential = true )
public class RepositoryScanningTest
extends AbstractRepositoryTest
@@ -38,7 +39,7 @@ public class RepositoryScanningTest
{
setFieldValue( "newpattern_0" , "**/*.dll" );
clickLinkWithXPath( "//div[@id='contentArea']/div/div[1]/table/tbody/tr[14]/td[2]/a/img" );
- assertTextPresent( "**/*.dll" );
+ Assert.assertEquals(getSelenium().getTable("//div[@id='contentArea']/div/div[1]/table.13.0"), "**/*.dll" );
}
@Test (dependsOnMethods = { "testAddArtifactFileType" } )
@@ -46,14 +47,15 @@ public class RepositoryScanningTest
{
setFieldValue( "newpattern_0" , "**/*.zip" );
clickLinkWithXPath( "//div[@id='contentArea']/div/div[1]/table/tbody/tr[15]/td[2]/a/img" );
- assertTextPresent( "Not adding pattern \"**/*.zip\" to filetype artifacts as it already exists." );
+ Assert.assertEquals(getSelenium().getText("//span[@class='errorMessage']"), "Not adding pattern \"**/*.zip\" to filetype artifacts as it already exists." );
}
@Test (dependsOnMethods = { "testAddArtifactFileType_ExistingValue" } )
public void testDeleteArtifactFileType()
{
+ Assert.assertEquals(getSelenium().getTable("//div[@id='contentArea']/div/div[1]/table.13.0"), "**/*.dll" );
clickLinkWithXPath( "//div[@id='contentArea']/div/div[1]/table/tbody/tr[14]/td[2]/a/img" );
- assertTextNotPresent( "dll" );
+ Assert.assertEquals(getSelenium().getTable("//div[@id='contentArea']/div/div[1]/table.13.0"), "" );
}
@Test (dependsOnMethods = { "testDeleteArtifactFileType" } )
@@ -69,7 +71,7 @@ public class RepositoryScanningTest
{
setFieldValue( "newpattern_1" , "**/*-" );
clickLinkWithXPath( "//div[@id='contentArea']/div/div[2]/table/tbody/tr[4]/td[2]/a/img" );
- assertTextPresent( "Not adding pattern \"**/*-\" to filetype auto-remove as it already exists." );
+ Assert.assertEquals(getSelenium().getText("//span[@class='errorMessage']"), "Not adding pattern \"**/*-\" to filetype auto-remove as it already exists." );
}
@Test (dependsOnMethods = { "testAddAutoRemove_ExistingValue" } )
@@ -77,14 +79,15 @@ public class RepositoryScanningTest
{
setFieldValue( "newpattern_1" , "**/*.test" );
clickLinkWithXPath( "//div[@id='contentArea']/div/div[2]/table/tbody/tr[4]/td[2]/a/img" );
- assertTextPresent( "**/*.test" );
+ Assert.assertEquals(getSelenium().getTable("//div[@id='contentArea']/div/div[2]/table.3.0"), "**/*.test" );
}
@Test (dependsOnMethods = { "testAddAutoRemove" } )
public void testDeleteAutoRemove()
{
+ Assert.assertEquals(getSelenium().getTable("//div[@id='contentArea']/div/div[2]/table.3.0"), "**/*.test" );
clickLinkWithXPath( "//div[@id='contentArea']/div/div[2]/table/tbody/tr[4]/td[2]/a/img" );
- assertTextNotPresent( "test" );
+ Assert.assertEquals(getSelenium().getTable("//div[@id='contentArea']/div/div[2]/table.3.0"), "" );
}
@Test (dependsOnMethods = { "testDeleteAutoRemove" } )
@@ -92,7 +95,7 @@ public class RepositoryScanningTest
{
setFieldValue( "newpattern_2" , "" );
clickLinkWithXPath( "//div[@id='contentArea']/div/div[3]/table/tbody/tr[7]/td[2]/a/img" );
- assertTextPresent( "Unable to process blank pattern." );
+ Assert.assertEquals(getSelenium().getText("//span[@class='errorMessage']"), "Unable to process blank pattern." );
}
@Test (dependsOnMethods = { "testAddIgnoredArtifacts_NullValue" } )
@@ -100,7 +103,7 @@ public class RepositoryScanningTest
{
setFieldValue( "newpattern_2" , "**/*.sh" );
clickLinkWithXPath( "//div[@id='contentArea']/div/div[3]/table/tbody/tr[7]/td[2]/a/img" );
- assertTextPresent( "Not adding pattern \"**/*.sh\" to filetype ignored as it already exists." );
+ Assert.assertEquals(getSelenium().getText("//span[@class='errorMessage']"), "Not adding pattern \"**/*.sh\" to filetype ignored as it already exists." );
}
@Test (dependsOnMethods = { "testAddIgnoredArtifacts_ExistingValue" } )
@@ -108,14 +111,15 @@ public class RepositoryScanningTest
{
setFieldValue( "newpattern_2" , "**/*.log" );
clickLinkWithXPath( "//div[@id='contentArea']/div/div[3]/table/tbody/tr[7]/td[2]/a/img" );
- assertTextPresent( "**/*.log" );
+ Assert.assertEquals(getSelenium().getTable("//div[@id='contentArea']/div/div[3]/table.6.0"), "**/*.log" );
}
@Test (dependsOnMethods = { "testAddIgnoredArtifacts" } )
public void testDeleteIgnoredArtifacts()
{
+ Assert.assertEquals(getSelenium().getTable("//div[@id='contentArea']/div/div[3]/table.6.0"), "**/*.log" );
clickLinkWithXPath( "//div[@id='contentArea']/div/div[3]/table/tbody/tr[7]/td[2]/a/img" );
- assertTextNotPresent( "log" );
+ Assert.assertEquals(getSelenium().getTable("//div[@id='contentArea']/div/div[3]/table.6.0"), "" );
}
//
@@ -124,7 +128,7 @@ public class RepositoryScanningTest
{
setFieldValue( "newpattern_3" , "" );
clickLinkWithXPath( "//div[@id='contentArea']/div/div[4]/table/tbody/tr[10]/td[2]/a/img" );
- assertTextPresent( "Unable to process blank pattern." );
+ Assert.assertEquals(getSelenium().getText("//span[@class='errorMessage']"), "Unable to process blank pattern." );
}
@Test (dependsOnMethods = { "testAddIndexableContent_NullValue" } )
@@ -132,7 +136,7 @@ public class RepositoryScanningTest
{
setFieldValue( "newpattern_3" , "**/*.xml" );
clickLinkWithXPath( "//div[@id='contentArea']/div/div[4]/table/tbody/tr[10]/td[2]/a/img" );
- assertTextPresent( "Not adding pattern \"**/*.xml\" to filetype indexable-content as it already exists." );
+ Assert.assertEquals(getSelenium().getText("//span[@class='errorMessage']"), "Not adding pattern \"**/*.xml\" to filetype indexable-content as it already exists." );
}
@Test (dependsOnMethods = { "testAddIndexableContent_ExistingValue" } )
@@ -140,14 +144,15 @@ public class RepositoryScanningTest
{
setFieldValue( "newpattern_3" , "**/*.html" );
clickLinkWithXPath( "//div[@id='contentArea']/div/div[4]/table/tbody/tr[10]/td[2]/a/img" );
- assertTextPresent( "**/*.html" );
+ Assert.assertEquals(getSelenium().getTable("//div[@id='contentArea']/div/div[4]/table.9.0"), "**/*.html" );
}
@Test (dependsOnMethods = { "testAddIndexableContent" } )
public void testDeleteIndexableContent()
{
+ Assert.assertEquals(getSelenium().getTable("//div[@id='contentArea']/div/div[4]/table.9.0"), "**/*.html" );
clickLinkWithXPath( "//div[@id='contentArea']/div/div[4]/table/tbody/tr[10]/td[2]/a/img" );
- assertTextNotPresent( "html" );
+ Assert.assertEquals(getSelenium().getTable("//div[@id='contentArea']/div/div[4]/table.9.0"), "" );
}
@Test (dependsOnMethods = { "testDeleteIndexableContent" } )
@@ -172,10 +177,6 @@ public class RepositoryScanningTest
getSelenium().uncheck( "//input[@name='enabledKnownContentConsumers' and @value='validate-checksums']" );
clickButtonWithValue( "Update Consumers" );
- // remove the ff. 2 lines if MRM-1238 will be fixed.
- getSelenium().goBack();
- waitPage();
-
assertPage( "Apache Archiva \\ Administration - Repository Scanning" );
}
diff --git a/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/RepositoryTest.java b/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/RepositoryTest.java
index e23e6bf93..c22e02be7 100644
--- a/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/RepositoryTest.java
+++ b/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/RepositoryTest.java
@@ -26,7 +26,6 @@ import org.testng.annotations.Test;
public class RepositoryTest
extends AbstractRepositoryTest
{
- @Test(dependsOnMethods = { "testWithCorrectUsernamePassword" } )
public void testAddManagedRepoValidValues()
{
goToRepositoriesPage();
@@ -37,11 +36,9 @@ public class RepositoryTest
assertRepositoriesPage();
}
- @Test(dependsOnMethods = { "testAddManagedRepoValidValues" } )
public void testAddManagedRepoInvalidValues()
- {
- goToRepositoriesPage();
- assertRepositoriesPage();
+ {
+ goToRepositoriesPage();
clickLinkWithLocator( "//div[@id='contentArea']/div/div/a[@href='/archiva/admin/addRepository.action']" );
addManagedRepository( "", "" , "" , "", "Maven 2.x Repository", "", "", "" );
assertTextPresent( "You must enter a repository identifier." );
diff --git a/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/SearchTest.java b/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/SearchTest.java
index 08a748a49..d10700985 100644
--- a/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/SearchTest.java
+++ b/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/SearchTest.java
@@ -19,6 +19,8 @@ package org.apache.archiva.web.test;
* under the License.
*/
+import java.io.File;
+
import org.apache.archiva.web.test.parent.AbstractSearchTest;
import org.testng.annotations.Test;
@@ -34,7 +36,6 @@ public class SearchTest
assertTextPresent( "No results found" );
}
- @Test (dependsOnMethods = { "testAddArtifactValidValues" } )
public void testSearchExistingArtifact()
{
searchForArtifact( getProperty( "ARTIFACT_ARTIFACTID" ) );
@@ -43,7 +44,6 @@ public class SearchTest
assertLinkPresent( "test" );
}
- @Test (dependsOnMethods = { "testAddArtifactValidValues" } )
public void testViewSearchedArtifact()
{
searchForArtifact( getProperty( "ARTIFACT_ARTIFACTID" ) );
@@ -66,12 +66,29 @@ public class SearchTest
assertTextPresent( "Advanced Search - At least one search criteria must be provided." );
}
- /* public void testSearchExistingArtifactUsingAdvancedSearchArtifactId()
+ public void testSearchExistingArtifactUsingAdvancedSearchArtifactId()
{
- searchForArtifactAdvancedSearch( null, getProperty( "ARTIFACT_ARTIFACTID" ), null, null, null, null );
+ searchForArtifactAdvancedSearch( null, getProperty( "ARTIFACT_ARTIFACTID" ), null, getProperty( "REPOSITORYID" ), null, null );
assertTextPresent( "Results" );
assertTextPresent( "Hits: 1 to 1 of 1" );
assertLinkPresent( "test" );
- }*/
+ }
+
+ public void testSearchExistingArtifactUsingAdvancedSearchGroupId()
+ {
+ searchForArtifactAdvancedSearch( getProperty( "GROUPID" ), null, null, getProperty( "REPOSITORYID" ), null, null );
+ assertTextPresent( "Results" );
+ assertTextPresent( "Hits: 1 to 1 of 1" );
+ assertLinkPresent( "test" );
+ }
+
+ public void testSearchExistingArtifactUsingAdvancedSearchNotInRepository()
+ {
+ searchForArtifactAdvancedSearch( null, getProperty( "ARTIFACT_ARTIFACTID" ), null, "snapshots", null, null );
+ assertTextPresent( "No results found" );
+ assertTextNotPresent( "Results" );
+ assertTextNotPresent( "Hits: 1 to 1 of 1" );
+ assertLinkNotPresent( "test" );
+ }
}
diff --git a/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/VirtualRepositoryTest.java b/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/VirtualRepositoryTest.java
index 081320fb8..befbea954 100644
--- a/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/VirtualRepositoryTest.java
+++ b/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/VirtualRepositoryTest.java
@@ -21,6 +21,7 @@ package org.apache.archiva.web.test;
import org.apache.archiva.web.test.parent.AbstractRepositoryTest;
import org.testng.annotations.Test;
+import org.testng.Assert;
@Test( groups = { "virtualrepository" }, dependsOnMethods = { "testWithCorrectUsernamePassword" } )
public class VirtualRepositoryTest
@@ -37,26 +38,25 @@ public class VirtualRepositoryTest
{
addRepositoryGroup( "testing" );
//assertAddedRepositoryLink( "testing" );
- assertTextPresent( "testing" );
+ Assert.assertEquals( getSelenium().getText( "//div[@id='contentArea']/div[2]/div/div[1]/p[1]" ), "testing" );
}
@Test(dependsOnMethods = { "testAddRepositoryGroupValidValue" } )
public void testAddRepositoryToRepositoryGroup()
{
addRepositoryToRepositoryGroup( "testing", "internal" );
- assertTextPresent( "internal" );
+ Assert.assertEquals( getSelenium().getText( "//div[@id='contentArea']/div[2]/div/div[3]/div[2]/p[1]" ), "internal" );
//clickLinkWithXPath( "/html/body/div[4]/div/div/div[2]/div/div/p[2]/a" );
//getSelenium().goBack();
}
@Test(dependsOnMethods = { "testAddRepositoryToRepositoryGroup" } )
public void testDeleteRepositoryOfRepositoryGroup()
- {
- goToRepositoryGroupsPage();
+ {
deleteRepositoryInRepositoryGroups();
assertTextPresent( "Repository Groups" );
assertTextNotPresent( "No Repository Groups Defined." );
- waitPage();
+ Assert.assertFalse( getSelenium().isElementPresent( "//div[@id='contentArea']/div[2]/div/div[3]/div[2]/p[1]" ) );
}
@Test(dependsOnMethods = { "testDeleteRepositoryOfRepositoryGroup" } )
diff --git a/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/listener/CaptureScreenShotsListener.java b/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/listener/CaptureScreenShotsListener.java
index 4e6ed3182..947d7cbf3 100644
--- a/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/listener/CaptureScreenShotsListener.java
+++ b/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/listener/CaptureScreenShotsListener.java
@@ -20,18 +20,28 @@ package org.apache.archiva.web.test.listener;
*/
import java.io.File;
+import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.regex.Pattern;
import org.apache.archiva.web.test.parent.AbstractSeleniumTest;
+import org.apache.commons.io.FileUtils;
import org.testng.ITestResult;
import org.testng.TestListenerAdapter;
+import com.thoughtworks.selenium.Selenium;
public class CaptureScreenShotsListener
extends TestListenerAdapter
{
@Override
+ public void onTestSkipped( ITestResult tr )
+ {
+ System.out.println( "Test " + tr.getName() + " -> Skipped" );
+ super.onTestSkipped( tr );
+ }
+
+ @Override
public void onTestFailure( ITestResult tr )
{
captureError( tr );
@@ -48,40 +58,38 @@ public class CaptureScreenShotsListener
private void captureError( ITestResult tr )
{
- try
- {
- captureScreenshot( tr );
- }
- catch ( RuntimeException e )
- {
- System.out.println( "Error when take screenshot for test " + tr.getName() );
- e.printStackTrace();
- }
- }
-
- // captureAssertionError() creates a 'target/screenshots' directory and saves '.png' page screenshot of the
- // encountered error
- private void captureScreenshot( ITestResult tr )
- {
- File f = new File( "" );
- String filePath = f.getAbsolutePath();
- Date d = new Date();
SimpleDateFormat sdf = new SimpleDateFormat( "yyyy.MM.dd-HH_mm_ss" );
- String time = sdf.format( d );
- String fs = File.separator;
- File targetPath = new File( filePath + fs + "target" + fs + "screenshots" );
- targetPath.mkdir();
- String cName = tr.getTestClass().getName();
+ String time = sdf.format( new Date() );
+ File targetPath = new File( "target", "screenshots" );
StackTraceElement stackTrace[] = tr.getThrowable().getStackTrace();
+ String cName = tr.getTestClass().getName();
int index = getStackTraceIndexOfCallingClass( cName, stackTrace );
String methodName = stackTrace[index].getMethodName();
int lNumber = stackTrace[index].getLineNumber();
String lineNumber = Integer.toString( lNumber );
String className = cName.substring( cName.lastIndexOf( '.' ) + 1 );
- String fileName =
- targetPath.toString() + fs + methodName + "(" + className + ".java_" + lineNumber + ")-" + time + ".png";
- AbstractSeleniumTest.getSelenium().windowMaximize();
- AbstractSeleniumTest.getSelenium().captureEntirePageScreenshot( fileName, "" );
+ targetPath.mkdirs();
+ Selenium selenium = AbstractSeleniumTest.getSelenium();
+ String fileBaseName = methodName + "_" + className + ".java_" + lineNumber + "-" + time;
+ try
+ {
+ selenium.windowMaximize();
+ File fileName = new File( targetPath, fileBaseName + ".png" );
+ selenium.captureEntirePageScreenshot( fileName.getAbsolutePath(), "" );
+ }
+ catch ( RuntimeException e )
+ {
+ System.out.println( "Error when take screenshot for test " + tr.getName() + ": " + e.getMessage() );
+ try
+ {
+ File fileName = new File( targetPath, fileBaseName + ".html" );
+ FileUtils.writeStringToFile( fileName, selenium.getHtmlSource() );
+ }
+ catch ( IOException ioe )
+ {
+ System.out.println( ioe.getMessage() );
+ }
+ }
}
private int getStackTraceIndexOfCallingClass( String nameOfClass, StackTraceElement stackTrace[] )
diff --git a/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/parent/AbstractArtifactManagementTest.java b/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/parent/AbstractArtifactManagementTest.java
index 830c39cd7..cf03765b0 100644
--- a/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/parent/AbstractArtifactManagementTest.java
+++ b/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/parent/AbstractArtifactManagementTest.java
@@ -14,7 +14,7 @@ public abstract class AbstractArtifactManagementTest
public String getArtifactId()
{
- String artifactId = getProperty( "GROUPID" ) ;
+ String artifactId = getProperty( "ARTIFACTID" ) ;
return artifactId;
}
diff --git a/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/parent/AbstractRepositoryTest.java b/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/parent/AbstractRepositoryTest.java
index b6237b8ef..52f02ef8a 100644
--- a/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/parent/AbstractRepositoryTest.java
+++ b/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/parent/AbstractRepositoryTest.java
@@ -1,6 +1,26 @@
package org.apache.archiva.web.test.parent;
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
import java.io.File;
+import org.testng.Assert;
public abstract class AbstractRepositoryTest
extends AbstractArchivaTest
@@ -80,12 +100,13 @@ public abstract class AbstractRepositoryTest
public void deleteRepositoryInRepositoryGroups()
{
+ goToRepositoryGroupsPage();
getSelenium().click( "xpath=//div[@id='contentArea']/div[2]/div/div[3]/div[1]/a/img" );
+ waitPage();
}
public void deleteRepositoryGroup( String repositoryName )
{
- //goToRepositoryGroupsPage();
getSelenium().click( "xpath=//div[@id='contentArea']/div[2]/div/div[1]/div/a/img" );
waitPage();
assertDeleteRepositoryGroupPage( repositoryName );
@@ -306,23 +327,23 @@ public abstract class AbstractRepositoryTest
assertTextPresent( "Repository Scanning - File Types" );
String artifactsTypes = "**/*.pom,**/*.jar,**/*.ear,**/*.war,**/*.car,**/*.sar,**/*.mar,**/*.rar,**/*.dtd,**/*.tld,**/*.tar.gz,**/*.tar.bz2,**/*.zip";
String [] arrayArtifactTypes = artifactsTypes.split( "," );
- for (String artifacttypes : arrayArtifactTypes )
- assertTextPresent( artifacttypes );
+ for (int i = 0; i < arrayArtifactTypes.length; i++)
+ Assert.assertEquals(getSelenium().getTable("//div[@id='contentArea']/div/div[1]/table."+i+".0"), arrayArtifactTypes[i]);
String autoremove = "**/*.bak,**/*~,**/*-";
String [] arrayAutoremove = autoremove.split( "," );
- for ( String arrayautoremove : arrayAutoremove )
- assertTextPresent( arrayautoremove );
+ for (int i = 0; i < arrayAutoremove.length; i++)
+ Assert.assertEquals(getSelenium().getTable("//div[@id='contentArea']/div/div[2]/table."+i+".0"), arrayAutoremove[i]);
String ignored = "**/.htaccess,**/KEYS,**/*.rb,**/*.sh,**/.svn/**,**/.DAV/**";
String [] arrayIgnored = ignored.split( "," );
- for ( String arrayignored : arrayIgnored )
- assertTextPresent( arrayignored );
+ for (int i = 0; i < arrayIgnored.length; i++)
+ Assert.assertEquals(getSelenium().getTable("//div[@id='contentArea']/div/div[3]/table."+i+".0"), arrayIgnored[i]);
String indexableContent = "**/*.txt,**/*.TXT,**/*.block,**/*.config,**/*.pom,**/*.xml,**/*.xsd,**/*.dtd,**/*.tld";
String [] arrayIndexableContent = indexableContent.split( "," );
- for ( String indexablecontent : arrayIndexableContent )
- assertTextPresent( indexablecontent );
+ for (int i = 0; i < arrayIndexableContent.length; i++)
+ Assert.assertEquals(getSelenium().getTable("//div[@id='contentArea']/div/div[4]/table."+i+".0"), arrayIndexableContent[i]);
}
/////////////////////////////////////////////
diff --git a/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/parent/AbstractSearchTest.java b/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/parent/AbstractSearchTest.java
index 410ec14ab..5b787b502 100644
--- a/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/parent/AbstractSearchTest.java
+++ b/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/parent/AbstractSearchTest.java
@@ -25,7 +25,7 @@ public abstract class AbstractSearchTest
//Search
public void goToSearchPage()
{
- if ( !"Apache Archiva \\ Quick Search".equals( getSelenium().getTitle() ) )
+ if ( !"Apache Archiva \\ Quick Search".equals( getTitle() ) )
{
clickLinkWithText( "Search" );
getSelenium().waitForPageToLoad( maxWaitTimeInMs );
@@ -107,6 +107,10 @@ public abstract class AbstractSearchTest
setFieldValue( "rowCount", rowCount );
}
+ if ( repositoryId != null )
+ {
+ selectValue( "filteredSearch_repositoryId", repositoryId );
+ }
clickSubmitWithLocator( "filteredSearch_0" );
}
-} \ No newline at end of file
+}
diff --git a/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/parent/AbstractSeleniumTest.java b/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/parent/AbstractSeleniumTest.java
index 2c697d725..cb4fee208 100644
--- a/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/parent/AbstractSeleniumTest.java
+++ b/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/parent/AbstractSeleniumTest.java
@@ -140,14 +140,13 @@ public abstract class AbstractSeleniumTest {
public void assertPage( String title )
{
- // Collapse spaces
- String actualTitle = getSelenium().getTitle().replaceAll( "[ \n\r]+", " " );
- Assert.assertEquals( actualTitle, title );
+ Assert.assertEquals( getTitle(), title );
}
public String getTitle()
{
- return getSelenium().getTitle();
+ // Collapse spaces
+ return getSelenium().getTitle().replaceAll( "[ \n\r]+", " " );
}
public String getHtmlContent()
diff --git a/archiva-modules/archiva-web/archiva-webapp/pom.xml b/archiva-modules/archiva-web/archiva-webapp/pom.xml
index b39989c85..9edf9a8ff 100644
--- a/archiva-modules/archiva-web/archiva-webapp/pom.xml
+++ b/archiva-modules/archiva-web/archiva-webapp/pom.xml
@@ -23,7 +23,7 @@
<parent>
<groupId>org.apache.archiva</groupId>
<artifactId>archiva-web</artifactId>
- <version>1.3-SNAPSHOT</version>
+ <version>1.4-SNAPSHOT</version>
</parent>
<artifactId>archiva-webapp</artifactId>
<packaging>war</packaging>
@@ -39,6 +39,10 @@
</dependency>
<dependency>
<groupId>org.apache.archiva</groupId>
+ <artifactId>audit</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.archiva</groupId>
<artifactId>archiva-scheduler-repository</artifactId>
</dependency>
<dependency>
@@ -64,7 +68,6 @@
<dependency>
<groupId>org.apache.archiva</groupId>
<artifactId>archiva-metadata-consumer</artifactId>
- <version>1.3-SNAPSHOT</version>
<scope>runtime</scope>
</dependency>
<dependency>
@@ -250,23 +253,19 @@
<dependency>
<groupId>org.apache.archiva</groupId>
<artifactId>metadata-model</artifactId>
- <version>1.3-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.archiva</groupId>
<artifactId>metadata-repository-api</artifactId>
- <version>1.3-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.archiva</groupId>
<artifactId>metadata-repository-file</artifactId>
- <version>1.3-SNAPSHOT</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.apache.archiva</groupId> <!-- FIXME: temporary coupling to plugin, should be runtime -->
<artifactId>maven2-repository</artifactId>
- <version>1.3-SNAPSHOT</version>
</dependency>
</dependencies>
<build>
@@ -307,9 +306,9 @@
<phase>compile</phase>
<configuration>
<tasks>
- <mkdir dir="${basedir}/target/archiva/WEB-INF/"/>
+ <mkdir dir="${basedir}/target/archiva/WEB-INF/" />
<copy todir="${basedir}/target/archiva/WEB-INF/">
- <fileset dir="${basedir}/target" includes="classes/" excludes="**/struts.xml"/>
+ <fileset dir="${basedir}/target" includes="classes/" excludes="**/struts.xml" />
</copy>
</tasks>
</configuration>
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/PlexusActionSupport.java b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/PlexusActionSupport.java
index 5a1d04da7..9fc4d979c 100644
--- a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/PlexusActionSupport.java
+++ b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/PlexusActionSupport.java
@@ -89,7 +89,7 @@ public abstract class PlexusActionSupport
protected void triggerAuditEvent( String resource, String action )
{
- AuditEvent event = new AuditEvent( getPrincipal(), resource, action );
+ AuditEvent event = new AuditEvent( null, getPrincipal(), resource, action );
event.setRemoteIP( getRemoteAddr() );
for ( AuditListener listener : auditListeners )
@@ -100,7 +100,7 @@ public abstract class PlexusActionSupport
protected void triggerAuditEvent( String action )
{
- AuditEvent event = new AuditEvent( getPrincipal(), action );
+ AuditEvent event = new AuditEvent( null, getPrincipal(), null, action );
event.setRemoteIP( getRemoteAddr() );
for ( AuditListener listener : auditListeners )
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/UploadAction.java b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/UploadAction.java
index d560c5a06..0919ee8a1 100644
--- a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/UploadAction.java
+++ b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/UploadAction.java
@@ -147,7 +147,7 @@ public class UploadAction
* @plexus.requirement role="org.apache.archiva.scheduler.ArchivaTaskScheduler" role-hint="repository"
*/
private ArchivaTaskScheduler scheduler;
-
+
private ChecksumAlgorithm[] algorithms = new ChecksumAlgorithm[]{ChecksumAlgorithm.SHA1, ChecksumAlgorithm.MD5};
public void setArtifact( File file )
@@ -415,7 +415,7 @@ public class UploadAction
String msg = "Artifact \'" + groupId + ":" + artifactId + ":" + version +
"\' was successfully deployed to repository \'" + repositoryId + "\'";
- triggerAuditEvent( repositoryId, groupId + ":" + artifactId + ":" + version, AuditEvent.UPLOAD_FILE );
+ triggerAuditEvent( repositoryId, artifactPath, AuditEvent.UPLOAD_FILE );
addActionMessage( msg );
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/reports/ViewAuditLogReportAction.java b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/reports/ViewAuditLogReportAction.java
new file mode 100644
index 000000000..d2244cfa5
--- /dev/null
+++ b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/reports/ViewAuditLogReportAction.java
@@ -0,0 +1,381 @@
+package org.apache.maven.archiva.web.action.reports;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Collections;
+import java.util.Date;
+import java.util.List;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.apache.archiva.audit.AuditManager;
+import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang.time.DateUtils;
+import org.apache.maven.archiva.repository.audit.AuditEvent;
+import org.apache.maven.archiva.security.AccessDeniedException;
+import org.apache.maven.archiva.security.ArchivaSecurityException;
+import org.apache.maven.archiva.security.PrincipalNotFoundException;
+import org.apache.maven.archiva.security.UserRepositories;
+import org.apache.maven.archiva.web.action.PlexusActionSupport;
+import org.apache.struts2.interceptor.ServletRequestAware;
+import org.codehaus.redback.integration.interceptor.SecureAction;
+import org.codehaus.redback.integration.interceptor.SecureActionBundle;
+import org.codehaus.redback.integration.interceptor.SecureActionException;
+
+import com.opensymphony.xwork2.Preparable;
+
+/**
+ * @plexus.component role="com.opensymphony.xwork2.Action" role-hint="viewAuditLogReport"
+ * instantiation-strategy="per-lookup"
+ */
+public class ViewAuditLogReportAction
+ extends PlexusActionSupport
+ implements SecureAction, ServletRequestAware, Preparable
+{
+ protected HttpServletRequest request;
+
+ /**
+ * @plexus.requirement
+ */
+ private UserRepositories userRepositories;
+
+ private String repository;
+
+ private List<String> repositories;
+
+ private String groupId;
+
+ private String artifactId;
+
+ private String startDate;
+
+ private String endDate;
+
+ private int rowCount = 30;
+
+ private int page = 1;
+
+ private String prev;
+
+ private String next;
+
+ protected boolean isLastPage = true;
+
+ private List<AuditEvent> auditLogs;
+
+ private static final String ALL_REPOSITORIES = "all";
+
+ protected int[] range = new int[2];
+
+ private String initial = "true";
+
+ private String headerName;
+
+ private static final String HEADER_LATEST_EVENTS = "Latest Events";
+
+ private static final String HEADER_RESULTS = "Results";
+
+ private String[] datePatterns = new String[] { "MM/dd/yy", "MM/dd/yyyy", "MMMMM/dd/yyyy", "MMMMM/dd/yy",
+ "dd MMMMM yyyy", "dd/MM/yy", "dd/MM/yyyy", "yyyy/MM/dd", "yyyy-MM-dd", "yyyy-dd-MM", "MM-dd-yyyy",
+ "MM-dd-yy" };
+
+ /**
+ * @plexus.requirement
+ */
+ private AuditManager auditManager;
+
+ public SecureActionBundle getSecureActionBundle()
+ throws SecureActionException
+ {
+ return null;
+ }
+
+ public void setServletRequest( HttpServletRequest request )
+ {
+ this.request = request;
+ }
+
+ @SuppressWarnings( "unchecked" )
+ public void prepare()
+ throws Exception
+ {
+ repositories = new ArrayList<String>();
+ repositories.add( ALL_REPOSITORIES );
+ repositories.addAll( getObservableRepositories() );
+
+ auditLogs = null;
+ groupId = "";
+ artifactId = "";
+ repository = "";
+
+ if( Boolean.parseBoolean( initial ) )
+ {
+ headerName = HEADER_LATEST_EVENTS;
+ }
+ else
+ {
+ headerName = HEADER_RESULTS;
+ }
+
+ auditLogs = auditManager.getMostRecentAuditEvents();
+ }
+
+ public String execute()
+ throws Exception
+ {
+ Date startDateInDF;
+ Date endDateInDF;
+ if ( startDate == null || "".equals( startDate ) )
+ {
+ Calendar cal = Calendar.getInstance();
+ cal.set( Calendar.HOUR, 0 );
+ cal.set( Calendar.MINUTE, 0 );
+ cal.set( Calendar.SECOND, 0 );
+
+ startDateInDF = cal.getTime();
+ }
+ else
+ {
+ startDateInDF = DateUtils.parseDate( startDate, datePatterns );
+ }
+
+ if ( endDate == null || "".equals( endDate ) )
+ {
+ endDateInDF = Calendar.getInstance().getTime();
+ }
+ else
+ {
+ endDateInDF = DateUtils.parseDate( endDate, datePatterns );
+ Calendar cal = Calendar.getInstance();
+ cal.setTime( endDateInDF );
+ cal.set( Calendar.HOUR, 23 );
+ cal.set( Calendar.MINUTE, 59 );
+ cal.set( Calendar.SECOND, 59 );
+
+ endDateInDF = cal.getTime();
+ }
+
+ range[0] = ( page - 1 ) * rowCount;
+ range[1] = ( page * rowCount ) + 1;
+
+ String repo = repository.equals( ALL_REPOSITORIES ) ? null : repository;
+ // TODO: query by artifact
+ auditLogs = auditManager.getAuditEventsInRange( repo, startDateInDF, endDateInDF );
+
+ if( auditLogs.isEmpty() )
+ {
+ addActionError( "No audit logs found." );
+ initial = "true";
+ }
+ else
+ {
+ initial = "false";
+ }
+
+ headerName = HEADER_RESULTS;
+ paginate();
+
+ return SUCCESS;
+ }
+
+ private void paginate()
+ {
+ if ( auditLogs.size() <= rowCount )
+ {
+ isLastPage = true;
+ }
+ else
+ {
+ isLastPage = false;
+ auditLogs.remove( rowCount );
+ }
+
+ prev =
+ request.getRequestURL() + "?page=" + ( page - 1 ) + "&rowCount=" + rowCount + "&groupId=" + groupId +
+ "&artifactId=" + artifactId + "&repository=" + repository + "&startDate=" + startDate + "&endDate=" +
+ endDate;
+
+ next =
+ request.getRequestURL() + "?page=" + ( page + 1 ) + "&rowCount=" + rowCount + "&groupId=" + groupId +
+ "&artifactId=" + artifactId + "&repository=" + repository + "&startDate=" + startDate + "&endDate=" +
+ endDate;
+
+ prev = StringUtils.replace( prev, " ", "%20" );
+ next = StringUtils.replace( next, " ", "%20" );
+ }
+
+ private List<String> getObservableRepositories()
+ {
+ try
+ {
+ return userRepositories.getObservableRepositoryIds( getPrincipal() );
+ }
+ catch ( PrincipalNotFoundException e )
+ {
+ log.warn( e.getMessage(), e );
+ }
+ catch ( AccessDeniedException e )
+ {
+ log.warn( e.getMessage(), e );
+ }
+ catch ( ArchivaSecurityException e )
+ {
+ log.warn( e.getMessage(), e );
+ }
+ return Collections.emptyList();
+ }
+
+ public String getRepository()
+ {
+ return repository;
+ }
+
+ public void setRepository( String repository )
+ {
+ this.repository = repository;
+ }
+
+ public List<String> getRepositories()
+ {
+ return repositories;
+ }
+
+ public void setRepositories( List<String> repositories )
+ {
+ this.repositories = repositories;
+ }
+
+ public String getGroupId()
+ {
+ return groupId;
+ }
+
+ public void setGroupId( String groupId )
+ {
+ this.groupId = groupId;
+ }
+
+ public String getArtifactId()
+ {
+ return artifactId;
+ }
+
+ public void setArtifactId( String artifactId )
+ {
+ this.artifactId = artifactId;
+ }
+
+ public List<AuditEvent> getAuditLogs()
+ {
+ return auditLogs;
+ }
+
+ public int getRowCount()
+ {
+ return rowCount;
+ }
+
+ public void setRowCount( int rowCount )
+ {
+ this.rowCount = rowCount;
+ }
+
+ public String getStartDate()
+ {
+ return startDate;
+ }
+
+ public void setStartDate( String startDate )
+ {
+ this.startDate = startDate;
+ }
+
+ public String getEndDate()
+ {
+ return endDate;
+ }
+
+ public void setEndDate( String endDate )
+ {
+ this.endDate = endDate;
+ }
+
+ public int getPage()
+ {
+ return page;
+ }
+
+ public void setPage( int page )
+ {
+ this.page = page;
+ }
+
+ public boolean getIsLastPage()
+ {
+ return isLastPage;
+ }
+
+ public void setIsLastPage( boolean isLastPage )
+ {
+ this.isLastPage = isLastPage;
+ }
+
+ public String getPrev()
+ {
+ return prev;
+ }
+
+ public void setPrev( String prev )
+ {
+ this.prev = prev;
+ }
+
+ public String getNext()
+ {
+ return next;
+ }
+
+ public void setNext( String next )
+ {
+ this.next = next;
+ }
+
+ public String getInitial()
+ {
+ return initial;
+ }
+
+ public void setInitial( String initial )
+ {
+ this.initial = initial;
+ }
+
+ public String getHeaderName()
+ {
+ return headerName;
+ }
+
+ public void setHeaderName( String headerName )
+ {
+ this.headerName = headerName;
+ }
+}
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/util/ContextUtils.java b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/util/ContextUtils.java
index 9579dbba0..f1b689cea 100644
--- a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/util/ContextUtils.java
+++ b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/util/ContextUtils.java
@@ -111,6 +111,12 @@ public class ContextUtils
}
return name;
}
+ else
+ {
+ // respect chains of proxies, return first one (as it's the outermost visible one)
+ String[] hosts = name.split( "," );
+ name = hosts[0].trim();
+ }
return name;
}
}
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/resources/struts.xml b/archiva-modules/archiva-web/archiva-webapp/src/main/resources/struts.xml
index 2f21561c6..02659ff3d 100644
--- a/archiva-modules/archiva-web/archiva-webapp/src/main/resources/struts.xml
+++ b/archiva-modules/archiva-web/archiva-webapp/src/main/resources/struts.xml
@@ -510,6 +510,16 @@
</result>
</action>
+ <!-- audit logs -->
+ <action name="queryAuditLogReport" class="viewAuditLogReport" method="input">
+ <result name="input">/WEB-INF/jsp/reports/auditLogReport.jsp</result>
+ </action>
+
+ <action name="viewAuditLogReport" class="viewAuditLogReport">
+ <result name="input">/WEB-INF/jsp/reports/auditLogReport.jsp</result>
+ <result>/WEB-INF/jsp/reports/auditLogReport.jsp</result>
+ </action>
+
</package>
</struts>
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/accessToNoRepos.jsp b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/accessToNoRepos.jsp
index 2b2e6a66e..c4666f173 100644
--- a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/accessToNoRepos.jsp
+++ b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/accessToNoRepos.jsp
@@ -22,7 +22,7 @@
<html>
<head>
- <title>You have access to no repositories</title>
+ <title>You do not have access to any repository</title>
<s:head/>
</head>
@@ -31,8 +31,8 @@
<div id="contentArea">
<div id="results">
- You have access to no repositories.
- Ask your system administrator for access.
+ You do not have access to any repository.
+ Please contact your system administrator and request for access.
</div>
</div>
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/decorators/default.jsp b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/decorators/default.jsp
index b91f70952..37ebbf517 100644
--- a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/decorators/default.jsp
+++ b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/decorators/default.jsp
@@ -80,7 +80,7 @@
</li>
</ul>
- <redback:ifAnyAuthorized permissions="archiva-upload-repository,archiva-delete-artifact,archiva-manage-users,archiva-access-reports,archiva-manage-configuration">
+ <redback:ifAnyAuthorized permissions="archiva-upload-repository,archiva-delete-artifact,archiva-manage-users,archiva-access-reports,archiva-manage-configuration,archiva-view-audit-logs">
<h5>Manage</h5>
<ul>
<redback:ifAuthorized permission="archiva-access-reports">
@@ -88,6 +88,11 @@
<my:currentWWUrl action="pickReport" namespace="/report">Reports</my:currentWWUrl>
</li>
</redback:ifAuthorized>
+ <redback:ifAuthorized permission="archiva-view-audit-logs">
+ <li class="none">
+ <my:currentWWUrl action="queryAuditLogReport" namespace="/report">Audit Log Report</my:currentWWUrl>
+ </li>
+ </redback:ifAuthorized>
<redback:ifAuthorized permission="archiva-manage-users">
<li class="none">
<my:currentWWUrl action="userlist" namespace="/security">User Management</my:currentWWUrl>
@@ -112,7 +117,7 @@
<li class="none">
<my:currentWWUrl action="deleteArtifact" namespace="/">Delete Artifact</my:currentWWUrl>
</li>
- </redback:ifAuthorized>
+ </redback:ifAuthorized>
<%-- TODO: future options here.
* Repository Statistics.
* Web Services Statistics.
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/reports/auditLogReport.jsp b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/reports/auditLogReport.jsp
new file mode 100644
index 000000000..02d029550
--- /dev/null
+++ b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/reports/auditLogReport.jsp
@@ -0,0 +1,152 @@
+<%--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you under the Apache License, Version 2.0 (the
+ ~ "License"); you may not use this file except in compliance
+ ~ with the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing,
+ ~ software distributed under the License is distributed on an
+ ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ~ KIND, either express or implied. See the License for the
+ ~ specific language governing permissions and limitations
+ ~ under the License.
+ --%>
+
+<%@ taglib prefix="s" uri="/struts-tags" %>
+<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
+<%@ taglib uri="http://www.extremecomponents.org" prefix="ec" %>
+
+<html>
+<head>
+
+ <title>Audit Log Report</title>
+ <s:head theme="ajax" />
+
+ <link rel="stylesheet" href="<c:url value='/css/no-theme/jquery-ui-1.7.2.custom.css'/>" type="text/css" />
+ <script type="text/javascript" src="<c:url value='/js/jquery-1.3.2.min.js'/>"></script>
+ <script type="text/javascript" src="<c:url value='/js/jquery-ui-1.7.2.custom.min.js'/>"></script>
+ <script type="text/javascript" charset="utf-8">
+ $(document).ready(function()
+ {
+ $('#startDate').datepicker()
+ $('#endDate').datepicker()
+ });
+ </script>
+</head>
+
+<body>
+<h1>Audit Log Report</h1>
+
+<div id="contentArea">
+
+ <s:form action="viewAuditLogReport" namespace="/report" validate="false">
+
+ <s:hidden name="initial"/>
+
+ <div id="auditLogReport">
+ <table id="auditLogFieds">
+ <tbody>
+ <tr>
+ <td>Repository: </td>
+ <td><s:select name="repository" list="repositories" theme="simple"/></td>
+ <tr>
+ <tr>
+ <td>Group ID: </td>
+ <td><s:textfield id="groupId" name="groupId" theme="simple"/></td>
+ <tr>
+ <tr>
+ <td>Artifact ID: </td>
+ <td><s:textfield id="artifactId" name="artifactId" theme="simple"/></td>
+ <tr>
+ <tr>
+ <td>Start Date: </td>
+ <td><s:textfield id="startDate" name="startDate" theme="simple"/>
+ <%--
+ <script type="text/javascript">
+ Calendar.setup({
+ inputField : "startDate",
+ ifFormat : "%Y-%m-%d",
+ align : "Tl",
+ singleClick : true
+ });
+ </script>
+ --%>
+ </td>
+ <tr>
+ <tr>
+ <td>End Date: </td>
+ <td><s:textfield id="endDate" name="endDate" theme="simple"/>
+ <%--
+ <script type="text/javascript">
+ Calendar.setup({
+ inputField : "endDate",
+ ifFormat : "%Y-%m-%d",
+ align : "Tl",
+ singleClick : true
+ });
+ </script>
+ --%>
+ </td>
+ <tr>
+ <tr>
+ <td>Row Count: </td>
+ <td><s:textfield name="rowCount" theme="simple"/></td>
+ <tr>
+ <tr>
+ <td/>
+ <td style="text-align: right"><s:submit value="View Audit Log" theme="simple"/></td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+
+ <p/>
+
+ <div class="auditLogReportResults">
+
+ <h2>${headerName}</h2>
+ <p>
+ <s:actionerror/>
+ </p>
+
+ <c:if test="${not empty (auditLogs)}">
+ <table class="auditlogs" cellspacing="0">
+ <tr>
+ <th>Event</th>
+ <th>Repository</th>
+ <th>Resource</th>
+ <th>Event Date</th>
+ <th>Username</th>
+ </tr>
+
+ <c:forEach items="${auditLogs}" var="auditLog" varStatus="i">
+ <tr>
+ <td>${auditLog.action}</td>
+ <td>${auditLog.repositoryId}</td>
+ <td>${auditLog.resource}</td>
+ <td>${auditLog.timestamp}</td>
+ <td>${auditLog.userId}</td>
+ </tr>
+ </c:forEach>
+ </table>
+
+ <s:set name="page" value="page"/>
+ <c:if test="${page > 1}"><a href="<s:property value='prev' />">&lt;&lt;</a></c:if>
+ <strong>Page: </strong>${page}
+ <s:set name="isLastPage" value="isLastPage"/>
+ <c:if test="${!isLastPage}"><a href="<s:property value='next' />">&gt;&gt;</a></c:if>
+ </c:if>
+ </div>
+
+ </s:form>
+
+
+</div>
+
+</body>
+</html>
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 990b5833e..1db6f6b05 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>
</tr>
<c:forEach var="stats" items="${repositoryStatistics}" varStatus="i">
@@ -168,6 +172,10 @@
<td align="right">${stats.totalCountForType['maven-archetype']}</td>
<td align="right">${stats.totalCountForType['jar']}</td>
<td align="right">${stats.totalCountForType['war']}</td>
+ <td align="right">${stats.totalCountForType['ear']}</td>
+ <td align="right">${stats.totalCountForType['exe']}</td>
+ <td align="right">${stats.totalCountForType['dll']}</td>
+ <td align="right">${stats.totalCountForType['zip']}</td>
</tr>
</c:forEach>
</table>
@@ -187,6 +195,10 @@
<th>Archetypes</th>
<th>Jars</th>
<th>Wars</th>
+ <th>Ears</th>
+ <th>Exes</th>
+ <th>Dlls</th>
+ <th>Zips</th>
</tr>
<c:forEach var="stats" items="${repositoryStatistics}">
@@ -201,6 +213,10 @@
<td align="right">${stats.totalCountForType['maven-archetype']}</td>
<td align="right">${stats.totalCountForType['jar']}</td>
<td align="right">${stats.totalCountForType['war']}</td>
+ <td align="right">${stats.totalCountForType['ear']}</td>
+ <td align="right">${stats.totalCountForType['exe']}</td>
+ <td align="right">${stats.totalCountForType['dll']}</td>
+ <td align="right">${stats.totalCountForType['zip']}</td>
</tr>
</c:forEach>
</table>
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/css/site.css b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/css/site.css
index ef9c51eac..9f9322a5f 100644
--- a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/css/site.css
+++ b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/css/site.css
@@ -350,3 +350,40 @@ div.versions a.expand {
list-style-image: url(../images/icon_warning_sml.gif)
}
+table.auditlogs {
+ text-align: center;
+ font-family: Verdana, Geneva, Arial, Helvetica, sans-serif ;
+ font-weight: normal;
+ font-size: 11px;
+ color: #fff;
+ width: 100%;
+ background-color: #666;
+ border: 0px;
+ border-collapse: collapse;
+ border-spacing: 0px;
+}
+
+table.auditlogs th {
+ background-color: #666;
+ color: #fff;
+ padding: 4px;
+ text-align: center;
+ border-bottom: 2px #fff solid;
+ font-size: 12px;
+ font-weight: bold;
+}
+
+table.auditlogs td {
+ background-color: #CCC;
+ color: #000;
+ padding: 4px;
+ text-align: center;
+ border: 1px #fff solid;
+}
+
+div.auditLogReportResults {
+ border: 1px dashed #DFDEDE;
+ margin-bottom: 15px;
+ margin-left: 2px;
+ padding: 5px;
+}
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/UploadActionTest.java b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/UploadActionTest.java
index 9131af530..8a98bd2d6 100644
--- a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/UploadActionTest.java
+++ b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/UploadActionTest.java
@@ -48,10 +48,6 @@ import org.easymock.classextension.MockClassControl;
public class UploadActionTest
extends PlexusInSpringTestCase
{
- private ArchivaTaskScheduler scheduler;
-
- private MockControl schedulerControl;
-
private UploadAction uploadAction;
private ArchivaConfiguration archivaConfig;
@@ -61,25 +57,25 @@ public class UploadActionTest
private RepositoryContentFactory repoFactory;
private MockControl repoFactoryControl;
-
+
private static final String REPOSITORY_ID = "test-repo";
- private Configuration config;
+ private Configuration config;
public void setUp()
throws Exception
{
super.setUp();
- schedulerControl = MockControl.createControl( ArchivaTaskScheduler.class );
- scheduler = (ArchivaTaskScheduler) schedulerControl.getMock();
+ MockControl schedulerControl = MockControl.createControl( ArchivaTaskScheduler.class );
+ ArchivaTaskScheduler scheduler = (ArchivaTaskScheduler) schedulerControl.getMock();
archivaConfigControl = MockControl.createControl( ArchivaConfiguration.class );
archivaConfig = (ArchivaConfiguration) archivaConfigControl.getMock();
repoFactoryControl = MockClassControl.createControl( RepositoryContentFactory.class );
repoFactory = (RepositoryContentFactory) repoFactoryControl.getMock();
-
+
uploadAction = new UploadAction();
uploadAction.setScheduler( scheduler );
uploadAction.setConfiguration( archivaConfig );
@@ -411,7 +407,7 @@ public class UploadActionTest
archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config );
repoFactoryControl.expectAndReturn( repoFactory.getManagedRepositoryContent( REPOSITORY_ID ), content );
-
+
archivaConfigControl.replay();
repoFactoryControl.replay();
@@ -505,10 +501,10 @@ public class UploadActionTest
archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config, 2 );
repoFactoryControl.expectAndReturn( repoFactory.getManagedRepositoryContent( REPOSITORY_ID ), content, 2 );
-
+
archivaConfigControl.replay();
repoFactoryControl.replay();
-
+
String returnString = uploadAction.doUpload();
assertEquals( Action.SUCCESS, returnString );
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/DisableProxyConnectorActionTest.java b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/DisableProxyConnectorActionTest.java
index b510a144d..becbd156e 100644
--- a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/DisableProxyConnectorActionTest.java
+++ b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/DisableProxyConnectorActionTest.java
@@ -40,7 +40,7 @@ public class DisableProxyConnectorActionTest extends AbstractWebworkTestCase
private MockControl archivaConfigurationControl;
private ArchivaConfiguration archivaConfiguration;
-
+
public void testConfirmDisableBadSourceOrTarget()
throws Exception
{
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/repositories/AddManagedRepositoryActionTest.java b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/repositories/AddManagedRepositoryActionTest.java
index ef32ea249..61479d247 100644
--- a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/repositories/AddManagedRepositoryActionTest.java
+++ b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/repositories/AddManagedRepositoryActionTest.java
@@ -51,7 +51,7 @@ public class AddManagedRepositoryActionTest
private MockControl archivaConfigurationControl;
private ArchivaConfiguration archivaConfiguration;
-
+
private static final String REPO_ID = "repo-ident";
private File location;
@@ -145,8 +145,7 @@ public class AddManagedRepositoryActionTest
assertFalse( location.exists() );
String status = action.commit();
assertEquals( Action.SUCCESS, status );
- assertTrue( location.exists() );
-
+ assertTrue( location.exists() );
assertEquals( Collections.singletonList( repository ), configuration.getManagedRepositories() );
roleManagerControl.verify();
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/repositories/DeleteManagedRepositoryActionTest.java b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/repositories/DeleteManagedRepositoryActionTest.java
index d4f631679..a7bf0b97e 100644
--- a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/repositories/DeleteManagedRepositoryActionTest.java
+++ b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/repositories/DeleteManagedRepositoryActionTest.java
@@ -79,7 +79,7 @@ public class DeleteManagedRepositoryActionTest
archivaConfigurationControl = MockControl.createControl( ArchivaConfiguration.class );
archivaConfiguration = (ArchivaConfiguration) archivaConfigurationControl.getMock();
action.setArchivaConfiguration( archivaConfiguration );
-
+
roleManagerControl = MockControl.createControl( RoleManager.class );
roleManager = (RoleManager) roleManagerControl.getMock();
action.setRoleManager( roleManager );
@@ -127,9 +127,10 @@ public class DeleteManagedRepositoryActionTest
ManagedRepositoryConfiguration repository = action.getRepository();
assertNotNull( repository );
assertRepositoryEquals( repository, createRepository() );
-
+
String status = action.execute();
assertEquals( Action.SUCCESS, status );
+
repository = action.getRepository();
assertRepositoryEquals( repository, createRepository() );
assertEquals( Collections.singletonList( originalRepository ), configuration.getManagedRepositories() );
@@ -146,7 +147,7 @@ public class DeleteManagedRepositoryActionTest
Configuration configuration = prepDeletionTest( createRepository(), 4 );
- String status = action.deleteEntry();
+ String status = action.deleteEntry();
assertEquals( Action.SUCCESS, status );
@@ -168,7 +169,7 @@ public class DeleteManagedRepositoryActionTest
Configuration configuration = prepDeletionTest( createRepository(), 4 );
String status = action.deleteContents();
-
+
assertEquals( Action.SUCCESS, status );
assertTrue( configuration.getManagedRepositories().isEmpty() );
@@ -194,6 +195,7 @@ public class DeleteManagedRepositoryActionTest
assertEquals( 1, configuration.getProxyConnectors().size() );
String status = action.deleteContents();
+
assertEquals( Action.SUCCESS, status );
assertTrue( configuration.getManagedRepositories().isEmpty() );
@@ -211,6 +213,7 @@ public class DeleteManagedRepositoryActionTest
ManagedRepositoryConfiguration originalRepository = createRepository();
Configuration configuration = prepDeletionTest( originalRepository, 3 );
+
String status = action.execute();
assertEquals( Action.SUCCESS, status );
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/repositories/EditManagedRepositoryActionTest.java b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/repositories/EditManagedRepositoryActionTest.java
index f9b4a7ae6..7c894ea32 100644
--- a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/repositories/EditManagedRepositoryActionTest.java
+++ b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/repositories/EditManagedRepositoryActionTest.java
@@ -140,10 +140,10 @@ public class EditManagedRepositoryActionTest
ManagedRepositoryConfiguration repository = action.getRepository();
populateRepository( repository );
repository.setName( "new repo name" );
-
+
String status = action.commit();
assertEquals( Action.SUCCESS, status );
-
+
ManagedRepositoryConfiguration newRepository = createRepository();
newRepository.setName( "new repo name" );
assertRepositoryEquals( repository, newRepository );
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/action/admin/connectors/proxy/EditProxyConnectorActionTest.xml b/archiva-modules/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/action/admin/connectors/proxy/EditProxyConnectorActionTest.xml
index dc32d3f3d..c01790ca8 100644
--- a/archiva-modules/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/action/admin/connectors/proxy/EditProxyConnectorActionTest.xml
+++ b/archiva-modules/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/action/admin/connectors/proxy/EditProxyConnectorActionTest.xml
@@ -38,7 +38,7 @@
<!-- 30 minutes = 1800 seconds -->
<time-to-live-seconds>1800</time-to-live-seconds>
</configuration>
- </component>
+ </component>
</components>
</plexus>
diff --git a/archiva-modules/archiva-web/archiva-webdav/pom.xml b/archiva-modules/archiva-web/archiva-webdav/pom.xml
index 95341522e..d85241cee 100644
--- a/archiva-modules/archiva-web/archiva-webdav/pom.xml
+++ b/archiva-modules/archiva-web/archiva-webdav/pom.xml
@@ -23,7 +23,7 @@
<parent>
<groupId>org.apache.archiva</groupId>
<artifactId>archiva-web</artifactId>
- <version>1.3-SNAPSHOT</version>
+ <version>1.4-SNAPSHOT</version>
</parent>
<artifactId>archiva-webdav</artifactId>
diff --git a/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/ArchivaDavResource.java b/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/ArchivaDavResource.java
index eff87127e..23727d0b4 100644
--- a/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/ArchivaDavResource.java
+++ b/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/ArchivaDavResource.java
@@ -403,9 +403,15 @@ public class ArchivaDavResource
private void triggerAuditEvent( DavResource member, String event ) throws DavException
{
String path = logicalResource + "/" + member.getDisplayName();
-
- triggerAuditEvent( checkDavResourceIsArchivaDavResource( member ).remoteAddr, locator.getRepositoryId(), path,
- event );
+
+ ArchivaDavResource resource = checkDavResourceIsArchivaDavResource( member );
+ AuditEvent auditEvent = new AuditEvent( locator.getRepositoryId(), resource.principal, path, event );
+ auditEvent.setRemoteIP( resource.remoteAddr );
+
+ for ( AuditListener listener : auditListeners )
+ {
+ listener.auditEvent( auditEvent );
+ }
}
public void move( DavResource destination )
diff --git a/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/ArchivaDavResourceFactory.java b/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/ArchivaDavResourceFactory.java
index c1cd85cf3..e92f87a32 100644
--- a/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/ArchivaDavResourceFactory.java
+++ b/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/ArchivaDavResourceFactory.java
@@ -528,7 +528,7 @@ public class ArchivaDavResourceFactory
log.debug( "Creating destination directory '" + destDir.getName() + "' (current user '" +
activePrincipal + "')" );
- triggerAuditEvent( request.getRemoteAddr(), logicalResource.getPath(), relPath,
+ triggerAuditEvent( request.getRemoteAddr(), managedRepository.getId(), relPath,
AuditEvent.CREATE_DIR, activePrincipal );
}
}
diff --git a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/maven/archiva/webdav/ArchivaDavResourceFactoryTest.java b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/maven/archiva/webdav/ArchivaDavResourceFactoryTest.java
index b2f38fdb4..0d30388bb 100644
--- a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/maven/archiva/webdav/ArchivaDavResourceFactoryTest.java
+++ b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/maven/archiva/webdav/ArchivaDavResourceFactoryTest.java
@@ -81,7 +81,7 @@ public class ArchivaDavResourceFactoryTest
private MockControl repoContentFactoryControl;
private RepositoryContentFactory repoFactory;
-
+
public void setUp()
throws Exception
{
@@ -96,7 +96,7 @@ public class ArchivaDavResourceFactoryTest
archivaConfigurationControl = MockControl.createControl( ArchivaConfiguration.class );
archivaConfiguration = (ArchivaConfiguration) archivaConfigurationControl.getMock();
-
+
config = new Configuration();
config.addManagedRepository( createManagedRepository( RELEASES_REPO, new File( getBasedir(),
"target/test-classes/" +
@@ -392,7 +392,7 @@ public class ArchivaDavResourceFactoryTest
long date = 2039842134;
response.addDateHeader( "last-modified", date );
responseControl.setVoidCallable();
-
+
archivaConfigurationControl.replay();
repoContentFactoryControl.replay();
requestControl.replay();
diff --git a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/maven/archiva/webdav/DavResourceTest.java b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/maven/archiva/webdav/DavResourceTest.java
index 8b656d8ec..8e22e72de 100644
--- a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/maven/archiva/webdav/DavResourceTest.java
+++ b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/maven/archiva/webdav/DavResourceTest.java
@@ -77,11 +77,12 @@ public class DavResourceTest
myResource = new File( baseDir, "myresource.jar" );
assertTrue( "Could not create " + myResource.getAbsolutePath(), myResource.createNewFile() );
resourceFactory = new RootContextDavResourceFactory();
+
resourceLocator =
- (ArchivaDavResourceLocator) new ArchivaDavLocatorFactory().createResourceLocator( "/", REPOPATH );
+ (ArchivaDavResourceLocator) new ArchivaDavLocatorFactory().createResourceLocator( "/", REPOPATH );
resource = getDavResource( resourceLocator.getHref( false ), myResource );
lockManager = new SimpleLockManager();
- resource.addLockManager( lockManager );
+ resource.addLockManager( lockManager );
}
@Override
diff --git a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/maven/archiva/webdav/RepositoryServletSecurityTest.java b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/maven/archiva/webdav/RepositoryServletSecurityTest.java
index 9066331de..f4119959f 100644
--- a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/maven/archiva/webdav/RepositoryServletSecurityTest.java
+++ b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/maven/archiva/webdav/RepositoryServletSecurityTest.java
@@ -39,6 +39,7 @@ import org.codehaus.plexus.redback.authentication.AuthenticationResult;
import org.codehaus.plexus.redback.authorization.UnauthorizedException;
import org.codehaus.plexus.redback.system.DefaultSecuritySession;
import org.codehaus.plexus.redback.system.SecuritySession;
+import org.codehaus.plexus.redback.users.User;
import org.codehaus.plexus.redback.users.memory.SimpleUser;
import org.codehaus.plexus.spring.PlexusInSpringTestCase;
import org.codehaus.redback.integration.filter.authentication.HttpAuthenticator;
@@ -352,11 +353,14 @@ public class RepositoryServletSecurityTest
httpAuthControl.expectAndReturn( httpAuth.getAuthenticationResult( null, null ), result );
servletAuthControl.expectAndReturn( servletAuth.isAuthenticated( null, null ), true );
+ User user = new SimpleUser();
+ user.setUsername( "admin" );
+
// ArchivaDavResourceFactory#isAuthorized()
SecuritySession session = new DefaultSecuritySession();
httpAuthControl.expectAndReturn( httpAuth.getAuthenticationResult( null, null ), result );
httpAuthControl.expectAndReturn( httpAuth.getSecuritySession( ic.getRequest().getSession( true ) ), session );
- httpAuthControl.expectAndReturn( httpAuth.getSessionUser( ic.getRequest().getSession() ), new SimpleUser() );
+ httpAuthControl.expectAndReturn( httpAuth.getSessionUser( ic.getRequest().getSession() ), user );
servletAuthControl.expectAndReturn( servletAuth.isAuthenticated( null, result ), true );
servletAuthControl.expectAndReturn(
servletAuth.isAuthorized( null, session, "internal",
diff --git a/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-api/pom.xml b/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-api/pom.xml
index 8a190a1e2..b307f9b1b 100644
--- a/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-api/pom.xml
+++ b/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-api/pom.xml
@@ -4,7 +4,7 @@
<parent>
<groupId>org.apache.archiva</groupId>
<artifactId>archiva-xmlrpc</artifactId>
- <version>1.3-SNAPSHOT</version>
+ <version>1.4-SNAPSHOT</version>
</parent>
<artifactId>archiva-xmlrpc-api</artifactId>
<name>Archiva Web :: XML-RPC API</name>
diff --git a/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-client/pom.xml b/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-client/pom.xml
index 492d5b8d4..b020b60bf 100644
--- a/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-client/pom.xml
+++ b/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-client/pom.xml
@@ -19,7 +19,7 @@
<parent>
<artifactId>archiva-xmlrpc</artifactId>
<groupId>org.apache.archiva</groupId>
- <version>1.3-SNAPSHOT</version>
+ <version>1.4-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>archiva-xmlrpc-client</artifactId>
diff --git a/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-security/pom.xml b/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-security/pom.xml
index 62d2859a0..159002b45 100644
--- a/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-security/pom.xml
+++ b/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-security/pom.xml
@@ -23,7 +23,7 @@
<parent>
<groupId>org.apache.archiva</groupId>
<artifactId>archiva-xmlrpc</artifactId>
- <version>1.3-SNAPSHOT</version>
+ <version>1.4-SNAPSHOT</version>
</parent>
<artifactId>archiva-xmlrpc-security</artifactId>
<name>Archiva Web :: XML-RPC Security</name>
diff --git a/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/pom.xml b/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/pom.xml
index 665095d74..ab685fb61 100644
--- a/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/pom.xml
+++ b/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/pom.xml
@@ -23,7 +23,7 @@
<parent>
<groupId>org.apache.archiva</groupId>
<artifactId>archiva-xmlrpc</artifactId>
- <version>1.3-SNAPSHOT</version>
+ <version>1.4-SNAPSHOT</version>
</parent>
<artifactId>archiva-xmlrpc-services</artifactId>
<name>Archiva Web :: XML-RPC Services</name>
diff --git a/archiva-modules/archiva-web/archiva-xmlrpc/pom.xml b/archiva-modules/archiva-web/archiva-xmlrpc/pom.xml
index 923bd525c..d9abce24a 100644
--- a/archiva-modules/archiva-web/archiva-xmlrpc/pom.xml
+++ b/archiva-modules/archiva-web/archiva-xmlrpc/pom.xml
@@ -22,7 +22,7 @@
<parent>
<groupId>org.apache.archiva</groupId>
<artifactId>archiva-web</artifactId>
- <version>1.3-SNAPSHOT</version>
+ <version>1.4-SNAPSHOT</version>
</parent>
<artifactId>archiva-xmlrpc</artifactId>
<name>Archiva Web :: XML-RPC</name>
diff --git a/archiva-modules/archiva-web/pom.xml b/archiva-modules/archiva-web/pom.xml
index c65901d1a..c4b17053d 100644
--- a/archiva-modules/archiva-web/pom.xml
+++ b/archiva-modules/archiva-web/pom.xml
@@ -20,7 +20,7 @@
<parent>
<groupId>org.apache.archiva</groupId>
<artifactId>archiva-modules</artifactId>
- <version>1.3-SNAPSHOT</version>
+ <version>1.4-SNAPSHOT</version>
</parent>
<artifactId>archiva-web</artifactId>