HgPlugin Config: Minor corrections

This commit is contained in:
Johannes Schnatterer
2018-08-02 11:56:06 +02:00
parent 31540a7ecc
commit f20865c658
4 changed files with 9 additions and 9 deletions

View File

@@ -6,7 +6,7 @@ import com.webcohesion.enunciate.metadata.rs.TypeHint;
import sonia.scm.config.ConfigurationPermissions; import sonia.scm.config.ConfigurationPermissions;
import sonia.scm.repository.HgConfig; import sonia.scm.repository.HgConfig;
import sonia.scm.repository.HgRepositoryHandler; import sonia.scm.repository.HgRepositoryHandler;
import sonia.scm.repository.HgVndMediaType; import sonia.scm.web.HgVndMediaType;
import javax.inject.Inject; import javax.inject.Inject;
import javax.ws.rs.Consumes; import javax.ws.rs.Consumes;
@@ -21,10 +21,10 @@ import javax.ws.rs.core.UriInfo;
/** /**
* RESTful Web Service Resource to manage the configuration of the hg plugin. * RESTful Web Service Resource to manage the configuration of the hg plugin.
*/ */
@Path(HgConfigResource.GIT_CONFIG_PATH_V2) @Path(HgConfigResource.HG_CONFIG_PATH_V2)
public class HgConfigResource { public class HgConfigResource {
static final String GIT_CONFIG_PATH_V2 = "v2/config/hg"; static final String HG_CONFIG_PATH_V2 = "v2/config/hg";
private final HgConfigDtoToHgConfigMapper dtoToConfigMapper; private final HgConfigDtoToHgConfigMapper dtoToConfigMapper;
private final HgConfigToHgConfigDtoMapper configToDtoMapper; private final HgConfigToHgConfigDtoMapper configToDtoMapper;
private final HgRepositoryHandler repositoryHandler; private final HgRepositoryHandler repositoryHandler;

View File

@@ -1,4 +1,4 @@
package sonia.scm.repository; package sonia.scm.web;
import sonia.scm.web.VndMediaType; import sonia.scm.web.VndMediaType;

View File

@@ -19,7 +19,7 @@ import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner; import org.mockito.runners.MockitoJUnitRunner;
import sonia.scm.repository.HgConfig; import sonia.scm.repository.HgConfig;
import sonia.scm.repository.HgRepositoryHandler; import sonia.scm.repository.HgRepositoryHandler;
import sonia.scm.repository.HgVndMediaType; import sonia.scm.web.HgVndMediaType;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.File; import java.io.File;
@@ -124,21 +124,21 @@ public class HgConfigResourceTest {
@Test @Test
@SubjectAware(username = "readOnly") @SubjectAware(username = "readOnly")
public void shouldUpdateConfigOnlyWhenAuthorized() throws URISyntaxException, IOException { public void shouldUpdateConfigOnlyWhenAuthorized() throws URISyntaxException {
thrown.expectMessage("Subject does not have permission [configuration:write:hg]"); thrown.expectMessage("Subject does not have permission [configuration:write:hg]");
put(); put();
} }
private MockHttpResponse get() throws URISyntaxException { private MockHttpResponse get() throws URISyntaxException {
MockHttpRequest request = MockHttpRequest.get("/" + HgConfigResource.GIT_CONFIG_PATH_V2); MockHttpRequest request = MockHttpRequest.get("/" + HgConfigResource.HG_CONFIG_PATH_V2);
MockHttpResponse response = new MockHttpResponse(); MockHttpResponse response = new MockHttpResponse();
dispatcher.invoke(request, response); dispatcher.invoke(request, response);
return response; return response;
} }
private MockHttpResponse put() throws URISyntaxException { private MockHttpResponse put() throws URISyntaxException {
MockHttpRequest request = MockHttpRequest.put("/" + HgConfigResource.GIT_CONFIG_PATH_V2) MockHttpRequest request = MockHttpRequest.put("/" + HgConfigResource.HG_CONFIG_PATH_V2)
.contentType(HgVndMediaType.HG_CONFIG) .contentType(HgVndMediaType.HG_CONFIG)
.content("{\"disabled\":true}".getBytes()); .content("{\"disabled\":true}".getBytes());

View File

@@ -42,7 +42,7 @@ public class HgConfigToHgConfigDtoMapperTest {
@Before @Before
public void init() { public void init() {
when(uriInfoStore.get().getBaseUri()).thenReturn(baseUri); when(uriInfoStore.get().getBaseUri()).thenReturn(baseUri);
expectedBaseUri = baseUri.resolve(HgConfigResource.GIT_CONFIG_PATH_V2); expectedBaseUri = baseUri.resolve(HgConfigResource.HG_CONFIG_PATH_V2);
subjectThreadState.bind(); subjectThreadState.bind();
ThreadContext.bind(subject); ThreadContext.bind(subject);
} }