import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
import java.util.List;
-import java.util.Map;
/**
* <b>No update method for changing source and target here as id is : sourceRepoId and targetRepoId, use delete then add.</b>
@GET
@Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
@RedbackAuthorization( permission = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
- ProxyConnector getProxyConnector( @QueryParam( "sourceRepoId" ) String sourceRepoId, @QueryParam( "targetRepoId" ) String targetRepoId )
+ ProxyConnector getProxyConnector( @QueryParam( "sourceRepoId" ) String sourceRepoId,
+ @QueryParam( "targetRepoId" ) String targetRepoId )
throws RepositoryAdminException;
@Path( "addProxyConnector" )
throws RepositoryAdminException;
- @Path( "getProxyConnectorAsMap" )
- @GET
- @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
- @RedbackAuthorization( permission = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
- Map<String, List<ProxyConnector>> getProxyConnectorAsMap()
- throws RepositoryAdminException;
-
}
getAuditInformation() );
}
- public Map<String, List<ProxyConnector>> getProxyConnectorAsMap()
- throws RepositoryAdminException
- {
- Map<String, List<org.apache.archiva.admin.repository.proxyconnector.ProxyConnector>> modelMap =
- proxyConnectorAdmin.getProxyConnectorAsMap();
- if ( modelMap == null || modelMap.isEmpty() )
- {
- return Collections.emptyMap();
- }
- Map<String, List<ProxyConnector>> map = new HashMap<String, List<ProxyConnector>>( modelMap.size() );
- for ( Map.Entry<String, List<org.apache.archiva.admin.repository.proxyconnector.ProxyConnector>> entry : modelMap.entrySet() )
- {
- List<ProxyConnector> proxyConnectors = new ArrayList<ProxyConnector>( entry.getValue().size() );
- for ( org.apache.archiva.admin.repository.proxyconnector.ProxyConnector proxyConnector : entry.getValue() )
- {
- proxyConnectors.add( new BeanReplicator().replicateBean( proxyConnector, ProxyConnector.class ) );
- }
- map.put( entry.getKey(), proxyConnectors );
- }
- return map;
- }
-
-
public ProxyConnectorAdmin getProxyConnectorAdmin()
{
return proxyConnectorAdmin;
import org.apache.archiva.rest.api.model.ManagedRepository;
import org.apache.archiva.rest.api.services.ManagedRepositoriesService;
import org.apache.archiva.rest.api.services.PingService;
+import org.apache.archiva.rest.api.services.ProxyConnectorService;
import org.apache.archiva.rest.api.services.RemoteRepositoriesService;
import org.apache.archiva.rest.api.services.RepositoriesService;
import org.apache.archiva.rest.api.services.RepositoryGroupService;
import org.apache.cxf.jaxrs.client.JAXRSClientFactory;
+import org.apache.cxf.jaxrs.client.WebClient;
import org.apache.maven.archiva.common.utils.FileUtil;
import org.codehaus.redback.rest.services.AbstractRestServicesTest;
RepositoryGroupService.class );
}
+ protected ProxyConnectorService getProxyConnectorService()
+ {
+ ProxyConnectorService service =
+ JAXRSClientFactory.create( "http://localhost:" + port + "/services/archivaServices/",
+ ProxyConnectorService.class );
+
+ WebClient.client( service ).header( "Authorization", authorizationHeader );
+ WebClient.getConfig( service ).getHttpConduit().getClient().setReceiveTimeout( 300000 );
+ return service;
+ }
+
protected ManagedRepository getTestManagedRepository()
{
String location = new File( FileUtil.getBasedir(), "target/test-repo" ).getAbsolutePath();
--- /dev/null
+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.junit.Test;
+
+/**
+ * @author Olivier Lamy
+ */
+public class ProxyConnectorServiceTest
+ extends AbstractArchivaRestTest
+{
+
+ @Test
+ public void getAllproxyConnectors()
+ throws Exception
+ {
+ assertTrue( getProxyConnectorService().getProxyConnectors() != null );
+ assertTrue( getProxyConnectorService().getProxyConnectors().size() > 0 );
+
+ }
+
+}