forked from kimhyungsik/ax_hub_mcp_tool
Refactor: remove legacy dap-tool and gateway references
This commit is contained in:
@@ -29,11 +29,11 @@ public class SwaggerConfig {
|
||||
public OpenAPI customOpenAPI() {
|
||||
return new OpenAPI()
|
||||
.info(new Info()
|
||||
.title("Shinhan MCP Gateway API 명세서")
|
||||
.title("Shinhan MCP WAS API 명세서")
|
||||
.version("v1.0")
|
||||
.description("AI Agent와 신한라이프 내부망(EIMS/EAI)을 연결하는 Adapter Gateway API 문서입니다."))
|
||||
.addServersItem(new io.swagger.v3.oas.models.servers.Server().url("http://localhost:8080").description("Adapter Pod (8080)"))
|
||||
.addServersItem(new io.swagger.v3.oas.models.servers.Server().url("http://localhost:8081").description("Gateway Pod (8081)"))
|
||||
.addServersItem(new io.swagger.v3.oas.models.servers.Server().url("http://localhost:8081").description("WAS Pod"))
|
||||
// 전역적으로 X-API-KEY 보안 설정을 Swagger UI에 추가합니다.
|
||||
.addSecurityItem(new SecurityRequirement().addList("X-API-KEY"))
|
||||
.components(new Components()
|
||||
|
||||
@@ -29,25 +29,25 @@ public class GlobalExceptionHandler {
|
||||
|
||||
@ExceptionHandler(NoResourceFoundException.class)
|
||||
public ResponseEntity<Void> handleNoResourceFound(NoResourceFoundException e) {
|
||||
log.warn(" [Gateway Not Found] 요청하신 리소스를 찾을 수 없습니다: {}", e.getResourcePath());
|
||||
log.warn(" [WAS Not Found] 요청하신 리소스를 찾을 수 없습니다: {}", e.getResourcePath());
|
||||
return ResponseEntity.notFound().build();
|
||||
}
|
||||
|
||||
@ExceptionHandler(IllegalArgumentException.class)
|
||||
public ResponseEntity<JsonRpcResponse> handleIllegalArgument(IllegalArgumentException e) {
|
||||
log.warn(" [Gateway Bad Request] 잘못된 요청: {}", e.getMessage());
|
||||
log.warn(" [WAS Bad Request] 잘못된 요청: {}", e.getMessage());
|
||||
return buildErrorResponse(-32602, "Invalid params: " + e.getMessage());
|
||||
}
|
||||
|
||||
@ExceptionHandler(RuntimeException.class)
|
||||
public ResponseEntity<JsonRpcResponse> handleRuntime(RuntimeException e) {
|
||||
log.error(" [Gateway Internal Error] 시스템 장애: {}", e.getMessage(), e);
|
||||
log.error(" [WAS Internal Error] 시스템 장애: {}", e.getMessage(), e);
|
||||
return buildErrorResponse(-32603, "Internal error: " + e.getMessage());
|
||||
}
|
||||
|
||||
@ExceptionHandler(Exception.class)
|
||||
public ResponseEntity<JsonRpcResponse> handleAllException(Exception e) {
|
||||
log.error(" [Gateway Fatal Error] 치명적 오류 발생", e);
|
||||
log.error(" [WAS Fatal Error] 치명적 오류 발생", e);
|
||||
return buildErrorResponse(-32000, "Server error: 시스템 관리자에게 문의하세요.");
|
||||
}
|
||||
|
||||
|
||||
@@ -18,10 +18,10 @@ public class PodScaffolder {
|
||||
System.out.println(" MCP Tool Pod Scaffolder (Java CLI) ");
|
||||
System.out.println("=========================================\n");
|
||||
|
||||
String rawModuleName = getOrAsk(args, 0, scanner, "1. 생성할 모듈(Pod) 이름 (예: payment 또는 dap-tool-payment): ");
|
||||
String moduleName = rawModuleName.startsWith("dap-tool-") ? rawModuleName : "dap-tool-" + rawModuleName;
|
||||
String rawModuleName = getOrAsk(args, 0, scanner, "1. 생성할 모듈(Pod) 이름 (예: payment 또는 dap-was-payment): ");
|
||||
String moduleName = rawModuleName.startsWith("dap-was-") ? rawModuleName : "dap-was-" + rawModuleName;
|
||||
String portStr = getOrAsk(args, 1, scanner, "2. 사용할 포트 번호 (예: 8085): ");
|
||||
String shortName = moduleName.replace("dap-tool-", "").replace("-", "");
|
||||
String shortName = moduleName.replace("dap-was-", "").replace("-", "");
|
||||
|
||||
String defaultAuthor = System.getProperty("user.name");
|
||||
String defaultDate = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy.MM.dd"));
|
||||
@@ -62,7 +62,7 @@ public class PodScaffolder {
|
||||
id 'org.springframework.boot'
|
||||
}
|
||||
dependencies {
|
||||
implementation project(':dap-tool-core')
|
||||
implementation project(':dap-was-core')
|
||||
}
|
||||
dependencies {
|
||||
compileOnly 'org.projectlombok:lombok:1.18.32'
|
||||
@@ -94,7 +94,7 @@ public class PodScaffolder {
|
||||
|
||||
/**
|
||||
* @package io.shinhanlife.dap.mcc.%s
|
||||
* @className DapTool%sApplication
|
||||
* @className DapWas%sApplication
|
||||
* @description AX HUB 시스템 처리 클래스
|
||||
* @author %s
|
||||
* @create %s
|
||||
@@ -109,9 +109,9 @@ public class PodScaffolder {
|
||||
@SpringBootApplication(scanBasePackages = {"io.shinhanlife.dap.mcc", "io.shinhanlife.dap.lib.adapter", "io.shinhanlife.dap.lib.mcp", "io.shinhanlife.dap.lib.config", "io.shinhanlife.dap.lib.integration"})
|
||||
@ConfigurationPropertiesScan(basePackages = {"io.shinhanlife.dap.mcc", "io.shinhanlife.dap.lib.adapter", "io.shinhanlife.dap.lib.mcp", "io.shinhanlife.dap.lib.config", "io.shinhanlife.dap.lib.integration"})
|
||||
@EnableCaching
|
||||
public class DapTool%sApplication {
|
||||
public class DapWas%sApplication {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(DapTool%sApplication.class, args);
|
||||
SpringApplication.run(DapWas%sApplication.class, args);
|
||||
}
|
||||
}
|
||||
""".formatted(shortName, shortName, capitalize(shortName), author, createDate, createDate, author, capitalize(shortName), capitalize(shortName));
|
||||
|
||||
@@ -18,8 +18,8 @@ import java.util.Scanner;
|
||||
* - 콘솔 창에 뜨는 질문에 차례대로 값을 입력하기만 하면 파일이 생성됩니다.
|
||||
*
|
||||
* 방법 2. 커맨드라인(터미널)에서 실행 (명령어 기반)
|
||||
* - 컴파일: javac -encoding UTF-8 dap-tool-core/src/main/java/io/shinhanlife/dap/mcc/util/ToolScaffolder.java
|
||||
* - 실행: java -cp dap-tool-core/src/main/java io.shinhanlife.dap.lib.util.ToolScaffolder [이름] [ID] "[설명]" "[그룹]" "[통신방식]" "[모듈명]"
|
||||
* - 컴파일: javac -encoding UTF-8 dap-was-core/src/main/java/io/shinhanlife/dap/mcc/util/ToolScaffolder.java
|
||||
* - 실행: java -cp dap-was-core/src/main/java io.shinhanlife.dap.lib.util.ToolScaffolder [이름] [ID] "[설명]" "[그룹]" "[통신방식]" "[모듈명]"
|
||||
*/
|
||||
/**
|
||||
* @package io.shinhanlife.dap.lib.util
|
||||
@@ -56,9 +56,9 @@ public class ToolScaffolder {
|
||||
if (routingType.trim().isEmpty()) {
|
||||
routingType = "HTTP";
|
||||
}
|
||||
String moduleName = getOrAsk(args, 5, scanner, "6. 코드를 생성할 모듈 (기본: dap-tool-oth): ");
|
||||
String moduleName = getOrAsk(args, 5, scanner, "6. 코드를 생성할 모듈 (기본: dap-was-oth): ");
|
||||
if (moduleName.trim().isEmpty()) {
|
||||
moduleName = "dap-tool-oth";
|
||||
moduleName = "dap-was-oth";
|
||||
}
|
||||
|
||||
String defaultAuthor = System.getProperty("user.name");
|
||||
@@ -673,8 +673,8 @@ public class ToolScaffolder {
|
||||
}
|
||||
|
||||
private static String toToolName(String moduleName, String group, String baseName) {
|
||||
String pod = moduleName.startsWith("dap-tool-")
|
||||
? moduleName.substring("dap-tool-".length())
|
||||
String pod = moduleName.startsWith("dap-was-")
|
||||
? moduleName.substring("dap-was-".length())
|
||||
: "oth";
|
||||
String normalizedName = baseName.replaceAll("([a-z0-9])([A-Z])", "$1 $2")
|
||||
.toLowerCase(Locale.ROOT)
|
||||
|
||||
@@ -28,7 +28,7 @@ import java.util.stream.Stream;
|
||||
public class ToolSourceUpdater {
|
||||
|
||||
public static void updateToolSource(String toolName, String domainGroup, String description, boolean register, Boolean requiresApproval) throws Exception {
|
||||
// 1. Find all *UseCase.java files in dap-tool-* directories
|
||||
// 1. Find all *UseCase.java files in dap-was-* directories
|
||||
String envSourceDir = System.getenv("AXHUB_SOURCE_DIR");
|
||||
Path rootDir = envSourceDir != null ? Paths.get(envSourceDir) : Paths.get(".");
|
||||
|
||||
@@ -37,7 +37,7 @@ public class ToolSourceUpdater {
|
||||
javaFiles = paths
|
||||
.filter(Files::isRegularFile)
|
||||
.filter(p -> p.toString().endsWith("UseCase.java"))
|
||||
.filter(p -> p.toString().contains("dap-tool-") || p.toString().contains("axhub-tool-"))
|
||||
.filter(p -> p.toString().contains("dap-was-") || p.toString().contains("axhub-tool-"))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
|
||||
@@ -38,8 +38,8 @@ public final class McpToolNameValidator {
|
||||
|
||||
try (var modules = Files.list(projectRoot)) {
|
||||
modules.filter(Files::isDirectory)
|
||||
.filter(path -> path.getFileName().toString().startsWith("dap-tool-"))
|
||||
.filter(path -> !path.getFileName().toString().equals("dap-tool-core"))
|
||||
.filter(path -> path.getFileName().toString().startsWith("dap-was-"))
|
||||
.filter(path -> !path.getFileName().toString().equals("dap-was-core"))
|
||||
.sorted()
|
||||
.forEach(module -> collectDeclarations(module, declarationsByName));
|
||||
} catch (IOException exception) {
|
||||
|
||||
@@ -31,21 +31,21 @@ class McpToolNameValidatorTest {
|
||||
|
||||
@Test
|
||||
void rejectsDuplicateMcpFunctionNamesAcrossToolModules() throws IOException {
|
||||
writeToolSource("dap-tool-first", "FirstTool.java", "first", "oth.sms.notification.send");
|
||||
writeToolSource("dap-tool-second", "SecondTool.java", "second", "oth.sms.notification.send");
|
||||
writeToolSource("dap-was-first", "FirstTool.java", "first", "oth.sms.notification.send");
|
||||
writeToolSource("dap-was-second", "SecondTool.java", "second", "oth.sms.notification.send");
|
||||
|
||||
IllegalStateException exception = assertThrows(IllegalStateException.class,
|
||||
() -> McpToolNameValidator.assertUnique(temporaryRoot));
|
||||
|
||||
assertTrue(exception.getMessage().contains("oth.sms.notification.send"));
|
||||
assertTrue(exception.getMessage().contains("dap-tool-first"));
|
||||
assertTrue(exception.getMessage().contains("dap-tool-second"));
|
||||
assertTrue(exception.getMessage().contains("dap-was-first"));
|
||||
assertTrue(exception.getMessage().contains("dap-was-second"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void validationRunnerRejectsDuplicateMcpFunctionNamesBeforePackaging() throws IOException {
|
||||
writeToolSource("dap-tool-first", "FirstTool.java", "first", "oth.sms.notification.send");
|
||||
writeToolSource("dap-tool-second", "SecondTool.java", "second", "oth.sms.notification.send");
|
||||
writeToolSource("dap-was-first", "FirstTool.java", "first", "oth.sms.notification.send");
|
||||
writeToolSource("dap-was-second", "SecondTool.java", "second", "oth.sms.notification.send");
|
||||
|
||||
assertThrows(IllegalStateException.class,
|
||||
() -> McpToolNameValidationRunner.validate(temporaryRoot));
|
||||
@@ -53,7 +53,7 @@ class McpToolNameValidatorTest {
|
||||
|
||||
@Test
|
||||
void rejectsToolNameOutsidePodDomainServiceActionConvention() throws IOException {
|
||||
writeToolSource("dap-tool-first", "FirstTool.java", "first", "bond_issue");
|
||||
writeToolSource("dap-was-first", "FirstTool.java", "first", "bond_issue");
|
||||
|
||||
IllegalStateException exception = assertThrows(IllegalStateException.class,
|
||||
() -> McpToolNameValidator.assertUnique(temporaryRoot));
|
||||
@@ -70,11 +70,11 @@ class McpToolNameValidatorTest {
|
||||
void usesDomainSpecificNamesForCustomerBillingAndBondTools() throws IOException {
|
||||
Path root = findProjectRoot();
|
||||
|
||||
assertToolName(root, "dap-tool-oth/src/main/java/io/shinhanlife/dap/mcc/biz/cmm/usecase/CustomerInfoUseCase.java",
|
||||
assertToolName(root, "dap-was-oth/src/main/java/io/shinhanlife/dap/mcc/biz/cmm/usecase/CustomerInfoUseCase.java",
|
||||
"oth.cmm.customer.detail", "detail");
|
||||
assertToolName(root, "dap-tool-oth/src/main/java/io/shinhanlife/dap/mcc/biz/cmm/usecase/BillingProcessUseCase.java",
|
||||
assertToolName(root, "dap-was-oth/src/main/java/io/shinhanlife/dap/mcc/biz/cmm/usecase/BillingProcessUseCase.java",
|
||||
"oth.cmm.billing.process", "process");
|
||||
assertToolName(root, "dap-tool-oth/src/main/java/io/shinhanlife/dap/mcc/biz/cmm/usecase/BondIssueUseCase.java",
|
||||
assertToolName(root, "dap-was-oth/src/main/java/io/shinhanlife/dap/mcc/biz/cmm/usecase/BondIssueUseCase.java",
|
||||
"oth.cmm.bond.issue", "issue");
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ package io.shinhanlife.dap.mcc.oth;
|
||||
|
||||
/**
|
||||
* @package io.shinhanlife.dap.mcc.oth
|
||||
* @className DapToolOthApplication
|
||||
* @className DapWasOthApplication
|
||||
* @description AX HUB 시스템 처리 클래스
|
||||
* @author 0986406
|
||||
* @create 2026.09.01
|
||||
@@ -23,8 +23,8 @@ import org.springframework.cache.annotation.EnableCaching;
|
||||
@SpringBootApplication(scanBasePackages = {"io.shinhanlife.dap.mcc", "io.shinhanlife.dap.lib.adapter", "io.shinhanlife.dap.lib.mcp", "io.shinhanlife.dap.lib.config", "io.shinhanlife.dap.lib.integration"})
|
||||
@ConfigurationPropertiesScan(basePackages = {"io.shinhanlife.dap.mcc", "io.shinhanlife.dap.lib.adapter", "io.shinhanlife.dap.lib.mcp", "io.shinhanlife.dap.lib.config", "io.shinhanlife.dap.lib.integration"})
|
||||
@EnableCaching
|
||||
public class DapToolOthApplication {
|
||||
public class DapWasOthApplication {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(DapToolOthApplication.class, args);
|
||||
SpringApplication.run(DapWasOthApplication.class, args);
|
||||
}
|
||||
}
|
||||
@@ -16,10 +16,10 @@
|
||||
<property name="HOSTNAME" value="${HOSTNAME}" />
|
||||
|
||||
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>/swlog/dap-tool-oth/A01/${HOSTNAME}_A01.log</file> <!-- 현재 로그가 쌓이는 파일 -->
|
||||
<file>/swlog/dap-was-oth/A01/${HOSTNAME}_A01.log</file> <!-- 현재 로그가 쌓이는 파일 -->
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<!-- 매일 자정에 날짜를 붙여서 지난 로그를 분리 저장 -->
|
||||
<fileNamePattern>/swlog/dap-tool-oth/A01/${HOSTNAME}_A01_%d{yyyyMMdd}.log</fileNamePattern>
|
||||
<fileNamePattern>/swlog/dap-was-oth/A01/${HOSTNAME}_A01_%d{yyyyMMdd}.log</fileNamePattern>
|
||||
<!-- 최대 30일치 로그만 보관하고 오래된 것은 자동 삭제 -->
|
||||
<maxHistory>30</maxHistory>
|
||||
</rollingPolicy>
|
||||
|
||||
@@ -3,7 +3,7 @@ package io.shinhanlife.dap.mcc.sms;
|
||||
|
||||
/**
|
||||
* @package io.shinhanlife.dap.mcc.sms
|
||||
* @className DapToolSmsApplication
|
||||
* @className DapWasSmsApplication
|
||||
* @description AX HUB 시스템 처리 클래스
|
||||
* @author 0986406
|
||||
* @create 2026.09.01
|
||||
@@ -23,8 +23,8 @@ import org.springframework.cache.annotation.EnableCaching;
|
||||
@SpringBootApplication(scanBasePackages = {"io.shinhanlife.dap.mcc", "io.shinhanlife.dap.lib.adapter", "io.shinhanlife.dap.lib.mcp", "io.shinhanlife.dap.lib.config", "io.shinhanlife.dap.lib.integration"})
|
||||
@ConfigurationPropertiesScan(basePackages = {"io.shinhanlife.dap.mcc", "io.shinhanlife.dap.lib.adapter", "io.shinhanlife.dap.lib.mcp", "io.shinhanlife.dap.lib.config", "io.shinhanlife.dap.lib.integration"})
|
||||
@EnableCaching
|
||||
public class DapToolSmsApplication {
|
||||
public class DapWasSmsApplication {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(DapToolSmsApplication.class, args);
|
||||
SpringApplication.run(DapWasSmsApplication.class, args);
|
||||
}
|
||||
}
|
||||
@@ -16,10 +16,10 @@
|
||||
<property name="HOSTNAME" value="${HOSTNAME}" />
|
||||
|
||||
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>/swlog/dap-tool-sms/A01/${HOSTNAME}_A01.log</file> <!-- 현재 로그가 쌓이는 파일 -->
|
||||
<file>/swlog/dap-was-sms/A01/${HOSTNAME}_A01.log</file> <!-- 현재 로그가 쌓이는 파일 -->
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<!-- 매일 자정에 날짜를 붙여서 지난 로그를 분리 저장 -->
|
||||
<fileNamePattern>/swlog/dap-tool-sms/A01/${HOSTNAME}_A01_%d{yyyyMMdd}.log</fileNamePattern>
|
||||
<fileNamePattern>/swlog/dap-was-sms/A01/${HOSTNAME}_A01_%d{yyyyMMdd}.log</fileNamePattern>
|
||||
<!-- 최대 30일치 로그만 보관하고 오래된 것은 자동 삭제 -->
|
||||
<maxHistory>30</maxHistory>
|
||||
</rollingPolicy>
|
||||
|
||||
62
docs/superpowers/plans/2026-08-04-readme-current-was.md
Normal file
62
docs/superpowers/plans/2026-08-04-readme-current-was.md
Normal file
@@ -0,0 +1,62 @@
|
||||
# Current WAS README Implementation Plan
|
||||
|
||||
> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
|
||||
|
||||
**Goal:** Replace the README's removed Gateway-era documentation with an accurate guide to the current independent Tool WAS modules.
|
||||
|
||||
**Architecture:** The README becomes the single user-facing reference for the Gradle modules, the two Tool Pods, direct REST and Streamable HTTP MCP access, schema resolution, local configuration, and Docker Compose. Every statement must be traceable to the current `HEAD` source or current checked-in configuration; the working tree's zero-byte Java files are documented as an explicit limitation.
|
||||
|
||||
**Tech Stack:** Java 21, Spring Boot 4.0.5, Gradle 8.14.3, Spring AI MCP Server WebMVC, Redis, Docker Compose.
|
||||
|
||||
## Global Constraints
|
||||
|
||||
- Modify only `README.md` for the requested deliverable; do not restore or alter Java source, Gradle, Docker, or CI files.
|
||||
- Describe only current Tool WAS behavior; exclude the removed `dap-gateway`, Chat API, SSE transport, and external registry/heartbeat workflow.
|
||||
- Use exact module names `dap-was-lib`, `dap-was-oth`, and `dap-was-sms`.
|
||||
- Label the working tree's 238 zero-byte Java files and stale Dockerfile jar paths as known execution blockers, not supported behavior.
|
||||
|
||||
---
|
||||
|
||||
### Task 1: Replace the obsolete README content
|
||||
|
||||
**Files:**
|
||||
- Modify: `README.md`
|
||||
|
||||
**Interfaces:**
|
||||
- Consumes: Gradle module declarations in `settings.gradle`, runtime configuration in both Tool Pods, `BusinessToolController`, `ToolManifestController`, `ToolMcpServerConfiguration`, `LocalToolScanner`, and `ToolPodMcpToolSynchronizer` from `HEAD`.
|
||||
- Produces: A self-contained Korean README for developers operating or extending the current Tool WAS deployment.
|
||||
|
||||
- [ ] **Step 1: Create a fact inventory before editing**
|
||||
|
||||
Record the following source-backed details for use in the README:
|
||||
|
||||
```text
|
||||
Modules: dap-was-lib, dap-was-sms, dap-was-oth
|
||||
Ports: SMS 8082, OTH 8084
|
||||
REST endpoints: GET /mcp/api/v1/tools/local, POST /mcp/{name}, GET /tool-manifest
|
||||
MCP transport: Streamable HTTP at /mcp
|
||||
Compose host ports: SMS 8282, OTH 8284, Redis 6379, WireMock 8089, Dozzle 8288
|
||||
```
|
||||
|
||||
- [ ] **Step 2: Rewrite README sections**
|
||||
|
||||
Replace Gateway-centric architecture, commands, URLs, environment variables, and future Gateway design material with sections for architecture, modules, API behavior, tool development, schema behavior, local/Docker execution, configuration, testing, and known limitations.
|
||||
|
||||
- [ ] **Step 3: Verify README facts mechanically**
|
||||
|
||||
Run:
|
||||
|
||||
```powershell
|
||||
rg -n "dap-gateway|OPENROUTER|/api/chat|/mcp/sse|AXHUB_GATEWAY_URL|ToolRegistryHeartbeatSender" README.md
|
||||
rg -n "dap-was-(lib|sms|oth)|/mcp/\{name\}|/tool-manifest|/mcp/api/v1/tools/local|8282|8284" README.md
|
||||
```
|
||||
|
||||
Expected: the first command produces no matches; the second shows the retained current implementation references.
|
||||
|
||||
- [ ] **Step 4: Cross-check every endpoint and command**
|
||||
|
||||
Compare README endpoint statements with the Java controller/configuration classes and compare module names, ports, profiles, and Docker service names with `settings.gradle`, `application*.yml`, and `docker-compose.yml`. Confirm that the README explicitly distinguishes source-backed behavior from known blockers.
|
||||
|
||||
- [ ] **Step 5: Commit**
|
||||
|
||||
Do not commit unless the user explicitly requests a commit; the workspace already contains unrelated migration changes.
|
||||
59
fix3.py
Normal file
59
fix3.py
Normal file
@@ -0,0 +1,59 @@
|
||||
import os
|
||||
import glob
|
||||
import re
|
||||
|
||||
def replace_in_file(path, replacements):
|
||||
with open(path, 'r', encoding='utf-8') as f:
|
||||
content = f.read()
|
||||
original = content
|
||||
for old, new in replacements:
|
||||
content = content.replace(old, new)
|
||||
if original != content:
|
||||
with open(path, 'w', encoding='utf-8') as f:
|
||||
f.write(content)
|
||||
|
||||
# 1. Rename Main Applications
|
||||
base_oth = 'c:/egov/workspace/dap-tool/dap-was-oth/src/main/java/io/shinhanlife/dap/mcc/oth/'
|
||||
if os.path.exists(base_oth + 'DapToolOthApplication.java'):
|
||||
os.rename(base_oth + 'DapToolOthApplication.java', base_oth + 'DapWasOthApplication.java')
|
||||
|
||||
base_sms = 'c:/egov/workspace/dap-tool/dap-was-sms/src/main/java/io/shinhanlife/dap/mcc/sms/'
|
||||
if os.path.exists(base_sms + 'DapToolSmsApplication.java'):
|
||||
os.rename(base_sms + 'DapToolSmsApplication.java', base_sms + 'DapWasSmsApplication.java')
|
||||
|
||||
# Replace DapTool...Application in code
|
||||
java_files = glob.glob('c:/egov/workspace/dap-tool/dap-was-*/**/*.java', recursive=True)
|
||||
for f in java_files:
|
||||
replace_in_file(f, [
|
||||
('DapToolOthApplication', 'DapWasOthApplication'),
|
||||
('DapToolSmsApplication', 'DapWasSmsApplication'),
|
||||
('DapTool%sApplication', 'DapWas%sApplication'),
|
||||
('dap-tool-', 'dap-was-'),
|
||||
('dap-tool-core', 'dap-was-lib'),
|
||||
('[Gateway Not Found]', '[WAS Not Found]'),
|
||||
('[Gateway Bad Request]', '[WAS Bad Request]'),
|
||||
('[Gateway Internal Error]', '[WAS Internal Error]'),
|
||||
('[Gateway Fatal Error]', '[WAS Fatal Error]'),
|
||||
('Shinhan MCP Gateway API 명세서', 'Shinhan MCP WAS API 명세서'),
|
||||
('Gateway Pod (8081)', 'WAS Pod')
|
||||
])
|
||||
|
||||
# Remove gateway from PodScaffolder.java
|
||||
pod = 'c:/egov/workspace/dap-tool/dap-was-lib/src/main/java/io/shinhanlife/dap/lib/util/PodScaffolder.java'
|
||||
replace_in_file(pod, [
|
||||
(' gateway:\n url: http://localhost:${server.port}/api/gateway\n', '')
|
||||
])
|
||||
|
||||
# 2. Update logback-spring.xml
|
||||
xml_files = glob.glob('c:/egov/workspace/dap-tool/**/logback-spring.xml', recursive=True)
|
||||
for f in xml_files:
|
||||
replace_in_file(f, [('dap-tool-', 'dap-was-')])
|
||||
|
||||
# 3. Update application.yml (Remove gateway blocks)
|
||||
yml_files = glob.glob('c:/egov/workspace/dap-tool/**/*.yml', recursive=True)
|
||||
for f in yml_files:
|
||||
replace_in_file(f, [
|
||||
(' gateway:\n url: http://localhost:${server.port}/api/gateway\n', '')
|
||||
])
|
||||
|
||||
print("Fix applied.")
|
||||
Reference in New Issue
Block a user