mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-15 09:46:16 +01:00
Rename media type
This commit is contained in:
@@ -20,7 +20,7 @@ public class VndMediaType {
|
||||
public static final String GROUP = PREFIX + "group" + SUFFIX;
|
||||
public static final String AUTOCOMPLETE = PREFIX + "autocomplete" + SUFFIX;
|
||||
public static final String REPOSITORY = PREFIX + "repository" + SUFFIX;
|
||||
public static final String PERMISSION = PREFIX + "permission" + SUFFIX;
|
||||
public static final String REPOSITORY_PERMISSION = PREFIX + "repositoryPermission" + SUFFIX;
|
||||
public static final String CHANGESET = PREFIX + "changeset" + SUFFIX;
|
||||
public static final String CHANGESET_COLLECTION = PREFIX + "changesetCollection" + SUFFIX;
|
||||
public static final String MODIFICATIONS = PREFIX + "modifications" + SUFFIX;
|
||||
|
||||
@@ -111,7 +111,7 @@ public class PermissionsITCase {
|
||||
|
||||
@Test
|
||||
public void readUserShouldNotSeeBruteForcePermissions() {
|
||||
given(VndMediaType.PERMISSION, USER_READ, USER_PASS)
|
||||
given(VndMediaType.REPOSITORY_PERMISSION, USER_READ, USER_PASS)
|
||||
.when()
|
||||
.get(TestData.getDefaultPermissionUrl(USER_SCM_ADMIN, USER_SCM_ADMIN, repositoryType))
|
||||
.then()
|
||||
@@ -127,7 +127,7 @@ public class PermissionsITCase {
|
||||
|
||||
@Test
|
||||
public void writeUserShouldNotSeeBruteForcePermissions() {
|
||||
given(VndMediaType.PERMISSION, USER_WRITE, USER_PASS)
|
||||
given(VndMediaType.REPOSITORY_PERMISSION, USER_WRITE, USER_PASS)
|
||||
.when()
|
||||
.get(TestData.getDefaultPermissionUrl(USER_SCM_ADMIN, USER_SCM_ADMIN, repositoryType))
|
||||
.then()
|
||||
@@ -147,7 +147,7 @@ public class PermissionsITCase {
|
||||
|
||||
@Test
|
||||
public void otherUserShouldNotSeeBruteForcePermissions() {
|
||||
given(VndMediaType.PERMISSION, USER_OTHER, USER_PASS)
|
||||
given(VndMediaType.REPOSITORY_PERMISSION, USER_OTHER, USER_PASS)
|
||||
.when()
|
||||
.get(TestData.getDefaultPermissionUrl(USER_SCM_ADMIN, USER_SCM_ADMIN, repositoryType))
|
||||
.then()
|
||||
|
||||
@@ -91,7 +91,7 @@ public class TestData {
|
||||
public static void createUserPermission(String name, Collection<String> permissionType, String repositoryType) {
|
||||
String defaultPermissionUrl = TestData.getDefaultPermissionUrl(USER_SCM_ADMIN, USER_SCM_ADMIN, repositoryType);
|
||||
LOG.info("create permission with name {} and type: {} using the endpoint: {}", name, permissionType, defaultPermissionUrl);
|
||||
given(VndMediaType.PERMISSION)
|
||||
given(VndMediaType.REPOSITORY_PERMISSION)
|
||||
.when()
|
||||
.content("{\n" +
|
||||
"\t\"verbs\": " + permissionType.stream().collect(Collectors.joining("\",\"", "[\"", "\"]")) + ",\n" +
|
||||
@@ -112,7 +112,7 @@ public class TestData {
|
||||
}
|
||||
|
||||
public static ValidatableResponse callUserPermissions(String username, String password, String repositoryType, int expectedStatusCode) {
|
||||
return given(VndMediaType.PERMISSION, username, password)
|
||||
return given(VndMediaType.REPOSITORY_PERMISSION, username, password)
|
||||
.when()
|
||||
.get(TestData.getDefaultPermissionUrl(username, password, repositoryType))
|
||||
.then()
|
||||
|
||||
@@ -73,7 +73,7 @@ public class RepositoryPermissionRootResource {
|
||||
@ResponseCode(code = 409, condition = "conflict")
|
||||
})
|
||||
@TypeHint(TypeHint.NO_CONTENT.class)
|
||||
@Consumes(VndMediaType.PERMISSION)
|
||||
@Consumes(VndMediaType.REPOSITORY_PERMISSION)
|
||||
@Path("")
|
||||
public Response create(@PathParam("namespace") String namespace, @PathParam("name") String name, @Valid RepositoryPermissionDto permission) {
|
||||
log.info("try to add new permission: {}", permission);
|
||||
@@ -100,7 +100,7 @@ public class RepositoryPermissionRootResource {
|
||||
@ResponseCode(code = 404, condition = "not found"),
|
||||
@ResponseCode(code = 500, condition = "internal server error")
|
||||
})
|
||||
@Produces(VndMediaType.PERMISSION)
|
||||
@Produces(VndMediaType.REPOSITORY_PERMISSION)
|
||||
@TypeHint(RepositoryPermissionDto.class)
|
||||
@Path("{permission-name}")
|
||||
public Response get(@PathParam("namespace") String namespace, @PathParam("name") String name, @PathParam("permission-name") String permissionName) {
|
||||
@@ -130,7 +130,7 @@ public class RepositoryPermissionRootResource {
|
||||
@ResponseCode(code = 404, condition = "not found"),
|
||||
@ResponseCode(code = 500, condition = "internal server error")
|
||||
})
|
||||
@Produces(VndMediaType.PERMISSION)
|
||||
@Produces(VndMediaType.REPOSITORY_PERMISSION)
|
||||
@TypeHint(RepositoryPermissionDto.class)
|
||||
@Path("")
|
||||
public Response getAll(@PathParam("namespace") String namespace, @PathParam("name") String name) {
|
||||
@@ -154,7 +154,7 @@ public class RepositoryPermissionRootResource {
|
||||
@ResponseCode(code = 500, condition = "internal server error")
|
||||
})
|
||||
@TypeHint(TypeHint.NO_CONTENT.class)
|
||||
@Consumes(VndMediaType.PERMISSION)
|
||||
@Consumes(VndMediaType.REPOSITORY_PERMISSION)
|
||||
@Path("{permission-name}")
|
||||
public Response update(@PathParam("namespace") String namespace,
|
||||
@PathParam("name") String name,
|
||||
|
||||
@@ -238,7 +238,7 @@ public class RepositoryPermissionRootResourceTest extends RepositoryTestBase {
|
||||
MockHttpRequest request = MockHttpRequest
|
||||
.post("/" + RepositoryRootResource.REPOSITORIES_PATH_V2 + PATH_OF_ALL_PERMISSIONS)
|
||||
.content(permissionJson.getBytes())
|
||||
.contentType(VndMediaType.PERMISSION);
|
||||
.contentType(VndMediaType.REPOSITORY_PERMISSION);
|
||||
MockHttpResponse response = new MockHttpResponse();
|
||||
|
||||
dispatcher.invoke(request, response);
|
||||
@@ -250,7 +250,7 @@ public class RepositoryPermissionRootResourceTest extends RepositoryTestBase {
|
||||
request = MockHttpRequest
|
||||
.post("/" + RepositoryRootResource.REPOSITORIES_PATH_V2 + PATH_OF_ALL_PERMISSIONS)
|
||||
.content(permissionJson.getBytes())
|
||||
.contentType(VndMediaType.PERMISSION);
|
||||
.contentType(VndMediaType.REPOSITORY_PERMISSION);
|
||||
response = new MockHttpResponse();
|
||||
|
||||
dispatcher.invoke(request, response);
|
||||
@@ -430,7 +430,7 @@ public class RepositoryPermissionRootResourceTest extends RepositoryTestBase {
|
||||
HttpRequest request = MockHttpRequest
|
||||
.create(entry.method, "/" + RepositoryRootResource.REPOSITORIES_PATH_V2 + entry.path)
|
||||
.content(entry.content)
|
||||
.contentType(VndMediaType.PERMISSION);
|
||||
.contentType(VndMediaType.REPOSITORY_PERMISSION);
|
||||
dispatcher.invoke(request, response);
|
||||
log.info("Test the Request :{}", entry);
|
||||
assertThat(response.getStatus())
|
||||
|
||||
@@ -124,8 +124,8 @@ public class GitLfsITCase {
|
||||
String permissionsUrl = repository.getLinks().getLinkBy("permissions").get().getHref();
|
||||
IntegrationTestUtil.createResource(adminClient, URI.create(permissionsUrl))
|
||||
.accept("*/*")
|
||||
.type(VndMediaType.PERMISSION)
|
||||
.post(ClientResponse.class, "{\"name\": \""+ trillian.getId() +"\", \"type\":\"WRITE\"}");
|
||||
.type(VndMediaType.REPOSITORY_PERMISSION)
|
||||
.post(ClientResponse.class, "{\"name\": \""+ trillian.getId() +"\", \"verbs\":[\"*\"]}");
|
||||
|
||||
ScmClient client = new ScmClient(trillian.getId(), "secret123");
|
||||
|
||||
@@ -165,8 +165,8 @@ public class GitLfsITCase {
|
||||
String permissionsUrl = repository.getLinks().getLinkBy("permissions").get().getHref();
|
||||
IntegrationTestUtil.createResource(adminClient, URI.create(permissionsUrl))
|
||||
.accept("*/*")
|
||||
.type(VndMediaType.PERMISSION)
|
||||
.post(ClientResponse.class, "{\"name\": \""+ trillian.getId() +"\", \"type\":\"READ\"}");
|
||||
.type(VndMediaType.REPOSITORY_PERMISSION)
|
||||
.post(ClientResponse.class, "{\"name\": \""+ trillian.getId() +"\", \"verbs\":[\"read\"]}");
|
||||
|
||||
ScmClient client = new ScmClient(trillian.getId(), "secret123");
|
||||
uploadAndDownload(client);
|
||||
@@ -186,8 +186,8 @@ public class GitLfsITCase {
|
||||
String permissionsUrl = repository.getLinks().getLinkBy("permissions").get().getHref();
|
||||
IntegrationTestUtil.createResource(adminClient, URI.create(permissionsUrl))
|
||||
.accept("*/*")
|
||||
.type(VndMediaType.PERMISSION)
|
||||
.post(ClientResponse.class, "{\"name\": \""+ trillian.getId() +"\", \"type\":\"READ\"}");
|
||||
.type(VndMediaType.REPOSITORY_PERMISSION)
|
||||
.post(ClientResponse.class, "{\"name\": \""+ trillian.getId() +"\", \"verbs\":[\"read\"]}");
|
||||
|
||||
// upload data as admin
|
||||
String data = UUID.randomUUID().toString();
|
||||
|
||||
Reference in New Issue
Block a user