mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-10 15:35:49 +01:00
Merged heads
This commit is contained in:
2
pom.xml
2
pom.xml
@@ -305,7 +305,7 @@
|
|||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.mockito</groupId>
|
<groupId>org.mockito</groupId>
|
||||||
<artifactId>mockito-all</artifactId>
|
<artifactId>mockito-core</artifactId>
|
||||||
<version>${mockito.version}</version>
|
<version>${mockito.version}</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|||||||
@@ -42,8 +42,6 @@ import java.io.InputStream;
|
|||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
|
|
||||||
//~--- JDK imports ------------------------------------------------------------
|
|
||||||
|
|
||||||
public class HgCatCommandTest extends AbstractHgCommandTestBase {
|
public class HgCatCommandTest extends AbstractHgCommandTestBase {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
@@ -73,17 +73,17 @@ public class ContentResource {
|
|||||||
|
|
||||||
private StreamingOutput createStreamingOutput(@PathParam("namespace") String namespace, @PathParam("name") String name, @PathParam("revision") String revision, @PathParam("path") String path, RepositoryService repositoryService) {
|
private StreamingOutput createStreamingOutput(@PathParam("namespace") String namespace, @PathParam("name") String name, @PathParam("revision") String revision, @PathParam("path") String path, RepositoryService repositoryService) {
|
||||||
return os -> {
|
return os -> {
|
||||||
try {
|
try {
|
||||||
repositoryService.getCatCommand().setRevision(revision).retriveContent(os, path);
|
repositoryService.getCatCommand().setRevision(revision).retriveContent(os, path);
|
||||||
os.close();
|
os.close();
|
||||||
} catch (PathNotFoundException e) {
|
} catch (PathNotFoundException e) {
|
||||||
LOG.debug("path '{}' not found in repository {}/{}", path, namespace, name, e);
|
LOG.debug("path '{}' not found in repository {}/{}", path, namespace, name, e);
|
||||||
throw new WebApplicationException(Status.NOT_FOUND);
|
throw new WebApplicationException(Status.NOT_FOUND);
|
||||||
} catch (RepositoryException e) {
|
} catch (RepositoryException e) {
|
||||||
LOG.info("error reading repository resource {} from {}/{}", path, namespace, name, e);
|
LOG.info("error reading repository resource {} from {}/{}", path, namespace, name, e);
|
||||||
throw new WebApplicationException(Status.INTERNAL_SERVER_ERROR);
|
throw new WebApplicationException(Status.INTERNAL_SERVER_ERROR);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -107,7 +107,7 @@ public class ContentResource {
|
|||||||
})
|
})
|
||||||
public Response metadata(@PathParam("namespace") String namespace, @PathParam("name") String name, @PathParam("revision") String revision, @PathParam("path") String path) {
|
public Response metadata(@PathParam("namespace") String namespace, @PathParam("name") String name, @PathParam("revision") String revision, @PathParam("path") String path) {
|
||||||
try (RepositoryService repositoryService = serviceFactory.create(new NamespaceAndName(namespace, name))) {
|
try (RepositoryService repositoryService = serviceFactory.create(new NamespaceAndName(namespace, name))) {
|
||||||
Response.ResponseBuilder responseBuilder = Response.ok();
|
Response.ResponseBuilder responseBuilder = Response.ok();
|
||||||
return createContentHeader(namespace, name, revision, path, repositoryService, responseBuilder);
|
return createContentHeader(namespace, name, revision, path, repositoryService, responseBuilder);
|
||||||
} catch (RepositoryNotFoundException e) {
|
} catch (RepositoryNotFoundException e) {
|
||||||
LOG.debug("path '{}' not found in repository {}/{}", path, namespace, name, e);
|
LOG.debug("path '{}' not found in repository {}/{}", path, namespace, name, e);
|
||||||
@@ -124,10 +124,7 @@ public class ContentResource {
|
|||||||
} catch (RevisionNotFoundException e) {
|
} catch (RevisionNotFoundException e) {
|
||||||
LOG.debug("revision '{}' not found in repository {}/{}", revision, namespace, name, e);
|
LOG.debug("revision '{}' not found in repository {}/{}", revision, namespace, name, e);
|
||||||
return Response.status(Status.NOT_FOUND).build();
|
return Response.status(Status.NOT_FOUND).build();
|
||||||
} catch (IOException e) {
|
} catch (IOException | RepositoryException e) {
|
||||||
LOG.info("error reading repository resource {} from {}/{}", path, namespace, name, e);
|
|
||||||
return Response.status(Status.INTERNAL_SERVER_ERROR).entity(e.getMessage()).build();
|
|
||||||
} catch (RepositoryException e) {
|
|
||||||
LOG.info("error reading repository resource {} from {}/{}", path, namespace, name, e);
|
LOG.info("error reading repository resource {} from {}/{}", path, namespace, name, e);
|
||||||
return Response.status(Status.INTERNAL_SERVER_ERROR).entity(e.getMessage()).build();
|
return Response.status(Status.INTERNAL_SERVER_ERROR).entity(e.getMessage()).build();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user