Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 0408abb890 |
@@ -14,6 +14,6 @@ eapim-admin 에서 포함하여 테스트 이용시 느린 부팅 속도 떄문
|
|||||||
GIT_SSH_COMMAND='ssh -i ~/.ssh/id_rsa-jenkins' git pull origin jenkins_with_weblogic
|
GIT_SSH_COMMAND='ssh -i ~/.ssh/id_rsa-jenkins' git pull origin jenkins_with_weblogic
|
||||||
|
|
||||||
# test run
|
# test run
|
||||||
KJB_EAPIM_TEST_ENABLED=TRUE ./gradlew :eapim-admin-kjb:test --tests "com.eactive.ext.kjb.ums.test.UmsTest.testSms" -Psafedb
|
KJB_EAPIM_TEST_ENABLED=TRUE kjb-gradle.sh :eapim-admin-kjb:test --tests "com.eactive.ext.kjb.ums.test.UmsTest.testSms" -Psafedb
|
||||||
KJB_EAPIM_TEST_ENABLED=TRUE ./gradlew :eapim-admin-kjb:test --tests "com.eactive.ext.kjb.ums.test.UmsTest.testEmail" -Psafedb
|
KJB_EAPIM_TEST_ENABLED=TRUE kjb-gradle.sh :eapim-admin-kjb:test --tests "com.eactive.ext.kjb.ums.test.UmsTest.testEmail" -Psafedb
|
||||||
```
|
```
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
/main/
|
||||||
|
/test/
|
||||||
|
/default/
|
||||||
+9
-5
@@ -9,12 +9,18 @@ group = 'com.eactive.ext.kjb'
|
|||||||
version = '1.0-SNAPSHOT'
|
version = '1.0-SNAPSHOT'
|
||||||
|
|
||||||
def springVersion = "5.3.27"
|
def springVersion = "5.3.27"
|
||||||
def nexusUrl = "https://nexus.eactive.synology.me:8090"
|
def reposiliteUrl = "http://localhost:8080"
|
||||||
|
|
||||||
|
allprojects {
|
||||||
repositories {
|
repositories {
|
||||||
maven {
|
maven {
|
||||||
url "${nexusUrl}/repository/maven-public/"
|
url "${reposiliteUrl}/private"
|
||||||
allowInsecureProtocol = true
|
allowInsecureProtocol = true
|
||||||
|
credentials {
|
||||||
|
username = reposiliteUser
|
||||||
|
password = reposilitePassword
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -26,9 +32,7 @@ dependencies {
|
|||||||
|
|
||||||
api 'com.eactive.elink.common:elink-common-data:4.5.5'
|
api 'com.eactive.elink.common:elink-common-data:4.5.5'
|
||||||
|
|
||||||
// log4j-core / log4j-1.2-api 는 log4j-to-slf4j 로 대체 (Hibernate/iBATIS 로그를 logback 으로 라우팅)
|
implementation fileTree(dir: "ext-libs", include: ["*.jar"])
|
||||||
implementation fileTree(dir: "ext-libs", include: ["*.jar"], exclude: ["log4j-core-*.jar", "log4j-1.2-api-*.jar"])
|
|
||||||
implementation 'org.apache.logging.log4j:log4j-to-slf4j:2.17.2'
|
|
||||||
|
|
||||||
// api "org.springframework:spring-context:${springVersion}"
|
// api "org.springframework:spring-context:${springVersion}"
|
||||||
// api "org.springframework:spring-webmvc:${springVersion}"
|
// api "org.springframework:spring-webmvc:${springVersion}"
|
||||||
|
|||||||
@@ -0,0 +1,2 @@
|
|||||||
|
reposiliteUser=admin
|
||||||
|
reposilitePassword=BFoZsHrQU4lmJf9rruDdcsPgE0gltKfRdTjAx04IgvFhrd5q07QwMFZqeLHFv+5n
|
||||||
@@ -1,6 +1,5 @@
|
|||||||
package com.eactive.ext.kjb.ums;
|
package com.eactive.ext.kjb.ums;
|
||||||
|
|
||||||
import com.eactive.apim.portal.common.util.PhoneNumberUtil;
|
|
||||||
import com.eactive.apim.portal.template.entity.MessageCode;
|
import com.eactive.apim.portal.template.entity.MessageCode;
|
||||||
import com.eactive.apim.portal.template.entity.MessageRequest;
|
import com.eactive.apim.portal.template.entity.MessageRequest;
|
||||||
import com.eactive.ext.kjb.common.KjbProperty;
|
import com.eactive.ext.kjb.common.KjbProperty;
|
||||||
@@ -129,7 +128,7 @@ public class KjbUmsService {
|
|||||||
.messageIdentityNo(guid)
|
.messageIdentityNo(guid)
|
||||||
.msgBizWorkCode(bizWorkCode.getCode())
|
.msgBizWorkCode(bizWorkCode.getCode())
|
||||||
.content(content)
|
.content(content)
|
||||||
.cellphone(PhoneNumberUtil.digitsOnly(cpno))
|
.cellphone(cpno)
|
||||||
.msgSndChnlCd(UmsRequestPayload.ChannelCode.KM)
|
.msgSndChnlCd(UmsRequestPayload.ChannelCode.KM)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
|||||||
@@ -17,11 +17,11 @@ public class KjbPropertyUtil {
|
|||||||
KjbPropertyValue anno = field.getAnnotation(KjbPropertyValue.class);
|
KjbPropertyValue anno = field.getAnnotation(KjbPropertyValue.class);
|
||||||
|
|
||||||
if (anno != null) {
|
if (anno != null) {
|
||||||
sbDelete.append("DELETE FROM EMSAPP.TSEAIRM24 WHERE PRPTYGROUPNAME = 'Monitoring' AND PRPTYNAME = '");
|
sbDelete.append("DELETE FROM EMSADM.TSEAIRM24 WHERE PRPTYGROUPNAME = 'Monitoring' AND PRPTYNAME = '");
|
||||||
sbDelete.append(anno.key());
|
sbDelete.append(anno.key());
|
||||||
sbDelete.append("';\n");
|
sbDelete.append("';\n");
|
||||||
|
|
||||||
sb.append("insert into EMSAPP.TSEAIRM24 (PRPTYGROUPNAME, PRPTYNAME, PRPTY2VAL) values ('Monitoring', ");
|
sb.append("insert into EMSADM.TSEAIRM24 (PRPTYGROUPNAME, PRPTYNAME, PRPTY2VAL) values ('Monitoring', ");
|
||||||
|
|
||||||
String key = anno.key();
|
String key = anno.key();
|
||||||
String defValue = anno.defaultValue();
|
String defValue = anno.defaultValue();
|
||||||
|
|||||||
@@ -0,0 +1,41 @@
|
|||||||
|
package com.eactive.ext.kjb.ums.test;
|
||||||
|
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
public class KjbEmailSendModuleTests {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void test() {
|
||||||
|
// KjbProperty prop = new KjbProperty();
|
||||||
|
// prop.setEaiBatchUrl(null);
|
||||||
|
// prop.setEaiBatchSendDir("D:\\kjb-logs\\sendmail\\snd");
|
||||||
|
// prop.setEaiBatchBackupDir("D:\\kjb-logs\\sendmail\\bak");
|
||||||
|
// prop.setEaiBatchInterfaceId("UAGFF00001UIE");
|
||||||
|
//
|
||||||
|
// EmailSendModule service = EmailSendModule.getInstance(prop, null);
|
||||||
|
// MessageRequest messageRequest = new MessageRequest();
|
||||||
|
// messageRequest.setId(UUID.randomUUID().toString());
|
||||||
|
// messageRequest.setEmail("dearmai@dearmai.net");
|
||||||
|
// messageRequest.setUsername("김광은");
|
||||||
|
// messageRequest.setSubject("제목 - test");
|
||||||
|
//
|
||||||
|
// messageRequest.setMessageCode(MessageCode.USER_ACCOUNT_LOCKED);
|
||||||
|
//// messageRequest.setMessage("내용 - test");
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// CompletableFuture<Boolean> future = service.sendEmail(messageRequest, (result, ex) -> {
|
||||||
|
// if (ex != null) {
|
||||||
|
// log.error("failed", ex);
|
||||||
|
// } else {
|
||||||
|
// log.info("result: {}", result);
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
//
|
||||||
|
// future.join();
|
||||||
|
|
||||||
|
log.info("done");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
package com.eactive.ext.kjb.ums.test;
|
||||||
|
|
||||||
|
import com.eactive.ext.kjb.common.KjbProperty;
|
||||||
|
import com.eactive.ext.kjb.utils.ValidationUtil;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.junit.jupiter.api.Assumptions;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
public class KjbPropertyTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void testKjbProperty() {
|
||||||
|
Assumptions.assumeTrue(
|
||||||
|
"true".equalsIgnoreCase(System.getenv("KJB_EAPIM_TEST_ENABLED")),
|
||||||
|
"OS 환경변수 내 KJB_EAPIM_TEST_ENABLED=TRUE 설정되어 있어야 동작함");
|
||||||
|
|
||||||
|
|
||||||
|
log.info("KjbProperty 테스트 시작");
|
||||||
|
|
||||||
|
|
||||||
|
log.info("기본값 Validation 테스트");
|
||||||
|
KjbProperty prop = new KjbProperty();
|
||||||
|
ValidationUtil.validateOrThrow(prop);
|
||||||
|
|
||||||
|
log.info("KjbProperty 테스트 완료");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,162 @@
|
|||||||
|
package com.eactive.ext.kjb.ums.test;
|
||||||
|
|
||||||
|
import com.eactive.apim.portal.template.entity.MessageCode;
|
||||||
|
import com.eactive.apim.portal.template.entity.MessageRequest;
|
||||||
|
import com.eactive.ext.kjb.common.KjbEaiBatchException;
|
||||||
|
import com.eactive.ext.kjb.common.KjbProperty;
|
||||||
|
import com.eactive.ext.kjb.common.KjbPropertyHolder;
|
||||||
|
import com.eactive.ext.kjb.common.KjbUmsException;
|
||||||
|
import com.eactive.ext.kjb.ums.KjbEmailSendModule;
|
||||||
|
import com.eactive.ext.kjb.ums.KjbUmsService;
|
||||||
|
import com.eactive.ext.kjb.utils.OsUtil;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.junit.jupiter.api.Assertions;
|
||||||
|
import org.junit.jupiter.api.Assumptions;
|
||||||
|
import org.junit.jupiter.api.BeforeAll;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
public class UmsTest {
|
||||||
|
private static KjbProperty prop = null;
|
||||||
|
|
||||||
|
@BeforeAll
|
||||||
|
public static void init() {
|
||||||
|
prop = new KjbProperty();
|
||||||
|
prop.setEaiBatchUrl("http://172.31.32.111:10230/BATAppWeb/EaiBatCall");
|
||||||
|
prop.setUmsEaiBatchInterfaceId("UIEFF00001UAG");
|
||||||
|
|
||||||
|
prop.setUmsHostUrl("http://172.31.35.144:9021");
|
||||||
|
prop.setUmsApiKey("7cca6d58-e4f7-474d-9edd-525806bc99ff");
|
||||||
|
|
||||||
|
if (OsUtil.isWindows()) {
|
||||||
|
prop.setEaiBatchUrl("");
|
||||||
|
prop.setUmsHostUrl("");
|
||||||
|
prop.setUmsEaiBatchSendDir("c:\\kjb-logs\\sendmail\\snd");
|
||||||
|
prop.setUmsEaiBatchBackupDir("c:\\kjb-logs\\sendmail\\bak");
|
||||||
|
prop.setUmsEaiBatchErrorDir("c:\\kjb-logs\\sendmail\\error");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (OsUtil.isLinux()) {
|
||||||
|
prop.setUmsEaiBatchSendDir("/Data/eapim/portal/sendmail/snd");
|
||||||
|
prop.setUmsEaiBatchBackupDir("/Data/eapim/portal/sendmail/bak");
|
||||||
|
prop.setUmsEaiBatchErrorDir("/Data/eapim/portal/sendmail/error");
|
||||||
|
}
|
||||||
|
|
||||||
|
KjbPropertyHolder.setForTest(prop);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testSms() {
|
||||||
|
Assumptions.assumeTrue(
|
||||||
|
"true".equalsIgnoreCase(System.getenv("KJB_EAPIM_TEST_ENABLED")),
|
||||||
|
"OS 환경변수 내 KJB_EAPIM_TEST_ENABLED=TRUE 설정되어 있어야 동작함");
|
||||||
|
|
||||||
|
MessageRequest messageRequest = new MessageRequest();
|
||||||
|
messageRequest.setId(UUID.randomUUID().toString());
|
||||||
|
messageRequest.setMessageCode(MessageCode.USER_VERIFICATION_MOBILEPHONE);
|
||||||
|
messageRequest.setPhone("01099750188");
|
||||||
|
messageRequest.setEmail("dearmai@dearmai.net");
|
||||||
|
messageRequest.setUsername("김광은");
|
||||||
|
messageRequest.setSubject("제목 - test");
|
||||||
|
messageRequest.setMessage("{\"ATHN_NO\"; \"369369\"}");
|
||||||
|
|
||||||
|
KjbUmsService umsService = KjbUmsService.getInstance();
|
||||||
|
try {
|
||||||
|
boolean result = umsService.send(messageRequest);
|
||||||
|
|
||||||
|
} catch (KjbUmsException e) {
|
||||||
|
log.error(e.getMessage(), e);
|
||||||
|
Assertions.fail(e);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
log.info("done");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* :eapim-admin-kjb:test --tests "com.eactive.ext.kjb.ums.test.UmsTest.testEmail"
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testEmail() {
|
||||||
|
Assumptions.assumeTrue(
|
||||||
|
"true".equalsIgnoreCase(System.getenv("KJB_EAPIM_TEST_ENABLED")),
|
||||||
|
"OS 환경변수 내 KJB_EAPIM_TEST_ENABLED=TRUE 설정되어 있어야 동작함");
|
||||||
|
|
||||||
|
|
||||||
|
System.getProperties().keySet().forEach(key -> {
|
||||||
|
log.info("{}: {}", key, System.getProperty((String) key));
|
||||||
|
});
|
||||||
|
|
||||||
|
KjbEmailSendModule service = KjbEmailSendModule.getInstance();
|
||||||
|
|
||||||
|
List<MessageRequest> requestList = new ArrayList<>();
|
||||||
|
|
||||||
|
|
||||||
|
log.info("#1 요청 생성 - 이메일 인증");
|
||||||
|
requestList.add(createMessageRequest(MessageCode.USER_VERIFICATION_EMAIL, "{\"ATHN_NO\": \"543216\"}"));
|
||||||
|
|
||||||
|
log.info("#2 요청 생성 - 비밀번호 초기화");
|
||||||
|
requestList.add(createMessageRequest(MessageCode.USER_PASSWORD_RESET, "{\"ATHN_NO\": \"new-password\"}"));
|
||||||
|
|
||||||
|
log.info("#3 요청 생성 - 비밀번호 변경 완료");
|
||||||
|
requestList.add(createMessageRequest(MessageCode.USER_PASSWORD_CHANGED, ""));
|
||||||
|
|
||||||
|
log.info("#4 요청 생성 - 로그인 제한");
|
||||||
|
requestList.add(createMessageRequest(MessageCode.USER_ACCOUNT_LOCKED, "{\"RJCT_RSN\": \"reason\"}"));
|
||||||
|
|
||||||
|
log.info("#5 요청 생성 - 이메일 초대");
|
||||||
|
requestList.add(createMessageRequest(MessageCode.USER_INVITATION,
|
||||||
|
"{\"CRPT_NM\":\"corpName\",\"MNGR_NM\":\"managerName\",\"CUST_ID\":\"loginId\",\"RCMD_CD\":\"321654\",\"URL_ADDR\":\"https://www.naver.com/\"}"));
|
||||||
|
|
||||||
|
log.info("#6 요청 생성 - 이메일 초대 취소");
|
||||||
|
requestList.add(createMessageRequest(MessageCode.USER_INVITATION_CANCELED,
|
||||||
|
"{\"CRPT_NM\":\"corpName\",\"MNGR_NM\":\"managerName\"}"));
|
||||||
|
|
||||||
|
log.info("#7 요청 생성 - 법인관리자 및 법인 등록 승인");
|
||||||
|
requestList.add(createMessageRequest(MessageCode.MANAGER_WITH_ORG_REGISTER_APPROVED, ""));
|
||||||
|
|
||||||
|
log.info("#8 요청 생성 - 법인관리자 및 법인 등록 거절");
|
||||||
|
requestList.add(createMessageRequest(MessageCode.MANAGER_WITH_ORG_REGISTER_REJECTED, "{\"RJCT_RSN\": \"reason\"}"));
|
||||||
|
|
||||||
|
log.info("#9 요청 생성 - 앱 승인");
|
||||||
|
requestList.add(createMessageRequest(MessageCode.APP_REGISTER_APPROVED, "{\"APP_IDNT_NM\": \"appName\"}"));
|
||||||
|
|
||||||
|
log.info("#10 요청 생성 - 앱 승인 거절");
|
||||||
|
requestList.add(createMessageRequest(MessageCode.APP_REGISTER_REJECTED, "{\"RJCT_RSN\": \"reason\"}"));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
try {
|
||||||
|
for (int i = 0; i < requestList.size(); i++) {
|
||||||
|
MessageRequest request = requestList.get(i);
|
||||||
|
log.info("#{} - 메일 전송 시도 - {}", i + 1, request.getServiceId());
|
||||||
|
service.sendEmail(request);
|
||||||
|
}
|
||||||
|
} catch (KjbEaiBatchException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
log.info("done");
|
||||||
|
}
|
||||||
|
|
||||||
|
private MessageRequest createMessageRequest(MessageCode messageCode, String message) {
|
||||||
|
MessageRequest messageRequest = new MessageRequest();
|
||||||
|
messageRequest.setId(UUID.randomUUID().toString());
|
||||||
|
messageRequest.setMessageCode(messageCode);
|
||||||
|
messageRequest.setEmail(System.getenv().getOrDefault("KJB_TEST_EMAIL", "25W0064@kjbank.com"));
|
||||||
|
messageRequest.setUmsUid(UUID.randomUUID().toString());
|
||||||
|
messageRequest.setUsername("김광은");
|
||||||
|
messageRequest.setSubject("제목 - test");
|
||||||
|
messageRequest.setMessage(message);
|
||||||
|
// messageRequest.setServiceId(serviceId);
|
||||||
|
|
||||||
|
log.info("MessageRequest - {}", messageRequest);
|
||||||
|
|
||||||
|
return messageRequest;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<configuration scan="true" scanPeriod="5 seconds">
|
||||||
|
|
||||||
|
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
|
||||||
|
<encoder>
|
||||||
|
<!-- <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>-->
|
||||||
|
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} %magenta([%thread]) %highlight([%-3level]) %logger - %msg %n</pattern>
|
||||||
|
</encoder>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<logger name="com.eactive.eai.custom.kjb" level="DEBUG" additivity="false">
|
||||||
|
<appender-ref ref="CONSOLE" />
|
||||||
|
</logger>
|
||||||
|
<logger name="com.eactive.ext.kjb" level="DEBUG" additivity="false">
|
||||||
|
<appender-ref ref="CONSOLE" />
|
||||||
|
</logger>
|
||||||
|
<logger name="org.apache.hc" level="DEBUG" additivity="false" />
|
||||||
|
|
||||||
|
|
||||||
|
<root level="INFO">
|
||||||
|
<appender-ref ref="CONSOLE" />
|
||||||
|
</root>
|
||||||
|
|
||||||
|
</configuration>
|
||||||
Reference in New Issue
Block a user