summaryrefslogtreecommitdiffstats
path: root/archiva-modules/archiva-web
diff options
context:
space:
mode:
authorOlivier Lamy <olamy@apache.org>2011-12-16 15:12:05 +0000
committerOlivier Lamy <olamy@apache.org>2011-12-16 15:12:05 +0000
commit7b344cb9496990fb0be932bcc121cc9fdd364cd1 (patch)
tree4dcde0d543f78683dafa5f17feaf0c1773f92638 /archiva-modules/archiva-web
parentaee64c8a47d6ddb709c95185aad9d1dd38a94947 (diff)
downloadarchiva-7b344cb9496990fb0be932bcc121cc9fdd364cd1.tar.gz
archiva-7b344cb9496990fb0be932bcc121cc9fdd364cd1.zip
[MRM-1566] remove xmlrpc services.
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1215172 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'archiva-modules/archiva-web')
-rw-r--r--archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-api/pom.xml69
-rw-r--r--archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-api/src/main/java/org/apache/archiva/web/xmlrpc/api/AdministrationService.java156
-rw-r--r--archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-api/src/main/java/org/apache/archiva/web/xmlrpc/api/PingService.java28
-rw-r--r--archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-api/src/main/java/org/apache/archiva/web/xmlrpc/api/SearchService.java63
-rw-r--r--archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-api/src/main/java/org/apache/archiva/web/xmlrpc/api/beans/Artifact.java180
-rw-r--r--archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-api/src/main/java/org/apache/archiva/web/xmlrpc/api/beans/Dependency.java173
-rw-r--r--archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-api/src/main/java/org/apache/archiva/web/xmlrpc/api/beans/ManagedRepository.java151
-rw-r--r--archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-api/src/main/java/org/apache/archiva/web/xmlrpc/api/beans/RemoteRepository.java120
-rw-r--r--archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-client/pom.xml85
-rw-r--r--archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-client/src/main/java/org/apache/archiva/web/xmlrpc/client/SampleClient.java161
-rw-r--r--archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-security/pom.xml175
-rw-r--r--archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-security/src/main/java/org/apache/archiva/web/xmlrpc/security/ServiceMethodsPermissionsMapping.java59
-rw-r--r--archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-security/src/main/java/org/apache/archiva/web/xmlrpc/security/XmlRpcAuthenticator.java155
-rw-r--r--archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-security/src/main/java/org/apache/archiva/web/xmlrpc/security/XmlRpcUserRepositories.java48
-rw-r--r--archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-security/src/test/java/org/apache/archiva/xmlrpc/security/XmlRpcAuthenticatorTest.java240
-rw-r--r--archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-security/src/test/resources/spring-context.xml60
-rw-r--r--archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/pom.xml213
-rw-r--r--archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/main/java/org/apache/archiva/web/xmlrpc/services/AdministrationServiceImpl.java660
-rw-r--r--archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/main/java/org/apache/archiva/web/xmlrpc/services/PingServiceImpl.java30
-rw-r--r--archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/main/java/org/apache/archiva/web/xmlrpc/services/SearchServiceImpl.java281
-rw-r--r--archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/test/java/org/apache/archiva/web/xmlrpc/services/AdministrationServiceImplTest.java1450
-rw-r--r--archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/test/java/org/apache/archiva/web/xmlrpc/services/SearchServiceImplTest.java600
-rw-r--r--archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/test/repositories/default-repo/org/apache/archiva/archiva-test/1.0/archiva-test-1.0.jar0
-rw-r--r--archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/test/repositories/default-repo/org/apache/archiva/archiva-test/1.0/archiva-test-1.0.jar.md50
-rw-r--r--archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/test/repositories/default-repo/org/apache/archiva/archiva-test/1.0/archiva-test-1.0.jar.sha10
-rw-r--r--archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/test/repositories/default-repo/org/apache/archiva/archiva-test/1.0/archiva-test-1.0.pom18
-rw-r--r--archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/test/repositories/default-repo/org/apache/archiva/archiva-test/1.0/archiva-test-1.0.pom.md50
-rw-r--r--archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/test/repositories/default-repo/org/apache/archiva/archiva-test/1.0/archiva-test-1.0.pom.sha10
-rw-r--r--archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/test/repositories/default-repo/org/apache/archiva/archiva-test/1.0/maven-metadata.xml0
-rw-r--r--archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/test/repositories/default-repo/org/apache/archiva/archiva-test/1.0/maven-metadata.xml.md50
-rw-r--r--archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/test/repositories/default-repo/org/apache/archiva/archiva-test/1.0/maven-metadata.xml.sha10
-rw-r--r--archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/test/repositories/default-repo/org/apache/archiva/archiva-test/1.1/archiva-test-1.1.jar0
-rw-r--r--archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/test/repositories/default-repo/org/apache/archiva/archiva-test/1.1/archiva-test-1.1.pom0
-rw-r--r--archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/test/repositories/legacy-repo/org.apache.archiva/jars/archiva-diff-1.0.jar0
-rw-r--r--archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/test/repositories/legacy-repo/org.apache.archiva/jars/archiva-test-1.0.jar0
-rw-r--r--archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/test/repositories/legacy-repo/org.apache.archiva/jars/archiva-test-1.1.jar0
-rw-r--r--archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/test/repositories/legacy-repo/org.apache.archiva/poms/archiva-diff-1.0.pom0
-rw-r--r--archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/test/repositories/legacy-repo/org.apache.archiva/poms/archiva-test-1.0.pom0
-rw-r--r--archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/test/repositories/legacy-repo/org.apache.archiva/poms/archiva-test-1.1.pom0
-rw-r--r--archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/test/resources/spring-context.xml51
-rw-r--r--archiva-modules/archiva-web/archiva-xmlrpc/pom.xml36
41 files changed, 0 insertions, 5262 deletions
diff --git a/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-api/pom.xml b/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-api/pom.xml
deleted file mode 100644
index 84ce8a3a2..000000000
--- a/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-api/pom.xml
+++ /dev/null
@@ -1,69 +0,0 @@
-<!--
- ~ 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.
- -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.apache.archiva</groupId>
- <artifactId>archiva-xmlrpc</artifactId>
- <version>1.4-M3-SNAPSHOT</version>
- </parent>
- <artifactId>archiva-xmlrpc-api</artifactId>
- <packaging>bundle</packaging>
- <name>Archiva Web :: XML-RPC API</name>
- <dependencies>
- <dependency>
- <groupId>org.apache.archiva</groupId>
- <artifactId>archiva-indexer</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.archiva</groupId>
- <artifactId>stage-repository-merge</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.archiva</groupId>
- <artifactId>archiva-repository-admin-api</artifactId>
- </dependency>
- <dependency>
- <groupId>com.atlassian.xmlrpc</groupId>
- <artifactId>atlassian-xmlrpc-binder-annotations</artifactId>
- </dependency>
- </dependencies>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <configuration>
- <instructions>
- <Bundle-SymbolicName>org.apache.archiva.web.xmlrpc.api</Bundle-SymbolicName>
- <Bundle-Version>${project.version}</Bundle-Version>
- <Export-Package>
- org.apache.archiva.web.xmlrpc.api*;version=${project.version};-split-package:=merge-first
- </Export-Package>
- <Import-Package>
- org.apache.archiva.admin.model;version=${project.version},
- com.atlassian.xmlrpc;version="[0.11,1)"
- </Import-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-</project>
diff --git a/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-api/src/main/java/org/apache/archiva/web/xmlrpc/api/AdministrationService.java b/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-api/src/main/java/org/apache/archiva/web/xmlrpc/api/AdministrationService.java
deleted file mode 100644
index 3fe121b2f..000000000
--- a/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-api/src/main/java/org/apache/archiva/web/xmlrpc/api/AdministrationService.java
+++ /dev/null
@@ -1,156 +0,0 @@
-package org.apache.archiva.web.xmlrpc.api;
-
-/*
- * 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 com.atlassian.xmlrpc.ServiceObject;
-import org.apache.archiva.admin.model.RepositoryAdminException;
-import org.apache.archiva.web.xmlrpc.api.beans.ManagedRepository;
-import org.apache.archiva.web.xmlrpc.api.beans.RemoteRepository;
-
-import java.util.List;
-
-@ServiceObject( "AdministrationService" )
-public interface AdministrationService
-{
- /**
- * Executes repository scanner on the given repository.
- *
- * @param repoId id of the repository to be scanned
- * @return
- * @throws Exception
- */
- Boolean executeRepositoryScanner( String repoId )
- throws Exception;
-
- /**
- * Gets all available repository consumers.
- *
- * @return
- */
- List<String> getAllRepositoryConsumers();
-
- // TODO should we already implement config of consumers per repository?
-
- /**
- * Configures (enable or disable) repository consumer.
- *
- * @param repoId
- * @param consumerId
- * @param enable
- * @return
- * @throws Exception
- */
- Boolean configureRepositoryConsumer( String repoId, String consumerId, boolean enable )
- throws Exception;
-
- /**
- * Gets all managed repositories.
- *
- * @return
- */
- List<ManagedRepository> getAllManagedRepositories()
- throws RepositoryAdminException;
-
- /**
- * Gets all remote repositories.
- *
- * @return
- */
- List<RemoteRepository> getAllRemoteRepositories()
- throws RepositoryAdminException;
-
- /**
- * Deletes given artifact from the specified repository.
- *
- * @param repoId id of the repository where the artifact to be deleted resides
- * @param groupId groupId of the artifact to be deleted
- * @param artifactId artifactId of the artifact to be deleted
- * @param version version of the artifact to be deleted
- * @return
- * @throws Exception
- */
- Boolean deleteArtifact( String repoId, String groupId, String artifactId, String version )
- throws Exception;
-
- /**
- * Create a new managed repository with the given parameters.
- *
- * @param repoId
- * @param layout
- * @param name
- * @param location
- * @param blockRedeployments
- * @param releasesIncluded
- * @param snapshotsIncluded
- * @param cronExpression
- * @return
- * @throws Exception
- */
- Boolean addManagedRepository( String repoId, String layout, String name, String location,
- boolean blockRedeployments, boolean releasesIncluded, boolean snapshotsIncluded,
- boolean stageRepoNeeded, String cronExpression, int daysOlder, int retentionCount,
- boolean deleteReleasedSnapshots )
- throws Exception;
-
- /**
- * Deletes a managed repository with the given repository id.
- *
- * @param repoId
- * @return
- */
- Boolean deleteManagedRepository( String repoId )
- throws Exception;
-
- /**
- * Deletes a managed repository content with the given repository id
- *
- * @param repoId
- * @return
- * @throws Exception
- */
- Boolean deleteManagedRepositoryContent( String repoId )
- throws Exception;
-
- /**
- * Get a managed repository with the given repository id.
- *
- * @param repoId
- * @return
- * @throws Exception
- */
- ManagedRepository getManagedRepository( String repoId )
- throws Exception;
- // TODO
- // consider the following as additional services:
- // - getAllConfiguredRepositoryConsumers( String repoId ) - list all enabled consumers for the repo
- // - getAllConfiguredDatabaseConsumers() - list all enabled db consumers
-
- /**
- * Merge staging repository with the managed repository and skips if there are conflicts
- *
- * @param repoId
- * @param skipConflicts
- * @return
- * @throws Exception
- */
- boolean merge( String repoId, boolean skipConflicts )
- throws Exception;
-
-}
diff --git a/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-api/src/main/java/org/apache/archiva/web/xmlrpc/api/PingService.java b/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-api/src/main/java/org/apache/archiva/web/xmlrpc/api/PingService.java
deleted file mode 100644
index 492f655fe..000000000
--- a/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-api/src/main/java/org/apache/archiva/web/xmlrpc/api/PingService.java
+++ /dev/null
@@ -1,28 +0,0 @@
-package org.apache.archiva.web.xmlrpc.api;
-
-/*
- * 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 com.atlassian.xmlrpc.ServiceObject;
-
-@ServiceObject("PingService")
-public interface PingService
-{
- public String ping();
-}
diff --git a/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-api/src/main/java/org/apache/archiva/web/xmlrpc/api/SearchService.java b/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-api/src/main/java/org/apache/archiva/web/xmlrpc/api/SearchService.java
deleted file mode 100644
index 23ef4adc4..000000000
--- a/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-api/src/main/java/org/apache/archiva/web/xmlrpc/api/SearchService.java
+++ /dev/null
@@ -1,63 +0,0 @@
-package org.apache.archiva.web.xmlrpc.api;
-
-/*
- * 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 com.atlassian.xmlrpc.ServiceObject;
-import org.apache.archiva.web.xmlrpc.api.beans.Artifact;
-import org.apache.archiva.web.xmlrpc.api.beans.Dependency;
-
-import java.util.Date;
-import java.util.List;
-
-@ServiceObject( "SearchService" )
-public interface SearchService
-{
- /*
- * quick/general text search which returns a list of artifacts
- * query for an artifact based on a checksum
- * query for all available versions of an artifact, sorted in version significance order
- * query for all available versions of an artifact since a given date
- * query for an artifact's direct dependencies
- * query for an artifact's dependency tree (as with mvn dependency:tree - no duplicates should be included)
- * query for all artifacts that depend on a given artifact
- */
-
- public List<Artifact> quickSearch( String queryString )
- throws Exception;
-
- public List<Artifact> getArtifactByChecksum( String checksum )
- throws Exception;
-
- public List<Artifact> getArtifactVersions( String groupId, String artifactId )
- throws Exception;
-
- public List<Artifact> getArtifactVersionsByDate( String groupId, String artifactId, String version,
- Date whenGathered )
- throws Exception;
-
- public List<Dependency> getDependencies( String groupId, String artifactId, String version )
- throws Exception;
-
- public List<Artifact> getDependencyTree( String groupId, String artifactId, String version )
- throws Exception;
-
- public List<Artifact> getDependees( String groupId, String artifactId, String version )
- throws Exception;
-}
diff --git a/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-api/src/main/java/org/apache/archiva/web/xmlrpc/api/beans/Artifact.java b/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-api/src/main/java/org/apache/archiva/web/xmlrpc/api/beans/Artifact.java
deleted file mode 100644
index d323ffd2b..000000000
--- a/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-api/src/main/java/org/apache/archiva/web/xmlrpc/api/beans/Artifact.java
+++ /dev/null
@@ -1,180 +0,0 @@
-package org.apache.archiva.web.xmlrpc.api.beans;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.io.Serializable;
-
-import com.atlassian.xmlrpc.ServiceBean;
-import com.atlassian.xmlrpc.ServiceBeanField;
-
-@ServiceBean
-public class Artifact
- implements Serializable
-{
- private String repositoryId;
-
- private String groupId;
-
- private String artifactId;
-
- private String version;
-
- private String type;
-
- //private Date whenGathered;
-
- public Artifact()
- {
-
- }
-
- @Override
- public boolean equals( Object o )
- {
- if ( this == o )
- {
- return true;
- }
- if ( o == null || getClass() != o.getClass() )
- {
- return false;
- }
-
- Artifact artifact = (Artifact) o;
-
- if ( !artifactId.equals( artifact.artifactId ) )
- {
- return false;
- }
- if ( !groupId.equals( artifact.groupId ) )
- {
- return false;
- }
- if ( !repositoryId.equals( artifact.repositoryId ) )
- {
- return false;
- }
- if ( type != null ? !type.equals( artifact.type ) : artifact.type != null )
- {
- return false;
- }
- if ( !version.equals( artifact.version ) )
- {
- return false;
- }
-
- return true;
- }
-
- @Override
- public int hashCode()
- {
- int result = repositoryId.hashCode();
- result = 31 * result + groupId.hashCode();
- result = 31 * result + artifactId.hashCode();
- result = 31 * result + version.hashCode();
- result = 31 * result + ( type != null ? type.hashCode() : 0 );
- return result;
- }
-
- @Override
- public String toString()
- {
- return "Artifact{" + "repositoryId='" + repositoryId + '\'' + ", groupId='" + groupId + '\'' +
- ", artifactId='" + artifactId + '\'' + ", version='" + version + '\'' + ", type='" + type + '\'' + '}';
- }
-
- public Artifact( String repositoryId, String groupId, String artifactId, String version, String type )
-// String type, Date whenGathered )
- {
- this.repositoryId = repositoryId;
- this.groupId = groupId;
- this.artifactId = artifactId;
- this.version = version;
- this.type = type;
- //this.whenGathered = whenGathered;
- }
-
- public String getGroupId()
- {
- return groupId;
- }
-
- public String getArtifactId()
- {
- return artifactId;
- }
-
- public String getVersion()
- {
- return version;
- }
-
- public String getType()
- {
- return type;
- }
-
- public String getRepositoryId()
- {
- return repositoryId;
- }
-
- /*public Date getWhenGathered()
- {
- return whenGathered;
- }*/
-
- @ServiceBeanField( "groupId" )
- public void setGroupId( String groupId )
- {
- this.groupId = groupId;
- }
-
- @ServiceBeanField( "artifactId" )
- public void setArtifactId( String artifactId )
- {
- this.artifactId = artifactId;
- }
-
- @ServiceBeanField( "version" )
- public void setVersion( String version )
- {
- this.version = version;
- }
-
- @ServiceBeanField( "type" )
- public void setType( String type )
- {
- this.type = type;
- }
-
- @ServiceBeanField( "repositoryId" )
- public void setRepositoryId( String repositoryId )
- {
- this.repositoryId = repositoryId;
- }
-
- /*@ServiceBeanField( "whenGathered" )
- public void setWhenGathered( Date whenGathered )
- {
- this.whenGathered = whenGathered;
- }*/
-}
diff --git a/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-api/src/main/java/org/apache/archiva/web/xmlrpc/api/beans/Dependency.java b/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-api/src/main/java/org/apache/archiva/web/xmlrpc/api/beans/Dependency.java
deleted file mode 100644
index 3ae198132..000000000
--- a/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-api/src/main/java/org/apache/archiva/web/xmlrpc/api/beans/Dependency.java
+++ /dev/null
@@ -1,173 +0,0 @@
-package org.apache.archiva.web.xmlrpc.api.beans;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.io.Serializable;
-
-import com.atlassian.xmlrpc.ServiceBean;
-
-@ServiceBean
-public class Dependency
- implements Serializable
-{
- private String groupId;
-
- private String artifactId;
-
- private String version;
-
- private String classifier;
-
- private String type;
-
- private String scope;
-
- @Override
- public String toString()
- {
- return "Dependency{" + "groupId='" + groupId + '\'' + ", artifactId='" + artifactId + '\'' + ", version='" +
- version + '\'' + ", classifier='" + classifier + '\'' + ", type='" + type + '\'' + ", scope='" + scope +
- '\'' + '}';
- }
-
- @Override
- public boolean equals( Object o )
- {
- if ( this == o )
- {
- return true;
- }
- if ( o == null || getClass() != o.getClass() )
- {
- return false;
- }
-
- Dependency that = (Dependency) o;
-
- if ( !artifactId.equals( that.artifactId ) )
- {
- return false;
- }
- if ( classifier != null ? !classifier.equals( that.classifier ) : that.classifier != null )
- {
- return false;
- }
- if ( !groupId.equals( that.groupId ) )
- {
- return false;
- }
- if ( scope != null ? !scope.equals( that.scope ) : that.scope != null )
- {
- return false;
- }
- if ( type != null ? !type.equals( that.type ) : that.type != null )
- {
- return false;
- }
- if ( !version.equals( that.version ) )
- {
- return false;
- }
-
- return true;
- }
-
- @Override
- public int hashCode()
- {
- int result = groupId.hashCode();
- result = 31 * result + artifactId.hashCode();
- result = 31 * result + version.hashCode();
- result = 31 * result + ( classifier != null ? classifier.hashCode() : 0 );
- result = 31 * result + ( type != null ? type.hashCode() : 0 );
- result = 31 * result + ( scope != null ? scope.hashCode() : 0 );
- return result;
- }
-
- public Dependency( String groupId, String artifactId, String version, String classifier, String type, String scope )
- {
- this.groupId = groupId;
- this.artifactId = artifactId;
- this.version = version;
- this.classifier = classifier;
- this.type = type;
- this.scope = scope;
- }
-
- 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 String getVersion()
- {
- return version;
- }
-
- public void setVersion( String version )
- {
- this.version = version;
- }
-
- public String getClassifier()
- {
- return classifier;
- }
-
- public void setClassifier( String classifier )
- {
- this.classifier = classifier;
- }
-
- public String getType()
- {
- return type;
- }
-
- public void setType( String type )
- {
- this.type = type;
- }
-
- public String getScope()
- {
- return scope;
- }
-
- public void setScope( String scope )
- {
- this.scope = scope;
- }
-}
diff --git a/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-api/src/main/java/org/apache/archiva/web/xmlrpc/api/beans/ManagedRepository.java b/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-api/src/main/java/org/apache/archiva/web/xmlrpc/api/beans/ManagedRepository.java
deleted file mode 100644
index ad36b140f..000000000
--- a/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-api/src/main/java/org/apache/archiva/web/xmlrpc/api/beans/ManagedRepository.java
+++ /dev/null
@@ -1,151 +0,0 @@
-package org.apache.archiva.web.xmlrpc.api.beans;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.io.Serializable;
-
-import com.atlassian.xmlrpc.ServiceBean;
-import com.atlassian.xmlrpc.ServiceBeanField;
-
-@ServiceBean
-public class ManagedRepository
- implements Serializable
-{
- private String id;
-
- private String name;
-
- private String url;
-
- private String layout;
-
- private boolean snapshots = false;
-
- private boolean releases = false;
-
- public ManagedRepository()
- {
-
- }
-
- public ManagedRepository( String id, String name, String url, String layout, boolean snapshots, boolean releases )
- {
- this.id = id;
- this.name = name;
- this.url = url;
- this.layout = layout;
- this.snapshots = snapshots;
- this.releases = releases;
- }
-
- public boolean equals(Object other)
- {
- if ( this == other)
- {
- return true;
- }
-
- if ( !(other instanceof ManagedRepository) )
- {
- return false;
- }
-
- ManagedRepository that = (ManagedRepository) other;
- boolean result = true;
- result = result && ( getId() == null ? that.getId() == null : getId().equals( that.getId() ) );
- return result;
- }
-
- public String getId()
- {
- return this.id;
- }
-
- public String getLayout()
- {
- return this.layout;
- }
-
- public String getName()
- {
- return this.name;
- }
-
- public String getUrl()
- {
- return this.url;
- }
-
- public int hashCode()
- {
- int result = 17;
- result = 37 * result + ( id != null ? id.hashCode() : 0 );
- return result;
- }
-
- public boolean isReleases()
- {
- return this.releases;
- }
-
- /**
- * Get null
- */
- public boolean isSnapshots()
- {
- return this.snapshots;
- }
-
- @ServiceBeanField( "id" )
- public void setId(String id)
- {
- this.id = id;
- }
-
- @ServiceBeanField( "layout" )
- public void setLayout(String layout)
- {
- this.layout = layout;
- }
-
- @ServiceBeanField( "name" )
- public void setName(String name)
- {
- this.name = name;
- }
-
- @ServiceBeanField( "releases" )
- public void setReleases(boolean releases)
- {
- this.releases = releases;
- }
-
- @ServiceBeanField( "snapshots" )
- public void setSnapshots(boolean snapshots)
- {
- this.snapshots = snapshots;
- }
-
- @ServiceBeanField( "url" )
- public void setUrl(String url)
- {
- this.url = url;
- }
-} \ No newline at end of file
diff --git a/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-api/src/main/java/org/apache/archiva/web/xmlrpc/api/beans/RemoteRepository.java b/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-api/src/main/java/org/apache/archiva/web/xmlrpc/api/beans/RemoteRepository.java
deleted file mode 100644
index a15a8a679..000000000
--- a/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-api/src/main/java/org/apache/archiva/web/xmlrpc/api/beans/RemoteRepository.java
+++ /dev/null
@@ -1,120 +0,0 @@
-package org.apache.archiva.web.xmlrpc.api.beans;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.io.Serializable;
-
-import com.atlassian.xmlrpc.ServiceBean;
-import com.atlassian.xmlrpc.ServiceBeanField;
-
-@ServiceBean
-public class RemoteRepository
- implements Serializable
-{
- private String id;
-
- private String name;
-
- private String url;
-
- private String layout;
-
- public RemoteRepository()
- {
-
- }
-
- public RemoteRepository( String id, String name, String url, String layout )
- {
- this.id = id;
- this.name = name;
- this.url = url;
- this.layout = layout;
- }
-
- public boolean equals(Object other)
- {
- if ( this == other)
- {
- return true;
- }
-
- if ( !(other instanceof RemoteRepository) )
- {
- return false;
- }
-
- RemoteRepository that = (RemoteRepository) other;
- boolean result = true;
- result = result && ( getId() == null ? that.getId() == null : getId().equals( that.getId() ) );
- return result;
- }
-
- public String getId()
- {
- return this.id;
- }
-
- public String getLayout()
- {
- return this.layout;
- }
-
- public String getName()
- {
- return this.name;
- }
-
- public String getUrl()
- {
- return this.url;
- }
-
- public int hashCode()
- {
- int result = 17;
- result = 37 * result + ( id != null ? id.hashCode() : 0 );
- return result;
- }
-
- @ServiceBeanField( "id" )
- public void setId(String id)
- {
- this.id = id;
- }
-
- @ServiceBeanField( "layout" )
- public void setLayout(String layout)
- {
- this.layout = layout;
- }
-
- @ServiceBeanField( "name" )
- public void setName(String name)
- {
- this.name = name;
- }
-
- @ServiceBeanField( "url" )
- public void setUrl(String url)
- {
- this.url = url;
- }
-} \ No newline at end of file
diff --git a/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-client/pom.xml b/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-client/pom.xml
deleted file mode 100644
index 2b5e993e0..000000000
--- a/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-client/pom.xml
+++ /dev/null
@@ -1,85 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ Copyright 2005-2006 The Apache Software Foundation.
- ~
- ~ Licensed 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.
- -->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <parent>
- <artifactId>archiva-xmlrpc</artifactId>
- <groupId>org.apache.archiva</groupId>
- <version>1.4-M3-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>archiva-xmlrpc-client</artifactId>
- <name>Archiva Web :: XML-RPC Client</name>
- <dependencies>
- <dependency>
- <groupId>org.apache.archiva</groupId>
- <artifactId>archiva-xmlrpc-api</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>com.atlassian.xmlrpc</groupId>
- <artifactId>atlassian-xmlrpc-binder</artifactId>
- <exclusions>
- <exclusion>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>com.atlassian.xmlrpc</groupId>
- <artifactId>atlassian-xmlrpc-binder-client-apache</artifactId>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>jcl-over-slf4j</artifactId>
- <!-- Exec plugin doesn't use runtime scope - odd -->
- <scope>compile</scope>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-simple</artifactId>
- <!-- Exec plugin doesn't use runtime scope - odd -->
- <scope>compile</scope>
- </dependency>
- </dependencies>
- <build>
- <plugins>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>exec-maven-plugin</artifactId>
- <configuration>
- <executable>java</executable>
- <mainClass>org.apache.archiva.web.xmlrpc.client.SampleClient</mainClass>
- <arguments>
- <!--
- URL: ex. http://127.0.0.1:9091/xmlrpc
- USERNAME & PASSWORD: Archiva credentials
- -->
- <argument>${archiva.url}/xmlrpc</argument>
- <argument>${username}</argument>
- <argument>${password}</argument>
- </arguments>
- </configuration>
- </plugin>
- </plugins>
- </build>
- <properties>
- <archiva.url>http://127.0.0.1:8080/archiva</archiva.url>
- <username>admin</username>
- </properties>
-</project>
diff --git a/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-client/src/main/java/org/apache/archiva/web/xmlrpc/client/SampleClient.java b/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-client/src/main/java/org/apache/archiva/web/xmlrpc/client/SampleClient.java
deleted file mode 100644
index e7ae4ce72..000000000
--- a/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-client/src/main/java/org/apache/archiva/web/xmlrpc/client/SampleClient.java
+++ /dev/null
@@ -1,161 +0,0 @@
-package org.apache.archiva.web.xmlrpc.client;
-
-/*
- * 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.net.URL;
-import java.util.List;
-import java.util.TimeZone;
-
-import com.atlassian.xmlrpc.ApacheBinder;
-import com.atlassian.xmlrpc.Binder;
-import com.atlassian.xmlrpc.BindingException;
-import com.atlassian.xmlrpc.ConnectionInfo;
-import org.apache.archiva.web.xmlrpc.api.AdministrationService;
-import org.apache.archiva.web.xmlrpc.api.PingService;
-import org.apache.archiva.web.xmlrpc.api.beans.ManagedRepository;
-import org.apache.archiva.web.xmlrpc.api.beans.RemoteRepository;
-
-/**
- * TestClient
- *
- * Test client for Archiva Web Services.
- * To execute:
- *
- * 1. set the <arguments> in the exec-maven-plugin config in the pom.xml in the following order:
- * - url
- * - username
- * - password
- * 2. execute 'mvn exec:java' from the command-line
- *
- * @version $Id$
- */
-public class SampleClient
-{
- public static void main( String[] args )
- {
-
- Binder binder = new ApacheBinder();
- ConnectionInfo info = new ConnectionInfo();
- info.setUsername( args[1] );
- info.setPassword( args[2] );
- info.setTimeZone( TimeZone.getDefault() );
-
- try
- {
- AdministrationService adminService = binder.bind( AdministrationService.class, new URL( args[0] ), info );
- PingService pingService = binder.bind( PingService.class, new URL( args[0] ), info );
-
- System.out.println( "Ping : " + pingService.ping() );
-
- List<ManagedRepository> managedRepos = adminService.getAllManagedRepositories();
-
- System.out.println( "\n******** Managed Repositories ********" );
- for( ManagedRepository managedRepo : managedRepos )
- {
- System.out.println( "=================================" );
- System.out.println( "Id: " + managedRepo.getId() );
- System.out.println( "Name: " + managedRepo.getName() );
- System.out.println( "Layout: " + managedRepo.getLayout() );
- System.out.println( "URL: " + managedRepo.getUrl() );
- System.out.println( "Releases: " + managedRepo.isReleases() );
- System.out.println( "Snapshots: " + managedRepo.isSnapshots() );
- }
-
- System.out.println( "\n******** Remote Repositories ********" );
- List<RemoteRepository> remoteRepos = adminService.getAllRemoteRepositories();
- for( RemoteRepository remoteRepo : remoteRepos )
- {
- System.out.println( "=================================" );
- System.out.println( "Id: " + remoteRepo.getId() );
- System.out.println( "Name: " + remoteRepo.getName() );
- System.out.println( "Layout: " + remoteRepo.getLayout() );
- System.out.println( "URL: " + remoteRepo.getUrl() );
- }
-
- System.out.println( "\n******** Repository Consumers ********" );
- List<String> repoConsumers = adminService.getAllRepositoryConsumers();
- for( String consumer : repoConsumers )
- {
- System.out.println( consumer );
- }
-
- Boolean success = adminService.configureRepositoryConsumer( "internal", "repository-purge", true );
- System.out.println( "\nConfigured repo consumer 'repository-purge' : " +
- ( (Boolean) success ).booleanValue() );
-
- success = adminService.executeRepositoryScanner( "internal" );
- System.out.println( "\nExecuted repo scanner of repository 'internal' : " +
- ( (Boolean) success ).booleanValue() );
-
- /** add, get and delete managed repo **/
- /*
- * NOTE: change the location of the repository to be added depending on your platform!
- *
- success = adminService.addManagedRepository( "test", "default", "Test Repo",
- "/tmp/archiva-repo/test/", true, true, false, "0 0 * * * ?" );
- System.out.println( "\nSuccessfully added managed repository 'test'" );
-
- ManagedRepository repo = adminService.getManagedRepository( "test" );
- System.out.println( "****** managed repo info ******" );
- System.out.println( "ID: " + repo.getId() );
- System.out.println( "NAME: " + repo.getName() );
- System.out.println( "LAYOUT: " + repo.getLayout() );
- System.out.println( "URL: " + repo.getUrl() );
-
- success = adminService.deleteManagedRepository( "test" );
- System.out.println( "\nSuccessfully deleted managed repository 'test'" );
- */
-
- /* delete artifact */
- /*
- * NOTE: before enabling & invoking deleteArtifact, make sure that the repository and artifact exists first!
- *
- success = adminService.deleteArtifact( "internal", "javax.activation", "activation", "1.1" );
- System.out.println( "\nDeleted artifact 'javax.activation:activation:1.1' from repository 'internal' : " +
- ( (Boolean) success ).booleanValue() );
- */
-
- /* quick search */
- /*
- * NOTE: before enabling & invoking search service, make sure that the artifacts you're searching
- * for has been indexed already in order to get results
- *
- SearchService searchService = binder.bind( SearchService.class, new URL( args[0] ), authnInfo );
- List<Artifact> artifacts = searchService.quickSearch( "org" );
-
- System.out.println( "\n************ Search Results for 'org' *************" );
- for( Artifact artifact : artifacts )
- {
- System.out.println( "Artifact: " + artifact.getGroupId() + ":" + artifact.getArtifactId() +
- ":" + artifact.getVersion() );
- }
- */
-
- }
- catch ( BindingException e )
- {
- e.printStackTrace();
- }
- catch( Exception e )
- {
- e.printStackTrace();
- }
- }
-}
diff --git a/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-security/pom.xml b/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-security/pom.xml
deleted file mode 100644
index e8de4e017..000000000
--- a/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-security/pom.xml
+++ /dev/null
@@ -1,175 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ 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.
- -->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.apache.archiva</groupId>
- <artifactId>archiva-xmlrpc</artifactId>
- <version>1.4-M3-SNAPSHOT</version>
- </parent>
- <artifactId>archiva-xmlrpc-security</artifactId>
- <packaging>bundle</packaging>
- <name>Archiva Web :: XML-RPC Security</name>
- <dependencies>
- <dependency>
- <groupId>org.apache.xmlrpc</groupId>
- <artifactId>xmlrpc-server</artifactId>
- <exclusions>
- <exclusion>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.codehaus.redback</groupId>
- <artifactId>redback-system</artifactId>
- <exclusions>
- <exclusion>
- <groupId>org.codehaus.redback</groupId>
- <artifactId>plexus-spring</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.codehaus.plexus.registry</groupId>
- <artifactId>plexus-registry-api</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.codehaus.plexus.registry</groupId>
- <artifactId>plexus-registry-commons</artifactId>
- </exclusion>
- <exclusion>
- <groupId>net.sf.ehcache</groupId>
- <artifactId>ehcache</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.codehaus.plexus.cache</groupId>
- <artifactId>plexus-cache-ehcache</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.codehaus.plexus.cache</groupId>
- <artifactId>plexus-cache-api</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.codehaus.plexus</groupId>
- <artifactId>plexus-component-api</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.apache.archiva</groupId>
- <artifactId>archiva-security</artifactId>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-context</artifactId>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-test</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.codehaus.redback</groupId>
- <artifactId>redback-authorization-rbac</artifactId>
- <scope>test</scope>
- <exclusions>
- <exclusion>
- <groupId>net.sf.ehcache</groupId>
- <artifactId>ehcache</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.codehaus.plexus.cache</groupId>
- <artifactId>plexus-cache-ehcache</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.codehaus.plexus.cache</groupId>
- <artifactId>plexus-cache-api</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.codehaus.redback</groupId>
- <artifactId>redback-keys-memory</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.codehaus.redback</groupId>
- <artifactId>redback-users-memory</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.codehaus.redback</groupId>
- <artifactId>redback-rbac-memory</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-simple</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.derby</groupId>
- <artifactId>derby</artifactId>
- </dependency>
- <dependency>
- <groupId>org.codehaus.redback</groupId>
- <artifactId>redback-common-test-resources</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <configuration>
- <instructions>
- <Bundle-SymbolicName>org.apache.archiva.web.xmlrpc.security</Bundle-SymbolicName>
- <Bundle-Version>${project.version}</Bundle-Version>
- <Export-Package>
- org.apache.archiva.web.xmlrpc.security;version=${project.version};-split-package:=merge-first
- </Export-Package>
- <Import-Package>
- org.apache.archiva.security;version=${project.version},
- org.apache.xmlrpc;version="[3,4)",
- org.apache.xmlrpc.common;version="[3,4)",
- org.apache.xmlrpc.server;version="[3,4)",
- org.codehaus.plexus.redback.authentication,
- org.codehaus.plexus.redback.authorization,
- org.codehaus.plexus.redback.policy,
- org.codehaus.plexus.redback.system,
- org.codehaus.plexus.redback.users
- </Import-Package>
- </instructions>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <systemPropertyVariables>
- <derby.system.home>${project.build.directory}/appserver-base</derby.system.home>
- </systemPropertyVariables>
- </configuration>
- </plugin>
- </plugins>
- </build>
-</project>
diff --git a/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-security/src/main/java/org/apache/archiva/web/xmlrpc/security/ServiceMethodsPermissionsMapping.java b/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-security/src/main/java/org/apache/archiva/web/xmlrpc/security/ServiceMethodsPermissionsMapping.java
deleted file mode 100644
index 5183d3271..000000000
--- a/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-security/src/main/java/org/apache/archiva/web/xmlrpc/security/ServiceMethodsPermissionsMapping.java
+++ /dev/null
@@ -1,59 +0,0 @@
-package org.apache.archiva.web.xmlrpc.security;
-
-/*
- * 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.Arrays;
-import java.util.List;
-
-/**
- * ServiceMethodsPermissionsMapping
- *
- * Used by the XmlRpcAuthenticationHandler to check the permissions specific to the requested service method.
- * New methods in exposed services must be registered in the appropriate operation below.
- *
- * @version $Id: ServiceMethodsPermissionsMapping.java
- */
-public class ServiceMethodsPermissionsMapping
-{
- public static final List<String> SERVICE_METHODS_FOR_OPERATION_MANAGE_CONFIGURATION =
- Arrays.asList( "AdministrationService.configureRepositoryConsumer",
- "AdministrationService.configureDatabaseConsumer",
- "AdministrationService.executeDatabaseScanner",
- "AdministrationService.getAllManagedRepositories",
- "AdministrationService.getAllRemoteRepositories",
- "AdministrationService.getAllDatabaseConsumers",
- "AdministrationService.getAllRepositoryConsumers",
- "AdministrationService.deleteArtifact",
- "AdministrationService.addManagedRepository",
- "AdministrationService.deleteManagedRepository", "AdministrationService.getManagedRepository",
- "AdministrationService.merge",
- "AdministrationService.deleteManagedRepositoryContent");
-
- public static final List<String> SERVICE_METHODS_FOR_OPERATION_RUN_INDEXER =
- Arrays.asList( "AdministrationService.executeRepositoryScanner" );
-
- public static final List<String> SERVICE_METHODS_FOR_OPERATION_REPOSITORY_ACCESS =
- Arrays.asList( "SearchService.quickSearch", "SearchService.getArtifactByChecksum",
- "SearchService.getArtifactVersions", "SearchService.getArtifactVersionsByDate",
- "SearchService.getDependencies", "SearchService.getDependencyTree",
- "SearchService.getDependees" );
-
- public static final String PING = "PingService.ping";
-}
diff --git a/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-security/src/main/java/org/apache/archiva/web/xmlrpc/security/XmlRpcAuthenticator.java b/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-security/src/main/java/org/apache/archiva/web/xmlrpc/security/XmlRpcAuthenticator.java
deleted file mode 100644
index 6f50f2054..000000000
--- a/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-security/src/main/java/org/apache/archiva/web/xmlrpc/security/XmlRpcAuthenticator.java
+++ /dev/null
@@ -1,155 +0,0 @@
-package org.apache.archiva.web.xmlrpc.security;
-
-/*
- * 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.archiva.security.ArchivaSecurityException;
-import org.apache.archiva.security.UserRepositories;
-import org.apache.archiva.security.common.ArchivaRoleConstants;
-import org.apache.xmlrpc.XmlRpcException;
-import org.apache.xmlrpc.XmlRpcRequest;
-import org.apache.xmlrpc.common.XmlRpcHttpRequestConfigImpl;
-import org.apache.xmlrpc.server.AbstractReflectiveHandlerMapping.AuthenticationHandler;
-import org.codehaus.plexus.redback.authentication.AuthenticationException;
-import org.codehaus.plexus.redback.authentication.PasswordBasedAuthenticationDataSource;
-import org.codehaus.plexus.redback.authorization.AuthorizationException;
-import org.codehaus.plexus.redback.authorization.AuthorizationResult;
-import org.codehaus.plexus.redback.policy.PolicyViolationException;
-import org.codehaus.plexus.redback.system.SecuritySession;
-import org.codehaus.plexus.redback.system.SecuritySystem;
-import org.codehaus.plexus.redback.users.UserNotFoundException;
-
-/**
- * XmlRpcAuthenticator
- *
- * Custom authentication and authorization handler for xmlrpc requests.
- *
- * @version $Id
- */
-public class XmlRpcAuthenticator
- implements AuthenticationHandler
-{
- private final SecuritySystem securitySystem;
-
- private UserRepositories userRepositories;
-
- private String username;
-
- public XmlRpcAuthenticator( SecuritySystem securitySystem, UserRepositories userRepositories )
- {
- this.securitySystem = securitySystem;
- this.userRepositories = userRepositories;
- }
-
- public boolean isAuthorized( XmlRpcRequest pRequest )
- throws XmlRpcException
- {
- if ( pRequest.getConfig() instanceof XmlRpcHttpRequestConfigImpl )
- {
- XmlRpcHttpRequestConfigImpl config = (XmlRpcHttpRequestConfigImpl) pRequest.getConfig();
- username = config.getBasicUserName();
- SecuritySession session =
- authenticate( new PasswordBasedAuthenticationDataSource( username,
- config.getBasicPassword() ) );
-
- String method = pRequest.getMethodName();
- AuthorizationResult result = authorize( session, method, username );
-
- return result.isAuthorized();
- }
-
- throw new XmlRpcException( "Unsupported transport (must be http)" );
- }
-
- private SecuritySession authenticate( PasswordBasedAuthenticationDataSource authenticationDataSource )
- throws XmlRpcException
- {
- try
- {
- return securitySystem.authenticate( authenticationDataSource );
- }
- catch ( PolicyViolationException e )
- {
- throw new XmlRpcException( 401, e.getMessage(), e );
- }
- catch ( AuthenticationException e )
- {
- throw new XmlRpcException( 401, e.getMessage(), e );
- }
- catch ( UserNotFoundException e )
- {
- throw new XmlRpcException( 401, e.getMessage(), e );
- }
- }
-
- private AuthorizationResult authorize( SecuritySession session, String methodName, String username )
- throws XmlRpcException
- {
- try
- {
- // sample attempt at simplifying authorization checking of requested service method
- if ( ServiceMethodsPermissionsMapping.SERVICE_METHODS_FOR_OPERATION_MANAGE_CONFIGURATION.contains( methodName ) )
- {
- return securitySystem.authorize( session, ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION );
- }
- else if ( ServiceMethodsPermissionsMapping.SERVICE_METHODS_FOR_OPERATION_RUN_INDEXER.contains( methodName ) )
- {
- return securitySystem.authorize( session, ArchivaRoleConstants.OPERATION_RUN_INDEXER );
- }
- else if ( ServiceMethodsPermissionsMapping.SERVICE_METHODS_FOR_OPERATION_REPOSITORY_ACCESS.contains( methodName ) )
- {
- try
- {
- List<String> observableRepos = userRepositories.getObservableRepositoryIds( username );
- if( observableRepos != null && observableRepos.size() > 1 )
- {
- return new AuthorizationResult( true, username, null );
- }
- else
- {
- return new AuthorizationResult( false, username, null );
- }
- }
- catch ( ArchivaSecurityException e )
- {
- throw new XmlRpcException( 401, e.getMessage() );
- }
- }
- else if ( methodName.equals( ServiceMethodsPermissionsMapping.PING ) )
- {
- return new AuthorizationResult( true, username, null );
- }
- else
- {
- return securitySystem.authorize( session, ArchivaRoleConstants.GLOBAL_REPOSITORY_MANAGER_ROLE );
- }
- }
- catch ( AuthorizationException e )
- {
- throw new XmlRpcException( 401, e.getMessage(), e );
- }
- }
-
- public String getActiveUser()
- {
- return username;
- }
-}
diff --git a/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-security/src/main/java/org/apache/archiva/web/xmlrpc/security/XmlRpcUserRepositories.java b/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-security/src/main/java/org/apache/archiva/web/xmlrpc/security/XmlRpcUserRepositories.java
deleted file mode 100644
index 65bd79964..000000000
--- a/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-security/src/main/java/org/apache/archiva/web/xmlrpc/security/XmlRpcUserRepositories.java
+++ /dev/null
@@ -1,48 +0,0 @@
-package org.apache.archiva.web.xmlrpc.security;
-
-/*
- * 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.archiva.security.ArchivaSecurityException;
-import org.apache.archiva.security.PrincipalNotFoundException;
-import org.apache.archiva.security.UserRepositories;
-import org.apache.xmlrpc.server.AbstractReflectiveHandlerMapping.AuthenticationHandler;
-
-public class XmlRpcUserRepositories
-{
- private UserRepositories userRepositories;
-
- private AuthenticationHandler authnHandler;
-
- public XmlRpcUserRepositories( UserRepositories userRepositories, AuthenticationHandler authnHandler )
- {
- this.userRepositories = userRepositories;
- this.authnHandler = authnHandler;
- }
-
- public List<String> getObservableRepositories()
- throws PrincipalNotFoundException, ArchivaSecurityException
- {
- XmlRpcAuthenticator xmlRpcAuthn = (XmlRpcAuthenticator) authnHandler;
-
- return userRepositories.getObservableRepositoryIds( xmlRpcAuthn.getActiveUser() );
- }
-}
diff --git a/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-security/src/test/java/org/apache/archiva/xmlrpc/security/XmlRpcAuthenticatorTest.java b/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-security/src/test/java/org/apache/archiva/xmlrpc/security/XmlRpcAuthenticatorTest.java
deleted file mode 100644
index 1f56cb2b1..000000000
--- a/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-security/src/test/java/org/apache/archiva/xmlrpc/security/XmlRpcAuthenticatorTest.java
+++ /dev/null
@@ -1,240 +0,0 @@
-package org.apache.archiva.xmlrpc.security;
-
-/*
- * 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 junit.framework.TestCase;
-import org.apache.archiva.security.common.ArchivaRoleConstants;
-import org.apache.archiva.web.xmlrpc.security.XmlRpcAuthenticator;
-import org.apache.xmlrpc.XmlRpcRequest;
-import org.apache.xmlrpc.common.XmlRpcHttpRequestConfigImpl;
-import org.codehaus.plexus.redback.role.RoleManager;
-import org.codehaus.plexus.redback.system.SecuritySystem;
-import org.codehaus.plexus.redback.users.User;
-import org.codehaus.plexus.redback.users.UserManager;
-import org.codehaus.plexus.redback.users.UserNotFoundException;
-import org.easymock.MockControl;
-import org.easymock.classextension.MockClassControl;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-
-import javax.inject.Inject;
-import javax.inject.Named;
-
-/**
- * XmlRpcAuthenticatorTest
- *
- * @version $Id XmlRpcAuthenticatorTest.java
- */
-@RunWith( SpringJUnit4ClassRunner.class )
-@ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml", "classpath*:/spring-context.xml" } )
-public class XmlRpcAuthenticatorTest
- extends TestCase
-{
- protected static final String USER_GUEST = "guest";
-
- protected static final String USER_ADMIN = "admin";
-
- protected static final String USER_ALPACA = "alpaca";
-
- private static final String PASSWORD = "password123";
-
- @Inject
- @Named( value = "securitySystem#testable" )
- protected SecuritySystem securitySystem;
-
-
- @Inject
- @Named( value = "roleManager#testable" )
- protected RoleManager roleManager;
-
- private MockControl xmlRpcRequestControl;
-
- private XmlRpcRequest xmlRpcRequest;
-
- private XmlRpcAuthenticator authenticator;
-
- private MockControl configControl;
-
- private XmlRpcHttpRequestConfigImpl config;
-
- @Before
- public void setUp()
- throws Exception
- {
- super.setUp();
-
- //securitySystem = (SecuritySystem) lookup( SecuritySystem.class, "testable" );
- //roleManager = (RoleManager) lookup( RoleManager.class, "default" );
-
- // Some basic asserts.
- assertNotNull( securitySystem );
- assertNotNull( roleManager );
-
- // Setup Admin User.
- User adminUser = createUser( USER_ADMIN, "Admin User", null );
- roleManager.assignRole( ArchivaRoleConstants.TEMPLATE_SYSTEM_ADMIN, adminUser.getPrincipal().toString() );
-
- // Setup Guest User.
- User guestUser = createUser( USER_GUEST, "Guest User", null );
- roleManager.assignRole( ArchivaRoleConstants.TEMPLATE_GUEST, guestUser.getPrincipal().toString() );
-
- configControl = MockClassControl.createControl( XmlRpcHttpRequestConfigImpl.class );
- config = (XmlRpcHttpRequestConfigImpl) configControl.getMock();
-
- xmlRpcRequestControl = MockControl.createControl( XmlRpcRequest.class );
- xmlRpcRequest = (XmlRpcRequest) xmlRpcRequestControl.getMock();
-
- authenticator = new XmlRpcAuthenticator( securitySystem, null );
- }
-
- private User createUser( String principal, String fullname, String password )
- throws UserNotFoundException
- {
- UserManager userManager = securitySystem.getUserManager();
-
- User user = userManager.createUser( principal, fullname, principal + "@testable.archiva.apache.org" );
- securitySystem.getPolicy().setEnabled( false );
- userManager.addUser( user );
- securitySystem.getPolicy().setEnabled( true );
-
- user.setPassword( password );
- userManager.updateUser( user );
-
- return user;
- }
-
- @Test
- public void testIsAuthorizedUserExistsButNotAuthorized()
- throws Exception
- {
- createUser( USER_ALPACA, "Al 'Archiva' Paca", PASSWORD );
-
- UserManager userManager = securitySystem.getUserManager();
- try
- {
- User user = userManager.findUser( USER_ALPACA );
- assertEquals( USER_ALPACA, user.getPrincipal() );
- }
- catch ( UserNotFoundException e )
- {
- fail( "User should exist in the database." );
- }
-
- xmlRpcRequestControl.expectAndReturn( xmlRpcRequest.getConfig(), config, 2 );
-
- configControl.expectAndReturn( config.getBasicUserName(), USER_ALPACA );
-
- configControl.expectAndReturn( config.getBasicPassword(), PASSWORD );
-
- xmlRpcRequestControl.expectAndReturn( xmlRpcRequest.getMethodName(),
- "AdministrationService.getAllManagedRepositories" );
-
- xmlRpcRequestControl.replay();
- configControl.replay();
-
- boolean isAuthorized = authenticator.isAuthorized( xmlRpcRequest );
-
- xmlRpcRequestControl.verify();
- configControl.verify();
-
- assertFalse( isAuthorized );
- }
-
- @Test
- public void testIsAuthorizedUserExistsAndAuthorized()
- throws Exception
- {
- createUser( USER_ALPACA, "Al 'Archiva' Paca", PASSWORD );
-
- UserManager userManager = securitySystem.getUserManager();
- try
- {
- User user = userManager.findUser( USER_ALPACA );
- assertEquals( USER_ALPACA, user.getPrincipal() );
- }
- catch ( UserNotFoundException e )
- {
- fail( "User should exist in the database." );
- }
-
- //TODO cannot assign global repo manager role - it says role does not exist :|
-
- //roleManager.assignRole( ArchivaRoleConstants.GLOBAL_REPOSITORY_MANAGER_ROLE, USER_ALPACA );
-
- xmlRpcRequestControl.expectAndReturn( xmlRpcRequest.getConfig(), config, 2 );
-
- configControl.expectAndReturn( config.getBasicUserName(), USER_ALPACA );
-
- configControl.expectAndReturn( config.getBasicPassword(), PASSWORD );
-
- xmlRpcRequestControl.expectAndReturn( xmlRpcRequest.getMethodName(),
- "AdministrationService.getAllManagedRepositories" );
-
- xmlRpcRequestControl.replay();
- configControl.replay();
-
- @SuppressWarnings( "unused" ) boolean isAuthorized = authenticator.isAuthorized( xmlRpcRequest );
- // TODO: broken or bad test?
- // assertTrue( isAuthorized );
-
- xmlRpcRequestControl.verify();
- configControl.verify();
-
- userManager.deleteUser( USER_ALPACA );
- }
-
- @Test
- public void testIsAuthorizedUserDoesNotExist()
- throws Exception
- {
- UserManager userManager = securitySystem.getUserManager();
- try
- {
- userManager.findUser( USER_ALPACA );
- fail( "User should not exist in the database." );
- }
- catch ( UserNotFoundException e )
- {
- assertEquals( "Unable to find user 'alpaca'", e.getMessage() );
- }
-
- xmlRpcRequestControl.expectAndReturn( xmlRpcRequest.getConfig(), config, 2 );
-
- configControl.expectAndReturn( config.getBasicUserName(), USER_ALPACA );
-
- configControl.expectAndReturn( config.getBasicPassword(), PASSWORD );
-
- xmlRpcRequestControl.expectAndReturn( xmlRpcRequest.getMethodName(),
- "AdministrationService.getAllManagedRepositories" );
-
- xmlRpcRequestControl.replay();
- configControl.replay();
-
- boolean isAuthorized = authenticator.isAuthorized( xmlRpcRequest );
-
- xmlRpcRequestControl.verify();
- configControl.verify();
-
- assertFalse( isAuthorized );
- }
-}
diff --git a/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-security/src/test/resources/spring-context.xml b/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-security/src/test/resources/spring-context.xml
deleted file mode 100644
index 4e2bcce0b..000000000
--- a/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-security/src/test/resources/spring-context.xml
+++ /dev/null
@@ -1,60 +0,0 @@
-<?xml version="1.0"?>
-
-<!--
- ~ 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.
- -->
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:context="http://www.springframework.org/schema/context"
- xsi:schemaLocation="http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
- http://www.springframework.org/schema/context
- http://www.springframework.org/schema/context/spring-context-3.0.xsd"
- default-lazy-init="true">
-
- <bean name="securitySystem#testable" class="org.codehaus.plexus.redback.system.DefaultSecuritySystem">
- <property name="authnManager" ref="authenticationManager"/>
- <property name="userManager" ref="userManager#memory"/>
- <property name="keyManager" ref="keyManager#memory"/>
- <property name="authorizer" ref="authorizer#rbac"/>
- </bean>
-
- <bean name="authorizer#rbac" class="org.codehaus.plexus.redback.authorization.rbac.RbacAuthorizer">
- <property name="manager" ref="rBACManager#memory"/>
- <property name="userManager" ref="userManager#memory"/>
- <property name="evaluator" ref="permissionEvaluator"/>
- </bean>
-
- <bean name="permissionEvaluator" class="org.codehaus.plexus.redback.authorization.rbac.evaluator.DefaultPermissionEvaluator">
- <property name="userManager" ref="userManager#memory"/>
- </bean>
-
- <bean name="roleManager" class="org.codehaus.plexus.redback.role.DefaultRoleManager">
- <property name="rbacManager" ref="rBACManager#memory"/>
- </bean>
- <alias name="roleManager" alias="roleManager#testable"/>
-
- <bean name="roleModelProcessor" class="org.codehaus.plexus.redback.role.processor.DefaultRoleModelProcessor">
- <property name="rbacManager" ref="rBACManager#memory"/>
- </bean>
-
- <bean name="roleTemplateProcessor" class="org.codehaus.plexus.redback.role.template.DefaultRoleTemplateProcessor">
- <property name="rbacManager" ref="rBACManager#memory"/>
- </bean>
-
-</beans> \ No newline at end of file
diff --git a/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/pom.xml b/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/pom.xml
deleted file mode 100644
index 8812dd85e..000000000
--- a/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/pom.xml
+++ /dev/null
@@ -1,213 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ 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.
- -->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.apache.archiva</groupId>
- <artifactId>archiva-xmlrpc</artifactId>
- <version>1.4-M3-SNAPSHOT</version>
- </parent>
- <artifactId>archiva-xmlrpc-services</artifactId>
- <packaging>bundle</packaging>
- <name>Archiva Web :: XML-RPC Services</name>
- <dependencies>
- <dependency>
- <groupId>org.apache.xmlrpc</groupId>
- <artifactId>xmlrpc-server</artifactId>
- <exclusions>
- <exclusion>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.apache.archiva</groupId>
- <artifactId>archiva-repository-admin-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.archiva</groupId>
- <artifactId>archiva-xmlrpc-security</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.archiva</groupId>
- <artifactId>archiva-xmlrpc-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.archiva</groupId>
- <artifactId>audit</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.archiva</groupId>
- <artifactId>archiva-repository-scanner</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.archiva</groupId>
- <artifactId>archiva-repository-layer</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.archiva</groupId>
- <artifactId>archiva-scheduler-repository</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.archiva</groupId>
- <artifactId>archiva-security</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.archiva</groupId>
- <artifactId>metadata-repository-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.archiva</groupId>
- <artifactId>maven2-repository</artifactId>
- </dependency>
- <dependency>
- <groupId>commons-validator</groupId>
- <artifactId>commons-validator</artifactId>
- </dependency>
- <dependency>
- <groupId>oro</groupId>
- <artifactId>oro</artifactId>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-simple</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.mockito</groupId>
- <artifactId>mockito-all</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.archiva</groupId>
- <artifactId>archiva-repository-admin-default</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.archiva</groupId>
- <artifactId>archiva-configuration</artifactId>
- <scope>runtime</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.jackrabbit</groupId>
- <artifactId>jackrabbit-core</artifactId>
- <scope>test</scope>
- <exclusions>
- <exclusion>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.apache.derby</groupId>
- <artifactId>derby</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.codehaus.redback</groupId>
- <artifactId>redback-keys-memory</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.codehaus.redback</groupId>
- <artifactId>redback-rbac-cached</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.codehaus.redback</groupId>
- <artifactId>redback-rbac-memory</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.codehaus.redback</groupId>
- <artifactId>redback-users-memory</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.codehaus.redback</groupId>
- <artifactId>redback-common-test-resources</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <configuration>
- <instructions>
- <Bundle-SymbolicName>org.apache.archiva.web.xmlrpc.services</Bundle-SymbolicName>
- <Bundle-Version>${project.version}</Bundle-Version>
- <Export-Package>
- org.apache.archiva.web.xmlrpc.services;version=${project.version};-split-package:=merge-first
- </Export-Package>
- <Import-Package>
- org.apache.archiva.admin.model*;version=${project.version},
- org.apache.archiva.audit;version=${project.version},
- org.apache.archiva.consumers;version=${project.version},
- org.apache.archiva.indexer*;version=${project.version},
- org.apache.archiva.metadata*;version=${project.version},
- org.apache.archiva.model;version=${project.version},
- org.apache.archiva.repository*;version=${project.version},
- org.apache.archiva.scheduler.repository;version=${project.version},
- org.apache.archiva.stagerepository.merge;version=${project.version},
- org.apache.archiva.web.xmlrpc.api*;version=${project.version},
- org.apache.archiva.web.xmlrpc.security;version=${project.version},
- org.apache.commons.io;version="[1.4,2)",
- org.apache.commons.lang;version="[2.4,3)",
- org.codehaus.plexus.redback.users,
- org.slf4j;resolution:=optional
- </Import-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- <pluginManagement>
- <plugins>
- <plugin>
- <groupId>org.apache.rat</groupId>
- <artifactId>apache-rat-plugin</artifactId>
- <configuration>
- <excludes>
- <exclude>src/test/repositories/**</exclude>
- </excludes>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <systemPropertyVariables>
- <appserver.base>${project.build.directory}/appserver-base</appserver.base>
- <plexus.home>${project.build.directory}/appserver-base</plexus.home>
- <java.io.tmpdir>${project.build.testOutputDirectory}</java.io.tmpdir>
- <derby.system.home>${project.build.directory}/appserver-base</derby.system.home>
- <redback.jdbc.url>${redbackTestJdbcUrl}</redback.jdbc.url>
- <redback.jdbc.driver.name>${redbackTestJdbcDriver}</redback.jdbc.driver.name>
- </systemPropertyVariables>
- </configuration>
- </plugin>
- </plugins>
- </pluginManagement>
- </build>
-</project>
diff --git a/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/main/java/org/apache/archiva/web/xmlrpc/services/AdministrationServiceImpl.java b/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/main/java/org/apache/archiva/web/xmlrpc/services/AdministrationServiceImpl.java
deleted file mode 100644
index 78ff18134..000000000
--- a/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/main/java/org/apache/archiva/web/xmlrpc/services/AdministrationServiceImpl.java
+++ /dev/null
@@ -1,660 +0,0 @@
-package org.apache.archiva.web.xmlrpc.services;
-
-/*
- * 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.admin.model.AuditInformation;
-import org.apache.archiva.admin.model.RepositoryAdminException;
-import org.apache.archiva.admin.model.admin.ArchivaAdministration;
-import org.apache.archiva.admin.model.beans.ProxyConnector;
-import org.apache.archiva.admin.model.group.RepositoryGroupAdmin;
-import org.apache.archiva.admin.model.managed.ManagedRepositoryAdmin;
-import org.apache.archiva.admin.model.proxyconnector.ProxyConnectorAdmin;
-import org.apache.archiva.admin.model.remote.RemoteRepositoryAdmin;
-import org.apache.archiva.audit.AuditEvent;
-import org.apache.archiva.audit.AuditListener;
-import org.apache.archiva.metadata.model.ArtifactMetadata;
-import org.apache.archiva.metadata.repository.MetadataRepository;
-import org.apache.archiva.metadata.repository.RepositorySession;
-import org.apache.archiva.metadata.repository.RepositorySessionFactory;
-import org.apache.archiva.metadata.repository.filter.Filter;
-import org.apache.archiva.metadata.repository.filter.IncludesFilter;
-import org.apache.archiva.metadata.repository.stats.RepositoryStatisticsManager;
-import org.apache.archiva.repository.events.RepositoryListener;
-import org.apache.archiva.repository.scanner.RepositoryContentConsumers;
-import org.apache.archiva.scheduler.repository.RepositoryArchivaTaskScheduler;
-import org.apache.archiva.scheduler.repository.RepositoryTask;
-import org.apache.archiva.stagerepository.merge.RepositoryMerger;
-import org.apache.archiva.web.xmlrpc.api.AdministrationService;
-import org.apache.archiva.web.xmlrpc.api.beans.ManagedRepository;
-import org.apache.archiva.web.xmlrpc.api.beans.RemoteRepository;
-import org.apache.commons.io.FileUtils;
-import org.apache.commons.lang.StringUtils;
-import org.apache.archiva.consumers.InvalidRepositoryContentConsumer;
-import org.apache.archiva.consumers.KnownRepositoryContentConsumer;
-import org.apache.archiva.model.VersionedReference;
-import org.apache.archiva.repository.ContentNotFoundException;
-import org.apache.archiva.repository.ManagedRepositoryContent;
-import org.apache.archiva.repository.RepositoryContentFactory;
-import org.apache.archiva.repository.RepositoryException;
-import org.apache.archiva.repository.RepositoryNotFoundException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
-
-/**
- * AdministrationServiceImpl
- *
- * @version $Id: AdministrationServiceImpl.java
- */
-public class AdministrationServiceImpl
- implements AdministrationService
-{
- protected Logger log = LoggerFactory.getLogger( getClass() );
-
- private RepositoryContentConsumers repoConsumersUtil;
-
- private RepositoryContentFactory repoFactory;
-
- private RepositoryArchivaTaskScheduler repositoryTaskScheduler;
-
- private Collection<RepositoryListener> listeners;
-
- private RepositoryStatisticsManager repositoryStatisticsManager;
-
- private RepositoryMerger repositoryMerger;
-
- private static final String STAGE = "-stage";
-
- private AuditListener auditListener;
-
- private RepositorySessionFactory repositorySessionFactory;
-
- private ManagedRepositoryAdmin managedRepositoryAdmin;
-
- private RemoteRepositoryAdmin remoteRepositoryAdmin;
-
- private ArchivaAdministration archivaAdministration;
-
- private ProxyConnectorAdmin proxyConnectorAdmin;
-
- private RepositoryGroupAdmin repositoryGroupAdmin;
-
- private static final String REPOSITORY_ID_VALID_EXPRESSION = "^[a-zA-Z0-9._-]+$";
-
- private static final String REPOSITORY_NAME_VALID_EXPRESSION = "^([a-zA-Z0-9.)/_(-]|\\s)+$";
-
- private static final String REPOSITORY_LOCATION_VALID_EXPRESSION = "^[-a-zA-Z0-9._/~:?!&amp;=\\\\]+$";
-
- public AdministrationServiceImpl( ArchivaAdministration archivaAdministration,
- RepositoryContentConsumers repoConsumersUtil,
- RepositoryContentFactory repoFactory,
- RepositorySessionFactory repositorySessionFactory,
- RepositoryArchivaTaskScheduler repositoryTaskScheduler,
- Collection<RepositoryListener> listeners,
- RepositoryStatisticsManager repositoryStatisticsManager,
- RepositoryMerger repositoryMerger, AuditListener auditListener,
- ManagedRepositoryAdmin managedRepositoryAdmin,
- RemoteRepositoryAdmin remoteRepositoryAdmin,
- ProxyConnectorAdmin proxyConnectorAdmin,
- RepositoryGroupAdmin repositoryGroupAdmin )
- {
- this.repoConsumersUtil = repoConsumersUtil;
- this.repoFactory = repoFactory;
- this.repositoryTaskScheduler = repositoryTaskScheduler;
- this.listeners = listeners;
- this.repositorySessionFactory = repositorySessionFactory;
- this.repositoryStatisticsManager = repositoryStatisticsManager;
- this.repositoryMerger = repositoryMerger;
- this.auditListener = auditListener;
- this.managedRepositoryAdmin = managedRepositoryAdmin;
- this.remoteRepositoryAdmin = remoteRepositoryAdmin;
- this.archivaAdministration = archivaAdministration;
- this.proxyConnectorAdmin = proxyConnectorAdmin;
- this.repositoryGroupAdmin = repositoryGroupAdmin;
- }
-
- /**
- * @see AdministrationService#configureRepositoryConsumer(String, String, boolean)
- */
- public Boolean configureRepositoryConsumer( String repoId, String consumerId, boolean enable )
- throws Exception
- {
- // TODO use repoId once consumers are configured per repository! (MRM-930)
-
- List<KnownRepositoryContentConsumer> knownConsumers = repoConsumersUtil.getAvailableKnownConsumers();
- List<InvalidRepositoryContentConsumer> invalidConsumers = repoConsumersUtil.getAvailableInvalidConsumers();
-
- boolean found = false;
- boolean isKnownContentConsumer = false;
- for ( KnownRepositoryContentConsumer consumer : knownConsumers )
- {
- if ( consumer.getId().equals( consumerId ) )
- {
- found = true;
- isKnownContentConsumer = true;
- break;
- }
- }
-
- if ( !found )
- {
- for ( InvalidRepositoryContentConsumer consumer : invalidConsumers )
- {
- if ( consumer.getId().equals( consumerId ) )
- {
- found = true;
- break;
- }
- }
- }
-
- if ( !found )
- {
- throw new Exception( "Invalid repository consumer." );
- }
-
- if ( isKnownContentConsumer )
- {
- if ( enable )
- {
- archivaAdministration.addKnownContentConsumer( consumerId, getAuditInformation() );
- }
- else
- {
- archivaAdministration.removeKnownContentConsumer( consumerId, getAuditInformation() );
- }
-
- }
- else
- {
- if ( enable )
- {
- archivaAdministration.addInvalidContentConsumer( consumerId, getAuditInformation() );
- }
- else
- {
- archivaAdministration.removeInvalidContentConsumer( consumerId, getAuditInformation() );
- }
- }
-
- return true;
- }
-
- /**
- * @see AdministrationService#deleteArtifact(String, String, String, String)
- */
- public Boolean deleteArtifact( String repoId, String groupId, String artifactId, String version )
- throws Exception
- {
- // TODO: remove duplication with web
-
- org.apache.archiva.admin.model.beans.ManagedRepository repoConfig =
- managedRepositoryAdmin.getManagedRepository( repoId );
-
- if ( repoConfig == null )
- {
- throw new Exception( "Repository does not exist." );
- }
-
- RepositorySession repositorySession = repositorySessionFactory.createSession();
- try
- {
- ManagedRepositoryContent repoContent = repoFactory.getManagedRepositoryContent( repoId );
- VersionedReference ref = new VersionedReference();
- ref.setGroupId( groupId );
- ref.setArtifactId( artifactId );
- ref.setVersion( version );
-
- // delete from file system
- repoContent.deleteVersion( ref );
-
- MetadataRepository metadataRepository = repositorySession.getRepository();
- Collection<ArtifactMetadata> artifacts =
- metadataRepository.getArtifacts( repoId, groupId, artifactId, version );
-
- for ( ArtifactMetadata artifact : artifacts )
- {
- // TODO: mismatch between artifact (snapshot) version and project (base) version here
- if ( artifact.getVersion().equals( version ) )
- {
- metadataRepository.removeArtifact( artifact.getRepositoryId(), artifact.getNamespace(),
- artifact.getProject(), artifact.getVersion(), artifact.getId() );
-
- // TODO: move into the metadata repository proper - need to differentiate attachment of
- // repository metadata to an artifact
- for ( RepositoryListener listener : listeners )
- {
- listener.deleteArtifact( metadataRepository, repoId, artifact.getNamespace(),
- artifact.getProject(), artifact.getVersion(), artifact.getId() );
- }
- }
- }
- repositorySession.save();
- }
- catch ( ContentNotFoundException e )
- {
- throw new Exception( "Artifact does not exist." );
- }
- catch ( RepositoryNotFoundException e )
- {
- throw new Exception( "Repository does not exist." );
- }
- catch ( RepositoryException e )
- {
- throw new Exception( "Repository exception occurred." );
- }
- finally
- {
- repositorySession.close();
- }
-
- return true;
- }
-
- /**
- * @see AdministrationService#executeRepositoryScanner(String)
- */
- public Boolean executeRepositoryScanner( String repoId )
- throws Exception
- {
- if ( managedRepositoryAdmin.getManagedRepository( repoId ) == null )
- {
- throw new Exception( "Repository does not exist." );
- }
-
- if ( repositoryTaskScheduler.isProcessingRepositoryTask( repoId ) )
- {
- return false;
- }
-
- RepositoryTask task = new RepositoryTask();
- task.setRepositoryId( repoId );
- repositoryTaskScheduler.queueTask( task );
-
- return true;
- }
-
- /**
- * @see AdministrationService#getAllRepositoryConsumers()
- */
- public List<String> getAllRepositoryConsumers()
- {
- List<String> consumers = new ArrayList<String>();
-
- List<KnownRepositoryContentConsumer> knownConsumers = repoConsumersUtil.getAvailableKnownConsumers();
- List<InvalidRepositoryContentConsumer> invalidConsumers = repoConsumersUtil.getAvailableInvalidConsumers();
-
- for ( KnownRepositoryContentConsumer consumer : knownConsumers )
- {
- consumers.add( consumer.getId() );
- }
-
- for ( InvalidRepositoryContentConsumer consumer : invalidConsumers )
- {
- consumers.add( consumer.getId() );
- }
-
- return consumers;
- }
-
- /**
- * @see AdministrationService#getAllManagedRepositories()
- */
- public List<ManagedRepository> getAllManagedRepositories()
- throws RepositoryAdminException
- {
- List<ManagedRepository> managedRepos = new ArrayList<ManagedRepository>();
-
- for ( org.apache.archiva.admin.model.beans.ManagedRepository repoConfig : managedRepositoryAdmin.getManagedRepositories() )
- {
- ManagedRepository repo =
- new ManagedRepository( repoConfig.getId(), repoConfig.getName(), repoConfig.getLocation(),
- repoConfig.getLayout(), repoConfig.isSnapshots(), repoConfig.isReleases() );
- managedRepos.add( repo );
- }
-
- return managedRepos;
- }
-
- /**
- * @see AdministrationService#getAllRemoteRepositories()
- */
- public List<RemoteRepository> getAllRemoteRepositories()
- throws RepositoryAdminException
- {
- List<RemoteRepository> remoteRepos = new ArrayList<RemoteRepository>();
-
- for ( org.apache.archiva.admin.model.beans.RemoteRepository repoConfig : remoteRepositoryAdmin.getRemoteRepositories() )
- {
- RemoteRepository repo = new RemoteRepository( repoConfig.getId(), repoConfig.getName(), repoConfig.getUrl(),
- repoConfig.getLayout() );
- remoteRepos.add( repo );
- }
-
- return remoteRepos;
- }
-
- public Boolean addManagedRepository( String repoId, String layout, String name, String location,
- boolean blockRedeployments, boolean releasesIncluded,
- boolean snapshotsIncluded, boolean stageRepoNeeded, String cronExpression,
- int daysOlder, int retentionCount, boolean deleteReleasedSnapshots )
- throws Exception
- {
-
- org.apache.archiva.admin.model.beans.ManagedRepository repository =
- new org.apache.archiva.admin.model.beans.ManagedRepository( repoId, name, location, layout,
- snapshotsIncluded, releasesIncluded,
- blockRedeployments, cronExpression, null, false,
- daysOlder, retentionCount,
- deleteReleasedSnapshots, false );
- return managedRepositoryAdmin.addManagedRepository( repository, stageRepoNeeded, getAuditInformation() );
-
- }
-
- public Boolean deleteManagedRepository( String repoId )
- throws Exception
- {
-
- org.apache.archiva.admin.model.beans.ManagedRepository repository =
- managedRepositoryAdmin.getManagedRepository( repoId );
-
- if ( repository == null )
- {
- throw new Exception( "A repository with that id does not exist" );
- }
-
- RepositorySession repositorySession = repositorySessionFactory.createSession();
- try
- {
- MetadataRepository metadataRepository = repositorySession.getRepository();
- metadataRepository.removeRepository( repository.getId() );
- repositoryStatisticsManager.deleteStatistics( metadataRepository, repository.getId() );
- repositorySession.save();
- }
- finally
- {
- repositorySession.close();
- }
- managedRepositoryAdmin.deleteManagedRepository( repoId, getAuditInformation(), false );
-
- File dir = new File( repository.getLocation() );
- if ( !FileUtils.deleteQuietly( dir ) )
- {
- throw new IOException( "Cannot delete repository " + dir );
- }
-
- List<ProxyConnector> proxyConnectors = proxyConnectorAdmin.getProxyConnectors();
- for ( ProxyConnector proxyConnector : proxyConnectors )
- {
- if ( StringUtils.equals( proxyConnector.getSourceRepoId(), repository.getId() ) )
- {
- proxyConnectorAdmin.deleteProxyConnector( proxyConnector, getAuditInformation() );
- }
- }
-
- Map<String, List<String>> repoToGroupMap = repositoryGroupAdmin.getRepositoryToGroupMap();
- if ( repoToGroupMap != null )
- {
- if ( repoToGroupMap.containsKey( repository.getId() ) )
- {
- List<String> repoGroups = repoToGroupMap.get( repository.getId() );
- for ( String repoGroup : repoGroups )
- {
- repositoryGroupAdmin.deleteRepositoryFromGroup( repoGroup, repository.getId(),
- getAuditInformation() );
- }
- }
- }
-
- return Boolean.TRUE;
- }
-
- public Boolean deleteManagedRepositoryContent( String repoId )
- throws Exception
- {
-
- org.apache.archiva.admin.model.beans.ManagedRepository repository =
- managedRepositoryAdmin.getManagedRepository( repoId );
-
- if ( repository == null )
- {
- throw new Exception( "Repository Id : " + repoId + " not found." );
- }
-
- RepositorySession repositorySession = repositorySessionFactory.createSession();
- try
- {
- MetadataRepository metadataRepository = repositorySession.getRepository();
- metadataRepository.removeRepository( repository.getId() );
- repositorySession.save();
- }
- finally
- {
- repositorySession.close();
- }
-
- File repoDir = new File( repository.getLocation() );
- File[] children = repoDir.listFiles();
-
- if ( children != null )
- {
- for ( File child : children )
- {
- FileUtils.deleteQuietly( child );
- }
-
- if ( repoDir.listFiles().length > 0 )
- {
- throw new IOException( "Cannot delete repository contents of " + repoDir );
- }
- }
-
- return Boolean.TRUE;
- }
-
- public ManagedRepository getManagedRepository( String repoId )
- throws Exception
- {
- org.apache.archiva.admin.model.beans.ManagedRepository managedRepository =
- managedRepositoryAdmin.getManagedRepository( repoId );
- if ( managedRepository == null )
- {
- throw new Exception( "A repository with that id does not exist" );
- }
- ManagedRepository repo = new ManagedRepository( managedRepository.getId(), managedRepository.getName(), "URL",
- managedRepository.getLayout(), managedRepository.isSnapshots(),
- managedRepository.isReleases() );
-
- return repo;
- }
-
- public boolean merge( String repoId, boolean skipConflicts )
- throws Exception
- {
- String stagingId = repoId + STAGE;
- org.apache.archiva.admin.model.beans.ManagedRepository repoConfig;
- org.apache.archiva.admin.model.beans.ManagedRepository stagingConfig;
-
- repoConfig = managedRepositoryAdmin.getManagedRepository( repoId );
-
- log.debug( "Retrieved repository configuration for repo '" + repoId + "'" );
-
- RepositorySession repositorySession = repositorySessionFactory.createSession();
- try
- {
- MetadataRepository metadataRepository = repositorySession.getRepository();
- if ( repoConfig != null )
- {
- stagingConfig = managedRepositoryAdmin.getManagedRepository( stagingId );
-
- if ( stagingConfig != null )
- {
- List<ArtifactMetadata> sourceArtifacts = metadataRepository.getArtifacts( stagingId );
-
- if ( repoConfig.isReleases() && !repoConfig.isSnapshots() )
- {
- log.info( "Repository to be merged contains releases only.." );
- if ( skipConflicts )
- {
- List<ArtifactMetadata> conflicts =
- repositoryMerger.getConflictingArtifacts( metadataRepository, repoId, stagingId );
-
- if ( log.isDebugEnabled() )
- {
- log.debug( "Artifacts in conflict.." );
- for ( ArtifactMetadata metadata : conflicts )
- {
- log.debug( metadata.getNamespace() + ":" + metadata.getProject() + ":"
- + metadata.getProjectVersion() );
- }
- }
-
- sourceArtifacts.removeAll( conflicts );
-
- log.debug( "Source artifacts size :: " + sourceArtifacts.size() );
- mergeWithOutSnapshots( sourceArtifacts, stagingId, repoId, metadataRepository );
- }
- else
- {
- log.debug( "Source artifacts size :: " + sourceArtifacts.size() );
- mergeWithOutSnapshots( sourceArtifacts, stagingId, repoId, metadataRepository );
- }
- }
- else
- {
- log.info( "Repository to be merged has snapshot artifacts.." );
- if ( skipConflicts )
- {
- List<ArtifactMetadata> conflicts =
- repositoryMerger.getConflictingArtifacts( metadataRepository, repoId, stagingId );
-
- if ( log.isDebugEnabled() )
- {
- log.debug( "Artifacts in conflict.." );
- for ( ArtifactMetadata metadata : conflicts )
- {
- log.debug( metadata.getNamespace() + ":" + metadata.getProject() + ":"
- + metadata.getProjectVersion() );
- }
- }
-
- sourceArtifacts.removeAll( conflicts );
-
- log.debug( "Source artifacts size :: " + sourceArtifacts.size() );
-
- Filter<ArtifactMetadata> artifactsWithOutConflicts =
- new IncludesFilter<ArtifactMetadata>( sourceArtifacts );
- repositoryMerger.merge( metadataRepository, stagingId, repoId, artifactsWithOutConflicts );
-
- log.info( "Staging repository '" + stagingId + "' merged successfully with managed repo '"
- + repoId + "'." );
- }
- else
- {
- repositoryMerger.merge( metadataRepository, stagingId, repoId );
-
- log.info( "Staging repository '" + stagingId + "' merged successfully with managed repo '"
- + repoId + "'." );
- }
- }
- }
- else
- {
- throw new Exception( "Staging Id : " + stagingId + " not found." );
- }
- }
- else
- {
- throw new Exception( "Repository Id : " + repoId + " not found." );
- }
-
- if ( !repositoryTaskScheduler.isProcessingRepositoryTask( repoId ) )
- {
- RepositoryTask task = new RepositoryTask();
- task.setRepositoryId( repoId );
-
- repositoryTaskScheduler.queueTask( task );
- }
-
- AuditEvent event = createAuditEvent( repoConfig );
-
- // add event for audit log reports
- metadataRepository.addMetadataFacet( event.getRepositoryId(), event );
-
- // log event in archiva audit log
- auditListener.auditEvent( createAuditEvent( repoConfig ) );
- repositorySession.save();
- }
- finally
- {
- repositorySession.close();
- }
-
- return true;
- }
-
- // todo: setting userid of audit event
- private AuditEvent createAuditEvent( org.apache.archiva.admin.model.beans.ManagedRepository repoConfig )
- {
-
- AuditEvent event = new AuditEvent();
- event.setAction( AuditEvent.MERGE_REPO_REMOTE );
- event.setRepositoryId( repoConfig.getId() );
- event.setResource( repoConfig.getLocation() );
- event.setTimestamp( new Date() );
-
- return event;
- }
-
- private void mergeWithOutSnapshots( List<ArtifactMetadata> sourceArtifacts, String sourceRepoId, String repoid,
- MetadataRepository metadataRepository )
- throws Exception
- {
- List<ArtifactMetadata> artifactsWithOutSnapshots = new ArrayList<ArtifactMetadata>();
- for ( ArtifactMetadata metadata : sourceArtifacts )
- {
-
- if ( metadata.getProjectVersion().contains( "SNAPSHOT" ) )
- {
- artifactsWithOutSnapshots.add( metadata );
- }
-
- }
- sourceArtifacts.removeAll( artifactsWithOutSnapshots );
-
- Filter<ArtifactMetadata> artifactListWithOutSnapShots = new IncludesFilter<ArtifactMetadata>( sourceArtifacts );
-
- repositoryMerger.merge( metadataRepository, sourceRepoId, repoid, artifactListWithOutSnapShots );
- }
-
-
- // FIXME find a way to get user id and adress
- private AuditInformation getAuditInformation()
- {
- return new AuditInformation( null, null );
- }
-}
diff --git a/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/main/java/org/apache/archiva/web/xmlrpc/services/PingServiceImpl.java b/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/main/java/org/apache/archiva/web/xmlrpc/services/PingServiceImpl.java
deleted file mode 100644
index e79ab3006..000000000
--- a/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/main/java/org/apache/archiva/web/xmlrpc/services/PingServiceImpl.java
+++ /dev/null
@@ -1,30 +0,0 @@
-package org.apache.archiva.web.xmlrpc.services;
-
-/*
- * 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.xmlrpc.api.PingService;
-
-public class PingServiceImpl implements PingService
-{
- public String ping()
- {
- return "pong";
- }
-}
diff --git a/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/main/java/org/apache/archiva/web/xmlrpc/services/SearchServiceImpl.java b/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/main/java/org/apache/archiva/web/xmlrpc/services/SearchServiceImpl.java
deleted file mode 100644
index 316fe6aac..000000000
--- a/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/main/java/org/apache/archiva/web/xmlrpc/services/SearchServiceImpl.java
+++ /dev/null
@@ -1,281 +0,0 @@
-package org.apache.archiva.web.xmlrpc.services;
-
-/*
- * 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.indexer.search.RepositorySearch;
-import org.apache.archiva.indexer.search.SearchResultHit;
-import org.apache.archiva.indexer.search.SearchResultLimits;
-import org.apache.archiva.indexer.search.SearchResults;
-import org.apache.archiva.metadata.model.ArtifactMetadata;
-import org.apache.archiva.metadata.model.FacetedMetadata;
-import org.apache.archiva.metadata.model.ProjectVersionMetadata;
-import org.apache.archiva.metadata.model.ProjectVersionReference;
-import org.apache.archiva.metadata.repository.MetadataRepository;
-import org.apache.archiva.metadata.repository.MetadataResolver;
-import org.apache.archiva.metadata.repository.RepositorySession;
-import org.apache.archiva.metadata.repository.RepositorySessionFactory;
-import org.apache.archiva.metadata.repository.storage.maven2.MavenArtifactFacet;
-import org.apache.archiva.metadata.repository.storage.maven2.MavenProjectFacet;
-import org.apache.archiva.web.xmlrpc.api.SearchService;
-import org.apache.archiva.web.xmlrpc.api.beans.Artifact;
-import org.apache.archiva.web.xmlrpc.api.beans.Dependency;
-import org.apache.archiva.web.xmlrpc.security.XmlRpcUserRepositories;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Date;
-import java.util.List;
-
-public class SearchServiceImpl
- implements SearchService
-{
- private RepositorySearch search;
-
- private XmlRpcUserRepositories xmlRpcUserRepositories;
-
- private RepositorySessionFactory repositorySessionFactory;
-
- public SearchServiceImpl( XmlRpcUserRepositories xmlRpcUserRepositories,
- RepositorySessionFactory repositorySessionFactory, RepositorySearch search )
- {
- this.xmlRpcUserRepositories = xmlRpcUserRepositories;
- this.search = search;
- this.repositorySessionFactory = repositorySessionFactory;
- }
-
- @SuppressWarnings( "unchecked" )
- public List<Artifact> quickSearch( String queryString )
- throws Exception
- {
- List<Artifact> artifacts = new ArrayList<Artifact>();
- List<String> observableRepos = xmlRpcUserRepositories.getObservableRepositories();
- SearchResultLimits limits = new SearchResultLimits( SearchResultLimits.ALL_PAGES );
- SearchResults results;
-
- results = search.search( "", observableRepos, queryString, limits, null );
-
- RepositorySession repositorySession = repositorySessionFactory.createSession();
- try
- {
- MetadataResolver metadataResolver = repositorySession.getResolver();
-
- for ( SearchResultHit resultHit : results.getHits() )
- {
- List<String> resultHitVersions = resultHit.getVersions();
- if ( resultHitVersions != null )
- {
- for ( String version : resultHitVersions )
- {
- Artifact artifact = null;
- for ( String repoId : observableRepos )
- {
- // slight behaviour change to previous implementation: instead of allocating "jar" when not
- // found in the database, we can rely on the metadata repository to create it on the fly. We
- // just allocate the default packaging if the Maven facet is not found.
- FacetedMetadata model = metadataResolver.resolveProjectVersion( repositorySession, repoId,
- resultHit.getGroupId(),
- resultHit.getArtifactId(),
- version );
-
- if ( model != null )
- {
- String packaging = "jar";
-
- MavenProjectFacet facet = (MavenProjectFacet) model.getFacet(
- MavenProjectFacet.FACET_ID );
- if ( facet != null && facet.getPackaging() != null )
- {
- packaging = facet.getPackaging();
- }
- artifact = new Artifact( repoId, resultHit.getGroupId(), resultHit.getArtifactId(),
- version, packaging );
- break;
- }
- }
-
- if ( artifact != null )
- {
- artifacts.add( artifact );
- }
- }
- }
- }
- }
- finally
- {
- repositorySession.close();
- }
-
- return artifacts;
- }
-
- public List<Artifact> getArtifactByChecksum( String checksum )
- throws Exception
- {
- List<String> observableRepos = xmlRpcUserRepositories.getObservableRepositories();
-
- RepositorySession repositorySession = repositorySessionFactory.createSession();
-
- List<Artifact> results = new ArrayList<Artifact>();
- try
- {
- MetadataRepository metadataRepository = repositorySession.getRepository();
-
- for ( String repoId : observableRepos )
- {
- for ( ArtifactMetadata artifact : metadataRepository.getArtifactsByChecksum( repoId, checksum ) )
- {
- // TODO: customise XMLRPC to handle non-Maven artifacts
- MavenArtifactFacet facet = (MavenArtifactFacet) artifact.getFacet( MavenArtifactFacet.FACET_ID );
-
- results.add( new Artifact( artifact.getRepositoryId(), artifact.getNamespace(),
- artifact.getProject(), artifact.getVersion(),
- facet != null ? facet.getType() : null ) );
- }
- }
- }
- finally
- {
- repositorySession.close();
- }
- return results;
- }
-
- public List<Artifact> getArtifactVersions( String groupId, String artifactId )
- throws Exception
- {
- List<Artifact> artifacts = new ArrayList<Artifact>();
- List<String> observableRepos = xmlRpcUserRepositories.getObservableRepositories();
-
- RepositorySession repositorySession = repositorySessionFactory.createSession();
- try
- {
- MetadataResolver metadataResolver = repositorySession.getResolver();
-
- for ( String repoId : observableRepos )
- {
- Collection<String> results = metadataResolver.resolveProjectVersions( repositorySession, repoId,
- groupId, artifactId );
-
- for ( final String version : results )
- {
- final Artifact artifact = new Artifact( repoId, groupId, artifactId, version, "pom" );
-
- artifacts.add( artifact );
- }
- }
- }
- finally
- {
- repositorySession.close();
- }
-
- return artifacts;
- }
-
- public List<Artifact> getArtifactVersionsByDate( String groupId, String artifactId, String version, Date since )
- throws Exception
- {
-// List<Artifact> artifacts = new ArrayList<Artifact>();
-
- // 1. get observable repositories
- // 2. use RepositoryBrowsing method to query uniqueVersions? (but with date)
-
- throw new UnsupportedOperationException( "getArtifactVersionsByDate not yet implemented" );
-
-// return artifacts;
- }
-
- public List<Dependency> getDependencies( String groupId, String artifactId, String version )
- throws Exception
- {
- List<String> observableRepos = xmlRpcUserRepositories.getObservableRepositories();
-
- RepositorySession repositorySession = repositorySessionFactory.createSession();
- try
- {
- MetadataResolver metadataResolver = repositorySession.getResolver();
-
- for ( String repoId : observableRepos )
- {
- ProjectVersionMetadata model = metadataResolver.resolveProjectVersion( repositorySession, repoId,
- groupId, artifactId, version );
- if ( model != null )
- {
- List<Dependency> dependencies = new ArrayList<Dependency>();
- List<org.apache.archiva.metadata.model.Dependency> modelDeps = model.getDependencies();
- for ( org.apache.archiva.metadata.model.Dependency dep : modelDeps )
- {
- Dependency dependency = new Dependency( dep.getGroupId(), dep.getArtifactId(), dep.getVersion(),
- dep.getClassifier(), dep.getType(), dep.getScope() );
- dependencies.add( dependency );
- }
- return dependencies;
- }
- }
- }
- finally
- {
- repositorySession.close();
- }
- throw new Exception( "Artifact does not exist." );
- }
-
- public List<Artifact> getDependencyTree( String groupId, String artifactId, String version )
- throws Exception
- {
-// List<Artifact> a = new ArrayList<Artifact>();
-
- throw new UnsupportedOperationException( "getDependencyTree not yet implemented" );
-// return a;
- }
-
- public List<Artifact> getDependees( String groupId, String artifactId, String version )
- throws Exception
- {
- List<Artifact> artifacts = new ArrayList<Artifact>();
- List<String> observableRepos = xmlRpcUserRepositories.getObservableRepositories();
-
- RepositorySession repositorySession = repositorySessionFactory.createSession();
- try
- {
- MetadataResolver metadataResolver = repositorySession.getResolver();
-
- for ( String repoId : observableRepos )
- {
- Collection<ProjectVersionReference> refs = metadataResolver.resolveProjectReferences( repositorySession,
- repoId, groupId,
- artifactId,
- version );
- for ( ProjectVersionReference ref : refs )
- {
- artifacts.add( new Artifact( repoId, ref.getNamespace(), ref.getProjectId(),
- ref.getProjectVersion(), "" ) );
- }
- }
- }
- finally
- {
- repositorySession.close();
- }
-
- return artifacts;
- }
-}
diff --git a/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/test/java/org/apache/archiva/web/xmlrpc/services/AdministrationServiceImplTest.java b/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/test/java/org/apache/archiva/web/xmlrpc/services/AdministrationServiceImplTest.java
deleted file mode 100644
index 47fb3b0f0..000000000
--- a/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/test/java/org/apache/archiva/web/xmlrpc/services/AdministrationServiceImplTest.java
+++ /dev/null
@@ -1,1450 +0,0 @@
-package org.apache.archiva.web.xmlrpc.services;
-
-/*
- * 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 junit.framework.TestCase;
-import net.sf.beanlib.provider.replicator.BeanReplicator;
-import org.apache.archiva.admin.repository.RepositoryCommonValidator;
-import org.apache.archiva.admin.repository.admin.DefaultArchivaAdministration;
-import org.apache.archiva.admin.repository.group.DefaultRepositoryGroupAdmin;
-import org.apache.archiva.admin.repository.managed.DefaultManagedRepositoryAdmin;
-import org.apache.archiva.admin.repository.proxyconnector.DefaultProxyConnectorAdmin;
-import org.apache.archiva.admin.repository.remote.DefaultRemoteRepositoryAdmin;
-import org.apache.archiva.audit.AuditEvent;
-import org.apache.archiva.audit.AuditListener;
-import org.apache.archiva.common.plexusbridge.MavenIndexerUtils;
-import org.apache.archiva.common.plexusbridge.PlexusSisuBridge;
-import org.apache.archiva.configuration.ArchivaConfiguration;
-import org.apache.archiva.configuration.Configuration;
-import org.apache.archiva.configuration.FileTypes;
-import org.apache.archiva.configuration.ManagedRepositoryConfiguration;
-import org.apache.archiva.configuration.RemoteRepositoryConfiguration;
-import org.apache.archiva.configuration.RepositoryGroupConfiguration;
-import org.apache.archiva.configuration.RepositoryScanningConfiguration;
-import org.apache.archiva.consumers.InvalidRepositoryContentConsumer;
-import org.apache.archiva.consumers.KnownRepositoryContentConsumer;
-import org.apache.archiva.metadata.model.ArtifactMetadata;
-import org.apache.archiva.metadata.repository.MetadataRepository;
-import org.apache.archiva.metadata.repository.RepositorySession;
-import org.apache.archiva.metadata.repository.RepositorySessionFactory;
-import org.apache.archiva.metadata.repository.filter.Filter;
-import org.apache.archiva.metadata.repository.filter.IncludesFilter;
-import org.apache.archiva.metadata.repository.stats.RepositoryStatisticsManager;
-import org.apache.archiva.model.ArtifactReference;
-import org.apache.archiva.repository.RepositoryContentFactory;
-import org.apache.archiva.repository.content.ManagedDefaultRepositoryContent;
-import org.apache.archiva.repository.content.ManagedLegacyRepositoryContent;
-import org.apache.archiva.repository.content.PathParser;
-import org.apache.archiva.repository.events.RepositoryListener;
-import org.apache.archiva.repository.layout.LayoutException;
-import org.apache.archiva.repository.scanner.RepositoryContentConsumers;
-import org.apache.archiva.scheduler.repository.RepositoryArchivaTaskScheduler;
-import org.apache.archiva.scheduler.repository.RepositoryTask;
-import org.apache.archiva.security.common.ArchivaRoleConstants;
-import org.apache.archiva.stagerepository.merge.RepositoryMerger;
-import org.apache.archiva.web.xmlrpc.api.beans.ManagedRepository;
-import org.apache.archiva.web.xmlrpc.api.beans.RemoteRepository;
-import org.apache.commons.io.FileUtils;
-import org.apache.commons.io.filefilter.FileFilterUtils;
-import org.codehaus.plexus.redback.role.RoleManager;
-import org.codehaus.plexus.registry.Registry;
-import org.easymock.MockControl;
-import org.easymock.classextension.MockClassControl;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-
-import javax.inject.Inject;
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
-/**
- * AdministrationServiceImplTest
- *
- * @version $Id: AdministrationServiceImplTest.java
- */
-@RunWith( SpringJUnit4ClassRunner.class )
-@ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml", "classpath*:/spring-context.xml" } )
-public class AdministrationServiceImplTest
- extends TestCase
-{
- private MockControl archivaConfigControl;
-
- private ArchivaConfiguration archivaConfig;
-
- private MockControl configControl;
-
- private Configuration config;
-
- private AdministrationServiceImpl service;
-
- private MockControl repositoryTaskSchedulerControl;
-
- private RepositoryArchivaTaskScheduler repositoryTaskScheduler;
-
- // repository consumers
- private MockControl repoConsumerUtilsControl;
-
- private RepositoryContentConsumers repoConsumersUtil;
-
- private MockControl knownContentConsumerControl;
-
- private MockControl invalidContentConsumerControl;
-
- private KnownRepositoryContentConsumer indexArtifactConsumer;
-
- private KnownRepositoryContentConsumer indexPomConsumer;
-
- private InvalidRepositoryContentConsumer checkPomConsumer;
-
- private InvalidRepositoryContentConsumer checkMetadataConsumer;
-
- // delete artifact
- private MockControl repoFactoryControl;
-
- private RepositoryContentFactory repositoryFactory;
-
- private MockControl listenerControl;
-
- private RepositoryListener listener;
-
- private MockControl metadataRepositoryControl;
-
- private MetadataRepository metadataRepository;
-
- private MockControl repositoryStatisticsManagerControl;
-
- private RepositoryStatisticsManager repositoryStatisticsManager;
-
- private MockControl repositoryMergerControl;
-
- private RepositoryMerger repositoryMerger;
-
- private MockControl auditListenerControl;
-
- private AuditListener auditListener;
-
- private MockControl roleManagerControl;
-
- private RoleManager roleManager;
-
- private MockControl registryControl;
-
- private Registry registry;
-
- private static final String STAGE = "-stage";
-
- private DefaultManagedRepositoryAdmin managedRepositoryAdmin;
-
- private DefaultRemoteRepositoryAdmin remoteRepositoryAdmin;
-
- private DefaultArchivaAdministration archivaAdministration;
-
- private DefaultProxyConnectorAdmin proxyConnectorAdmin;
-
- private DefaultRepositoryGroupAdmin repositoryGroupAdmin;
-
- @Inject
- PlexusSisuBridge plexusSisuBridge;
-
- @Inject
- MavenIndexerUtils mavenIndexerUtils;
-
- @Before
- public void setUp()
- throws Exception
- {
- super.setUp();
-
- archivaConfigControl = MockControl.createControl( ArchivaConfiguration.class );
- archivaConfig = (ArchivaConfiguration) archivaConfigControl.getMock();
-
- configControl = MockClassControl.createControl( Configuration.class );
- config = (Configuration) configControl.getMock();
-
-
-
- repositoryTaskSchedulerControl = MockClassControl.createControl( RepositoryArchivaTaskScheduler.class );
- repositoryTaskScheduler = (RepositoryArchivaTaskScheduler) repositoryTaskSchedulerControl.getMock();
-
- // repo consumers
- repoConsumerUtilsControl = MockClassControl.createControl( RepositoryContentConsumers.class );
- repoConsumersUtil = (RepositoryContentConsumers) repoConsumerUtilsControl.getMock();
-
- knownContentConsumerControl = MockControl.createControl( KnownRepositoryContentConsumer.class );
- indexArtifactConsumer = (KnownRepositoryContentConsumer) knownContentConsumerControl.getMock();
- indexPomConsumer = (KnownRepositoryContentConsumer) knownContentConsumerControl.getMock();
-
- invalidContentConsumerControl = MockControl.createControl( InvalidRepositoryContentConsumer.class );
- checkPomConsumer = (InvalidRepositoryContentConsumer) invalidContentConsumerControl.getMock();
- checkMetadataConsumer = (InvalidRepositoryContentConsumer) invalidContentConsumerControl.getMock();
-
- // delete artifact
- repoFactoryControl = MockClassControl.createControl( RepositoryContentFactory.class );
- repositoryFactory = (RepositoryContentFactory) repoFactoryControl.getMock();
-
- metadataRepositoryControl = MockControl.createControl( MetadataRepository.class );
- metadataRepository = (MetadataRepository) metadataRepositoryControl.getMock();
-
- RepositorySession repositorySession = mock( RepositorySession.class );
- when( repositorySession.getRepository() ).thenReturn( metadataRepository );
-
- RepositorySessionFactory repositorySessionFactory = mock( RepositorySessionFactory.class );
- when( repositorySessionFactory.createSession() ).thenReturn( repositorySession );
-
- listenerControl = MockControl.createControl( RepositoryListener.class );
- listener = (RepositoryListener) listenerControl.getMock();
-
- roleManagerControl = MockControl.createControl( RoleManager.class );
- roleManager = (RoleManager) roleManagerControl.getMock();
-
- repositoryStatisticsManagerControl = MockControl.createControl( RepositoryStatisticsManager.class );
- repositoryStatisticsManager = (RepositoryStatisticsManager) repositoryStatisticsManagerControl.getMock();
-
- repositoryMergerControl = MockControl.createControl( RepositoryMerger.class );
- repositoryMerger = (RepositoryMerger) repositoryMergerControl.getMock();
-
- auditListenerControl = MockControl.createControl( AuditListener.class );
- auditListener = (AuditListener) auditListenerControl.getMock();
-
- registryControl = MockControl.createControl( Registry.class );
- registry = (Registry) registryControl.getMock();
-
- managedRepositoryAdmin = new DefaultManagedRepositoryAdmin();
- managedRepositoryAdmin.setArchivaConfiguration( archivaConfig );
- managedRepositoryAdmin.setRegistry( registry );
- managedRepositoryAdmin.setRepositoryStatisticsManager( repositoryStatisticsManager );
- managedRepositoryAdmin.setRepositoryTaskScheduler( repositoryTaskScheduler );
- managedRepositoryAdmin.setRepositorySessionFactory( repositorySessionFactory );
- managedRepositoryAdmin.setAuditListeners( Arrays.asList( auditListener ) );
- managedRepositoryAdmin.setRoleManager( roleManager );
- managedRepositoryAdmin.setMavenIndexerUtils( mavenIndexerUtils );
- managedRepositoryAdmin.setPlexusSisuBridge( plexusSisuBridge );
- archivaConfigControl.reset();
- archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config, 1, 3 );
- configControl.expectAndReturn( config.getManagedRepositories(), new ArrayList( 0 ) );
- archivaConfigControl.replay();
- configControl.replay();
- managedRepositoryAdmin.initialize();
-
- RepositoryCommonValidator repositoryCommonValidator = new RepositoryCommonValidator();
- repositoryCommonValidator.setArchivaConfiguration( archivaConfig );
- repositoryCommonValidator.setRegistry( registry );
-
- managedRepositoryAdmin.setRepositoryCommonValidator( repositoryCommonValidator );
-
- remoteRepositoryAdmin = new DefaultRemoteRepositoryAdmin();
- remoteRepositoryAdmin.setArchivaConfiguration( archivaConfig );
- remoteRepositoryAdmin.setAuditListeners( Arrays.asList( auditListener ) );
-
- remoteRepositoryAdmin.setRepositoryCommonValidator( repositoryCommonValidator );
-
- archivaAdministration = new DefaultArchivaAdministration();
- archivaAdministration.setArchivaConfiguration( archivaConfig );
- archivaAdministration.setRegistry( registry );
-
- proxyConnectorAdmin = new DefaultProxyConnectorAdmin();
- proxyConnectorAdmin.setArchivaConfiguration( archivaConfig );
- proxyConnectorAdmin.setRegistry( registry );
-
- repositoryGroupAdmin = new DefaultRepositoryGroupAdmin();
- repositoryGroupAdmin.setArchivaConfiguration( archivaConfig );
- repositoryGroupAdmin.setRegistry( registry );
-
- service = new AdministrationServiceImpl( archivaAdministration, repoConsumersUtil, repositoryFactory,
- repositorySessionFactory, repositoryTaskScheduler,
- Collections.singletonList( listener ), repositoryStatisticsManager,
- repositoryMerger, auditListener, managedRepositoryAdmin,
- remoteRepositoryAdmin, proxyConnectorAdmin, repositoryGroupAdmin );
-
-
- }
-
- @After
- public void shutdown()
- throws Exception
- {
- //archivaConfigControl.reset();
- //archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config, 1 );
- //configControl.expectAndReturn( config.getManagedRepositories(), new ArrayList( 0 ), 1 );
- //managedRepositoryAdmin.shutdown();
- }
-
- /* Tests for repository consumers */
- @Test
- public void testGetAllRepoConsumers()
- throws Exception
- {
- recordRepoConsumers();
-
- repoConsumerUtilsControl.replay();
- knownContentConsumerControl.replay();
- invalidContentConsumerControl.replay();
-
- List<String> repoConsumers = service.getAllRepositoryConsumers();
-
- repoConsumerUtilsControl.verify();
- knownContentConsumerControl.verify();
- invalidContentConsumerControl.verify();
-
- assertNotNull( repoConsumers );
- assertEquals( 4, repoConsumers.size() );
- assertTrue( repoConsumers.contains( "index-artifact" ) );
- assertTrue( repoConsumers.contains( "index-pom" ) );
- assertTrue( repoConsumers.contains( "check-pom" ) );
- assertTrue( repoConsumers.contains( "check-metadata" ) );
- }
-
- @Test
- public void testConfigureValidRepositoryConsumer()
- throws Exception
- {
- RepositoryScanningConfiguration repoScanning = new RepositoryScanningConfiguration();
- repoScanning.addKnownContentConsumer( "index-artifact" );
- repoScanning.addKnownContentConsumer( "index-pom" );
- repoScanning.addInvalidContentConsumer( "check-pom" );
-
- // test enable "check-metadata" consumer
- recordRepoConsumers();
-
- archivaConfigControl.reset();
- archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config );
- configControl.reset();
- configControl.expectAndReturn( config.getRepositoryScanning(), repoScanning, 1, 5 );
-
- archivaConfig.save( config );
- archivaConfigControl.setVoidCallable();
-
- repoConsumerUtilsControl.replay();
- knownContentConsumerControl.replay();
- invalidContentConsumerControl.replay();
- archivaConfigControl.replay();
- configControl.replay();
-
- try
- {
- boolean success = service.configureRepositoryConsumer( null, "check-metadata", true );
- assertTrue( success );
- }
- catch ( Exception e )
- {
- fail( "An exception should not have been thrown." );
- }
-
- repoConsumerUtilsControl.verify();
- knownContentConsumerControl.verify();
- invalidContentConsumerControl.verify();
- archivaConfigControl.verify();
- configControl.verify();
-
- // test disable "check-metadata" consumer
- repoConsumerUtilsControl.reset();
- knownContentConsumerControl.reset();
- invalidContentConsumerControl.reset();
- archivaConfigControl.reset();
- configControl.reset();
-
- repoScanning.addInvalidContentConsumer( "check-metadata" );
-
- recordRepoConsumers();
-
- archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config );
- configControl.expectAndReturn( config.getRepositoryScanning(), repoScanning, 1, 4 );
-
- archivaConfig.save( config );
- archivaConfigControl.setVoidCallable();
-
- repoConsumerUtilsControl.replay();
- knownContentConsumerControl.replay();
- invalidContentConsumerControl.replay();
- archivaConfigControl.replay();
- configControl.replay();
-
- try
- {
- boolean success = service.configureRepositoryConsumer( null, "check-metadata", false );
-
- repoConsumerUtilsControl.verify();
- knownContentConsumerControl.verify();
- invalidContentConsumerControl.verify();
- archivaConfigControl.verify();
- configControl.verify();
-
- assertTrue( success );
- }
- catch ( Exception e )
- {
- fail( "An excecption should not have been thrown." );
- }
- }
-
- @Test
- public void testConfigureInvalidRepositoryConsumer()
- throws Exception
- {
- recordRepoConsumers();
-
- repoConsumerUtilsControl.replay();
- knownContentConsumerControl.replay();
- invalidContentConsumerControl.replay();
-
- try
- {
- service.configureRepositoryConsumer( null, "invalid-consumer", true );
- fail( "An exception should have been thrown." );
- }
- catch ( Exception e )
- {
- assertEquals( "Invalid repository consumer.", e.getMessage() );
- }
-
- repoConsumerUtilsControl.verify();
- knownContentConsumerControl.verify();
- invalidContentConsumerControl.verify();
- }
-
- /* Tests for delete artifact */
- @Test
- public void testDeleteM2ArtifactArtifactExists()
- throws Exception
- {
- ManagedRepositoryConfiguration managedRepo = createManagedRepo( "default", "default-repo" );
-
- archivaConfigControl.reset();
- archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config );
- configControl.reset();
- configControl.expectAndReturn( config.getManagedRepositories(), Arrays.asList( managedRepo ), 1, 5 );
-
- ManagedDefaultRepositoryContent repoContent = new ManagedDefaultRepositoryContent();
- repoContent.setRepository( new BeanReplicator().replicateBean( managedRepo,
- org.apache.archiva.admin.model.beans.ManagedRepository.class ) );
-
- repoFactoryControl.expectAndReturn( repositoryFactory.getManagedRepositoryContent( "internal" ), repoContent );
-
- List<ArtifactMetadata> artifacts = getArtifacts();
- ArtifactMetadata artifact = artifacts.get( 0 );
-
- metadataRepositoryControl.expectAndReturn(
- metadataRepository.getArtifacts( repoContent.getId(), artifact.getNamespace(), artifact.getProject(),
- artifact.getVersion() ), artifacts );
- metadataRepository.removeArtifact( repoContent.getId(), artifact.getNamespace(), artifact.getProject(),
- artifact.getVersion(), artifact.getId() );
-
- listener.deleteArtifact( metadataRepository, repoContent.getId(), artifact.getNamespace(),
- artifact.getProject(), artifact.getVersion(), artifact.getId() );
- listenerControl.setVoidCallable( 1 );
-
- archivaConfigControl.replay();
- configControl.replay();
- repoFactoryControl.replay();
- metadataRepositoryControl.replay();
- listenerControl.replay();
-
- boolean success = service.deleteArtifact( "internal", "org.apache.archiva", "archiva-test", "1.0" );
- assertTrue( success );
-
- archivaConfigControl.verify();
- configControl.verify();
- repoFactoryControl.verify();
- metadataRepositoryControl.verify();
- listenerControl.verify();
-
- assertFalse( new File( managedRepo.getLocation(), "org/apache/archiva/archiva-test/1.0" ).exists() );
- assertTrue( new File( managedRepo.getLocation(), "org/apache/archiva/archiva-test/1.1" ).exists() );
- }
-
- @Test
- public void testDeleteM1ArtifactArtifactExists()
- throws Exception
- {
- MockControl fileTypesControl = MockClassControl.createControl( FileTypes.class );
- FileTypes fileTypes = (FileTypes) fileTypesControl.getMock();
-
- MockControl pathParserControl = MockClassControl.createControl( PathParser.class );
- PathParser parser = (PathParser) pathParserControl.getMock();
-
- ManagedRepositoryConfiguration managedRepo = createManagedRepo( "legacy", "legacy-repo" );
- archivaConfigControl.reset();
- archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config );
- configControl.reset();
- configControl.expectAndReturn( config.getManagedRepositories(), Arrays.asList( managedRepo ), 1, 5 );
-
- ManagedLegacyRepositoryContent repoContent = new ManagedLegacyRepositoryContent();
- repoContent.setRepository( new BeanReplicator().replicateBean( managedRepo,
- org.apache.archiva.admin.model.beans.ManagedRepository.class ) );
- repoContent.setFileTypes( fileTypes );
- repoContent.setLegacyPathParser( parser );
-
- repoFactoryControl.expectAndReturn( repositoryFactory.getManagedRepositoryContent( "internal" ), repoContent );
-
- recordInManagedLegacyRepoContent( fileTypesControl, fileTypes, pathParserControl, parser );
-
- List<ArtifactMetadata> artifacts = getArtifacts();
- ArtifactMetadata artifact = artifacts.get( 0 );
-
- metadataRepositoryControl.expectAndReturn(
- metadataRepository.getArtifacts( repoContent.getId(), artifact.getNamespace(), artifact.getProject(),
- artifact.getVersion() ), artifacts );
- metadataRepository.removeArtifact( repoContent.getId(), artifact.getNamespace(), artifact.getProject(),
- artifact.getVersion(), artifact.getId() );
-
- listener.deleteArtifact( metadataRepository, repoContent.getId(), artifact.getNamespace(),
- artifact.getProject(), artifact.getVersion(), artifact.getId() );
- listenerControl.setVoidCallable( 1 );
-
- archivaConfigControl.replay();
- configControl.replay();
- repoFactoryControl.replay();
- metadataRepositoryControl.replay();
- listenerControl.replay();
- fileTypesControl.replay();
- pathParserControl.replay();
-
- boolean success = service.deleteArtifact( "internal", "org.apache.archiva", "archiva-test", "1.0" );
- assertTrue( success );
-
- archivaConfigControl.verify();
- configControl.verify();
- repoFactoryControl.verify();
- metadataRepositoryControl.verify();
- listenerControl.verify();
- fileTypesControl.verify();
- pathParserControl.verify();
-
- File repo = new File( managedRepo.getLocation() );
- assertFalse( new File( repo, "org.apache.archiva/jars/archiva-test-1.0.jar" ).exists() );
- assertFalse( new File( repo, "org.apache.archiva/poms/archiva-test-1.0.pom" ).exists() );
-
- assertTrue( new File( repo, "org.apache.archiva/jars/archiva-test-1.1.jar" ).exists() );
- assertTrue( new File( repo, "org.apache.archiva/jars/archiva-diff-1.0.jar" ).exists() );
- assertTrue( new File( repo, "org.apache.archiva/poms/archiva-test-1.1.pom" ).exists() );
- assertTrue( new File( repo, "org.apache.archiva/poms/archiva-diff-1.0.pom" ).exists() );
- }
-
- @Test
- public void testDeleteArtifactArtifactDoesNotExist()
- throws Exception
- {
- ManagedRepositoryConfiguration managedRepo = createManagedRepo( "default", "default-repo" );
-
- archivaConfigControl.reset();
- archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config );
- configControl.reset();
- configControl.expectAndReturn( config.getManagedRepositories(), Arrays.asList( managedRepo ), 1, 5 );
-
- ManagedDefaultRepositoryContent repoContent = new ManagedDefaultRepositoryContent();
- repoContent.setRepository( new BeanReplicator().replicateBean( managedRepo,
- org.apache.archiva.admin.model.beans.ManagedRepository.class ) );
-
- repoFactoryControl.expectAndReturn( repositoryFactory.getManagedRepositoryContent( "internal" ), repoContent );
-
- archivaConfigControl.replay();
- configControl.replay();
- repoFactoryControl.replay();
-
- try
- {
- service.deleteArtifact( "internal", "org.apache.archiva", "archiva-non-existing", "1.0" );
- fail( "An exception should have been thrown." );
- }
- catch ( Exception e )
- {
- assertEquals( "Artifact does not exist.", e.getMessage() );
- }
-
- archivaConfigControl.verify();
- configControl.verify();
- repoFactoryControl.verify();
- }
-
- private ManagedRepositoryConfiguration createManagedRepo( String layout, String directory )
- throws IOException
- {
- File srcDir = new File( "src/test/repositories/" + directory );
-
- File repoDir = new File( "target/test-repos/" + directory );
-
- FileUtils.deleteDirectory( repoDir );
-
- FileUtils.copyDirectory( srcDir, repoDir, FileFilterUtils.makeSVNAware( null ) );
-
- ManagedRepositoryConfiguration managedRepo =
- createManagedRepo( "internal", layout, "Internal Repository", true, false );
- managedRepo.setLocation( repoDir.getAbsolutePath() );
- return managedRepo;
- }
-
- @Test
- public void testDeleteArtifacRepositoryDoesNotExist()
- throws Exception
- {
- archivaConfigControl.reset();
- archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config );
- configControl.reset();
- configControl.expectAndReturn( config.getManagedRepositories(), Collections.emptyList() );
-
- archivaConfigControl.replay();
- configControl.replay();
-
- try
- {
- service.deleteArtifact( "non-existing-repo", "org.apache.archiva", "archiva-test", "1.0" );
- fail( "An exception should have been thrown." );
- }
- catch ( Exception e )
- {
- assertEquals( "Repository does not exist.", e.getMessage() );
- }
-
- archivaConfigControl.verify();
- configControl.verify();
- }
-
- /* Tests for repository scanning */
- @Test
- public void testExecuteRepoScannerRepoExistsAndNotBeingScanned()
- throws Exception
- {
- archivaConfigControl.reset();
- archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config );
- configControl.reset();
- configControl.expectAndReturn( config.getManagedRepositories(), Arrays.asList(
- createManagedRepo( "internal", "default", "Internal Repository", true, false ) ), 1, 5 );
-
- RepositoryTask task = new RepositoryTask();
-
- repositoryTaskSchedulerControl.expectAndReturn(
- repositoryTaskScheduler.isProcessingRepositoryTask( "internal" ), false );
-
- repositoryTaskScheduler.queueTask( task );
- repositoryTaskSchedulerControl.setMatcher( MockControl.ALWAYS_MATCHER );
- repositoryTaskSchedulerControl.setVoidCallable();
-
- archivaConfigControl.replay();
- configControl.replay();
- repositoryTaskSchedulerControl.replay();
-
- try
- {
- boolean success = service.executeRepositoryScanner( "internal" );
- assertTrue( success );
- }
- catch ( Exception e )
- {
- fail( "An exception should not have been thrown." );
- }
-
- archivaConfigControl.verify();
- configControl.verify();
- repositoryTaskSchedulerControl.verify();
- }
-
- @Test
- public void testExecuteRepoScannerRepoExistsButBeingScanned()
- throws Exception
- {
- archivaConfigControl.reset();
- archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config );
-
- configControl.reset();
- configControl.expectAndReturn( config.getManagedRepositories(), Arrays.asList(
- createManagedRepo( "internal", "default", "Internal Repository", true, false ) ), 1, 5 );
-
- repositoryTaskSchedulerControl.expectAndReturn(
- repositoryTaskScheduler.isProcessingRepositoryTask( "internal" ), true );
-
- archivaConfigControl.replay();
- configControl.replay();
- repositoryTaskSchedulerControl.replay();
-
- try
- {
- boolean success = service.executeRepositoryScanner( "internal" );
- assertFalse( success );
- }
- catch ( Exception e )
- {
- fail( "An exception should not have been thrown." );
- }
-
- archivaConfigControl.verify();
- configControl.verify();
- repositoryTaskSchedulerControl.verify();
- }
-
- @Test
- public void testExecuteRepoScannerRepoDoesNotExist()
- throws Exception
- {
- archivaConfigControl.reset();
- archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config );
- configControl.reset();
- configControl.expectAndReturn( config.getManagedRepositories(), Collections.emptyList(), 1, 5 );
-
- archivaConfigControl.replay();
- configControl.replay();
-
- try
- {
- service.executeRepositoryScanner( "internal" );
- fail( "An exception should have been thrown." );
- }
- catch ( Exception e )
- {
- assertEquals( "Repository does not exist.", e.getMessage() );
- }
-
- archivaConfigControl.verify();
- configControl.verify();
- }
-
- /* Tests for querying repositories */
- @Test
- public void testGetAllManagedRepositories()
- throws Exception
- {
- List<ManagedRepositoryConfiguration> managedRepos = new ArrayList<ManagedRepositoryConfiguration>();
- managedRepos.add( createManagedRepo( "internal", "default", "Internal Repository", true, false ) );
- managedRepos.add( createManagedRepo( "snapshots", "default", "Snapshots Repository", false, true ) );
-
- archivaConfigControl.reset();
- archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config );
- configControl.reset();
- configControl.expectAndReturn( config.getManagedRepositories(), managedRepos );
-
- archivaConfigControl.replay();
- configControl.replay();
-
- List<ManagedRepository> repos = service.getAllManagedRepositories();
-
- archivaConfigControl.verify();
- configControl.verify();
-
- assertNotNull( repos );
- assertEquals( 2, repos.size() );
-
- assertManagedRepo( repos.get( 0 ), managedRepos.get( 0 ) );
- assertManagedRepo( repos.get( 1 ), managedRepos.get( 1 ) );
- }
-
- @Test
- public void testGetAllRemoteRepositories()
- throws Exception
- {
- List<RemoteRepositoryConfiguration> remoteRepos = new ArrayList<RemoteRepositoryConfiguration>();
- remoteRepos.add(
- createRemoteRepository( "central", "Central Repository", "default", "http://repo1.maven.org/maven2" ) );
- remoteRepos.add(
- createRemoteRepository( "dummy", "Dummy Remote Repository", "legacy", "http://dummy.com/dummy" ) );
-
- archivaConfigControl.reset();
- archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config );
- configControl.reset();
- configControl.expectAndReturn( config.getRemoteRepositories(), remoteRepos );
-
- archivaConfigControl.replay();
- configControl.replay();
-
- List<RemoteRepository> repos = service.getAllRemoteRepositories();
-
- archivaConfigControl.verify();
- configControl.verify();
-
- assertNotNull( repos );
- assertEquals( 2, repos.size() );
-
- assertRemoteRepo( repos.get( 0 ), remoteRepos.get( 0 ) );
- assertRemoteRepo( repos.get( 1 ), remoteRepos.get( 1 ) );
- }
-
- @Test
- public void testDeleteInvalidRepositoryContent()
- {
- archivaConfigControl.reset();
- archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config );
- configControl.reset();
- configControl.expectAndReturn( config.getManagedRepositories(), Collections.emptyList(), 1, 5 );
-
- archivaConfigControl.replay();
- configControl.replay();
-
- try
- {
- service.deleteManagedRepositoryContent( "invalid" );
- }
- catch ( Exception e )
- {
- assertEquals( "Repository Id : invalid not found.", e.getMessage() );
- }
-
- archivaConfigControl.verify();
- configControl.verify();
- }
-
- @Test
- public void testDeleteRepositoryContent()
- throws Exception
- {
- ManagedRepositoryConfiguration managedRepo = createManagedRepo( "default", "default-repo" );
- assertTrue( new File( managedRepo.getLocation(), "org" ).exists() );
-
- archivaConfigControl.reset();
- archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config, 1, 3 );
- configControl.reset();
- configControl.expectAndReturn( config.getManagedRepositories(), Arrays.asList( managedRepo ), 1, 5 );
- metadataRepository.removeRepository( "internal" );
-
- archivaConfigControl.replay();
- configControl.replay();
- metadataRepositoryControl.replay();
-
- boolean success = service.deleteManagedRepositoryContent( "internal" );
- assertTrue( success );
-
- archivaConfigControl.verify();
- configControl.verify();
- metadataRepositoryControl.verify();
-
- assertFalse( new File( managedRepo.getLocation(), "org" ).exists() );
- assertTrue( new File( managedRepo.getLocation() ).exists() );
- }
-
- /* Merge method */
- @Test
- public void testMergeRepositoryWithInvalidRepository()
- throws Exception
- {
- archivaConfigControl.reset();
- archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config );
- configControl.reset();
- configControl.expectAndReturn( config.getManagedRepositories(), Collections.emptyList(), 1, 2 );
-
- archivaConfigControl.replay();
- configControl.replay();
-
- try
- {
- service.merge( "invalid", true );
- }
- catch ( Exception e )
- {
- assertEquals( "Repository Id : invalid not found.", e.getMessage() );
- }
-
- archivaConfigControl.verify();
- configControl.verify();
- }
-
- @Test
- public void testMergeWithNoStagingRepository()
- throws Exception
- {
- archivaConfigControl.reset();
- archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config, 1, 5 );
-
- configControl.reset();
- configControl.expectAndReturn( config.getManagedRepositories(),
- Arrays.asList( createManagedRepo( "repo", "default", "repo", true, false ) ), 1,
- 4 );
-
- archivaConfigControl.replay();
- configControl.replay();
-
- try
- {
- service.merge( "repo", true );
- }
- catch ( Exception e )
- {
- assertEquals( "Staging Id : repo-stage not found.", e.getMessage() );
- }
-
- archivaConfigControl.verify();
- configControl.verify();
- }
-
- @Test
- public void testMergeRepositoriesAndScan()
- throws Exception
- {
- List<ArtifactMetadata> sources = new ArrayList<ArtifactMetadata>();
-
- ArtifactMetadata artifact = new ArtifactMetadata();
- artifact.setId( "artifact" );
- artifact.setFileLastModified( System.currentTimeMillis() );
-
- sources.add( artifact );
-
- ManagedRepositoryConfiguration merge = createManagedRepo( "merge", "default", "merge", true, true );
- merge.setLocation( "target/test-repository/merge" );
- ManagedRepositoryConfiguration staging = createStagingRepo( merge );
-
- RepositoryTask task = new RepositoryTask();
- task.setScanAll( true );
-
- archivaConfigControl.reset();
- archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config, 1, 5 );
- configControl.reset();
- configControl.expectAndReturn( config.getManagedRepositories(), Arrays.asList( merge, staging ), 1, 5 );
-
- metadataRepositoryControl.expectAndReturn( metadataRepository.getArtifacts( staging.getId() ), sources );
- repositoryMergerControl.expectAndDefaultReturn(
- repositoryMerger.getConflictingArtifacts( metadataRepository, staging.getId(), merge.getId() ), sources );
- repositoryMerger.merge( metadataRepository, staging.getId(), merge.getId() );
- repositoryMergerControl.setVoidCallable();
- repositoryTaskSchedulerControl.expectAndReturn( repositoryTaskScheduler.isProcessingRepositoryTask( "merge" ),
- false );
-
- // scanning after merge
- repositoryTaskScheduler.queueTask( task );
- repositoryTaskSchedulerControl.setMatcher( MockControl.ALWAYS_MATCHER );
- repositoryTaskSchedulerControl.setVoidCallable();
-
- // audit logs
- metadataRepository.addMetadataFacet( merge.getId(), createAuditEvent( merge ) );
- metadataRepositoryControl.setMatcher( MockControl.ALWAYS_MATCHER );
- metadataRepositoryControl.setVoidCallable();
-
- archivaConfigControl.replay();
- metadataRepositoryControl.replay();
- configControl.replay();
- repositoryMergerControl.replay();
- repositoryTaskSchedulerControl.replay();
-
- boolean a = service.merge( "merge", false );
- assertTrue( a );
-
- archivaConfigControl.verify();
- configControl.verify();
- configControl.verify();
- metadataRepositoryControl.verify();
- repositoryMergerControl.verify();
- repositoryTaskSchedulerControl.verify();
- }
-
- @Test
- public void testMergeRepositoriesWithConflictsAndScan()
- throws Exception
- {
- List<ArtifactMetadata> sources = new ArrayList<ArtifactMetadata>();
- ArtifactMetadata one = new ArtifactMetadata();
- one.setId( "one" );
- one.setVersion( "1.0" );
-
- ArtifactMetadata two = new ArtifactMetadata();
- two.setId( "two" );
- two.setVersion( "1.0-SNAPSHOT" );
-
- sources.add( one );
- sources.add( two );
-
- List<ArtifactMetadata> conflicts = new ArrayList<ArtifactMetadata>();
- conflicts.add( one );
-
- sources.removeAll( conflicts );
-
- Filter<ArtifactMetadata> artifactsWithOutConflicts = new IncludesFilter<ArtifactMetadata>( sources );
-
- RepositoryTask task = new RepositoryTask();
- task.setScanAll( true );
-
- ManagedRepositoryConfiguration repo = createManagedRepo( "repo", "default", "repo", true, true );
- repo.setLocation( "target/test-repository/one" );
- ManagedRepositoryConfiguration staging = createStagingRepo( repo );
-
- configControl.reset();
- configControl.expectAndReturn( config.getManagedRepositories(), Arrays.asList( repo, staging ), 1, 5 );
- archivaConfigControl.reset();
- archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config, 1, 5 );
-
- metadataRepositoryControl.expectAndReturn( metadataRepository.getArtifacts( staging.getId() ), sources );
- repositoryMergerControl.expectAndDefaultReturn(
- repositoryMerger.getConflictingArtifacts( metadataRepository, staging.getId(), repo.getId() ), conflicts );
- repositoryMerger.merge( metadataRepository, staging.getId(), repo.getId(), artifactsWithOutConflicts );
- repositoryMergerControl.setMatcher( MockControl.ALWAYS_MATCHER );
- repositoryMergerControl.setVoidCallable();
- repositoryTaskSchedulerControl.expectAndReturn( repositoryTaskScheduler.isProcessingRepositoryTask( "repo" ),
- false );
- repositoryTaskScheduler.queueTask( task );
- repositoryTaskSchedulerControl.setMatcher( MockControl.ALWAYS_MATCHER );
- repositoryTaskSchedulerControl.setVoidCallable();
-
- // audit logs
- metadataRepository.addMetadataFacet( repo.getId(), createAuditEvent( repo ) );
- metadataRepositoryControl.setMatcher( MockControl.ALWAYS_MATCHER );
- metadataRepositoryControl.setVoidCallable();
-
- archivaConfigControl.replay();
- metadataRepositoryControl.replay();
- configControl.replay();
- repositoryMergerControl.replay();
- repositoryTaskSchedulerControl.replay();
-
- boolean a = service.merge( "repo", true );
- assertTrue( a );
-
- archivaConfigControl.verify();
- configControl.verify();
- configControl.verify();
- metadataRepositoryControl.verify();
- repositoryMergerControl.verify();
- repositoryTaskSchedulerControl.verify();
- }
-
- @Test
- public void testAddManagedRepository()
- throws Exception
- {
- String projId = "org.apache.archiva";
- String repoId = projId + ".releases";
- String layout = "default";
- String name = projId + " Releases";
- String releaseLocation = "target/test-repository/" + projId + ".releases";
- String stageLocation = releaseLocation + "-stage";
- String appserverBase = "target";
-
- ManagedRepositoryConfiguration managedRepo = createManagedRepo( "repo1", "default", "repo", true, false );
- RemoteRepositoryConfiguration remoteRepo =
- createRemoteRepository( "central", "Central Repository", "default", "http://repo1.maven.org/maven2" );
- List<String> repositories = new ArrayList<String>();
- repositories.add( managedRepo.getName() );
- RepositoryGroupConfiguration repoGroup = createRepoGroupConfig( "repoGroup", repositories );
- Map<String, ManagedRepositoryConfiguration> managedRepoMap =
- new HashMap<String, ManagedRepositoryConfiguration>();
- Map<String, RemoteRepositoryConfiguration> remoteRepoMap = new HashMap<String, RemoteRepositoryConfiguration>();
- Map<String, RepositoryGroupConfiguration> repoGroupMap = new HashMap<String, RepositoryGroupConfiguration>();
- managedRepoMap.put( "repo1", managedRepo );
- remoteRepoMap.put( "repo1", remoteRepo );
- repoGroupMap.put( "repo1", repoGroup );
-
- archivaConfigControl.reset();
- archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config );
-
- configControl.reset();
- configControl.expectAndReturn( config.getManagedRepositoriesAsMap(), managedRepoMap );
- configControl.expectAndReturn( config.getRemoteRepositoriesAsMap(), remoteRepoMap );
- configControl.expectAndReturn( config.getRepositoryGroupsAsMap(), repoGroupMap );
-
- roleManager.templatedRoleExists( ArchivaRoleConstants.TEMPLATE_REPOSITORY_OBSERVER, repoId );
- roleManagerControl.setReturnValue( false );
- roleManager.createTemplatedRole( ArchivaRoleConstants.TEMPLATE_REPOSITORY_OBSERVER, repoId );
- roleManagerControl.setVoidCallable();
- roleManager.templatedRoleExists( ArchivaRoleConstants.TEMPLATE_REPOSITORY_MANAGER, repoId );
- roleManagerControl.setReturnValue( false );
- roleManager.createTemplatedRole( ArchivaRoleConstants.TEMPLATE_REPOSITORY_MANAGER, repoId );
- roleManagerControl.setVoidCallable();
-
- roleManager.templatedRoleExists( ArchivaRoleConstants.TEMPLATE_REPOSITORY_OBSERVER, repoId + "-stage" );
- roleManagerControl.setReturnValue( false );
- roleManager.createTemplatedRole( ArchivaRoleConstants.TEMPLATE_REPOSITORY_OBSERVER, repoId + "-stage" );
- roleManagerControl.setVoidCallable();
- roleManager.templatedRoleExists( ArchivaRoleConstants.TEMPLATE_REPOSITORY_MANAGER, repoId + "-stage" );
- roleManagerControl.setReturnValue( false );
- roleManager.createTemplatedRole( ArchivaRoleConstants.TEMPLATE_REPOSITORY_MANAGER, repoId + "-stage" );
- roleManagerControl.setVoidCallable();
-
- roleManagerControl.replay();
-
- registryControl.expectAndReturn( registry.getString( "appserver.base", "${appserver.base}" ), appserverBase );
- registryControl.expectAndReturn( registry.getString( "appserver.home", "${appserver.home}" ), appserverBase );
- config.addManagedRepository( managedRepo );
- configControl.setMatcher( MockControl.ALWAYS_MATCHER );
- configControl.setVoidCallable();
- config.addManagedRepository( managedRepo );
- configControl.setMatcher( MockControl.ALWAYS_MATCHER );
- configControl.setVoidCallable();
- archivaConfig.save( config );
- archivaConfigControl.setVoidCallable();
-
- //managed repo
- repositoryTaskSchedulerControl.expectAndReturn( repositoryTaskScheduler.isProcessingRepositoryTask( repoId ),
- false );
-
- RepositoryTask task = new RepositoryTask();
- task.setRepositoryId( repoId );
- archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config );
-
- configControl.expectAndReturn( config.findManagedRepositoryById( repoId ), managedRepo );
- repositoryTaskScheduler.queueTask( task );
- repositoryTaskSchedulerControl.setVoidCallable();
-
- //staged repo
- repositoryTaskSchedulerControl.expectAndReturn(
- repositoryTaskScheduler.isProcessingRepositoryTask( repoId + STAGE ), false );
- task = new RepositoryTask();
- task.setRepositoryId( repoId + STAGE );
- archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config );
-
- configControl.expectAndReturn( config.findManagedRepositoryById( repoId + STAGE ), managedRepo );
- repositoryTaskScheduler.queueTask( task );
- repositoryTaskSchedulerControl.setVoidCallable();
-
- archivaConfigControl.replay();
- configControl.replay();
- registryControl.replay();
- repositoryTaskSchedulerControl.replay();
- assertFalse( new File( releaseLocation ).isDirectory() );
- assertFalse( new File( stageLocation ).isDirectory() );
- boolean success = service.addManagedRepository( repoId, layout, name,
- appserverBase + "/test-repository/" + projId + ".releases",
- true, true, false, true, "0 15 3 * * ? *", 1, 1, true );
- assertTrue( success );
- assertTrue( new File( releaseLocation ).isDirectory() );
- assertTrue( new File( stageLocation ).isDirectory() );
- new File( releaseLocation ).delete();
- new File( stageLocation ).delete();
-
- registryControl.verify();
- }
-
- @Test
- public void testAddManagedRepositoryInvalidId()
- throws Exception
- {
- String projId = "org.apache.archiva";
- String repoId = projId + "<script>alert('xss')</script>";
- String layout = "default";
- String name = projId + " Releases";
-
- ManagedRepositoryConfiguration managedRepo = createManagedRepo( "repo1", "default", "repo", true, false );
- RemoteRepositoryConfiguration remoteRepo =
- createRemoteRepository( "central", "Central Repository", "default", "http://repo1.maven.org/maven2" );
- List<String> repositories = new ArrayList<String>();
- repositories.add( managedRepo.getName() );
- RepositoryGroupConfiguration repoGroup = createRepoGroupConfig( "repoGroup", repositories );
- Map<String, ManagedRepositoryConfiguration> managedRepoMap =
- new HashMap<String, ManagedRepositoryConfiguration>();
- Map<String, RemoteRepositoryConfiguration> remoteRepoMap = new HashMap<String, RemoteRepositoryConfiguration>();
- Map<String, RepositoryGroupConfiguration> repoGroupMap = new HashMap<String, RepositoryGroupConfiguration>();
- managedRepoMap.put( "repo1", managedRepo );
- remoteRepoMap.put( "repo1", remoteRepo );
- repoGroupMap.put( "repo1", repoGroup );
-
- archivaConfigControl.reset();
- archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config );
-
- configControl.reset();
- configControl.expectAndReturn( config.getManagedRepositoriesAsMap(), managedRepoMap );
- configControl.expectAndReturn( config.getRemoteRepositoriesAsMap(), remoteRepoMap );
- configControl.expectAndReturn( config.getRepositoryGroupsAsMap(), repoGroupMap );
-
- archivaConfigControl.replay();
- configControl.replay();
-
- try
- {
- service.addManagedRepository( repoId, layout, name,
- "target/test-repository/" + projId + ".releases", true, true,
- false, true, "0 15 3 * * ? *", 1, 1, true );
- fail( "An exception should have been thrown! Repository ID is not valid." );
- }
- catch ( Exception e )
- {
- assertEquals(
- "Invalid repository ID. Identifier must only contain alphanumeric characters, underscores(_), dots(.), and dashes(-).",
- e.getMessage() );
- }
- }
-
- @Test
- public void testAddManagedRepositoryInvalidName()
- throws Exception
- {
- String projId = "org.apache.archiva";
- String repoId = projId + ".releases";
- String layout = "default";
- String name = projId + " <script>alert('xss')</script>";
-
- ManagedRepositoryConfiguration managedRepo = createManagedRepo( "repo1", "default", "repo", true, false );
- RemoteRepositoryConfiguration remoteRepo =
- createRemoteRepository( "central", "Central Repository", "default", "http://repo1.maven.org/maven2" );
- List<String> repositories = new ArrayList<String>();
- repositories.add( managedRepo.getName() );
- RepositoryGroupConfiguration repoGroup = createRepoGroupConfig( "repoGroup", repositories );
- Map<String, ManagedRepositoryConfiguration> managedRepoMap =
- new HashMap<String, ManagedRepositoryConfiguration>();
- Map<String, RemoteRepositoryConfiguration> remoteRepoMap = new HashMap<String, RemoteRepositoryConfiguration>();
- Map<String, RepositoryGroupConfiguration> repoGroupMap = new HashMap<String, RepositoryGroupConfiguration>();
- managedRepoMap.put( "repo1", managedRepo );
- remoteRepoMap.put( "repo1", remoteRepo );
- repoGroupMap.put( "repo1", repoGroup );
-
- archivaConfigControl.reset();
- archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config );
-
- configControl.reset();
- configControl.expectAndReturn( config.getManagedRepositoriesAsMap(), managedRepoMap );
- configControl.expectAndReturn( config.getRemoteRepositoriesAsMap(), remoteRepoMap );
- configControl.expectAndReturn( config.getRepositoryGroupsAsMap(), repoGroupMap );
-
- archivaConfigControl.replay();
- configControl.replay();
-
- try
- {
- service.addManagedRepository( repoId, layout, name,
- "target/test-repository/" + projId + ".releases", true, true,
- false, true, "0 15 3 * * ? *", 1, 1, true );
- fail( "An exception should have been thrown! Repository name is not valid." );
- }
- catch ( Exception e )
- {
- assertEquals(
- "Invalid repository name. Repository Name must only contain alphanumeric characters, white-spaces(' '), "
- + "forward-slashes(/), open-parenthesis('('), close-parenthesis(')'), underscores(_), dots(.), and dashes(-).",
- e.getMessage() );
- }
- }
-
- @Test
- public void testAddManagedRepositoryInvalidLocation()
- throws Exception
- {
- String projId = "org.apache.archiva";
- String repoId = projId + ".releases";
- String layout = "default";
- String name = projId + " Releases";
- String appserverBase = "target";
-
- ManagedRepositoryConfiguration managedRepo = createManagedRepo( "repo1", "default", "repo", true, false );
- RemoteRepositoryConfiguration remoteRepo =
- createRemoteRepository( "central", "Central Repository", "default", "http://repo1.maven.org/maven2" );
- List<String> repositories = new ArrayList<String>();
- repositories.add( managedRepo.getName() );
- RepositoryGroupConfiguration repoGroup = createRepoGroupConfig( "repoGroup", repositories );
- Map<String, ManagedRepositoryConfiguration> managedRepoMap =
- new HashMap<String, ManagedRepositoryConfiguration>();
- Map<String, RemoteRepositoryConfiguration> remoteRepoMap = new HashMap<String, RemoteRepositoryConfiguration>();
- Map<String, RepositoryGroupConfiguration> repoGroupMap = new HashMap<String, RepositoryGroupConfiguration>();
- managedRepoMap.put( "repo1", managedRepo );
- remoteRepoMap.put( "repo1", remoteRepo );
- repoGroupMap.put( "repo1", repoGroup );
-
- archivaConfigControl.reset();
- archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config, 1, 3 );
-
- configControl.reset();
- configControl.expectAndReturn( config.getManagedRepositoriesAsMap(), managedRepoMap, 0, 3 );
- configControl.expectAndReturn( config.getRemoteRepositoriesAsMap(), remoteRepoMap, 1, 3 );
- configControl.expectAndReturn( config.getRepositoryGroupsAsMap(), repoGroupMap );
- registryControl.expectAndReturn( registry.getString( "appserver.base", "${appserver.base}" ), appserverBase );
- registryControl.expectAndReturn( registry.getString( "appserver.home", "${appserver.home}" ), appserverBase );
-
- archivaConfigControl.replay();
- configControl.replay();
- registryControl.replay();
-
- try
- {
- service.addManagedRepository( repoId, layout, name,
- "${appserver.base}/<script>alert('xss')</script>" + projId + ".releases",
- true, true, false, true, "0 15 3 * * ? *", 1, 1, true );
- fail( "An exception should have been thrown! Repository location is not valid." );
- }
- catch ( Exception e )
- {
- assertEquals( "message found " + e.getMessage(),
- "Invalid repository location. Directory must only contain alphanumeric characters, equals(=), question-marks(?), "
- + "exclamation-points(!), ampersands(&amp;), forward-slashes(/), back-slashes(\\), underscores(_), dots(.), colons(:), tildes(~), and dashes(-).",
- e.getMessage() );
- }
-
- registryControl.verify();
- }
-
- /* private methods */
-
- private void assertRemoteRepo( RemoteRepository remoteRepo, RemoteRepositoryConfiguration expectedRepoConfig )
- {
- assertEquals( expectedRepoConfig.getId(), remoteRepo.getId() );
- assertEquals( expectedRepoConfig.getLayout(), remoteRepo.getLayout() );
- assertEquals( expectedRepoConfig.getName(), remoteRepo.getName() );
- assertEquals( expectedRepoConfig.getUrl(), remoteRepo.getUrl() );
- }
-
- private RemoteRepositoryConfiguration createRemoteRepository( String id, String name, String layout, String url )
- {
- RemoteRepositoryConfiguration remoteConfig = new RemoteRepositoryConfiguration();
- remoteConfig.setId( id );
- remoteConfig.setName( name );
- remoteConfig.setLayout( layout );
- remoteConfig.setUrl( url );
-
- return remoteConfig;
- }
-
- private void assertManagedRepo( ManagedRepository managedRepo, ManagedRepositoryConfiguration expectedRepoConfig )
- {
- assertEquals( expectedRepoConfig.getId(), managedRepo.getId() );
- assertEquals( expectedRepoConfig.getLayout(), managedRepo.getLayout() );
- assertEquals( expectedRepoConfig.getName(), managedRepo.getName() );
-
- // TODO enable assert once fixed in AdministrationServiceImpl!
- // assertEquals( "http://localhost:8080/archiva/repository/" + expectedRepoConfig.getId(), managedRepo.getUrl()
- // );
- assertEquals( expectedRepoConfig.isReleases(), managedRepo.isReleases() );
- assertEquals( expectedRepoConfig.isSnapshots(), managedRepo.isSnapshots() );
- }
-
- private ManagedRepositoryConfiguration createManagedRepo( String id, String layout, String name,
- boolean hasReleases, boolean hasSnapshots )
- {
- ManagedRepositoryConfiguration repoConfig = new ManagedRepositoryConfiguration();
- repoConfig.setId( id );
- repoConfig.setLayout( layout );
- repoConfig.setName( name );
- repoConfig.setReleases( hasReleases );
- repoConfig.setSnapshots( hasSnapshots );
-
- return repoConfig;
- }
-
- private ManagedRepositoryConfiguration createStagingRepo( ManagedRepositoryConfiguration repoConfig )
- {
- ManagedRepositoryConfiguration stagingRepo = new ManagedRepositoryConfiguration();
- stagingRepo.setId( repoConfig.getId() + STAGE );
- stagingRepo.setLayout( repoConfig.getLayout() );
- stagingRepo.setName( repoConfig + STAGE );
- stagingRepo.setReleases( repoConfig.isReleases() );
- stagingRepo.setSnapshots( repoConfig.isSnapshots() );
- stagingRepo.setLocation( repoConfig.getLocation() );
-
- return stagingRepo;
- }
-
- private AuditEvent createAuditEvent( ManagedRepositoryConfiguration repoConfig )
- {
- AuditEvent auditEvent = new AuditEvent();
-
- auditEvent.setAction( AuditEvent.MERGE_REPO_REMOTE );
- auditEvent.setRepositoryId( repoConfig.getId() );
- auditEvent.setResource( repoConfig.getLocation() );
- auditEvent.setTimestamp( new Date() );
-
- return auditEvent;
- }
-
- private void recordRepoConsumers()
- {
- List<KnownRepositoryContentConsumer> availableKnownConsumers = new ArrayList<KnownRepositoryContentConsumer>();
- availableKnownConsumers.add( indexArtifactConsumer );
- availableKnownConsumers.add( indexPomConsumer );
-
- List<InvalidRepositoryContentConsumer> availableInvalidConsumers =
- new ArrayList<InvalidRepositoryContentConsumer>();
- availableInvalidConsumers.add( checkPomConsumer );
- availableInvalidConsumers.add( checkMetadataConsumer );
-
- repoConsumerUtilsControl.expectAndReturn( repoConsumersUtil.getAvailableKnownConsumers(),
- availableKnownConsumers );
- knownContentConsumerControl.expectAndReturn( indexArtifactConsumer.getId(), "index-artifact" );
- knownContentConsumerControl.expectAndReturn( indexPomConsumer.getId(), "index-pom" );
-
- repoConsumerUtilsControl.expectAndReturn( repoConsumersUtil.getAvailableInvalidConsumers(),
- availableInvalidConsumers );
- invalidContentConsumerControl.expectAndReturn( checkPomConsumer.getId(), "check-pom" );
- invalidContentConsumerControl.expectAndReturn( checkMetadataConsumer.getId(), "check-metadata" );
- }
-
- private void recordInManagedLegacyRepoContent( MockControl fileTypesControl, FileTypes fileTypes,
- MockControl pathParserControl, PathParser parser )
- throws LayoutException
- {
- String sep = File.separator;
- String ad10p = "org.apache.archiva" + sep + "poms" + sep + "archiva-diff-1.0.pom";
- String at10p = "org.apache.archiva" + sep + "poms" + sep + "archiva-test-1.0.pom";
- String at11p = "org.apache.archiva" + sep + "poms" + sep + "archiva-test-1.1.pom";
- String ad10j = "org.apache.archiva" + sep + "jars" + sep + "archiva-diff-1.0.jar";
- String at10j = "org.apache.archiva" + sep + "jars" + sep + "archiva-test-1.0.jar";
- String at11j = "org.apache.archiva" + sep + "jars" + sep + "archiva-test-1.1.jar";
-
- fileTypesControl.expectAndReturn( fileTypes.matchesArtifactPattern( at10p ), true );
- fileTypesControl.expectAndReturn( fileTypes.matchesArtifactPattern( at11p ), true );
- fileTypesControl.expectAndReturn( fileTypes.matchesArtifactPattern( ad10p ), true );
- fileTypesControl.expectAndReturn( fileTypes.matchesArtifactPattern( ad10j ), true );
- fileTypesControl.expectAndReturn( fileTypes.matchesArtifactPattern( at10j ), true );
- fileTypesControl.expectAndReturn( fileTypes.matchesArtifactPattern( at11j ), true );
-
- ArtifactReference aRef = createArtifactReference( "archiva-test", "org.apache.archiva", "1.1", "pom" );
- pathParserControl.expectAndReturn( parser.toArtifactReference( at11p ), aRef );
-
- aRef = createArtifactReference( "archiva-test", "org.apache.archiva", "1.0", "pom" );
- pathParserControl.expectAndReturn( parser.toArtifactReference( at10p ), aRef );
-
- aRef = createArtifactReference( "archiva-diff", "org.apache.archiva", "1.0", "pom" );
- pathParserControl.expectAndReturn( parser.toArtifactReference( ad10p ), aRef );
-
- aRef = createArtifactReference( "archiva-diff", "org.apache.archiva", "1.0", "jar" );
- pathParserControl.expectAndReturn( parser.toArtifactReference( ad10j ), aRef );
-
- aRef = createArtifactReference( "archiva-test", "org.apache.archiva", "1.0", "jar" );
- pathParserControl.expectAndReturn( parser.toArtifactReference( at10j ), aRef );
-
- aRef = createArtifactReference( "archiva-test", "org.apache.archiva", "1.1", "jar" );
- pathParserControl.expectAndReturn( parser.toArtifactReference( at11j ), aRef );
- }
-
- private List<ArtifactMetadata> getArtifacts()
- {
- List<ArtifactMetadata> artifacts = new ArrayList<ArtifactMetadata>();
-
- ArtifactMetadata artifact = new ArtifactMetadata();
- artifact.setId( "archiva-test-1.0.jar" );
- artifact.setProject( "archiva-test" );
- artifact.setVersion( "1.0" );
- artifact.setProjectVersion( "1.0" );
- artifact.setNamespace( "org.apache.archiva" );
- artifact.setRepositoryId( "internal" );
- artifacts.add( artifact );
- return artifacts;
- }
-
- private ArtifactReference createArtifactReference( String artifactId, String groupId, String version, String type )
- {
- ArtifactReference aRef = new ArtifactReference();
- aRef.setArtifactId( artifactId );
- aRef.setGroupId( groupId );
- aRef.setType( type );
- aRef.setVersion( version );
-
- return aRef;
- }
-
- private RepositoryGroupConfiguration createRepoGroupConfig( String id, List<String> repositories )
- {
- RepositoryGroupConfiguration repoGroup = new RepositoryGroupConfiguration();
- repoGroup.setId( id );
- repoGroup.setRepositories( repositories );
- return repoGroup;
- }
-}
diff --git a/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/test/java/org/apache/archiva/web/xmlrpc/services/SearchServiceImplTest.java b/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/test/java/org/apache/archiva/web/xmlrpc/services/SearchServiceImplTest.java
deleted file mode 100644
index 2cd8f66a6..000000000
--- a/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/test/java/org/apache/archiva/web/xmlrpc/services/SearchServiceImplTest.java
+++ /dev/null
@@ -1,600 +0,0 @@
-package org.apache.archiva.web.xmlrpc.services;
-
-/*
- * 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 junit.framework.TestCase;
-import org.apache.archiva.indexer.search.RepositorySearch;
-import org.apache.archiva.indexer.search.SearchResultHit;
-import org.apache.archiva.indexer.search.SearchResultLimits;
-import org.apache.archiva.indexer.search.SearchResults;
-import org.apache.archiva.indexer.util.SearchUtil;
-import org.apache.archiva.metadata.model.ArtifactMetadata;
-import org.apache.archiva.metadata.model.ProjectVersionMetadata;
-import org.apache.archiva.metadata.model.ProjectVersionReference;
-import org.apache.archiva.metadata.repository.MetadataRepository;
-import org.apache.archiva.metadata.repository.MetadataResolver;
-import org.apache.archiva.metadata.repository.RepositorySession;
-import org.apache.archiva.metadata.repository.RepositorySessionFactory;
-import org.apache.archiva.metadata.repository.storage.maven2.MavenArtifactFacet;
-import org.apache.archiva.metadata.repository.storage.maven2.MavenProjectFacet;
-import org.apache.archiva.web.xmlrpc.api.SearchService;
-import org.apache.archiva.web.xmlrpc.api.beans.Artifact;
-import org.apache.archiva.web.xmlrpc.api.beans.Dependency;
-import org.apache.archiva.web.xmlrpc.security.XmlRpcUserRepositories;
-import org.easymock.MockControl;
-import org.easymock.classextension.MockClassControl;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Date;
-import java.util.List;
-
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
-/**
- * SearchServiceImplTest
- *
- * @version $Id: SearchServiceImplTest.java
- */
-@RunWith( SpringJUnit4ClassRunner.class )
-@ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml", "classpath*:/spring-context.xml" } )
-public class SearchServiceImplTest
- extends TestCase
-{
- private SearchService searchService;
-
- private MockControl userReposControl;
-
- private XmlRpcUserRepositories userRepos;
-
- private MockControl searchControl;
-
- private RepositorySearch search;
-
- private static final String ARCHIVA_TEST_ARTIFACT_ID = "archiva-xmlrpc-test";
-
- private static final String ARCHIVA_TEST_GROUP_ID = "org.apache.archiva";
-
- private MockControl metadataResolverControl;
-
- private MetadataResolver metadataResolver;
-
- private MockControl metadataRepositoryControl;
-
- private MetadataRepository metadataRepository;
-
- private static final String CHECKSUM = "a1b2c3aksjhdasfkdasasd";
-
- private static final String TEST_REPO = "test-repo";
-
- private RepositorySession repositorySession;
-
- @Override
- @Before
- public void setUp()
- throws Exception
- {
- userReposControl = MockClassControl.createControl( XmlRpcUserRepositories.class );
- userRepos = (XmlRpcUserRepositories) userReposControl.getMock();
-
- searchControl = MockControl.createControl( RepositorySearch.class );
- searchControl.setDefaultMatcher( MockControl.ALWAYS_MATCHER );
- search = (RepositorySearch) searchControl.getMock();
-
- metadataResolverControl = MockControl.createControl( MetadataResolver.class );
- metadataResolver = (MetadataResolver) metadataResolverControl.getMock();
-
- metadataRepositoryControl = MockControl.createControl( MetadataRepository.class );
- metadataRepository = (MetadataRepository) metadataRepositoryControl.getMock();
-
- repositorySession = mock( RepositorySession.class );
- when( repositorySession.getResolver() ).thenReturn( metadataResolver );
- when( repositorySession.getRepository() ).thenReturn( metadataRepository );
- RepositorySessionFactory repositorySessionFactory = mock( RepositorySessionFactory.class );
- when( repositorySessionFactory.createSession() ).thenReturn( repositorySession );
-
- searchService = new SearchServiceImpl( userRepos, repositorySessionFactory, search );
- }
-
- // MRM-1230
- @Test
- public void testQuickSearchModelPackagingIsUsed()
- throws Exception
- {
- List<String> observableRepoIds = new ArrayList<String>();
- observableRepoIds.add( "repo1.mirror" );
- observableRepoIds.add( "public.releases" );
-
- userReposControl.expectAndReturn( userRepos.getObservableRepositories(), observableRepoIds );
-
- SearchResults results = new SearchResults();
- List<String> versions = new ArrayList<String>();
- versions.add( "1.0" );
-
- SearchResultHit resultHit = new SearchResultHit();
- resultHit.setGroupId( ARCHIVA_TEST_GROUP_ID );
- resultHit.setArtifactId( "archiva-webapp" );
- resultHit.setVersions( versions );
- resultHit.setRepositoryId( null );
-
- results.addHit( SearchUtil.getHitId( ARCHIVA_TEST_GROUP_ID, "archiva-webapp", null, "war" ), resultHit );
-
- SearchResultLimits limits = new SearchResultLimits( SearchResultLimits.ALL_PAGES );
-
- searchControl.expectAndDefaultReturn( search.search( "", observableRepoIds, "archiva", limits, null ),
- results );
-
- ProjectVersionMetadata model = new ProjectVersionMetadata();
- model.setId( "1.0" );
- MavenProjectFacet facet = new MavenProjectFacet();
- facet.setPackaging( "war" );
- model.addFacet( facet );
-
- metadataResolverControl.expectAndReturn(
- metadataResolver.resolveProjectVersion( repositorySession, "repo1.mirror", ARCHIVA_TEST_GROUP_ID,
- "archiva-webapp", "1.0" ), model );
-
- userReposControl.replay();
- searchControl.replay();
- metadataResolverControl.replay();
- metadataRepositoryControl.replay();
-
- List<Artifact> artifacts = searchService.quickSearch( "archiva" );
-
- userReposControl.verify();
- searchControl.verify();
- metadataResolverControl.verify();
- metadataRepositoryControl.verify();
-
- assertNotNull( artifacts );
- assertEquals( 1, artifacts.size() );
-
- Artifact artifact = artifacts.get( 0 );
- assertEquals( ARCHIVA_TEST_GROUP_ID, artifact.getGroupId() );
- assertEquals( "archiva-webapp", artifact.getArtifactId() );
- assertEquals( "1.0", artifact.getVersion() );
- assertEquals( "war", artifact.getType() );
- assertNotNull( "Repository should not be null!", artifact.getRepositoryId() );
- assertEquals( "repo1.mirror", artifact.getRepositoryId() );
- }
-
- @Test
- public void testQuickSearchDefaultPackagingIsUsed()
- throws Exception
- {
- List<String> observableRepoIds = new ArrayList<String>();
- observableRepoIds.add( "repo1.mirror" );
- observableRepoIds.add( "public.releases" );
-
- userReposControl.expectAndReturn( userRepos.getObservableRepositories(), observableRepoIds );
-
- SearchResults results = new SearchResults();
- List<String> versions = new ArrayList<String>();
- versions.add( "1.0" );
-
- SearchResultHit resultHit = new SearchResultHit();
- resultHit.setRepositoryId( null );
- resultHit.setGroupId( ARCHIVA_TEST_GROUP_ID );
- resultHit.setArtifactId( ARCHIVA_TEST_ARTIFACT_ID );
- resultHit.setVersions( versions );
-
- results.addHit( SearchUtil.getHitId( ARCHIVA_TEST_GROUP_ID, ARCHIVA_TEST_ARTIFACT_ID, null, "war" ),
- resultHit );
-
- SearchResultLimits limits = new SearchResultLimits( SearchResultLimits.ALL_PAGES );
-
- searchControl.expectAndDefaultReturn( search.search( "", observableRepoIds, "archiva", limits, null ),
- results );
-
- metadataResolverControl.expectAndReturn(
- metadataResolver.resolveProjectVersion( repositorySession, "repo1.mirror", ARCHIVA_TEST_GROUP_ID,
- ARCHIVA_TEST_ARTIFACT_ID, "1.0" ), null );
-
- ProjectVersionMetadata model = new ProjectVersionMetadata();
- model.setId( "1.0" );
- metadataResolverControl.expectAndReturn(
- metadataResolver.resolveProjectVersion( repositorySession, "public.releases", ARCHIVA_TEST_GROUP_ID,
- ARCHIVA_TEST_ARTIFACT_ID, "1.0" ), model );
-
- userReposControl.replay();
- searchControl.replay();
- metadataResolverControl.replay();
- metadataRepositoryControl.replay();
-
- List<Artifact> artifacts = searchService.quickSearch( "archiva" );
-
- userReposControl.verify();
- searchControl.verify();
- metadataResolverControl.verify();
- metadataRepositoryControl.verify();
-
- assertNotNull( artifacts );
- assertEquals( 1, artifacts.size() );
-
- Artifact artifact = artifacts.get( 0 );
- assertEquals( ARCHIVA_TEST_GROUP_ID, artifact.getGroupId() );
- assertEquals( ARCHIVA_TEST_ARTIFACT_ID, artifact.getArtifactId() );
- assertEquals( "1.0", artifact.getVersion() );
- assertEquals( "jar", artifact.getType() );
- assertEquals( "public.releases", artifact.getRepositoryId() );
- }
-
- @Test
- public void testQuickSearchArtifactRegularSearch()
- throws Exception
- {
- List<String> observableRepoIds = new ArrayList<String>();
- observableRepoIds.add( "repo1.mirror" );
- observableRepoIds.add( "public.releases" );
-
- userReposControl.expectAndReturn( userRepos.getObservableRepositories(), observableRepoIds );
-
- SearchResults results = new SearchResults();
- List<String> versions = new ArrayList<String>();
- versions.add( "1.0" );
-
- SearchResultHit resultHit = new SearchResultHit();
- resultHit.setGroupId( ARCHIVA_TEST_GROUP_ID );
- resultHit.setArtifactId( ARCHIVA_TEST_ARTIFACT_ID );
- resultHit.setVersions( versions );
- resultHit.setRepositoryId( null );
-
- results.addHit( SearchUtil.getHitId( resultHit.getGroupId(), resultHit.getArtifactId(), null, "war" ),
- resultHit );
-
- SearchResultLimits limits = new SearchResultLimits( SearchResultLimits.ALL_PAGES );
-
- searchControl.expectAndDefaultReturn( search.search( "", observableRepoIds, "archiva", limits, null ),
- results );
-
- ProjectVersionMetadata model = new ProjectVersionMetadata();
- model.setId( "1.0" );
- MavenProjectFacet facet = new MavenProjectFacet();
- facet.setPackaging( "jar" );
- model.addFacet( facet );
-
- metadataResolverControl.expectAndReturn(
- metadataResolver.resolveProjectVersion( repositorySession, "repo1.mirror", ARCHIVA_TEST_GROUP_ID,
- ARCHIVA_TEST_ARTIFACT_ID, "1.0" ), model );
-
- userReposControl.replay();
- searchControl.replay();
- metadataRepositoryControl.replay();
- metadataResolverControl.replay();
-
- List<Artifact> artifacts = searchService.quickSearch( "archiva" );
-
- userReposControl.verify();
- searchControl.verify();
- metadataRepositoryControl.verify();
- metadataResolverControl.verify();
-
- assertNotNull( artifacts );
- assertEquals( 1, artifacts.size() );
-
- Artifact artifact = artifacts.get( 0 );
- assertEquals( ARCHIVA_TEST_GROUP_ID, artifact.getGroupId() );
- assertEquals( ARCHIVA_TEST_ARTIFACT_ID, artifact.getArtifactId() );
- assertEquals( "1.0", artifact.getVersion() );
- assertEquals( "jar", artifact.getType() );
- assertNotNull( "Repository should not be null!", artifact.getRepositoryId() );
- assertEquals( "repo1.mirror", artifact.getRepositoryId() );
- }
-
- @Test
- public void testQuickSearchNoResults()
- throws Exception
- {
- List<String> observableRepoIds = new ArrayList<String>();
- observableRepoIds.add( "repo1.mirror" );
- observableRepoIds.add( "public.releases" );
-
- userReposControl.expectAndReturn( userRepos.getObservableRepositories(), observableRepoIds );
-
- SearchResults results = new SearchResults();
- SearchResultLimits limits = new SearchResultLimits( SearchResultLimits.ALL_PAGES );
-
- searchControl.expectAndDefaultReturn( search.search( "", observableRepoIds, "non-existent", limits, null ),
- results );
- userReposControl.replay();
- searchControl.replay();
-
- List<Artifact> artifacts = searchService.quickSearch( "test" );
-
- userReposControl.verify();
- searchControl.verify();
-
- assertNotNull( artifacts );
- assertEquals( 0, artifacts.size() );
- }
-
- @Test
- public void testGetArtifactByChecksum()
- throws Exception
- {
- userReposControl.expectAndReturn( userRepos.getObservableRepositories(),
- Collections.singletonList( TEST_REPO ) );
-
- Date whenGathered = new Date();
-
- ArtifactMetadata artifact = createArtifact( whenGathered );
- metadataRepositoryControl.expectAndReturn( metadataRepository.getArtifactsByChecksum( TEST_REPO, CHECKSUM ),
- Collections.singletonList( artifact ) );
-
- metadataRepositoryControl.replay();
- userReposControl.replay();
-
- List<Artifact> results = searchService.getArtifactByChecksum( CHECKSUM );
-
- metadataRepositoryControl.verify();
- userReposControl.verify();
-
- assertNotNull( results );
- assertEquals( 1, results.size() );
- Artifact result = results.get( 0 );
- assertEquals( ARCHIVA_TEST_GROUP_ID, result.getGroupId() );
- assertEquals( ARCHIVA_TEST_ARTIFACT_ID, result.getArtifactId() );
- assertEquals( "1.0", result.getVersion() );
- assertEquals( "jar", result.getType() );
- assertEquals( TEST_REPO, result.getRepositoryId() );
- }
-
- @Test
- public void testGetArtifactVersionsArtifactExists()
- throws Exception
- {
- List<String> observableRepoIds = new ArrayList<String>();
- observableRepoIds.add( "repo1.mirror" );
- observableRepoIds.add( "public.releases" );
-
- userReposControl.expectAndReturn( userRepos.getObservableRepositories(), observableRepoIds );
- metadataResolverControl.expectAndReturn(
- metadataResolver.resolveProjectVersions( repositorySession, "repo1.mirror", ARCHIVA_TEST_GROUP_ID,
- ARCHIVA_TEST_ARTIFACT_ID ),
- Arrays.asList( "1.0", "1.1-beta-2", "1.2" ) );
- metadataResolverControl.expectAndReturn(
- metadataResolver.resolveProjectVersions( repositorySession, "public.releases", ARCHIVA_TEST_GROUP_ID,
- ARCHIVA_TEST_ARTIFACT_ID ),
- Arrays.asList( "1.1-beta-1", "1.1", "1.2.1-SNAPSHOT" ) );
-
- userReposControl.replay();
- metadataResolverControl.replay();
-
- List<Artifact> artifacts = searchService.getArtifactVersions( ARCHIVA_TEST_GROUP_ID, ARCHIVA_TEST_ARTIFACT_ID );
-
- userReposControl.verify();
- metadataResolverControl.verify();
-
- assertNotNull( artifacts );
- assertEquals( 6, artifacts.size() );
- assertEquals( new Artifact( "repo1.mirror", ARCHIVA_TEST_GROUP_ID, ARCHIVA_TEST_ARTIFACT_ID, "1.0", "pom" ),
- artifacts.get( 0 ) );
- assertEquals(
- new Artifact( "public.releases", ARCHIVA_TEST_GROUP_ID, ARCHIVA_TEST_ARTIFACT_ID, "1.1-beta-1", "pom" ),
- artifacts.get( 3 ) );
- assertEquals(
- new Artifact( "repo1.mirror", ARCHIVA_TEST_GROUP_ID, ARCHIVA_TEST_ARTIFACT_ID, "1.1-beta-2", "pom" ),
- artifacts.get( 1 ) );
- assertEquals( new Artifact( "public.releases", ARCHIVA_TEST_GROUP_ID, ARCHIVA_TEST_ARTIFACT_ID, "1.1", "pom" ),
- artifacts.get( 4 ) );
- assertEquals( new Artifact( "repo1.mirror", ARCHIVA_TEST_GROUP_ID, ARCHIVA_TEST_ARTIFACT_ID, "1.2", "pom" ),
- artifacts.get( 2 ) );
- assertEquals(
- new Artifact( "public.releases", ARCHIVA_TEST_GROUP_ID, ARCHIVA_TEST_ARTIFACT_ID, "1.2.1-SNAPSHOT", "pom" ),
- artifacts.get( 5 ) );
- }
-
- @Test
- public void testGetArtifactVersionsByDateArtifactExists()
- throws Exception
- {
- // TODO
- }
-
- @Test
- public void testGetArtifactVersionsByDateArtifactDoesNotExist()
- throws Exception
- {
- // TODO
- }
-
- @Test
- public void testGetDependenciesArtifactExists()
- throws Exception
- {
- String repoId = "repo1.mirror";
-
- ProjectVersionMetadata model = new ProjectVersionMetadata();
- model.setId( "1.0" );
-
- org.apache.archiva.metadata.model.Dependency dependency = new org.apache.archiva.metadata.model.Dependency();
- dependency.setGroupId( "org.apache.commons" );
- dependency.setArtifactId( "commons-logging" );
- dependency.setVersion( "2.0" );
-
- model.addDependency( dependency );
-
- dependency = new org.apache.archiva.metadata.model.Dependency();
- dependency.setGroupId( "junit" );
- dependency.setArtifactId( "junit" );
- dependency.setVersion( "2.4" );
- dependency.setScope( "test" );
-
- model.addDependency( dependency );
-
- userReposControl.expectAndReturn( userRepos.getObservableRepositories(), Collections.singletonList( repoId ) );
- metadataResolverControl.expectAndReturn(
- metadataResolver.resolveProjectVersion( repositorySession, repoId, ARCHIVA_TEST_GROUP_ID,
- ARCHIVA_TEST_ARTIFACT_ID, "1.0" ), model );
-
- metadataResolverControl.replay();
- userReposControl.replay();
-
- List<Dependency> dependencies =
- searchService.getDependencies( ARCHIVA_TEST_GROUP_ID, ARCHIVA_TEST_ARTIFACT_ID, "1.0" );
-
- metadataResolverControl.verify();
- userReposControl.verify();
-
- assertNotNull( dependencies );
- assertEquals( 2, dependencies.size() );
- assertEquals( new Dependency( "org.apache.commons", "commons-logging", "2.0", null, null, null ),
- dependencies.get( 0 ) );
- assertEquals( new Dependency( "junit", "junit", "2.4", null, null, "test" ), dependencies.get( 1 ) );
- }
-
- @Test
- public void testGetDependenciesArtifactDoesNotExist()
- throws Exception
- {
- String repoId = "repo1.mirror";
-
- userReposControl.expectAndReturn( userRepos.getObservableRepositories(), Collections.singletonList( repoId ) );
- metadataResolverControl.expectAndReturn(
- metadataResolver.resolveProjectVersion( repositorySession, repoId, ARCHIVA_TEST_GROUP_ID,
- ARCHIVA_TEST_ARTIFACT_ID, "1.0" ), null );
-
- userReposControl.replay();
- metadataResolverControl.replay();
-
- try
- {
- searchService.getDependencies( ARCHIVA_TEST_GROUP_ID, ARCHIVA_TEST_ARTIFACT_ID, "1.0" );
- fail( "An exception should have been thrown." );
- }
- catch ( Exception e )
- {
- assertEquals( "Artifact does not exist.", e.getMessage() );
- }
-
- userReposControl.verify();
- metadataResolverControl.verify();
- }
-
- @Test
- public void testGetDependencyTreeArtifactExists()
- throws Exception
- {
- // TODO
- }
-
- @Test
- public void testGetDependencyTreeArtifactDoesNotExist()
- throws Exception
- {
- // TODO
- }
-
- @Test
- public void testGetDependees()
- throws Exception
- {
- List<String> observableRepoIds = new ArrayList<String>();
- String repoId = "repo1.mirror";
- observableRepoIds.add( repoId );
-
- List<ProjectVersionReference> dependeeModels = new ArrayList<ProjectVersionReference>();
- ProjectVersionReference dependeeModel = new ProjectVersionReference();
- dependeeModel.setNamespace( ARCHIVA_TEST_GROUP_ID );
- dependeeModel.setProjectId( "archiva-dependee-one" );
- dependeeModel.setProjectVersion( "1.0" );
- dependeeModels.add( dependeeModel );
-
- dependeeModel = new ProjectVersionReference();
- dependeeModel.setNamespace( ARCHIVA_TEST_GROUP_ID );
- dependeeModel.setProjectId( "archiva-dependee-two" );
- dependeeModel.setProjectVersion( "1.0" );
- dependeeModels.add( dependeeModel );
-
- userReposControl.expectAndReturn( userRepos.getObservableRepositories(), observableRepoIds );
- metadataResolverControl.expectAndReturn(
- metadataResolver.resolveProjectReferences( repositorySession, repoId, ARCHIVA_TEST_GROUP_ID,
- ARCHIVA_TEST_ARTIFACT_ID, "1.0" ), dependeeModels );
-
- metadataResolverControl.replay();
- userReposControl.replay();
-
- List<Artifact> dependees = searchService.getDependees( ARCHIVA_TEST_GROUP_ID, ARCHIVA_TEST_ARTIFACT_ID, "1.0" );
-
- metadataResolverControl.verify();
- userReposControl.verify();
-
- assertNotNull( dependees );
- assertEquals( 2, dependees.size() );
- assertEquals( new Artifact( repoId, ARCHIVA_TEST_GROUP_ID, "archiva-dependee-one", "1.0", "" ),
- dependees.get( 0 ) );
- assertEquals( new Artifact( repoId, ARCHIVA_TEST_GROUP_ID, "archiva-dependee-two", "1.0", "" ),
- dependees.get( 1 ) );
- }
-
- @Test
- public void testGetDependeesArtifactDoesNotExist()
- throws Exception
- {
- List<String> observableRepoIds = new ArrayList<String>();
- observableRepoIds.add( "repo1.mirror" );
- observableRepoIds.add( "public.releases" );
-
- // no longer differentiating between a project not being present and a project that is present but with
- // no references. If it is later determined to be needed, we will need to modify the metadata content repository
- userReposControl.expectAndReturn( userRepos.getObservableRepositories(), observableRepoIds );
- metadataResolverControl.expectAndReturn(
- metadataResolver.resolveProjectReferences( repositorySession, "repo1.mirror", ARCHIVA_TEST_GROUP_ID,
- ARCHIVA_TEST_ARTIFACT_ID, "1.0" ),
- Collections.<ProjectVersionReference>emptyList() );
- metadataResolverControl.expectAndReturn(
- metadataResolver.resolveProjectReferences( repositorySession, "public.releases", ARCHIVA_TEST_GROUP_ID,
- ARCHIVA_TEST_ARTIFACT_ID, "1.0" ),
- Collections.<ProjectVersionReference>emptyList() );
-
- userReposControl.replay();
- metadataResolverControl.replay();
-
- assertTrue( searchService.getDependees( ARCHIVA_TEST_GROUP_ID, ARCHIVA_TEST_ARTIFACT_ID, "1.0" ).isEmpty() );
- }
-
- private ArtifactMetadata createArtifact( Date whenGathered )
- {
- String version = "1.0";
- ArtifactMetadata artifactMetadata = new ArtifactMetadata();
- artifactMetadata.setVersion( version );
- artifactMetadata.setProjectVersion( version );
- artifactMetadata.setId( ARCHIVA_TEST_ARTIFACT_ID + "-" + version + ".jar" );
- artifactMetadata.setProject( ARCHIVA_TEST_ARTIFACT_ID );
- artifactMetadata.setNamespace( ARCHIVA_TEST_GROUP_ID );
- artifactMetadata.setMd5( CHECKSUM );
- artifactMetadata.setWhenGathered( whenGathered );
- artifactMetadata.setRepositoryId( TEST_REPO );
-
- MavenArtifactFacet facet = new MavenArtifactFacet();
- facet.setType( "jar" );
- artifactMetadata.addFacet( facet );
-
- return artifactMetadata;
- }
-} \ No newline at end of file
diff --git a/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/test/repositories/default-repo/org/apache/archiva/archiva-test/1.0/archiva-test-1.0.jar b/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/test/repositories/default-repo/org/apache/archiva/archiva-test/1.0/archiva-test-1.0.jar
deleted file mode 100644
index e69de29bb..000000000
--- a/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/test/repositories/default-repo/org/apache/archiva/archiva-test/1.0/archiva-test-1.0.jar
+++ /dev/null
diff --git a/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/test/repositories/default-repo/org/apache/archiva/archiva-test/1.0/archiva-test-1.0.jar.md5 b/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/test/repositories/default-repo/org/apache/archiva/archiva-test/1.0/archiva-test-1.0.jar.md5
deleted file mode 100644
index e69de29bb..000000000
--- a/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/test/repositories/default-repo/org/apache/archiva/archiva-test/1.0/archiva-test-1.0.jar.md5
+++ /dev/null
diff --git a/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/test/repositories/default-repo/org/apache/archiva/archiva-test/1.0/archiva-test-1.0.jar.sha1 b/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/test/repositories/default-repo/org/apache/archiva/archiva-test/1.0/archiva-test-1.0.jar.sha1
deleted file mode 100644
index e69de29bb..000000000
--- a/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/test/repositories/default-repo/org/apache/archiva/archiva-test/1.0/archiva-test-1.0.jar.sha1
+++ /dev/null
diff --git a/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/test/repositories/default-repo/org/apache/archiva/archiva-test/1.0/archiva-test-1.0.pom b/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/test/repositories/default-repo/org/apache/archiva/archiva-test/1.0/archiva-test-1.0.pom
deleted file mode 100644
index f80e1dec1..000000000
--- a/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/test/repositories/default-repo/org/apache/archiva/archiva-test/1.0/archiva-test-1.0.pom
+++ /dev/null
@@ -1,18 +0,0 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <groupId>org.apache.archiva</groupId>
- <artifactId>archiva-test</artifactId>
- <packaging>jar</packaging>
- <version>1.0</version>
- <name>Maven Quick Start Archetype</name>
- <url>http://maven.apache.org</url>
- <dependencies>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>3.8.1</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
-</project>
diff --git a/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/test/repositories/default-repo/org/apache/archiva/archiva-test/1.0/archiva-test-1.0.pom.md5 b/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/test/repositories/default-repo/org/apache/archiva/archiva-test/1.0/archiva-test-1.0.pom.md5
deleted file mode 100644
index e69de29bb..000000000
--- a/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/test/repositories/default-repo/org/apache/archiva/archiva-test/1.0/archiva-test-1.0.pom.md5
+++ /dev/null
diff --git a/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/test/repositories/default-repo/org/apache/archiva/archiva-test/1.0/archiva-test-1.0.pom.sha1 b/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/test/repositories/default-repo/org/apache/archiva/archiva-test/1.0/archiva-test-1.0.pom.sha1
deleted file mode 100644
index e69de29bb..000000000
--- a/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/test/repositories/default-repo/org/apache/archiva/archiva-test/1.0/archiva-test-1.0.pom.sha1
+++ /dev/null
diff --git a/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/test/repositories/default-repo/org/apache/archiva/archiva-test/1.0/maven-metadata.xml b/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/test/repositories/default-repo/org/apache/archiva/archiva-test/1.0/maven-metadata.xml
deleted file mode 100644
index e69de29bb..000000000
--- a/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/test/repositories/default-repo/org/apache/archiva/archiva-test/1.0/maven-metadata.xml
+++ /dev/null
diff --git a/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/test/repositories/default-repo/org/apache/archiva/archiva-test/1.0/maven-metadata.xml.md5 b/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/test/repositories/default-repo/org/apache/archiva/archiva-test/1.0/maven-metadata.xml.md5
deleted file mode 100644
index e69de29bb..000000000
--- a/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/test/repositories/default-repo/org/apache/archiva/archiva-test/1.0/maven-metadata.xml.md5
+++ /dev/null
diff --git a/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/test/repositories/default-repo/org/apache/archiva/archiva-test/1.0/maven-metadata.xml.sha1 b/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/test/repositories/default-repo/org/apache/archiva/archiva-test/1.0/maven-metadata.xml.sha1
deleted file mode 100644
index e69de29bb..000000000
--- a/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/test/repositories/default-repo/org/apache/archiva/archiva-test/1.0/maven-metadata.xml.sha1
+++ /dev/null
diff --git a/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/test/repositories/default-repo/org/apache/archiva/archiva-test/1.1/archiva-test-1.1.jar b/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/test/repositories/default-repo/org/apache/archiva/archiva-test/1.1/archiva-test-1.1.jar
deleted file mode 100644
index e69de29bb..000000000
--- a/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/test/repositories/default-repo/org/apache/archiva/archiva-test/1.1/archiva-test-1.1.jar
+++ /dev/null
diff --git a/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/test/repositories/default-repo/org/apache/archiva/archiva-test/1.1/archiva-test-1.1.pom b/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/test/repositories/default-repo/org/apache/archiva/archiva-test/1.1/archiva-test-1.1.pom
deleted file mode 100644
index e69de29bb..000000000
--- a/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/test/repositories/default-repo/org/apache/archiva/archiva-test/1.1/archiva-test-1.1.pom
+++ /dev/null
diff --git a/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/test/repositories/legacy-repo/org.apache.archiva/jars/archiva-diff-1.0.jar b/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/test/repositories/legacy-repo/org.apache.archiva/jars/archiva-diff-1.0.jar
deleted file mode 100644
index e69de29bb..000000000
--- a/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/test/repositories/legacy-repo/org.apache.archiva/jars/archiva-diff-1.0.jar
+++ /dev/null
diff --git a/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/test/repositories/legacy-repo/org.apache.archiva/jars/archiva-test-1.0.jar b/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/test/repositories/legacy-repo/org.apache.archiva/jars/archiva-test-1.0.jar
deleted file mode 100644
index e69de29bb..000000000
--- a/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/test/repositories/legacy-repo/org.apache.archiva/jars/archiva-test-1.0.jar
+++ /dev/null
diff --git a/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/test/repositories/legacy-repo/org.apache.archiva/jars/archiva-test-1.1.jar b/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/test/repositories/legacy-repo/org.apache.archiva/jars/archiva-test-1.1.jar
deleted file mode 100644
index e69de29bb..000000000
--- a/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/test/repositories/legacy-repo/org.apache.archiva/jars/archiva-test-1.1.jar
+++ /dev/null
diff --git a/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/test/repositories/legacy-repo/org.apache.archiva/poms/archiva-diff-1.0.pom b/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/test/repositories/legacy-repo/org.apache.archiva/poms/archiva-diff-1.0.pom
deleted file mode 100644
index e69de29bb..000000000
--- a/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/test/repositories/legacy-repo/org.apache.archiva/poms/archiva-diff-1.0.pom
+++ /dev/null
diff --git a/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/test/repositories/legacy-repo/org.apache.archiva/poms/archiva-test-1.0.pom b/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/test/repositories/legacy-repo/org.apache.archiva/poms/archiva-test-1.0.pom
deleted file mode 100644
index e69de29bb..000000000
--- a/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/test/repositories/legacy-repo/org.apache.archiva/poms/archiva-test-1.0.pom
+++ /dev/null
diff --git a/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/test/repositories/legacy-repo/org.apache.archiva/poms/archiva-test-1.1.pom b/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/test/repositories/legacy-repo/org.apache.archiva/poms/archiva-test-1.1.pom
deleted file mode 100644
index e69de29bb..000000000
--- a/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/test/repositories/legacy-repo/org.apache.archiva/poms/archiva-test-1.1.pom
+++ /dev/null
diff --git a/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/test/resources/spring-context.xml b/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/test/resources/spring-context.xml
deleted file mode 100644
index 4a73047ac..000000000
--- a/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/test/resources/spring-context.xml
+++ /dev/null
@@ -1,51 +0,0 @@
-<?xml version="1.0"?>
-
-<!--
- ~ 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.
- -->
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:context="http://www.springframework.org/schema/context"
- xsi:schemaLocation="http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
- http://www.springframework.org/schema/context
- http://www.springframework.org/schema/context/spring-context-3.0.xsd"
- default-lazy-init="true">
-
- <bean id="jcr-config" class="org.apache.archiva.metadata.repository.jcr.ArchivaJcrRepositoryConfig" factory-method="create">
- <constructor-arg value="${appserver.base}/conf/repository.xml"/>
- <constructor-arg value="${appserver.base}/data/jcr"/>
- </bean>
-
- <bean id="jcr-repository" class="org.apache.jackrabbit.core.RepositoryImpl" destroy-method="shutdown" lazy-init="true">
- <constructor-arg ref="jcr-config"/>
- </bean>
-
- <bean name="scheduler" class="org.codehaus.redback.components.scheduler.DefaultScheduler">
- <property name="properties">
- <props>
- <prop key="org.quartz.scheduler.instanceName">scheduler1</prop>
- <prop key="org.quartz.threadPool.class">org.quartz.simpl.SimpleThreadPool</prop>
- <prop key="org.quartz.threadPool.threadCount">2</prop>
- <prop key="org.quartz.threadPool.threadPriority">4</prop>
- <prop key="org.quartz.jobStore.class">org.quartz.simpl.RAMJobStore</prop>
- </props>
- </property>
- </bean>
-
-</beans> \ No newline at end of file
diff --git a/archiva-modules/archiva-web/archiva-xmlrpc/pom.xml b/archiva-modules/archiva-web/archiva-xmlrpc/pom.xml
deleted file mode 100644
index 83bdaf3df..000000000
--- a/archiva-modules/archiva-web/archiva-xmlrpc/pom.xml
+++ /dev/null
@@ -1,36 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ 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.
- -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.apache.archiva</groupId>
- <artifactId>archiva-web</artifactId>
- <version>1.4-M3-SNAPSHOT</version>
- </parent>
- <artifactId>archiva-xmlrpc</artifactId>
- <name>Archiva Web :: XML-RPC</name>
- <packaging>pom</packaging>
- <modules>
- <module>archiva-xmlrpc-api</module>
- <module>archiva-xmlrpc-services</module>
- <module>archiva-xmlrpc-security</module>
- <module>archiva-xmlrpc-client</module>
- </modules>
-</project>