From 07569e62da157b636cdfbd1f3c59305114cd627a Mon Sep 17 00:00:00 2001 From: curry772 Date: Mon, 11 May 2026 16:11:10 +0900 Subject: [PATCH] =?UTF-8?q?HTTP=EB=8F=84=20REST=20=EC=B2=98=EB=9F=BC=20sim?= =?UTF-8?q?ulator=20=ED=98=B8=EC=B6=9C=20=EA=B8=B0=EB=8A=A5,=20mock=20serv?= =?UTF-8?q?er(test=20master)=20=ED=98=B8=EC=B6=9C=EB=A1=9C=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/eactive/eai/outbound/HTTPProcess.java | 56 +++++++++++++------ 1 file changed, 38 insertions(+), 18 deletions(-) diff --git a/src/main/java/com/eactive/eai/outbound/HTTPProcess.java b/src/main/java/com/eactive/eai/outbound/HTTPProcess.java index da67208..b965eca 100644 --- a/src/main/java/com/eactive/eai/outbound/HTTPProcess.java +++ b/src/main/java/com/eactive/eai/outbound/HTTPProcess.java @@ -17,6 +17,7 @@ import com.eactive.eai.adapter.AdapterPropManager; import com.eactive.eai.adapter.AdapterVO; import com.eactive.eai.adapter.http.HttpStatusException; import com.eactive.eai.adapter.http.client.HttpClientAdapterServiceKey; +import com.eactive.eai.adapter.http.dynamic.HttpAdapterServiceKey; import com.eactive.eai.common.EAIKeys; import com.eactive.eai.common.exception.ExceptionUtil; import com.eactive.eai.common.header.HeaderAction; @@ -352,24 +353,26 @@ public class HTTPProcess extends DefaultProcess { this.tempProp.put(HttpClientAdapterServiceKey.INSTANCE_ID, instanceId); } - EAIServerManager eaiServerManager = EAIServerManager.getInstance(); - AdapterManager adapterManager = AdapterManager.getInstance(); - AdapterGroupVO adptGrpVO = adapterManager.getAdapterGroupVO(reqEaiMsg.getCurrentSvcMsg().getPsvSysItfTp()); - if (eaiServerManager.isTASEnabledEAIServer() && EAIMessageKeys.TRANTYPE_TAS.equals(reqEaiMsg.getTranType()) - // RESTAdapter는 교체하지 않는다 - && !StringUtils.equals(adptGrpVO.getType(), com.eactive.eai.adapter.Keys.TYPE_REST)) { - PropManager manager = PropManager.getInstance(); - Properties prop = manager.getProperties(RouteKeys.SIM); - - if (reqEaiMsg.getCurrentSvcMsg().isSyncItfTp()) { - this.adapterGroupName = prop.getProperty(RouteKeys.SIM_ADAPTER_SYNC, "_SIM_OU_HTT_SyC"); - } else { - this.adapterGroupName = prop.getProperty(RouteKeys.SIM_ADAPTER_ASYNC, "_SIM_OU_HTT_AsC"); - } - this.reqEaiMsg.getSvcMsg(0).setPsvSysItfTp(this.adapterGroupName); - } else { - this.adapterGroupName = reqEaiMsg.getCurrentSvcMsg().getPsvSysItfTp(); - } +// EAIServerManager eaiServerManager = EAIServerManager.getInstance(); +// AdapterManager adapterManager = AdapterManager.getInstance(); +// AdapterGroupVO adptGrpVO = adapterManager.getAdapterGroupVO(reqEaiMsg.getCurrentSvcMsg().getPsvSysItfTp()); +// if (eaiServerManager.isTASEnabledEAIServer() && EAIMessageKeys.TRANTYPE_TAS.equals(reqEaiMsg.getTranType()) +// // RESTAdapter는 교체하지 않는다 +// && !StringUtils.equals(adptGrpVO.getType(), com.eactive.eai.adapter.Keys.TYPE_REST)) { +// PropManager manager = PropManager.getInstance(); +// Properties prop = manager.getProperties(RouteKeys.SIM); +// +// if (reqEaiMsg.getCurrentSvcMsg().isSyncItfTp()) { +// this.adapterGroupName = prop.getProperty(RouteKeys.SIM_ADAPTER_SYNC, "_SIM_OU_HTT_SyC"); +// } else { +// this.adapterGroupName = prop.getProperty(RouteKeys.SIM_ADAPTER_ASYNC, "_SIM_OU_HTT_AsC"); +// } +// this.reqEaiMsg.getSvcMsg(0).setPsvSysItfTp(this.adapterGroupName); +// } else { +// this.adapterGroupName = reqEaiMsg.getCurrentSvcMsg().getPsvSysItfTp(); +// } + + this.adapterGroupName = reqEaiMsg.getCurrentSvcMsg().getPsvSysItfTp(); this.svcTsmtUsgTp = this.reqEaiMsg.getSvcTsmtUsgTp(); // Inbound 호출방식 this.psvItfTp = this.reqEaiMsg.getCurrentSvcMsg().getPsvItfTp(); // 호출방식 @@ -404,6 +407,7 @@ public class HTTPProcess extends DefaultProcess { } // Inbound Adapter mesageType + AdapterManager adapterManager = AdapterManager.getInstance(); AdapterGroupVO inAdptGrpVO = adapterManager.getAdapterGroupVO(this.reqEaiMsg.getSngSysItfTp()); this.inAdapterMsgType = MessageType.ASC; @@ -592,6 +596,22 @@ public class HTTPProcess extends DefaultProcess { logger.debug(guidLogPrefix + " HTTP NONSTANDARD Request Message : " + MessageUtil.toAdapterTypeString(this.reqObject, this.inboundCharset)); } + // TAS 선택시 시뮬레이터 url로 변경, HTT 어댑터도 RST 처럼 방식을 변경하였다. + EAIServerManager eaiServerManager = EAIServerManager.getInstance(); + if (eaiServerManager.isTASEnabledEAIServer() && EAIMessageKeys.TRANTYPE_TAS.equals(reqEaiMsg.getTranType())) { + PropManager manager = PropManager.getInstance(); + Properties prop = manager.getProperties(RouteKeys.SIM); + String simAddr = prop.getProperty(RouteKeys.SIM_REST_MOCKSERVER); + if (StringUtils.isBlank(simAddr)) { + throw new Exception(String.format("Properties %s > %s not setted", RouteKeys.SIM, + RouteKeys.SIM_REST_MOCKSERVER)); + } + + String url = StringUtils.removeEnd(simAddr, "/") + "/mockapi/" + this.reqEaiMsg.getEAISvcCd(); + this.outboundProp.put(HttpClientAdapterServiceKey.URL, url); + this.tempProp.remove(HttpAdapterServiceKey.INBOUND_REWRITE_PATH); + logger.debug("simUrl=" + url); + } } catch (Exception e) { String[] msgArgs = new String[1]; msgArgs[0] = this.reqEaiMsg.getEAISvcCd();