mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-12 00:15:44 +01:00
Fix typo
This commit is contained in:
@@ -27,17 +27,17 @@ public class ContentResource {
|
|||||||
|
|
||||||
private static final Logger LOG = LoggerFactory.getLogger(ContentResource.class);
|
private static final Logger LOG = LoggerFactory.getLogger(ContentResource.class);
|
||||||
|
|
||||||
private final RepositoryServiceFactory servicefactory;
|
private final RepositoryServiceFactory serviceFactory;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public ContentResource(RepositoryServiceFactory servicefactory) {
|
public ContentResource(RepositoryServiceFactory serviceFactory) {
|
||||||
this.servicefactory = servicefactory;
|
this.serviceFactory = serviceFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
@Path("{revision}/{path: .*}")
|
@Path("{revision}/{path: .*}")
|
||||||
public Response get(@PathParam("namespace") String namespace, @PathParam("name") String name, @PathParam("revision") String revision, @PathParam("path") String path) {
|
public Response get(@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))) {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
StreamingOutput stream = os -> {
|
StreamingOutput stream = os -> {
|
||||||
@@ -72,7 +72,7 @@ public class ContentResource {
|
|||||||
@HEAD
|
@HEAD
|
||||||
@Path("{revision}/{path: .*}")
|
@Path("{revision}/{path: .*}")
|
||||||
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))) {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
Response.ResponseBuilder responseBuilder = Response.ok();
|
Response.ResponseBuilder responseBuilder = Response.ok();
|
||||||
|
|||||||
@@ -115,15 +115,6 @@ public class ContentResourceTest {
|
|||||||
assertEquals("application/octet-stream", response.getHeaderString("Content-Type"));
|
assertEquals("application/octet-stream", response.getHeaderString("Content-Type"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
public void shouldHandleExceptionsInStreamProcessing() throws Exception {
|
|
||||||
Response response = contentResource.get(NAMESPACE, REPO_NAME, REV, "MissingFile");
|
|
||||||
|
|
||||||
ByteArrayOutputStream baos = readOutputStream(response);
|
|
||||||
|
|
||||||
assertEquals(404, response.getStatus());
|
|
||||||
}
|
|
||||||
|
|
||||||
private void mockContentFromResource(String fileName) throws Exception {
|
private void mockContentFromResource(String fileName) throws Exception {
|
||||||
URL url = Resources.getResource(fileName);
|
URL url = Resources.getResource(fileName);
|
||||||
mockContent(fileName, Resources.toByteArray(url));
|
mockContent(fileName, Resources.toByteArray(url));
|
||||||
|
|||||||
Reference in New Issue
Block a user