]> source.dussan.org Git - archiva.git/commitdiff
[MRM-1490] Expose Archiva services trough REST
authorOlivier Lamy <olamy@apache.org>
Fri, 19 Aug 2011 07:52:52 +0000 (07:52 +0000)
committerOlivier Lamy <olamy@apache.org>
Fri, 19 Aug 2011 07:52:52 +0000 (07:52 +0000)
start adding some services :
* search
* administration

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

12 files changed:
archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/model/ManagedRepository.java [new file with mode: 0644]
archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/model/RemoteRepository.java [new file with mode: 0644]
archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/model/SearchRequest.java [new file with mode: 0644]
archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/services/PingService.java
archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/services/RepositoriesService.java [new file with mode: 0644]
archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/services/SearchService.java [new file with mode: 0644]
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org.apache.archiva.rest.services/DefaultPingService.java
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org.apache.archiva.rest.services/DefaultRepositoriesService.java [new file with mode: 0644]
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/resources/META-INF/spring-context.xml
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/PingServiceTest.java
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/RepositoriesServiceTest.java [new file with mode: 0644]
archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/main/java/org/apache/archiva/web/xmlrpc/services/AdministrationServiceImpl.java

diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/model/ManagedRepository.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/model/ManagedRepository.java
new file mode 100644 (file)
index 0000000..07b19ac
--- /dev/null
@@ -0,0 +1,146 @@
+package org.apache.archiva.rest.api.model;
+
+/*
+ * 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 javax.xml.bind.annotation.XmlRootElement;
+import java.io.Serializable;
+
+/**
+ * @since 1.4
+ */
+@XmlRootElement( name = "managedRepository" )
+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()
+    {
+        // no op
+    }
+    
+    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;
+    } 
+    
+    public void setId(String id)
+    {
+        this.id = id;
+    } 
+    
+    public void setLayout(String layout)
+    {
+        this.layout = layout;
+    } 
+
+    public void setName(String name)
+    {
+        this.name = name;
+    } 
+    
+    public void setReleases(boolean releases)
+    {
+        this.releases = releases;
+    } 
+
+    public void setSnapshots(boolean snapshots)
+    {
+        this.snapshots = snapshots;
+    } 
+
+    public void setUrl(String url)
+    {
+        this.url = url;
+    }
+}
\ No newline at end of file
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/model/RemoteRepository.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/model/RemoteRepository.java
new file mode 100644 (file)
index 0000000..fba20a5
--- /dev/null
@@ -0,0 +1,115 @@
+package org.apache.archiva.rest.api.model;
+
+/*
+ * 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 javax.xml.bind.annotation.XmlRootElement;
+import java.io.Serializable;
+
+
+@XmlRootElement( name = "remoteRepository" )
+public class RemoteRepository
+    implements Serializable
+{   
+    private String id;
+
+    private String name;
+
+    private String url;
+    
+    private String layout;
+
+    public RemoteRepository()
+    {
+        // no op
+    }
+    
+    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;
+    }
+    
+    public void setId(String id)
+    {
+        this.id = id;
+    }
+    
+    public void setLayout(String layout)
+    {
+        this.layout = layout;
+    }
+    
+    public void setName(String name)
+    {
+        this.name = name;
+    } 
+    
+    public void setUrl(String url)
+    {
+        this.url = url;
+    }     
+}
\ No newline at end of file
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/model/SearchRequest.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/model/SearchRequest.java
new file mode 100644 (file)
index 0000000..7ab8f37
--- /dev/null
@@ -0,0 +1,212 @@
+package org.apache.archiva.rest.api.model;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/*
+ * 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.
+ */
+
+public class SearchRequest
+{
+    /**
+     * groupId
+     */
+    private String groupId;
+
+    /**
+     * artifactId
+     */
+    private String artifactId;
+
+    /**
+     * version
+     */
+    private String version;
+
+    /**
+     * packaging (jar, war, pom, etc.)
+     */
+    private String packaging;
+
+    /**
+     * class name or package name
+     */
+    private String className;
+
+    /**
+     * repositories
+     */
+    private List<String> repositories = new ArrayList<String>();
+
+
+    /**
+     * contains osgi metadata Bundle-Version if available
+     *
+     * @since 1.4
+     */
+    private String bundleVersion;
+
+    /**
+     * contains osgi metadata Bundle-SymbolicName if available
+     *
+     * @since 1.4
+     */
+    private String bundleSymbolicName;
+
+    /**
+     * contains osgi metadata Export-Package if available
+     *
+     * @since 1.4
+     */
+    private String bundleExportPackage;
+
+    /**
+     * contains osgi metadata Export-Service if available
+     *
+     * @since 1.4
+     */
+    private String bundleExportService;
+
+    public SearchRequest()
+    {
+        // no op
+    }
+
+    public SearchRequest( String groupId, String artifactId, String version, String packaging, String className,
+                          List<String> repositories )
+    {
+        this.groupId = groupId;
+        this.artifactId = artifactId;
+        this.version = version;
+        this.packaging = packaging;
+        this.className = className;
+        this.repositories = repositories;
+    }
+
+    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 getPackaging()
+    {
+        return packaging;
+    }
+
+    public void setPackaging( String packaging )
+    {
+        this.packaging = packaging;
+    }
+
+    public String getClassName()
+    {
+        return className;
+    }
+
+    public void setClassName( String className )
+    {
+        this.className = className;
+    }
+
+    public List<String> getRepositories()
+    {
+        return repositories;
+    }
+
+    public void setRepositories( List<String> repositories )
+    {
+        this.repositories = repositories;
+    }
+
+
+    public String getBundleVersion()
+    {
+        return bundleVersion;
+    }
+
+    public void setBundleVersion( String bundleVersion )
+    {
+        this.bundleVersion = bundleVersion;
+    }
+
+    public String getBundleSymbolicName()
+    {
+        return bundleSymbolicName;
+    }
+
+    public void setBundleSymbolicName( String bundleSymbolicName )
+    {
+        this.bundleSymbolicName = bundleSymbolicName;
+    }
+
+    public String getBundleExportPackage()
+    {
+        return bundleExportPackage;
+    }
+
+    public void setBundleExportPackage( String bundleExportPackage )
+    {
+        this.bundleExportPackage = bundleExportPackage;
+    }
+
+    public String getBundleExportService()
+    {
+        return bundleExportService;
+    }
+
+    public void setBundleExportService( String bundleExportService )
+    {
+        this.bundleExportService = bundleExportService;
+    }
+
+    @Override
+    public String toString()
+    {
+        return "SearchFields{" + "groupId='" + groupId + '\'' + ", artifactId='" + artifactId + '\'' + ", version='"
+            + version + '\'' + ", packaging='" + packaging + '\'' + ", className='" + className + '\''
+            + ", repositories=" + repositories + ", bundleVersion='" + bundleVersion + '\'' + ", bundleSymbolicName='"
+            + bundleSymbolicName + '\'' + ", bundleExportPackage='" + bundleExportPackage + '\''
+            + ", bundleExportService='" + bundleExportService + '\'' + '}';
+    }
+}
index e03362d67b040826fe87002d6ac31dd1f6799b5e..c5ac495344b46660a79c1e5ab5c46d7d481fb4af 100644 (file)
@@ -35,14 +35,24 @@ public interface PingService
 {
 
     /**
-     *
      * ping service to monitor Archiva with a nice returned message :-)
+     *
      * @return Yeah Baby It rocks!
      */
-    @Path( "addAuthenticationKey" )
+    @Path( "ping" )
     @GET
     @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
     @RedbackAuthorization( noRestriction = true )
-    String ping( );
+    String ping();
+
+    /**
+     * same as #ping but check authz
+     * @return
+     */
+    @Path( "pingWithAuthz" )
+    @GET
+    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
+    @RedbackAuthorization( noRestriction = false, noPermission = true )
+    String pingWithAuthz();
 
 }
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/services/RepositoriesService.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/services/RepositoriesService.java
new file mode 100644 (file)
index 0000000..2c2a199
--- /dev/null
@@ -0,0 +1,58 @@
+package org.apache.archiva.rest.api.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.rest.api.model.ManagedRepository;
+import org.apache.archiva.rest.api.model.RemoteRepository;
+import org.codehaus.plexus.redback.authorization.RedbackAuthorization;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.QueryParam;
+import javax.ws.rs.core.MediaType;
+import java.util.List;
+
+/**
+ * @author Olivier Lamy
+ * @since 1.4
+ */
+@Path( "/repositoriesService/" )
+public interface RepositoriesService
+{
+    @Path( "getManagedRepositories" )
+    @GET
+    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
+    @RedbackAuthorization( noRestriction = true )
+    List<ManagedRepository> getManagedRepositories();
+
+    @Path( "getRemoteRepositories" )
+    @GET
+    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
+    @RedbackAuthorization( noRestriction = true )
+    List<RemoteRepository> getRemoteRepositories();
+
+    @Path( "scanRepository" )
+    @GET
+    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
+    @RedbackAuthorization( noRestriction = true )
+    Boolean scanRepository( @QueryParam( "repositoryId" ) String repositoryId,
+                            @QueryParam( "fullScan" ) boolean fullScan );
+}
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/services/SearchService.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/services/SearchService.java
new file mode 100644 (file)
index 0000000..9328595
--- /dev/null
@@ -0,0 +1,63 @@
+package org.apache.archiva.rest.api.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.rest.api.model.Artifact;
+import org.apache.archiva.rest.api.model.Dependency;
+
+import javax.xml.bind.annotation.XmlRootElement;
+import java.util.Date;
+import java.util.List;
+
+@XmlRootElement( name = "searchRequest" )
+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
+    */
+
+    List<Artifact> quickSearch( String queryString )
+        throws Exception;
+
+    List<Artifact> getArtifactByChecksum( String checksum )
+        throws Exception;
+
+    List<Artifact> getArtifactVersions( String groupId, String artifactId )
+        throws Exception;
+
+    List<Artifact> getArtifactVersionsByDate( String groupId, String artifactId, String version, Date whenGathered )
+        throws Exception;
+
+    List<Dependency> getDependencies( String groupId, String artifactId, String version )
+        throws Exception;
+
+    List<Artifact> getDependencyTree( String groupId, String artifactId, String version )
+        throws Exception;
+
+    List<Artifact> getDependees( String groupId, String artifactId, String version )
+        throws Exception;
+}
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org.apache.archiva.rest.services/DefaultRepositoriesService.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org.apache.archiva.rest.services/DefaultRepositoriesService.java
new file mode 100644 (file)
index 0000000..a08c4a5
--- /dev/null
@@ -0,0 +1,32 @@
+package org.apache.archiva.rest.services;
+
+import org.apache.archiva.rest.api.model.ManagedRepository;
+import org.apache.archiva.rest.api.model.RemoteRepository;
+import org.apache.archiva.rest.api.services.RepositoriesService;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * @author Olivier Lamy
+ * @since 1.4
+ */
+@Service("repositoriesService#rest")
+public class DefaultRepositoriesService
+    implements RepositoriesService
+{
+    public List<ManagedRepository> getManagedRepositories()
+    {
+        return null;  //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    public List<RemoteRepository> getRemoteRepositories()
+    {
+        return null;  //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    public Boolean scanRepository( String repositoryId, boolean fullScan )
+    {
+        return null;  //To change body of implemented methods use File | Settings | File Templates.
+    }
+}
index 053891ef334920cfc5b4df063d99f91cea20cbf7..9d5ba24b4e0baa49359d710c43bc8934a52d90c1 100644 (file)
@@ -47,6 +47,7 @@
     <jaxrs:providers>
       <ref bean="authenticationInterceptor#rest"/>
       <ref bean="permissionInterceptor#rest"/>
+      <ref bean="repositoriesService#rest"/>
     </jaxrs:providers>
 
    </jaxrs:server>
index 7b7efc3ab4fc6b9114060e9778abf97eb0e55d2a..a44d8a2bed4ef48a255e537ce7c5b957dbb9e268 100644 (file)
@@ -21,9 +21,9 @@ package org.apache.archiva.rest.services;
 
 import org.apache.archiva.rest.api.services.PingService;
 import org.apache.cxf.jaxrs.client.JAXRSClientFactory;
+import org.apache.cxf.jaxrs.client.ServerWebApplicationException;
+import org.apache.cxf.jaxrs.client.WebClient;
 import org.codehaus.redback.rest.services.AbstractRestServicesTest;
-import org.codehaus.redback.rest.services.FakeCreateAdminService;
-import org.junit.Before;
 import org.junit.Test;
 
 /**
@@ -34,20 +34,6 @@ public class PingServiceTest
     extends AbstractRestServicesTest
 {
 
-    @Before
-    public void setUp()
-        throws Exception
-    {
-        super.startServer();
-
-        FakeCreateAdminService fakeCreateAdminService =
-            JAXRSClientFactory.create( "http://localhost:" + port + "/services/fakeCreateAdminService/",
-                                       FakeCreateAdminService.class );
-
-        Boolean res = fakeCreateAdminService.createAdminIfNeeded();
-        assertTrue( res.booleanValue() );
-    }
-
     PingService getPingService()
     {
         return JAXRSClientFactory.create( "http://localhost:" + port + "/services/archivaServices/",
@@ -66,4 +52,32 @@ public class PingServiceTest
         String res = getPingService().ping();
         assertEquals( "Yeah Baby It rocks!", res );
     }
+
+    @Test( expected = ServerWebApplicationException.class )
+    public void pingWithAuthzFailed()
+        throws Exception
+    {
+
+        try
+        {
+            String res = getPingService().pingWithAuthz();
+            fail( "not in exception" );
+        }
+        catch ( ServerWebApplicationException e )
+        {
+            assertEquals( 403, e.getStatus() );
+            throw e;
+        }
+    }
+
+    @Test
+    public void pingWithAuthz()
+        throws Exception
+    {
+
+        PingService service = getPingService();
+        WebClient.client( service ).header( "Authorization", authorizationHeader );
+        String res = service.pingWithAuthz();
+        assertEquals( "Yeah Baby It rocks!", res );
+    }
 }
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/RepositoriesServiceTest.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/RepositoriesServiceTest.java
new file mode 100644 (file)
index 0000000..07527e2
--- /dev/null
@@ -0,0 +1,45 @@
+package org.apache.archiva.rest.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.rest.api.services.RepositoriesService;
+import org.apache.cxf.jaxrs.client.JAXRSClientFactory;
+import org.codehaus.redback.rest.services.AbstractRestServicesTest;
+import org.junit.Test;
+
+/**
+ * @author Olivier Lamy
+ */
+public class RepositoriesServiceTest
+    extends AbstractRestServicesTest
+{
+    RepositoriesService getPingService()
+    {
+        return JAXRSClientFactory.create( "http://localhost:" + port + "/services/archivaServices/",
+                                          RepositoriesService.class );
+
+    }
+
+    @Test
+    public void listRemoteRepositories() throws Exception
+    {
+
+    }
+}