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 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 + '}';

View File

@ -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() );

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.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 * * * * ?" );
}
}