]> source.dussan.org Git - archiva.git/commitdiff
[MRM-1704] Refactor to remove maven specific part from various repository/metadata...
authorOlivier Lamy <olamy@apache.org>
Mon, 29 Oct 2012 21:02:19 +0000 (21:02 +0000)
committerOlivier Lamy <olamy@apache.org>
Mon, 29 Oct 2012 21:02:19 +0000 (21:02 +0000)
fix some unit tests due to some move spring conf for test need to be adapted.

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1403511 13f79535-47bb-0310-9956-ffa450edef68

19 files changed:
archiva-modules/archiva-base/archiva-repository-layer/src/test/resources/spring-context.xml [deleted file]
archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryStorage.java
archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/configuration/TestConfiguration.java
archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/metadata/repository/TestMetadataResolver.java
archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/metadata/repository/storage/maven2/AbstractDefaultRepositoryContentTestCase.java
archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/metadata/repository/storage/maven2/AbstractLegacyRepositoryContentTestCase.java
archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/metadata/repository/storage/maven2/AbstractRepositoryLayerTestCase.java [deleted file]
archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/metadata/repository/storage/maven2/ManagedDefaultRepositoryContentTest.java
archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/metadata/repository/storage/maven2/ManagedLegacyRepositoryContentTest.java
archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryMetadataResolverMRM1411RepoGroupTest.java
archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryMetadataResolverMRM1411Test.java
archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryMetadataResolverManagedReleaseTest.java
archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryMetadataResolverManagedSnapshotTest.java
archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryMetadataResolverTest.java
archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/metadata/repository/storage/maven2/RemoteDefaultRepositoryContentTest.java
archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/repository/content/legacy/LegacyPathParserTest.java
archiva-modules/plugins/maven2-repository/src/test/repositories/default-repository/org/apache/cocoon/cocoon/1/cocoon-1.pom
archiva-modules/plugins/maven2-repository/src/test/resources/spring-context-metadata-tools-test.xml
archiva-modules/plugins/maven2-repository/src/test/resources/spring-context-no-mock-conf.xml [new file with mode: 0644]

diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/test/resources/spring-context.xml b/archiva-modules/archiva-base/archiva-repository-layer/src/test/resources/spring-context.xml
deleted file mode 100644 (file)
index 03ae490..0000000
+++ /dev/null
@@ -1,30 +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">
-
-
-</beans>
\ No newline at end of file
index 791c8806c2d878560fe0af415ed075ab9ca02938..cb2171c7064305eff98002ecdae2cfe33ba33397 100644 (file)
@@ -72,6 +72,7 @@ import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
 import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.springframework.context.ApplicationContext;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.PostConstruct;
@@ -136,8 +137,7 @@ public class Maven2RepositoryStorage
     private WagonFactory wagonFactory;
 
     @Inject
-    @Named ( value = "repositoryProxyConnectors#default" )
-    private RepositoryProxyConnectors connectors;
+    private ApplicationContext applicationContext;
 
     private static final Logger log = LoggerFactory.getLogger( Maven2RepositoryStorage.class );
 
@@ -644,6 +644,9 @@ public class Maven2RepositoryStorage
         pomReference.setVersion( artifact.getVersion() );
         pomReference.setType( "pom" );
 
+        RepositoryProxyConnectors connectors =
+            applicationContext.getBean( "repositoryProxyConnectors#default", RepositoryProxyConnectors.class );
+
         // Get the artifact POM from proxied repositories if needed
         connectors.fetchFromProxies( managedRepository, pomReference );
 
index d5839d210cdb96b20d1825b75a966937ed227608..a583931692b23ea3987c6024dfa9ab7783e3262e 100644 (file)
@@ -47,17 +47,17 @@ public class TestConfiguration
 
     public void addListener( ConfigurationListener listener )
     {
-        throw new UnsupportedOperationException();
+        // no op
     }
 
     public void removeListener( ConfigurationListener listener )
     {
-        throw new UnsupportedOperationException();
+        // no op
     }
 
     public void addChangeListener( RegistryListener listener )
     {
-        throw new UnsupportedOperationException();
+        // no op
     }
 
     public void reload()
index 319df0f232238e60ec474b00039cbb60bd741192..211cfa305d75186a72516e0dded72da18716d754 100644 (file)
@@ -35,7 +35,7 @@ public class TestMetadataResolver
                                                          String projectId, String projectVersion )
         throws MetadataResolutionException
     {
-        return null;  //To change body of implemented methods use File | Settings | File Templates.
+        return null;
     }
 
     public Collection<ProjectVersionReference> resolveProjectReferences( RepositorySession session, String repoId,
@@ -43,38 +43,38 @@ public class TestMetadataResolver
                                                                          String projectVersion )
         throws MetadataResolutionException
     {
-        return null;  //To change body of implemented methods use File | Settings | File Templates.
+        return null;
     }
 
     public Collection<String> resolveRootNamespaces( RepositorySession session, String repoId )
         throws MetadataResolutionException
     {
-        return null;  //To change body of implemented methods use File | Settings | File Templates.
+        return null;
     }
 
     public Collection<String> resolveNamespaces( RepositorySession session, String repoId, String namespace )
         throws MetadataResolutionException
     {
-        return null;  //To change body of implemented methods use File | Settings | File Templates.
+        return null;
     }
 
     public Collection<String> resolveProjects( RepositorySession session, String repoId, String namespace )
         throws MetadataResolutionException
     {
-        return null;  //To change body of implemented methods use File | Settings | File Templates.
+        return null;
     }
 
     public Collection<String> resolveProjectVersions( RepositorySession session, String repoId, String namespace,
                                                       String projectId )
         throws MetadataResolutionException
     {
-        return null;  //To change body of implemented methods use File | Settings | File Templates.
+        return null;
     }
 
     public Collection<ArtifactMetadata> resolveArtifacts( RepositorySession session, String repoId, String namespace,
                                                           String projectId, String projectVersion )
         throws MetadataResolutionException
     {
-        return null;  //To change body of implemented methods use File | Settings | File Templates.
+        return null;
     }
 }
index c63c8d7bf6ed1c16a79757f5cefdd00379009a37..cf998b63e355a2bfdba332085bb90a52ab47f627 100644 (file)
@@ -20,6 +20,7 @@ package org.apache.archiva.metadata.repository.storage.maven2;
  */
 
 import org.apache.archiva.model.ArtifactReference;
+import org.apache.archiva.repository.AbstractRepositoryLayerTestCase;
 import org.apache.archiva.repository.layout.LayoutException;
 import org.apache.archiva.test.utils.ArchivaSpringJUnit4ClassRunner;
 import org.apache.commons.lang.StringUtils;
@@ -33,7 +34,7 @@ import static org.junit.Assert.*;
  * AbstractDefaultRepositoryContentTestCase
  */
 @RunWith ( ArchivaSpringJUnit4ClassRunner.class )
-@ContextConfiguration ( locations = { "classpath*:/META-INF/spring-context.xml", "classpath:/spring-context.xml" } )
+@ContextConfiguration ( locations = { "classpath*:/META-INF/spring-context.xml", "classpath:/spring-context-no-mock-conf.xml" } )
 public abstract class AbstractDefaultRepositoryContentTestCase
     extends AbstractRepositoryLayerTestCase
 {
index 5a53f84d175af177fa9ce238016a8db8dfac22cf..f00aef424a230a98af9ddc9767d258a2a64d415b 100644 (file)
@@ -20,6 +20,7 @@ package org.apache.archiva.metadata.repository.storage.maven2;
  */
 
 import org.apache.archiva.model.ArtifactReference;
+import org.apache.archiva.repository.AbstractRepositoryLayerTestCase;
 import org.apache.archiva.repository.layout.LayoutException;
 import org.apache.archiva.test.utils.ArchivaSpringJUnit4ClassRunner;
 import org.junit.Test;
@@ -32,10 +33,11 @@ import static org.junit.Assert.*;
  * AbstractLegacyRepositoryContentTestCase
  */
 @RunWith ( ArchivaSpringJUnit4ClassRunner.class )
-@ContextConfiguration ( locations = { "classpath*:/META-INF/spring-context.xml", "classpath:/spring-context.xml" } )
+@ContextConfiguration ( locations = { "classpath*:/META-INF/spring-context.xml", "classpath:/spring-context-no-mock-conf.xml" } )
 public abstract class AbstractLegacyRepositoryContentTestCase
     extends AbstractRepositoryLayerTestCase
 {
+
     @Test
     public void testBadPathArtifactIdMissingA()
     {
@@ -48,6 +50,7 @@ public abstract class AbstractLegacyRepositoryContentTestCase
         assertBadPath( "groupId/jars/1.0.jar", "artifactId is missing" );
     }
 
+
     @Test
     public void testBadPathMissingType()
     {
@@ -61,6 +64,7 @@ public abstract class AbstractLegacyRepositoryContentTestCase
         assertBadPath( "invalid/invalid-1.0.jar", "path is too short" );
     }
 
+
     @Test
     public void testBadPathWrongPackageExtension()
     {
diff --git a/archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/metadata/repository/storage/maven2/AbstractRepositoryLayerTestCase.java b/archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/metadata/repository/storage/maven2/AbstractRepositoryLayerTestCase.java
deleted file mode 100644 (file)
index ea1ea84..0000000
+++ /dev/null
@@ -1,101 +0,0 @@
-package org.apache.archiva.metadata.repository.storage.maven2;
-
-/*
- * 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.beans.ManagedRepository;
-import org.apache.archiva.admin.model.beans.RemoteRepository;
-import org.apache.archiva.repository.ManagedRepositoryContent;
-import org.apache.archiva.repository.RemoteRepositoryContent;
-import org.apache.archiva.test.utils.ArchivaSpringJUnit4ClassRunner;
-import org.junit.Rule;
-import org.junit.rules.TestName;
-import org.junit.runner.RunWith;
-import org.springframework.context.ApplicationContext;
-import org.springframework.test.context.ContextConfiguration;
-
-import javax.inject.Inject;
-import java.io.File;
-
-/**
- * AbstractRepositoryLayerTestCase
- *
- *
- */
-@RunWith( ArchivaSpringJUnit4ClassRunner.class )
-@ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml", "classpath:/spring-context.xml" } )
-public abstract class AbstractRepositoryLayerTestCase
-{
-    @Rule
-    public TestName name = new TestName();
-
-    @Inject
-    protected ApplicationContext applicationContext;
-
-    protected ManagedRepository createRepository( String id, String name, File location )
-    {
-        ManagedRepository repo = new ManagedRepository();
-        repo.setId( id );
-        repo.setName( name );
-        repo.setLocation( location.getAbsolutePath() );
-        return repo;
-    }
-
-    protected RemoteRepository createRemoteRepository( String id, String name, String url )
-    {
-        RemoteRepository repo = new RemoteRepository();
-        repo.setId( id );
-        repo.setName( name );
-        repo.setUrl( url );
-        return repo;
-    }
-
-    protected ManagedRepositoryContent createManagedRepositoryContent( String id, String name, File location,
-                                                                       String layout )
-        throws Exception
-    {
-        ManagedRepository repo = new ManagedRepository();
-        repo.setId( id );
-        repo.setName( name );
-        repo.setLocation( location.getAbsolutePath() );
-        repo.setLayout( layout );
-
-        ManagedRepositoryContent repoContent =
-            applicationContext.getBean( "managedRepositoryContent#" + layout, ManagedRepositoryContent.class );
-        repoContent.setRepository( repo );
-
-        return repoContent;
-    }
-
-    protected RemoteRepositoryContent createRemoteRepositoryContent( String id, String name, String url, String layout )
-        throws Exception
-    {
-        RemoteRepository repo = new RemoteRepository();
-        repo.setId( id );
-        repo.setName( name );
-        repo.setUrl( url );
-        repo.setLayout( layout );
-
-        RemoteRepositoryContent repoContent =
-            applicationContext.getBean( "remoteRepositoryContent#" + layout, RemoteRepositoryContent.class );
-        repoContent.setRepository( repo );
-
-        return repoContent;
-    }
-}
index 4fc0e7429101a12f2fac63177dd95a42cf3f762c..0c583a0595542ced0ef5c02d052a4bb193abbffa 100644 (file)
@@ -50,8 +50,6 @@ import static org.junit.Assert.fail;
 /**
  * ManagedDefaultRepositoryContentTest
  */
-@RunWith ( ArchivaSpringJUnit4ClassRunner.class )
-@ContextConfiguration ( locations = { "classpath*:/META-INF/spring-context.xml", "classpath:/spring-context.xml" } )
 public class ManagedDefaultRepositoryContentTest
     extends AbstractDefaultRepositoryContentTestCase
 {
index 61640e563036982512a69f9fd21edbc2a4032af7..e0bbde49ef681cc4b739309f6296369156f3a3fd 100644 (file)
@@ -47,8 +47,6 @@ import static org.junit.Assert.*;
  *
  *
  */
-@RunWith ( ArchivaSpringJUnit4ClassRunner.class )
-@ContextConfiguration ( locations = { "classpath*:/META-INF/spring-context.xml", "classpath:/spring-context.xml" } )
 public class ManagedLegacyRepositoryContentTest
     extends AbstractDefaultRepositoryContentTestCase
 {
index 9a3a78cf6f9c76182244f77b82bfc5cc41381cfc..e24a00a492e228101d54d520757a43ff00efcce3 100644 (file)
@@ -56,8 +56,10 @@ import java.util.List;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
 
-@RunWith (ArchivaSpringJUnit4ClassRunner.class)
-@ContextConfiguration (locations = { "classpath*:/META-INF/spring-context.xml", "classpath:/spring-context.xml" })
+
+@RunWith ( ArchivaSpringJUnit4ClassRunner.class )
+@ContextConfiguration (
+    locations = { "classpath*:/META-INF/spring-context.xml", "classpath:/spring-context-no-mock-conf.xml" } )
 public class Maven2RepositoryMetadataResolverMRM1411RepoGroupTest
     extends TestCase
 {
@@ -92,6 +94,7 @@ public class Maven2RepositoryMetadataResolverMRM1411RepoGroupTest
     private static final String EMPTY_SHA1 = "da39a3ee5e6b4b0d3255bfef95601890afd80709";
 
     @Inject
+    @Named (value = "archivaConfiguration#default")
     private ArchivaConfiguration configuration;
 
     private WagonFactory wagonFactory;
index a03e70291134f40de33eb35b35fb19cdb75b75f1..6d940fa2b9dc7df0ce35bab4943abbd7fafd2ff8 100644 (file)
@@ -58,14 +58,15 @@ import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
 
 @RunWith ( ArchivaSpringJUnit4ClassRunner.class )
-@ContextConfiguration ( locations = { "classpath*:/META-INF/spring-context.xml", "classpath:/spring-context.xml" } )
+@ContextConfiguration (
+    locations = { "classpath*:/META-INF/spring-context.xml", "classpath:/spring-context-no-mock-conf.xml" } )
 public class Maven2RepositoryMetadataResolverMRM1411Test
     extends TestCase
 {
     private static final Filter<String> ALL = new AllFilter<String>();
 
     @Inject
-    @Named ( value = "repositoryStorage#maven2" )
+    @Named (value = "repositoryStorage#maven2")
     private Maven2RepositoryStorage storage;
 
     private static final String TEST_REPO_ID = "test";
@@ -89,6 +90,7 @@ public class Maven2RepositoryMetadataResolverMRM1411Test
     private static final String EMPTY_SHA1 = "da39a3ee5e6b4b0d3255bfef95601890afd80709";
 
     @Inject
+    @Named (value = "archivaConfiguration#default")
     private ArchivaConfiguration configuration;
 
     private WagonFactory wagonFactory;
index 495c15c5563def86596067f141edbf60e2013468..c0ebe5ef45f778138f90171afa02de7730c33bb0 100644 (file)
@@ -19,32 +19,26 @@ package org.apache.archiva.metadata.repository.storage.maven2;
  * under the License.
  */
 
-import org.apache.archiva.configuration.ArchivaConfiguration;
 import org.apache.archiva.metadata.model.ProjectVersionMetadata;
 import org.apache.archiva.metadata.repository.filter.AllFilter;
 import org.apache.archiva.metadata.repository.filter.Filter;
 import org.apache.archiva.metadata.repository.storage.ReadMetadataRequest;
 import org.apache.archiva.metadata.repository.storage.RepositoryStorageRuntimeException;
 import org.apache.archiva.proxy.common.WagonFactory;
-import org.apache.archiva.test.utils.ArchivaSpringJUnit4ClassRunner;
 import org.junit.Before;
 import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.springframework.test.context.ContextConfiguration;
 
 import javax.inject.Inject;
 import javax.inject.Named;
 
 
-@RunWith ( ArchivaSpringJUnit4ClassRunner.class )
-@ContextConfiguration ( locations = { "classpath*:/META-INF/spring-context.xml", "classpath:/spring-context.xml" } )
 public class Maven2RepositoryMetadataResolverManagedReleaseTest
     extends Maven2RepositoryMetadataResolverTest
 {
     private static final Filter<String> ALL = new AllFilter<String>();
 
     @Inject
-    @Named ( value = "repositoryStorage#maven2" )
+    @Named (value = "repositoryStorage#maven2")
     private Maven2RepositoryStorage storage;
 
     private static final String TEST_REPO_ID = "test";
@@ -67,9 +61,6 @@ public class Maven2RepositoryMetadataResolverManagedReleaseTest
 
     private static final String EMPTY_SHA1 = "da39a3ee5e6b4b0d3255bfef95601890afd80709";
 
-    @Inject
-    private ArchivaConfiguration configuration;
-
     private WagonFactory wagonFactory;
 
     @Before
@@ -103,7 +94,7 @@ public class Maven2RepositoryMetadataResolverManagedReleaseTest
         ProjectVersionMetadata metadata = storage.readProjectVersionMetadata( readMetadataRequest );
     }
 
-    @Test ( expected = RepositoryStorageRuntimeException.class )
+    @Test (expected = RepositoryStorageRuntimeException.class)
     @Override
     public void testGetProjectVersionMetadataForTimestampedSnapshotMissingMetadata()
         throws Exception
@@ -114,7 +105,7 @@ public class Maven2RepositoryMetadataResolverManagedReleaseTest
         storage.readProjectVersionMetadata( readMetadataRequest );
     }
 
-    @Test ( expected = RepositoryStorageRuntimeException.class )
+    @Test (expected = RepositoryStorageRuntimeException.class)
     @Override
     public void testGetProjectVersionMetadataForTimestampedSnapshotMalformedMetadata()
         throws Exception
@@ -125,7 +116,7 @@ public class Maven2RepositoryMetadataResolverManagedReleaseTest
         storage.readProjectVersionMetadata( readMetadataRequest );
     }
 
-    @Test ( expected = RepositoryStorageRuntimeException.class )
+    @Test (expected = RepositoryStorageRuntimeException.class)
     @Override
     public void testGetProjectVersionMetadataForTimestampedSnapshot()
         throws Exception
@@ -134,7 +125,7 @@ public class Maven2RepositoryMetadataResolverManagedReleaseTest
     }
 
 
-    @Test ( expected = RepositoryStorageRuntimeException.class )
+    @Test (expected = RepositoryStorageRuntimeException.class)
     @Override
     public void testGetProjectVersionMetadataForTimestampedSnapshotIncompleteMetadata()
         throws Exception
index f24ba9cbf3e92dbb23da98e35350355c1de96009..5011f9f048fca67433b7e8ee857ed58396042487 100644 (file)
@@ -19,7 +19,6 @@ package org.apache.archiva.metadata.repository.storage.maven2;
  * under the License.
  */
 
-import org.apache.archiva.configuration.ArchivaConfiguration;
 import org.apache.archiva.metadata.model.ProjectVersionMetadata;
 import org.apache.archiva.metadata.repository.filter.AllFilter;
 import org.apache.archiva.metadata.repository.filter.Filter;
@@ -34,16 +33,16 @@ import org.springframework.test.context.ContextConfiguration;
 import javax.inject.Inject;
 import javax.inject.Named;
 
-
 @RunWith ( ArchivaSpringJUnit4ClassRunner.class )
-@ContextConfiguration ( locations = { "classpath*:/META-INF/spring-context.xml", "classpath:/spring-context.xml" } )
+@ContextConfiguration (
+    locations = { "classpath*:/META-INF/spring-context.xml", "classpath:/spring-context-no-mock-conf.xml" } )
 public class Maven2RepositoryMetadataResolverManagedSnapshotTest
     extends Maven2RepositoryMetadataResolverTest
 {
     private static final Filter<String> ALL = new AllFilter<String>();
 
     @Inject
-    @Named ( value = "repositoryStorage#maven2" )
+    @Named (value = "repositoryStorage#maven2")
     private Maven2RepositoryStorage storage;
 
     private static final String TEST_REPO_ID = "test";
@@ -64,10 +63,8 @@ public class Maven2RepositoryMetadataResolverManagedSnapshotTest
 
     private static final String EMPTY_MD5 = "d41d8cd98f00b204e9800998ecf8427e";
 
-    private static final String EMPTY_SHA1 = "da39a3ee5e6b4b0d3255bfef95601890afd80709";
 
-    @Inject
-    private ArchivaConfiguration configuration;
+    private static final String EMPTY_SHA1 = "da39a3ee5e6b4b0d3255bfef95601890afd80709";
 
 
     @Before
@@ -86,7 +83,7 @@ public class Maven2RepositoryMetadataResolverManagedSnapshotTest
         assertFalse( c.getManagedRepositories().get( 0 ).isReleases() );
     }
 
-    @Test ( expected = RepositoryStorageRuntimeException.class )
+    @Test (expected = RepositoryStorageRuntimeException.class)
     @Override
     public void testModelWithJdkProfileActivation()
         throws Exception
@@ -100,7 +97,7 @@ public class Maven2RepositoryMetadataResolverManagedSnapshotTest
         ProjectVersionMetadata metadata = storage.readProjectVersionMetadata( readMetadataRequest );
     }
 
-    @Test ( expected = RepositoryStorageRuntimeException.class )
+    @Test (expected = RepositoryStorageRuntimeException.class)
     @Override
     public void testGetProjectVersionMetadataForMislocatedPom()
         throws Exception
@@ -120,7 +117,7 @@ public class Maven2RepositoryMetadataResolverManagedSnapshotTest
         // super test is on release
     }
 
-    @Test ( expected = RepositoryStorageRuntimeException.class )
+    @Test (expected = RepositoryStorageRuntimeException.class)
     @Override
     public void testGetProjectVersionMetadataForInvalidPom()
         throws Exception
@@ -131,7 +128,7 @@ public class Maven2RepositoryMetadataResolverManagedSnapshotTest
         storage.readProjectVersionMetadata( readMetadataRequest );
     }
 
-    @Test ( expected = RepositoryStorageRuntimeException.class )
+    @Test (expected = RepositoryStorageRuntimeException.class)
     @Override
     public void testGetProjectVersionMetadataForMissingPom()
         throws Exception
index 3c8e3212d71ad6263dc3cf16c3e1e9b07c7a7a94..607d91a1b742350aa503e3d3ef070a39e0dade45 100644 (file)
@@ -62,15 +62,16 @@ import java.util.List;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
 
-@RunWith ( ArchivaSpringJUnit4ClassRunner.class )
-@ContextConfiguration ( locations = { "classpath*:/META-INF/spring-context.xml", "classpath:/spring-context.xml" } )
+@RunWith (ArchivaSpringJUnit4ClassRunner.class)
+@ContextConfiguration (
+    locations = { "classpath*:/META-INF/spring-context.xml", "classpath:/spring-context-no-mock-conf.xml" })
 public class Maven2RepositoryMetadataResolverTest
     extends TestCase
 {
     private static final Filter<String> ALL = new AllFilter<String>();
 
     @Inject
-    @Named ( value = "repositoryStorage#maven2" )
+    @Named (value = "repositoryStorage#maven2")
     private Maven2RepositoryStorage storage;
 
     private static final String TEST_REPO_ID = "test";
@@ -94,7 +95,8 @@ public class Maven2RepositoryMetadataResolverTest
     private static final String EMPTY_SHA1 = "da39a3ee5e6b4b0d3255bfef95601890afd80709";
 
     @Inject
-    private ArchivaConfiguration configuration;
+    @Named ( value = "archivaConfiguration#default" )
+    protected ArchivaConfiguration configuration;
 
     private WagonFactory wagonFactory;
 
index fc2e4cf2d9497b955c53449f55a7dac29c77df0a..be5f77b1c962203dca3b68f74cd22a7bb31db642 100644 (file)
@@ -34,8 +34,6 @@ import javax.inject.Named;
 /**
  * RemoteDefaultRepositoryContentTest
  */
-@RunWith ( ArchivaSpringJUnit4ClassRunner.class )
-@ContextConfiguration ( locations = { "classpath*:/META-INF/spring-context.xml", "classpath:/spring-context.xml" } )
 public class RemoteDefaultRepositoryContentTest
     extends AbstractDefaultRepositoryContentTestCase
 {
index 4f4e3bee94fbb3505bf1f00b213ff4fcbe087530..1e587c92fef28ff943f41f09028407bcd6ceb17b 100644 (file)
@@ -41,7 +41,7 @@ import static org.junit.Assert.*;
  *
  */
 @RunWith ( ArchivaSpringJUnit4ClassRunner.class )
-@ContextConfiguration ( locations = { "classpath*:/META-INF/spring-context.xml", "classpath:/spring-context.xml" } )
+@ContextConfiguration ( locations = { "classpath*:/META-INF/spring-context.xml", "classpath:/spring-context-no-mock-conf.xml" } )
 public class LegacyPathParserTest
 {
     private LegacyPathParser parser;
index 31405768a9329a394aabe01a7889da3efd888dac..81201451ea892552a106652caf89c7a11dc57c93 100644 (file)
@@ -16,7 +16,7 @@
 -->
 <!--+
     | This is the main Maven file that contains all global settings, management and information.
-    | @version $Id$
+    | @version $Id: cocoon-1.pom 580582 2007-09-29 13:37:01Z joakime $
     +-->
 <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">
   
index 663f4fad0be8e46b4b569d985a6d5f07543fa6d4..90b8da13e725916d3f0e8ddc20db12c4521ee26c 100644 (file)
@@ -27,7 +27,8 @@
            http://www.springframework.org/schema/context/spring-context-3.0.xsd"
        default-lazy-init="true">
 
-
+  <bean name="archivaConfiguration#mock" class="org.apache.archiva.repository.MockConfiguration"/>
+  <alias name="archivaConfiguration#mock" alias="archivaConfiguration#default"/>
   <bean name="metadataTools#test" class="org.apache.archiva.repository.metadata.MetadataTools">
     <property name="configuration" ref="archivaConfiguration#mock"/>
   </bean>
diff --git a/archiva-modules/plugins/maven2-repository/src/test/resources/spring-context-no-mock-conf.xml b/archiva-modules/plugins/maven2-repository/src/test/resources/spring-context-no-mock-conf.xml
new file mode 100644 (file)
index 0000000..98df636
--- /dev/null
@@ -0,0 +1,30 @@
+<?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">
+  <alias name="archivaConfiguration#mock" alias="archivaConfiguration#default"/>
+  <alias name="archivaConfiguration#mock" alias="archivaConfiguration#test"/>
+</beans>
\ No newline at end of file