테스트 실패 대응

This commit is contained in:
Rinjae
2025-10-22 21:10:18 +09:00
parent 3b7c4d4683
commit 1928579717
4 changed files with 9 additions and 10 deletions
@@ -32,8 +32,8 @@ public class KjbProperty {
private String umsEaiBatchInterfaceId; private String umsEaiBatchInterfaceId;
@Pattern(regexp = "^(https?://[^\\s/$.?#][^\\s]*)|\\s*$", message = "kjb.ums.url 는 유효한 URL 형식이거나 공백이어야 합니다. 예: http://example.com/api") @Pattern(regexp = "^(https?://[^\\s/$.?#][^\\s]*)|\\s*$", message = "kjb.ums.host_url 는 유효한 URL 형식이거나 공백이어야 합니다. 예: http://example.com/api")
private String umsUrl; private String umsHostUrl;
@Pattern(regexp = "^[a-zA-Z0-9_-]{36}$", message = "kjb.ums.api_key 입력 형식이 맞지 않습니다.") @Pattern(regexp = "^[a-zA-Z0-9_-]{36}$", message = "kjb.ums.api_key 입력 형식이 맞지 않습니다.")
private String umsApiKey; private String umsApiKey;
@@ -11,7 +11,6 @@ import com.eactive.ext.kjb.utils.ValidationUtil;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.google.gson.JsonSyntaxException; import com.google.gson.JsonSyntaxException;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.hc.client5.http.classic.methods.HttpPost; import org.apache.hc.client5.http.classic.methods.HttpPost;
import org.apache.hc.client5.http.config.RequestConfig; import org.apache.hc.client5.http.config.RequestConfig;
@@ -52,7 +51,7 @@ public class KjbUmsService {
throw new IllegalArgumentException("property is null"); throw new IllegalArgumentException("property is null");
} }
isRealMode = property.getUmsUrl() != null && StringUtils.isNotEmpty(property.getUmsUrl().trim()); isRealMode = property.getUmsHostUrl() != null && StringUtils.isNotEmpty(property.getUmsHostUrl().trim());
if (isRealMode) { if (isRealMode) {
ValidationUtil.validateOrThrow(property); ValidationUtil.validateOrThrow(property);
@@ -84,7 +83,7 @@ public class KjbUmsService {
content = VerifyPhoneUmsTemplate.builder().authNumber(messageRequest.getMessage()).build(); content = VerifyPhoneUmsTemplate.builder().authNumber(messageRequest.getMessage()).build();
String umsMessageId = this.sendKakaoAlimTalk(messageRequest.getId(), String umsMessageId = this.sendKakaoAlimTalk(messageRequest.getId(),
UmzBizWorkCode.VERIFY_PHONE, UmsBizWorkCode.VERIFY_PHONE,
messageRequest.getPhone(), messageRequest.getPhone(),
content content
); );
@@ -94,7 +93,7 @@ public class KjbUmsService {
return true; return true;
} }
public String sendKakaoAlimTalk(String guid, UmzBizWorkCode bizWorkCode, String cpno, IUmsGsonObject content) { public String sendKakaoAlimTalk(String guid, UmsBizWorkCode bizWorkCode, String cpno, IUmsGsonObject content) {
if (content == null) { if (content == null) {
throw new IllegalArgumentException("content is null"); throw new IllegalArgumentException("content is null");
} }
@@ -140,7 +139,7 @@ public class KjbUmsService {
Gson gson = new Gson(); Gson gson = new Gson();
String json = gson.toJson(requestPayload); String json = gson.toJson(requestPayload);
HttpPost httpPost = new HttpPost(property.getUmsUrl() + url); HttpPost httpPost = new HttpPost(property.getUmsHostUrl() + url);
httpPost.setHeader("Content-Type", CONTENT_TYPE); httpPost.setHeader("Content-Type", CONTENT_TYPE);
httpPost.setHeader("Authorization", String.format(AUTHORIZATION_FMT, property.getUmsApiKey())); httpPost.setHeader("Authorization", String.format(AUTHORIZATION_FMT, property.getUmsApiKey()));
httpPost.setEntity(EntityBuilder.create().setText(json).setContentType(ContentType.APPLICATION_JSON).build()); httpPost.setEntity(EntityBuilder.create().setText(json).setContentType(ContentType.APPLICATION_JSON).build());
@@ -2,7 +2,7 @@ package com.eactive.ext.kjb.ums;
import lombok.Getter; import lombok.Getter;
public enum UmzBizWorkCode { public enum UmsBizWorkCode {
MONITORING("B_ELFN_09510", "OBP 모니터링"), MONITORING("B_ELFN_09510", "OBP 모니터링"),
VERIFY_PHONE("S55_ICT_0006", "API Portal 인증번호"), VERIFY_PHONE("S55_ICT_0006", "API Portal 인증번호"),
; ;
@@ -12,7 +12,7 @@ public enum UmzBizWorkCode {
@Getter @Getter
private String displayName; private String displayName;
UmzBizWorkCode(String code, String displayName) { UmsBizWorkCode(String code, String displayName) {
this.code = code; this.code = code;
this.displayName = displayName; this.displayName = displayName;
} }
@@ -41,7 +41,7 @@ public class UmsTest {
"true".equalsIgnoreCase(System.getenv("KJB_EAPIM_TEST_ENABLED")), "true".equalsIgnoreCase(System.getenv("KJB_EAPIM_TEST_ENABLED")),
"OS 환경변수 내 KJB_EAPIM_TEST_ENABLED=TRUE 설정되어 있어야 동작함"); "OS 환경변수 내 KJB_EAPIM_TEST_ENABLED=TRUE 설정되어 있어야 동작함");
prop.setUmsUrl("http://172.31.35.144:9021/ums/openapi/send"); prop.setUmsHostUrl("http://172.31.35.144:9021");
prop.setUmsApiKey("7cca6d58-e4f7-474d-9edd-525806bc99ff"); prop.setUmsApiKey("7cca6d58-e4f7-474d-9edd-525806bc99ff");
MessageRequest messageRequest = new MessageRequest(); MessageRequest messageRequest = new MessageRequest();