-
+
diff --git a/core/src/main/resources/templates/requestSchema.html b/core/src/main/resources/templates/requestSchema.html
index de973c80bd..68a4721563 100644
--- a/core/src/main/resources/templates/requestSchema.html
+++ b/core/src/main/resources/templates/requestSchema.html
@@ -453,7 +453,7 @@ Shortcuts-
+
@@ -474,30 +474,25 @@ Shortcuts-
-
-
+
+
-
-
- Please select the topic on which schema has to be registered.
+
+
-
diff --git a/core/src/test/java/io/aiven/klaw/TopicAclControllerIT.java b/core/src/test/java/io/aiven/klaw/TopicAclControllerIT.java
index 86410bd612..263d2830ab 100644
--- a/core/src/test/java/io/aiven/klaw/TopicAclControllerIT.java
+++ b/core/src/test/java/io/aiven/klaw/TopicAclControllerIT.java
@@ -1233,6 +1233,33 @@ public void createSREnv() throws Exception {
ApiResponse response1 = OBJECT_MAPPER.readValue(response, new TypeReference<>() {});
assertThat(response1.isSuccess()).isTrue();
+ KwPropertiesModel kwPropertiesModel = new KwPropertiesModel();
+ kwPropertiesModel.setKwKey(TENANT_CONFIG_PROPERTY);
+ kwPropertiesModel.setKwValue(
+ """
+ {
+ "tenantModel":
+ {
+ "tenantName": "default",
+ "baseSyncEnvironment": "DEV",
+ "orderOfTopicPromotionEnvsList": ["DEV"],
+ "requestTopicsEnvironmentsList": ["DEV"],
+ "requestSchemaEnvironmentsList": ["DEVSCH"]
+ }
+ }""");
+ String jsonReq = OBJECT_MAPPER.writer().writeValueAsString(kwPropertiesModel);
+
+ mvc.perform(
+ MockMvcRequestBuilders.post("/updateKwCustomProperty")
+ .with(user(superAdmin).password(superAdminPwd))
+ .content(jsonReq)
+ .contentType(MediaType.APPLICATION_JSON)
+ .accept(MediaType.APPLICATION_JSON))
+ .andExpect(status().isOk())
+ .andReturn()
+ .getResponse()
+ .getContentAsString();
+
// get SR envs
response =
mvc.perform(
@@ -1256,7 +1283,7 @@ public void createSchemaRequest() throws Exception {
SchemaRequestModel schemaRequest = utilMethods.getSchemaRequests().get(0);
schemaRequest.setTopicname(topicName + topicId1);
schemaRequest.setRequestor(user1);
- schemaRequest.setEnvironment("3"); // Schema reg env
+ schemaRequest.setEnvironment("1"); // Schema reg env
schemaRequest.setSchemafull(
"{\n"
+ " \"type\" : \"record\",\n"
diff --git a/core/src/test/java/io/aiven/klaw/service/SchemaRegistryControllerServiceTest.java b/core/src/test/java/io/aiven/klaw/service/SchemaRegistryControllerServiceTest.java
index aa133550f3..77ae320918 100644
--- a/core/src/test/java/io/aiven/klaw/service/SchemaRegistryControllerServiceTest.java
+++ b/core/src/test/java/io/aiven/klaw/service/SchemaRegistryControllerServiceTest.java
@@ -1,5 +1,6 @@
package io.aiven.klaw.service;
+import static io.aiven.klaw.helpers.KwConstants.REQUEST_SCHEMA_OF_ENVS;
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.mockito.ArgumentMatchers.any;
@@ -306,6 +307,8 @@ public void uploadSchemaSuccess() throws KlawException {
when(commonUtilsService.getEnvsFromUserId(anyString()))
.thenReturn(new HashSet<>(Collections.singletonList("1")));
when(commonUtilsService.getTenantId(anyString())).thenReturn(101);
+ mockGetEnvironment();
+ when(commonUtilsService.getEnvProperty(eq(101), eq(REQUEST_SCHEMA_OF_ENVS))).thenReturn("1");
when(commonUtilsService.isNotAuthorizedUser(any(), any())).thenReturn(false);
when(handleDbRequests.requestForSchema(any())).thenReturn(ApiResultStatus.SUCCESS.value);
when(commonUtilsService.getTopicsForTopicName(anyString(), anyInt()))
@@ -380,6 +383,7 @@ public void promoteSchemaSuccess() throws Exception {
when(clusterApiService.validateSchema(anyString(), anyString(), anyString(), anyInt()))
.thenReturn(buildValidationResponse(true));
mockSchemaCreation();
+ when(commonUtilsService.getEnvProperty(eq(101), eq(REQUEST_SCHEMA_OF_ENVS))).thenReturn("8");
ApiResponse returnedValue =
schemaRegistryControllerService.promoteSchema(buildPromoteSchemaRequest(false, "1"));
@@ -397,6 +401,7 @@ public void promoteSchemaEnsureCorrectSchemaSelectedV1Success() throws Exception
when(clusterApiService.validateSchema(anyString(), anyString(), anyString(), anyInt()))
.thenReturn(buildValidationResponse(true));
mockSchemaCreation();
+ when(commonUtilsService.getEnvProperty(eq(101), eq(REQUEST_SCHEMA_OF_ENVS))).thenReturn("8");
ApiResponse returnedValue =
schemaRegistryControllerService.promoteSchema(buildPromoteSchemaRequest(false, "1"));
@@ -418,6 +423,7 @@ public void promoteSchemaEnsureCorrectSchemaSelectedV2Success() throws Exception
when(clusterApiService.validateSchema(anyString(), anyString(), anyString(), anyInt()))
.thenReturn(buildValidationResponse(true));
mockSchemaCreation();
+ when(commonUtilsService.getEnvProperty(eq(101), eq(REQUEST_SCHEMA_OF_ENVS))).thenReturn("8");
ApiResponse returnedValue =
schemaRegistryControllerService.promoteSchema(buildPromoteSchemaRequest(false, "2"));
@@ -439,6 +445,7 @@ public void promoteSchemaEnsureCorrectSchemaSelectedV3Success() throws Exception
when(clusterApiService.validateSchema(anyString(), anyString(), anyString(), anyInt()))
.thenReturn(buildValidationResponse(true));
mockSchemaCreation();
+ when(commonUtilsService.getEnvProperty(eq(101), eq(REQUEST_SCHEMA_OF_ENVS))).thenReturn("8");
ApiResponse returnedValue =
schemaRegistryControllerService.promoteSchema(buildPromoteSchemaRequest(false, "3"));
@@ -461,6 +468,7 @@ public void promoteSchemaEnsureCorrectSchemaSelectedV4Success() throws Exception
when(clusterApiService.validateSchema(anyString(), anyString(), anyString(), anyInt()))
.thenReturn(buildValidationResponse(true));
mockSchemaCreation();
+ when(commonUtilsService.getEnvProperty(eq(101), eq(REQUEST_SCHEMA_OF_ENVS))).thenReturn("8");
ApiResponse returnedValue =
schemaRegistryControllerService.promoteSchema(buildPromoteSchemaRequest(false, "4"));
@@ -475,13 +483,14 @@ public void promoteSchemaEnsureCorrectSchemaSelectedV4Success() throws Exception
@Test
@Order(17)
- public void promoteSchemaWithInCompaitbleSchemaReturnFailure() throws Exception {
+ public void promoteSchemaWithInCompatibleSchemaReturnFailure() throws Exception {
mockGetEnvironment();
mockSchema();
when(commonUtilsService.getTenantId(anyString())).thenReturn(101);
when(clusterApiService.validateSchema(anyString(), anyString(), anyString(), anyInt()))
.thenReturn(buildValidationResponse(false));
mockSchemaCreation();
+ when(commonUtilsService.getEnvProperty(eq(101), eq(REQUEST_SCHEMA_OF_ENVS))).thenReturn("8");
ApiResponse returnedValue =
schemaRegistryControllerService.promoteSchema(buildPromoteSchemaRequest(false, "4"));
@@ -505,6 +514,8 @@ public void uploadSchemaIncompatibleSchemaError() throws KlawException {
.thenReturn(new HashSet<>(Collections.singletonList("1")));
when(commonUtilsService.getTenantId(anyString())).thenReturn(101);
when(commonUtilsService.isNotAuthorizedUser(any(), any())).thenReturn(false);
+ mockGetEnvironment();
+ when(commonUtilsService.getEnvProperty(eq(101), eq(REQUEST_SCHEMA_OF_ENVS))).thenReturn("1");
ApiResponse resultResp =
schemaRegistryControllerService.uploadSchema(schemaRequest, RequestOperationType.CREATE);
@@ -611,6 +622,8 @@ public void uploadSchema_NoValidationOnSave() throws KlawException {
when(commonUtilsService.getTopicsForTopicName(anyString(), anyInt()))
.thenReturn(List.of(topic));
when(commonUtilsService.getFilteredTopicsForTenant(any())).thenReturn(List.of(topic));
+ mockGetEnvironment();
+ when(commonUtilsService.getEnvProperty(eq(101), eq(REQUEST_SCHEMA_OF_ENVS))).thenReturn("1");
ApiResponse resultResp =
schemaRegistryControllerService.uploadSchema(schemaRequest, RequestOperationType.CREATE);
@@ -636,6 +649,8 @@ public void uploadSchema_ValidationPropertyNotSet() throws KlawException {
.thenReturn(new HashSet<>(Collections.singletonList("1")));
when(commonUtilsService.getTenantId(anyString())).thenReturn(101);
when(commonUtilsService.isNotAuthorizedUser(any(), any())).thenReturn(false);
+ mockGetEnvironment();
+ when(commonUtilsService.getEnvProperty(eq(101), eq(REQUEST_SCHEMA_OF_ENVS))).thenReturn("1");
NullPointerException ex =
assertThrows(
@@ -781,7 +796,6 @@ private static Topic createTopic() {
}
private void mockGetEnvironment() {
-
when(manageDatabase.getSchemaRegEnvList(anyInt())).thenReturn(createEnvList(8));
}
diff --git a/openapi.yaml b/openapi.yaml
index a9f6486d7a..263b4cfd11 100644
--- a/openapi.yaml
+++ b/openapi.yaml
@@ -4244,27 +4244,6 @@
}
}
},
- "/getEnvsForSchemaRequests" : {
- "get" : {
- "tags" : [ "envs-clusters-tenants-controller" ],
- "operationId" : "getEnvsForSchemaRequests",
- "responses" : {
- "200" : {
- "description" : "OK",
- "content" : {
- "application/json" : {
- "schema" : {
- "type" : "array",
- "items" : {
- "$ref" : "#/components/schemas/EnvModelResponse"
- }
- }
- }
- }
- }
- }
- }
- },
"/getEnvsBaseCluster" : {
"get" : {
"tags" : [ "envs-clusters-tenants-controller" ],
|