Rename group resource classes

This commit is contained in:
René Pfeuffer
2018-06-22 08:28:18 +02:00
parent ed1417b2ea
commit 5836688f30
7 changed files with 29 additions and 29 deletions

View File

@@ -41,7 +41,7 @@ public class GroupCollectionToDtoMapperTest {
public void init() throws URISyntaxException {
uriInfoStore.set(uriInfo);
URI baseUri = new URI("http://example.com/base/");
expectedBaseUri = baseUri.resolve(GroupV2Resource.GROUPS_PATH_V2 + "/");
expectedBaseUri = baseUri.resolve(GroupRootResource.GROUPS_PATH_V2 + "/");
when(uriInfo.getBaseUri()).thenReturn(baseUri);
subjectThreadState.bind();
ThreadContext.bind(subject);

View File

@@ -38,7 +38,7 @@ import static org.mockito.MockitoAnnotations.initMocks;
password = "secret",
configuration = "classpath:sonia/scm/repository/shiro.ini"
)
public class GroupV2ResourceTest {
public class GroupRootResourceTest {
@Rule
public ShiroRule shiro = new ShiroRule();
@@ -73,10 +73,10 @@ public class GroupV2ResourceTest {
when(groupManager.get("admin")).thenReturn(group);
GroupCollectionResource groupCollectionResource = new GroupCollectionResource(groupManager, dtoToGroupMapper, groupToDtoMapper, groupCollectionToDtoMapper);
GroupSubResource groupSubResource = new GroupSubResource(groupManager, groupToDtoMapper);
GroupV2Resource groupV2Resource = new GroupV2Resource(groupCollectionResource, groupSubResource);
GroupResource groupResource = new GroupResource(groupManager, groupToDtoMapper);
GroupRootResource groupRootResource = new GroupRootResource(groupCollectionResource, groupResource);
dispatcher.getRegistry().addSingletonResource(groupV2Resource);
dispatcher.getRegistry().addSingletonResource(groupRootResource);
when(uriInfo.getBaseUri()).thenReturn(URI.create("/"));
when(uriInfoStore.get()).thenReturn(uriInfo);
@@ -84,7 +84,7 @@ public class GroupV2ResourceTest {
@Test
public void shouldGetNotFoundForNotExistentGroup() throws URISyntaxException {
MockHttpRequest request = MockHttpRequest.get("/" + GroupV2Resource.GROUPS_PATH_V2 + "nosuchgroup");
MockHttpRequest request = MockHttpRequest.get("/" + GroupRootResource.GROUPS_PATH_V2 + "nosuchgroup");
MockHttpResponse response = new MockHttpResponse();
dispatcher.invoke(request, response);
@@ -95,7 +95,7 @@ public class GroupV2ResourceTest {
@Test
@SubjectAware(username = "unpriv")
public void shouldGetNotAuthorizedForWrongUser() throws URISyntaxException {
MockHttpRequest request = MockHttpRequest.get("/" + GroupV2Resource.GROUPS_PATH_V2 + "admin");
MockHttpRequest request = MockHttpRequest.get("/" + GroupRootResource.GROUPS_PATH_V2 + "admin");
MockHttpResponse response = new MockHttpResponse();
dispatcher.invoke(request, response);
@@ -111,7 +111,7 @@ public class GroupV2ResourceTest {
group.setMembers(Collections.singletonList("user"));
when(groupManager.get("admin")).thenReturn(group);
MockHttpRequest request = MockHttpRequest.get("/" + GroupV2Resource.GROUPS_PATH_V2 + "admin");
MockHttpRequest request = MockHttpRequest.get("/" + GroupRootResource.GROUPS_PATH_V2 + "admin");
MockHttpResponse response = new MockHttpResponse();
dispatcher.invoke(request, response);
@@ -129,7 +129,7 @@ public class GroupV2ResourceTest {
byte[] groupJson = Resources.toByteArray(url);
MockHttpRequest request = MockHttpRequest
.post("/" + GroupV2Resource.GROUPS_PATH_V2)
.post("/" + GroupRootResource.GROUPS_PATH_V2)
.contentType(VndMediaType.GROUP)
.content(groupJson);
MockHttpResponse response = new MockHttpResponse();

View File

@@ -41,7 +41,7 @@ public class GroupToGroupDtoMapperTest {
public void init() throws URISyntaxException {
initMocks(this);
URI baseUri = new URI("http://example.com/base/");
expectedBaseUri = baseUri.resolve(GroupV2Resource.GROUPS_PATH_V2 + "/");
expectedBaseUri = baseUri.resolve(GroupRootResource.GROUPS_PATH_V2 + "/");
when(uriInfo.getBaseUri()).thenReturn(baseUri);
when(uriInfoStore.get()).thenReturn(uriInfo);
subjectThreadState.bind();

View File

@@ -52,31 +52,31 @@ public class ResourceLinksTest {
@Test
public void shouldCreateCorrectGroupSelfUrl() {
String url = group(uriInfo).self("nobodies");
assertEquals(BASE_URL + GroupV2Resource.GROUPS_PATH_V2 + "nobodies", url);
assertEquals(BASE_URL + GroupRootResource.GROUPS_PATH_V2 + "nobodies", url);
}
@Test
public void shouldCreateCorrectGroupDeleteUrl() {
String url = group(uriInfo).delete("nobodies");
assertEquals(BASE_URL + GroupV2Resource.GROUPS_PATH_V2 + "nobodies", url);
assertEquals(BASE_URL + GroupRootResource.GROUPS_PATH_V2 + "nobodies", url);
}
@Test
public void shouldCreateCorrectGroupUpdateUrl() {
String url = group(uriInfo).update("nobodies");
assertEquals(BASE_URL + GroupV2Resource.GROUPS_PATH_V2 + "nobodies", url);
assertEquals(BASE_URL + GroupRootResource.GROUPS_PATH_V2 + "nobodies", url);
}
// @Test
// public void shouldCreateCorrectGroupCreateUrl() {
// String url = ResourceLinks.groupCollection(uriInfo).create();
// assertEquals(BASE_URL + GroupV2Resource.GROUPS_PATH_V2, url);
// assertEquals(BASE_URL + GroupRootResource.GROUPS_PATH_V2, url);
// }
//
// @Test
// public void shouldCreateCorrectGroupCollectionUrl() {
// String url = ResourceLinks.groupCollection(uriInfo).self();
// assertEquals(BASE_URL + GroupV2Resource.GROUPS_PATH_V2, url);
// assertEquals(BASE_URL + GroupRootResource.GROUPS_PATH_V2, url);
// }
@Before