From a5d547b3f6f2fb181015f620a0b8709c919ba3f3 Mon Sep 17 00:00:00 2001 From: jade Date: Wed, 8 Jul 2026 14:19:23 +0900 Subject: [PATCH] feat: Add WireMock server for MCI testing and fix HttpEimsSender HTTP/2 compatibility issue --- .../mcp/adapter/sender/HttpEimsSender.java | 5 ++++- .../config/application-glow-local.yml | 6 +++--- docker-compose.yml | 17 +++++++++++++++ mci-mock/mappings/extmci.json | 21 +++++++++++++++++++ mci-mock/mappings/mci-send.json | 21 +++++++++++++++++++ 5 files changed, 66 insertions(+), 4 deletions(-) create mode 100644 mci-mock/mappings/extmci.json create mode 100644 mci-mock/mappings/mci-send.json diff --git a/axhub-tool-core/src/main/java/io/shinhanlife/axhub/biz/mcp/adapter/sender/HttpEimsSender.java b/axhub-tool-core/src/main/java/io/shinhanlife/axhub/biz/mcp/adapter/sender/HttpEimsSender.java index a1a8256..958ff90 100644 --- a/axhub-tool-core/src/main/java/io/shinhanlife/axhub/biz/mcp/adapter/sender/HttpEimsSender.java +++ b/axhub-tool-core/src/main/java/io/shinhanlife/axhub/biz/mcp/adapter/sender/HttpEimsSender.java @@ -22,7 +22,10 @@ public class HttpEimsSender implements EimsSender { this.glowProps = glowProps; // yml의 대내 MCI host, port, uri를 조합하여 EIMS 호출 주소 생성 this.eimsUrl = glowProps.getMci().getHost() + ":" + glowProps.getMci().getPort() + glowProps.getMci().getUri(); - this.restClient = RestClient.builder().build(); // 필요시 타임아웃 팩토리 추가 + org.springframework.http.client.SimpleClientHttpRequestFactory factory = new org.springframework.http.client.SimpleClientHttpRequestFactory(); + factory.setConnectTimeout(glowProps.getMci().getConnectionTimeout() * 1000); + factory.setReadTimeout(glowProps.getMci().getReadTimeout() * 1000); + this.restClient = RestClient.builder().requestFactory(factory).build(); } @Override diff --git a/axhub-tool-core/src/main/resources/config/application-glow-local.yml b/axhub-tool-core/src/main/resources/config/application-glow-local.yml index 2da2f27..3b14be9 100644 --- a/axhub-tool-core/src/main/resources/config/application-glow-local.yml +++ b/axhub-tool-core/src/main/resources/config/application-glow-local.yml @@ -30,7 +30,7 @@ glow: connection-timeout: 5 # 연결 타임아웃 시간 (초 단위) read-timeout: 5 # 읽기 타임아웃 시간 (초 단위) mci: # 대내MCI 통신 설정 - host: http://localhost # 대내MCI 호스트 주소 + host: http://host.docker.internal # 대내MCI 호스트 주소 port: 8080 # 대내MCI 포트 번호 uri: /mciSend # 대내MCI URI 정보 receive-uri: /app/mciReceive # 대내MCI 수신 URI @@ -38,7 +38,7 @@ glow: read-timeout: 30 # 읽기 타임아웃 시간 (초 단위) encoding: UTF-8 # 대내MCI 인코딩 정보 extmci: # 대외MCI 통신 설정 - host: http://localhost # 대외MCI 호스트 주소 + host: http://host.docker.internal # 대외MCI 호스트 주소 port: 8080 # 대외MCI 포트 번호 uri: /extmci # 대외MCI URI 정보 json-uri: /extmciJson # 대외MCI JSON방식 URI 정보 @@ -47,7 +47,7 @@ glow: read-timeout: 30 # 읽기 타임아웃 시간 (초 단위) encoding: EUC-KR # 대외MCI 인코딩 정보 eai: # EAI 통신 설정 - host: tcp://localhost # EAI 호스트 주소 (TODO: 실제 주소로 변경) + host: tcp://host.docker.internal # EAI 호스트 주소 (TODO: 실제 주소로 변경) port: 9999 # EAI 포트 번호 websocket: endpoint: "/ws-glow" diff --git a/docker-compose.yml b/docker-compose.yml index 2ab77f7..9fda885 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -40,6 +40,9 @@ services: - SPRING_DATA_REDIS_PORT=6379 - AXHUB_GATEWAY_URL=http://gateway:8081 - AXHUB_TOOL_URL=http://tool-sms:8082 + - GLOW_COMMUNICATION_MCI_HOST=http://mci-mock + - GLOW_COMMUNICATION_EXTMCI_HOST=http://mci-mock + - GLOW_COMMUNICATION_EAI_HOST=tcp://mci-mock tool-email: build: @@ -55,6 +58,9 @@ services: - SPRING_DATA_REDIS_PORT=6379 - AXHUB_GATEWAY_URL=http://gateway:8081 - AXHUB_TOOL_URL=http://tool-email:8083 + - GLOW_COMMUNICATION_MCI_HOST=http://mci-mock + - GLOW_COMMUNICATION_EXTMCI_HOST=http://mci-mock + - GLOW_COMMUNICATION_EAI_HOST=tcp://mci-mock tool-other: build: @@ -70,3 +76,14 @@ services: - SPRING_DATA_REDIS_PORT=6379 - AXHUB_GATEWAY_URL=http://gateway:8081 - AXHUB_TOOL_URL=http://tool-other:8084 + - GLOW_COMMUNICATION_MCI_HOST=http://mci-mock + - GLOW_COMMUNICATION_EXTMCI_HOST=http://mci-mock + - GLOW_COMMUNICATION_EAI_HOST=tcp://mci-mock + + mci-mock: + image: wiremock/wiremock:latest + ports: + - "8080:8080" + volumes: + - ./mci-mock/mappings:/home/wiremock/mappings + command: ["--port", "8080", "--verbose"] diff --git a/mci-mock/mappings/extmci.json b/mci-mock/mappings/extmci.json new file mode 100644 index 0000000..c799896 --- /dev/null +++ b/mci-mock/mappings/extmci.json @@ -0,0 +1,21 @@ +{ + "request": { + "method": "POST", + "urlPath": "/extmci" + }, + "response": { + "status": 200, + "headers": { + "Content-Type": "application/json;charset=UTF-8" + }, + "jsonBody": { + "resCode": "0000", + "resMsg": "정상 처리되었습니다.", + "data": { + "status": "SUCCESS", + "mock": true, + "detail": "가짜 응답 서버(extmci)에서 내려주는 샘플 데이터입니다." + } + } + } +} diff --git a/mci-mock/mappings/mci-send.json b/mci-mock/mappings/mci-send.json new file mode 100644 index 0000000..620d41a --- /dev/null +++ b/mci-mock/mappings/mci-send.json @@ -0,0 +1,21 @@ +{ + "request": { + "method": "POST", + "urlPath": "/mciSend" + }, + "response": { + "status": 200, + "headers": { + "Content-Type": "application/json;charset=UTF-8" + }, + "jsonBody": { + "resCode": "0000", + "resMsg": "정상 처리되었습니다.", + "data": { + "status": "SUCCESS", + "mock": true, + "detail": "가짜 응답 서버에서 내려주는 샘플 데이터입니다." + } + } + } +}