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 index 49c40db76..59787b078 100644 --- 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 @@ -33,7 +33,7 @@ public class ManagedRepository private String name; - private String url; + private String location; private String layout; @@ -52,12 +52,12 @@ public class ManagedRepository // no op } - public ManagedRepository( String id, String name, String url, String layout, boolean snapshots, boolean releases, + public ManagedRepository( String id, String name, String location, String layout, boolean snapshots, boolean releases, boolean blockRedeployments, boolean stageRepoNeeded, String cronExpression ) { this.id = id; this.name = name; - this.url = url; + this.location = location; this.layout = layout; this.snapshots = snapshots; this.releases = releases; @@ -81,9 +81,9 @@ public class ManagedRepository return this.name; } - public String getUrl() + public String getLocation() { - return this.url; + return this.location; } @@ -125,9 +125,9 @@ public class ManagedRepository this.snapshots = snapshots; } - public void setUrl( String url ) + public void setLocation( String location ) { - this.url = url; + this.location = location; } public boolean isBlockRedeployments() @@ -189,7 +189,7 @@ public class ManagedRepository @Override public String toString() { - return "ManagedRepository{" + "id='" + id + '\'' + ", name='" + name + '\'' + ", url='" + url + '\'' + return "ManagedRepository{" + "id='" + id + '\'' + ", name='" + name + '\'' + ", location='" + location + '\'' + ", layout='" + layout + '\'' + ", snapshots=" + snapshots + ", releases=" + releases + ", blockRedeployments=" + blockRedeployments + ", cronExpression='" + cronExpression + '\'' + ", stageRepoNeeded=" + stageRepoNeeded + '}'; 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 index 0ebd8c345..db8cf5e52 100644 --- 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 @@ -113,11 +113,10 @@ public class DefaultRepositoriesService for ( ManagedRepositoryConfiguration repoConfig : managedRepoConfigs ) { - // TODO fix resolution of repo url! // TODO staging repo too ManagedRepository repo = - new ManagedRepository( repoConfig.getId(), repoConfig.getName(), "URL", repoConfig.getLayout(), - repoConfig.isSnapshots(), repoConfig.isReleases(), + new ManagedRepository( repoConfig.getId(), repoConfig.getName(), repoConfig.getLocation(), + repoConfig.getLayout(), repoConfig.isSnapshots(), repoConfig.isReleases(), repoConfig.isBlockRedeployments(), false, repoConfig.getRefreshCronExpression() ); managedRepos.add( repo ); @@ -231,7 +230,7 @@ public class DefaultRepositoriesService { return addManagedRepository( managedRepository.getId(), managedRepository.getLayout(), managedRepository.getName(), - managedRepository.getUrl(), managedRepository.isBlockRedeployments(), + managedRepository.getLocation(), managedRepository.isBlockRedeployments(), managedRepository.isReleases(), managedRepository.isSnapshots(), managedRepository.isStageRepoNeeded(), managedRepository.getCronExpression() ) != null; @@ -355,7 +354,7 @@ public class DefaultRepositoriesService String result; RepositorySession repositorySession = repositorySessionFactory.createSession(); ManagedRepositoryConfiguration managedRepositoryConfiguration = - addManagedRepository( repository.getId(), repository.getLayout(), repository.getName(), repository.getUrl(), + addManagedRepository( repository.getId(), repository.getLayout(), repository.getName(), repository.getLocation(), repository.isBlockRedeployments(), repository.isReleases(), repository.isSnapshots(), repository.isStageRepoNeeded(), repository.getCronExpression() ); 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 index bbbe59980..be11f0a98 100644 --- 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 @@ -25,8 +25,10 @@ import org.apache.archiva.rest.api.services.RepositoriesService; import org.apache.cxf.jaxrs.client.JAXRSClientFactory; import org.apache.cxf.jaxrs.client.ServerWebApplicationException; import org.apache.cxf.jaxrs.client.WebClient; +import org.apache.maven.archiva.common.utils.FileUtil; import org.junit.Test; +import java.io.File; import java.util.List; /** @@ -154,7 +156,8 @@ public class RepositoriesServiceTest private ManagedRepository getTestManagedRepository() { - return new ManagedRepository( "TEST", "test", "foo", "default", true, true, false, false, "2 * * * * ?" ); + String location = new File( FileUtil.getBasedir(), "target/test-repo" ).getAbsolutePath(); + return new ManagedRepository( "TEST", "test", location, "default", true, true, false, false, "2 * * * * ?" ); } }