mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-12-22 08:19:47 +01:00
merge with branch 1.x
This commit is contained in:
@@ -50,12 +50,14 @@ import sonia.scm.repository.spi.GitRepositoryServiceProvider;
|
|||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import sonia.scm.store.ConfigurationStoreFactory;
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import sonia.scm.SCMContextProvider;
|
import sonia.scm.SCMContextProvider;
|
||||||
import sonia.scm.schedule.Scheduler;
|
import sonia.scm.schedule.Scheduler;
|
||||||
import sonia.scm.schedule.Task;
|
import sonia.scm.schedule.Task;
|
||||||
|
import sonia.scm.store.ConfigurationStoreFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -195,21 +197,17 @@ public class GitRepositoryHandler
|
|||||||
protected void create(Repository repository, File directory)
|
protected void create(Repository repository, File directory)
|
||||||
throws RepositoryException, IOException
|
throws RepositoryException, IOException
|
||||||
{
|
{
|
||||||
org.eclipse.jgit.lib.Repository gitRepository = null;
|
try (org.eclipse.jgit.lib.Repository gitRepository = build(directory)) {
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
gitRepository = new FileRepositoryBuilder().setGitDir(
|
|
||||||
directory).readEnvironment().findGitDir().build();
|
|
||||||
gitRepository.create(true);
|
gitRepository.create(true);
|
||||||
}
|
}
|
||||||
finally
|
|
||||||
{
|
|
||||||
if (gitRepository != null)
|
|
||||||
{
|
|
||||||
gitRepository.close();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private org.eclipse.jgit.lib.Repository build(File directory) throws IOException {
|
||||||
|
return new FileRepositoryBuilder()
|
||||||
|
.setGitDir(directory)
|
||||||
|
.readEnvironment()
|
||||||
|
.findGitDir()
|
||||||
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -271,7 +271,7 @@ public class GitBrowseCommand extends AbstractGitCommand
|
|||||||
walk.markStart(commit);
|
walk.markStart(commit);
|
||||||
result = Util.getFirst(walk);
|
result = Util.getFirst(walk);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (IOException ex)
|
||||||
{
|
{
|
||||||
logger.error("could not parse commit for file", ex);
|
logger.error("could not parse commit for file", ex);
|
||||||
}
|
}
|
||||||
@@ -417,12 +417,9 @@ public class GitBrowseCommand extends AbstractGitCommand
|
|||||||
revision);
|
revision);
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<String, SubRepository> subRepositories = null;
|
Map<String, SubRepository> subRepositories;
|
||||||
ByteArrayOutputStream baos = null;
|
try ( ByteArrayOutputStream baos = new ByteArrayOutputStream() )
|
||||||
|
|
||||||
try
|
|
||||||
{
|
{
|
||||||
baos = new ByteArrayOutputStream();
|
|
||||||
new GitCatCommand(context, repository).getContent(repo, revision,
|
new GitCatCommand(context, repository).getContent(repo, revision,
|
||||||
PATH_MODULES, baos);
|
PATH_MODULES, baos);
|
||||||
subRepositories = GitSubModuleParser.parse(baos.toString());
|
subRepositories = GitSubModuleParser.parse(baos.toString());
|
||||||
@@ -431,8 +428,6 @@ public class GitBrowseCommand extends AbstractGitCommand
|
|||||||
{
|
{
|
||||||
logger.trace("could not find .gitmodules", ex);
|
logger.trace("could not find .gitmodules", ex);
|
||||||
subRepositories = Collections.EMPTY_MAP;
|
subRepositories = Collections.EMPTY_MAP;
|
||||||
} finally {
|
|
||||||
IOUtil.close(baos);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return subRepositories;
|
return subRepositories;
|
||||||
@@ -462,7 +457,6 @@ public class GitBrowseCommand extends AbstractGitCommand
|
|||||||
|
|
||||||
//~--- fields ---------------------------------------------------------------
|
//~--- fields ---------------------------------------------------------------
|
||||||
|
|
||||||
/** Field description */
|
/** sub repository cache */
|
||||||
private final Map<ObjectId, Map<String, SubRepository>> subrepositoryCache =
|
private final Map<ObjectId, Map<String, SubRepository>> subrepositoryCache = Maps.newHashMap();
|
||||||
Maps.newHashMap();
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,8 +35,6 @@ package sonia.scm.repository.client.spi;
|
|||||||
|
|
||||||
//~--- non-JDK imports --------------------------------------------------------
|
//~--- non-JDK imports --------------------------------------------------------
|
||||||
|
|
||||||
import com.google.common.io.Closeables;
|
|
||||||
|
|
||||||
import org.eclipse.jgit.api.Git;
|
import org.eclipse.jgit.api.Git;
|
||||||
import org.eclipse.jgit.api.errors.GitAPIException;
|
import org.eclipse.jgit.api.errors.GitAPIException;
|
||||||
import org.eclipse.jgit.revwalk.RevCommit;
|
import org.eclipse.jgit.revwalk.RevCommit;
|
||||||
@@ -48,7 +46,6 @@ import sonia.scm.repository.client.api.RepositoryClientException;
|
|||||||
//~--- JDK imports ------------------------------------------------------------
|
//~--- JDK imports ------------------------------------------------------------
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import sonia.scm.util.IOUtil;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -83,31 +80,17 @@ public class GitCommitCommand implements CommitCommand
|
|||||||
@Override
|
@Override
|
||||||
public Changeset commit(CommitRequest request) throws IOException
|
public Changeset commit(CommitRequest request) throws IOException
|
||||||
{
|
{
|
||||||
Changeset changeset = null;
|
try (GitChangesetConverter converter = new GitChangesetConverter(git.getRepository()))
|
||||||
GitChangesetConverter converter = null;
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
{
|
||||||
RevCommit commit = git.commit().setAuthor(
|
RevCommit commit = git.commit()
|
||||||
request.getAuthor().getName(),
|
.setAuthor(request.getAuthor().getName(), request.getAuthor().getMail())
|
||||||
request.getAuthor().getMail()).setMessage(
|
.setMessage(request.getMessage())
|
||||||
request.getMessage()).call();
|
.call();
|
||||||
|
|
||||||
converter = new GitChangesetConverter(git.getRepository());
|
return converter.createChangeset(commit);
|
||||||
|
} catch (GitAPIException ex) {
|
||||||
changeset = converter.createChangeset(commit);
|
throw new RepositoryClientException("could not commit changes to repository", ex);
|
||||||
}
|
}
|
||||||
catch (GitAPIException ex)
|
|
||||||
{
|
|
||||||
throw new RepositoryClientException(
|
|
||||||
"could not commit changes to repository", ex);
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
IOUtil.close(converter);
|
|
||||||
}
|
|
||||||
|
|
||||||
return changeset;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//~--- fields ---------------------------------------------------------------
|
//~--- fields ---------------------------------------------------------------
|
||||||
|
|||||||
@@ -105,13 +105,18 @@ public class GitRepositoryClientFactoryProvider
|
|||||||
{
|
{
|
||||||
Git git = null;
|
Git git = null;
|
||||||
|
|
||||||
CredentialsProvider credentialsProvider =
|
CredentialsProvider credentialsProvider = null;
|
||||||
new UsernamePasswordCredentialsProvider(username, password);
|
if ( username != null && password != null ) {
|
||||||
|
credentialsProvider = new UsernamePasswordCredentialsProvider(username, password);
|
||||||
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
git = Git.cloneRepository().setURI(url).setDirectory(
|
git = Git.cloneRepository()
|
||||||
workingCopy).setCredentialsProvider(credentialsProvider).call();
|
.setURI(url)
|
||||||
|
.setDirectory(workingCopy)
|
||||||
|
.setCredentialsProvider(credentialsProvider)
|
||||||
|
.call();
|
||||||
}
|
}
|
||||||
catch (GitAPIException ex)
|
catch (GitAPIException ex)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ package sonia.scm.repository.client.spi;
|
|||||||
//~--- non-JDK imports --------------------------------------------------------
|
//~--- non-JDK imports --------------------------------------------------------
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
|
import java.io.File;
|
||||||
|
|
||||||
import org.eclipse.jgit.api.Git;
|
import org.eclipse.jgit.api.Git;
|
||||||
import org.eclipse.jgit.transport.CredentialsProvider;
|
import org.eclipse.jgit.transport.CredentialsProvider;
|
||||||
@@ -188,6 +189,11 @@ public class GitRepositoryClientProvider extends RepositoryClientProvider
|
|||||||
return new GitTagCommand(git);
|
return new GitTagCommand(git);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public File getWorkingCopy() {
|
||||||
|
return git.getRepository().getDirectory();
|
||||||
|
}
|
||||||
|
|
||||||
//~--- fields ---------------------------------------------------------------
|
//~--- fields ---------------------------------------------------------------
|
||||||
|
|
||||||
/** Field description */
|
/** Field description */
|
||||||
|
|||||||
@@ -35,8 +35,6 @@ package sonia.scm.repository;
|
|||||||
|
|
||||||
//~--- non-JDK imports --------------------------------------------------------
|
//~--- non-JDK imports --------------------------------------------------------
|
||||||
|
|
||||||
import com.google.common.io.Closeables;
|
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
@@ -164,7 +162,7 @@ public class AbstractHgHandler
|
|||||||
*/
|
*/
|
||||||
protected Map<String, String> createEnvironment(String revision, String path)
|
protected Map<String, String> createEnvironment(String revision, String path)
|
||||||
{
|
{
|
||||||
Map<String, String> env = new HashMap<String, String>();
|
Map<String, String> env = new HashMap<>();
|
||||||
|
|
||||||
env.put(ENV_REVISION, HgUtil.getRevision(revision));
|
env.put(ENV_REVISION, HgUtil.getRevision(revision));
|
||||||
env.put(ENV_PATH, Util.nonNull(path));
|
env.put(ENV_PATH, Util.nonNull(path));
|
||||||
@@ -300,29 +298,15 @@ public class AbstractHgHandler
|
|||||||
throws IOException, RepositoryException
|
throws IOException, RepositoryException
|
||||||
{
|
{
|
||||||
Process p = createScriptProcess(script, extraEnv);
|
Process p = createScriptProcess(script, extraEnv);
|
||||||
T result = null;
|
|
||||||
InputStream input = null;
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
handleErrorStream(p.getErrorStream());
|
handleErrorStream(p.getErrorStream());
|
||||||
input = p.getInputStream();
|
try (InputStream input = p.getInputStream()) {
|
||||||
result =
|
return (T) handler.getJaxbContext().createUnmarshaller().unmarshal(input);
|
||||||
(T) handler.getJaxbContext().createUnmarshaller().unmarshal(input);
|
} catch (JAXBException ex) {
|
||||||
input.close();
|
|
||||||
}
|
|
||||||
catch (JAXBException ex)
|
|
||||||
{
|
|
||||||
logger.error("could not parse result", ex);
|
logger.error("could not parse result", ex);
|
||||||
|
|
||||||
throw new RepositoryException("could not parse result", ex);
|
throw new RepositoryException("could not parse result", ex);
|
||||||
}
|
}
|
||||||
finally
|
|
||||||
{
|
|
||||||
Closeables.close(input, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//~--- methods --------------------------------------------------------------
|
//~--- methods --------------------------------------------------------------
|
||||||
|
|||||||
@@ -34,7 +34,6 @@ package sonia.scm.repository;
|
|||||||
|
|
||||||
//~--- non-JDK imports --------------------------------------------------------
|
//~--- non-JDK imports --------------------------------------------------------
|
||||||
|
|
||||||
import com.google.common.io.Closeables;
|
|
||||||
import com.google.common.io.Resources;
|
import com.google.common.io.Resources;
|
||||||
|
|
||||||
import org.junit.Rule;
|
import org.junit.Rule;
|
||||||
@@ -109,20 +108,13 @@ public class HgWindowsPackageFixTest
|
|||||||
*/
|
*/
|
||||||
private File createHgBat(String number) throws IOException
|
private File createHgBat(String number) throws IOException
|
||||||
{
|
{
|
||||||
URL url =
|
URL url = Resources.getResource("sonia/scm/repository/hg.bat.".concat(number));
|
||||||
Resources.getResource("sonia/scm/repository/hg.bat.".concat(number));
|
|
||||||
File file = tempFolder.newFile(number);
|
File file = tempFolder.newFile(number);
|
||||||
FileOutputStream fos = null;
|
|
||||||
|
|
||||||
try
|
try (FileOutputStream fos = new FileOutputStream(file))
|
||||||
{
|
{
|
||||||
fos = new FileOutputStream(file);
|
|
||||||
Resources.copy(url, fos);
|
Resources.copy(url, fos);
|
||||||
}
|
}
|
||||||
finally
|
|
||||||
{
|
|
||||||
Closeables.close(fos, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
return file;
|
return file;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,7 +31,9 @@
|
|||||||
package sonia.scm.repository.client.spi;
|
package sonia.scm.repository.client.spi;
|
||||||
|
|
||||||
import com.aragost.javahg.Repository;
|
import com.aragost.javahg.Repository;
|
||||||
|
import com.aragost.javahg.commands.ExecutionException;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import sonia.scm.repository.client.api.RepositoryClientException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Mercurial implementation of the {@link PushCommand}.
|
* Mercurial implementation of the {@link PushCommand}.
|
||||||
@@ -55,7 +57,11 @@ public class HgPushCommand implements PushCommand
|
|||||||
{
|
{
|
||||||
com.aragost.javahg.commands.PushCommand cmd = com.aragost.javahg.commands.PushCommand.on(repository);
|
com.aragost.javahg.commands.PushCommand cmd = com.aragost.javahg.commands.PushCommand.on(repository);
|
||||||
cmd.cmdAppend("--new-branch");
|
cmd.cmdAppend("--new-branch");
|
||||||
|
try {
|
||||||
cmd.execute(url);
|
cmd.execute(url);
|
||||||
|
} catch (ExecutionException ex) {
|
||||||
|
throw new RepositoryClientException("push to repository failed", ex);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ package sonia.scm.repository.client.spi;
|
|||||||
|
|
||||||
import com.aragost.javahg.Repository;
|
import com.aragost.javahg.Repository;
|
||||||
import com.aragost.javahg.RepositoryConfiguration;
|
import com.aragost.javahg.RepositoryConfiguration;
|
||||||
|
import com.aragost.javahg.commands.ExecutionException;
|
||||||
import com.aragost.javahg.commands.PullCommand;
|
import com.aragost.javahg.commands.PullCommand;
|
||||||
import com.google.common.base.Strings;
|
import com.google.common.base.Strings;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
@@ -40,6 +41,7 @@ import java.net.URL;
|
|||||||
import sonia.scm.io.INIConfiguration;
|
import sonia.scm.io.INIConfiguration;
|
||||||
import sonia.scm.io.INIConfigurationWriter;
|
import sonia.scm.io.INIConfigurationWriter;
|
||||||
import sonia.scm.io.INISection;
|
import sonia.scm.io.INISection;
|
||||||
|
import sonia.scm.repository.client.api.RepositoryClientException;
|
||||||
import sonia.scm.util.IOUtil;
|
import sonia.scm.util.IOUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -53,19 +55,17 @@ public class HgRepositoryClientFactoryProvider implements RepositoryClientFactor
|
|||||||
private static final String TYPE = "hg";
|
private static final String TYPE = "hg";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public RepositoryClientProvider create(File main, File workingCopy) throws IOException
|
public RepositoryClientProvider create(File main, File workingCopy) throws IOException {
|
||||||
{
|
|
||||||
return create(main.toURI().toString(), null, null, workingCopy);
|
return create(main.toURI().toString(), null, null, workingCopy);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public RepositoryClientProvider create(String url, String username, String password, File workingCopy)
|
public RepositoryClientProvider create(String url, String username, String password, File workingCopy)
|
||||||
throws IOException
|
throws IOException {
|
||||||
{
|
|
||||||
RepositoryConfiguration configuration = new RepositoryConfiguration();
|
RepositoryConfiguration configuration = new RepositoryConfiguration();
|
||||||
String binary = IOUtil.search("hg");
|
String binary = IOUtil.search("hg");
|
||||||
if (Strings.isNullOrEmpty(binary)){
|
if (Strings.isNullOrEmpty(binary)){
|
||||||
throw new IOException("could not find mercurial binary (hg)");
|
throw new RepositoryClientException("could not find mercurial binary (hg)");
|
||||||
}
|
}
|
||||||
configuration.setHgBin(binary);
|
configuration.setHgBin(binary);
|
||||||
|
|
||||||
@@ -77,13 +77,18 @@ public class HgRepositoryClientFactoryProvider implements RepositoryClientFactor
|
|||||||
}
|
}
|
||||||
|
|
||||||
Repository repository = Repository.create(configuration, workingCopy);
|
Repository repository = Repository.create(configuration, workingCopy);
|
||||||
PullCommand.on(repository).execute(url);
|
try {
|
||||||
|
PullCommand command = PullCommand.on(repository);
|
||||||
|
command.cmdAppend("-u");
|
||||||
|
command.execute(url);
|
||||||
|
} catch (ExecutionException ex) {
|
||||||
|
throw new RepositoryClientException("failed to pull from remote repository", ex);
|
||||||
|
}
|
||||||
|
|
||||||
return new HgRepositoryClientProvider(repository, hgrc, url);
|
return new HgRepositoryClientProvider(repository, hgrc, url);
|
||||||
}
|
}
|
||||||
|
|
||||||
private File createHgrc(String url, String username, String password) throws IOException
|
private File createHgrc(String url, String username, String password) throws IOException {
|
||||||
{
|
|
||||||
URL repositoryUrl = new URL(url);
|
URL repositoryUrl = new URL(url);
|
||||||
|
|
||||||
INIConfiguration hgConfig = new INIConfiguration();
|
INIConfiguration hgConfig = new INIConfiguration();
|
||||||
@@ -101,8 +106,7 @@ public class HgRepositoryClientFactoryProvider implements RepositoryClientFactor
|
|||||||
);
|
);
|
||||||
authSection.setParameter(prefix + "schemes", repositoryUrl.getProtocol());
|
authSection.setParameter(prefix + "schemes", repositoryUrl.getProtocol());
|
||||||
authSection.setParameter(prefix + "username", username);
|
authSection.setParameter(prefix + "username", username);
|
||||||
if (!Strings.isNullOrEmpty(password))
|
if (!Strings.isNullOrEmpty(password)) {
|
||||||
{
|
|
||||||
authSection.setParameter(prefix + "password", password);
|
authSection.setParameter(prefix + "password", password);
|
||||||
}
|
}
|
||||||
hgConfig.addSection(authSection);
|
hgConfig.addSection(authSection);
|
||||||
@@ -114,8 +118,7 @@ public class HgRepositoryClientFactoryProvider implements RepositoryClientFactor
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getType()
|
public String getType() {
|
||||||
{
|
|
||||||
return TYPE;
|
return TYPE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -103,6 +103,11 @@ public class HgRepositoryClientProvider extends RepositoryClientProvider
|
|||||||
return new HgPushCommand(repository, url);
|
return new HgPushCommand(repository, url);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public File getWorkingCopy() {
|
||||||
|
return repository.getDirectory();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void close() throws IOException
|
public void close() throws IOException
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -113,11 +113,8 @@ public class SvnBrowseCommand extends AbstractSvnCommand
|
|||||||
String path = request.getPath();
|
String path = request.getPath();
|
||||||
long revisionNumber = SvnUtil.getRevisionNumber(request.getRevision());
|
long revisionNumber = SvnUtil.getRevisionNumber(request.getRevision());
|
||||||
|
|
||||||
if (logger.isDebugEnabled())
|
if (logger.isDebugEnabled()) {
|
||||||
{
|
logger.debug("browser repository {} in path {} at revision {}", repository.getName(), path, revisionNumber);
|
||||||
logger.debug("browser repository {} in path {} at revision {}",
|
|
||||||
new Object[] { repository.getName(),
|
|
||||||
path, revisionNumber });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BrowserResult result = null;
|
BrowserResult result = null;
|
||||||
|
|||||||
@@ -32,7 +32,6 @@ package sonia.scm.repository.client.spi;
|
|||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.tmatesoft.svn.core.SVNCommitInfo;
|
import org.tmatesoft.svn.core.SVNCommitInfo;
|
||||||
@@ -46,8 +45,10 @@ import org.tmatesoft.svn.core.wc2.SvnCommit;
|
|||||||
import org.tmatesoft.svn.core.wc2.SvnLog;
|
import org.tmatesoft.svn.core.wc2.SvnLog;
|
||||||
import org.tmatesoft.svn.core.wc2.SvnRevisionRange;
|
import org.tmatesoft.svn.core.wc2.SvnRevisionRange;
|
||||||
import org.tmatesoft.svn.core.wc2.SvnTarget;
|
import org.tmatesoft.svn.core.wc2.SvnTarget;
|
||||||
|
|
||||||
import sonia.scm.repository.Changeset;
|
import sonia.scm.repository.Changeset;
|
||||||
import sonia.scm.repository.SvnUtil;
|
import sonia.scm.repository.SvnUtil;
|
||||||
|
import sonia.scm.repository.client.api.RepositoryClientException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -71,18 +72,14 @@ public class SvnCommitCommand implements CommitCommand {
|
|||||||
public Changeset commit(CommitRequest request) throws IOException {
|
public Changeset commit(CommitRequest request) throws IOException {
|
||||||
SVNWCClient wClient = client.getWCClient();
|
SVNWCClient wClient = client.getWCClient();
|
||||||
|
|
||||||
List<File> filesToCommit = new ArrayList<>();
|
|
||||||
|
|
||||||
// add files
|
// add files
|
||||||
try {
|
try {
|
||||||
wClient.doAdd(addedFiles.toArray(new File[0]), true, false, false,
|
wClient.doAdd(addedFiles.toArray(new File[0]), true, false, false,
|
||||||
SVNDepth.INFINITY, false, false, false);
|
SVNDepth.INFINITY, false, false, false);
|
||||||
|
|
||||||
filesToCommit.addAll(addedFiles);
|
|
||||||
addedFiles.clear();
|
addedFiles.clear();
|
||||||
|
|
||||||
} catch (SVNException ex) {
|
} catch (SVNException ex) {
|
||||||
throw new IOException("failed to add files", ex);
|
throw new RepositoryClientException("failed to add files", ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
// remove files
|
// remove files
|
||||||
@@ -92,19 +89,15 @@ public class SvnCommitCommand implements CommitCommand {
|
|||||||
File file = removeIt.next();
|
File file = removeIt.next();
|
||||||
wClient.doDelete(file, false, true, false);
|
wClient.doDelete(file, false, true, false);
|
||||||
removeIt.remove();
|
removeIt.remove();
|
||||||
filesToCommit.add(file);
|
|
||||||
}
|
}
|
||||||
} catch (SVNException ex) {
|
} catch (SVNException ex) {
|
||||||
throw new IOException("failed to remove files", ex);
|
throw new RepositoryClientException("failed to remove files", ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
SvnTarget workingCopyTarget = SvnTarget.fromFile(workingCopy);
|
SvnTarget workingCopyTarget = SvnTarget.fromFile(workingCopy);
|
||||||
Changeset changeset;
|
Changeset changeset;
|
||||||
SVNCommitInfo info;
|
SVNCommitInfo info;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// commit files
|
// commit files
|
||||||
try {
|
try {
|
||||||
SvnCommit commit = client.getOperationFactory().createCommit();
|
SvnCommit commit = client.getOperationFactory().createCommit();
|
||||||
@@ -120,7 +113,7 @@ public class SvnCommitCommand implements CommitCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
} catch (SVNException ex) {
|
} catch (SVNException ex) {
|
||||||
throw new IOException("failed to commit", ex);
|
throw new RepositoryClientException("failed to commit", ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
// get log for commit
|
// get log for commit
|
||||||
@@ -133,7 +126,7 @@ public class SvnCommitCommand implements CommitCommand {
|
|||||||
|
|
||||||
changeset = SvnUtil.createChangeset(log.run());
|
changeset = SvnUtil.createChangeset(log.run());
|
||||||
} catch (SVNException ex) {
|
} catch (SVNException ex) {
|
||||||
throw new IOException("failed to create log entry for last commit", ex);
|
throw new RepositoryClientException("failed to create log entry for last commit", ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
return changeset;
|
return changeset;
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ import org.tmatesoft.svn.core.wc.SVNUpdateClient;
|
|||||||
import org.tmatesoft.svn.core.wc.SVNWCUtil;
|
import org.tmatesoft.svn.core.wc.SVNWCUtil;
|
||||||
import org.tmatesoft.svn.core.wc2.SvnOperationFactory;
|
import org.tmatesoft.svn.core.wc2.SvnOperationFactory;
|
||||||
import sonia.scm.repository.SvnRepositoryHandler;
|
import sonia.scm.repository.SvnRepositoryHandler;
|
||||||
|
import sonia.scm.repository.client.api.RepositoryClientException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Client provider factory for subversion.
|
* Client provider factory for subversion.
|
||||||
@@ -60,7 +61,7 @@ public class SvnRepositoryClientFactoryProvider implements RepositoryClientFacto
|
|||||||
try {
|
try {
|
||||||
source = SVNURL.fromFile(workingCopy);
|
source = SVNURL.fromFile(workingCopy);
|
||||||
} catch (SVNException ex) {
|
} catch (SVNException ex) {
|
||||||
throw new IOException("failed to parse svn url", ex);
|
throw new RepositoryClientException("failed to parse svn url", ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
// create client
|
// create client
|
||||||
@@ -69,11 +70,11 @@ public class SvnRepositoryClientFactoryProvider implements RepositoryClientFacto
|
|||||||
try {
|
try {
|
||||||
updateClient.doCheckout(source, workingCopy, SVNRevision.HEAD, SVNRevision.HEAD, SVNDepth.INFINITY, true);
|
updateClient.doCheckout(source, workingCopy, SVNRevision.HEAD, SVNRevision.HEAD, SVNDepth.INFINITY, true);
|
||||||
} catch (SVNException ex) {
|
} catch (SVNException ex) {
|
||||||
throw new IOException("failed to checkout repository", ex);
|
throw new RepositoryClientException("failed to checkout repository", ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
// return client provider
|
// return client provider
|
||||||
return new SvnRepositoryClientProvider(client, source, workingCopy);
|
return new SvnRepositoryClientProvider(client, workingCopy);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -101,7 +102,7 @@ public class SvnRepositoryClientFactoryProvider implements RepositoryClientFacto
|
|||||||
try {
|
try {
|
||||||
remoteUrl = SVNURL.parseURIEncoded(url);
|
remoteUrl = SVNURL.parseURIEncoded(url);
|
||||||
} catch (SVNException ex) {
|
} catch (SVNException ex) {
|
||||||
throw new IOException("failed to parse svn url", ex);
|
throw new RepositoryClientException("failed to parse svn url", ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
// initial checkout
|
// initial checkout
|
||||||
@@ -109,11 +110,11 @@ public class SvnRepositoryClientFactoryProvider implements RepositoryClientFacto
|
|||||||
try {
|
try {
|
||||||
updateClient.doCheckout(remoteUrl, workingCopy, SVNRevision.HEAD, SVNRevision.HEAD, SVNDepth.INFINITY, true);
|
updateClient.doCheckout(remoteUrl, workingCopy, SVNRevision.HEAD, SVNRevision.HEAD, SVNDepth.INFINITY, true);
|
||||||
} catch (SVNException ex) {
|
} catch (SVNException ex) {
|
||||||
throw new IOException("failed to checkout repository", ex);
|
throw new RepositoryClientException("failed to checkout repository", ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
// return client provider
|
// return client provider
|
||||||
return new SvnRepositoryClientProvider(client, remoteUrl, workingCopy);
|
return new SvnRepositoryClientProvider(client, workingCopy);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -52,15 +52,13 @@ public class SvnRepositoryClientProvider extends RepositoryClientProvider {
|
|||||||
);
|
);
|
||||||
|
|
||||||
private final SVNClientManager client;
|
private final SVNClientManager client;
|
||||||
private final SVNURL remoteRepositoryURL;
|
|
||||||
private final File workingCopy;
|
private final File workingCopy;
|
||||||
|
|
||||||
private final List<File> addedFiles = new ArrayList<>();
|
private final List<File> addedFiles = new ArrayList<>();
|
||||||
private final List<File> removedFiles = new ArrayList<>();
|
private final List<File> removedFiles = new ArrayList<>();
|
||||||
|
|
||||||
SvnRepositoryClientProvider(SVNClientManager client, SVNURL remoteRepositoryURL, File workingCopy) {
|
SvnRepositoryClientProvider(SVNClientManager client, File workingCopy) {
|
||||||
this.client = client;
|
this.client = client;
|
||||||
this.remoteRepositoryURL = remoteRepositoryURL;
|
|
||||||
this.workingCopy = workingCopy;
|
this.workingCopy = workingCopy;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -79,6 +77,11 @@ public class SvnRepositoryClientProvider extends RepositoryClientProvider {
|
|||||||
return new SvnCommitCommand(client, workingCopy, addedFiles, removedFiles);
|
return new SvnCommitCommand(client, workingCopy, addedFiles, removedFiles);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public File getWorkingCopy() {
|
||||||
|
return workingCopy;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Set<ClientCommand> getSupportedClientCommands() {
|
public Set<ClientCommand> getSupportedClientCommands() {
|
||||||
return SUPPORTED_COMMANDS;
|
return SUPPORTED_COMMANDS;
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ import sonia.scm.util.IOUtil;
|
|||||||
//~--- JDK imports ------------------------------------------------------------
|
//~--- JDK imports ------------------------------------------------------------
|
||||||
|
|
||||||
import java.io.Closeable;
|
import java.io.Closeable;
|
||||||
|
import java.io.File;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -188,6 +189,16 @@ public final class RepositoryClient implements Closeable
|
|||||||
return new TagCommandBuilder(clientProvider.getTagCommand());
|
return new TagCommandBuilder(clientProvider.getTagCommand());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the working copy of the repository.
|
||||||
|
*
|
||||||
|
* @return working copy
|
||||||
|
* @since 1.51
|
||||||
|
*/
|
||||||
|
public File getWorkingCopy() {
|
||||||
|
return clientProvider.getWorkingCopy();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method description
|
* Method description
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ import sonia.scm.repository.client.api.ClientCommandNotSupportedException;
|
|||||||
//~--- JDK imports ------------------------------------------------------------
|
//~--- JDK imports ------------------------------------------------------------
|
||||||
|
|
||||||
import java.io.Closeable;
|
import java.io.Closeable;
|
||||||
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
@@ -138,4 +139,12 @@ public abstract class RepositoryClientProvider implements Closeable
|
|||||||
{
|
{
|
||||||
throw new ClientCommandNotSupportedException(ClientCommand.TAG);
|
throw new ClientCommandNotSupportedException(ClientCommand.TAG);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the working copy of the repository client.
|
||||||
|
*
|
||||||
|
* @return working copy
|
||||||
|
* @since 1.51
|
||||||
|
*/
|
||||||
|
public abstract File getWorkingCopy();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,9 +51,6 @@ import sonia.scm.repository.Permission;
|
|||||||
import sonia.scm.repository.PermissionType;
|
import sonia.scm.repository.PermissionType;
|
||||||
import sonia.scm.repository.Repository;
|
import sonia.scm.repository.Repository;
|
||||||
import sonia.scm.repository.RepositoryTestData;
|
import sonia.scm.repository.RepositoryTestData;
|
||||||
import sonia.scm.repository.client.RepositoryClient;
|
|
||||||
import sonia.scm.repository.client.RepositoryClientException;
|
|
||||||
import sonia.scm.repository.client.RepositoryClientFactory;
|
|
||||||
|
|
||||||
import static org.junit.Assert.*;
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
@@ -68,10 +65,14 @@ import com.sun.jersey.api.client.WebResource;
|
|||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import org.junit.Ignore;
|
import org.junit.Ignore;
|
||||||
|
|
||||||
|
import sonia.scm.repository.client.api.RepositoryClient;
|
||||||
|
import sonia.scm.repository.client.api.RepositoryClientFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author Sebastian Sdorra
|
* @author Sebastian Sdorra
|
||||||
@@ -185,39 +186,58 @@ public class AnonymousAccessITCase
|
|||||||
logoutClient(client);
|
logoutClient(client);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method description
|
||||||
|
*
|
||||||
|
* @throws IOException
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
@Ignore
|
||||||
|
public void testAllowedAnonymousPush() throws IOException
|
||||||
|
{
|
||||||
|
Client client = createAdminClient();
|
||||||
|
WebResource resource = createResource(client,
|
||||||
|
"repository/".concat(repository.getId()));
|
||||||
|
|
||||||
|
repository.setPermissions(Arrays.asList(PERMISSION_ANONYMOUS_WRITE));
|
||||||
|
resource.post(ClientResponse.class, repository);
|
||||||
|
|
||||||
|
RepositoryClient repositoryClient = createAnonymousRepositoryClient();
|
||||||
|
|
||||||
|
createRandomFile(repositoryClient);
|
||||||
|
commit(repositoryClient, "added test files");
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method description
|
* Method description
|
||||||
*
|
*
|
||||||
* TODO fix test case
|
* TODO fix test case
|
||||||
*
|
*
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
* @throws RepositoryClientException
|
|
||||||
*/
|
*/
|
||||||
@Test @Ignore
|
@Test @Ignore
|
||||||
public void testAnonymousClone() throws RepositoryClientException, IOException
|
public void testAnonymousClone() throws IOException
|
||||||
{
|
{
|
||||||
testSimpleAdminPush();
|
testSimpleAdminPush();
|
||||||
|
|
||||||
RepositoryClient client = createAnonymousRepositoryClient();
|
RepositoryClient client = createAnonymousRepositoryClient();
|
||||||
|
|
||||||
client.checkout();
|
// client.checkout();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method description
|
* Method description
|
||||||
*
|
*
|
||||||
*
|
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
* @throws RepositoryClientException
|
|
||||||
*/
|
*/
|
||||||
@Test(expected = RepositoryClientException.class)
|
@Ignore
|
||||||
public void testDeniedAnonymousPush()
|
@Test(expected = IOException.class)
|
||||||
throws IOException, RepositoryClientException
|
public void testDeniedAnonymousPush() throws IOException
|
||||||
{
|
{
|
||||||
RepositoryClient repositoryClient = createAnonymousRepositoryClient();
|
RepositoryClient repositoryClient = createAnonymousRepositoryClient();
|
||||||
|
|
||||||
createRandomFile(repositoryClient);
|
createRandomFile(repositoryClient);
|
||||||
repositoryClient.commit("added anonymous test file");
|
commit(repositoryClient, "added anonymous test file");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -225,83 +245,30 @@ public class AnonymousAccessITCase
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
* @throws RepositoryClientException
|
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testSimpleAdminPush()
|
public void testSimpleAdminPush() throws IOException
|
||||||
throws RepositoryClientException, IOException
|
|
||||||
{
|
{
|
||||||
RepositoryClient client = createAdminRepositoryClient();
|
RepositoryClient repositoryClient = createAdminRepositoryClient();
|
||||||
|
|
||||||
createRandomFile(client);
|
createRandomFile(repositoryClient);
|
||||||
client.commit("added random file");
|
commit(repositoryClient, "added random file");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
private RepositoryClient createAdminRepositoryClient() throws IOException {
|
||||||
* Method description
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*
|
|
||||||
* @throws IOException
|
|
||||||
* @throws RepositoryClientException
|
|
||||||
*/
|
|
||||||
private RepositoryClient createAdminRepositoryClient()
|
|
||||||
throws IOException, RepositoryClientException
|
|
||||||
{
|
|
||||||
return createRepositoryClient(ADMIN_USERNAME, ADMIN_PASSWORD);
|
return createRepositoryClient(ADMIN_USERNAME, ADMIN_PASSWORD);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
private RepositoryClient createAnonymousRepositoryClient() throws IOException {
|
||||||
* Method description
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*
|
|
||||||
* @throws IOException
|
|
||||||
* @throws RepositoryClientException
|
|
||||||
*/
|
|
||||||
private RepositoryClient createAnonymousRepositoryClient()
|
|
||||||
throws IOException, RepositoryClientException
|
|
||||||
{
|
|
||||||
return createRepositoryClient(null, null);
|
return createRepositoryClient(null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
private RepositoryClient createRepositoryClient(String username, String password) throws IOException {
|
||||||
* Method description
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @param username
|
|
||||||
* @param password
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*
|
|
||||||
* @throws IOException
|
|
||||||
* @throws RepositoryClientException
|
|
||||||
*/
|
|
||||||
private RepositoryClient createRepositoryClient(String username,
|
|
||||||
String password)
|
|
||||||
throws IOException, RepositoryClientException
|
|
||||||
{
|
|
||||||
File directory = temporaryFolder.newFolder();
|
File directory = temporaryFolder.newFolder();
|
||||||
RepositoryClient client = null;
|
String remoteUrl = repository.createUrl(BASE_URL);
|
||||||
|
|
||||||
String url = repository.createUrl(BASE_URL);
|
RepositoryClientFactory factory = new RepositoryClientFactory();
|
||||||
|
return factory.create(repositoryType, remoteUrl, username, password, directory);
|
||||||
if ((username != null) && (password != null))
|
|
||||||
{
|
|
||||||
client = RepositoryClientFactory.createClient(repositoryType, directory,
|
|
||||||
url, username, password);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
client = RepositoryClientFactory.createClient(repositoryType, directory,
|
|
||||||
url);
|
|
||||||
}
|
|
||||||
|
|
||||||
client.init();
|
|
||||||
|
|
||||||
return client;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//~--- fields ---------------------------------------------------------------
|
//~--- fields ---------------------------------------------------------------
|
||||||
@@ -314,5 +281,5 @@ public class AnonymousAccessITCase
|
|||||||
private Repository repository;
|
private Repository repository;
|
||||||
|
|
||||||
/** Field description */
|
/** Field description */
|
||||||
private String repositoryType;
|
private final String repositoryType;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,9 +47,7 @@ import sonia.scm.repository.ChangesetPagingResult;
|
|||||||
import sonia.scm.repository.Modifications;
|
import sonia.scm.repository.Modifications;
|
||||||
import sonia.scm.repository.Repository;
|
import sonia.scm.repository.Repository;
|
||||||
import sonia.scm.repository.RepositoryTestData;
|
import sonia.scm.repository.RepositoryTestData;
|
||||||
import sonia.scm.repository.client.RepositoryClient;
|
|
||||||
import sonia.scm.repository.client.RepositoryClientException;
|
|
||||||
import sonia.scm.repository.client.RepositoryClientFactory;
|
|
||||||
import sonia.scm.util.IOUtil;
|
import sonia.scm.util.IOUtil;
|
||||||
|
|
||||||
import static org.hamcrest.Matchers.*;
|
import static org.hamcrest.Matchers.*;
|
||||||
@@ -72,6 +70,9 @@ import java.util.Collection;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
|
import sonia.scm.repository.client.api.RepositoryClient;
|
||||||
|
import sonia.scm.repository.client.api.RepositoryClientFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author Sebastian Sdorra
|
* @author Sebastian Sdorra
|
||||||
@@ -111,15 +112,13 @@ public class ChangesetViewerITCase extends AbstractAdminITCaseBase
|
|||||||
*
|
*
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
* @throws InterruptedException
|
* @throws InterruptedException
|
||||||
* @throws RepositoryClientException
|
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void cachingTest()
|
public void cachingTest() throws IOException, InterruptedException
|
||||||
throws RepositoryClientException, IOException, InterruptedException
|
|
||||||
{
|
{
|
||||||
RepositoryClient rc = createRepositoryClient();
|
RepositoryClient rc = createRepositoryClient();
|
||||||
|
|
||||||
rc.checkout();
|
// rc.checkout();
|
||||||
addTestFile(rc, "a", 1, false);
|
addTestFile(rc, "a", 1, false);
|
||||||
addTestFile(rc, "b", 2, true);
|
addTestFile(rc, "b", 2, true);
|
||||||
}
|
}
|
||||||
@@ -159,15 +158,13 @@ public class ChangesetViewerITCase extends AbstractAdminITCaseBase
|
|||||||
*
|
*
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
* @throws InterruptedException
|
* @throws InterruptedException
|
||||||
* @throws RepositoryClientException
|
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void simpleTest()
|
public void simpleTest() throws IOException, InterruptedException
|
||||||
throws RepositoryClientException, IOException, InterruptedException
|
|
||||||
{
|
{
|
||||||
RepositoryClient rc = createRepositoryClient();
|
RepositoryClient rc = createRepositoryClient();
|
||||||
|
|
||||||
rc.init();
|
// rc.init();
|
||||||
addTestFile(rc, "a", 1, false);
|
addTestFile(rc, "a", 1, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -186,29 +183,24 @@ public class ChangesetViewerITCase extends AbstractAdminITCaseBase
|
|||||||
*/
|
*/
|
||||||
private void addTestFile(RepositoryClient rc, String name, int count,
|
private void addTestFile(RepositoryClient rc, String name, int count,
|
||||||
boolean sleep)
|
boolean sleep)
|
||||||
throws IOException, RepositoryClientException, InterruptedException
|
throws IOException, InterruptedException
|
||||||
{
|
{
|
||||||
File file = new File(localDirectory, name.concat(".txt"));
|
File file = new File(localDirectory, name.concat(".txt"));
|
||||||
|
|
||||||
writeRandomContent(file);
|
writeRandomContent(file);
|
||||||
rc.add(name.concat(".txt"));
|
rc.getAddCommand().add(name.concat(".txt"));
|
||||||
rc.commit("added-".concat(name).concat(".txt"));
|
IntegrationTestUtil.commit(rc, "added-".concat(name).concat(".txt"));
|
||||||
|
|
||||||
if (sleep)
|
|
||||||
{
|
|
||||||
|
|
||||||
|
if (sleep) {
|
||||||
// cache clear is async
|
// cache clear is async
|
||||||
Thread.sleep(500l);
|
Thread.sleep(500l);
|
||||||
}
|
}
|
||||||
|
|
||||||
ChangesetPagingResult cpr = getChangesets(repository);
|
ChangesetPagingResult cpr = getChangesets(repository);
|
||||||
|
|
||||||
if ("svn".equals(repositoryType))
|
if ("svn".equals(repositoryType)) {
|
||||||
{
|
|
||||||
assertEquals((count + 1), cpr.getTotal());
|
assertEquals((count + 1), cpr.getTotal());
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
assertEquals(count, cpr.getTotal());
|
assertEquals(count, cpr.getTotal());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -216,12 +208,9 @@ public class ChangesetViewerITCase extends AbstractAdminITCaseBase
|
|||||||
|
|
||||||
assertNotNull(changesets);
|
assertNotNull(changesets);
|
||||||
|
|
||||||
if ("svn".equals(repositoryType))
|
if ("svn".equals(repositoryType)) {
|
||||||
{
|
|
||||||
assertEquals((count + 1), changesets.size());
|
assertEquals((count + 1), changesets.size());
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
assertEquals(count, changesets.size());
|
assertEquals(count, changesets.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -251,75 +240,32 @@ public class ChangesetViewerITCase extends AbstractAdminITCaseBase
|
|||||||
//J+
|
//J+
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
private RepositoryClient createRepositoryClient() throws IOException {
|
||||||
* Method description
|
RepositoryClientFactory factory = new RepositoryClientFactory();
|
||||||
*
|
return factory.create(
|
||||||
*
|
repositoryType, repository.createUrl(BASE_URL),
|
||||||
* @return
|
IntegrationTestUtil.ADMIN_USERNAME, IntegrationTestUtil.ADMIN_PASSWORD,
|
||||||
*
|
localDirectory
|
||||||
* @throws RepositoryClientException
|
);
|
||||||
*/
|
|
||||||
private RepositoryClient createRepositoryClient()
|
|
||||||
throws RepositoryClientException
|
|
||||||
{
|
|
||||||
return RepositoryClientFactory.createClient(repositoryType, localDirectory,
|
|
||||||
repository.createUrl(BASE_URL), IntegrationTestUtil.ADMIN_USERNAME,
|
|
||||||
IntegrationTestUtil.ADMIN_PASSWORD);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
private void writeRandomContent(File file) throws IOException {
|
||||||
* Method description
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @param file
|
|
||||||
*
|
|
||||||
* @throws IOException
|
|
||||||
*/
|
|
||||||
private void writeRandomContent(File file) throws IOException
|
|
||||||
{
|
|
||||||
FileOutputStream output = null;
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
output = new FileOutputStream(file);
|
|
||||||
|
|
||||||
Random random = new Random();
|
Random random = new Random();
|
||||||
byte[] data = new byte[random.nextInt(1024)];
|
byte[] data = new byte[random.nextInt(1024)];
|
||||||
|
|
||||||
|
try (FileOutputStream output = new FileOutputStream(file)) {
|
||||||
random.nextBytes(data);
|
random.nextBytes(data);
|
||||||
output.write(data);
|
output.write(data);
|
||||||
}
|
}
|
||||||
finally
|
|
||||||
{
|
|
||||||
IOUtil.close(output);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//~--- get methods ----------------------------------------------------------
|
//~--- get methods ----------------------------------------------------------
|
||||||
|
|
||||||
/**
|
private String getChangesetViewerUri(Repository repository) {
|
||||||
* Method description
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @param repository
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
private String getChangesetViewerUri(Repository repository)
|
|
||||||
{
|
|
||||||
return "repositories/".concat(repository.getId()).concat("/changesets");
|
return "repositories/".concat(repository.getId()).concat("/changesets");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
private ChangesetPagingResult getChangesets(Repository repository) {
|
||||||
* Method description
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @param repository
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
private ChangesetPagingResult getChangesets(Repository repository)
|
|
||||||
{
|
|
||||||
WebResource resource = createResource(client,
|
WebResource resource = createResource(client,
|
||||||
getChangesetViewerUri(repository));
|
getChangesetViewerUri(repository));
|
||||||
|
|
||||||
@@ -346,5 +292,5 @@ public class ChangesetViewerITCase extends AbstractAdminITCaseBase
|
|||||||
private Repository repository;
|
private Repository repository;
|
||||||
|
|
||||||
/** Field description */
|
/** Field description */
|
||||||
private String repositoryType;
|
private final String repositoryType;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,8 +37,6 @@ package sonia.scm.it;
|
|||||||
|
|
||||||
import sonia.scm.ScmState;
|
import sonia.scm.ScmState;
|
||||||
import sonia.scm.Type;
|
import sonia.scm.Type;
|
||||||
import sonia.scm.repository.client.RepositoryClient;
|
|
||||||
import sonia.scm.repository.client.RepositoryClientException;
|
|
||||||
import sonia.scm.user.User;
|
import sonia.scm.user.User;
|
||||||
import sonia.scm.util.IOUtil;
|
import sonia.scm.util.IOUtil;
|
||||||
|
|
||||||
@@ -64,6 +62,9 @@ import java.util.Collection;
|
|||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import javax.ws.rs.core.MultivaluedMap;
|
import javax.ws.rs.core.MultivaluedMap;
|
||||||
|
import sonia.scm.repository.Person;
|
||||||
|
import sonia.scm.repository.client.api.ClientCommand;
|
||||||
|
import sonia.scm.repository.client.api.RepositoryClient;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -72,6 +73,8 @@ import javax.ws.rs.core.MultivaluedMap;
|
|||||||
public final class IntegrationTestUtil
|
public final class IntegrationTestUtil
|
||||||
{
|
{
|
||||||
|
|
||||||
|
public static final Person AUTHOR = new Person("SCM Administrator", "scmadmin@scm-manager.org");
|
||||||
|
|
||||||
/** Field description */
|
/** Field description */
|
||||||
public static final String ADMIN_PASSWORD = "scmadmin";
|
public static final String ADMIN_PASSWORD = "scmadmin";
|
||||||
|
|
||||||
@@ -182,34 +185,41 @@ public final class IntegrationTestUtil
|
|||||||
return ApacheHttpClient.create(config);
|
return ApacheHttpClient.create(config);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Commit and push changes.
|
||||||
|
*
|
||||||
|
* @param repositoryClient repository client
|
||||||
|
* @param message commit message
|
||||||
|
*
|
||||||
|
* @throws IOException
|
||||||
|
*
|
||||||
|
* @since 1.51
|
||||||
|
*/
|
||||||
|
public static void commit(RepositoryClient repositoryClient, String message) throws IOException {
|
||||||
|
repositoryClient.getCommitCommand().commit(IntegrationTestUtil.AUTHOR, message);
|
||||||
|
if ( repositoryClient.isCommandSupported(ClientCommand.PUSH) ) {
|
||||||
|
repositoryClient.getPushCommand().push();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method description
|
* Method description
|
||||||
*
|
*
|
||||||
*
|
|
||||||
*
|
|
||||||
* @param client
|
* @param client
|
||||||
*
|
*
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
* @throws RepositoryClientException
|
|
||||||
*/
|
*/
|
||||||
public static void createRandomFile(RepositoryClient client)
|
public static void createRandomFile(RepositoryClient client) throws IOException
|
||||||
throws IOException, RepositoryClientException
|
|
||||||
{
|
{
|
||||||
String uuid = UUID.randomUUID().toString();
|
String uuid = UUID.randomUUID().toString();
|
||||||
String name = "file-" + uuid + ".uuid";
|
String name = "file-" + uuid + ".uuid";
|
||||||
FileOutputStream out = null;
|
|
||||||
|
|
||||||
try
|
File file = new File(client.getWorkingCopy(), name);
|
||||||
{
|
try (FileOutputStream out = new FileOutputStream(file)) {
|
||||||
out = new FileOutputStream(new File(client.getLocalRepository(), name));
|
|
||||||
out.write(uuid.getBytes());
|
out.write(uuid.getBytes());
|
||||||
}
|
}
|
||||||
finally
|
|
||||||
{
|
|
||||||
IOUtil.close(out);
|
|
||||||
}
|
|
||||||
|
|
||||||
client.add(name);
|
client.getAddCommand().add(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -220,7 +230,7 @@ public final class IntegrationTestUtil
|
|||||||
*/
|
*/
|
||||||
public static Collection<String[]> createRepositoryTypeParameters()
|
public static Collection<String[]> createRepositoryTypeParameters()
|
||||||
{
|
{
|
||||||
Collection<String[]> params = new ArrayList<String[]>();
|
Collection<String[]> params = new ArrayList<>();
|
||||||
|
|
||||||
params.add(new String[] { "git" });
|
params.add(new String[] { "git" });
|
||||||
params.add(new String[] { "svn" });
|
params.add(new String[] { "svn" });
|
||||||
|
|||||||
@@ -42,8 +42,6 @@ import org.junit.runner.RunWith;
|
|||||||
import org.junit.runners.Parameterized;
|
import org.junit.runners.Parameterized;
|
||||||
|
|
||||||
import sonia.scm.repository.Repository;
|
import sonia.scm.repository.Repository;
|
||||||
import sonia.scm.repository.client.RepositoryClient;
|
|
||||||
import sonia.scm.repository.client.RepositoryClientException;
|
|
||||||
import sonia.scm.user.User;
|
import sonia.scm.user.User;
|
||||||
import sonia.scm.util.IOUtil;
|
import sonia.scm.util.IOUtil;
|
||||||
|
|
||||||
@@ -56,6 +54,9 @@ import static sonia.scm.it.IntegrationTestUtil.*;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
|
import sonia.scm.repository.client.api.RepositoryClient;
|
||||||
|
import sonia.scm.repository.client.api.RepositoryClientException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author Sebastian Sdorra
|
* @author Sebastian Sdorra
|
||||||
@@ -100,14 +101,14 @@ public class RepositoryExtendedITCase extends RepositoryITCaseBase
|
|||||||
* Method description
|
* Method description
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* @throws RepositoryClientException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
@Test(expected = RepositoryClientException.class)
|
@Test(expected = RepositoryClientException.class)
|
||||||
public void readFailed() throws RepositoryClientException
|
public void readFailed() throws IOException
|
||||||
{
|
{
|
||||||
RepositoryClient rc = createRepositoryClient(nopermUser, directory);
|
RepositoryClient rc = createRepositoryClient(nopermUser, directory);
|
||||||
|
|
||||||
rc.checkout();
|
// rc.checkout();
|
||||||
|
|
||||||
// ugly workaround
|
// ugly workaround
|
||||||
if (repository.getType().equals("git"))
|
if (repository.getType().equals("git"))
|
||||||
@@ -120,7 +121,7 @@ public class RepositoryExtendedITCase extends RepositoryITCaseBase
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new RepositoryClientException("checkout failed");
|
throw new IOException("checkout failed");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -139,47 +140,40 @@ public class RepositoryExtendedITCase extends RepositoryITCaseBase
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
* @throws RepositoryClientException
|
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void simpleRead() throws RepositoryClientException, IOException
|
public void simpleRead() throws IOException
|
||||||
{
|
{
|
||||||
RepositoryClient rc = createRepositoryClient(readUser, directory);
|
RepositoryClient rc = createRepositoryClient(readUser, directory);
|
||||||
|
|
||||||
rc.checkout();
|
// rc.checkout();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method description
|
* Method description
|
||||||
*
|
*
|
||||||
*
|
|
||||||
*
|
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
* @throws RepositoryClientException
|
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void simpleWrite() throws RepositoryClientException, IOException
|
public void simpleWrite() throws IOException
|
||||||
{
|
{
|
||||||
RepositoryClient rc = createRepositoryClient(writeUser, directory);
|
RepositoryClient rc = createRepositoryClient(writeUser, directory);
|
||||||
|
|
||||||
rc.checkout();
|
// rc.checkout();
|
||||||
addTestFiles(rc);
|
addTestFiles(rc);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method description
|
* Method description
|
||||||
*
|
*
|
||||||
*
|
|
||||||
*
|
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
* @throws RepositoryClientException
|
|
||||||
*/
|
*/
|
||||||
@Test(expected = RepositoryClientException.class)
|
@Test(expected = IOException.class)
|
||||||
public void writeFailed() throws RepositoryClientException, IOException
|
public void writeFailed() throws IOException
|
||||||
{
|
{
|
||||||
RepositoryClient rc = createRepositoryClient(readUser, directory);
|
RepositoryClient rc = createRepositoryClient(readUser, directory);
|
||||||
|
|
||||||
rc.checkout();
|
// rc.checkout();
|
||||||
addTestFiles(rc);
|
addTestFiles(rc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -44,9 +44,6 @@ import sonia.scm.repository.Permission;
|
|||||||
import sonia.scm.repository.PermissionType;
|
import sonia.scm.repository.PermissionType;
|
||||||
import sonia.scm.repository.Repository;
|
import sonia.scm.repository.Repository;
|
||||||
import sonia.scm.repository.RepositoryTestData;
|
import sonia.scm.repository.RepositoryTestData;
|
||||||
import sonia.scm.repository.client.RepositoryClient;
|
|
||||||
import sonia.scm.repository.client.RepositoryClientException;
|
|
||||||
import sonia.scm.repository.client.RepositoryClientFactory;
|
|
||||||
import sonia.scm.user.User;
|
import sonia.scm.user.User;
|
||||||
import sonia.scm.user.UserTestData;
|
import sonia.scm.user.UserTestData;
|
||||||
import sonia.scm.util.IOUtil;
|
import sonia.scm.util.IOUtil;
|
||||||
@@ -69,6 +66,9 @@ import java.util.ArrayList;
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
|
||||||
|
import sonia.scm.repository.client.api.RepositoryClient;
|
||||||
|
import sonia.scm.repository.client.api.RepositoryClientFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author Sebastian Sdorra
|
* @author Sebastian Sdorra
|
||||||
@@ -107,45 +107,40 @@ public class RepositoryITCaseBase
|
|||||||
* @param client
|
* @param client
|
||||||
*
|
*
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
* @throws RepositoryClientException
|
|
||||||
*/
|
*/
|
||||||
public static void addTestFiles(RepositoryClient client)
|
public static void addTestFiles(RepositoryClient client) throws IOException
|
||||||
throws RepositoryClientException, IOException
|
|
||||||
{
|
{
|
||||||
for (int i = 0; i < 5; i++)
|
for (int i = 0; i < 5; i++)
|
||||||
{
|
{
|
||||||
createRandomFile(client);
|
createRandomFile(client);
|
||||||
}
|
}
|
||||||
|
|
||||||
client.commit("added some test files");
|
commit(client, "added some test files");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method description
|
* Method description
|
||||||
*
|
*
|
||||||
*
|
|
||||||
*
|
|
||||||
* @param repository
|
* @param repository
|
||||||
* @param username
|
* @param username
|
||||||
* @param password
|
* @param password
|
||||||
*
|
*
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
* @throws RepositoryClientException
|
|
||||||
*/
|
*/
|
||||||
public static void addTestFiles(Repository repository, String username,
|
public static void addTestFiles(Repository repository, String username,
|
||||||
String password)
|
String password)
|
||||||
throws RepositoryClientException, IOException
|
throws IOException
|
||||||
{
|
{
|
||||||
File directory = createTempDirectory();
|
File directory = createTempDirectory();
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
RepositoryClient rc =
|
RepositoryClientFactory clientFactory = new RepositoryClientFactory();
|
||||||
RepositoryClientFactory.createClient(repository.getType(), directory,
|
RepositoryClient client = clientFactory.create(
|
||||||
repository.createUrl(BASE_URL), username, password);
|
repository.getType(), repository.createUrl(BASE_URL), username, password, directory
|
||||||
|
);
|
||||||
|
|
||||||
rc.init();
|
addTestFiles(client);
|
||||||
addTestFiles(rc);
|
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
@@ -190,11 +185,9 @@ public class RepositoryITCaseBase
|
|||||||
* @return
|
* @return
|
||||||
*
|
*
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
* @throws RepositoryClientException
|
|
||||||
*/
|
*/
|
||||||
@Parameters
|
@Parameters
|
||||||
public static Collection<Object[]> createParameters()
|
public static Collection<Object[]> createParameters() throws IOException
|
||||||
throws RepositoryClientException, IOException
|
|
||||||
{
|
{
|
||||||
Client client = createClient();
|
Client client = createClient();
|
||||||
ScmState state = authenticateAdmin(client);
|
ScmState state = authenticateAdmin(client);
|
||||||
@@ -202,7 +195,7 @@ public class RepositoryITCaseBase
|
|||||||
assertNotNull(state);
|
assertNotNull(state);
|
||||||
assertTrue(state.isSuccess());
|
assertTrue(state.isSuccess());
|
||||||
|
|
||||||
Collection<Object[]> params = new ArrayList<Object[]>();
|
Collection<Object[]> params = new ArrayList<>();
|
||||||
User owner = UserTestData.createTrillian();
|
User owner = UserTestData.createTrillian();
|
||||||
|
|
||||||
createUser(owner);
|
createUser(owner);
|
||||||
@@ -242,16 +235,14 @@ public class RepositoryITCaseBase
|
|||||||
* @throws RepositoryClientException
|
* @throws RepositoryClientException
|
||||||
*/
|
*/
|
||||||
private static void appendTestParemeter(Collection<Object[]> params,
|
private static void appendTestParemeter(Collection<Object[]> params,
|
||||||
String type, User owner, User write, User read, User noperm)
|
String type, User owner, User write, User read, User noperm) throws IOException
|
||||||
throws RepositoryClientException, IOException
|
|
||||||
{
|
{
|
||||||
Repository repository = createTestRepository(null, type, owner, write,
|
Repository repository = createTestRepository(null, type, owner, write, read);
|
||||||
read);
|
|
||||||
|
|
||||||
params.add(new Object[]
|
params.add(new Object[]
|
||||||
{
|
{
|
||||||
repository, owner, write, read, noperm, "secret"
|
repository, owner, write, read, noperm, "secret"
|
||||||
});
|
});
|
||||||
|
|
||||||
repository = createTestRepository("test", type, owner, write, read);
|
repository = createTestRepository("test", type, owner, write, read);
|
||||||
params.add(new Object[]
|
params.add(new Object[]
|
||||||
{
|
{
|
||||||
@@ -276,8 +267,7 @@ public class RepositoryITCaseBase
|
|||||||
* @throws RepositoryClientException
|
* @throws RepositoryClientException
|
||||||
*/
|
*/
|
||||||
private static Repository createTestRepository(String prefix, String type,
|
private static Repository createTestRepository(String prefix, String type,
|
||||||
User owner, User write, User read)
|
User owner, User write, User read) throws IOException
|
||||||
throws RepositoryClientException, IOException
|
|
||||||
{
|
{
|
||||||
Client client = createAdminClient();
|
Client client = createAdminClient();
|
||||||
Repository repository = RepositoryTestData.createHeartOfGold(type);
|
Repository repository = RepositoryTestData.createHeartOfGold(type);
|
||||||
@@ -296,6 +286,7 @@ public class RepositoryITCaseBase
|
|||||||
//J+
|
//J+
|
||||||
repository = createRepository(client, repository);
|
repository = createRepository(client, repository);
|
||||||
client.destroy();
|
client.destroy();
|
||||||
|
|
||||||
addTestFiles(repository, ADMIN_USERNAME, ADMIN_PASSWORD);
|
addTestFiles(repository, ADMIN_USERNAME, ADMIN_PASSWORD);
|
||||||
|
|
||||||
return repository;
|
return repository;
|
||||||
@@ -337,13 +328,13 @@ public class RepositoryITCaseBase
|
|||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*
|
*
|
||||||
* @throws RepositoryClientException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
protected RepositoryClient createRepositoryClient(User user, File directory)
|
protected RepositoryClient createRepositoryClient(User user, File directory) throws IOException
|
||||||
throws RepositoryClientException
|
|
||||||
{
|
{
|
||||||
return RepositoryClientFactory.createClient(repository.getType(),
|
RepositoryClientFactory clientFactory = new RepositoryClientFactory();
|
||||||
directory, repository.createUrl(BASE_URL), user.getName(), password);
|
return clientFactory.create(repository.getType(), repository.createUrl(BASE_URL),
|
||||||
|
user.getName(), password, directory);
|
||||||
}
|
}
|
||||||
|
|
||||||
//~--- fields ---------------------------------------------------------------
|
//~--- fields ---------------------------------------------------------------
|
||||||
|
|||||||
@@ -65,12 +65,10 @@ public final class RepositoryITUtil
|
|||||||
/**
|
/**
|
||||||
* Method description
|
* Method description
|
||||||
*
|
*
|
||||||
*
|
|
||||||
* @param repository
|
* @param repository
|
||||||
* @param other
|
* @param other
|
||||||
*/
|
*/
|
||||||
public static void assertRepositoriesEquals(Repository repository,
|
public static void assertRepositoriesEquals(Repository repository, Repository other)
|
||||||
Repository other)
|
|
||||||
{
|
{
|
||||||
assertEquals(repository.getName(), other.getName());
|
assertEquals(repository.getName(), other.getName());
|
||||||
assertEquals(repository.getDescription(), other.getDescription());
|
assertEquals(repository.getDescription(), other.getDescription());
|
||||||
@@ -82,8 +80,6 @@ public final class RepositoryITUtil
|
|||||||
/**
|
/**
|
||||||
* Method description
|
* Method description
|
||||||
*
|
*
|
||||||
*
|
|
||||||
*
|
|
||||||
* @param client
|
* @param client
|
||||||
* @param repository
|
* @param repository
|
||||||
*
|
*
|
||||||
@@ -116,8 +112,6 @@ public final class RepositoryITUtil
|
|||||||
/**
|
/**
|
||||||
* Method description
|
* Method description
|
||||||
*
|
*
|
||||||
*
|
|
||||||
*
|
|
||||||
* @param client
|
* @param client
|
||||||
* @param id
|
* @param id
|
||||||
*/
|
*/
|
||||||
@@ -141,10 +135,6 @@ public final class RepositoryITUtil
|
|||||||
/**
|
/**
|
||||||
* Method description
|
* Method description
|
||||||
*
|
*
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @param client
|
* @param client
|
||||||
* @param url
|
* @param url
|
||||||
*
|
*
|
||||||
@@ -168,11 +158,6 @@ public final class RepositoryITUtil
|
|||||||
/**
|
/**
|
||||||
* Method description
|
* Method description
|
||||||
*
|
*
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @param client
|
* @param client
|
||||||
* @param id
|
* @param id
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user