Minor changes due to review

This commit is contained in:
Philipp Czora
2018-08-09 11:21:29 +02:00
parent 8e0af3354f
commit efc72b21ec
4 changed files with 1 additions and 11 deletions

View File

@@ -29,11 +29,8 @@
* *
*/ */
package sonia.scm.repository.api; package sonia.scm.repository.api;
//~--- non-JDK imports --------------------------------------------------------
import com.google.common.base.Objects; import com.google.common.base.Objects;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@@ -49,7 +46,6 @@ import sonia.scm.repository.spi.BranchesCommand;
import java.io.IOException; import java.io.IOException;
//~--- JDK imports ------------------------------------------------------------
/** /**
* The branches command list all repository branches.<br /> * The branches command list all repository branches.<br />

View File

@@ -56,10 +56,8 @@ public class BranchRootResource {
@ResponseCode(code = 500, condition = "internal server error") @ResponseCode(code = 500, condition = "internal server error")
}) })
public Response get(@PathParam("namespace") String namespace, @PathParam("name") String name, @PathParam("branch") String branchName) throws IOException, RepositoryException { public Response get(@PathParam("namespace") String namespace, @PathParam("name") String name, @PathParam("branch") String branchName) throws IOException, RepositoryException {
System.out.println("in branch resource");
try (RepositoryService repositoryService = servicefactory.create(new NamespaceAndName(namespace, name))) { try (RepositoryService repositoryService = servicefactory.create(new NamespaceAndName(namespace, name))) {
Branches branches = repositoryService.getBranchesCommand().getBranches(); Branches branches = repositoryService.getBranchesCommand().getBranches();
System.out.println("found branches: " + branches);
return branches.getBranches() return branches.getBranches()
.stream() .stream()
.filter(branch -> branchName.equals(branch.getName())) .filter(branch -> branchName.equals(branch.getName()))
@@ -71,7 +69,6 @@ public class BranchRootResource {
} catch (CommandNotSupportedException ex) { } catch (CommandNotSupportedException ex) {
return Response.status(Response.Status.BAD_REQUEST).build(); return Response.status(Response.Status.BAD_REQUEST).build();
} catch (RepositoryNotFoundException e) { } catch (RepositoryNotFoundException e) {
System.out.println("got RepositoryNotFoundException");
return Response.status(Response.Status.NOT_FOUND).build(); return Response.status(Response.Status.NOT_FOUND).build();
} }
} }
@@ -79,7 +76,7 @@ public class BranchRootResource {
@Path("{branch}/changesets/") @Path("{branch}/changesets/")
@GET @GET
public Response history(@PathParam("namespace") String namespace, @PathParam("name") String name, @PathParam("branch") String branchName) { public Response history(@PathParam("namespace") String namespace, @PathParam("name") String name, @PathParam("branch") String branchName) {
return null; throw new UnsupportedOperationException();
} }
/** /**

View File

@@ -138,7 +138,6 @@ public class RepositoryResource {
@Path("branches/") @Path("branches/")
public BranchRootResource branches(@PathParam("namespace") String namespace, @PathParam("name") String name) { public BranchRootResource branches(@PathParam("namespace") String namespace, @PathParam("name") String name) {
System.out.println("got request for branches");
return branchRootResource.get(); return branchRootResource.get();
} }

View File

@@ -72,8 +72,6 @@ import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.any; import static org.mockito.Mockito.any;
import static org.mockito.Mockito.when; import static org.mockito.Mockito.when;
//~--- JDK imports ------------------------------------------------------------
/** /**
* Unit tests for {@link BearerRealm}. * Unit tests for {@link BearerRealm}.
* *