feat: add scaffold HTTP mock support
Some checks failed
Deploy to OCIWP / deploy (push) Has been cancelled
Some checks failed
Deploy to OCIWP / deploy (push) Has been cancelled
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
package io.shinhanlife.dap.mcc.biz.cmm.converter;
|
||||
|
||||
import io.shinhanlife.dap.mcc.biz.cmm.dto.MemoListRetrieverRequest;
|
||||
import io.shinhanlife.dap.mcc.biz.cmm.dto.MemoListRetrieverResponse;
|
||||
import io.shinhanlife.dap.mcc.infra.itrf.http.memo.io.MemoListRetrieverHttpRequest;
|
||||
import io.shinhanlife.dap.mcc.infra.itrf.http.memo.io.MemoListRetrieverHttpResponse;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mapping;
|
||||
import org.mapstruct.ReportingPolicy;
|
||||
|
||||
@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE)
|
||||
public interface MemoListRetrieverConverter {
|
||||
// Field names differ? Add mappings like this before the method.
|
||||
// @Mapping(source = "sourceField", target = "targetField")
|
||||
MemoListRetrieverHttpRequest toHttpRequest(MemoListRetrieverRequest request);
|
||||
MemoListRetrieverResponse toResponse(MemoListRetrieverHttpResponse httpResponse);
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package io.shinhanlife.dap.mcc.biz.cmm.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
public class MemoListRetrieverRequest {
|
||||
@Schema(description = "조회할 의뢰서 상태", example = "OPEN", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String memoStatus;
|
||||
|
||||
@Schema(description = "검색 키워드", example = "프로젝트", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String searchKeyword;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package io.shinhanlife.dap.mcc.biz.cmm.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
public class MemoListRetrieverResponse {
|
||||
private String resultCode;
|
||||
|
||||
private String resultMessage;
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package io.shinhanlife.dap.mcc.biz.cmm.usecase;
|
||||
|
||||
import org.springaicommunity.mcp.annotation.McpTool;
|
||||
import io.shinhanlife.dap.lib.annotation.ToolHint;
|
||||
import io.shinhanlife.dap.mcc.biz.cmm.dto.MemoListRetrieverRequest;
|
||||
import io.shinhanlife.dap.mcc.biz.cmm.dto.MemoListRetrieverResponse;
|
||||
|
||||
/**
|
||||
* @package io.shinhanlife.dap.mcc.biz.cmm.usecase
|
||||
* @className MemoListRetrieverUseCase
|
||||
* @description AX HUB ?쒖뒪??泥섎━ ?대옒??
|
||||
* @author Admin
|
||||
* @create 2026.08.11
|
||||
* <pre>
|
||||
* ---------- 媛쒖젙?대젰 ----------
|
||||
* ?섏젙?? ?섏젙?? ?섏젙?댁슜
|
||||
* ---------- -------- ---------------------------
|
||||
* 2026.08.11 Admin 理쒖큹?앹꽦
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
public interface MemoListRetrieverUseCase {
|
||||
|
||||
@McpTool(name = "cmm_memo_retriever", title = "의뢰서 목록 조회", description = "의뢰서 목록을 조회하여 의뢰 정보를 반환합니다.")
|
||||
@ToolHint(register = false, categoryKey = "cmm", mappingId = "MEMO0000001")
|
||||
MemoListRetrieverResponse execute(MemoListRetrieverRequest req);
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package io.shinhanlife.dap.mcc.biz.cmm.usecase.impl;
|
||||
|
||||
import io.shinhanlife.dap.mcc.biz.cmm.converter.MemoListRetrieverConverter;
|
||||
import io.shinhanlife.dap.mcc.biz.cmm.dto.MemoListRetrieverRequest;
|
||||
import io.shinhanlife.dap.mcc.biz.cmm.dto.MemoListRetrieverResponse;
|
||||
import io.shinhanlife.dap.mcc.infra.itrf.http.memo.MemoClient;
|
||||
import io.shinhanlife.dap.mcc.infra.itrf.http.memo.io.MemoListRetrieverHttpRequest;
|
||||
import io.shinhanlife.dap.mcc.infra.itrf.http.memo.io.MemoListRetrieverHttpResponse;
|
||||
import io.shinhanlife.dap.mcc.biz.cmm.usecase.MemoListRetrieverUseCase;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class MemoListRetrieverUseCaseImpl implements MemoListRetrieverUseCase {
|
||||
|
||||
private final MemoListRetrieverConverter converter;
|
||||
private final MemoClient memoClient;
|
||||
|
||||
@Override
|
||||
public MemoListRetrieverResponse execute(MemoListRetrieverRequest req) {
|
||||
MemoListRetrieverHttpRequest httpRequest = converter.toHttpRequest(req);
|
||||
MemoListRetrieverHttpResponse httpResponse = memoClient.call(httpRequest, MemoListRetrieverHttpResponse.class);
|
||||
|
||||
MemoListRetrieverResponse response = converter.toResponse(httpResponse);
|
||||
response.setResultCode("SUCCESS");
|
||||
response.setResultMessage("HTTP API call completed.");
|
||||
return response;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package io.shinhanlife.dap.mcc.infra.itrf.http.memo;
|
||||
|
||||
import io.shinhanlife.dap.lib.integration.http.component.AxhubHttpComponent;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
public class MemoClient {
|
||||
private static final String API_NAME = "memo";
|
||||
|
||||
private final AxhubHttpComponent http;
|
||||
|
||||
public <I, O> O call(I request, Class<O> responseType) {
|
||||
return http.call(API_NAME, request, responseType);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package io.shinhanlife.dap.mcc.infra.itrf.http.memo.io;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
public class MemoListRetrieverHttpRequest {
|
||||
@Schema(description = "조회할 의뢰서 상태", example = "OPEN", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String memoStatus;
|
||||
|
||||
@Schema(description = "검색 키워드", example = "프로젝트", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String searchKeyword;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package io.shinhanlife.dap.mcc.infra.itrf.http.memo.io;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
public class MemoListRetrieverHttpResponse {
|
||||
private String resultCode;
|
||||
|
||||
private String resultMessage;
|
||||
}
|
||||
@@ -26,3 +26,17 @@ axhub:
|
||||
url: http://localhost:8081
|
||||
tool:
|
||||
url: ${AXHUB_TOOL_URL:http://localhost:${server.port}}
|
||||
mock:
|
||||
http:
|
||||
enabled: true
|
||||
|
||||
glow:
|
||||
communication:
|
||||
http:
|
||||
api-list:
|
||||
- name: memo
|
||||
domain: ${AXHUB_MEMO_HTTP_DOMAIN:http://localhost:${server.port}}
|
||||
url: ${AXHUB_MEMO_HTTP_URL:/api/mock/http/cmm_memo_retriever}
|
||||
method: POST
|
||||
content-type: application/json;charset=UTF-8
|
||||
biz-pod: false
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"resultCode": "SUCCESS"
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package io.shinhanlife.dap.mcc.biz.cmm.usecase;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||
|
||||
import io.shinhanlife.dap.mcc.biz.cmm.dto.MemoListRetrieverRequest;
|
||||
import io.shinhanlife.dap.mcc.biz.cmm.dto.MemoListRetrieverResponse;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
class MemoListRetrieverUseCaseTest {
|
||||
|
||||
@Test
|
||||
void createsToolRequestAndResponseDtos() {
|
||||
assertNotNull(new MemoListRetrieverRequest());
|
||||
assertNotNull(new MemoListRetrieverResponse());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user