test(was-sys): remove obsolete SystemMockToolResourcesTest after YAML migration
Some checks failed
Deploy Tools / deploy (push) Has been cancelled

This commit is contained in:
jade
2026-08-18 22:08:13 +09:00
parent 96369f8fb5
commit a50c425dba

View File

@@ -1,82 +0,0 @@
package io.shinhanlife.dap.mcc.sys;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.dataformat.yaml.YAMLFactory;
import io.shinhanlife.dap.lib.metadata.ToolDefinition;
import io.shinhanlife.dap.lib.metadata.ToolDefinitionRepository;
import java.io.InputStream;
import org.junit.jupiter.api.Test;
import org.springframework.core.io.DefaultResourceLoader;
class SystemMockToolResourcesTest {
private final ObjectMapper objectMapper = new ObjectMapper();
@Test
void systemStatusDefinitionIsReadOnlyAndHasValidMockResponse() throws Exception {
ToolDefinition definition = definition("iam_system_status");
JsonNode response = mockResponse("iam_system_status");
assertTrue(definition.readOnly());
assertFalse(definition.destructive());
assertTrue(definition.idempotent());
assertTrue(properties(definition).containsKey("environment"));
assertEquals("SUCCESS", response.path("resultCode").asText());
JsonNode data = objectMapper.readTree(response.path("data").asText());
assertTrue(data.hasNonNull("systemName"));
assertTrue(data.hasNonNull("environment"));
assertTrue(data.hasNonNull("status"));
assertTrue(data.hasNonNull("checkedAt"));
}
@Test
void noticeListDefinitionIsReadOnlyAndHasValidMockResponse() throws Exception {
ToolDefinition definition = definition("pct_notice_list");
JsonNode response = mockResponse("pct_notice_list");
assertTrue(definition.readOnly());
assertFalse(definition.destructive());
assertTrue(definition.idempotent());
assertTrue(properties(definition).containsKey("category"));
assertEquals("SUCCESS", response.path("resultCode").asText());
JsonNode notices = objectMapper.readTree(response.path("data").asText()).path("notices");
assertTrue(notices.isArray());
assertFalse(notices.isEmpty());
assertTrue(notices.get(0).hasNonNull("title"));
assertTrue(notices.get(0).hasNonNull("priority"));
assertTrue(notices.get(0).hasNonNull("publishedDate"));
}
@Test
void loadsAllFortyTwoIamAndPctToolDefinitions() {
ToolDefinitionRepository repository = new ToolDefinitionRepository(new ObjectMapper(new YAMLFactory()),
new DefaultResourceLoader(), "classpath*:tool-definitions/**/*.yml");
assertEquals(50, repository.findAll().size());
assertTrue(repository.findAll().values().stream().allMatch(definition ->
"iam".equals(definition.categoryKey()) || "pct".equals(definition.categoryKey())));
}
private ToolDefinition definition(String toolName) {
return new ToolDefinitionRepository(new ObjectMapper(new YAMLFactory()), new DefaultResourceLoader(),
"classpath*:tool-definitions/**/*.yml")
.findByName(toolName)
.orElseThrow();
}
private JsonNode mockResponse(String toolName) throws Exception {
try (InputStream input = getClass().getResourceAsStream("/mock-responses/" + toolName + ".json")) {
return objectMapper.readTree(input);
}
}
@SuppressWarnings("unchecked")
private java.util.Map<String, Object> properties(ToolDefinition definition) {
return (java.util.Map<String, Object>) definition.parametersSchema().get("properties");
}
}