Skip to content

Commit

Permalink
Return Schema Promotion button using new TopicOverview button (#1181)
Browse files Browse the repository at this point in the history
Change in API requires finding the environments a topic is provisioned on by a different look up.

Signed-off-by: Aindriu Lavelle <aindriu.lavelle@aiven.io>
  • Loading branch information
aindriu-aiven authored May 11, 2023
1 parent 5625c7a commit ceb82b0
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,13 @@ private void updateAvroSchema(
// A team owns a topic across all environments so we can assume if the search returned
// one or more topics it is owned by this users team.
if (topics.size() > 0) {

// Set Promotion Details
processSchemaPromotionDetails(schemaOverview, tenantId, schemaEnv, kafkaEnvIds);
processSchemaPromotionDetails(
schemaOverview,
tenantId,
schemaEnv,
topics.stream().map(topic -> topic.getEnvironment()).toList());
log.info("Getting schema details for: " + topicNameSearch);
}
}
Expand All @@ -182,7 +187,7 @@ private void updateAvroSchema(

private void processSchemaPromotionDetails(
SchemaOverview schemaOverview, int tenantId, Env schemaEnv, List<String> kafkaEnvIds) {
log.info("SchemaEnv Id {}", schemaEnv.getId());
log.debug("SchemaEnv Id {} KafkaEnvIds {}", schemaEnv.getId(), kafkaEnvIds);
Map<String, String> promotionDetails = new HashMap<>();
generatePromotionDetails(
tenantId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,9 @@ public void getGivenASchemaWithManySchemaEnv_ReturnNextInPromotion() throws Exce
when(commonUtilsService.getTeamId(anyString())).thenReturn(10);
when(handleDbRequests.getAllTopicsByTopicNameAndTeamIdAndTenantId(
eq(TESTTOPIC), eq(10), eq(101)))
.thenReturn(List.of(createTopic(TESTTOPIC, "1")));
.thenReturn(List.of(createTopic(TESTTOPIC, "1"), createTopic(TESTTOPIC, "2")));
SchemaOverview returnedValue =
schemaOverviewService.getSchemaOfTopic(TESTTOPIC, "1", List.of("1", "2"));
schemaOverviewService.getSchemaOfTopic(TESTTOPIC, "1", List.of("1"));

assertThat(returnedValue.getSchemaPromotionDetails()).isNotNull();
assertThat(returnedValue.getSchemaPromotionDetails().get("DEV").containsKey("status")).isTrue();
Expand Down
2 changes: 1 addition & 1 deletion openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"name" : "Apache 2.0",
"url" : "https://www.apache.org/licenses/LICENSE-2.0.html"
},
"version" : "2.2.0"
"version" : "2.3.0"
},
"externalDocs" : {
"description" : "Klaw documentation",
Expand Down

0 comments on commit ceb82b0

Please sign in to comment.