This commit is contained in:
René Pfeuffer
2018-06-20 11:11:14 +02:00
parent b93b291293
commit 7f19b5baff
5 changed files with 25 additions and 23 deletions

View File

@@ -35,20 +35,17 @@ 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;
import sonia.scm.repository.GitUtil; import sonia.scm.repository.GitUtil;
import sonia.scm.repository.client.api.ClientCommand; import sonia.scm.repository.client.api.ClientCommand;
//~--- JDK imports ------------------------------------------------------------ import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.util.Set; import java.util.Set;
//~--- JDK imports ------------------------------------------------------------
/** /**
* *
* @author Sebastian Sdorra * @author Sebastian Sdorra
@@ -59,7 +56,7 @@ public class GitRepositoryClientProvider extends RepositoryClientProvider
/** Field description */ /** Field description */
private static final Set<ClientCommand> SUPPORTED_COMMANDS = private static final Set<ClientCommand> SUPPORTED_COMMANDS =
ImmutableSet.of(ClientCommand.ADD, ClientCommand.REMOVE, ImmutableSet.of(ClientCommand.ADD, ClientCommand.REMOVE,
ClientCommand.COMMIT, ClientCommand.TAG, ClientCommand.BANCH, ClientCommand.COMMIT, ClientCommand.TAG, ClientCommand.BRANCH,
ClientCommand.PUSH); ClientCommand.PUSH);
//~--- constructors --------------------------------------------------------- //~--- constructors ---------------------------------------------------------

View File

@@ -32,10 +32,11 @@ package sonia.scm.repository.client.spi;
import com.aragost.javahg.Repository; import com.aragost.javahg.Repository;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;
import sonia.scm.repository.client.api.ClientCommand;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.util.Set; import java.util.Set;
import sonia.scm.repository.client.api.ClientCommand;
/** /**
* Mercurial implementation of the {@link RepositoryClientProvider}. * Mercurial implementation of the {@link RepositoryClientProvider}.
@@ -47,7 +48,7 @@ public class HgRepositoryClientProvider extends RepositoryClientProvider
private static final Set<ClientCommand> SUPPORTED_COMMANDS = ImmutableSet.of( private static final Set<ClientCommand> SUPPORTED_COMMANDS = ImmutableSet.of(
ClientCommand.ADD, ClientCommand.REMOVE, ClientCommand.COMMIT, ClientCommand.ADD, ClientCommand.REMOVE, ClientCommand.COMMIT,
ClientCommand.TAG, ClientCommand.BANCH, ClientCommand.PUSH ClientCommand.TAG, ClientCommand.BRANCH, ClientCommand.PUSH
); );
private final Repository repository; private final Repository repository;

View File

@@ -39,5 +39,5 @@ package sonia.scm.repository.client.api;
*/ */
public enum ClientCommand public enum ClientCommand
{ {
ADD, REMOVE, COMMIT, PUSH, TAG, BANCH ADD, REMOVE, COMMIT, PUSH, TAG, BRANCH
} }

View File

@@ -37,14 +37,13 @@ package sonia.scm.repository.client.spi;
import sonia.scm.repository.client.api.ClientCommand; import sonia.scm.repository.client.api.ClientCommand;
import sonia.scm.repository.client.api.ClientCommandNotSupportedException; import sonia.scm.repository.client.api.ClientCommandNotSupportedException;
//~--- JDK imports ------------------------------------------------------------
import java.io.Closeable; import java.io.Closeable;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.util.Set; import java.util.Set;
//~--- JDK imports ------------------------------------------------------------
/** /**
* *
* @author Sebastian Sdorra * @author Sebastian Sdorra
@@ -93,7 +92,7 @@ public abstract class RepositoryClientProvider implements Closeable
*/ */
public BranchCommand getBranchCommand() public BranchCommand getBranchCommand()
{ {
throw new ClientCommandNotSupportedException(ClientCommand.BANCH); throw new ClientCommandNotSupportedException(ClientCommand.BRANCH);
} }
/** /**

View File

@@ -34,12 +34,7 @@ import com.google.common.base.Charsets;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.google.common.io.Files; import com.google.common.io.Files;
import com.sun.jersey.api.client.WebResource; import com.sun.jersey.api.client.WebResource;
import java.io.File;
import java.io.IOException;
import java.util.Collection;
import org.junit.After; import org.junit.After;
import static org.junit.Assert.*;
import static org.hamcrest.Matchers.*;
import org.junit.Assume; import org.junit.Assume;
import org.junit.Before; import org.junit.Before;
import org.junit.Rule; import org.junit.Rule;
@@ -49,9 +44,6 @@ import org.junit.runner.RunWith;
import org.junit.runners.Parameterized; import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameters; import org.junit.runners.Parameterized.Parameters;
import sonia.scm.debug.DebugHookData; import sonia.scm.debug.DebugHookData;
import static sonia.scm.it.IntegrationTestUtil.createResource;
import static sonia.scm.it.RepositoryITUtil.createRepository;
import static sonia.scm.it.RepositoryITUtil.deleteRepository;
import sonia.scm.repository.Changeset; import sonia.scm.repository.Changeset;
import sonia.scm.repository.Person; import sonia.scm.repository.Person;
import sonia.scm.repository.Repository; import sonia.scm.repository.Repository;
@@ -61,6 +53,19 @@ import sonia.scm.repository.client.api.RepositoryClient;
import sonia.scm.repository.client.api.RepositoryClientFactory; import sonia.scm.repository.client.api.RepositoryClientFactory;
import sonia.scm.util.IOUtil; import sonia.scm.util.IOUtil;
import java.io.File;
import java.io.IOException;
import java.util.Collection;
import static org.hamcrest.Matchers.allOf;
import static org.hamcrest.Matchers.contains;
import static org.hamcrest.Matchers.not;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertThat;
import static sonia.scm.it.IntegrationTestUtil.createResource;
import static sonia.scm.it.RepositoryITUtil.createRepository;
import static sonia.scm.it.RepositoryITUtil.deleteRepository;
/** /**
* Integration tests for repository hooks. * Integration tests for repository hooks.
* *
@@ -149,7 +154,7 @@ public class RepositoryHookITCase extends AbstractAdminITCaseBase
public void testOnlyNewCommit() throws IOException, InterruptedException public void testOnlyNewCommit() throws IOException, InterruptedException
{ {
// skip test if branches are not supported by repository type // skip test if branches are not supported by repository type
Assume.assumeTrue(repositoryClient.isCommandSupported(ClientCommand.BANCH)); Assume.assumeTrue(repositoryClient.isCommandSupported(ClientCommand.BRANCH));
// push commit // push commit
Files.write("a", new File(workingCopy, "a.txt"), Charsets.UTF_8); Files.write("a", new File(workingCopy, "a.txt"), Charsets.UTF_8);