DJBRequestProcessor Override 메소드 시그니쳐 변경

This commit is contained in:
curry772
2026-05-27 10:32:08 +09:00
parent 7336267b32
commit 82998b475c
2 changed files with 25 additions and 12 deletions
@@ -1,11 +1,14 @@
package com.eactive.eai.custom.inbound.processor;
import java.util.Properties;
import org.apache.commons.lang3.StringUtils;
import com.eactive.eai.common.inflow.Bucket;
import com.eactive.eai.common.inflow.InflowTargetVO;
import com.eactive.eai.common.inflow.dual.DualBucket;
import com.eactive.eai.common.inflow.dual.DualCustomBucket;
import com.eactive.eai.common.message.EAIMessage;
import com.eactive.eai.custom.inflow.ClientDualBucket;
import com.eactive.eai.inbound.processor.RequestProcessor;
@@ -23,7 +26,8 @@ import com.eactive.eai.inbound.processor.RequestProcessor;
public class DJBRequestProcessor extends RequestProcessor {
@Override
protected String checkClientInflow(Bucket bucket, String clientId) {
protected String checkCustomInflow(Bucket bucket, EAIMessage eaiMsg, Properties prop) {
String clientId = eaiMsg.getClientId();
if (StringUtils.isBlank(clientId)) return null;
if (bucket instanceof ClientDualBucket) {
return ((ClientDualBucket) bucket).isClientPassDetail(clientId);
@@ -32,9 +36,9 @@ public class DJBRequestProcessor extends RequestProcessor {
}
@Override
protected InflowTargetVO resolveClientInflowThreshold(Bucket bucket, String clientId) {
protected InflowTargetVO resolveCustomInflowThreshold(Bucket bucket, EAIMessage eaiMsg, Properties prop) {
if (bucket instanceof ClientDualBucket) {
return ((ClientDualBucket) bucket).getClientInflowThreshold(clientId);
return ((ClientDualBucket) bucket).getClientInflowThreshold(eaiMsg.getClientId());
}
return null;
}
@@ -8,6 +8,8 @@ import static org.mockito.Mockito.never;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import java.util.Properties;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.springframework.context.ApplicationContext;
@@ -17,6 +19,7 @@ import com.eactive.eai.common.inflow.Bucket;
import com.eactive.eai.common.inflow.InflowTargetVO;
import com.eactive.eai.common.inflow.dual.DualBucket;
import com.eactive.eai.common.inflow.dual.DualCustomBucket;
import com.eactive.eai.common.message.EAIMessage;
import com.eactive.eai.common.server.EAIServerManager;
import com.eactive.eai.common.util.ApplicationContextProvider;
import com.eactive.eai.custom.inflow.ClientDualBucket;
@@ -53,6 +56,12 @@ class DJBRequestProcessorTest {
return vo;
}
private EAIMessage mockEaiMsg(String clientId) {
EAIMessage msg = mock(EAIMessage.class);
when(msg.getClientId()).thenReturn(clientId);
return msg;
}
// -------------------------------------------------------------------------
// checkAdapterInflow
// -------------------------------------------------------------------------
@@ -148,43 +157,43 @@ class DJBRequestProcessorTest {
}
// -------------------------------------------------------------------------
// checkClientInflow — ClientDualBucket 기반
// checkCustomInflow — ClientDualBucket 기반
// -------------------------------------------------------------------------
@Test
void checkClientInflow_clientDualBucket_pass_returnsNull() {
void checkCustomInflow_clientDualBucket_pass_returnsNull() {
DJBRequestProcessor processor = new DJBRequestProcessor();
ClientDualBucket mockBucket = mock(ClientDualBucket.class);
when(mockBucket.isClientPassDetail("CLIENT_A")).thenReturn(null);
assertNull(processor.checkClientInflow(mockBucket, "CLIENT_A"));
assertNull(processor.checkCustomInflow(mockBucket, mockEaiMsg("CLIENT_A"), new Properties()));
verify(mockBucket).isClientPassDetail("CLIENT_A");
}
@Test
void checkClientInflow_clientDualBucket_blocked() {
void checkCustomInflow_clientDualBucket_blocked() {
DJBRequestProcessor processor = new DJBRequestProcessor();
ClientDualBucket mockBucket = mock(ClientDualBucket.class);
when(mockBucket.isClientPassDetail("CLIENT_A")).thenReturn(DualCustomBucket.RESULT_BLOCKED_THRESHOLD);
assertEquals(DualCustomBucket.RESULT_BLOCKED_THRESHOLD,
processor.checkClientInflow(mockBucket, "CLIENT_A"));
processor.checkCustomInflow(mockBucket, mockEaiMsg("CLIENT_A"), new Properties()));
}
@Test
void checkClientInflow_nonClientDualBucket_returnsNull() {
void checkCustomInflow_nonClientDualBucket_returnsNull() {
DJBRequestProcessor processor = new DJBRequestProcessor();
Bucket mockBucket = mock(Bucket.class);
assertNull(processor.checkClientInflow(mockBucket, "CLIENT_A"));
assertNull(processor.checkCustomInflow(mockBucket, mockEaiMsg("CLIENT_A"), new Properties()));
}
@Test
void checkClientInflow_blankClientId_returnsNull() {
void checkCustomInflow_blankClientId_returnsNull() {
DJBRequestProcessor processor = new DJBRequestProcessor();
ClientDualBucket mockBucket = mock(ClientDualBucket.class);
assertNull(processor.checkClientInflow(mockBucket, ""));
assertNull(processor.checkCustomInflow(mockBucket, mockEaiMsg(""), new Properties()));
verify(mockBucket, never()).isClientPassDetail(any());
}