replace url with location to match configuration API and populate sensible values

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1162668 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Brett Porter 2011-08-29 07:41:16 +00:00
parent a2ca0a36fb
commit 82d6d72490
3 changed files with 16 additions and 14 deletions

View File

@ -33,7 +33,7 @@ public class ManagedRepository
private String name; private String name;
private String url; private String location;
private String layout; private String layout;
@ -52,12 +52,12 @@ public class ManagedRepository
// no op // 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 ) boolean blockRedeployments, boolean stageRepoNeeded, String cronExpression )
{ {
this.id = id; this.id = id;
this.name = name; this.name = name;
this.url = url; this.location = location;
this.layout = layout; this.layout = layout;
this.snapshots = snapshots; this.snapshots = snapshots;
this.releases = releases; this.releases = releases;
@ -81,9 +81,9 @@ public class ManagedRepository
return this.name; 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; this.snapshots = snapshots;
} }
public void setUrl( String url ) public void setLocation( String location )
{ {
this.url = url; this.location = location;
} }
public boolean isBlockRedeployments() public boolean isBlockRedeployments()
@ -189,7 +189,7 @@ public class ManagedRepository
@Override @Override
public String toString() 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 + ", layout='" + layout + '\'' + ", snapshots=" + snapshots + ", releases=" + releases
+ ", blockRedeployments=" + blockRedeployments + ", cronExpression='" + cronExpression + '\'' + ", blockRedeployments=" + blockRedeployments + ", cronExpression='" + cronExpression + '\''
+ ", stageRepoNeeded=" + stageRepoNeeded + '}'; + ", stageRepoNeeded=" + stageRepoNeeded + '}';

View File

@ -113,11 +113,10 @@ public class DefaultRepositoriesService
for ( ManagedRepositoryConfiguration repoConfig : managedRepoConfigs ) for ( ManagedRepositoryConfiguration repoConfig : managedRepoConfigs )
{ {
// TODO fix resolution of repo url!
// TODO staging repo too // TODO staging repo too
ManagedRepository repo = ManagedRepository repo =
new ManagedRepository( repoConfig.getId(), repoConfig.getName(), "URL", repoConfig.getLayout(), new ManagedRepository( repoConfig.getId(), repoConfig.getName(), repoConfig.getLocation(),
repoConfig.isSnapshots(), repoConfig.isReleases(), repoConfig.getLayout(), repoConfig.isSnapshots(), repoConfig.isReleases(),
repoConfig.isBlockRedeployments(), false, repoConfig.isBlockRedeployments(), false,
repoConfig.getRefreshCronExpression() ); repoConfig.getRefreshCronExpression() );
managedRepos.add( repo ); managedRepos.add( repo );
@ -231,7 +230,7 @@ public class DefaultRepositoriesService
{ {
return return
addManagedRepository( managedRepository.getId(), managedRepository.getLayout(), managedRepository.getName(), addManagedRepository( managedRepository.getId(), managedRepository.getLayout(), managedRepository.getName(),
managedRepository.getUrl(), managedRepository.isBlockRedeployments(), managedRepository.getLocation(), managedRepository.isBlockRedeployments(),
managedRepository.isReleases(), managedRepository.isSnapshots(), managedRepository.isReleases(), managedRepository.isSnapshots(),
managedRepository.isStageRepoNeeded(), managedRepository.getCronExpression() ) managedRepository.isStageRepoNeeded(), managedRepository.getCronExpression() )
!= null; != null;
@ -355,7 +354,7 @@ public class DefaultRepositoriesService
String result; String result;
RepositorySession repositorySession = repositorySessionFactory.createSession(); RepositorySession repositorySession = repositorySessionFactory.createSession();
ManagedRepositoryConfiguration managedRepositoryConfiguration = 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.isBlockRedeployments(), repository.isReleases(), repository.isSnapshots(),
repository.isStageRepoNeeded(), repository.getCronExpression() ); repository.isStageRepoNeeded(), repository.getCronExpression() );

View File

@ -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.JAXRSClientFactory;
import org.apache.cxf.jaxrs.client.ServerWebApplicationException; import org.apache.cxf.jaxrs.client.ServerWebApplicationException;
import org.apache.cxf.jaxrs.client.WebClient; import org.apache.cxf.jaxrs.client.WebClient;
import org.apache.maven.archiva.common.utils.FileUtil;
import org.junit.Test; import org.junit.Test;
import java.io.File;
import java.util.List; import java.util.List;
/** /**
@ -154,7 +156,8 @@ public class RepositoriesServiceTest
private ManagedRepository getTestManagedRepository() 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 * * * * ?" );
} }
} }