This commit is contained in:
Mohamed Karray
2018-09-14 16:36:02 +02:00
parent 188d2d8cef
commit 9a207d3313
15 changed files with 13 additions and 28 deletions

View File

@@ -28,7 +28,6 @@ import java.io.IOException;
* @since 2.0 * @since 2.0
*/ */
@Slf4j @Slf4j
@AllArgsConstructor
@RequiredArgsConstructor @RequiredArgsConstructor
@Accessors(fluent = true) @Accessors(fluent = true)
public final class ModificationsCommandBuilder { public final class ModificationsCommandBuilder {

View File

@@ -258,7 +258,7 @@ public final class RepositoryService implements Closeable {
* by the implementation of the repository service provider. * by the implementation of the repository service provider.
*/ */
public ModificationsCommandBuilder getModificationsCommand() { public ModificationsCommandBuilder getModificationsCommand() {
logger.debug("create modifications command for repository {}", repository.getName()); logger.debug("create modifications command for repository {}",repository.getNamespaceAndName());
return new ModificationsCommandBuilder(provider.getModificationsCommand(),repository, cacheManager.getCache(ModificationsCommandBuilder.CACHE_NAME), preProcessorUtil); return new ModificationsCommandBuilder(provider.getModificationsCommand(),repository, cacheManager.getCache(ModificationsCommandBuilder.CACHE_NAME), preProcessorUtil);
} }

View File

@@ -36,10 +36,4 @@ public class ModificationsDto extends HalRepresentation {
return super.add(links); return super.add(links);
} }
@SuppressWarnings("squid:S1185") // We want to have this method available in this package
protected HalRepresentation withEmbedded(String rel, List<? extends HalRepresentation> halRepresentations) {
return super.withEmbedded(rel, halRepresentations);
}
} }

View File

@@ -34,20 +34,12 @@ public class ModificationsRootResource {
/** /**
* Get the file modifications related to a revision. * Get the file modifications related to a revision.
* file modifications are for example: Modified, Added or Removed. * file modifications are for example: Modified, Added or Removed.
*
* @param namespace
* @param name
* @param revision
* @return
* @throws IOException
* @throws RevisionNotFoundException
* @throws RepositoryNotFoundException
*/ */
@GET @GET
@StatusCodes({ @StatusCodes({
@ResponseCode(code = 200, condition = "success"), @ResponseCode(code = 200, condition = "success"),
@ResponseCode(code = 401, condition = "not authenticated / invalid credentials"), @ResponseCode(code = 401, condition = "not authenticated / invalid credentials"),
@ResponseCode(code = 403, condition = "not authorized, the current user has no privileges to read the changeset"), @ResponseCode(code = 403, condition = "not authorized, the current user has no privileges to read the modifications"),
@ResponseCode(code = 404, condition = "not found, no changeset with the specified id is available in the repository"), @ResponseCode(code = 404, condition = "not found, no changeset with the specified id is available in the repository"),
@ResponseCode(code = 500, condition = "internal server error") @ResponseCode(code = 500, condition = "internal server error")
}) })

View File

@@ -14,7 +14,7 @@ import javax.inject.Inject;
import static de.otto.edison.hal.Links.linkingTo; import static de.otto.edison.hal.Links.linkingTo;
@Mapper @Mapper
public abstract class ModificationsToDtoMapper extends BaseMapper<Modifications, ModificationsDto> { public abstract class ModificationsToDtoMapper {
@Inject @Inject
private ResourceLinks resourceLinks; private ResourceLinks resourceLinks;

View File

@@ -44,7 +44,7 @@ import static org.mockito.Mockito.when;
@RunWith(MockitoJUnitRunner.Silent.class) @RunWith(MockitoJUnitRunner.Silent.class)
@Slf4j @Slf4j
public class BranchRootResourceTest extends BaseRepositoryTest { public class BranchRootResourceTestBase extends RepositoryTestBase {
public static final String BRANCH_PATH = "space/repo/branches/master"; public static final String BRANCH_PATH = "space/repo/branches/master";
public static final String BRANCH_URL = "/" + RepositoryRootResource.REPOSITORIES_PATH_V2 + BRANCH_PATH; public static final String BRANCH_URL = "/" + RepositoryRootResource.REPOSITORIES_PATH_V2 + BRANCH_PATH;

View File

@@ -44,7 +44,7 @@ import static org.mockito.Mockito.when;
@RunWith(MockitoJUnitRunner.Silent.class) @RunWith(MockitoJUnitRunner.Silent.class)
@Slf4j @Slf4j
public class ChangesetRootResourceTest extends BaseRepositoryTest{ public class ChangesetRootResourceTestBase extends RepositoryTestBase {
public static final String CHANGESET_PATH = "space/repo/changesets/"; public static final String CHANGESET_PATH = "space/repo/changesets/";

View File

@@ -37,7 +37,7 @@ import static org.mockito.Mockito.when;
@RunWith(MockitoJUnitRunner.Silent.class) @RunWith(MockitoJUnitRunner.Silent.class)
@Slf4j @Slf4j
public class DiffResourceTest extends BaseRepositoryTest { public class DiffResourceTestBase extends RepositoryTestBase {
public static final String DIFF_PATH = "space/repo/diff/"; public static final String DIFF_PATH = "space/repo/diff/";

View File

@@ -47,7 +47,7 @@ import static org.mockito.Mockito.when;
@RunWith(MockitoJUnitRunner.Silent.class) @RunWith(MockitoJUnitRunner.Silent.class)
@Slf4j @Slf4j
public class FileHistoryResourceTest extends BaseRepositoryTest { public class FileHistoryResourceTestBase extends RepositoryTestBase {
public static final String FILE_HISTORY_PATH = "space/repo/history/"; public static final String FILE_HISTORY_PATH = "space/repo/history/";
public static final String FILE_HISTORY_URL = "/" + RepositoryRootResource.REPOSITORIES_PATH_V2 + FILE_HISTORY_PATH; public static final String FILE_HISTORY_URL = "/" + RepositoryRootResource.REPOSITORIES_PATH_V2 + FILE_HISTORY_PATH;

View File

@@ -39,7 +39,7 @@ import static org.mockito.Mockito.when;
@Slf4j @Slf4j
@RunWith(MockitoJUnitRunner.Silent.class) @RunWith(MockitoJUnitRunner.Silent.class)
public class ModificationsResourceTest extends BaseRepositoryTest { public class ModificationsResourceTestBase extends RepositoryTestBase {
public static final String MODIFICATIONS_PATH = "space/repo/modifications/"; public static final String MODIFICATIONS_PATH = "space/repo/modifications/";

View File

@@ -64,7 +64,7 @@ import static sonia.scm.api.v2.resources.PermissionDto.GROUP_PREFIX;
password = "secret", password = "secret",
configuration = "classpath:sonia/scm/repository/shiro.ini" configuration = "classpath:sonia/scm/repository/shiro.ini"
) )
public class PermissionRootResourceTest extends BaseRepositoryTest { public class PermissionRootResourceTestBase extends RepositoryTestBase {
private static final String REPOSITORY_NAMESPACE = "repo_namespace"; private static final String REPOSITORY_NAMESPACE = "repo_namespace";
private static final String REPOSITORY_NAME = "repo"; private static final String REPOSITORY_NAME = "repo";
private static final String PERMISSION_WRITE = "repository:permissionWrite:" + REPOSITORY_NAME; private static final String PERMISSION_WRITE = "repository:permissionWrite:" + REPOSITORY_NAME;

View File

@@ -55,7 +55,7 @@ import static sonia.scm.api.v2.resources.DispatcherMock.createDispatcher;
password = "secret", password = "secret",
configuration = "classpath:sonia/scm/repository/shiro.ini" configuration = "classpath:sonia/scm/repository/shiro.ini"
) )
public class RepositoryRootResourceTest extends BaseRepositoryTest { public class RepositoryRootResourceTestBase extends RepositoryTestBase {
private Dispatcher dispatcher; private Dispatcher dispatcher;

View File

@@ -4,7 +4,7 @@ import sonia.scm.repository.RepositoryManager;
import javax.inject.Provider; import javax.inject.Provider;
public class BaseRepositoryTest { public abstract class RepositoryTestBase {
protected RepositoryToRepositoryDtoMapper repositoryToDtoMapper; protected RepositoryToRepositoryDtoMapper repositoryToDtoMapper;

View File

@@ -32,7 +32,7 @@ import static sonia.scm.api.v2.resources.DispatcherMock.createDispatcher;
@RunWith(MockitoJUnitRunner.Silent.class) @RunWith(MockitoJUnitRunner.Silent.class)
public class SourceRootResourceTest extends BaseRepositoryTest { public class SourceRootResourceTestBase extends RepositoryTestBase {
private Dispatcher dispatcher; private Dispatcher dispatcher;
private final URI baseUri = URI.create("/"); private final URI baseUri = URI.create("/");

View File

@@ -38,7 +38,7 @@ import static sonia.scm.api.v2.resources.DispatcherMock.createDispatcher;
@Slf4j @Slf4j
@RunWith(MockitoJUnitRunner.Silent.class) @RunWith(MockitoJUnitRunner.Silent.class)
public class TagRootResourceTest extends BaseRepositoryTest { public class TagRootResourceTestBase extends RepositoryTestBase {
public static final String TAG_PATH = "space/repo/tags/"; public static final String TAG_PATH = "space/repo/tags/";
public static final String TAG_URL = "/" + RepositoryRootResource.REPOSITORIES_PATH_V2 + TAG_PATH; public static final String TAG_URL = "/" + RepositoryRootResource.REPOSITORIES_PATH_V2 + TAG_PATH;