chore: import fully qualified types in events, pipes and scheduler (#6736)

Replaces inline fully-qualified class names with imports in five files and drops the two NoFqcn suppressions that covered them. ScheduleInvoker and its test each import one of the two NetworkConfiguration types and keep the other qualified, with a comment naming the clash.

Signed-off-by: Hector Ventura <hectorvent@gmail.com>
This commit is contained in:
Hector Ventura authored and GitHub committed 2026-10-27 10:08:57 -04:00
1 parent 52c9c51a7b
commit 6b10bf24c9
6 files changed
+36 -30

No files matched your search

@@ -1,5 +1,6 @@
package io.github.hectorvent.floci.services.eventbridge;
import io.github.hectorvent.floci.services.eventbridge.model.ArchivedEvent;
import io.github.hectorvent.floci.services.eventbridge.model.Replay;
import io.github.hectorvent.floci.services.eventbridge.model.ReplayState;
import io.vertx.core.Vertx;
@@ -84,9 +85,8 @@ class ReplayDispatcherTest {
return replay;
}
private static io.github.hectorvent.floci.services.eventbridge.model.ArchivedEvent archivedEvent() {
io.github.hectorvent.floci.services.eventbridge.model.ArchivedEvent event =
new io.github.hectorvent.floci.services.eventbridge.model.ArchivedEvent();
private static ArchivedEvent archivedEvent() {
ArchivedEvent event = new ArchivedEvent();
event.setEventTime(Instant.EPOCH.plusSeconds(1));
return event;
}
@@ -1,6 +1,7 @@
package io.github.hectorvent.floci.services.pipes;
import com.fasterxml.jackson.databind.ObjectMapper;
import io.github.hectorvent.floci.core.common.AwsException;
import io.github.hectorvent.floci.services.msk.MskService;
import io.github.hectorvent.floci.services.pipes.model.Pipe;
import org.junit.jupiter.api.BeforeEach;
@@ -145,10 +146,10 @@ class PipesKafkaConsumerManagerTest {
"""));
assertEquals("SourceParameters.ManagedStreamingKafkaParameters.TopicName is required",
assertThrows(io.github.hectorvent.floci.core.common.AwsException.class,
assertThrows(AwsException.class,
() -> manager.resolveTopicName(managed)).getMessage());
assertEquals("SourceParameters.SelfManagedKafkaParameters.TopicName is required",
assertThrows(io.github.hectorvent.floci.core.common.AwsException.class,
assertThrows(AwsException.class,
() -> manager.resolveTopicName(selfManaged)).getMessage());
}
@@ -163,10 +164,10 @@ class PipesKafkaConsumerManagerTest {
selfManaged.setSourceParameters(MAPPER.createObjectNode());
assertEquals("SourceParameters.ManagedStreamingKafkaParameters is required",
assertThrows(io.github.hectorvent.floci.core.common.AwsException.class,
assertThrows(AwsException.class,
() -> manager.resolveTopicName(managed)).getMessage());
assertEquals("SourceParameters.SelfManagedKafkaParameters is required",
assertThrows(io.github.hectorvent.floci.core.common.AwsException.class,
assertThrows(AwsException.class,
() -> manager.resolveTopicName(selfManaged)).getMessage());
}
@@ -7,6 +7,7 @@ import io.github.hectorvent.floci.config.EmulatorConfig;
import io.github.hectorvent.floci.services.eventbridge.EventBridgeService;
import io.github.hectorvent.floci.services.lambda.LambdaService;
import io.github.hectorvent.floci.services.lambda.model.InvocationType;
import io.github.hectorvent.floci.services.lambda.model.InvokeResult;
import io.github.hectorvent.floci.services.pipes.model.DesiredState;
import io.github.hectorvent.floci.services.pipes.model.Pipe;
import io.github.hectorvent.floci.services.sns.SnsService;
@@ -19,6 +20,7 @@ import org.mockito.ArgumentCaptor;
import org.mockito.Mock;
import org.mockito.junit.jupiter.MockitoExtension;
import java.nio.charset.StandardCharsets;
import java.time.Instant;
import java.util.HashMap;
import java.util.List;
@@ -109,7 +111,7 @@ class PipesTargetInvokerTest {
void invoke_keepsTheQualifierOfTheTargetFunctionArn() {
Pipe pipe = createPipe("arn:aws:lambda:us-east-1:000000000000:function:my-fn:PROD", null);
when(lambdaService.invoke(anyString(), anyString(), any(byte[].class), any(InvocationType.class)))
.thenReturn(new io.github.hectorvent.floci.services.lambda.model.InvokeResult(200, null, "{}".getBytes(), null, "req"));
.thenReturn(new InvokeResult(200, null, "{}".getBytes(), null, "req"));
invoker.invoke(pipe, "{}", "us-east-1");
@@ -359,9 +361,9 @@ class PipesTargetInvokerTest {
void applyEnrichment_invokesLambdaAndReturnsResponse() {
String region = "us-east-1";
Pipe pipe = enrichmentPipe(region, "arn:aws:lambda:" + region + ":000000000000:function:enrich-fn");
byte[] resp = "{\"systemId\":\"S1\"}".getBytes(java.nio.charset.StandardCharsets.UTF_8);
byte[] resp = "{\"systemId\":\"S1\"}".getBytes(StandardCharsets.UTF_8);
when(lambdaService.invoke(eq(region), eq("enrich-fn"), any(byte[].class), eq(InvocationType.RequestResponse)))
.thenReturn(new io.github.hectorvent.floci.services.lambda.model.InvokeResult(200, null, resp, null, "req"));
.thenReturn(new InvokeResult(200, null, resp, null, "req"));
String out = invoker.applyEnrichment(pipe, "[{\"body\":\"{}\"}]", region);
@@ -369,7 +371,7 @@ class PipesTargetInvokerTest {
ArgumentCaptor<byte[]> payloadCaptor = ArgumentCaptor.forClass(byte[].class);
verify(lambdaService).invoke(eq(region), eq("enrich-fn"), payloadCaptor.capture(), eq(InvocationType.RequestResponse));
assertEquals("[{\"body\":\"{}\"}]",
new String(payloadCaptor.getValue(), java.nio.charset.StandardCharsets.UTF_8));
new String(payloadCaptor.getValue(), StandardCharsets.UTF_8));
}
@Test
@@ -377,7 +379,7 @@ class PipesTargetInvokerTest {
String region = "us-east-1";
Pipe pipe = enrichmentPipe(region, "arn:aws:lambda:" + region + ":000000000000:function:enrich-fn:PROD");
when(lambdaService.invoke(eq(region), eq("enrich-fn:PROD"), any(byte[].class), eq(InvocationType.RequestResponse)))
.thenReturn(new io.github.hectorvent.floci.services.lambda.model.InvokeResult(200, null, "{}".getBytes(), null, "req"));
.thenReturn(new InvokeResult(200, null, "{}".getBytes(), null, "req"));
invoker.applyEnrichment(pipe, "[]", region);
@@ -397,7 +399,7 @@ class PipesTargetInvokerTest {
String region = "us-east-1";
Pipe pipe = enrichmentPipe(region, "arn:aws:lambda:" + region + ":000000000000:function:enrich-fn");
when(lambdaService.invoke(eq(region), eq("enrich-fn"), any(byte[].class), eq(InvocationType.RequestResponse)))
.thenReturn(new io.github.hectorvent.floci.services.lambda.model.InvokeResult(200, null, new byte[0], null, "req"));
.thenReturn(new InvokeResult(200, null, new byte[0], null, "req"));
assertNull(invoker.applyEnrichment(pipe, "[]", region));
}
@@ -408,8 +410,8 @@ class PipesTargetInvokerTest {
Pipe pipe = enrichmentPipe(region, "arn:aws:lambda:" + region + ":000000000000:function:enrich-fn");
for (String body : new String[]{"{}", "[]", " { } ", "[ ]"}) {
when(lambdaService.invoke(eq(region), eq("enrich-fn"), any(byte[].class), eq(InvocationType.RequestResponse)))
.thenReturn(new io.github.hectorvent.floci.services.lambda.model.InvokeResult(
200, null, body.getBytes(java.nio.charset.StandardCharsets.UTF_8), null, "req"));
.thenReturn(new InvokeResult(
200, null, body.getBytes(StandardCharsets.UTF_8), null, "req"));
assertNull(invoker.applyEnrichment(pipe, "[]", region),
"enrichment response " + body + " should skip the target");
}
@@ -421,8 +423,8 @@ class PipesTargetInvokerTest {
String region = "us-east-1";
Pipe pipe = enrichmentPipe(region, "arn:aws:lambda:" + region + ":000000000000:function:enrich-fn");
when(lambdaService.invoke(eq(region), eq("enrich-fn"), any(byte[].class), eq(InvocationType.RequestResponse)))
.thenReturn(new io.github.hectorvent.floci.services.lambda.model.InvokeResult(
200, null, "[{}]".getBytes(java.nio.charset.StandardCharsets.UTF_8), null, "req"));
.thenReturn(new InvokeResult(
200, null, "[{}]".getBytes(StandardCharsets.UTF_8), null, "req"));
assertEquals("[{}]", invoker.applyEnrichment(pipe, "[]", region));
}
@@ -441,7 +443,7 @@ class PipesTargetInvokerTest {
String region = "us-east-1";
Pipe pipe = enrichmentPipe(region, "arn:aws:lambda:" + region + ":000000000000:function:enrich-fn");
when(lambdaService.invoke(eq(region), eq("enrich-fn"), any(byte[].class), eq(InvocationType.RequestResponse)))
.thenReturn(new io.github.hectorvent.floci.services.lambda.model.InvokeResult(200, "Unhandled", "boom".getBytes(), null, "req"));
.thenReturn(new InvokeResult(200, "Unhandled", "boom".getBytes(), null, "req"));
assertThrows(RuntimeException.class, () -> invoker.applyEnrichment(pipe, "[]", region));
}
@@ -452,7 +454,7 @@ class PipesTargetInvokerTest {
String region = "us-east-1";
Pipe pipe = createPipe("arn:aws:lambda:" + region + ":000000000000:function:my-fn", null);
when(lambdaService.invoke(eq(region), eq("my-fn"), any(byte[].class), eq(InvocationType.RequestResponse)))
.thenReturn(new io.github.hectorvent.floci.services.lambda.model.InvokeResult(200, "Unhandled", "boom".getBytes(), null, "req"));
.thenReturn(new InvokeResult(200, "Unhandled", "boom".getBytes(), null, "req"));
assertThrows(RuntimeException.class, () -> invoker.invoke(pipe, "{}", region));
}
@@ -10,6 +10,7 @@ import io.github.hectorvent.floci.services.ecs.model.ContainerOverride;
import io.github.hectorvent.floci.services.ecs.model.LaunchType;
import io.github.hectorvent.floci.services.eventbridge.EventBridgeService;
import io.github.hectorvent.floci.services.lambda.LambdaService;
import io.github.hectorvent.floci.services.lambda.model.InvocationType;
import io.github.hectorvent.floci.services.redshiftdata.RedshiftDataService;
import io.github.hectorvent.floci.services.scheduler.model.AwsVpcConfiguration;
import io.github.hectorvent.floci.services.scheduler.model.EcsParameters;
@@ -31,6 +32,7 @@ import org.mockito.ArgumentCaptor;
import java.nio.charset.StandardCharsets;
import java.time.Instant;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.UUID;
@@ -42,6 +44,7 @@ import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.AdditionalMatchers.aryEq;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.ArgumentMatchers.argThat;
@@ -280,7 +283,7 @@ class ScheduleInvokerTest {
attrs != null
&& attrs.containsKey("BinAttr")
&& "Binary".equals(attrs.get("BinAttr").getDataType())
&& java.util.Arrays.equals("hello".getBytes(), attrs.get("BinAttr").getBinaryValue())),
&& Arrays.equals("hello".getBytes(), attrs.get("BinAttr").getBinaryValue())),
isNull(), isNull(), eq("us-east-1"));
}
@@ -555,9 +558,9 @@ class ScheduleInvokerTest {
verify(lambdaService).invokeArn(
eq(arn),
org.mockito.AdditionalMatchers.aryEq(
aryEq(
"{\"detail\":{\"job\":\"workflow-recovery\"}}".getBytes()),
eq(io.github.hectorvent.floci.services.lambda.model.InvocationType.Event));
eq(InvocationType.Event));
}
@Test
@@ -679,6 +682,7 @@ class ScheduleInvokerTest {
invoke(target, "us-west-2");
// two NetworkConfiguration and AwsVpcConfiguration types: the scheduler model's are imported.
ArgumentCaptor<io.github.hectorvent.floci.services.ecs.model.NetworkConfiguration> networkCaptor =
ArgumentCaptor.forClass(io.github.hectorvent.floci.services.ecs.model.NetworkConfiguration.class);
verify(ecsService).runTask(
@@ -693,9 +697,9 @@ class ScheduleInvokerTest {
eq("us-east-1"));
io.github.hectorvent.floci.services.ecs.model.AwsVpcConfiguration awsvpc =
networkCaptor.getValue().getAwsvpcConfiguration();
org.junit.jupiter.api.Assertions.assertEquals(List.of("subnet-a", "subnet-b"), awsvpc.getSubnets());
org.junit.jupiter.api.Assertions.assertEquals(List.of("sg-a"), awsvpc.getSecurityGroups());
org.junit.jupiter.api.Assertions.assertEquals("DISABLED", awsvpc.getAssignPublicIp());
assertEquals(List.of("subnet-a", "subnet-b"), awsvpc.getSubnets());
assertEquals(List.of("sg-a"), awsvpc.getSecurityGroups());
assertEquals("DISABLED", awsvpc.getAssignPublicIp());
}
@Test