From a76831f557baae49e9c8cf5cd03b8375369481bd Mon Sep 17 00:00:00 2001 From: Artsiom Korzun Date: Fri, 15 Mar 2024 12:30:20 +0100 Subject: [PATCH] cleanup resource/move api --- .../core/controller/ControllerSelector.java | 2 +- .../aidial/core/ResourceOperationApiTest.java | 20 +++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/main/java/com/epam/aidial/core/controller/ControllerSelector.java b/src/main/java/com/epam/aidial/core/controller/ControllerSelector.java index ac5083060..d2fecccee 100644 --- a/src/main/java/com/epam/aidial/core/controller/ControllerSelector.java +++ b/src/main/java/com/epam/aidial/core/controller/ControllerSelector.java @@ -51,7 +51,7 @@ public class ControllerSelector { private static final Pattern PUBLICATIONS = Pattern.compile("^/v1/ops/publication/(list|get|create|delete|approve|reject)$"); private static final Pattern PUBLICATION_RULES = Pattern.compile("^/v1/ops/publication/rule/list$"); - private static final Pattern RESOURCE_OPERATIONS = Pattern.compile("^/v1/ops/resources/(move)$"); + private static final Pattern RESOURCE_OPERATIONS = Pattern.compile("^/v1/ops/resource/(move)$"); private static final Pattern DEPLOYMENT_LIMITS = Pattern.compile("^/v1/deployments/([^/]+)/limits$"); diff --git a/src/test/java/com/epam/aidial/core/ResourceOperationApiTest.java b/src/test/java/com/epam/aidial/core/ResourceOperationApiTest.java index 80b5de229..27178eccf 100644 --- a/src/test/java/com/epam/aidial/core/ResourceOperationApiTest.java +++ b/src/test/java/com/epam/aidial/core/ResourceOperationApiTest.java @@ -20,7 +20,7 @@ void testMoveResourceWorkflow() { verifyJson(response, 200, CONVERSATION_BODY_1); // verify move operation - response = send(HttpMethod.POST, "/v1/ops/resources/move", null, """ + response = send(HttpMethod.POST, "/v1/ops/resource/move", null, """ { "sourceUrl": "conversations/3CcedGxCx23EwiVbVmscVktScRyf46KypuBQ65miviST/folder/conversation", "destinationUrl": "conversations/3CcedGxCx23EwiVbVmscVktScRyf46KypuBQ65miviST/folder2/conversation2" @@ -54,7 +54,7 @@ void testMoveResourceWorkflowWhenDestinationResourceExists() { verifyJson(response, 200, CONVERSATION_BODY_2); // verify move operation - response = send(HttpMethod.POST, "/v1/ops/resources/move", null, """ + response = send(HttpMethod.POST, "/v1/ops/resource/move", null, """ { "sourceUrl": "conversations/3CcedGxCx23EwiVbVmscVktScRyf46KypuBQ65miviST/folder/conversation", "destinationUrl": "conversations/3CcedGxCx23EwiVbVmscVktScRyf46KypuBQ65miviST/folder2/conversation2" @@ -69,7 +69,7 @@ void testMoveResourceWorkflowWhenDestinationResourceExists() { response = resourceRequest(HttpMethod.GET, "/folder2/conversation2"); verifyJson(response, 200, CONVERSATION_BODY_2); - response = send(HttpMethod.POST, "/v1/ops/resources/move", null, """ + response = send(HttpMethod.POST, "/v1/ops/resource/move", null, """ { "sourceUrl": "conversations/3CcedGxCx23EwiVbVmscVktScRyf46KypuBQ65miviST/folder/conversation", "destinationUrl": "conversations/3CcedGxCx23EwiVbVmscVktScRyf46KypuBQ65miviST/folder2/conversation2", @@ -124,7 +124,7 @@ void testMoveOperationCopySharedAccess() { verify(response, 200, CONVERSATION_BODY_1); // verify move operation - response = send(HttpMethod.POST, "/v1/ops/resources/move", null, """ + response = send(HttpMethod.POST, "/v1/ops/resource/move", null, """ { "sourceUrl": "conversations/3CcedGxCx23EwiVbVmscVktScRyf46KypuBQ65miviST/folder/conversation", "destinationUrl": "conversations/3CcedGxCx23EwiVbVmscVktScRyf46KypuBQ65miviST/folder2/conversation2" @@ -210,7 +210,7 @@ void testMoveOperationCopySharedAccess() { @Test void testMoveOperationErrors() { // verify sourceUrl must be present - Response response = send(HttpMethod.POST, "/v1/ops/resources/move", null, """ + Response response = send(HttpMethod.POST, "/v1/ops/resource/move", null, """ { "destinationUrl": "conversations/3CcedGxCx23EwiVbVmscVktScRyf46KypuBQ65miviST/folder2/conversation2" } @@ -218,7 +218,7 @@ void testMoveOperationErrors() { verify(response, 400); // verify destinationUrl must be present - response = send(HttpMethod.POST, "/v1/ops/resources/move", null, """ + response = send(HttpMethod.POST, "/v1/ops/resource/move", null, """ { "sourceUrl": "conversations/3CcedGxCx23EwiVbVmscVktScRyf46KypuBQ65miviST/folder/conversation" } @@ -226,7 +226,7 @@ void testMoveOperationErrors() { verify(response, 400); // verify source and dest must be the same type - response = send(HttpMethod.POST, "/v1/ops/resources/move", null, """ + response = send(HttpMethod.POST, "/v1/ops/resource/move", null, """ { "sourceUrl": "conversations/3CcedGxCx23EwiVbVmscVktScRyf46KypuBQ65miviST/folder/conversation", "destinationUrl": "files/3CcedGxCx23EwiVbVmscVktScRyf46KypuBQ65miviST/folder2/conversation2" @@ -235,7 +235,7 @@ void testMoveOperationErrors() { verify(response, 400); // verify source must belong to the user - response = send(HttpMethod.POST, "/v1/ops/resources/move", null, """ + response = send(HttpMethod.POST, "/v1/ops/resource/move", null, """ { "sourceUrl": "conversations/7G9WZNcoY26Vy9D7bEgbv6zqbJGfyDp9KZyEbJR4XMZt/folder/conversation", "destinationUrl": "conversations/3CcedGxCx23EwiVbVmscVktScRyf46KypuBQ65miviST/folder2/conversation2" @@ -244,7 +244,7 @@ void testMoveOperationErrors() { verify(response, 400); // verify move do not support folders - response = send(HttpMethod.POST, "/v1/ops/resources/move", null, """ + response = send(HttpMethod.POST, "/v1/ops/resource/move", null, """ { "sourceUrl": "conversations/3CcedGxCx23EwiVbVmscVktScRyf46KypuBQ65miviST/folder/", "destinationUrl": "files/3CcedGxCx23EwiVbVmscVktScRyf46KypuBQ65miviST/folder2/conversation2" @@ -253,7 +253,7 @@ void testMoveOperationErrors() { verify(response, 400); // verify sourceUrl do not exists - response = send(HttpMethod.POST, "/v1/ops/resources/move", null, """ + response = send(HttpMethod.POST, "/v1/ops/resource/move", null, """ { "sourceUrl": "conversations/3CcedGxCx23EwiVbVmscVktScRyf46KypuBQ65miviST/folder/conversation", "destinationUrl": "files/3CcedGxCx23EwiVbVmscVktScRyf46KypuBQ65miviST/folder2/conversation2"