summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaria Odea B. Ching <oching@apache.org>2010-01-11 15:07:00 +0000
committerMaria Odea B. Ching <oching@apache.org>2010-01-11 15:07:00 +0000
commitb44ad982c3afa5a3f34c4fd682eea9b2925e7898 (patch)
tree82f0e33d846d78042ba69a379e7d7a8745f9d8fb
parent9b2e1cfa421364675e53fbc450508015747eea74 (diff)
downloadarchiva-b44ad982c3afa5a3f34c4fd682eea9b2925e7898.tar.gz
archiva-b44ad982c3afa5a3f34c4fd682eea9b2925e7898.zip
[MRM-1296] Audit logging report
merged MRM-1296 branch to trunk git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@897892 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--archiva-docs/src/site/apt/userguide/auditlog-report.apt38
-rw-r--r--archiva-docs/src/site/apt/userguide/index.apt2
-rw-r--r--archiva-docs/src/site/resources/images/latest-events.pngbin0 -> 72218 bytes
-rw-r--r--archiva-docs/src/site/site.xml1
-rwxr-xr-xarchiva-modules/archiva-base/archiva-model/pom.xml2
-rw-r--r--archiva-modules/archiva-base/archiva-model/src/main/mdo/archiva-base.xml75
-rw-r--r--archiva-modules/archiva-database/src/main/java/org/apache/maven/archiva/database/ArchivaAuditLogsDao.java35
-rw-r--r--archiva-modules/archiva-database/src/main/java/org/apache/maven/archiva/database/constraints/ArchivaAuditLogsConstraint.java106
-rw-r--r--archiva-modules/archiva-database/src/main/java/org/apache/maven/archiva/database/constraints/MostRecentArchivaAuditLogsConstraint.java49
-rw-r--r--archiva-modules/archiva-database/src/main/java/org/apache/maven/archiva/database/jdo/JdoAccess.java2
-rw-r--r--archiva-modules/archiva-database/src/main/java/org/apache/maven/archiva/database/jdo/JdoArchivaAuditLogsDao.java62
-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/src/test/testng/config/testng.xml1
-rw-r--r--archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/AuditLogsReportTest.java125
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/PlexusActionSupport.java22
-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.java433
-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/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/css/site.css44
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/UploadActionTest.java51
-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.java18
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/repositories/ArchivaAuditLogsDaoStub.java34
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/repositories/DeleteManagedRepositoryActionTest.java34
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/repositories/EditManagedRepositoryActionTest.java23
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/action/BrowseActionTest.xml5
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/action/ShowArtifactActionTest.xml5
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/action/admin/appearance/EditOrganizationInfoActionTest.xml28
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/action/admin/appearance/OrganizationInfoActionTest.xml28
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/action/admin/connectors/proxy/AddProxyConnectorActionTest.xml6
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/action/admin/connectors/proxy/DeleteProxyConnectorActionTest.xml28
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/action/admin/connectors/proxy/DisableProxyConnectorActionTest.xml28
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/action/admin/connectors/proxy/EditProxyConnectorActionTest.xml8
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/action/admin/connectors/proxy/EnableProxyConnectorActionTest.xml28
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/action/admin/connectors/proxy/ProxyConnectorsActionTest.xml28
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/action/admin/connectors/proxy/SortProxyConnectorsActionTest.xml28
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/action/admin/repositories/AbstractManagedRepositoriesActionTest.xml8
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/action/admin/repositories/AddRemoteRepositoryActionTest.xml28
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/action/admin/repositories/DeleteManagedRepositoryActionTest.xml7
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/action/admin/repositories/DeleteRemoteRepositoryActionTest.xml28
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/action/admin/repositories/DeleteRepositoryGroupActionTest.xml28
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/action/admin/repositories/EditRemoteRepositoryActionTest.xml28
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/action/admin/repositories/RepositoriesActionTest.xml5
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/action/admin/repositories/RepositoryGroupsActionTest.xml28
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/action/admin/repositories/SortRepositoriesActionTest.xml28
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/action/reports/GenerateReportActionTest.xml7
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/rss/RssFeedServletTest.xml5
-rw-r--r--archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/ArchivaDavResource.java33
-rw-r--r--archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/ArchivaDavResourceFactory.java23
-rw-r--r--archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/maven/archiva/webdav/ArchivaDavResourceFactoryTest.java13
-rw-r--r--archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/maven/archiva/webdav/DavResourceTest.java42
-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-webdav/src/test/resources/org/apache/maven/archiva/webdav/RepositoryServletSecurityTest.xml5
-rw-r--r--archiva-modules/archiva-web/archiva-webdav/src/test/resources/org/apache/maven/archiva/webdav/RepositoryServletTest.xml5
57 files changed, 1849 insertions, 45 deletions
diff --git a/archiva-docs/src/site/apt/userguide/auditlog-report.apt b/archiva-docs/src/site/apt/userguide/auditlog-report.apt
new file mode 100644
index 000000000..c2eb93cbe
--- /dev/null
+++ b/archiva-docs/src/site/apt/userguide/auditlog-report.apt
@@ -0,0 +1,38 @@
+ ------
+ Audit Log Report
+ ------
+
+Audit Log Report
+
+ Starting with Archiva 1.3, audit events can be viewed and queried from the web UI. In the current implementation, only artifact upload events are viewable
+ but there are plans to include other events such as artifact delete, repository creation and deletion, configuration changes, etc.
+
+ To view the audit events, click <<<Audit Log Report>>> from the navigation menu. Initially, the latest 10 artifact upload events are displayed.
+
+[../images/latest-events.png] Latest Events
+
+* Customizing the Audit Log Report
+
+ The following fields can be specified when querying for the audit events:
+
+ [[1]] Repository - the repository where the events happened. Only those repositories which the logged in user has permission to access are listed in the drop-down
+ box.
+
+ [[2]] Group ID - the <<<groupId>>> of the artifact whose audit events you want to view.
+
+ [[3]] Artifact ID - the <<<artifactId>>> of the artifact whose audit events you want to view.
+
+ [[4]] Start Date - the start date of the event(s) you want to view. This defaults to the current date if none is specified.
+
+ [[5]] End Date - the end date of the event(s) you want to view. This defaults to the current date if none is specified.
+
+ [[6]] Row Count - the number of rows you want displayed per page. This will be the basis for the pagination of the results. The default value is 30 rows.
+
+ []
+
+ Just specify values for either one or all of the above fields and then submit the form to perform the query. The results of the query will be displayed at the lower
+ section of the page, similar to that shown in the <<<Latest Events>>> except that the heading will be <<<Results>>> instead of <<<Latest Events>>>.
+
+
+
+
diff --git a/archiva-docs/src/site/apt/userguide/index.apt b/archiva-docs/src/site/apt/userguide/index.apt
index d79e6eb3d..4227e8f46 100644
--- a/archiva-docs/src/site/apt/userguide/index.apt
+++ b/archiva-docs/src/site/apt/userguide/index.apt
@@ -20,6 +20,8 @@ Users Guide
* {{{virtual-repositories.html} Configuring Virtual Repositories}}
* {{{rss.html}RSS Feeds in Archiva}}
+
+ * {{{auditlog-report.html}Viewing the Audit Log Report}}
[]
diff --git a/archiva-docs/src/site/resources/images/latest-events.png b/archiva-docs/src/site/resources/images/latest-events.png
new file mode 100644
index 000000000..823234031
--- /dev/null
+++ b/archiva-docs/src/site/resources/images/latest-events.png
Binary files differ
diff --git a/archiva-docs/src/site/site.xml b/archiva-docs/src/site/site.xml
index ca9eb0e0f..9c6650c2a 100644
--- a/archiva-docs/src/site/site.xml
+++ b/archiva-docs/src/site/site.xml
@@ -40,6 +40,7 @@
<item name="Deploying to repository" href="/userguide/deploy.html" />
<item name="Configuring Virtual Repositories" href="/userguide/virtual-repositories.html" />
<item name="Rss Feeds in Archiva" href="/userguide/rss.html"/>
+ <item name="Audit Log Report" href="/userguide/auditlog-report.html"/>
</menu>
<menu name="Administrators Guide">
diff --git a/archiva-modules/archiva-base/archiva-model/pom.xml b/archiva-modules/archiva-base/archiva-model/pom.xml
index f686016c9..f24fd3724 100755
--- a/archiva-modules/archiva-base/archiva-model/pom.xml
+++ b/archiva-modules/archiva-base/archiva-model/pom.xml
@@ -70,7 +70,7 @@
<groupId>org.codehaus.modello</groupId>
<artifactId>modello-maven-plugin</artifactId>
<configuration>
- <version>1.2.1</version>
+ <version>1.3.0</version>
<packageWithVersion>false</packageWithVersion>
<models>
<model>src/main/mdo/archiva-base.xml</model>
diff --git a/archiva-modules/archiva-base/archiva-model/src/main/mdo/archiva-base.xml b/archiva-modules/archiva-base/archiva-model/src/main/mdo/archiva-base.xml
index de08a8d7b..93e4a295a 100644
--- a/archiva-modules/archiva-base/archiva-model/src/main/mdo/archiva-base.xml
+++ b/archiva-modules/archiva-base/archiva-model/src/main/mdo/archiva-base.xml
@@ -5,7 +5,7 @@
xsd.target-namespace="http://archiva.apache.org/model/1.2.0">
<id>archiva-base-model</id>
<name>ArchivaBaseModel</name>
- <version>1.2.1</version>
+ <version>1.3.0</version>
<description>Archiva Model</description>
<defaults>
<default>
@@ -75,6 +75,14 @@
<multiplicity>*</multiplicity>
</association>
</field>
+ <field>
+ <name>archivaAuditLogs</name>
+ <version>1.3.0+</version>
+ <association>
+ <type>ArchivaAuditLogs</type>
+ <multiplicity>*</multiplicity>
+ </association>
+ </field>
</fields>
<codeSegments>
<codeSegment>
@@ -2278,5 +2286,70 @@
</codeSegment>
</codeSegments>
</class>
+ <class stash.storable="true"
+ jpox.table="AUDIT_LOGS">
+ <name>ArchivaAuditLogs</name>
+ <version>1.3.0+</version>
+ <fields>
+ <field stash.maxSize="50">
+ <name>repositoryId</name>
+ <version>1.3.0+</version>
+ <identifier>false</identifier>
+ <required>true</required>
+ <type>String</type>
+ <description>
+ The repository id where the operation was done.
+ </description>
+ </field>
+ <field>
+ <name>eventDate</name>
+ <version>1.3.0+</version>
+ <identifier>false</identifier>
+ <required>true</required>
+ <type>Date</type>
+ <description>
+ The timestamp on when the event happened.
+ </description>
+ </field>
+ <field>
+ <name>artifact</name>
+ <version>1.3.0+</version>
+ <identifier>false</identifier>
+ <required>false</required>
+ <type>String</type>
+ <description>
+ The affected artifact, if there is one.
+ </description>
+ </field>
+ <field>
+ <name>event</name>
+ <version>1.3.0+</version>
+ <identifier>false</identifier>
+ <required>false</required>
+ <type>String</type>
+ <description>
+ The event that happened.
+ </description>
+ </field>
+ <field>
+ <name>username</name>
+ <version>1.3.0+</version>
+ <identifier>false</identifier>
+ <required>true</required>
+ <type>String</type>
+ <description>
+ The user who executed the event.
+ </description>
+ </field>
+ </fields>
+ <codeSegments>
+ <codeSegment>
+ <version>1.3.0+</version>
+ <code><![CDATA[
+ private static final long serialVersionUID = -7113629916828442780L;
+ ]]></code>
+ </codeSegment>
+ </codeSegments>
+ </class>
</classes>
</model>
diff --git a/archiva-modules/archiva-database/src/main/java/org/apache/maven/archiva/database/ArchivaAuditLogsDao.java b/archiva-modules/archiva-database/src/main/java/org/apache/maven/archiva/database/ArchivaAuditLogsDao.java
new file mode 100644
index 000000000..639c5d623
--- /dev/null
+++ b/archiva-modules/archiva-database/src/main/java/org/apache/maven/archiva/database/ArchivaAuditLogsDao.java
@@ -0,0 +1,35 @@
+package org.apache.maven.archiva.database;
+
+/*
+ * 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.List;
+
+import org.apache.maven.archiva.model.ArchivaAuditLogs;
+
+public interface ArchivaAuditLogsDao
+{
+ public List<ArchivaAuditLogs> queryAuditLogs( Constraint constraint )
+ throws ObjectNotFoundException, ArchivaDatabaseException;
+
+ public ArchivaAuditLogs saveAuditLogs( ArchivaAuditLogs logs );
+
+ public void deleteAuditLogs( ArchivaAuditLogs logs )
+ throws ArchivaDatabaseException;
+}
diff --git a/archiva-modules/archiva-database/src/main/java/org/apache/maven/archiva/database/constraints/ArchivaAuditLogsConstraint.java b/archiva-modules/archiva-database/src/main/java/org/apache/maven/archiva/database/constraints/ArchivaAuditLogsConstraint.java
new file mode 100644
index 000000000..ed225ae6f
--- /dev/null
+++ b/archiva-modules/archiva-database/src/main/java/org/apache/maven/archiva/database/constraints/ArchivaAuditLogsConstraint.java
@@ -0,0 +1,106 @@
+package org.apache.maven.archiva.database.constraints;
+
+/*
+ * 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.Date;
+import java.util.List;
+
+/**
+ * ArchivaAuditLogsConstraint
+ */
+public class ArchivaAuditLogsConstraint
+ extends RangeConstraint
+{
+ private String whereClause;
+
+ private void createWhereClause( String desiredArtifact, String desiredRepositoryId, String desiredEvent,
+ Date startDate, Date endDate )
+ {
+ whereClause = "eventDate >= desiredStartDate && eventDate <= desiredEndDate";
+ declImports = new String[] { "import java.util.Date" };
+
+ List<String> declParamsList = new ArrayList<String>();
+ declParamsList.add( "Date desiredStartDate" );
+ declParamsList.add( "Date desiredEndDate" );
+
+ List<Object> paramsList = new ArrayList<Object>();
+ paramsList.add( startDate );
+ paramsList.add( endDate );
+
+ if ( desiredArtifact != null && !"".equals( desiredArtifact ) )
+ {
+ whereClause = whereClause + " && artifact.like(desiredArtifact)";
+ declParamsList.add( "String desiredArtifact" );
+ paramsList.add( desiredArtifact );
+ }
+
+ if ( desiredRepositoryId != null && !"".equals( desiredRepositoryId ) )
+ {
+ whereClause = whereClause + " && repositoryId == desiredRepositoryId";
+ declParamsList.add( "String desiredRepositoryId" );
+ paramsList.add( desiredRepositoryId );
+ }
+
+ if ( desiredEvent != null && !"".equals( desiredEvent ) )
+ {
+ whereClause = whereClause + " && event == desiredEvent";
+ declParamsList.add( "String desiredEvent" );
+ paramsList.add( desiredEvent );
+ }
+
+ int size = declParamsList.size();
+ int i = 0;
+ declParams = new String[size];
+
+ while( i < size )
+ {
+ declParams[i] = declParamsList.get( i );
+ i++;
+ }
+
+ params = paramsList.toArray();
+ }
+
+ public ArchivaAuditLogsConstraint( int[] range, String desiredArtifact, String desiredRepositoryId,
+ String desiredEvent, Date startDate, Date endDate )
+ {
+ super( range );
+ createWhereClause( desiredArtifact, desiredRepositoryId, desiredEvent, startDate, endDate );
+ }
+
+ public ArchivaAuditLogsConstraint( String desiredArtifact, String desiredRepositoryId,
+ String desiredEvent, Date startDate, Date endDate )
+ {
+ super();
+ createWhereClause( desiredArtifact, desiredRepositoryId, desiredEvent, startDate, endDate );
+ }
+
+
+ public String getSortColumn()
+ {
+ return "eventDate";
+ }
+
+ public String getWhereCondition()
+ {
+ return whereClause;
+ }
+}
diff --git a/archiva-modules/archiva-database/src/main/java/org/apache/maven/archiva/database/constraints/MostRecentArchivaAuditLogsConstraint.java b/archiva-modules/archiva-database/src/main/java/org/apache/maven/archiva/database/constraints/MostRecentArchivaAuditLogsConstraint.java
new file mode 100644
index 000000000..8e2d00531
--- /dev/null
+++ b/archiva-modules/archiva-database/src/main/java/org/apache/maven/archiva/database/constraints/MostRecentArchivaAuditLogsConstraint.java
@@ -0,0 +1,49 @@
+package org.apache.maven.archiva.database.constraints;
+
+/*
+ * 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.maven.archiva.model.ArchivaAuditLogs;
+import org.apache.maven.archiva.repository.audit.AuditEvent;
+
+public class MostRecentArchivaAuditLogsConstraint
+ extends AbstractSimpleConstraint
+{
+ private String sql;
+
+ public MostRecentArchivaAuditLogsConstraint()
+ {
+ sql =
+ "SELECT FROM " + ArchivaAuditLogs.class.getName() +
+ " WHERE event == uploadArtifact PARAMETERS String uploadArtifact" +
+ " ORDER BY eventDate DESCENDING RANGE 0,10";
+
+ super.params = new Object[] { AuditEvent.UPLOAD_FILE };
+ }
+
+ public Class<?> getResultClass()
+ {
+ return ArchivaAuditLogs.class;
+ }
+
+ public String getSelectSql()
+ {
+ return sql;
+ }
+}
diff --git a/archiva-modules/archiva-database/src/main/java/org/apache/maven/archiva/database/jdo/JdoAccess.java b/archiva-modules/archiva-database/src/main/java/org/apache/maven/archiva/database/jdo/JdoAccess.java
index 27c39bf52..dd38dfe52 100644
--- a/archiva-modules/archiva-database/src/main/java/org/apache/maven/archiva/database/jdo/JdoAccess.java
+++ b/archiva-modules/archiva-database/src/main/java/org/apache/maven/archiva/database/jdo/JdoAccess.java
@@ -395,7 +395,7 @@ public class JdoAccess
case 3:
return (List<?>) query.execute( parameters[0], parameters[1], parameters[2] );
default:
- throw new JDOException( "Unable to use more than 3 parameters." );
+ return (List<?>) query.executeWithArray( parameters );
}
}
diff --git a/archiva-modules/archiva-database/src/main/java/org/apache/maven/archiva/database/jdo/JdoArchivaAuditLogsDao.java b/archiva-modules/archiva-database/src/main/java/org/apache/maven/archiva/database/jdo/JdoArchivaAuditLogsDao.java
new file mode 100644
index 000000000..64aa62012
--- /dev/null
+++ b/archiva-modules/archiva-database/src/main/java/org/apache/maven/archiva/database/jdo/JdoArchivaAuditLogsDao.java
@@ -0,0 +1,62 @@
+package org.apache.maven.archiva.database.jdo;
+
+/*
+ * 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.List;
+
+import org.apache.maven.archiva.database.ArchivaAuditLogsDao;
+import org.apache.maven.archiva.database.ArchivaDatabaseException;
+import org.apache.maven.archiva.database.Constraint;
+import org.apache.maven.archiva.database.ObjectNotFoundException;
+import org.apache.maven.archiva.model.ArchivaAuditLogs;
+
+/**
+ * JdoArchivaAuditLogsDao
+ *
+ * @version
+ *
+ * @plexus.component role-hint="jdo"
+ */
+public class JdoArchivaAuditLogsDao
+ implements ArchivaAuditLogsDao
+{
+ /**
+ * @plexus.requirement role-hint="archiva"
+ */
+ private JdoAccess jdo;
+
+ public void deleteAuditLogs( ArchivaAuditLogs logs )
+ throws ArchivaDatabaseException
+ {
+ jdo.removeObject( logs );
+ }
+
+ @SuppressWarnings( "unchecked" )
+ public List<ArchivaAuditLogs> queryAuditLogs( Constraint constraint )
+ throws ObjectNotFoundException, ArchivaDatabaseException
+ {
+ return (List<ArchivaAuditLogs>) jdo.queryObjects( ArchivaAuditLogs.class, constraint );
+ }
+
+ public ArchivaAuditLogs saveAuditLogs( ArchivaAuditLogs logs )
+ {
+ return (ArchivaAuditLogs) jdo.saveObject( logs );
+ }
+}
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/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/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..bced43169
--- /dev/null
+++ b/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/AuditLogsReportTest.java
@@ -0,0 +1,125 @@
+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." );
+ }
+
+ @Test (dependsOnMethods = { "testAddArtifactValidValues" } )
+ 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" );
+ }
+
+ @Test (dependsOnMethods = { "testViewAuditLogsDataFound" } )
+ 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" );
+ }
+
+ @Test (dependsOnMethods = { "testViewAuditLogsOnlyArtifactIdIsSpecified" } )
+ 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/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..ad1d38875 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
@@ -20,11 +20,14 @@ package org.apache.maven.archiva.web.action;
*/
import java.util.ArrayList;
+import java.util.Calendar;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
+import org.apache.maven.archiva.database.ArchivaAuditLogsDao;
+import org.apache.maven.archiva.model.ArchivaAuditLogs;
import org.apache.maven.archiva.repository.audit.AuditEvent;
import org.apache.maven.archiva.repository.audit.AuditListener;
import org.apache.maven.archiva.repository.audit.Auditable;
@@ -53,6 +56,11 @@ public abstract class PlexusActionSupport
*/
private List<AuditListener> auditListeners = new ArrayList<AuditListener>();
+ /**
+ * @plexus.requirement role-hint="jdo"
+ */
+ private ArchivaAuditLogsDao auditLogsDao;
+
private String principal;
@SuppressWarnings("unchecked")
@@ -85,6 +93,15 @@ public abstract class PlexusActionSupport
{
listener.auditEvent( event );
}
+
+ ArchivaAuditLogs auditLogs = new ArchivaAuditLogs();
+ auditLogs.setArtifact( resource );
+ auditLogs.setEvent( action );
+ auditLogs.setEventDate( Calendar.getInstance().getTime() );
+ auditLogs.setRepositoryId( repositoryId );
+ auditLogs.setUsername( getPrincipal() );
+
+ auditLogsDao.saveAuditLogs( auditLogs );
}
protected void triggerAuditEvent( String resource, String action )
@@ -129,4 +146,9 @@ public abstract class PlexusActionSupport
{
this.principal = principal;
}
+
+ public void setAuditLogsDao( ArchivaAuditLogsDao auditLogsDao )
+ {
+ this.auditLogsDao = auditLogsDao;
+ }
}
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 c61ba16ff..0796850c9 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
@@ -149,7 +149,7 @@ public class UploadAction
* @plexus.requirement
*/
private ArchivaTaskScheduler scheduler;
-
+
private ChecksumAlgorithm[] algorithms = new ChecksumAlgorithm[]{ChecksumAlgorithm.SHA1, ChecksumAlgorithm.MD5};
private ProjectModelWriter pomWriter = new ProjectModel400Writer();
@@ -423,7 +423,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..298a6d996
--- /dev/null
+++ b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/reports/ViewAuditLogReportAction.java
@@ -0,0 +1,433 @@
+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.commons.lang.StringUtils;
+import org.apache.commons.lang.time.DateUtils;
+import org.apache.maven.archiva.database.ArchivaAuditLogsDao;
+import org.apache.maven.archiva.database.ArchivaDAO;
+import org.apache.maven.archiva.database.ArchivaDatabaseException;
+import org.apache.maven.archiva.database.ObjectNotFoundException;
+import org.apache.maven.archiva.database.SimpleConstraint;
+import org.apache.maven.archiva.database.constraints.ArchivaAuditLogsConstraint;
+import org.apache.maven.archiva.database.constraints.MostRecentArchivaAuditLogsConstraint;
+import org.apache.maven.archiva.model.ArchivaAuditLogs;
+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;
+
+ /**
+ * @plexus.requirement role-hint="jdo"
+ */
+ private ArchivaAuditLogsDao auditLogsDao;
+
+ /**
+ * @plexus.requirement role-hint="jdo"
+ */
+ private ArchivaDAO dao;
+
+ 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<ArchivaAuditLogs> 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" };
+
+ 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;
+ }
+
+ SimpleConstraint constraint = new MostRecentArchivaAuditLogsConstraint();
+ auditLogs = (List<ArchivaAuditLogs>) dao.query( constraint );
+ }
+
+ public String execute()
+ throws Exception
+ {
+ auditLogs = null;
+ String artifact = "";
+
+ if ( groupId != null && !"".equals( groupId.trim() ) )
+ {
+ artifact = groupId + ( ( artifactId != null && !"".equals( artifactId.trim() ) ) ? ( "/" + artifactId + "/%" ) : "%" );
+ }
+ else
+ {
+ artifact = ( artifactId != null && !"".equals( artifactId.trim() ) ) ? ( "%" + artifactId + "%" ) : "";
+ }
+
+ Date startDateInDF = null;
+ Date endDateInDF = null;
+ 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;
+
+ ArchivaAuditLogsConstraint constraint = null;
+ if ( !repository.equals( ALL_REPOSITORIES ) )
+ {
+ constraint =
+ new ArchivaAuditLogsConstraint( range, artifact, repository, AuditEvent.UPLOAD_FILE, startDateInDF, endDateInDF );
+ }
+ else
+ {
+ constraint =
+ new ArchivaAuditLogsConstraint( range, artifact, null, AuditEvent.UPLOAD_FILE, startDateInDF, endDateInDF );
+ }
+
+ try
+ {
+ auditLogs = auditLogsDao.queryAuditLogs( constraint );
+ if( auditLogs.isEmpty() )
+ {
+ addActionError( "No audit logs found." );
+ initial = "true";
+ }
+ else
+ {
+ initial = "false";
+ }
+
+ headerName = HEADER_RESULTS;
+ paginate();
+ }
+ catch ( ObjectNotFoundException e )
+ {
+ addActionError( "No audit logs found." );
+ return ERROR;
+ }
+ catch ( ArchivaDatabaseException e )
+ {
+ addActionError( "Error occurred while querying audit logs." );
+ return ERROR;
+ }
+
+ 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<ArchivaAuditLogs> getAuditLogs()
+ {
+ return auditLogs;
+ }
+
+ public void setAuditLogs( List<ArchivaAuditLogs> auditLogs )
+ {
+ this.auditLogs = 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/resources/struts.xml b/archiva-modules/archiva-web/archiva-webapp/src/main/resources/struts.xml
index 8df1acfdd..138843335 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
@@ -523,6 +523,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/decorators/default.jsp b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/decorators/default.jsp
index 52ec32bbe..4dc48af6d 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..664f8e7fa
--- /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/ui.datepicker.css'/>" type="text/css" media="all"/>
+ <script type="text/javascript" src="<c:url value='/js/jquery/jquery-1.2.6.pack.js'/>"></script>
+ <script type="text/javascript" src="<c:url value='/js/jquery/ui.datepicker.packed.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>Artifact</th>
+ <th>Event Date</th>
+ <th>Username</th>
+ </tr>
+
+ <c:forEach items="${auditLogs}" var="auditLog" varStatus="i">
+ <tr>
+ <td>${auditLog.event}</td>
+ <td>${auditLog.repositoryId}</td>
+ <td>${auditLog.artifact}</td>
+ <td>${auditLog.eventDate}</td>
+ <td>${auditLog.username}</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/css/site.css b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/css/site.css
index a68b439a2..996614608 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
@@ -435,4 +435,46 @@ div.versions {
div.versions a.expand {
font-size: 7pt;
color: gray;
-} \ No newline at end of file
+}
+
+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 f86660c56..1af6eda88 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
@@ -31,6 +31,8 @@ import org.apache.maven.archiva.configuration.ArchivaConfiguration;
import org.apache.maven.archiva.configuration.Configuration;
import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
import org.apache.maven.archiva.configuration.RepositoryScanningConfiguration;
+import org.apache.maven.archiva.database.ArchivaAuditLogsDao;
+import org.apache.maven.archiva.model.ArchivaAuditLogs;
import org.apache.maven.archiva.repository.ManagedRepositoryContent;
import org.apache.maven.archiva.repository.RepositoryContentFactory;
import org.apache.maven.archiva.repository.RepositoryNotFoundException;
@@ -62,10 +64,14 @@ public class UploadActionTest
private RepositoryContentFactory repoFactory;
private MockControl repoFactoryControl;
+
+ private ArchivaAuditLogsDao auditLogsDao;
+
+ private MockControl auditLogsDaoControl;
private static final String REPOSITORY_ID = "test-repo";
- private Configuration config;
+ private Configuration config;
public void setUp()
throws Exception
@@ -80,11 +86,16 @@ public class UploadActionTest
repoFactoryControl = MockClassControl.createControl( RepositoryContentFactory.class );
repoFactory = (RepositoryContentFactory) repoFactoryControl.getMock();
+
+ auditLogsDaoControl = MockControl.createControl( ArchivaAuditLogsDao.class );
+ auditLogsDaoControl.setDefaultMatcher( MockControl.ALWAYS_MATCHER );
+ auditLogsDao = (ArchivaAuditLogsDao) auditLogsDaoControl.getMock();
uploadAction = new UploadAction();
uploadAction.setScheduler( scheduler );
uploadAction.setConfiguration( archivaConfig );
uploadAction.setRepositoryFactory( repoFactory );
+ uploadAction.setAuditLogsDao( auditLogsDao );
File testRepo = new File( getBasedir(), "target/test-classes/test-repo" );
testRepo.mkdirs();
@@ -216,16 +227,19 @@ public class UploadActionTest
archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config );
repoFactoryControl.expectAndReturn( repoFactory.getManagedRepositoryContent( REPOSITORY_ID ), content );
+ auditLogsDaoControl.expectAndReturn( auditLogsDao.saveAuditLogs( new ArchivaAuditLogs() ), null );
archivaConfigControl.replay();
repoFactoryControl.replay();
+ auditLogsDaoControl.replay();
String returnString = uploadAction.doUpload();
assertEquals( Action.SUCCESS, returnString );
archivaConfigControl.verify();
repoFactoryControl.verify();
-
+ auditLogsDaoControl.verify();
+
String repoLocation = config.findManagedRepositoryById( REPOSITORY_ID ).getLocation();
assertAllArtifactsIncludingSupportArtifactsArePresent( repoLocation );
@@ -245,15 +259,18 @@ public class UploadActionTest
archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config );
repoFactoryControl.expectAndReturn( repoFactory.getManagedRepositoryContent( REPOSITORY_ID ), content );
+ auditLogsDaoControl.expectAndReturn( auditLogsDao.saveAuditLogs( new ArchivaAuditLogs() ), null );
archivaConfigControl.replay();
repoFactoryControl.replay();
-
+ auditLogsDaoControl.replay();
+
String returnString = uploadAction.doUpload();
assertEquals( Action.SUCCESS, returnString );
archivaConfigControl.verify();
repoFactoryControl.verify();
+ auditLogsDaoControl.verify();
String repoLocation = config.findManagedRepositoryById( REPOSITORY_ID ).getLocation();
assertTrue( new File( repoLocation, "/org/apache/archiva/artifact-upload/1.0/artifact-upload-1.0-tests.jar" ).exists() );
@@ -319,15 +336,18 @@ public class UploadActionTest
archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config );
repoFactoryControl.expectAndReturn( repoFactory.getManagedRepositoryContent( REPOSITORY_ID ), content );
+ auditLogsDaoControl.expectAndReturn( auditLogsDao.saveAuditLogs( new ArchivaAuditLogs() ), null );
archivaConfigControl.replay();
repoFactoryControl.replay();
+ auditLogsDaoControl.replay();
String returnString = uploadAction.doUpload();
assertEquals( Action.SUCCESS, returnString );
archivaConfigControl.verify();
repoFactoryControl.verify();
+ auditLogsDaoControl.verify();
String repoLocation = config.findManagedRepositoryById( REPOSITORY_ID ).getLocation();
assertAllArtifactsIncludingSupportArtifactsArePresent( repoLocation );
@@ -377,15 +397,18 @@ public class UploadActionTest
archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config );
repoFactoryControl.expectAndReturn( repoFactory.getManagedRepositoryContent( REPOSITORY_ID ), content );
-
+ auditLogsDaoControl.expectAndReturn( auditLogsDao.saveAuditLogs( new ArchivaAuditLogs() ), null );
+
archivaConfigControl.replay();
repoFactoryControl.replay();
-
+ auditLogsDaoControl.replay();
+
String returnString = uploadAction.doUpload();
assertEquals( Action.SUCCESS, returnString );
archivaConfigControl.verify();
repoFactoryControl.verify();
+ auditLogsDaoControl.verify();
String repoLocation = config.findManagedRepositoryById( REPOSITORY_ID ).getLocation();
assertEquals( 6, new File( repoLocation, "/org/apache/archiva/artifact-upload/1.0-SNAPSHOT/" ).list().length );
@@ -412,18 +435,23 @@ public class UploadActionTest
archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config );
repoFactoryControl.expectAndReturn( repoFactory.getManagedRepositoryContent( REPOSITORY_ID ), content );
+ auditLogsDaoControl.expectAndReturn( auditLogsDao.saveAuditLogs( new ArchivaAuditLogs() ), null );
archivaConfigControl.replay();
repoFactoryControl.replay();
+ auditLogsDaoControl.replay();
String returnString = uploadAction.doUpload();
assertEquals( Action.SUCCESS, returnString );
archivaConfigControl.verify();
repoFactoryControl.verify();
+ auditLogsDaoControl.verify();
archivaConfigControl.reset();
repoFactoryControl.reset();
+ auditLogsDaoControl.reset();
+ auditLogsDaoControl.setDefaultMatcher( MockControl.ALWAYS_MATCHER );
String repoLocation = config.findManagedRepositoryById( REPOSITORY_ID ).getLocation();
assertAllArtifactsIncludingSupportArtifactsArePresent( repoLocation );
@@ -438,15 +466,18 @@ public class UploadActionTest
archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config );
repoFactoryControl.expectAndReturn( repoFactory.getManagedRepositoryContent( REPOSITORY_ID ), content );
-
+ auditLogsDaoControl.expectAndReturn( auditLogsDao.saveAuditLogs( new ArchivaAuditLogs() ), null );
+
archivaConfigControl.replay();
repoFactoryControl.replay();
+ auditLogsDaoControl.replay();
returnString = uploadAction.doUpload();
assertEquals( Action.SUCCESS, returnString );
archivaConfigControl.verify();
repoFactoryControl.verify();
+ auditLogsDaoControl.verify();
repoLocation = config.findManagedRepositoryById( REPOSITORY_ID ).getLocation();
assertAllArtifactsIncludingSupportArtifactsArePresent( repoLocation );
@@ -467,9 +498,11 @@ public class UploadActionTest
archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config, 2 );
repoFactoryControl.expectAndReturn( repoFactory.getManagedRepositoryContent( REPOSITORY_ID ), content, 2 );
-
+ auditLogsDaoControl.expectAndReturn( auditLogsDao.saveAuditLogs( new ArchivaAuditLogs() ), null );
+
archivaConfigControl.replay();
repoFactoryControl.replay();
+ auditLogsDaoControl.replay();
String returnString = uploadAction.doUpload();
assertEquals( Action.SUCCESS, returnString );
@@ -484,6 +517,7 @@ public class UploadActionTest
archivaConfigControl.verify();
repoFactoryControl.verify();
+ auditLogsDaoControl.verify();
String repoLocation = config.findManagedRepositoryById( REPOSITORY_ID ).getLocation();
assertAllArtifactsIncludingSupportArtifactsArePresent( repoLocation );
@@ -506,9 +540,11 @@ public class UploadActionTest
archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config, 2 );
repoFactoryControl.expectAndReturn( repoFactory.getManagedRepositoryContent( REPOSITORY_ID ), content, 2 );
+ auditLogsDaoControl.expectAndReturn( auditLogsDao.saveAuditLogs( new ArchivaAuditLogs() ), null, 2 );
archivaConfigControl.replay();
repoFactoryControl.replay();
+ auditLogsDaoControl.replay();
String returnString = uploadAction.doUpload();
assertEquals( Action.SUCCESS, returnString );
@@ -523,6 +559,7 @@ public class UploadActionTest
archivaConfigControl.verify();
repoFactoryControl.verify();
+ auditLogsDaoControl.verify();
String repoLocation = config.findManagedRepositoryById( REPOSITORY_ID ).getLocation();
assertAllArtifactsIncludingSupportArtifactsArePresent( repoLocation );
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 5ef78ba39..7accb4b7c 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
@@ -24,6 +24,8 @@ import org.apache.commons.io.FileUtils;
import org.apache.maven.archiva.configuration.ArchivaConfiguration;
import org.apache.maven.archiva.configuration.Configuration;
import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
+import org.apache.maven.archiva.database.ArchivaAuditLogsDao;
+import org.apache.maven.archiva.model.ArchivaAuditLogs;
import org.apache.maven.archiva.security.ArchivaRoleConstants;
import org.codehaus.plexus.redback.role.RoleManager;
import org.codehaus.redback.integration.interceptor.SecureActionBundle;
@@ -51,6 +53,10 @@ public class AddManagedRepositoryActionTest
private MockControl archivaConfigurationControl;
private ArchivaConfiguration archivaConfiguration;
+
+ private ArchivaAuditLogsDao auditLogsDao;
+
+ private MockControl auditLogsDaoControl;
private static final String REPO_ID = "repo-ident";
@@ -74,6 +80,11 @@ public class AddManagedRepositoryActionTest
archivaConfiguration = (ArchivaConfiguration) archivaConfigurationControl.getMock();
action.setArchivaConfiguration( archivaConfiguration );
+ auditLogsDaoControl = MockControl.createControl( ArchivaAuditLogsDao.class );
+ auditLogsDaoControl.setDefaultMatcher( MockControl.ALWAYS_MATCHER );
+ auditLogsDao = (ArchivaAuditLogsDao) auditLogsDaoControl.getMock();
+ action.setAuditLogsDao( auditLogsDao );
+
roleManagerControl = MockControl.createControl( RoleManager.class );
roleManager = (RoleManager) roleManagerControl.getMock();
action.setRoleManager( roleManager );
@@ -148,15 +159,18 @@ public class AddManagedRepositoryActionTest
ManagedRepositoryConfiguration repository = action.getRepository();
populateRepository( repository );
+ auditLogsDaoControl.expectAndReturn( auditLogsDao.saveAuditLogs( new ArchivaAuditLogs() ), null );
+ auditLogsDaoControl.replay();
+
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();
archivaConfigurationControl.verify();
+ auditLogsDaoControl.verify();
}
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/repositories/ArchivaAuditLogsDaoStub.java b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/repositories/ArchivaAuditLogsDaoStub.java
new file mode 100644
index 000000000..933aeb1c9
--- /dev/null
+++ b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/repositories/ArchivaAuditLogsDaoStub.java
@@ -0,0 +1,34 @@
+package org.apache.maven.archiva.web.action.admin.repositories;
+
+import java.util.List;
+
+import org.apache.maven.archiva.database.ArchivaAuditLogsDao;
+import org.apache.maven.archiva.database.ArchivaDatabaseException;
+import org.apache.maven.archiva.database.Constraint;
+import org.apache.maven.archiva.database.ObjectNotFoundException;
+import org.apache.maven.archiva.model.ArchivaAuditLogs;
+
+public class ArchivaAuditLogsDaoStub
+ implements ArchivaAuditLogsDao
+{
+
+ public void deleteAuditLogs( ArchivaAuditLogs logs )
+ throws ArchivaDatabaseException
+ {
+ // TODO Auto-generated method stub
+ }
+
+ public List<ArchivaAuditLogs> queryAuditLogs( Constraint constraint )
+ throws ObjectNotFoundException, ArchivaDatabaseException
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public ArchivaAuditLogs saveAuditLogs( ArchivaAuditLogs logs )
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+}
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 8d8c4b2b9..ccd69f49f 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
@@ -27,6 +27,8 @@ import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
import org.apache.maven.archiva.configuration.ProxyConnectorConfiguration;
import org.apache.maven.archiva.configuration.RemoteRepositoryConfiguration;
import org.apache.maven.archiva.configuration.RepositoryGroupConfiguration;
+import org.apache.maven.archiva.database.ArchivaAuditLogsDao;
+import org.apache.maven.archiva.model.ArchivaAuditLogs;
import org.apache.maven.archiva.model.ArchivaProjectModel;
import org.apache.maven.archiva.security.ArchivaRoleConstants;
import org.codehaus.plexus.redback.role.RoleManager;
@@ -60,6 +62,10 @@ public class DeleteManagedRepositoryActionTest
private ArchivaConfiguration archivaConfiguration;
+ private ArchivaAuditLogsDao auditLogsDao;
+
+ private MockControl auditLogsDaoControl;
+
private static final String REPO_ID = "repo-ident";
private File location;
@@ -80,6 +86,11 @@ public class DeleteManagedRepositoryActionTest
archivaConfigurationControl = MockControl.createControl( ArchivaConfiguration.class );
archivaConfiguration = (ArchivaConfiguration) archivaConfigurationControl.getMock();
action.setArchivaConfiguration( archivaConfiguration );
+
+ auditLogsDaoControl = MockControl.createControl( ArchivaAuditLogsDao.class );
+ auditLogsDaoControl.setDefaultMatcher( MockControl.ALWAYS_MATCHER );
+ auditLogsDao = (ArchivaAuditLogsDao) auditLogsDaoControl.getMock();
+ action.setAuditLogsDao( auditLogsDao );
roleManagerControl = MockControl.createControl( RoleManager.class );
roleManager = (RoleManager) roleManagerControl.getMock();
@@ -117,9 +128,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() );
@@ -132,8 +144,13 @@ public class DeleteManagedRepositoryActionTest
Configuration configuration = prepDeletionTest( createRepository(), 4 );
+ auditLogsDaoControl.expectAndReturn( auditLogsDao.saveAuditLogs( new ArchivaAuditLogs() ), null );
+ auditLogsDaoControl.replay();
+
String status = action.deleteEntry();
+ auditLogsDaoControl.verify();
+
assertEquals( Action.SUCCESS, status );
assertTrue( configuration.getManagedRepositories().isEmpty() );
@@ -148,7 +165,12 @@ public class DeleteManagedRepositoryActionTest
Configuration configuration = prepDeletionTest( createRepository(), 4 );
+ auditLogsDaoControl.expectAndReturn( auditLogsDao.saveAuditLogs( new ArchivaAuditLogs() ), null );
+ auditLogsDaoControl.replay();
+
String status = action.deleteContents();
+
+ auditLogsDaoControl.verify();
assertEquals( Action.SUCCESS, status );
@@ -169,7 +191,12 @@ public class DeleteManagedRepositoryActionTest
assertEquals( 1, configuration.getProxyConnectors().size() );
+ auditLogsDaoControl.expectAndReturn( auditLogsDao.saveAuditLogs( new ArchivaAuditLogs() ), null );
+ auditLogsDaoControl.replay();
+
String status = action.deleteContents();
+
+ auditLogsDaoControl.verify();
assertEquals( Action.SUCCESS, status );
assertTrue( configuration.getManagedRepositories().isEmpty() );
@@ -183,6 +210,7 @@ public class DeleteManagedRepositoryActionTest
{
ManagedRepositoryConfiguration originalRepository = createRepository();
Configuration configuration = prepDeletionTest( originalRepository, 3 );
+
String status = action.execute();
assertEquals( Action.SUCCESS, status );
@@ -205,8 +233,12 @@ public class DeleteManagedRepositoryActionTest
assertEquals( 1, configuration.getRepositoryGroups().size() );
+ auditLogsDaoControl.expectAndReturn( auditLogsDao.saveAuditLogs( new ArchivaAuditLogs() ), null );
+ auditLogsDaoControl.replay();
+
String status = action.deleteContents();
assertEquals( Action.SUCCESS, status );
+ auditLogsDaoControl.verify();
assertTrue( configuration.getManagedRepositories().isEmpty() );
assertEquals( 0, ( ( RepositoryGroupConfiguration ) configuration.getRepositoryGroups().get( 0 ) ).getRepositories().size() );
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 e688f8a29..6f9bdf162 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
@@ -23,9 +23,11 @@ import com.opensymphony.xwork2.Action;
import org.apache.maven.archiva.configuration.ArchivaConfiguration;
import org.apache.maven.archiva.configuration.Configuration;
import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
+import org.apache.maven.archiva.database.ArchivaAuditLogsDao;
import org.apache.maven.archiva.database.ArchivaDAO;
import org.apache.maven.archiva.database.RepositoryContentStatisticsDAO;
import org.apache.maven.archiva.database.constraints.RepositoryContentStatisticsByRepositoryConstraint;
+import org.apache.maven.archiva.model.ArchivaAuditLogs;
import org.apache.maven.archiva.model.RepositoryContentStatistics;
import org.apache.maven.archiva.security.ArchivaRoleConstants;
import org.codehaus.plexus.redback.role.RoleManager;
@@ -66,6 +68,10 @@ public class EditManagedRepositoryActionTest
private MockControl repoContentStatsDaoControl;
private RepositoryContentStatisticsDAO repoContentStatsDao;
+
+ private ArchivaAuditLogsDao auditLogsDao;
+
+ private MockControl auditLogsDaoControl;
private static final String REPO_ID = "repo-ident";
@@ -96,6 +102,11 @@ public class EditManagedRepositoryActionTest
archivaDaoControl = MockControl.createControl( ArchivaDAO.class );
archivaDao = (ArchivaDAO) archivaDaoControl.getMock();
action.setArchivaDAO( archivaDao );
+
+ auditLogsDaoControl = MockControl.createControl( ArchivaAuditLogsDao.class );
+ auditLogsDaoControl.setDefaultMatcher( MockControl.ALWAYS_MATCHER );
+ auditLogsDao = (ArchivaAuditLogsDao) auditLogsDaoControl.getMock();
+ action.setAuditLogsDao( auditLogsDao );
repoContentStatsDaoControl = MockControl.createControl( RepositoryContentStatisticsDAO.class );
repoContentStatsDao = (RepositoryContentStatisticsDAO) repoContentStatsDaoControl.getMock();
@@ -167,10 +178,13 @@ public class EditManagedRepositoryActionTest
ManagedRepositoryConfiguration repository = action.getRepository();
populateRepository( repository );
repository.setName( "new repo name" );
-
+
+ auditLogsDaoControl.expectAndReturn( auditLogsDao.saveAuditLogs( new ArchivaAuditLogs() ), null );
+ auditLogsDaoControl.replay();
+
String status = action.commit();
assertEquals( Action.SUCCESS, status );
-
+
ManagedRepositoryConfiguration newRepository = createRepository();
newRepository.setName( "new repo name" );
assertRepositoryEquals( repository, newRepository );
@@ -178,6 +192,7 @@ public class EditManagedRepositoryActionTest
roleManagerControl.verify();
archivaConfigurationControl.verify();
+ auditLogsDaoControl.verify();
}
public void testEditRepositoryLocationChanged()
@@ -226,6 +241,9 @@ public class EditManagedRepositoryActionTest
action.prepare();
assertEquals( REPO_ID, action.getRepoid() );
+ auditLogsDaoControl.expectAndReturn( auditLogsDao.saveAuditLogs( new ArchivaAuditLogs() ), null );
+ auditLogsDaoControl.replay();
+
ManagedRepositoryConfiguration repository = new ManagedRepositoryConfiguration();
populateRepository( repository );
repository.setLocation( new File( "target/test/location/new" ).getCanonicalPath() );
@@ -238,6 +256,7 @@ public class EditManagedRepositoryActionTest
archivaConfigurationControl.verify();
archivaDaoControl.verify();
repoContentStatsDaoControl.verify();
+ auditLogsDaoControl.verify();
}
private void assertRepositoryEquals( ManagedRepositoryConfiguration expectedRepository,
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/action/BrowseActionTest.xml b/archiva-modules/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/action/BrowseActionTest.xml
index cccf675cb..bb19ef4c1 100644
--- a/archiva-modules/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/action/BrowseActionTest.xml
+++ b/archiva-modules/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/action/BrowseActionTest.xml
@@ -35,5 +35,10 @@
<role-hint>default</role-hint>
<implementation>org.apache.maven.archiva.security.UserRepositoriesStub</implementation>
</component>
+ <component>
+ <role>org.apache.maven.archiva.database.ArchivaAuditLogsDao</role>
+ <role-hint>jdo</role-hint>
+ <implementation>org.apache.maven.archiva.web.action.admin.repositories.ArchivaAuditLogsDaoStub</implementation>
+ </component>
</components>
</plexus>
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/action/ShowArtifactActionTest.xml b/archiva-modules/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/action/ShowArtifactActionTest.xml
index d51572b7f..ecd72a3ae 100644
--- a/archiva-modules/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/action/ShowArtifactActionTest.xml
+++ b/archiva-modules/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/action/ShowArtifactActionTest.xml
@@ -35,5 +35,10 @@
<role-hint>default</role-hint>
<implementation>org.apache.maven.archiva.security.UserRepositoriesStub</implementation>
</component>
+ <component>
+ <role>org.apache.maven.archiva.database.ArchivaAuditLogsDao</role>
+ <role-hint>jdo</role-hint>
+ <implementation>org.apache.maven.archiva.web.action.admin.repositories.ArchivaAuditLogsDaoStub</implementation>
+ </component>
</components>
</plexus>
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/action/admin/appearance/EditOrganizationInfoActionTest.xml b/archiva-modules/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/action/admin/appearance/EditOrganizationInfoActionTest.xml
new file mode 100644
index 000000000..62b568bd8
--- /dev/null
+++ b/archiva-modules/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/action/admin/appearance/EditOrganizationInfoActionTest.xml
@@ -0,0 +1,28 @@
+<!--
+ ~ 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.
+ -->
+
+<plexus>
+ <components>
+ <component>
+ <role>org.apache.maven.archiva.database.ArchivaAuditLogsDao</role>
+ <role-hint>jdo</role-hint>
+ <implementation>org.apache.maven.archiva.web.action.admin.repositories.ArchivaAuditLogsDaoStub</implementation>
+ </component>
+ </components>
+</plexus>
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/action/admin/appearance/OrganizationInfoActionTest.xml b/archiva-modules/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/action/admin/appearance/OrganizationInfoActionTest.xml
new file mode 100644
index 000000000..62b568bd8
--- /dev/null
+++ b/archiva-modules/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/action/admin/appearance/OrganizationInfoActionTest.xml
@@ -0,0 +1,28 @@
+<!--
+ ~ 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.
+ -->
+
+<plexus>
+ <components>
+ <component>
+ <role>org.apache.maven.archiva.database.ArchivaAuditLogsDao</role>
+ <role-hint>jdo</role-hint>
+ <implementation>org.apache.maven.archiva.web.action.admin.repositories.ArchivaAuditLogsDaoStub</implementation>
+ </component>
+ </components>
+</plexus>
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/action/admin/connectors/proxy/AddProxyConnectorActionTest.xml b/archiva-modules/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/action/admin/connectors/proxy/AddProxyConnectorActionTest.xml
index dc32d3f3d..4ae525c16 100644
--- a/archiva-modules/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/action/admin/connectors/proxy/AddProxyConnectorActionTest.xml
+++ b/archiva-modules/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/action/admin/connectors/proxy/AddProxyConnectorActionTest.xml
@@ -39,6 +39,10 @@
<time-to-live-seconds>1800</time-to-live-seconds>
</configuration>
</component>
-
+ <component>
+ <role>org.apache.maven.archiva.database.ArchivaAuditLogsDao</role>
+ <role-hint>jdo</role-hint>
+ <implementation>org.apache.maven.archiva.web.action.admin.repositories.ArchivaAuditLogsDaoStub</implementation>
+ </component>
</components>
</plexus>
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/action/admin/connectors/proxy/DeleteProxyConnectorActionTest.xml b/archiva-modules/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/action/admin/connectors/proxy/DeleteProxyConnectorActionTest.xml
new file mode 100644
index 000000000..62b568bd8
--- /dev/null
+++ b/archiva-modules/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/action/admin/connectors/proxy/DeleteProxyConnectorActionTest.xml
@@ -0,0 +1,28 @@
+<!--
+ ~ 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.
+ -->
+
+<plexus>
+ <components>
+ <component>
+ <role>org.apache.maven.archiva.database.ArchivaAuditLogsDao</role>
+ <role-hint>jdo</role-hint>
+ <implementation>org.apache.maven.archiva.web.action.admin.repositories.ArchivaAuditLogsDaoStub</implementation>
+ </component>
+ </components>
+</plexus>
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/action/admin/connectors/proxy/DisableProxyConnectorActionTest.xml b/archiva-modules/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/action/admin/connectors/proxy/DisableProxyConnectorActionTest.xml
new file mode 100644
index 000000000..62b568bd8
--- /dev/null
+++ b/archiva-modules/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/action/admin/connectors/proxy/DisableProxyConnectorActionTest.xml
@@ -0,0 +1,28 @@
+<!--
+ ~ 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.
+ -->
+
+<plexus>
+ <components>
+ <component>
+ <role>org.apache.maven.archiva.database.ArchivaAuditLogsDao</role>
+ <role-hint>jdo</role-hint>
+ <implementation>org.apache.maven.archiva.web.action.admin.repositories.ArchivaAuditLogsDaoStub</implementation>
+ </component>
+ </components>
+</plexus>
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..a0b969b58 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,11 @@
<!-- 30 minutes = 1800 seconds -->
<time-to-live-seconds>1800</time-to-live-seconds>
</configuration>
- </component>
-
+ </component>
+ <component>
+ <role>org.apache.maven.archiva.database.ArchivaAuditLogsDao</role>
+ <role-hint>jdo</role-hint>
+ <implementation>org.apache.maven.archiva.web.action.admin.repositories.ArchivaAuditLogsDaoStub</implementation>
+ </component>
</components>
</plexus>
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/action/admin/connectors/proxy/EnableProxyConnectorActionTest.xml b/archiva-modules/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/action/admin/connectors/proxy/EnableProxyConnectorActionTest.xml
new file mode 100644
index 000000000..62b568bd8
--- /dev/null
+++ b/archiva-modules/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/action/admin/connectors/proxy/EnableProxyConnectorActionTest.xml
@@ -0,0 +1,28 @@
+<!--
+ ~ 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.
+ -->
+
+<plexus>
+ <components>
+ <component>
+ <role>org.apache.maven.archiva.database.ArchivaAuditLogsDao</role>
+ <role-hint>jdo</role-hint>
+ <implementation>org.apache.maven.archiva.web.action.admin.repositories.ArchivaAuditLogsDaoStub</implementation>
+ </component>
+ </components>
+</plexus>
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/action/admin/connectors/proxy/ProxyConnectorsActionTest.xml b/archiva-modules/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/action/admin/connectors/proxy/ProxyConnectorsActionTest.xml
new file mode 100644
index 000000000..62b568bd8
--- /dev/null
+++ b/archiva-modules/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/action/admin/connectors/proxy/ProxyConnectorsActionTest.xml
@@ -0,0 +1,28 @@
+<!--
+ ~ 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.
+ -->
+
+<plexus>
+ <components>
+ <component>
+ <role>org.apache.maven.archiva.database.ArchivaAuditLogsDao</role>
+ <role-hint>jdo</role-hint>
+ <implementation>org.apache.maven.archiva.web.action.admin.repositories.ArchivaAuditLogsDaoStub</implementation>
+ </component>
+ </components>
+</plexus>
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/action/admin/connectors/proxy/SortProxyConnectorsActionTest.xml b/archiva-modules/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/action/admin/connectors/proxy/SortProxyConnectorsActionTest.xml
new file mode 100644
index 000000000..62b568bd8
--- /dev/null
+++ b/archiva-modules/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/action/admin/connectors/proxy/SortProxyConnectorsActionTest.xml
@@ -0,0 +1,28 @@
+<!--
+ ~ 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.
+ -->
+
+<plexus>
+ <components>
+ <component>
+ <role>org.apache.maven.archiva.database.ArchivaAuditLogsDao</role>
+ <role-hint>jdo</role-hint>
+ <implementation>org.apache.maven.archiva.web.action.admin.repositories.ArchivaAuditLogsDaoStub</implementation>
+ </component>
+ </components>
+</plexus>
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/action/admin/repositories/AbstractManagedRepositoriesActionTest.xml b/archiva-modules/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/action/admin/repositories/AbstractManagedRepositoriesActionTest.xml
index afb64ee15..673e760e8 100644
--- a/archiva-modules/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/action/admin/repositories/AbstractManagedRepositoriesActionTest.xml
+++ b/archiva-modules/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/action/admin/repositories/AbstractManagedRepositoriesActionTest.xml
@@ -86,7 +86,11 @@
<role>org.apache.maven.archiva.database.RepositoryContentStatisticsDAO</role>
<role-hint>jdo</role-hint>
<implementation>org.apache.maven.archiva.web.action.admin.repositories.RepositoryContentStatisticsDAOStub</implementation>
- </component>
-
+ </component>
+ <component>
+ <role>org.apache.maven.archiva.database.ArchivaAuditLogsDao</role>
+ <role-hint>jdo</role-hint>
+ <implementation>org.apache.maven.archiva.web.action.admin.repositories.ArchivaAuditLogsDaoStub</implementation>
+ </component>
</components>
</plexus>
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/action/admin/repositories/AddRemoteRepositoryActionTest.xml b/archiva-modules/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/action/admin/repositories/AddRemoteRepositoryActionTest.xml
new file mode 100644
index 000000000..62b568bd8
--- /dev/null
+++ b/archiva-modules/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/action/admin/repositories/AddRemoteRepositoryActionTest.xml
@@ -0,0 +1,28 @@
+<!--
+ ~ 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.
+ -->
+
+<plexus>
+ <components>
+ <component>
+ <role>org.apache.maven.archiva.database.ArchivaAuditLogsDao</role>
+ <role-hint>jdo</role-hint>
+ <implementation>org.apache.maven.archiva.web.action.admin.repositories.ArchivaAuditLogsDaoStub</implementation>
+ </component>
+ </components>
+</plexus>
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/action/admin/repositories/DeleteManagedRepositoryActionTest.xml b/archiva-modules/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/action/admin/repositories/DeleteManagedRepositoryActionTest.xml
index f4d20ee61..0a8e9e743 100644
--- a/archiva-modules/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/action/admin/repositories/DeleteManagedRepositoryActionTest.xml
+++ b/archiva-modules/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/action/admin/repositories/DeleteManagedRepositoryActionTest.xml
@@ -73,6 +73,11 @@
<role>org.apache.maven.archiva.database.RepositoryContentStatisticsDAO</role>
<role-hint>jdo</role-hint>
<implementation>org.apache.maven.archiva.web.action.admin.repositories.RepositoryContentStatisticsDAOStub</implementation>
- </component>
+ </component>
+ <component>
+ <role>org.apache.maven.archiva.database.ArchivaAuditLogsDao</role>
+ <role-hint>jdo</role-hint>
+ <implementation>org.apache.maven.archiva.web.action.admin.repositories.ArchivaAuditLogsDaoStub</implementation>
+ </component>
</components>
</plexus>
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/action/admin/repositories/DeleteRemoteRepositoryActionTest.xml b/archiva-modules/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/action/admin/repositories/DeleteRemoteRepositoryActionTest.xml
new file mode 100644
index 000000000..62b568bd8
--- /dev/null
+++ b/archiva-modules/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/action/admin/repositories/DeleteRemoteRepositoryActionTest.xml
@@ -0,0 +1,28 @@
+<!--
+ ~ 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.
+ -->
+
+<plexus>
+ <components>
+ <component>
+ <role>org.apache.maven.archiva.database.ArchivaAuditLogsDao</role>
+ <role-hint>jdo</role-hint>
+ <implementation>org.apache.maven.archiva.web.action.admin.repositories.ArchivaAuditLogsDaoStub</implementation>
+ </component>
+ </components>
+</plexus>
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/action/admin/repositories/DeleteRepositoryGroupActionTest.xml b/archiva-modules/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/action/admin/repositories/DeleteRepositoryGroupActionTest.xml
new file mode 100644
index 000000000..62b568bd8
--- /dev/null
+++ b/archiva-modules/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/action/admin/repositories/DeleteRepositoryGroupActionTest.xml
@@ -0,0 +1,28 @@
+<!--
+ ~ 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.
+ -->
+
+<plexus>
+ <components>
+ <component>
+ <role>org.apache.maven.archiva.database.ArchivaAuditLogsDao</role>
+ <role-hint>jdo</role-hint>
+ <implementation>org.apache.maven.archiva.web.action.admin.repositories.ArchivaAuditLogsDaoStub</implementation>
+ </component>
+ </components>
+</plexus>
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/action/admin/repositories/EditRemoteRepositoryActionTest.xml b/archiva-modules/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/action/admin/repositories/EditRemoteRepositoryActionTest.xml
new file mode 100644
index 000000000..62b568bd8
--- /dev/null
+++ b/archiva-modules/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/action/admin/repositories/EditRemoteRepositoryActionTest.xml
@@ -0,0 +1,28 @@
+<!--
+ ~ 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.
+ -->
+
+<plexus>
+ <components>
+ <component>
+ <role>org.apache.maven.archiva.database.ArchivaAuditLogsDao</role>
+ <role-hint>jdo</role-hint>
+ <implementation>org.apache.maven.archiva.web.action.admin.repositories.ArchivaAuditLogsDaoStub</implementation>
+ </component>
+ </components>
+</plexus>
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/action/admin/repositories/RepositoriesActionTest.xml b/archiva-modules/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/action/admin/repositories/RepositoriesActionTest.xml
index c09e524a2..cac84b952 100644
--- a/archiva-modules/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/action/admin/repositories/RepositoriesActionTest.xml
+++ b/archiva-modules/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/action/admin/repositories/RepositoriesActionTest.xml
@@ -48,5 +48,10 @@
</requirement>
</requirements>
</component>
+ <component>
+ <role>org.apache.maven.archiva.database.ArchivaAuditLogsDao</role>
+ <role-hint>jdo</role-hint>
+ <implementation>org.apache.maven.archiva.web.action.admin.repositories.ArchivaAuditLogsDaoStub</implementation>
+ </component>
</components>
</plexus>
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/action/admin/repositories/RepositoryGroupsActionTest.xml b/archiva-modules/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/action/admin/repositories/RepositoryGroupsActionTest.xml
new file mode 100644
index 000000000..62b568bd8
--- /dev/null
+++ b/archiva-modules/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/action/admin/repositories/RepositoryGroupsActionTest.xml
@@ -0,0 +1,28 @@
+<!--
+ ~ 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.
+ -->
+
+<plexus>
+ <components>
+ <component>
+ <role>org.apache.maven.archiva.database.ArchivaAuditLogsDao</role>
+ <role-hint>jdo</role-hint>
+ <implementation>org.apache.maven.archiva.web.action.admin.repositories.ArchivaAuditLogsDaoStub</implementation>
+ </component>
+ </components>
+</plexus>
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/action/admin/repositories/SortRepositoriesActionTest.xml b/archiva-modules/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/action/admin/repositories/SortRepositoriesActionTest.xml
new file mode 100644
index 000000000..62b568bd8
--- /dev/null
+++ b/archiva-modules/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/action/admin/repositories/SortRepositoriesActionTest.xml
@@ -0,0 +1,28 @@
+<!--
+ ~ 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.
+ -->
+
+<plexus>
+ <components>
+ <component>
+ <role>org.apache.maven.archiva.database.ArchivaAuditLogsDao</role>
+ <role-hint>jdo</role-hint>
+ <implementation>org.apache.maven.archiva.web.action.admin.repositories.ArchivaAuditLogsDaoStub</implementation>
+ </component>
+ </components>
+</plexus>
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/action/reports/GenerateReportActionTest.xml b/archiva-modules/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/action/reports/GenerateReportActionTest.xml
index dc68e12af..8f21c1462 100644
--- a/archiva-modules/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/action/reports/GenerateReportActionTest.xml
+++ b/archiva-modules/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/action/reports/GenerateReportActionTest.xml
@@ -45,5 +45,10 @@
<implementation>org.apache.maven.archiva.web.action.admin.repositories.RepositoryContentStatisticsDAOStub
</implementation>
</component>
+ <component>
+ <role>org.apache.maven.archiva.database.ArchivaAuditLogsDao</role>
+ <role-hint>jdo</role-hint>
+ <implementation>org.apache.maven.archiva.web.action.admin.repositories.ArchivaAuditLogsDaoStub</implementation>
+ </component>
</components>
-</component-set> \ No newline at end of file
+</component-set>
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/rss/RssFeedServletTest.xml b/archiva-modules/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/rss/RssFeedServletTest.xml
index 0fec42f00..bb6632ca2 100644
--- a/archiva-modules/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/rss/RssFeedServletTest.xml
+++ b/archiva-modules/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/rss/RssFeedServletTest.xml
@@ -37,5 +37,10 @@
<role-hint>default</role-hint>
<implementation>org.apache.maven.archiva.security.UserRepositoriesStub</implementation>
</component>
+ <component>
+ <role>org.apache.maven.archiva.database.ArchivaAuditLogsDao</role>
+ <role-hint>jdo</role-hint>
+ <implementation>org.apache.maven.archiva.web.action.admin.repositories.ArchivaAuditLogsDaoStub</implementation>
+ </component>
</components>
</plexus>
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 113aba0e5..ec4f1b97b 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
@@ -24,6 +24,7 @@ import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.ArrayList;
+import java.util.Calendar;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
@@ -54,6 +55,8 @@ import org.apache.jackrabbit.webdav.property.DavPropertySet;
import org.apache.jackrabbit.webdav.property.DefaultDavProperty;
import org.apache.jackrabbit.webdav.property.ResourceType;
import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
+import org.apache.maven.archiva.database.ArchivaAuditLogsDao;
+import org.apache.maven.archiva.model.ArchivaAuditLogs;
import org.apache.maven.archiva.repository.audit.AuditEvent;
import org.apache.maven.archiva.repository.audit.AuditListener;
import org.apache.maven.archiva.scheduled.ArchivaTaskScheduler;
@@ -104,11 +107,13 @@ public class ArchivaDavResource
private ArchivaTaskScheduler scheduler;
private Logger log = LoggerFactory.getLogger( ArchivaDavResource.class );
+
+ private ArchivaAuditLogsDao auditLogsDao;
public ArchivaDavResource( String localResource, String logicalResource, ManagedRepositoryConfiguration repository,
DavSession session, ArchivaDavResourceLocator locator, DavResourceFactory factory,
MimeTypes mimeTypes, List<AuditListener> auditListeners,
- ArchivaTaskScheduler scheduler )
+ ArchivaTaskScheduler scheduler, ArchivaAuditLogsDao auditLogsDao )
{
this.localResource = new File( localResource );
this.logicalResource = logicalResource;
@@ -123,15 +128,16 @@ public class ArchivaDavResource
this.mimeTypes = mimeTypes;
this.auditListeners = auditListeners;
this.scheduler = scheduler;
+ this.auditLogsDao = auditLogsDao;
}
public ArchivaDavResource( String localResource, String logicalResource, ManagedRepositoryConfiguration repository,
String remoteAddr, String principal, DavSession session, ArchivaDavResourceLocator locator,
DavResourceFactory factory, MimeTypes mimeTypes, List<AuditListener> auditListeners,
- ArchivaTaskScheduler scheduler )
+ ArchivaTaskScheduler scheduler, ArchivaAuditLogsDao auditLogsDao )
{
this( localResource, logicalResource, repository, session, locator, factory, mimeTypes, auditListeners,
- scheduler );
+ scheduler, auditLogsDao );
this.remoteAddr = remoteAddr;
this.principal = principal;
@@ -641,6 +647,27 @@ public class ArchivaDavResource
{
listener.auditEvent( event );
}
+
+ // identify as artifact deployment/upload
+ if( action.equals( AuditEvent.CREATE_FILE ) )
+ {
+ action = AuditEvent.UPLOAD_FILE;
+ }
+
+ String user = principal;
+ if( principal == null )
+ {
+ user = "guest";
+ }
+
+ ArchivaAuditLogs auditLogs = new ArchivaAuditLogs();
+ auditLogs.setArtifact( resource );
+ auditLogs.setEvent( action );
+ auditLogs.setEventDate( Calendar.getInstance().getTime() );
+ auditLogs.setRepositoryId( repositoryId );
+ auditLogs.setUsername( user );
+
+ auditLogsDao.saveAuditLogs( auditLogs );
}
private void queueRepositoryTask( File localFile )
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 a297659f5..2684c8ef2 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
@@ -43,6 +43,7 @@ import org.apache.maven.archiva.common.utils.PathUtil;
import org.apache.maven.archiva.common.utils.VersionUtil;
import org.apache.maven.archiva.configuration.ArchivaConfiguration;
import org.apache.maven.archiva.configuration.RepositoryGroupConfiguration;
+import org.apache.maven.archiva.database.ArchivaAuditLogsDao;
import org.apache.maven.archiva.model.ArchivaRepositoryMetadata;
import org.apache.maven.archiva.model.ArtifactReference;
import org.apache.maven.archiva.policies.ProxyDownloadException;
@@ -168,6 +169,11 @@ public class ArchivaDavResourceFactory
* @plexus.requirement
*/
private ArchivaTaskScheduler scheduler;
+
+ /**
+ * @plexus.requirement role-hint="jdo"
+ */
+ private ArchivaAuditLogsDao auditLogsDao;
public DavResource createResource( final DavResourceLocator locator, final DavServletRequest request,
final DavServletResponse response )
@@ -264,7 +270,7 @@ public class ArchivaDavResourceFactory
new ArchivaDavResource( metadataChecksum.getAbsolutePath(), logicalResource.getPath(),
null, request.getRemoteAddr(), activePrincipal,
request.getDavSession(), archivaLocator, this, mimeTypes,
- auditListeners, scheduler );
+ auditListeners, scheduler, auditLogsDao );
}
}
else
@@ -299,7 +305,7 @@ public class ArchivaDavResourceFactory
new ArchivaDavResource( resourceFile.getAbsolutePath(), logicalResource.getPath(),
null, request.getRemoteAddr(), activePrincipal,
request.getDavSession(), archivaLocator, this, mimeTypes,
- auditListeners, scheduler );
+ auditListeners, scheduler, auditLogsDao );
}
catch ( RepositoryMetadataException r )
{
@@ -418,7 +424,7 @@ public class ArchivaDavResourceFactory
resource =
new ArchivaDavResource( resourceFile.getAbsolutePath(), path, managedRepository.getRepository(),
request.getRemoteAddr(), activePrincipal, request.getDavSession(),
- archivaLocator, this, mimeTypes, auditListeners, scheduler );
+ archivaLocator, this, mimeTypes, auditListeners, scheduler, auditLogsDao );
if ( WebdavMethodUtil.isReadMethod( request.getMethod() ) )
{
@@ -449,7 +455,7 @@ public class ArchivaDavResourceFactory
new ArchivaDavResource( resourceFile.getAbsolutePath(), logicalResource.getPath(),
managedRepository.getRepository(), request.getRemoteAddr(),
activePrincipal, request.getDavSession(), archivaLocator, this,
- mimeTypes, auditListeners, scheduler );
+ mimeTypes, auditListeners, scheduler, auditLogsDao );
}
catch ( LayoutException e )
{
@@ -529,7 +535,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 );
}
}
@@ -565,7 +571,7 @@ public class ArchivaDavResourceFactory
File resourceFile = new File( managedRepository.getRepoRoot(), logicalResource );
DavResource resource =
new ArchivaDavResource( resourceFile.getAbsolutePath(), logicalResource, managedRepository.getRepository(),
- davSession, archivaLocator, this, mimeTypes, auditListeners, scheduler );
+ davSession, archivaLocator, this, mimeTypes, auditListeners, scheduler, auditLogsDao );
resource.addLockManager( lockManager );
return resource;
@@ -1093,4 +1099,9 @@ public class ArchivaDavResourceFactory
{
this.connectors = connectors;
}
+
+ public void setAuditLogsDao( ArchivaAuditLogsDao auditLogsDao )
+ {
+ this.auditLogsDao = auditLogsDao;
+ }
}
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..e5973b08c 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
@@ -33,6 +33,8 @@ import org.apache.maven.archiva.configuration.ArchivaConfiguration;
import org.apache.maven.archiva.configuration.Configuration;
import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
import org.apache.maven.archiva.configuration.RepositoryGroupConfiguration;
+import org.apache.maven.archiva.database.ArchivaAuditLogsDao;
+import org.apache.maven.archiva.model.ArchivaAuditLogs;
import org.apache.maven.archiva.proxy.DefaultRepositoryProxyConnectors;
import org.apache.maven.archiva.repository.ManagedRepositoryContent;
import org.apache.maven.archiva.repository.RepositoryContentFactory;
@@ -81,6 +83,10 @@ public class ArchivaDavResourceFactoryTest
private MockControl repoContentFactoryControl;
private RepositoryContentFactory repoFactory;
+
+ private ArchivaAuditLogsDao auditLogsDao;
+
+ private MockControl auditLogsDaoControl;
public void setUp()
throws Exception
@@ -96,6 +102,10 @@ public class ArchivaDavResourceFactoryTest
archivaConfigurationControl = MockControl.createControl( ArchivaConfiguration.class );
archivaConfiguration = (ArchivaConfiguration) archivaConfigurationControl.getMock();
+
+ auditLogsDaoControl = MockControl.createControl( ArchivaAuditLogsDao.class );
+ auditLogsDaoControl.setDefaultMatcher( MockControl.ALWAYS_MATCHER );
+ auditLogsDao = (ArchivaAuditLogsDao) auditLogsDaoControl.getMock();
config = new Configuration();
config.addManagedRepository( createManagedRepository( RELEASES_REPO, new File( getBasedir(),
@@ -125,6 +135,7 @@ public class ArchivaDavResourceFactoryTest
resourceFactory.setRepositoryFactory( repoFactory );
resourceFactory.setRepositoryRequest( repoRequest );
resourceFactory.setConnectors( new OverridingRepositoryProxyConnectors() );
+ resourceFactory.setAuditLogsDao( auditLogsDao );
}
private ManagedRepositoryConfiguration createManagedRepository( String id, String location, String layout )
@@ -392,7 +403,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 937907585..a3c2d6eb9 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
@@ -20,7 +20,9 @@ package org.apache.maven.archiva.webdav;
*/
import java.io.File;
+import java.util.ArrayList;
import java.util.Collections;
+import java.util.List;
import org.apache.commons.io.FileUtils;
import org.apache.jackrabbit.webdav.DavException;
@@ -37,12 +39,15 @@ import org.apache.jackrabbit.webdav.lock.Scope;
import org.apache.jackrabbit.webdav.lock.SimpleLockManager;
import org.apache.jackrabbit.webdav.lock.Type;
import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
+import org.apache.maven.archiva.database.ArchivaAuditLogsDao;
+import org.apache.maven.archiva.database.ArchivaDatabaseException;
+import org.apache.maven.archiva.database.Constraint;
+import org.apache.maven.archiva.database.ObjectNotFoundException;
+import org.apache.maven.archiva.model.ArchivaAuditLogs;
import org.apache.maven.archiva.repository.audit.AuditListener;
-import org.apache.maven.archiva.repository.scanner.RepositoryContentConsumers;
import org.apache.maven.archiva.webdav.util.MimeTypes;
import org.codehaus.plexus.spring.PlexusInSpringTestCase;
import org.codehaus.plexus.spring.PlexusToSpringUtils;
-import org.codehaus.plexus.taskqueue.execution.TaskQueueExecutor;
public class DavResourceTest
extends PlexusInSpringTestCase
@@ -67,23 +72,27 @@ public class DavResourceTest
private ManagedRepositoryConfiguration repository = new ManagedRepositoryConfiguration();
+ private ArchivaAuditLogsDao auditLogsDao;
+
@Override
protected void setUp()
throws Exception
{
super.setUp();
session = new ArchivaDavSession();
+ auditLogsDao = new ArchivaAuditLogsDaoImpl();
mimeTypes = (MimeTypes) getApplicationContext().getBean( PlexusToSpringUtils.buildSpringId( MimeTypes.class ) );
baseDir = getTestFile( "target/DavResourceTest" );
baseDir.mkdirs();
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
@@ -98,7 +107,7 @@ public class DavResourceTest
private DavResource getDavResource( String logicalPath, File file )
{
return new ArchivaDavResource( file.getAbsolutePath(), logicalPath, repository, session, resourceLocator,
- resourceFactory, mimeTypes, Collections.<AuditListener> emptyList(), null );
+ resourceFactory, mimeTypes, Collections.<AuditListener> emptyList(), null, auditLogsDao );
}
public void testDeleteNonExistantResourceShould404()
@@ -305,7 +314,28 @@ public class DavResourceTest
{
return new ArchivaDavResource( baseDir.getAbsolutePath(), "/", repository, session, resourceLocator,
resourceFactory, mimeTypes, Collections.<AuditListener> emptyList(),
- null );
+ null, auditLogsDao );
+ }
+ }
+
+ private class ArchivaAuditLogsDaoImpl
+ implements ArchivaAuditLogsDao
+ {
+ public List<ArchivaAuditLogs> queryAuditLogs( Constraint constraint )
+ throws ObjectNotFoundException, ArchivaDatabaseException
+ {
+ return new ArrayList<ArchivaAuditLogs>();
+ }
+
+ public ArchivaAuditLogs saveAuditLogs( ArchivaAuditLogs logs )
+ {
+ return new ArchivaAuditLogs();
+ }
+
+ public void deleteAuditLogs( ArchivaAuditLogs logs )
+ throws ArchivaDatabaseException
+ {
+
}
}
}
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-webdav/src/test/resources/org/apache/maven/archiva/webdav/RepositoryServletSecurityTest.xml b/archiva-modules/archiva-web/archiva-webdav/src/test/resources/org/apache/maven/archiva/webdav/RepositoryServletSecurityTest.xml
index bd9196bdf..719bc5f01 100644
--- a/archiva-modules/archiva-web/archiva-webdav/src/test/resources/org/apache/maven/archiva/webdav/RepositoryServletSecurityTest.xml
+++ b/archiva-modules/archiva-web/archiva-webdav/src/test/resources/org/apache/maven/archiva/webdav/RepositoryServletSecurityTest.xml
@@ -148,6 +148,11 @@
<role>org.apache.maven.archiva.scheduled.ArchivaTaskScheduler</role>
<field-name>scheduler</field-name>
</requirement>
+ <requirement>
+ <role>org.apache.maven.archiva.database.ArchivaAuditLogsDao</role>
+ <role-hint>jdo</role-hint>
+ <field-name>auditLogsDao</field-name>
+ </requirement>
</requirements>
</component>
<component>
diff --git a/archiva-modules/archiva-web/archiva-webdav/src/test/resources/org/apache/maven/archiva/webdav/RepositoryServletTest.xml b/archiva-modules/archiva-web/archiva-webdav/src/test/resources/org/apache/maven/archiva/webdav/RepositoryServletTest.xml
index 74a63e922..4ee64c61b 100644
--- a/archiva-modules/archiva-web/archiva-webdav/src/test/resources/org/apache/maven/archiva/webdav/RepositoryServletTest.xml
+++ b/archiva-modules/archiva-web/archiva-webdav/src/test/resources/org/apache/maven/archiva/webdav/RepositoryServletTest.xml
@@ -160,6 +160,11 @@
<role>org.apache.maven.archiva.scheduled.ArchivaTaskScheduler</role>
<field-name>scheduler</field-name>
</requirement>
+ <requirement>
+ <role>org.apache.maven.archiva.database.ArchivaAuditLogsDao</role>
+ <role-hint>jdo</role-hint>
+ <field-name>auditLogsDao</field-name>
+ </requirement>
</requirements>
</component>
<component>