feat: 클라이언트 유량제어/RequestProcessor custom 패키지로 분리
- DJBRequestProcessor: inbound.processor → custom.inbound.processor 이동
- ClientInflowTargetMetricService/Controller: custom.inflow 패키지 신규 생성
클라이언트 메트릭 API(/manage/inflow/client/**)를 InflowTargetMetric*에서 분리
- InflowTargetMetricService/Controller: 클라이언트 관련 메서드/엔드포인트 제거
- InflowTargetBucketService: getClientDualManager() 분리 반영
- standard-message-config.properties: requestProcessor.class 경로 업데이트
- 단위 테스트: ClientInflowTargetMetric{Service,Controller}Test 추가,
기존 테스트에서 클라이언트 케이스 분리
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -13,12 +13,12 @@ import com.eactive.eai.common.inflow.dual.DualInflowControlManager;
|
||||
/**
|
||||
* InflowTargetMetricService 단위 테스트.
|
||||
*
|
||||
* <p>getDualManager()를 오버라이드하여 DualInflowControlManager 의존성을 주입한다.
|
||||
* <p>어댑터/인터페이스 테스트는 getDualManager()를 오버라이드하여 DualInflowControlManager 주입.
|
||||
*/
|
||||
class InflowTargetMetricServiceTest {
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// 테스트용 서브클래스
|
||||
// 테스트용 서브클래스 — 어댑터/인터페이스용
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
private static InflowTargetMetricService serviceWith(DualInflowControlManager manager) {
|
||||
@@ -76,11 +76,6 @@ class InflowTargetMetricServiceTest {
|
||||
assertNull(serviceWith(null).getInterfaceMetric("IF1"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void getClientMetric_managerIsNull_returnsNull() {
|
||||
assertNull(serviceWith(null).getClientMetric("C1"));
|
||||
}
|
||||
|
||||
// =========================================================================
|
||||
// 어댑터 — 단일 조회
|
||||
// =========================================================================
|
||||
@@ -271,55 +266,4 @@ class InflowTargetMetricServiceTest {
|
||||
serviceWith(manager).resetAllInterfaceMetrics();
|
||||
verify(manager).resetAllInterfaceMetrics();
|
||||
}
|
||||
|
||||
// =========================================================================
|
||||
// 클라이언트 — 단일 조회
|
||||
// =========================================================================
|
||||
|
||||
@Test
|
||||
void getClientMetric_found_mapsFields() {
|
||||
DualInflowControlManager manager = mock(DualInflowControlManager.class);
|
||||
when(manager.getClientInflowThreshold("C1")).thenReturn(makeVO("C1"));
|
||||
when(manager.getClientMetrics("C1")).thenReturn(makeMetrics(200, 30, 20));
|
||||
|
||||
TargetMetricDTO dto = serviceWith(manager).getClientMetric("C1");
|
||||
|
||||
assertNotNull(dto);
|
||||
assertEquals("C1", dto.getTargetId());
|
||||
assertEquals("CLIENT", dto.getTargetType());
|
||||
assertEquals(200, dto.getAllowed());
|
||||
assertEquals(250, dto.getTotalRequests());
|
||||
}
|
||||
|
||||
@Test
|
||||
void getClientMetric_notRegistered_returnsNull() {
|
||||
DualInflowControlManager manager = mock(DualInflowControlManager.class);
|
||||
when(manager.getClientInflowThreshold("C1")).thenReturn(null);
|
||||
|
||||
assertNull(serviceWith(manager).getClientMetric("C1"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void resetClientMetric_success_returnsTrueAndCallsManager() {
|
||||
DualInflowControlManager manager = mock(DualInflowControlManager.class);
|
||||
when(manager.getClientInflowThreshold("C1")).thenReturn(makeVO("C1"));
|
||||
|
||||
assertTrue(serviceWith(manager).resetClientMetric("C1"));
|
||||
verify(manager).resetClientMetrics("C1");
|
||||
}
|
||||
|
||||
@Test
|
||||
void resetClientMetric_notRegistered_returnsFalse() {
|
||||
DualInflowControlManager manager = mock(DualInflowControlManager.class);
|
||||
when(manager.getClientInflowThreshold("C1")).thenReturn(null);
|
||||
|
||||
assertFalse(serviceWith(manager).resetClientMetric("C1"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void resetAllClientMetrics_callsManager() {
|
||||
DualInflowControlManager manager = mock(DualInflowControlManager.class);
|
||||
serviceWith(manager).resetAllClientMetrics();
|
||||
verify(manager).resetAllClientMetrics();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user