mirror of
				https://github.com/scm-manager/scm-manager.git
				synced 2025-10-31 10:35:56 +01:00 
			
		
		
		
	Replace model object exception with generic ones and migrate guice
This commit is contained in:
		| @@ -37,10 +37,8 @@ package sonia.scm.repository; | ||||
|  | ||||
| import com.google.inject.Inject; | ||||
| import com.google.inject.Singleton; | ||||
|  | ||||
| import org.slf4j.Logger; | ||||
| import org.slf4j.LoggerFactory; | ||||
|  | ||||
| import org.tmatesoft.svn.core.SVNException; | ||||
| import org.tmatesoft.svn.core.SVNURL; | ||||
| import org.tmatesoft.svn.core.internal.io.fs.FSHooks; | ||||
| @@ -48,19 +46,17 @@ import org.tmatesoft.svn.core.internal.io.fs.FSRepositoryFactory; | ||||
| import org.tmatesoft.svn.core.io.SVNRepository; | ||||
| import org.tmatesoft.svn.core.io.SVNRepositoryFactory; | ||||
| import org.tmatesoft.svn.util.SVNDebugLog; | ||||
|  | ||||
| import sonia.scm.io.FileSystem; | ||||
| import sonia.scm.logging.SVNKitLogger; | ||||
| import sonia.scm.plugin.Extension; | ||||
| import sonia.scm.repository.spi.HookEventFacade; | ||||
| import sonia.scm.repository.spi.SvnRepositoryServiceProvider; | ||||
| import sonia.scm.store.ConfigurationStoreFactory; | ||||
| import sonia.scm.util.Util; | ||||
|  | ||||
| //~--- JDK imports ------------------------------------------------------------ | ||||
|  | ||||
| import java.io.File; | ||||
| import java.io.IOException; | ||||
| import sonia.scm.repository.spi.HookEventFacade; | ||||
| import sonia.scm.store.ConfigurationStoreFactory; | ||||
|  | ||||
| //~--- JDK imports ------------------------------------------------------------ | ||||
|  | ||||
| /** | ||||
|  * | ||||
| @@ -72,38 +68,21 @@ public class SvnRepositoryHandler | ||||
|   extends AbstractSimpleRepositoryHandler<SvnConfig> | ||||
| { | ||||
|  | ||||
|   /** Field description */ | ||||
|   public static final String PROPERTY_UUID = "svn.uuid"; | ||||
|  | ||||
|   /** Field description */ | ||||
|   public static final String RESOURCE_VERSION = | ||||
|     "sonia/scm/version/scm-svn-plugin"; | ||||
|   public static final String RESOURCE_VERSION = "sonia/scm/version/scm-svn-plugin"; | ||||
|  | ||||
|   /** Field description */ | ||||
|   public static final String TYPE_DISPLAYNAME = "Subversion"; | ||||
|  | ||||
|   /** Field description */ | ||||
|   public static final String TYPE_NAME = "svn"; | ||||
|  | ||||
|   /** Field description */ | ||||
|   public static final RepositoryType TYPE = new RepositoryType(TYPE_NAME, | ||||
|                                     TYPE_DISPLAYNAME, | ||||
|                                     SvnRepositoryServiceProvider.COMMANDS); | ||||
|  | ||||
|   /** the logger for SvnRepositoryHandler */ | ||||
|   private static final Logger logger = | ||||
|     LoggerFactory.getLogger(SvnRepositoryHandler.class); | ||||
|  | ||||
|   //~--- constructors --------------------------------------------------------- | ||||
|  | ||||
|   /** | ||||
|    * Constructs ... | ||||
|    * | ||||
|    * | ||||
|    * @param storeFactory | ||||
|    * @param fileSystem | ||||
|    * @param repositoryManager | ||||
|    */ | ||||
|   @Inject | ||||
|   public SvnRepositoryHandler(ConfigurationStoreFactory storeFactory, FileSystem fileSystem, | ||||
|     HookEventFacade eventFacade) | ||||
| @@ -128,60 +107,26 @@ public class SvnRepositoryHandler | ||||
|     } | ||||
|   } | ||||
|  | ||||
|   //~--- get methods ---------------------------------------------------------- | ||||
|  | ||||
|   /** | ||||
|    * Method description | ||||
|    * | ||||
|    * | ||||
|    * @return | ||||
|    */ | ||||
|   @Override | ||||
|   public ImportHandler getImportHandler() | ||||
|   { | ||||
|     return new SvnImportHandler(this); | ||||
|   } | ||||
|  | ||||
|   /** | ||||
|    * Method description | ||||
|    * | ||||
|    * | ||||
|    * @return | ||||
|    */ | ||||
|   @Override | ||||
|   public RepositoryType getType() | ||||
|   { | ||||
|     return TYPE; | ||||
|   } | ||||
|  | ||||
|   /** | ||||
|    * Method description | ||||
|    * | ||||
|    * | ||||
|    * @return | ||||
|    */ | ||||
|   @Override | ||||
|   public String getVersionInformation() | ||||
|   { | ||||
|     return getStringFromResource(RESOURCE_VERSION, DEFAULT_VERSION_INFORMATION); | ||||
|   } | ||||
|  | ||||
|   //~--- methods -------------------------------------------------------------- | ||||
|  | ||||
|   /** | ||||
|    * Method description | ||||
|    * | ||||
|    * | ||||
|    * @param repository | ||||
|    * @param directory | ||||
|    * | ||||
|    * @throws IOException | ||||
|    * @throws RepositoryException | ||||
|    */ | ||||
|   @Override | ||||
|   protected void create(Repository repository, File directory) | ||||
|     throws RepositoryException, IOException | ||||
|   { | ||||
|   protected void create(Repository repository, File directory) throws InternalRepositoryException { | ||||
|     Compatibility comp = config.getCompatibility(); | ||||
|  | ||||
|     if (logger.isDebugEnabled()) | ||||
| @@ -228,7 +173,7 @@ public class SvnRepositoryHandler | ||||
|     } | ||||
|     catch (SVNException ex) | ||||
|     { | ||||
|       throw new RepositoryException(ex); | ||||
|       throw new InternalRepositoryException(ex); | ||||
|     } | ||||
|     finally | ||||
|     { | ||||
|   | ||||
| @@ -38,10 +38,8 @@ package sonia.scm.repository; | ||||
| import com.google.common.base.Strings; | ||||
| import com.google.common.collect.Lists; | ||||
| import com.google.common.io.Closeables; | ||||
|  | ||||
| import org.slf4j.Logger; | ||||
| import org.slf4j.LoggerFactory; | ||||
|  | ||||
| import org.tmatesoft.svn.core.SVNErrorCode; | ||||
| import org.tmatesoft.svn.core.SVNLogEntry; | ||||
| import org.tmatesoft.svn.core.SVNLogEntryPath; | ||||
| @@ -52,20 +50,17 @@ import org.tmatesoft.svn.core.internal.util.SVNXMLUtil; | ||||
| import org.tmatesoft.svn.core.io.SVNRepository; | ||||
| import org.tmatesoft.svn.core.wc.SVNClientManager; | ||||
| import org.tmatesoft.svn.core.wc.admin.SVNChangeEntry; | ||||
|  | ||||
| import sonia.scm.util.HttpUtil; | ||||
| import sonia.scm.util.Util; | ||||
|  | ||||
| //~--- JDK imports ------------------------------------------------------------ | ||||
|  | ||||
| import javax.servlet.http.HttpServletRequest; | ||||
| import javax.servlet.http.HttpServletResponse; | ||||
| import java.io.IOException; | ||||
| import java.io.PrintWriter; | ||||
|  | ||||
| import java.util.List; | ||||
| import java.util.Map; | ||||
|  | ||||
| import javax.servlet.http.HttpServletRequest; | ||||
| import javax.servlet.http.HttpServletResponse; | ||||
| //~--- JDK imports ------------------------------------------------------------ | ||||
|  | ||||
| /** | ||||
|  * | ||||
| @@ -351,21 +346,7 @@ public final class SvnUtil | ||||
|     } | ||||
|   } | ||||
|  | ||||
|   //~--- get methods ---------------------------------------------------------- | ||||
|  | ||||
|   /** | ||||
|    * Method description | ||||
|    * | ||||
|    * | ||||
|    * @param revision | ||||
|    * | ||||
|    * @return | ||||
|    * | ||||
|    * @throws RepositoryException | ||||
|    */ | ||||
|   public static long getRevisionNumber(String revision) | ||||
|     throws RepositoryException | ||||
|   { | ||||
|   public static long getRevisionNumber(String revision) throws RevisionNotFoundException { | ||||
|     long revisionNumber = -1; | ||||
|  | ||||
|     if (Util.isNotEmpty(revision)) | ||||
| @@ -376,7 +357,7 @@ public final class SvnUtil | ||||
|       } | ||||
|       catch (NumberFormatException ex) | ||||
|       { | ||||
|         throw new RepositoryException("given revision is not a svnrevision"); | ||||
|         throw new RevisionNotFoundException(revision); | ||||
|       } | ||||
|     } | ||||
|  | ||||
|   | ||||
| @@ -35,7 +35,6 @@ package sonia.scm.repository.spi; | ||||
| //~--- non-JDK imports -------------------------------------------------------- | ||||
|  | ||||
| import com.google.common.collect.Lists; | ||||
|  | ||||
| import org.tmatesoft.svn.core.SVNException; | ||||
| import org.tmatesoft.svn.core.SVNURL; | ||||
| import org.tmatesoft.svn.core.auth.ISVNAuthenticationManager; | ||||
| @@ -43,21 +42,18 @@ import org.tmatesoft.svn.core.io.SVNRepository; | ||||
| import org.tmatesoft.svn.core.io.SVNRepositoryFactory; | ||||
| import org.tmatesoft.svn.core.wc.SVNLogClient; | ||||
| import org.tmatesoft.svn.core.wc.SVNRevision; | ||||
|  | ||||
| import sonia.scm.repository.BlameLine; | ||||
| import sonia.scm.repository.BlameResult; | ||||
| import sonia.scm.repository.InternalRepositoryException; | ||||
| import sonia.scm.repository.Repository; | ||||
| import sonia.scm.repository.RepositoryException; | ||||
| import sonia.scm.repository.SvnBlameHandler; | ||||
| import sonia.scm.util.Util; | ||||
|  | ||||
| //~--- JDK imports ------------------------------------------------------------ | ||||
|  | ||||
| import java.io.File; | ||||
| import java.io.IOException; | ||||
|  | ||||
| import java.util.List; | ||||
|  | ||||
| //~--- JDK imports ------------------------------------------------------------ | ||||
|  | ||||
| /** | ||||
|  * | ||||
|  * @author Sebastian Sdorra | ||||
| @@ -65,37 +61,13 @@ import java.util.List; | ||||
| public class SvnBlameCommand extends AbstractSvnCommand implements BlameCommand | ||||
| { | ||||
|  | ||||
|   /** | ||||
|    * Constructs ... | ||||
|    * | ||||
|    * | ||||
|    * | ||||
|    * @param context | ||||
|    * @param repository | ||||
|    * @param repositoryDirectory | ||||
|    */ | ||||
|   public SvnBlameCommand(SvnContext context, Repository repository) | ||||
|   { | ||||
|     super(context, repository); | ||||
|   } | ||||
|  | ||||
|   //~--- get methods ---------------------------------------------------------- | ||||
|  | ||||
|   /** | ||||
|    * Method description | ||||
|    * | ||||
|    * | ||||
|    * @param request | ||||
|    * | ||||
|    * @return | ||||
|    * | ||||
|    * @throws IOException | ||||
|    * @throws RepositoryException | ||||
|    */ | ||||
|   @Override | ||||
|   public BlameResult getBlameResult(BlameCommandRequest request) | ||||
|           throws IOException, RepositoryException | ||||
|   { | ||||
|   public BlameResult getBlameResult(BlameCommandRequest request) { | ||||
|     String path = request.getPath(); | ||||
|     String revision = request.getRevision(); | ||||
|     List<BlameLine> blameLines = Lists.newArrayList(); | ||||
| @@ -126,7 +98,7 @@ public class SvnBlameCommand extends AbstractSvnCommand implements BlameCommand | ||||
|     } | ||||
|     catch (SVNException ex) | ||||
|     { | ||||
|       throw new RepositoryException("could not create blame result", ex); | ||||
|       throw new InternalRepositoryException("could not create blame result", ex); | ||||
|     } | ||||
|  | ||||
|     return new BlameResult(blameLines.size(), blameLines); | ||||
|   | ||||
| @@ -36,32 +36,27 @@ package sonia.scm.repository.spi; | ||||
| //~--- non-JDK imports -------------------------------------------------------- | ||||
|  | ||||
| import com.google.common.collect.Lists; | ||||
|  | ||||
| import org.slf4j.Logger; | ||||
| import org.slf4j.LoggerFactory; | ||||
|  | ||||
| import org.tmatesoft.svn.core.SVNDirEntry; | ||||
| import org.tmatesoft.svn.core.SVNException; | ||||
| import org.tmatesoft.svn.core.SVNNodeKind; | ||||
| import org.tmatesoft.svn.core.SVNProperties; | ||||
| import org.tmatesoft.svn.core.SVNProperty; | ||||
| import org.tmatesoft.svn.core.io.SVNRepository; | ||||
|  | ||||
| import sonia.scm.repository.BrowserResult; | ||||
| import sonia.scm.repository.FileObject; | ||||
| import sonia.scm.repository.Repository; | ||||
| import sonia.scm.repository.RepositoryException; | ||||
| import sonia.scm.repository.RevisionNotFoundException; | ||||
| import sonia.scm.repository.SubRepository; | ||||
| import sonia.scm.repository.SvnUtil; | ||||
| import sonia.scm.util.Util; | ||||
|  | ||||
| //~--- JDK imports ------------------------------------------------------------ | ||||
|  | ||||
| import java.io.IOException; | ||||
|  | ||||
| import java.util.Collection; | ||||
| import java.util.List; | ||||
|  | ||||
| //~--- JDK imports ------------------------------------------------------------ | ||||
|  | ||||
| /** | ||||
|  * | ||||
|  * @author Sebastian Sdorra | ||||
| @@ -76,40 +71,14 @@ public class SvnBrowseCommand extends AbstractSvnCommand | ||||
|   private static final Logger logger = | ||||
|     LoggerFactory.getLogger(SvnBrowseCommand.class); | ||||
|  | ||||
|   //~--- constructors --------------------------------------------------------- | ||||
|  | ||||
|   /** | ||||
|    * Constructs ... | ||||
|    * | ||||
|    * | ||||
|    * | ||||
|    * @param context | ||||
|    * @param repository | ||||
|    * @param repositoryDirectory | ||||
|    */ | ||||
|   SvnBrowseCommand(SvnContext context, Repository repository) | ||||
|   { | ||||
|     super(context, repository); | ||||
|   } | ||||
|  | ||||
|   //~--- get methods ---------------------------------------------------------- | ||||
|  | ||||
|   /** | ||||
|    * Method description | ||||
|    * | ||||
|    * | ||||
|    * @param request | ||||
|    * | ||||
|    * @return | ||||
|    * | ||||
|    * @throws IOException | ||||
|    * @throws RepositoryException | ||||
|    */ | ||||
|   @Override | ||||
|   @SuppressWarnings("unchecked") | ||||
|   public BrowserResult getBrowserResult(BrowseCommandRequest request) | ||||
|     throws IOException, RepositoryException | ||||
|   { | ||||
|   public BrowserResult getBrowserResult(BrowseCommandRequest request) throws RevisionNotFoundException { | ||||
|     String path = request.getPath(); | ||||
|     long revisionNumber = SvnUtil.getRevisionNumber(request.getRevision()); | ||||
|  | ||||
| @@ -293,7 +262,7 @@ public class SvnBrowseCommand extends AbstractSvnCommand | ||||
|     } | ||||
|     catch (SVNException ex) | ||||
|     { | ||||
|       logger.error("could not fetch file properties"); | ||||
|       logger.error("could not fetch file properties", ex); | ||||
|     } | ||||
|   } | ||||
| } | ||||
|   | ||||
| @@ -37,25 +37,22 @@ package sonia.scm.repository.spi; | ||||
|  | ||||
| import com.google.common.io.ByteSink; | ||||
| import com.google.common.io.Closeables; | ||||
|  | ||||
| import org.tmatesoft.svn.core.SVNException; | ||||
| import org.tmatesoft.svn.core.wc.SVNClientManager; | ||||
| import org.tmatesoft.svn.core.wc.SVNRevision; | ||||
| import org.tmatesoft.svn.core.wc.admin.SVNAdminClient; | ||||
|  | ||||
| import sonia.scm.repository.Repository; | ||||
| import sonia.scm.repository.RepositoryException; | ||||
| import sonia.scm.repository.SvnUtil; | ||||
| import sonia.scm.repository.api.BundleResponse; | ||||
|  | ||||
| import static com.google.common.base.Preconditions.*; | ||||
|  | ||||
| //~--- JDK imports ------------------------------------------------------------ | ||||
|  | ||||
| import java.io.File; | ||||
| import java.io.IOException; | ||||
| import java.io.OutputStream; | ||||
|  | ||||
| import static com.google.common.base.Preconditions.checkNotNull; | ||||
|  | ||||
| //~--- JDK imports ------------------------------------------------------------ | ||||
|  | ||||
| /** | ||||
|  * | ||||
|  * @author Sebastian Sdorra <s.sdorra@gmail.com> | ||||
| @@ -64,31 +61,11 @@ public class SvnBundleCommand extends AbstractSvnCommand | ||||
|   implements BundleCommand | ||||
| { | ||||
|  | ||||
|   /** | ||||
|    * Constructs ... | ||||
|    * | ||||
|    * | ||||
|    * @param context | ||||
|    * @param repository | ||||
|    */ | ||||
|   public SvnBundleCommand(SvnContext context, Repository repository) | ||||
|   { | ||||
|     super(context, repository); | ||||
|   } | ||||
|  | ||||
|   //~--- methods -------------------------------------------------------------- | ||||
|  | ||||
|   /** | ||||
|    * Method description | ||||
|    * | ||||
|    * | ||||
|    * @param adminClient | ||||
|    * @param repository | ||||
|    * @param target | ||||
|    * | ||||
|    * @throws IOException | ||||
|    * @throws SVNException | ||||
|    */ | ||||
|   private static void dump(SVNAdminClient adminClient, File repository, | ||||
|     ByteSink target) | ||||
|     throws SVNException, IOException | ||||
| @@ -107,21 +84,8 @@ public class SvnBundleCommand extends AbstractSvnCommand | ||||
|     } | ||||
|   } | ||||
|  | ||||
|   /** | ||||
|    * Method description | ||||
|    * | ||||
|    * | ||||
|    * @param request | ||||
|    * | ||||
|    * @return | ||||
|    * | ||||
|    * @throws IOException | ||||
|    * @throws RepositoryException | ||||
|    */ | ||||
|   @Override | ||||
|   public BundleResponse bundle(BundleCommandRequest request) | ||||
|     throws IOException, RepositoryException | ||||
|   { | ||||
|   public BundleResponse bundle(BundleCommandRequest request) throws IOException { | ||||
|     ByteSink archive = checkNotNull(request.getArchive(), | ||||
|                          "archive is required"); | ||||
|  | ||||
|   | ||||
| @@ -43,15 +43,14 @@ import org.tmatesoft.svn.core.SVNProperties; | ||||
| import org.tmatesoft.svn.core.io.SVNRepository; | ||||
| import org.tmatesoft.svn.core.wc.SVNClientManager; | ||||
| import org.tmatesoft.svn.core.wc.admin.SVNLookClient; | ||||
| import sonia.scm.repository.InternalRepositoryException; | ||||
| import sonia.scm.repository.PathNotFoundException; | ||||
| import sonia.scm.repository.Repository; | ||||
| import sonia.scm.repository.RepositoryException; | ||||
| import sonia.scm.repository.RevisionNotFoundException; | ||||
| import sonia.scm.repository.SvnUtil; | ||||
|  | ||||
| import java.io.ByteArrayInputStream; | ||||
| import java.io.ByteArrayOutputStream; | ||||
| import java.io.IOException; | ||||
| import java.io.InputStream; | ||||
| import java.io.OutputStream; | ||||
|  | ||||
| @@ -72,15 +71,6 @@ public class SvnCatCommand extends AbstractSvnCommand implements CatCommand | ||||
|  | ||||
|   //~--- constructors --------------------------------------------------------- | ||||
|  | ||||
|   /** | ||||
|    * Constructs ... | ||||
|    * | ||||
|    * | ||||
|    * | ||||
|    * @param context | ||||
|    * @param repository | ||||
|    * @param repositoryDirectory | ||||
|    */ | ||||
|   SvnCatCommand(SvnContext context, Repository repository) | ||||
|   { | ||||
|     super(context, repository); | ||||
| @@ -88,20 +78,8 @@ public class SvnCatCommand extends AbstractSvnCommand implements CatCommand | ||||
|  | ||||
|   //~--- get methods ---------------------------------------------------------- | ||||
|  | ||||
|   /** | ||||
|    * Method description | ||||
|    * | ||||
|    * | ||||
|    * @param request | ||||
|    * @param output | ||||
|    * | ||||
|    * @throws IOException | ||||
|    * @throws RepositoryException | ||||
|    */ | ||||
|   @Override | ||||
|   public void getCatResult(CatCommandRequest request, OutputStream output) | ||||
|     throws IOException, RepositoryException | ||||
|   { | ||||
|   public void getCatResult(CatCommandRequest request, OutputStream output) throws RevisionNotFoundException, PathNotFoundException { | ||||
|     if (logger.isDebugEnabled()) | ||||
|     { | ||||
|       logger.debug("try to get content for {}", request); | ||||
| @@ -125,7 +103,7 @@ public class SvnCatCommand extends AbstractSvnCommand implements CatCommand | ||||
|   } | ||||
|  | ||||
|   @Override | ||||
|   public InputStream getCatResultStream(CatCommandRequest request) throws IOException, RepositoryException { | ||||
|   public InputStream getCatResultStream(CatCommandRequest request) throws RevisionNotFoundException, PathNotFoundException { | ||||
|     // There seems to be no method creating an input stream as a result, so | ||||
|     // we have no other possibility then to copy the content into a buffer and | ||||
|     // stream it from there. | ||||
| @@ -134,20 +112,7 @@ public class SvnCatCommand extends AbstractSvnCommand implements CatCommand | ||||
|     return new ByteArrayInputStream(output.toByteArray()); | ||||
|   } | ||||
|  | ||||
|   /** | ||||
|    * Method description | ||||
|    * | ||||
|    * | ||||
|    * @param request | ||||
|    * @param output | ||||
|    * @param revision | ||||
|    * | ||||
|    * @throws RepositoryException | ||||
|    */ | ||||
|   private void getCatFromRevision(CatCommandRequest request, | ||||
|     OutputStream output, long revision) | ||||
|     throws RepositoryException | ||||
|   { | ||||
|   private void getCatFromRevision(CatCommandRequest request, OutputStream output, long revision) throws PathNotFoundException, RevisionNotFoundException { | ||||
|     logger.debug("try to read content from revision {} and path {}", revision, | ||||
|       request.getPath()); | ||||
|  | ||||
| @@ -164,31 +129,18 @@ public class SvnCatCommand extends AbstractSvnCommand implements CatCommand | ||||
|     } | ||||
|   } | ||||
|  | ||||
|   private void handleSvnException(CatCommandRequest request, SVNException ex) throws RepositoryException { | ||||
|   private void handleSvnException(CatCommandRequest request, SVNException ex) throws PathNotFoundException, RevisionNotFoundException { | ||||
|     int svnErrorCode = ex.getErrorMessage().getErrorCode().getCode(); | ||||
|     if (SVNErrorCode.FS_NOT_FOUND.getCode() == svnErrorCode) { | ||||
|       throw new PathNotFoundException(request.getPath()); | ||||
|     } else if (SVNErrorCode.FS_NO_SUCH_REVISION.getCode() == svnErrorCode) { | ||||
|       throw new RevisionNotFoundException(request.getRevision()); | ||||
|     } else { | ||||
|       throw new RepositoryException("could not get content from revision", ex); | ||||
|       throw new InternalRepositoryException("could not get content from revision", ex); | ||||
|     } | ||||
|   } | ||||
|  | ||||
|   /** | ||||
|    * Method description | ||||
|    * | ||||
|    * | ||||
|    * @param request | ||||
|    * @param output | ||||
|    * @param txn | ||||
|    * | ||||
|    * @throws RepositoryException | ||||
|    */ | ||||
|   private void getCatFromTransaction(CatCommandRequest request, | ||||
|     OutputStream output, String txn) | ||||
|     throws RepositoryException | ||||
|   { | ||||
|   private void getCatFromTransaction(CatCommandRequest request, OutputStream output, String txn) { | ||||
|     logger.debug("try to read content from transaction {} and path {}", txn, | ||||
|       request.getPath()); | ||||
|  | ||||
| @@ -204,8 +156,7 @@ public class SvnCatCommand extends AbstractSvnCommand implements CatCommand | ||||
|     } | ||||
|     catch (SVNException ex) | ||||
|     { | ||||
|       throw new RepositoryException("could not get content from transaction", | ||||
|         ex); | ||||
|       throw new InternalRepositoryException("could not get content from transaction", ex); | ||||
|     } | ||||
|     finally | ||||
|     { | ||||
|   | ||||
| @@ -36,10 +36,8 @@ package sonia.scm.repository.spi; | ||||
| //~--- non-JDK imports -------------------------------------------------------- | ||||
|  | ||||
| import com.google.common.base.Preconditions; | ||||
|  | ||||
| import org.slf4j.Logger; | ||||
| import org.slf4j.LoggerFactory; | ||||
|  | ||||
| import org.tmatesoft.svn.core.SVNDepth; | ||||
| import org.tmatesoft.svn.core.SVNException; | ||||
| import org.tmatesoft.svn.core.SVNURL; | ||||
| @@ -48,18 +46,17 @@ import org.tmatesoft.svn.core.wc.ISVNDiffGenerator; | ||||
| import org.tmatesoft.svn.core.wc.SVNClientManager; | ||||
| import org.tmatesoft.svn.core.wc.SVNDiffClient; | ||||
| import org.tmatesoft.svn.core.wc.SVNRevision; | ||||
|  | ||||
| import sonia.scm.repository.InternalRepositoryException; | ||||
| import sonia.scm.repository.Repository; | ||||
| import sonia.scm.repository.RepositoryException; | ||||
| import sonia.scm.repository.RevisionNotFoundException; | ||||
| import sonia.scm.repository.SvnUtil; | ||||
| import sonia.scm.repository.api.DiffFormat; | ||||
| import sonia.scm.util.Util; | ||||
|  | ||||
| //~--- JDK imports ------------------------------------------------------------ | ||||
|  | ||||
| import java.io.IOException; | ||||
| import java.io.OutputStream; | ||||
|  | ||||
| //~--- JDK imports ------------------------------------------------------------ | ||||
|  | ||||
| /** | ||||
|  * | ||||
|  * @author Sebastian Sdorra | ||||
| @@ -73,38 +70,13 @@ public class SvnDiffCommand extends AbstractSvnCommand implements DiffCommand | ||||
|   private static final Logger logger = | ||||
|     LoggerFactory.getLogger(SvnDiffCommand.class); | ||||
|  | ||||
|   //~--- constructors --------------------------------------------------------- | ||||
|  | ||||
|   /** | ||||
|    * Constructs ... | ||||
|    * | ||||
|    * | ||||
|    * | ||||
|    * @param context | ||||
|    * @param repository | ||||
|    * @param repositoryDirectory | ||||
|    */ | ||||
|   public SvnDiffCommand(SvnContext context, Repository repository) | ||||
|   { | ||||
|     super(context, repository); | ||||
|   } | ||||
|  | ||||
|   //~--- get methods ---------------------------------------------------------- | ||||
|  | ||||
|   /** | ||||
|    * Method description | ||||
|    * | ||||
|    * | ||||
|    * @param request | ||||
|    * @param output | ||||
|    * | ||||
|    * @throws IOException | ||||
|    * @throws RepositoryException | ||||
|    */ | ||||
|   @Override | ||||
|   public void getDiffResult(DiffCommandRequest request, OutputStream output) | ||||
|     throws IOException, RepositoryException | ||||
|   { | ||||
|   public void getDiffResult(DiffCommandRequest request, OutputStream output) throws RevisionNotFoundException { | ||||
|     if (logger.isDebugEnabled()) | ||||
|     { | ||||
|       logger.debug("create diff for {}", request); | ||||
| @@ -149,7 +121,7 @@ public class SvnDiffCommand extends AbstractSvnCommand implements DiffCommand | ||||
|     } | ||||
|     catch (SVNException ex) | ||||
|     { | ||||
|       throw new RepositoryException("could not create diff", ex); | ||||
|       throw new InternalRepositoryException("could not create diff", ex); | ||||
|     } | ||||
|     finally | ||||
|     { | ||||
|   | ||||
| @@ -37,33 +37,25 @@ package sonia.scm.repository.spi; | ||||
|  | ||||
| import com.google.common.base.Strings; | ||||
| import com.google.common.collect.Lists; | ||||
|  | ||||
| import org.slf4j.Logger; | ||||
| import org.slf4j.LoggerFactory; | ||||
|  | ||||
| import org.tmatesoft.svn.core.ISVNLogEntryHandler; | ||||
| import org.tmatesoft.svn.core.SVNException; | ||||
| import org.tmatesoft.svn.core.SVNLogEntry; | ||||
| import org.tmatesoft.svn.core.io.SVNRepository; | ||||
|  | ||||
| import sonia.scm.repository.Changeset; | ||||
| import sonia.scm.repository.ChangesetPagingResult; | ||||
| import sonia.scm.repository.InternalRepositoryException; | ||||
| import sonia.scm.repository.Repository; | ||||
| import sonia.scm.repository.RepositoryException; | ||||
| import sonia.scm.repository.RevisionNotFoundException; | ||||
| import sonia.scm.repository.SvnUtil; | ||||
| import sonia.scm.util.Util; | ||||
|  | ||||
| //~--- JDK imports ------------------------------------------------------------ | ||||
|  | ||||
| import java.io.IOException; | ||||
|  | ||||
| import java.util.Collection; | ||||
| import java.util.List; | ||||
|  | ||||
| /** | ||||
|  * | ||||
|  * @author Sebastian Sdorra | ||||
|  */ | ||||
| //~--- JDK imports ------------------------------------------------------------ | ||||
|  | ||||
| public class SvnLogCommand extends AbstractSvnCommand implements LogCommand | ||||
| { | ||||
|  | ||||
| @@ -73,17 +65,6 @@ public class SvnLogCommand extends AbstractSvnCommand implements LogCommand | ||||
|   private static final Logger logger = | ||||
|     LoggerFactory.getLogger(SvnLogCommand.class); | ||||
|  | ||||
|   //~--- constructors --------------------------------------------------------- | ||||
|  | ||||
|   /** | ||||
|    * Constructs ... | ||||
|    * | ||||
|    * | ||||
|    * | ||||
|    * @param context | ||||
|    * @param repository | ||||
|    * @param repositoryDirectory | ||||
|    */ | ||||
|   SvnLogCommand(SvnContext context, Repository repository) | ||||
|   { | ||||
|     super(context, repository); | ||||
| @@ -91,22 +72,9 @@ public class SvnLogCommand extends AbstractSvnCommand implements LogCommand | ||||
|  | ||||
|   //~--- get methods ---------------------------------------------------------- | ||||
|  | ||||
|   /** | ||||
|    * Method description | ||||
|    * | ||||
|    * | ||||
|    * @param revision | ||||
|    * | ||||
|    * @return | ||||
|    * | ||||
|    * @throws IOException | ||||
|    * @throws RepositoryException | ||||
|    */ | ||||
|   @Override | ||||
|   @SuppressWarnings("unchecked") | ||||
|   public Changeset getChangeset(String revision) | ||||
|     throws IOException, RepositoryException | ||||
|   { | ||||
|   public Changeset getChangeset(String revision) throws RevisionNotFoundException { | ||||
|     Changeset changeset = null; | ||||
|  | ||||
|     if (logger.isDebugEnabled()) | ||||
| @@ -128,28 +96,15 @@ public class SvnLogCommand extends AbstractSvnCommand implements LogCommand | ||||
|     } | ||||
|     catch (SVNException ex) | ||||
|     { | ||||
|       throw new RepositoryException("could not open repository", ex); | ||||
|       throw new InternalRepositoryException("could not open repository", ex); | ||||
|     } | ||||
|  | ||||
|     return changeset; | ||||
|   } | ||||
|  | ||||
|   /** | ||||
|    * Method description | ||||
|    * | ||||
|    * | ||||
|    * @param request | ||||
|    * | ||||
|    * @return | ||||
|    * | ||||
|    * @throws IOException | ||||
|    * @throws RepositoryException | ||||
|    */ | ||||
|   @Override | ||||
|   @SuppressWarnings("unchecked") | ||||
|   public ChangesetPagingResult getChangesets(LogCommandRequest request) | ||||
|     throws IOException, RepositoryException | ||||
|   { | ||||
|   public ChangesetPagingResult getChangesets(LogCommandRequest request) throws RevisionNotFoundException { | ||||
|     if (logger.isDebugEnabled()) | ||||
|     { | ||||
|       logger.debug("fetch changesets for {}", request); | ||||
| @@ -183,7 +138,7 @@ public class SvnLogCommand extends AbstractSvnCommand implements LogCommand | ||||
|     } | ||||
|     catch (SVNException ex) | ||||
|     { | ||||
|       throw new RepositoryException("could not open repository", ex); | ||||
|       throw new InternalRepositoryException("could not open repository", ex); | ||||
|     } | ||||
|  | ||||
|     return changesets; | ||||
| @@ -191,18 +146,7 @@ public class SvnLogCommand extends AbstractSvnCommand implements LogCommand | ||||
|  | ||||
|   //~--- methods -------------------------------------------------------------- | ||||
|  | ||||
|   /** | ||||
|    * Method description | ||||
|    * | ||||
|    * | ||||
|    * @param v | ||||
|    * | ||||
|    * @return | ||||
|    * | ||||
|    * @throws RepositoryException | ||||
|    */ | ||||
|   private long parseRevision(String v) throws RepositoryException | ||||
|   { | ||||
|   private long parseRevision(String v) throws RevisionNotFoundException { | ||||
|     long result = -1l; | ||||
|  | ||||
|     if (!Strings.isNullOrEmpty(v)) | ||||
| @@ -213,8 +157,7 @@ public class SvnLogCommand extends AbstractSvnCommand implements LogCommand | ||||
|       } | ||||
|       catch (NumberFormatException ex) | ||||
|       { | ||||
|         throw new RepositoryException( | ||||
|           String.format("could not convert revision %s", v), ex); | ||||
|         throw new RevisionNotFoundException(v); | ||||
|       } | ||||
|     } | ||||
|  | ||||
|   | ||||
| @@ -35,17 +35,15 @@ package sonia.scm.repository.spi; | ||||
| //~--- non-JDK imports -------------------------------------------------------- | ||||
|  | ||||
| import org.junit.Test; | ||||
|  | ||||
| import sonia.scm.repository.BlameLine; | ||||
| import sonia.scm.repository.BlameResult; | ||||
| import sonia.scm.repository.RepositoryException; | ||||
|  | ||||
| import static org.junit.Assert.*; | ||||
| import static org.junit.Assert.assertEquals; | ||||
| import static org.junit.Assert.assertNotNull; | ||||
| import static org.junit.Assert.assertNull; | ||||
|  | ||||
| //~--- JDK imports ------------------------------------------------------------ | ||||
|  | ||||
| import java.io.IOException; | ||||
|  | ||||
| /** | ||||
|  * | ||||
|  * @author Sebastian Sdorra | ||||
| @@ -53,15 +51,8 @@ import java.io.IOException; | ||||
| public class SvnBlameCommandTest extends AbstractSvnCommandTestBase | ||||
| { | ||||
|  | ||||
|   /** | ||||
|    * Method description | ||||
|    * | ||||
|    * | ||||
|    * @throws IOException | ||||
|    * @throws RepositoryException | ||||
|    */ | ||||
|   @Test | ||||
|   public void testGetBlameResult() throws IOException, RepositoryException | ||||
|   public void testGetBlameResult() | ||||
|   { | ||||
|     BlameCommandRequest request = new BlameCommandRequest(); | ||||
|  | ||||
| @@ -85,17 +76,8 @@ public class SvnBlameCommandTest extends AbstractSvnCommandTestBase | ||||
|     assertNull(line.getAuthor().getMail()); | ||||
|   } | ||||
|  | ||||
|   /** | ||||
|    * Method description | ||||
|    * | ||||
|    * | ||||
|    * @throws IOException | ||||
|    * @throws RepositoryException | ||||
|    */ | ||||
|   @Test | ||||
|   public void testGetBlameResultWithRevision() | ||||
|           throws IOException, RepositoryException | ||||
|   { | ||||
|   public void testGetBlameResultWithRevision() { | ||||
|     BlameCommandRequest request = new BlameCommandRequest(); | ||||
|  | ||||
|     request.setPath("a.txt"); | ||||
|   | ||||
| @@ -36,19 +36,21 @@ package sonia.scm.repository.spi; | ||||
| //~--- non-JDK imports -------------------------------------------------------- | ||||
|  | ||||
| import org.junit.Test; | ||||
|  | ||||
| import sonia.scm.repository.BrowserResult; | ||||
| import sonia.scm.repository.FileObject; | ||||
| import sonia.scm.repository.RepositoryException; | ||||
|  | ||||
| import static org.junit.Assert.*; | ||||
|  | ||||
| //~--- JDK imports ------------------------------------------------------------ | ||||
| import sonia.scm.repository.RevisionNotFoundException; | ||||
|  | ||||
| import java.io.IOException; | ||||
|  | ||||
| import java.util.List; | ||||
|  | ||||
| import static org.junit.Assert.assertEquals; | ||||
| import static org.junit.Assert.assertFalse; | ||||
| import static org.junit.Assert.assertNotNull; | ||||
| import static org.junit.Assert.assertNull; | ||||
| import static org.junit.Assert.assertTrue; | ||||
|  | ||||
| //~--- JDK imports ------------------------------------------------------------ | ||||
|  | ||||
| /** | ||||
|  * | ||||
|  * @author Sebastian Sdorra | ||||
| @@ -56,16 +58,8 @@ import java.util.List; | ||||
| public class SvnBrowseCommandTest extends AbstractSvnCommandTestBase | ||||
| { | ||||
|  | ||||
|   /** | ||||
|    * Method description | ||||
|    * | ||||
|    * | ||||
|    * @throws IOException | ||||
|    * @throws RepositoryException | ||||
|    */ | ||||
|   @Test | ||||
|   public void testBrowse() throws IOException, RepositoryException | ||||
|   { | ||||
|   public void testBrowse() throws RevisionNotFoundException { | ||||
|     List<FileObject> foList = getRootFromTip(new BrowseCommandRequest()); | ||||
|  | ||||
|     FileObject a = getFileObject(foList, "a.txt"); | ||||
| @@ -87,11 +81,9 @@ public class SvnBrowseCommandTest extends AbstractSvnCommandTestBase | ||||
|    * | ||||
|    * | ||||
|    * @throws IOException | ||||
|    * @throws RepositoryException | ||||
|    */ | ||||
|   @Test | ||||
|   public void testBrowseSubDirectory() throws IOException, RepositoryException | ||||
|   { | ||||
|   public void testBrowseSubDirectory() throws RevisionNotFoundException { | ||||
|     BrowseCommandRequest request = new BrowseCommandRequest(); | ||||
|  | ||||
|     request.setPath("c"); | ||||
| @@ -137,16 +129,8 @@ public class SvnBrowseCommandTest extends AbstractSvnCommandTestBase | ||||
|     checkDate(e.getLastModified()); | ||||
|   } | ||||
|  | ||||
|   /** | ||||
|    * Method description | ||||
|    * | ||||
|    * | ||||
|    * @throws IOException | ||||
|    * @throws RepositoryException | ||||
|    */ | ||||
|   @Test | ||||
|   public void testDisableLastCommit() throws IOException, RepositoryException | ||||
|   { | ||||
|   public void testDisableLastCommit() throws RevisionNotFoundException { | ||||
|     BrowseCommandRequest request = new BrowseCommandRequest(); | ||||
|  | ||||
|     request.setDisableLastCommit(true); | ||||
| @@ -160,8 +144,7 @@ public class SvnBrowseCommandTest extends AbstractSvnCommandTestBase | ||||
|   } | ||||
|    | ||||
|   @Test | ||||
|   public void testRecursive() throws IOException, RepositoryException | ||||
|   { | ||||
|   public void testRecursive() throws RevisionNotFoundException { | ||||
|     BrowseCommandRequest request = new BrowseCommandRequest(); | ||||
|     request.setRecursive(true); | ||||
|     BrowserResult result = createCommand().getBrowserResult(request); | ||||
| @@ -220,20 +203,7 @@ public class SvnBrowseCommandTest extends AbstractSvnCommandTestBase | ||||
|     return a; | ||||
|   } | ||||
|  | ||||
|   /** | ||||
|    * Method description | ||||
|    * | ||||
|    * | ||||
|    * @param request | ||||
|    * | ||||
|    * @return | ||||
|    * | ||||
|    * @throws IOException | ||||
|    * @throws RepositoryException | ||||
|    */ | ||||
|   private List<FileObject> getRootFromTip(BrowseCommandRequest request) | ||||
|     throws IOException, RepositoryException | ||||
|   { | ||||
|   private List<FileObject> getRootFromTip(BrowseCommandRequest request) throws RevisionNotFoundException { | ||||
|     BrowserResult result = createCommand().getBrowserResult(request); | ||||
|  | ||||
|     assertNotNull(result); | ||||
|   | ||||
| @@ -37,23 +37,22 @@ package sonia.scm.repository.spi; | ||||
|  | ||||
| import com.google.common.io.ByteSink; | ||||
| import com.google.common.io.Files; | ||||
|  | ||||
| import org.junit.Rule; | ||||
| import org.junit.Test; | ||||
| import org.junit.rules.TemporaryFolder; | ||||
|  | ||||
| import sonia.scm.repository.RepositoryException; | ||||
| import sonia.scm.repository.api.BundleResponse; | ||||
|  | ||||
| import static org.hamcrest.Matchers.*; | ||||
|  | ||||
| import static org.junit.Assert.*; | ||||
|  | ||||
| //~--- JDK imports ------------------------------------------------------------ | ||||
|  | ||||
| import java.io.File; | ||||
| import java.io.IOException; | ||||
|  | ||||
| import static org.hamcrest.Matchers.greaterThan; | ||||
| import static org.hamcrest.Matchers.is; | ||||
| import static org.hamcrest.Matchers.notNullValue; | ||||
| import static org.junit.Assert.assertThat; | ||||
| import static org.junit.Assert.assertTrue; | ||||
|  | ||||
| //~--- JDK imports ------------------------------------------------------------ | ||||
|  | ||||
| /** | ||||
|  * | ||||
|  * @author Sebastian Sdorra | ||||
| @@ -61,15 +60,8 @@ import java.io.IOException; | ||||
| public class SvnBundleCommandTest extends AbstractSvnCommandTestBase | ||||
| { | ||||
|  | ||||
|   /** | ||||
|    * Method description | ||||
|    * | ||||
|    * | ||||
|    * @throws IOException | ||||
|    * @throws RepositoryException | ||||
|    */ | ||||
|   @Test | ||||
|   public void testBundle() throws IOException, RepositoryException | ||||
|   public void testBundle() throws IOException | ||||
|   { | ||||
|     File file = temp.newFile(); | ||||
|     ByteSink sink = Files.asByteSink(file); | ||||
|   | ||||
| @@ -34,7 +34,6 @@ package sonia.scm.repository.spi; | ||||
|  | ||||
| import org.junit.Test; | ||||
| import sonia.scm.repository.PathNotFoundException; | ||||
| import sonia.scm.repository.RepositoryException; | ||||
| import sonia.scm.repository.RevisionNotFoundException; | ||||
|  | ||||
| import java.io.ByteArrayOutputStream; | ||||
| @@ -48,7 +47,7 @@ import static org.junit.Assert.assertEquals; | ||||
| public class SvnCatCommandTest extends AbstractSvnCommandTestBase { | ||||
|  | ||||
|   @Test | ||||
|   public void testCat() throws IOException, RepositoryException { | ||||
|   public void testCat() throws PathNotFoundException, RevisionNotFoundException { | ||||
|     CatCommandRequest request = new CatCommandRequest(); | ||||
|  | ||||
|     request.setPath("a.txt"); | ||||
| @@ -57,7 +56,7 @@ public class SvnCatCommandTest extends AbstractSvnCommandTestBase { | ||||
|   } | ||||
|  | ||||
|   @Test | ||||
|   public void testSimpleCat() throws IOException, RepositoryException { | ||||
|   public void testSimpleCat() throws PathNotFoundException, RevisionNotFoundException { | ||||
|     CatCommandRequest request = new CatCommandRequest(); | ||||
|  | ||||
|     request.setPath("c/d.txt"); | ||||
| @@ -65,7 +64,7 @@ public class SvnCatCommandTest extends AbstractSvnCommandTestBase { | ||||
|   } | ||||
|  | ||||
|   @Test(expected = PathNotFoundException.class) | ||||
|   public void testUnknownFile() throws IOException, RepositoryException { | ||||
|   public void testUnknownFile() throws PathNotFoundException, RevisionNotFoundException { | ||||
|     CatCommandRequest request = new CatCommandRequest(); | ||||
|  | ||||
|     request.setPath("unknown"); | ||||
| @@ -75,7 +74,7 @@ public class SvnCatCommandTest extends AbstractSvnCommandTestBase { | ||||
|   } | ||||
|  | ||||
|   @Test(expected = RevisionNotFoundException.class) | ||||
|   public void testUnknownRevision() throws IOException, RepositoryException { | ||||
|   public void testUnknownRevision() throws PathNotFoundException, RevisionNotFoundException { | ||||
|     CatCommandRequest request = new CatCommandRequest(); | ||||
|  | ||||
|     request.setPath("a.txt"); | ||||
| @@ -85,7 +84,7 @@ public class SvnCatCommandTest extends AbstractSvnCommandTestBase { | ||||
|   } | ||||
|  | ||||
|   @Test | ||||
|   public void testSimpleStream() throws IOException, RepositoryException { | ||||
|   public void testSimpleStream() throws IOException, PathNotFoundException, RevisionNotFoundException { | ||||
|     CatCommandRequest request = new CatCommandRequest(); | ||||
|     request.setPath("a.txt"); | ||||
|     request.setRevision("1"); | ||||
| @@ -99,7 +98,7 @@ public class SvnCatCommandTest extends AbstractSvnCommandTestBase { | ||||
|     catResultStream.close(); | ||||
|   } | ||||
|  | ||||
|   private String execute(CatCommandRequest request) throws IOException, RepositoryException { | ||||
|   private String execute(CatCommandRequest request) throws PathNotFoundException, RevisionNotFoundException { | ||||
|     String content = null; | ||||
|     ByteArrayOutputStream baos = new ByteArrayOutputStream(); | ||||
|  | ||||
|   | ||||
| @@ -35,18 +35,18 @@ package sonia.scm.repository.spi; | ||||
| //~--- non-JDK imports -------------------------------------------------------- | ||||
|  | ||||
| import org.junit.Test; | ||||
|  | ||||
| import sonia.scm.repository.Changeset; | ||||
| import sonia.scm.repository.ChangesetPagingResult; | ||||
| import sonia.scm.repository.Modifications; | ||||
| import sonia.scm.repository.RepositoryException; | ||||
| import sonia.scm.repository.RevisionNotFoundException; | ||||
|  | ||||
| import static org.junit.Assert.*; | ||||
| import static org.junit.Assert.assertEquals; | ||||
| import static org.junit.Assert.assertNotNull; | ||||
| import static org.junit.Assert.assertNull; | ||||
| import static org.junit.Assert.assertTrue; | ||||
|  | ||||
| //~--- JDK imports ------------------------------------------------------------ | ||||
|  | ||||
| import java.io.IOException; | ||||
|  | ||||
| /** | ||||
|  * | ||||
|  * @author Sebastian Sdorra | ||||
| @@ -54,16 +54,8 @@ import java.io.IOException; | ||||
| public class SvnLogCommandTest extends AbstractSvnCommandTestBase | ||||
| { | ||||
|  | ||||
|   /** | ||||
|    *   Method description | ||||
|    * | ||||
|    * | ||||
|    *   @throws IOException | ||||
|    * @throws RepositoryException | ||||
|    */ | ||||
|   @Test | ||||
|   public void testGetAll() throws IOException, RepositoryException | ||||
|   { | ||||
|   public void testGetAll() throws RevisionNotFoundException { | ||||
|     ChangesetPagingResult result = | ||||
|       createCommand().getChangesets(new LogCommandRequest()); | ||||
|  | ||||
| @@ -72,16 +64,8 @@ public class SvnLogCommandTest extends AbstractSvnCommandTestBase | ||||
|     assertEquals(6, result.getChangesets().size()); | ||||
|   } | ||||
|  | ||||
|   /** | ||||
|    * Method description | ||||
|    * | ||||
|    * | ||||
|    * @throws IOException | ||||
|    * @throws RepositoryException | ||||
|    */ | ||||
|   @Test | ||||
|   public void testGetAllByPath() throws IOException, RepositoryException | ||||
|   { | ||||
|   public void testGetAllByPath() throws RevisionNotFoundException { | ||||
|     LogCommandRequest request = new LogCommandRequest(); | ||||
|  | ||||
|     request.setPath("a.txt"); | ||||
| @@ -96,16 +80,8 @@ public class SvnLogCommandTest extends AbstractSvnCommandTestBase | ||||
|     assertEquals("1", result.getChangesets().get(2).getId()); | ||||
|   } | ||||
|  | ||||
|   /** | ||||
|    *  Method description | ||||
|    * | ||||
|    * | ||||
|    *  @throws IOException | ||||
|    * @throws RepositoryException | ||||
|    */ | ||||
|   @Test | ||||
|   public void testGetAllWithLimit() throws IOException, RepositoryException | ||||
|   { | ||||
|   public void testGetAllWithLimit() throws RevisionNotFoundException { | ||||
|     LogCommandRequest request = new LogCommandRequest(); | ||||
|  | ||||
|     request.setPagingLimit(2); | ||||
| @@ -127,16 +103,8 @@ public class SvnLogCommandTest extends AbstractSvnCommandTestBase | ||||
|     assertEquals("4", c2.getId()); | ||||
|   } | ||||
|  | ||||
|   /** | ||||
|    * Method description | ||||
|    * | ||||
|    * | ||||
|    * @throws IOException | ||||
|    * @throws RepositoryException | ||||
|    */ | ||||
|   @Test | ||||
|   public void testGetAllWithPaging() throws IOException, RepositoryException | ||||
|   { | ||||
|   public void testGetAllWithPaging() throws RevisionNotFoundException { | ||||
|     LogCommandRequest request = new LogCommandRequest(); | ||||
|  | ||||
|     request.setPagingStart(1); | ||||
| @@ -159,16 +127,8 @@ public class SvnLogCommandTest extends AbstractSvnCommandTestBase | ||||
|     assertEquals("3", c2.getId()); | ||||
|   } | ||||
|  | ||||
|   /** | ||||
|    *  Method description | ||||
|    * | ||||
|    * | ||||
|    * @throws IOException | ||||
|    * @throws RepositoryException | ||||
|    */ | ||||
|   @Test | ||||
|   public void testGetCommit() throws IOException, RepositoryException | ||||
|   { | ||||
|   public void testGetCommit() throws RevisionNotFoundException { | ||||
|     Changeset c = createCommand().getChangeset("3"); | ||||
|  | ||||
|     assertNotNull(c); | ||||
| @@ -188,16 +148,8 @@ public class SvnLogCommandTest extends AbstractSvnCommandTestBase | ||||
|     assertEquals("b.txt", mods.getRemoved().get(0)); | ||||
|   } | ||||
|  | ||||
|   /** | ||||
|    *  Method description | ||||
|    * | ||||
|    * | ||||
|    *  @throws IOException | ||||
|    * @throws RepositoryException | ||||
|    */ | ||||
|   @Test | ||||
|   public void testGetRange() throws IOException, RepositoryException | ||||
|   { | ||||
|   public void testGetRange() throws RevisionNotFoundException { | ||||
|     LogCommandRequest request = new LogCommandRequest(); | ||||
|  | ||||
|     request.setStartChangeset("2"); | ||||
|   | ||||
| @@ -34,26 +34,22 @@ package sonia.scm.repository.spi; | ||||
| //~--- non-JDK imports -------------------------------------------------------- | ||||
|  | ||||
| import com.google.common.io.Files; | ||||
|  | ||||
| import org.junit.Test; | ||||
|  | ||||
| import org.tmatesoft.svn.core.SVNException; | ||||
| import org.tmatesoft.svn.core.io.SVNRepository; | ||||
| import org.tmatesoft.svn.core.io.SVNRepositoryFactory; | ||||
|  | ||||
| import sonia.scm.repository.RepositoryException; | ||||
| import sonia.scm.repository.SvnUtil; | ||||
| import sonia.scm.repository.api.UnbundleResponse; | ||||
|  | ||||
| import static org.hamcrest.Matchers.*; | ||||
|  | ||||
| import static org.junit.Assert.*; | ||||
|  | ||||
| //~--- JDK imports ------------------------------------------------------------ | ||||
|  | ||||
| import java.io.File; | ||||
| import java.io.IOException; | ||||
|  | ||||
| import static org.hamcrest.Matchers.is; | ||||
| import static org.hamcrest.Matchers.notNullValue; | ||||
| import static org.junit.Assert.assertThat; | ||||
|  | ||||
| //~--- JDK imports ------------------------------------------------------------ | ||||
|  | ||||
| /** | ||||
|  * | ||||
|  * @author Sebastian Sdorra | ||||
| @@ -61,17 +57,9 @@ import java.io.IOException; | ||||
| public class SvnUnbundleCommandTest extends AbstractSvnCommandTestBase | ||||
| { | ||||
|  | ||||
|   /** | ||||
|    * Method description | ||||
|    * | ||||
|    * | ||||
|    * @throws IOException | ||||
|    * @throws RepositoryException | ||||
|    * @throws SVNException | ||||
|    */ | ||||
|   @Test | ||||
|   public void testUnbundle() | ||||
|     throws IOException, RepositoryException, SVNException | ||||
|     throws IOException, SVNException | ||||
|   { | ||||
|     File bundle = bundle(); | ||||
|     SvnContext ctx = createEmptyContext(); | ||||
| @@ -95,16 +83,7 @@ public class SvnUnbundleCommandTest extends AbstractSvnCommandTestBase | ||||
|     SvnUtil.closeSession(repo); | ||||
|   } | ||||
|  | ||||
|   /** | ||||
|    * Method description | ||||
|    * | ||||
|    * | ||||
|    * @return | ||||
|    * | ||||
|    * @throws IOException | ||||
|    * @throws RepositoryException | ||||
|    */ | ||||
|   private File bundle() throws IOException, RepositoryException | ||||
|   private File bundle() throws IOException | ||||
|   { | ||||
|     File file = tempFolder.newFile(); | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user