summaryrefslogtreecommitdiffstats
path: root/archiva-modules/archiva-base
diff options
context:
space:
mode:
authorOlivier Lamy <olamy@apache.org>2011-05-31 16:39:20 +0000
committerOlivier Lamy <olamy@apache.org>2011-05-31 16:39:20 +0000
commit206b66a2be1d09fefe99977e587f53a409326b55 (patch)
treea79fb54e9c84bcadcc5ed57830e06af9447ae792 /archiva-modules/archiva-base
parent3289f9b03b309d235590c3db599f9b995f97c5ac (diff)
downloadarchiva-206b66a2be1d09fefe99977e587f53a409326b55.tar.gz
archiva-206b66a2be1d09fefe99977e587f53a409326b55.zip
fixing some test spring configuration : still some tests fail and puzzle me ! :-)
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1129792 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'archiva-modules/archiva-base')
-rw-r--r--archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/DefaultRepositoryProxyConnectors.java7
-rw-r--r--archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/metadata/repository/TestMetadataRepository.java54
-rw-r--r--archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/AbstractProxyTestCase.java13
-rw-r--r--archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/MockConfiguration.java2
-rw-r--r--archiva-modules/archiva-base/archiva-proxy/src/test/resources/META-INF/spring-context.xml1
-rwxr-xr-xarchiva-modules/archiva-base/archiva-proxy/src/test/resources/spring-context.xml8
6 files changed, 49 insertions, 36 deletions
diff --git a/archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/DefaultRepositoryProxyConnectors.java b/archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/DefaultRepositoryProxyConnectors.java
index 8205bda4a..1fd51ef9d 100644
--- a/archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/DefaultRepositoryProxyConnectors.java
+++ b/archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/DefaultRepositoryProxyConnectors.java
@@ -103,6 +103,7 @@ public class DefaultRepositoryProxyConnectors
* plexus.requirement
*/
@Inject
+ @Named(value = "repositoryContentFactory#default")
private RepositoryContentFactory repositoryFactory;
/**
@@ -115,17 +116,17 @@ public class DefaultRepositoryProxyConnectors
private ApplicationContext applicationContext;
/**
- * @plexus.requirement role="org.apache.maven.archiva.policies.PreDownloadPolicy"
+ * plexus.requirement role="org.apache.maven.archiva.policies.PreDownloadPolicy"
*/
private Map<String, PreDownloadPolicy> preDownloadPolicies;
/**
- * @plexus.requirement role="org.apache.maven.archiva.policies.PostDownloadPolicy"
+ * plexus.requirement role="org.apache.maven.archiva.policies.PostDownloadPolicy"
*/
private Map<String, PostDownloadPolicy> postDownloadPolicies;
/**
- * @plexus.requirement role="org.apache.maven.archiva.policies.DownloadErrorPolicy"
+ * plexus.requirement role="org.apache.maven.archiva.policies.DownloadErrorPolicy"
*/
private Map<String, DownloadErrorPolicy> downloadErrorPolicies;
diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/metadata/repository/TestMetadataRepository.java b/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/metadata/repository/TestMetadataRepository.java
index a40c79da3..1c1e97e90 100644
--- a/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/metadata/repository/TestMetadataRepository.java
+++ b/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/metadata/repository/TestMetadataRepository.java
@@ -39,67 +39,67 @@ public class TestMetadataRepository
{
public ProjectMetadata getProject( String repoId, String namespace, String projectId )
{
- return null; //To change body of implemented methods use File | Settings | File Templates.
+ return null;
}
public ProjectVersionMetadata getProjectVersion( String repoId, String namespace, String projectId,
String projectVersion )
{
- return null; //To change body of implemented methods use File | Settings | File Templates.
+ return null;
}
public Collection<String> getArtifactVersions( String repoId, String namespace, String projectId,
String projectVersion )
{
- return null; //To change body of implemented methods use File | Settings | File Templates.
+ return Collections.emptyList();
}
public Collection<ProjectVersionReference> getProjectReferences( String repoId, String namespace, String projectId,
String projectVersion )
{
- return null; //To change body of implemented methods use File | Settings | File Templates.
+ return Collections.emptyList();
}
public Collection<String> getRootNamespaces( String repoId )
{
- return null; //To change body of implemented methods use File | Settings | File Templates.
+ return Collections.emptyList();
}
public Collection<String> getNamespaces( String repoId, String namespace )
{
- return null; //To change body of implemented methods use File | Settings | File Templates.
+ return Collections.emptyList();
}
public Collection<String> getProjects( String repoId, String namespace )
{
- return null; //To change body of implemented methods use File | Settings | File Templates.
+ return Collections.emptyList();
}
public Collection<String> getProjectVersions( String repoId, String namespace, String projectId )
{
- return null; //To change body of implemented methods use File | Settings | File Templates.
+ return Collections.emptyList();
}
public void updateProject( String repoId, ProjectMetadata project )
{
- //To change body of implemented methods use File | Settings | File Templates.
+ // no op
}
public void updateArtifact( String repoId, String namespace, String projectId, String projectVersion,
ArtifactMetadata artifactMeta )
{
- //To change body of implemented methods use File | Settings | File Templates.
+ // no op
}
public void updateProjectVersion( String repoId, String namespace, String projectId,
ProjectVersionMetadata versionMetadata )
{
- //To change body of implemented methods use File | Settings | File Templates.
+ // no op
}
public void updateNamespace( String repoId, String namespace )
{
- //To change body of implemented methods use File | Settings | File Templates.
+ // no op
}
public List<String> getMetadataFacets( String repodId, String facetId )
@@ -109,73 +109,73 @@ public class TestMetadataRepository
public MetadataFacet getMetadataFacet( String repositoryId, String facetId, String name )
{
- return null; //To change body of implemented methods use File | Settings | File Templates.
+ return null;
}
public void addMetadataFacet( String repositoryId, MetadataFacet metadataFacet )
{
- //To change body of implemented methods use File | Settings | File Templates.
+ // no op
}
public void removeMetadataFacets( String repositoryId, String facetId )
{
- //To change body of implemented methods use File | Settings | File Templates.
+ // no op
}
public void removeMetadataFacet( String repoId, String facetId, String name )
{
- //To change body of implemented methods use File | Settings | File Templates.
+ // no op
}
public List<ArtifactMetadata> getArtifactsByDateRange( String repoId, Date startTime, Date endTime )
{
- return null; //To change body of implemented methods use File | Settings | File Templates.
+ return Collections.emptyList();
}
public Collection<String> getRepositories()
{
- return null; //To change body of implemented methods use File | Settings | File Templates.
+ return Collections.emptyList();
}
public List<ArtifactMetadata> getArtifactsByChecksum( String repoId, String checksum )
{
- return null; //To change body of implemented methods use File | Settings | File Templates.
+ return Collections.emptyList();
}
public void removeArtifact( String repositoryId, String namespace, String project, String version, String id )
{
- //To change body of implemented methods use File | Settings | File Templates.
+ // no op
}
public void removeRepository( String repoId )
{
- //To change body of implemented methods use File | Settings | File Templates.
+ // no op
}
public Collection<ArtifactMetadata> getArtifacts( String repoId, String namespace, String projectId,
String projectVersion )
{
- return null; //To change body of implemented methods use File | Settings | File Templates.
+ return Collections.emptyList();
}
public void save()
{
- //To change body of implemented methods use File | Settings | File Templates.
+ // no op
}
public void close()
{
- //To change body of implemented methods use File | Settings | File Templates.
+ // no op
}
public void revert()
{
- //To change body of implemented methods use File | Settings | File Templates.
+ // no op
}
public boolean canObtainAccess( Class<?> aClass )
{
- return false; //To change body of implemented methods use File | Settings | File Templates.
+ return false;
}
public Object obtainAccess( Class<?> aClass )
@@ -185,6 +185,6 @@ public class TestMetadataRepository
public List<ArtifactMetadata> getArtifacts( String repositoryId )
{
- return null;
+ return Collections.emptyList();
}
}
diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/AbstractProxyTestCase.java b/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/AbstractProxyTestCase.java
index 7d206b0b7..09815b4c4 100644
--- a/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/AbstractProxyTestCase.java
+++ b/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/AbstractProxyTestCase.java
@@ -47,13 +47,13 @@ import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import javax.inject.Inject;
-import javax.inject.Named;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.text.ParseException;
import java.text.SimpleDateFormat;
+import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collection;
import java.util.Date;
@@ -135,11 +135,13 @@ public abstract class AbstractProxyTestCase
{
super.setUp();
- proxyHandler = applicationContext.getBean("repositoryProxyConnectors#default", RepositoryProxyConnectors.class );
-
config =
(MockConfiguration) applicationContext.getBean( "archivaConfiguration#mock", ArchivaConfiguration.class );
+ config.getConfiguration().setManagedRepositories( new ArrayList<ManagedRepositoryConfiguration>() );
+ config.getConfiguration().setRemoteRepositories( new ArrayList<RemoteRepositoryConfiguration>() );
+ config.getConfiguration().setProxyConnectors( new ArrayList<ProxyConnectorConfiguration>() );
+
// Setup source repository (using default layout)
String repoPath = "target/test-repository/managed/" + getName();
File repoLocation = new File( repoPath );
@@ -162,6 +164,8 @@ public abstract class AbstractProxyTestCase
createRepository( ID_LEGACY_MANAGED, "Legacy Managed Repository", REPOPATH_LEGACY_MANAGED_TARGET,
"legacy" );
+
+
managedLegacyDir = new File( managedLegacyRepository.getRepoRoot() );
repoConfig = managedLegacyRepository.getRepository();
@@ -183,6 +187,9 @@ public abstract class AbstractProxyTestCase
// Setup the proxy handler.
//proxyHandler = applicationContext.getBean (RepositoryProxyConnectors) lookup( RepositoryProxyConnectors.class.getName() );
+ proxyHandler =
+ applicationContext.getBean( "repositoryProxyConnectors#test", RepositoryProxyConnectors.class );
+
// Setup the wagon mock.
wagonMockControl = MockControl.createNiceControl( Wagon.class );
wagonMock = (Wagon) wagonMockControl.getMock();
diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/MockConfiguration.java b/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/MockConfiguration.java
index b6e1ea480..9a6e78380 100644
--- a/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/MockConfiguration.java
+++ b/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/MockConfiguration.java
@@ -50,7 +50,7 @@ import java.util.Set;
* role-hint="mock"
*/
@Service( "archivaConfiguration#mock" )
-@Scope( "prototype" )
+//Scope( "prototype" )
public class MockConfiguration
implements ArchivaConfiguration
{
diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/resources/META-INF/spring-context.xml b/archiva-modules/archiva-base/archiva-proxy/src/test/resources/META-INF/spring-context.xml
index db2e53079..011f375fb 100644
--- a/archiva-modules/archiva-base/archiva-proxy/src/test/resources/META-INF/spring-context.xml
+++ b/archiva-modules/archiva-base/archiva-proxy/src/test/resources/META-INF/spring-context.xml
@@ -27,5 +27,4 @@
http://www.springframework.org/schema/context/spring-context-3.0.xsd"
default-lazy-init="true">
- <bean id="repositorySessionFactory" class="org.apache.archiva.metadata.repository.TestRepositorySessionFactory"/>
</beans> \ No newline at end of file
diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/resources/spring-context.xml b/archiva-modules/archiva-base/archiva-proxy/src/test/resources/spring-context.xml
index 319666892..bb4256003 100755
--- a/archiva-modules/archiva-base/archiva-proxy/src/test/resources/spring-context.xml
+++ b/archiva-modules/archiva-base/archiva-proxy/src/test/resources/spring-context.xml
@@ -45,10 +45,16 @@
</property>
</bean>
- <bean name="repositoryProxyConnectors#default" class="org.apache.maven.archiva.proxy.DefaultRepositoryProxyConnectors">
+ <bean name="repositoryContentFactory#mocked" class="org.apache.maven.archiva.repository.RepositoryContentFactory">
<property name="archivaConfiguration" ref="archivaConfiguration#mock"/>
</bean>
+
+ <bean name="repositoryProxyConnectors#test" class="org.apache.maven.archiva.proxy.DefaultRepositoryProxyConnectors">
+ <property name="archivaConfiguration" ref="archivaConfiguration#mock"/>
+ <property name="repositoryFactory" ref="repositoryContentFactory#mocked"/>
+ </bean>
+
<bean name="metadataTools#default" class="org.apache.maven.archiva.repository.metadata.MetadataTools">
<property name="configuration" ref="archivaConfiguration#mock"/>
</bean>