diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/beans/RemoteRepository.java b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/beans/RemoteRepository.java index 7a5cba646..60d6822f2 100644 --- a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/beans/RemoteRepository.java +++ b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/beans/RemoteRepository.java @@ -26,7 +26,7 @@ import java.io.Serializable; * @author Olivier Lamy * @since 1.4-M1 */ -@XmlRootElement( name = "remoteRepository" ) +@XmlRootElement ( name = "remoteRepository" ) public class RemoteRepository extends AbstractRepository implements Serializable @@ -86,6 +86,16 @@ public class RemoteRepository 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() { return url; diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/remote/DefaultRemoteRepositoryAdmin.java b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/remote/DefaultRemoteRepositoryAdmin.java index d20c4762a..9086903da 100644 --- a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/remote/DefaultRemoteRepositoryAdmin.java +++ b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/remote/DefaultRemoteRepositoryAdmin.java @@ -133,6 +133,7 @@ public class DefaultRemoteRepositoryAdmin remoteRepository.setRemoteDownloadTimeout( repositoryConfiguration.getRemoteDownloadTimeout() ); remoteRepository.setDownloadRemoteIndexOnStartup( repositoryConfiguration.isDownloadRemoteIndexOnStartup() ); + remoteRepository.setDescription( repositoryConfiguration.getDescription() ); remoteRepositories.add( remoteRepository ); } return remoteRepositories; @@ -333,6 +334,7 @@ public class DefaultRemoteRepositoryAdmin remoteRepositoryConfiguration.setRemoteDownloadTimeout( remoteRepository.getRemoteDownloadTimeout() ); remoteRepositoryConfiguration.setDownloadRemoteIndexOnStartup( remoteRepository.isDownloadRemoteIndexOnStartup() ); + remoteRepositoryConfiguration.setDescription( remoteRepository.getDescription() ); return remoteRepositoryConfiguration; } diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/repository/AbstractRepositoryAdminTest.java b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/repository/AbstractRepositoryAdminTest.java index 9218b5b7c..66ee8acf6 100644 --- a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/repository/AbstractRepositoryAdminTest.java +++ b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/repository/AbstractRepositoryAdminTest.java @@ -148,6 +148,7 @@ public abstract class AbstractRepositoryAdminTest remoteRepository.setPassword( "toto" ); remoteRepository.setId( id ); remoteRepository.setRemoteDownloadNetworkProxyId( "foo" ); + remoteRepository.setDescription( "cool apache repo" ); return remoteRepository; } } diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/repository/remote/RemoteRepositoryAdminTest.java b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/repository/remote/RemoteRepositoryAdminTest.java index 0f01fdb31..ca1cafdd3 100644 --- a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/repository/remote/RemoteRepositoryAdminTest.java +++ b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/repository/remote/RemoteRepositoryAdminTest.java @@ -74,6 +74,7 @@ public class RemoteRepositoryAdminTest assertEquals( getRemoteRepository().getUserName(), repo.getUserName() ); assertEquals( getRemoteRepository().getName(), repo.getName() ); assertEquals( getRemoteRepository().getTimeout(), repo.getTimeout() ); + assertEquals( getRemoteRepository().getDescription(), repo.getDescription() ); remoteRepositoryAdmin.deleteRemoteRepository( "foo", getFakeAuditInformation() ); @@ -120,6 +121,7 @@ public class RemoteRepositoryAdminTest repo.setPassword( "titi" ); repo.setUrl( "http://foo.com/maven-really-rocks" ); repo.setRemoteDownloadNetworkProxyId( "toto" ); + repo.setDescription( "archiva rocks!" ); remoteRepositoryAdmin.updateRemoteRepository( repo, getFakeAuditInformation() ); @@ -129,6 +131,7 @@ public class RemoteRepositoryAdminTest assertEquals( "titi", repo.getPassword() ); assertEquals( "http://foo.com/maven-really-rocks", repo.getUrl() ); assertEquals( "toto", repo.getRemoteDownloadNetworkProxyId() ); + assertEquals( "archiva rocks!", repo.getDescription() ); remoteRepositoryAdmin.deleteRemoteRepository( "foo", getFakeAuditInformation() ); diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/RemoteRepositoriesServiceTest.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/RemoteRepositoriesServiceTest.java index bb674f621..c2d0a0d77 100644 --- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/RemoteRepositoriesServiceTest.java +++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/RemoteRepositoriesServiceTest.java @@ -35,7 +35,7 @@ public class RemoteRepositoriesServiceTest { - @Test( expected = ServerWebApplicationException.class ) + @Test (expected = ServerWebApplicationException.class) public void listRemoteRepositoriesKarmaFailed() throws Exception { @@ -85,6 +85,8 @@ public class RemoteRepositoriesServiceTest assertEquals( getRemoteRepository().getUserName(), service.getRemoteRepository( "id-new" ).getUserName() ); assertEquals( getRemoteRepository().getPassword(), service.getRemoteRepository( "id-new" ).getPassword() ); assertEquals( getRemoteRepository().getTimeout(), service.getRemoteRepository( "id-new" ).getTimeout() ); + assertEquals( getRemoteRepository().getDescription(), + service.getRemoteRepository( "id-new" ).getDescription() ); assertEquals( initialSize + 1, service.getRemoteRepositories().size() ); @@ -124,6 +126,7 @@ public class RemoteRepositoriesServiceTest repo.setPassword( "new password" ); repo.setUserName( "new username" ); repo.setUrl( "http://foo.new.org" ); + repo.setDescription( "foo bar" ); service.updateRemoteRepository( repo ); @@ -133,6 +136,7 @@ public class RemoteRepositoriesServiceTest assertEquals( repo.getUserName(), service.getRemoteRepository( "id-new" ).getUserName() ); assertEquals( repo.getPassword(), service.getRemoteRepository( "id-new" ).getPassword() ); assertEquals( repo.getTimeout(), service.getRemoteRepository( "id-new" ).getTimeout() ); + assertEquals( repo.getDescription(), service.getRemoteRepository( "id-new" ).getDescription() ); service.deleteRemoteRepository( "id-new" ); @@ -144,7 +148,8 @@ public class RemoteRepositoriesServiceTest 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" ); }