archiva-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1129792 - in /archiva/trunk/archiva-modules/archiva-base/archiva-proxy/src: main/java/org/apache/maven/archiva/proxy/ test/java/org/apache/archiva/metadata/repository/ test/java/org/apache/maven/archiva/proxy/ test/resources/ test/resource...
Date Tue, 31 May 2011 16:39:21 GMT
Author: olamy
Date: Tue May 31 16:39:20 2011
New Revision: 1129792

URL: http://svn.apache.org/viewvc?rev=1129792&view=rev
Log:
fixing some test spring configuration : still some tests fail and puzzle me ! :-)

Modified:
    archiva/trunk/archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/DefaultRepositoryProxyConnectors.java
    archiva/trunk/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/metadata/repository/TestMetadataRepository.java
    archiva/trunk/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/AbstractProxyTestCase.java
    archiva/trunk/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/MockConfiguration.java
    archiva/trunk/archiva-modules/archiva-base/archiva-proxy/src/test/resources/META-INF/spring-context.xml
    archiva/trunk/archiva-modules/archiva-base/archiva-proxy/src/test/resources/spring-context.xml

Modified: archiva/trunk/archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/DefaultRepositoryProxyConnectors.java
URL: http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/DefaultRepositoryProxyConnectors.java?rev=1129792&r1=1129791&r2=1129792&view=diff
==============================================================================
--- archiva/trunk/archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/DefaultRepositoryProxyConnectors.java
(original)
+++ archiva/trunk/archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/DefaultRepositoryProxyConnectors.java
Tue May 31 16:39:20 2011
@@ -103,6 +103,7 @@ public class DefaultRepositoryProxyConne
      * plexus.requirement
      */
     @Inject
+    @Named(value = "repositoryContentFactory#default")
     private RepositoryContentFactory repositoryFactory;
 
     /**
@@ -115,17 +116,17 @@ public class DefaultRepositoryProxyConne
     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;
 

Modified: archiva/trunk/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/metadata/repository/TestMetadataRepository.java
URL: http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/metadata/repository/TestMetadataRepository.java?rev=1129792&r1=1129791&r2=1129792&view=diff
==============================================================================
--- archiva/trunk/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/metadata/repository/TestMetadataRepository.java
(original)
+++ archiva/trunk/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/metadata/repository/TestMetadataRepository.java
Tue May 31 16:39:20 2011
@@ -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();
     }
 }

Modified: archiva/trunk/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/AbstractProxyTestCase.java
URL: http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/AbstractProxyTestCase.java?rev=1129792&r1=1129791&r2=1129792&view=diff
==============================================================================
--- archiva/trunk/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/AbstractProxyTestCase.java
(original)
+++ archiva/trunk/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/AbstractProxyTestCase.java
Tue May 31 16:39:20 2011
@@ -47,13 +47,13 @@ import org.springframework.test.context.
 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 AbstractProxyTestC
     {
         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 AbstractProxyTestC
             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 AbstractProxyTestC
         // 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();

Modified: archiva/trunk/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/MockConfiguration.java
URL: http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/MockConfiguration.java?rev=1129792&r1=1129791&r2=1129792&view=diff
==============================================================================
--- archiva/trunk/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/MockConfiguration.java
(original)
+++ archiva/trunk/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/MockConfiguration.java
Tue May 31 16:39:20 2011
@@ -50,7 +50,7 @@ import java.util.Set;
  *          role-hint="mock"
  */
 @Service( "archivaConfiguration#mock" )
-@Scope( "prototype" )
+//Scope( "prototype" )
 public class MockConfiguration
     implements ArchivaConfiguration
 {

Modified: archiva/trunk/archiva-modules/archiva-base/archiva-proxy/src/test/resources/META-INF/spring-context.xml
URL: http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-base/archiva-proxy/src/test/resources/META-INF/spring-context.xml?rev=1129792&r1=1129791&r2=1129792&view=diff
==============================================================================
--- archiva/trunk/archiva-modules/archiva-base/archiva-proxy/src/test/resources/META-INF/spring-context.xml
(original)
+++ archiva/trunk/archiva-modules/archiva-base/archiva-proxy/src/test/resources/META-INF/spring-context.xml
Tue May 31 16:39:20 2011
@@ -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

Modified: archiva/trunk/archiva-modules/archiva-base/archiva-proxy/src/test/resources/spring-context.xml
URL: http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-base/archiva-proxy/src/test/resources/spring-context.xml?rev=1129792&r1=1129791&r2=1129792&view=diff
==============================================================================
--- archiva/trunk/archiva-modules/archiva-base/archiva-proxy/src/test/resources/spring-context.xml
(original)
+++ archiva/trunk/archiva-modules/archiva-base/archiva-proxy/src/test/resources/spring-context.xml
Tue May 31 16:39:20 2011
@@ -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>



Mime
View raw message