feat: invoke Solgit MCI before returning dummy response
All checks were successful
Deploy to OCIWP / deploy (push) Successful in 6m26s
All checks were successful
Deploy to OCIWP / deploy (push) Successful in 6m26s
This commit is contained in:
@@ -3,7 +3,6 @@ package io.shinhanlife.dap.mcc.biz.solgit.usecase.impl;
|
|||||||
import io.shinhanlife.dap.mcc.biz.solgit.dto.SolgitReqListRequest;
|
import io.shinhanlife.dap.mcc.biz.solgit.dto.SolgitReqListRequest;
|
||||||
import io.shinhanlife.dap.mcc.biz.solgit.dto.SolgitReqListResponse;
|
import io.shinhanlife.dap.mcc.biz.solgit.dto.SolgitReqListResponse;
|
||||||
import io.shinhanlife.dap.mcc.biz.solgit.usecase.SolgitReqListUseCase;
|
import io.shinhanlife.dap.mcc.biz.solgit.usecase.SolgitReqListUseCase;
|
||||||
import io.shinhanlife.dap.lib.integration.mci.component.AxhubMciComponent;
|
|
||||||
import io.shinhanlife.glow.communication.dto.Transfer;
|
import io.shinhanlife.glow.communication.dto.Transfer;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
@@ -13,6 +12,7 @@ import java.util.List;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import io.shinhanlife.dap.mcc.biz.solgit.converter.SolgitReqListConverter;
|
import io.shinhanlife.dap.mcc.biz.solgit.converter.SolgitReqListConverter;
|
||||||
import io.shinhanlife.dap.mcc.infra.itrf.mci.ncl.g.io.SOLG00000001_I;
|
import io.shinhanlife.dap.mcc.infra.itrf.mci.ncl.g.io.SOLG00000001_I;
|
||||||
|
import io.shinhanlife.dap.mcc.infra.itrf.mci.ncl.g.io.SOLG00000001_O;
|
||||||
import io.shinhanlife.dap.mcc.infra.itrf.mci.ncl.g.MciNclgClient;
|
import io.shinhanlife.dap.mcc.infra.itrf.mci.ncl.g.MciNclgClient;
|
||||||
import io.shinhanlife.dap.mcc.biz.solgit.dto.SolgitReqListResponse.SolgitReqListItem;
|
import io.shinhanlife.dap.mcc.biz.solgit.dto.SolgitReqListResponse.SolgitReqListItem;
|
||||||
|
|
||||||
@@ -42,6 +42,11 @@ public class SolgitReqListUseCaseImpl implements SolgitReqListUseCase {
|
|||||||
public Object execute(SolgitReqListRequest req) {
|
public Object execute(SolgitReqListRequest req) {
|
||||||
log.info("[MCI Tool] {} 요청 수신. 파라미터: {}", "solgitReqList", req);
|
log.info("[MCI Tool] {} 요청 수신. 파라미터: {}", "solgitReqList", req);
|
||||||
try {
|
try {
|
||||||
|
SOLG00000001_I mciRequest = converter.toLegacyRequest(req);
|
||||||
|
Transfer<SOLG00000001_O> mciResponse = mci.callTo(
|
||||||
|
"SOLG00000001", "SOLG00000001", mciRequest, SOLG00000001_O.class);
|
||||||
|
log.info("[MCI Tool] SOLG00000001 MCI call completed. Returning dummy response: {}",
|
||||||
|
mciResponse != null);
|
||||||
// 현업 테스트용으로 MCI 통신을 바이패스하고 하드코딩된 결과를 반환합니다.
|
// 현업 테스트용으로 MCI 통신을 바이패스하고 하드코딩된 결과를 반환합니다.
|
||||||
SolgitReqListResponse res = new SolgitReqListResponse();
|
SolgitReqListResponse res = new SolgitReqListResponse();
|
||||||
List<SolgitReqListItem> list = new ArrayList<>();
|
List<SolgitReqListItem> list = new ArrayList<>();
|
||||||
|
|||||||
@@ -0,0 +1,39 @@
|
|||||||
|
package io.shinhanlife.dap.mcc.biz.solgit.usecase.impl;
|
||||||
|
|
||||||
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
|
import static org.mockito.ArgumentMatchers.eq;
|
||||||
|
import static org.mockito.Mockito.verify;
|
||||||
|
import static org.mockito.Mockito.when;
|
||||||
|
|
||||||
|
import io.shinhanlife.dap.mcc.biz.solgit.converter.SolgitReqListConverter;
|
||||||
|
import io.shinhanlife.dap.mcc.biz.solgit.dto.SolgitReqListRequest;
|
||||||
|
import io.shinhanlife.dap.mcc.biz.solgit.dto.SolgitReqListResponse;
|
||||||
|
import io.shinhanlife.dap.mcc.infra.itrf.mci.ncl.g.MciNclgClient;
|
||||||
|
import io.shinhanlife.dap.mcc.infra.itrf.mci.ncl.g.io.SOLG00000001_I;
|
||||||
|
import io.shinhanlife.dap.mcc.infra.itrf.mci.ncl.g.io.SOLG00000001_O;
|
||||||
|
import io.shinhanlife.glow.communication.dto.Transfer;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.mockito.Mockito;
|
||||||
|
|
||||||
|
class SolgitReqListUseCaseImplTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void callsMciWithConvertedRequestAndReturnsDummyResponse() throws Exception {
|
||||||
|
MciNclgClient mci = Mockito.mock(MciNclgClient.class);
|
||||||
|
SolgitReqListConverter converter = Mockito.mock(SolgitReqListConverter.class);
|
||||||
|
SolgitReqListUseCaseImpl useCase = new SolgitReqListUseCaseImpl(mci, converter);
|
||||||
|
SolgitReqListRequest request = new SolgitReqListRequest();
|
||||||
|
SOLG00000001_I mciRequest = new SOLG00000001_I();
|
||||||
|
|
||||||
|
when(converter.toLegacyRequest(request)).thenReturn(mciRequest);
|
||||||
|
when(mci.callTo(eq("SOLG00000001"), eq("SOLG00000001"), eq(mciRequest), eq(SOLG00000001_O.class)))
|
||||||
|
.thenReturn(new Transfer<>());
|
||||||
|
|
||||||
|
SolgitReqListResponse response = (SolgitReqListResponse) useCase.execute(request);
|
||||||
|
|
||||||
|
verify(converter).toLegacyRequest(request);
|
||||||
|
verify(mci).callTo("SOLG00000001", "SOLG00000001", mciRequest, SOLG00000001_O.class);
|
||||||
|
assertThat(response.getReqList()).extracting(SolgitReqListResponse.SolgitReqListItem::getSrId)
|
||||||
|
.containsExactly("SR-2026-001", "SR-2026-002");
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user