feat: align pod scaffolding with oth runtime
All checks were successful
Deploy to OCIWP / deploy (push) Successful in 1m37s
All checks were successful
Deploy to OCIWP / deploy (push) Successful in 1m37s
This commit is contained in:
@@ -76,11 +76,14 @@ public class PodScaffolder {
|
||||
|
||||
log.append("[3/6] Dockerfile 생성 중...\n");
|
||||
String dockerfile = """
|
||||
FROM eclipse-temurin:21-jdk-alpine
|
||||
FROM eclipse-temurin:21-jre-alpine
|
||||
WORKDIR /app
|
||||
COPY build/libs/%s-0.0.1-SNAPSHOT.jar app.jar
|
||||
RUN apk add --no-cache tzdata
|
||||
ENV TZ=Asia/Seoul
|
||||
COPY %s/build/libs/*-SNAPSHOT.jar app.jar
|
||||
EXPOSE %s
|
||||
ENTRYPOINT ["java", "-jar", "app.jar"]
|
||||
""".formatted(moduleName);
|
||||
""".formatted(moduleName, portStr);
|
||||
Files.writeString(modulePath.resolve("Dockerfile"), dockerfile);
|
||||
|
||||
log.append("[4/6] Application 클래스 및 설정 파일 생성 중...\n");
|
||||
@@ -135,10 +138,13 @@ public class PodScaffolder {
|
||||
org.apache.kafka: ERROR
|
||||
mcp:
|
||||
namespace: ""
|
||||
manifest:
|
||||
bundle-id: %s
|
||||
name-prefix: ""
|
||||
security:
|
||||
tenant-domains:
|
||||
TESTER-DEV: ALL
|
||||
""".formatted(portStr, moduleName);
|
||||
""".formatted(portStr, moduleName, moduleName.replace("dap-", ""));
|
||||
Files.writeString(resPath.resolve("application.yml"), applicationYml);
|
||||
|
||||
String applicationLocalYml = """
|
||||
@@ -226,6 +232,30 @@ public class PodScaffolder {
|
||||
""".formatted(portStr, portStr);
|
||||
Files.writeString(resPath.resolve("application-dev.yml"), applicationDevYml);
|
||||
|
||||
String applicationTestYml = """
|
||||
server:
|
||||
port: ${PORT:%s}
|
||||
|
||||
axhub:
|
||||
gateway:
|
||||
url: ${AXHUB_GATEWAY_URL}
|
||||
tool:
|
||||
url: ${AXHUB_TOOL_URL}
|
||||
""".formatted(portStr);
|
||||
Files.writeString(resPath.resolve("application-test.yml"), applicationTestYml);
|
||||
|
||||
String applicationProdYml = """
|
||||
server:
|
||||
port: ${PORT:%s}
|
||||
|
||||
axhub:
|
||||
gateway:
|
||||
url: ${AXHUB_GATEWAY_URL}
|
||||
tool:
|
||||
url: ${AXHUB_TOOL_URL}
|
||||
""".formatted(portStr);
|
||||
Files.writeString(resPath.resolve("application-prod.yml"), applicationProdYml);
|
||||
|
||||
String logbackXml = """
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration>
|
||||
|
||||
@@ -74,8 +74,9 @@ public class ToolScaffolder {
|
||||
String useSchemaResourceStr = getOrAsk(args, 8, scanner, "9. input/output JSON Schema 파일 자동 생성 여부 (y/N): ");
|
||||
boolean useSchemaResource = "y".equalsIgnoreCase(useSchemaResourceStr.trim());
|
||||
|
||||
String inputSchemaResource = useSchemaResource ? "classpath:mcp/schema/" + toKebabCase(baseName) + "-resource-input-schema.json" : null;
|
||||
String outputSchemaResource = useSchemaResource ? "classpath:mcp/schema/" + toKebabCase(baseName) + "-resource-output-schema.json" : null;
|
||||
String schemaResourceDirectory = "classpath:tool-schemas/" + group.toLowerCase() + "/";
|
||||
String inputSchemaResource = useSchemaResource ? schemaResourceDirectory + toKebabCase(baseName) + "-resource-input-schema.json" : null;
|
||||
String outputSchemaResource = useSchemaResource ? schemaResourceDirectory + toKebabCase(baseName) + "-resource-output-schema.json" : null;
|
||||
|
||||
String result = scaffold(baseName, interfaceId, description, group, routingType, moduleName, author, createDate, true, null, inputSchemaResource, outputSchemaResource);
|
||||
System.out.println(result);
|
||||
@@ -110,9 +111,9 @@ public class ToolScaffolder {
|
||||
String schemaBaseName = toKebabCase(baseName);
|
||||
String inputSchemaFileName = schemaBaseName + "-resource-input-schema.json";
|
||||
String outputSchemaFileName = schemaBaseName + "-resource-output-schema.json";
|
||||
Path schemaDir = rootDir.resolve(Paths.get(moduleName, "src/main/resources/mcp/schema"));
|
||||
String inputSchemaClasspath = "classpath:mcp/schema/" + inputSchemaFileName;
|
||||
String outputSchemaClasspath = "classpath:mcp/schema/" + outputSchemaFileName;
|
||||
Path schemaDir = rootDir.resolve(Paths.get(moduleName, "src/main/resources/tool-schemas", group.toLowerCase()));
|
||||
String inputSchemaClasspath = "classpath:tool-schemas/" + group.toLowerCase() + "/" + inputSchemaFileName;
|
||||
String outputSchemaClasspath = "classpath:tool-schemas/" + group.toLowerCase() + "/" + outputSchemaFileName;
|
||||
|
||||
String bizPackage = BASE_PACKAGE + ".biz." + group.toLowerCase();
|
||||
boolean isMci = "MCI".equalsIgnoreCase(routingType);
|
||||
|
||||
@@ -23,4 +23,23 @@ class PodScaffolderTest {
|
||||
assertTrue(buildGradle.contains("implementation project(':dap-was-lib')"));
|
||||
assertFalse(buildGradle.contains("compileOnly 'org.projectlombok:lombok"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void generatesOthStandardRuntimeResources() throws Exception {
|
||||
PodScaffolder.scaffoldPod(root, "dap-was-sample", "8099", "sample", "tester", "2026.08.07");
|
||||
|
||||
Path resources = root.resolve("dap-was-sample/src/main/resources");
|
||||
String dockerfile = Files.readString(root.resolve("dap-was-sample/Dockerfile"));
|
||||
|
||||
assertTrue(dockerfile.contains("RUN apk add --no-cache tzdata"));
|
||||
assertTrue(dockerfile.contains("ENV TZ=Asia/Seoul"));
|
||||
assertTrue(dockerfile.contains("COPY dap-was-sample/build/libs/*-SNAPSHOT.jar app.jar"));
|
||||
assertTrue(dockerfile.contains("EXPOSE 8099"));
|
||||
assertTrue(Files.exists(resources.resolve("application-test.yml")));
|
||||
assertTrue(Files.exists(resources.resolve("application-prod.yml")));
|
||||
assertTrue(Files.readString(resources.resolve("application-test.yml"))
|
||||
.contains("${AXHUB_GATEWAY_URL}"));
|
||||
assertTrue(Files.readString(resources.resolve("application-prod.yml"))
|
||||
.contains("${AXHUB_TOOL_URL}"));
|
||||
}
|
||||
}
|
||||
@@ -5,9 +5,13 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.io.TempDir;
|
||||
|
||||
class ToolScaffolderTest {
|
||||
|
||||
@TempDir
|
||||
Path root;
|
||||
|
||||
@Test
|
||||
void generatesManifestReadyToolAndOutputSchemaDto() throws Exception {
|
||||
String moduleName = "build/scaffold-manifest-test";
|
||||
@@ -38,4 +42,18 @@ class ToolScaffolderTest {
|
||||
|
||||
assertTrue(useCase.contains("name = \"sms.cmm.notification.send\""));
|
||||
}
|
||||
|
||||
@Test
|
||||
void createsSchemaResourcesInToolSchemaCategoryDirectory() throws Exception {
|
||||
String moduleName = root.resolve("dap-was-sample").toString();
|
||||
|
||||
ToolScaffolder.scaffold("claim search", "CLM0001", "청구 조회", "cmm", "HTTP", moduleName,
|
||||
"tester", "2026.08.09", true, null,
|
||||
"classpath:tool-schemas/cmm/claim-search-resource-input-schema.json",
|
||||
"classpath:tool-schemas/cmm/claim-search-resource-output-schema.json");
|
||||
|
||||
Path schemas = root.resolve("dap-was-sample/src/main/resources/tool-schemas/cmm");
|
||||
assertTrue(Files.exists(schemas.resolve("claim-search-resource-input-schema.json")));
|
||||
assertTrue(Files.exists(schemas.resolve("claim-search-resource-output-schema.json")));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ public interface ClaimSearchSchemaSampleUseCase {
|
||||
|
||||
@McpTool(name = "oth.cmm.claim.search", title = "청구 조회 스키마 샘플", description = "Claim search Tool sample using input and output JSON Schema resources.", annotations = @McpTool.McpAnnotations(readOnlyHint = true, idempotentHint = true))
|
||||
@ToolHint(register = false, categoryKey = "cmm",
|
||||
inputSchemaResource = "classpath:mcp/schema/claim-search-resource-input-schema.json",
|
||||
outputSchemaResource = "classpath:mcp/schema/claim-search-resource-output-schema.json")
|
||||
inputSchemaResource = "classpath:tool-schemas/cmm/claim-search-resource-input-schema.json",
|
||||
outputSchemaResource = "classpath:tool-schemas/cmm/claim-search-resource-output-schema.json")
|
||||
ClaimSearchResponse search(ClaimSearchRequest request);
|
||||
}
|
||||
|
||||
8
dap-was-oth/src/main/resources/application-prod.yml
Normal file
8
dap-was-oth/src/main/resources/application-prod.yml
Normal file
@@ -0,0 +1,8 @@
|
||||
server:
|
||||
port: ${PORT:8084}
|
||||
|
||||
axhub:
|
||||
gateway:
|
||||
url: ${AXHUB_GATEWAY_URL}
|
||||
tool:
|
||||
url: ${AXHUB_TOOL_URL}
|
||||
8
dap-was-oth/src/main/resources/application-test.yml
Normal file
8
dap-was-oth/src/main/resources/application-test.yml
Normal file
@@ -0,0 +1,8 @@
|
||||
server:
|
||||
port: ${PORT:8084}
|
||||
|
||||
axhub:
|
||||
gateway:
|
||||
url: ${AXHUB_GATEWAY_URL}
|
||||
tool:
|
||||
url: ${AXHUB_TOOL_URL}
|
||||
Reference in New Issue
Block a user