Skip to content

Commit

Permalink
ApplicationTypeSchema api tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sergey-zinchenko committed Dec 27, 2024
1 parent cb5bc91 commit cc3b05f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 13 deletions.
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
package com.epam.aidial.core.server;


import java.util.concurrent.atomic.AtomicReference;

import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import io.vertx.core.http.HttpMethod;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

import java.util.concurrent.atomic.AtomicReference;

public class ApplicationTypeSchemaApiTest extends ResourceBaseTest {

private final ObjectMapper objectMapper = new ObjectMapper();

@Test
void testApplicationTypeSchemaList_ok() {
Response response = send(HttpMethod.GET,"/v1/application_type_schemas/schemas",null, null);
Response response = send(HttpMethod.GET, "/v1/application_type_schemas/schemas", null, null);

Assertions.assertEquals(200, response.status());
AtomicReference<JsonNode> jsonNode = new AtomicReference<>();
Expand All @@ -31,7 +30,7 @@ void testApplicationTypeSchemaList_ok() {

@Test
void testApplicationTypeSchemaMetaSchema_ok() {
Response response = send(HttpMethod.GET,"/v1/application_type_schemas/meta_schema",null, null);
Response response = send(HttpMethod.GET, "/v1/application_type_schemas/meta_schema", null, null);

Assertions.assertEquals(200, response.status());
AtomicReference<JsonNode> jsonNodeRef = new AtomicReference<>();
Expand All @@ -44,8 +43,8 @@ void testApplicationTypeSchemaMetaSchema_ok() {

@Test
void testApplicationTypeSchemaSchema_ok() {
Response response = send(HttpMethod.GET,"/v1/application_type_schemas/schema",
"id=https://mydial.somewhere.com/custom_application_schemas/specific_application_type", null);
Response response = send(HttpMethod.GET, "/v1/application_type_schemas/schema",
"id=https://mydial.somewhere.com/custom_application_schemas/specific_application_type", null);

Assertions.assertEquals(200, response.status());
AtomicReference<JsonNode> jsonNodeRef = new AtomicReference<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -323,19 +323,19 @@ void testHeartbeat() {

@Test
void testApplicationWithTypeSchemaCreation_Ok_FilesAccessible() {
Response response = upload(HttpMethod.PUT,"/v1/files/3CcedGxCx23EwiVbVmscVktScRyf46KypuBQ65miviST/test_file1.txt",null, """
Response response = upload(HttpMethod.PUT, "/v1/files/3CcedGxCx23EwiVbVmscVktScRyf46KypuBQ65miviST/test_file1.txt", null, """
Test1
""");

Assertions.assertEquals(200, response.status());

response = upload(HttpMethod.PUT,"/v1/files/3CcedGxCx23EwiVbVmscVktScRyf46KypuBQ65miviST/test_file2.txt",null, """
response = upload(HttpMethod.PUT, "/v1/files/3CcedGxCx23EwiVbVmscVktScRyf46KypuBQ65miviST/test_file2.txt", null, """
Test2
""");

Assertions.assertEquals(200, response.status());

response = send(HttpMethod.PUT,"/v1/applications/3CcedGxCx23EwiVbVmscVktScRyf46KypuBQ65miviST/test_app_files",null, """
response = send(HttpMethod.PUT, "/v1/applications/3CcedGxCx23EwiVbVmscVktScRyf46KypuBQ65miviST/test_app_files", null, """
{
"displayName": "test_app",
"customAppSchemaId": "https://mydial.somewhere.com/custom_application_schemas/specific_application_type",
Expand All @@ -358,7 +358,7 @@ void testApplicationWithTypeSchemaCreation_Ok_FilesAccessible() {

@Test
void testApplicationWithTypeSchemaCreation_Ok_Folder() {
Response response = send(HttpMethod.PUT,"/v1/applications/3CcedGxCx23EwiVbVmscVktScRyf46KypuBQ65miviST/test_app_folder",null, """
Response response = send(HttpMethod.PUT, "/v1/applications/3CcedGxCx23EwiVbVmscVktScRyf46KypuBQ65miviST/test_app_folder", null, """
{
"displayName": "test_app",
"customAppSchemaId": "https://mydial.somewhere.com/custom_application_schemas/specific_application_type",
Expand All @@ -380,7 +380,7 @@ void testApplicationWithTypeSchemaCreation_Ok_Folder() {

@Test
void testApplicationWithTypeSchemaCreation_Failed_FailAccessFile() {
Response response = send(HttpMethod.PUT,"/v1/applications/3CcedGxCx23EwiVbVmscVktScRyf46KypuBQ65miviST/test_app_files_failed",null, """
Response response = send(HttpMethod.PUT, "/v1/applications/3CcedGxCx23EwiVbVmscVktScRyf46KypuBQ65miviST/test_app_files_failed", null, """
{
"displayName": "test_app",
"customAppSchemaId": "https://mydial.somewhere.com/custom_application_schemas/specific_application_type",
Expand All @@ -402,7 +402,7 @@ void testApplicationWithTypeSchemaCreation_Failed_FailAccessFile() {

@Test
void testApplicationWithTypeSchemaCreation_Failed_FailMissingProps() {
Response response = send(HttpMethod.PUT,"/v1/applications/3CcedGxCx23EwiVbVmscVktScRyf46KypuBQ65miviST/test_app_props_failed",null, """
Response response = send(HttpMethod.PUT, "/v1/applications/3CcedGxCx23EwiVbVmscVktScRyf46KypuBQ65miviST/test_app_props_failed", null, """
{
"displayName": "test_app",
"customAppSchemaId": "https://mydial.somewhere.com/custom_application_schemas/specific_application_type",
Expand Down

0 comments on commit cc3b05f

Please sign in to comment.