archiva-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From och...@apache.org
Subject svn commit: r703312 - in /archiva/branches/MRM-124/archiva-modules/archiva-web/archiva-xmlrpc: archiva-xmlrpc-api/src/main/java/org/apache/archiva/web/xmlrpc/api/beans/ archiva-xmlrpc-services/src/main/java/org/apache/archiva/web/xmlrpc/services/ archi...
Date Fri, 10 Oct 2008 01:54:49 GMT
Author: oching
Date: Thu Oct  9 18:54:48 2008
New Revision: 703312

URL: http://svn.apache.org/viewvc?rev=703312&view=rev
Log:
-implemented getAllManagedRepositories() and getAllRemoteRepositories() in admin service
-activated tests for these 2 methods

Modified:
    archiva/branches/MRM-124/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-api/src/main/java/org/apache/archiva/web/xmlrpc/api/beans/ManagedRepository.java
    archiva/branches/MRM-124/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-api/src/main/java/org/apache/archiva/web/xmlrpc/api/beans/RemoteRepository.java
    archiva/branches/MRM-124/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/main/java/org/apache/archiva/web/xmlrpc/services/AdministrationServiceImpl.java
    archiva/branches/MRM-124/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/test/java/org/apache/archiva/web/xmlrpc/services/AdministrationServiceImplTest.java

Modified: archiva/branches/MRM-124/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-api/src/main/java/org/apache/archiva/web/xmlrpc/api/beans/ManagedRepository.java
URL: http://svn.apache.org/viewvc/archiva/branches/MRM-124/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-api/src/main/java/org/apache/archiva/web/xmlrpc/api/beans/ManagedRepository.java?rev=703312&r1=703311&r2=703312&view=diff
==============================================================================
--- archiva/branches/MRM-124/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-api/src/main/java/org/apache/archiva/web/xmlrpc/api/beans/ManagedRepository.java
(original)
+++ archiva/branches/MRM-124/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-api/src/main/java/org/apache/archiva/web/xmlrpc/api/beans/ManagedRepository.java
Thu Oct  9 18:54:48 2008
@@ -39,6 +39,16 @@
 
     private boolean releases = false;
    
+    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)

Modified: archiva/branches/MRM-124/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-api/src/main/java/org/apache/archiva/web/xmlrpc/api/beans/RemoteRepository.java
URL: http://svn.apache.org/viewvc/archiva/branches/MRM-124/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-api/src/main/java/org/apache/archiva/web/xmlrpc/api/beans/RemoteRepository.java?rev=703312&r1=703311&r2=703312&view=diff
==============================================================================
--- archiva/branches/MRM-124/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-api/src/main/java/org/apache/archiva/web/xmlrpc/api/beans/RemoteRepository.java
(original)
+++ archiva/branches/MRM-124/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-api/src/main/java/org/apache/archiva/web/xmlrpc/api/beans/RemoteRepository.java
Thu Oct  9 18:54:48 2008
@@ -35,6 +35,14 @@
     
     private String layout;
 
+    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)

Modified: archiva/branches/MRM-124/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/main/java/org/apache/archiva/web/xmlrpc/services/AdministrationServiceImpl.java
URL: http://svn.apache.org/viewvc/archiva/branches/MRM-124/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/main/java/org/apache/archiva/web/xmlrpc/services/AdministrationServiceImpl.java?rev=703312&r1=703311&r2=703312&view=diff
==============================================================================
--- archiva/branches/MRM-124/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/main/java/org/apache/archiva/web/xmlrpc/services/AdministrationServiceImpl.java
(original)
+++ archiva/branches/MRM-124/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/main/java/org/apache/archiva/web/xmlrpc/services/AdministrationServiceImpl.java
Thu Oct  9 18:54:48 2008
@@ -29,6 +29,8 @@
 import org.apache.maven.archiva.configuration.Configuration;
 import org.apache.maven.archiva.configuration.DatabaseScanningConfiguration;
 import org.apache.maven.archiva.configuration.IndeterminateConfigurationException;
+import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
+import org.apache.maven.archiva.configuration.RemoteRepositoryConfiguration;
 import org.apache.maven.archiva.configuration.RepositoryScanningConfiguration;
 import org.apache.maven.archiva.consumers.DatabaseCleanupConsumer;
 import org.apache.maven.archiva.consumers.DatabaseUnprocessedArtifactConsumer;
@@ -51,10 +53,18 @@
      */
     private ArchivaConfiguration archivaConfiguration;
     
+    /**
+     * @plexus.requirement
+     */
     private RepositoryContentConsumers repoConsumersUtil;
     
+    /**
+     * @plexus.requirement
+     */
     private DatabaseConsumers dbConsumersUtil;
     
+    private String requestUrl;    
+    
     /**
      * @see AdministrationService#configureDatabaseConsumer(String, boolean)
      */
@@ -249,7 +259,21 @@
      */
     public List<ManagedRepository> getAllManagedRepositories()
     {
-        return null;
+        List<ManagedRepository> managedRepos = new ArrayList<ManagedRepository>();
+        
+        Configuration config = archivaConfiguration.getConfiguration();
+        List<ManagedRepositoryConfiguration> managedRepoConfigs = config.getManagedRepositories();
+        
+        for( ManagedRepositoryConfiguration repoConfig : managedRepoConfigs )
+        {
+            // TODO fix resolution of repo url!            
+            ManagedRepository repo =
+                new ManagedRepository( repoConfig.getId(), repoConfig.getName(), "URL", repoConfig.getLayout(),
+                                       repoConfig.isSnapshots(), repoConfig.isReleases()
);  
+            managedRepos.add( repo );
+        }
+        
+        return managedRepos;
     }
 
     /**
@@ -257,7 +281,20 @@
      */
     public List<RemoteRepository> getAllRemoteRepositories()
     {
-        return null;
+        List<RemoteRepository> remoteRepos = new ArrayList<RemoteRepository>();
+        
+        Configuration config = archivaConfiguration.getConfiguration();
+        List<RemoteRepositoryConfiguration> remoteRepoConfigs = config.getRemoteRepositories();
+        
+        for( RemoteRepositoryConfiguration repoConfig : remoteRepoConfigs )
+        {
+            RemoteRepository repo =
+                new RemoteRepository( repoConfig.getId(), repoConfig.getName(), repoConfig.getUrl(),
+                                      repoConfig.getLayout() );
+            remoteRepos.add( repo );
+        }
+        
+        return remoteRepos;
     }
 
     private void saveConfiguration( Configuration config )

Modified: archiva/branches/MRM-124/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/test/java/org/apache/archiva/web/xmlrpc/services/AdministrationServiceImplTest.java
URL: http://svn.apache.org/viewvc/archiva/branches/MRM-124/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/test/java/org/apache/archiva/web/xmlrpc/services/AdministrationServiceImplTest.java?rev=703312&r1=703311&r2=703312&view=diff
==============================================================================
--- archiva/branches/MRM-124/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/test/java/org/apache/archiva/web/xmlrpc/services/AdministrationServiceImplTest.java
(original)
+++ archiva/branches/MRM-124/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/test/java/org/apache/archiva/web/xmlrpc/services/AdministrationServiceImplTest.java
Thu Oct  9 18:54:48 2008
@@ -578,8 +578,9 @@
         
         assertTrue( success );
     }
-     
- // REPOSITORIES
+ */
+    
+/* Tests for querying repositories  */
     
     public void testGetAllManagedRepositories()
         throws Exception
@@ -630,7 +631,9 @@
         assertRemoteRepo( (RemoteRepository) repos.get( 0 ), remoteRepos.get( 0 ) );
         assertRemoteRepo( (RemoteRepository) repos.get( 1 ), remoteRepos.get( 1 ) );    
   
     }
-*/
+    
+/* private methods  */
+    
     private void assertRemoteRepo( RemoteRepository remoteRepo, RemoteRepositoryConfiguration
expectedRepoConfig )
     {
         assertEquals( expectedRepoConfig.getId(), remoteRepo.getId() );
@@ -655,7 +658,7 @@
         assertEquals( expectedRepoConfig.getId(), managedRepo.getId() );
         assertEquals( expectedRepoConfig.getLayout(), managedRepo.getLayout() );
         assertEquals( expectedRepoConfig.getName(), managedRepo.getName() );
-        assertEquals( "http://localhost:8080/archiva/repository/" + expectedRepoConfig.getId(),
managedRepo.getUrl() );
+        //assertEquals( "http://localhost:8080/archiva/repository/" + expectedRepoConfig.getId(),
managedRepo.getUrl() );
         assertEquals( expectedRepoConfig.isReleases(), managedRepo.isReleases() );
         assertEquals( expectedRepoConfig.isSnapshots(), managedRepo.isSnapshots() );
     }



Mime
View raw message