refs #703: fix Smilegate annotation metadata query

This commit is contained in:
devmrko
2026-07-23 10:46:11 +09:00
parent f730c73ceb
commit cbee6c31c7
6 changed files with 34 additions and 20 deletions

View File

@@ -0,0 +1,22 @@
package com.cloudhandson.vpdbackoffice.mapper;
import static org.assertj.core.api.Assertions.assertThat;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import org.junit.jupiter.api.Test;
class SchemaMetadataMapperXmlTest {
@Test
void annotationUsageQueriesUseOnlyColumnsProvidedByTheAllView() throws IOException {
try (var input = getClass().getResourceAsStream("/mapper/SchemaMetadataMapper.xml")) {
String mapperXml = new String(input.readAllBytes(), StandardCharsets.UTF_8);
assertThat(mapperXml)
.contains("FROM all_annotations_usage")
.contains("object_name = #{tableName,jdbcType=VARCHAR}")
.doesNotContain("object_owner");
}
}
}

View File

@@ -39,7 +39,7 @@ class SchemaMetadataServiceTest {
void readsOnlyTheSelectedSmilegateTableThroughMapper() {
when(mapper.findTableComment("SGMP_POC", "CZN_COMN_USER_MST"))
.thenReturn("게임별 사용자 기준 정보");
when(mapper.findAnnotations("SGMP_POC", "CZN_COMN_USER_MST")).thenReturn(List.of(
when(mapper.findAnnotations("CZN_COMN_USER_MST")).thenReturn(List.of(
new SchemaMetadataAnnotationRow(null, "BUSINESS_TERM", "게임 사용자"),
new SchemaMetadataAnnotationRow("GUID", "BUSINESS_TERM", "사용자 고유 식별자"),
new SchemaMetadataAnnotationRow("GUID", "BUSINESS_TERM", "고객 계정 식별자")
@@ -62,14 +62,14 @@ class SchemaMetadataServiceTest {
.extracting(annotation -> annotation.value())
.isEqualTo("사용자 고유 식별자\n--- duplicate annotation value ---\n고객 계정 식별자");
});
verify(mapper).findAnnotations("SGMP_POC", "CZN_COMN_USER_MST");
verify(mapper).findAnnotations("CZN_COMN_USER_MST");
verify(mapper).findColumns("SGMP_POC", "CZN_COMN_USER_MST");
}
@Test
void replacesAnExistingColumnAnnotationUsingMapperDdl() {
when(mapper.countColumn("SGMP_POC", "CZN_COMN_USER_MST", "GUID")).thenReturn(1);
when(mapper.countColumnAnnotation("SGMP_POC", "CZN_COMN_USER_MST", "GUID", "BUSINESS_TERM"))
when(mapper.countColumnAnnotation("CZN_COMN_USER_MST", "GUID", "BUSINESS_TERM"))
.thenReturn(1);
service.updateColumnAnnotation("game-users", "guid", "business_term", "사용자 고유 식별자");
@@ -81,7 +81,7 @@ class SchemaMetadataServiceTest {
@Test
void clearsAnExistingTableAnnotationWithoutAddingAnEmptyValue() {
when(mapper.countTableAnnotation("SGMP_POC", "CZN_COMN_USER_MST", "BUSINESS_TERM"))
when(mapper.countTableAnnotation("CZN_COMN_USER_MST", "BUSINESS_TERM"))
.thenReturn(1);
service.updateTableAnnotation("game-users", "business_term", " ");