[MRM-648] Add description field to the different types of repositories and proxies

configuration and rest service implemented for remote repositories.

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1384117 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2012-09-12 20:45:25 +00:00
parent 7756665404
commit 4b2a422d58
5 changed files with 24 additions and 3 deletions

View File

@ -26,7 +26,7 @@ import java.io.Serializable;
* @author Olivier Lamy * @author Olivier Lamy
* @since 1.4-M1 * @since 1.4-M1
*/ */
@XmlRootElement( name = "remoteRepository" ) @XmlRootElement ( name = "remoteRepository" )
public class RemoteRepository public class RemoteRepository
extends AbstractRepository extends AbstractRepository
implements Serializable implements Serializable
@ -86,6 +86,16 @@ public class RemoteRepository
this.timeout = timeout; this.timeout = timeout;
} }
/**
* @since 1.4-M3
*/
public RemoteRepository( String id, String name, String url, String layout, String userName, String password,
int timeout, String description )
{
this( id, name, url, layout, userName, password, timeout );
setDescription( description );
}
public String getUrl() public String getUrl()
{ {
return url; return url;

View File

@ -133,6 +133,7 @@ public class DefaultRemoteRepositoryAdmin
remoteRepository.setRemoteDownloadTimeout( repositoryConfiguration.getRemoteDownloadTimeout() ); remoteRepository.setRemoteDownloadTimeout( repositoryConfiguration.getRemoteDownloadTimeout() );
remoteRepository.setDownloadRemoteIndexOnStartup( remoteRepository.setDownloadRemoteIndexOnStartup(
repositoryConfiguration.isDownloadRemoteIndexOnStartup() ); repositoryConfiguration.isDownloadRemoteIndexOnStartup() );
remoteRepository.setDescription( repositoryConfiguration.getDescription() );
remoteRepositories.add( remoteRepository ); remoteRepositories.add( remoteRepository );
} }
return remoteRepositories; return remoteRepositories;
@ -333,6 +334,7 @@ public class DefaultRemoteRepositoryAdmin
remoteRepositoryConfiguration.setRemoteDownloadTimeout( remoteRepository.getRemoteDownloadTimeout() ); remoteRepositoryConfiguration.setRemoteDownloadTimeout( remoteRepository.getRemoteDownloadTimeout() );
remoteRepositoryConfiguration.setDownloadRemoteIndexOnStartup( remoteRepositoryConfiguration.setDownloadRemoteIndexOnStartup(
remoteRepository.isDownloadRemoteIndexOnStartup() ); remoteRepository.isDownloadRemoteIndexOnStartup() );
remoteRepositoryConfiguration.setDescription( remoteRepository.getDescription() );
return remoteRepositoryConfiguration; return remoteRepositoryConfiguration;
} }

View File

@ -148,6 +148,7 @@ public abstract class AbstractRepositoryAdminTest
remoteRepository.setPassword( "toto" ); remoteRepository.setPassword( "toto" );
remoteRepository.setId( id ); remoteRepository.setId( id );
remoteRepository.setRemoteDownloadNetworkProxyId( "foo" ); remoteRepository.setRemoteDownloadNetworkProxyId( "foo" );
remoteRepository.setDescription( "cool apache repo" );
return remoteRepository; return remoteRepository;
} }
} }

View File

@ -74,6 +74,7 @@ public class RemoteRepositoryAdminTest
assertEquals( getRemoteRepository().getUserName(), repo.getUserName() ); assertEquals( getRemoteRepository().getUserName(), repo.getUserName() );
assertEquals( getRemoteRepository().getName(), repo.getName() ); assertEquals( getRemoteRepository().getName(), repo.getName() );
assertEquals( getRemoteRepository().getTimeout(), repo.getTimeout() ); assertEquals( getRemoteRepository().getTimeout(), repo.getTimeout() );
assertEquals( getRemoteRepository().getDescription(), repo.getDescription() );
remoteRepositoryAdmin.deleteRemoteRepository( "foo", getFakeAuditInformation() ); remoteRepositoryAdmin.deleteRemoteRepository( "foo", getFakeAuditInformation() );
@ -120,6 +121,7 @@ public class RemoteRepositoryAdminTest
repo.setPassword( "titi" ); repo.setPassword( "titi" );
repo.setUrl( "http://foo.com/maven-really-rocks" ); repo.setUrl( "http://foo.com/maven-really-rocks" );
repo.setRemoteDownloadNetworkProxyId( "toto" ); repo.setRemoteDownloadNetworkProxyId( "toto" );
repo.setDescription( "archiva rocks!" );
remoteRepositoryAdmin.updateRemoteRepository( repo, getFakeAuditInformation() ); remoteRepositoryAdmin.updateRemoteRepository( repo, getFakeAuditInformation() );
@ -129,6 +131,7 @@ public class RemoteRepositoryAdminTest
assertEquals( "titi", repo.getPassword() ); assertEquals( "titi", repo.getPassword() );
assertEquals( "http://foo.com/maven-really-rocks", repo.getUrl() ); assertEquals( "http://foo.com/maven-really-rocks", repo.getUrl() );
assertEquals( "toto", repo.getRemoteDownloadNetworkProxyId() ); assertEquals( "toto", repo.getRemoteDownloadNetworkProxyId() );
assertEquals( "archiva rocks!", repo.getDescription() );
remoteRepositoryAdmin.deleteRemoteRepository( "foo", getFakeAuditInformation() ); remoteRepositoryAdmin.deleteRemoteRepository( "foo", getFakeAuditInformation() );

View File

@ -35,7 +35,7 @@ public class RemoteRepositoriesServiceTest
{ {
@Test( expected = ServerWebApplicationException.class ) @Test (expected = ServerWebApplicationException.class)
public void listRemoteRepositoriesKarmaFailed() public void listRemoteRepositoriesKarmaFailed()
throws Exception throws Exception
{ {
@ -85,6 +85,8 @@ public class RemoteRepositoriesServiceTest
assertEquals( getRemoteRepository().getUserName(), service.getRemoteRepository( "id-new" ).getUserName() ); assertEquals( getRemoteRepository().getUserName(), service.getRemoteRepository( "id-new" ).getUserName() );
assertEquals( getRemoteRepository().getPassword(), service.getRemoteRepository( "id-new" ).getPassword() ); assertEquals( getRemoteRepository().getPassword(), service.getRemoteRepository( "id-new" ).getPassword() );
assertEquals( getRemoteRepository().getTimeout(), service.getRemoteRepository( "id-new" ).getTimeout() ); assertEquals( getRemoteRepository().getTimeout(), service.getRemoteRepository( "id-new" ).getTimeout() );
assertEquals( getRemoteRepository().getDescription(),
service.getRemoteRepository( "id-new" ).getDescription() );
assertEquals( initialSize + 1, service.getRemoteRepositories().size() ); assertEquals( initialSize + 1, service.getRemoteRepositories().size() );
@ -124,6 +126,7 @@ public class RemoteRepositoriesServiceTest
repo.setPassword( "new password" ); repo.setPassword( "new password" );
repo.setUserName( "new username" ); repo.setUserName( "new username" );
repo.setUrl( "http://foo.new.org" ); repo.setUrl( "http://foo.new.org" );
repo.setDescription( "foo bar" );
service.updateRemoteRepository( repo ); service.updateRemoteRepository( repo );
@ -133,6 +136,7 @@ public class RemoteRepositoriesServiceTest
assertEquals( repo.getUserName(), service.getRemoteRepository( "id-new" ).getUserName() ); assertEquals( repo.getUserName(), service.getRemoteRepository( "id-new" ).getUserName() );
assertEquals( repo.getPassword(), service.getRemoteRepository( "id-new" ).getPassword() ); assertEquals( repo.getPassword(), service.getRemoteRepository( "id-new" ).getPassword() );
assertEquals( repo.getTimeout(), service.getRemoteRepository( "id-new" ).getTimeout() ); assertEquals( repo.getTimeout(), service.getRemoteRepository( "id-new" ).getTimeout() );
assertEquals( repo.getDescription(), service.getRemoteRepository( "id-new" ).getDescription() );
service.deleteRemoteRepository( "id-new" ); service.deleteRemoteRepository( "id-new" );
@ -144,7 +148,8 @@ public class RemoteRepositoriesServiceTest
RemoteRepository getRemoteRepository() RemoteRepository getRemoteRepository()
{ {
return new RemoteRepository( "id-new", "new one", "http://foo.com", "default", "foo", "foopassword", 120 ); return new RemoteRepository( "id-new", "new one", "http://foo.com", "default", "foo", "foopassword", 120,
"cool repo" );
} }