refactor: remove sample HTTP tool integration
Some checks failed
Deploy to OCIWP / deploy (push) Has been cancelled
Some checks failed
Deploy to OCIWP / deploy (push) Has been cancelled
This commit is contained in:
@@ -47,16 +47,6 @@ public class AxhubHttpComponent {
|
||||
return execute(api, uri, inputDto, responseBodyClass, timeout);
|
||||
}
|
||||
|
||||
/** Backward-compatible enum overload. */
|
||||
public <T, R> R call(AxhubHttpDomain domain, String uri, T inputDto, Class<R> responseBodyClass) {
|
||||
return call(domain.getCode(), uri, inputDto, responseBodyClass, 0);
|
||||
}
|
||||
|
||||
/** Backward-compatible enum overload. */
|
||||
public <T, R> R call(AxhubHttpDomain domain, String uri, T inputDto, Class<R> responseBodyClass, int timeout) {
|
||||
return call(domain.getCode(), uri, inputDto, responseBodyClass, timeout);
|
||||
}
|
||||
|
||||
/** Calls the configured URL only when the target is marked as a business Pod. */
|
||||
public <T, R> R callBizPod(String apiName, T inputDto, Class<R> responseBodyClass) {
|
||||
AxhubHttpProperties.ApiDefinition api = resolveApi(apiName);
|
||||
@@ -66,15 +56,6 @@ public class AxhubHttpComponent {
|
||||
return execute(api, "", inputDto, responseBodyClass, 0);
|
||||
}
|
||||
|
||||
/** Backward-compatible enum overload. */
|
||||
public <T, R> R callBizPod(AxhubHttpDomain domain, String uri, T inputDto, Class<R> responseBodyClass) {
|
||||
AxhubHttpProperties.ApiDefinition api = resolveApi(domain.getCode());
|
||||
if (!api.bizPod()) {
|
||||
throw new IllegalArgumentException("Configured API is not a business Pod: " + domain.getCode());
|
||||
}
|
||||
return execute(api, uri, inputDto, responseBodyClass, 0);
|
||||
}
|
||||
|
||||
private <T, R> R execute(AxhubHttpProperties.ApiDefinition api, String uri, T inputDto,
|
||||
Class<R> responseBodyClass, int timeout) {
|
||||
HttpHeader header = createHeader(api, timeout);
|
||||
@@ -156,4 +137,4 @@ public class AxhubHttpComponent {
|
||||
String right = suffix.startsWith("/") ? suffix : "/" + suffix;
|
||||
return left + right;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
package io.shinhanlife.dap.lib.integration.http.component;
|
||||
|
||||
/** Registered outbound HTTP API domains. Add a domain only after its endpoint is configured. */
|
||||
public enum AxhubHttpDomain {
|
||||
SAMPLE("sample");
|
||||
|
||||
private final String code;
|
||||
|
||||
AxhubHttpDomain(String code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
}
|
||||
@@ -117,7 +117,8 @@ public class ToolScaffolder {
|
||||
*/
|
||||
public static String scaffold(String baseName, String interfaceId, String title, String description, String group, String routingType, String moduleName, String author, String createDate, boolean register, String clientSystemCode, String inputSchemaResource, String outputSchemaResource, List<FieldDefinition> inputFields, List<FieldDefinition> outputFields) throws IOException {
|
||||
return scaffold(baseName, interfaceId, title, description, group, routingType, moduleName, author, createDate,
|
||||
register, clientSystemCode, inputSchemaResource, outputSchemaResource, inputFields, outputFields, "sample");
|
||||
register, clientSystemCode, inputSchemaResource, outputSchemaResource, inputFields, outputFields,
|
||||
toKebabCase(toPascalCase(baseName)));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -127,7 +128,7 @@ public class ToolScaffolder {
|
||||
baseName = toPascalCase(baseName);
|
||||
title = title == null || title.isBlank() ? baseName : title.trim();
|
||||
description = description == null ? "" : description.trim();
|
||||
httpApiName = httpApiName == null || httpApiName.isBlank() ? "sample" : httpApiName.trim();
|
||||
httpApiName = httpApiName == null || httpApiName.isBlank() ? toKebabCase(baseName) : httpApiName.trim();
|
||||
String envSourceDir = System.getenv("AXHUB_SOURCE_DIR");
|
||||
Path rootDir = envSourceDir != null ? Paths.get(envSourceDir) : Paths.get(".");
|
||||
|
||||
@@ -860,7 +861,7 @@ public class ToolScaffolder {
|
||||
Files.writeString(wireMockBodyPath, mockResponse);
|
||||
Files.writeString(wireMockMappingPath, wireMockMappingContent(interfaceId, wireMockBodyPath.getFileName().toString()));
|
||||
Files.writeString(podMockResponsePath, mockResponse);
|
||||
ensureLocalHttpApiConfiguration(moduleRoot, httpApiName, toolName);
|
||||
ensureLocalHttpApiConfiguration(projectRoot, httpApiName, toolName);
|
||||
log.append("[WireMock Response] ").append(wireMockBodyPath).append("\n");
|
||||
log.append("[WireMock Mapping] ").append(wireMockMappingPath).append("\n");
|
||||
log.append("[Pod Mock Response] ").append(podMockResponsePath).append("\n");
|
||||
@@ -889,8 +890,8 @@ public class ToolScaffolder {
|
||||
.toLowerCase(Locale.ROOT);
|
||||
}
|
||||
|
||||
private static void ensureLocalHttpApiConfiguration(Path moduleRoot, String httpApiName, String toolName) throws IOException {
|
||||
Path localConfigPath = moduleRoot.resolve("src/main/resources/application-local.yml");
|
||||
private static void ensureLocalHttpApiConfiguration(Path projectRoot, String httpApiName, String toolName) throws IOException {
|
||||
Path localConfigPath = projectRoot.resolve("dap-was-lib/src/main/resources/glow/application-glow-local.yml");
|
||||
Files.createDirectories(localConfigPath.getParent());
|
||||
String existing = Files.exists(localConfigPath) ? Files.readString(localConfigPath) : "";
|
||||
if (java.util.regex.Pattern.compile("(?m)^\\s*-\\s+name:\\s*"
|
||||
@@ -898,17 +899,7 @@ public class ToolScaffolder {
|
||||
return;
|
||||
}
|
||||
String environmentKey = toPackageSegment(httpApiName).toUpperCase(Locale.ROOT).replace('-', '_');
|
||||
String config = """
|
||||
|
||||
axhub:
|
||||
mock:
|
||||
http:
|
||||
enabled: true
|
||||
|
||||
glow:
|
||||
communication:
|
||||
http:
|
||||
api-list:
|
||||
String apiEntry = """
|
||||
- name: %s
|
||||
domain: ${AXHUB_%s_HTTP_DOMAIN:http://localhost:${server.port}}
|
||||
url: ${AXHUB_%s_HTTP_URL:/api/mock/http/%s}
|
||||
@@ -916,7 +907,37 @@ public class ToolScaffolder {
|
||||
content-type: application/json;charset=UTF-8
|
||||
biz-pod: false
|
||||
""".formatted(httpApiName, environmentKey, environmentKey, toolName);
|
||||
Files.writeString(localConfigPath, existing + config);
|
||||
if (existing.isBlank()) {
|
||||
existing = """
|
||||
spring:
|
||||
config:
|
||||
activate:
|
||||
on-profile: local
|
||||
|
||||
glow:
|
||||
communication:
|
||||
http:
|
||||
api-list:
|
||||
""" + apiEntry;
|
||||
} else if (existing.contains("\n mci:")) {
|
||||
existing = existing.replace("\n mci:", apiEntry + " mci:");
|
||||
} else if (existing.contains("\naxhub:")) {
|
||||
existing = existing.replace("\naxhub:", apiEntry + "axhub:");
|
||||
} else if (existing.contains("api-list:")) {
|
||||
existing += apiEntry;
|
||||
} else {
|
||||
throw new IllegalStateException("application-glow-local.yml must define glow.communication.http.api-list");
|
||||
}
|
||||
if (!existing.contains("axhub:\n mock:\n http:\n enabled: true")) {
|
||||
existing += """
|
||||
|
||||
axhub:
|
||||
mock:
|
||||
http:
|
||||
enabled: true
|
||||
""";
|
||||
}
|
||||
Files.writeString(localConfigPath, existing);
|
||||
}
|
||||
|
||||
private static String dtoContent(String packageName, String className, List<FieldDefinition> fields,
|
||||
@@ -1059,7 +1080,7 @@ public class ToolScaffolder {
|
||||
String normalized = value == null ? "" : value.toLowerCase(Locale.ROOT)
|
||||
.replaceAll("[^a-z0-9]+", "_")
|
||||
.replaceAll("^_+|_+$", "");
|
||||
return normalized.isBlank() ? "sample" : normalized;
|
||||
return normalized.isBlank() ? "http_api" : normalized;
|
||||
}
|
||||
private static String mciConverterContent(String bizPackage, String baseName, String mciPackage, String interfaceId) {
|
||||
return """
|
||||
|
||||
@@ -13,9 +13,9 @@ glow:
|
||||
connection-timeout: 5
|
||||
read-timeout: 5
|
||||
api-list:
|
||||
- name: sample
|
||||
domain: ${AXHUB_SAMPLE_HTTP_DOMAIN:http://localhost:8089}
|
||||
url: ${AXHUB_SAMPLE_HTTP_URL:/CLCNNB00001}
|
||||
- name: memo
|
||||
domain: ${AXHUB_MEMO_HTTP_DOMAIN:http://localhost:${server.port}}
|
||||
url: ${AXHUB_MEMO_HTTP_URL:/api/mock/http/cmm_memo_retriever}
|
||||
method: POST
|
||||
content-type: application/json;charset=UTF-8
|
||||
biz-pod: false
|
||||
@@ -27,4 +27,9 @@ glow:
|
||||
port: ${GLOW_COMMUNICATION_EXTMCI_PORT:8080}
|
||||
eai:
|
||||
host: ${GLOW_COMMUNICATION_EAI_HOST:http://localhost}
|
||||
port: ${GLOW_COMMUNICATION_EAI_PORT:8080}
|
||||
port: ${GLOW_COMMUNICATION_EAI_PORT:8080}
|
||||
|
||||
axhub:
|
||||
mock:
|
||||
http:
|
||||
enabled: true
|
||||
|
||||
@@ -21,18 +21,8 @@ glow:
|
||||
http:
|
||||
connection-timeout: 5
|
||||
read-timeout: 5
|
||||
# HTTP Tool target catalog. Replace or add entries after the business endpoint is agreed.
|
||||
api-list:
|
||||
# WireMock/개발환경 샘플입니다. 컨테이너 내부에서는 localhost가 Tool Pod 자신을 뜻하므로
|
||||
# Docker 서비스명(mci-mock)과 컨테이너 포트(8080)를 기본값으로 사용합니다.
|
||||
# 로컬 PC에서 실행할 때는 AXHUB_SAMPLE_HTTP_DOMAIN=http://localhost:8089 로 덮어씁니다.
|
||||
- name: sample
|
||||
domain: ${AXHUB_SAMPLE_HTTP_DOMAIN:http://mci-mock:8080}
|
||||
# mci-mock/mappings/smp_employee_search.json의 urlPath와 동일해야 합니다.
|
||||
url: ${AXHUB_SAMPLE_HTTP_URL:/CLCNNB00001}
|
||||
method: POST
|
||||
content-type: application/json;charset=UTF-8
|
||||
biz-pod: false
|
||||
# HTTP Tool target catalog. Scaffold adds local mock entries after a Tool is created.
|
||||
api-list: []
|
||||
mci:
|
||||
uri: /ntl_mci/dap_rcv
|
||||
receive-uri: /itrf/mciReceive
|
||||
@@ -48,4 +38,4 @@ glow:
|
||||
encoding: EUC-KR
|
||||
websocket:
|
||||
endpoint: /ws-glow
|
||||
allowed-origins: "*"
|
||||
allowed-origins: "*"
|
||||
|
||||
Reference in New Issue
Block a user