refactor(ses): clean up what the controller split left behind (#3841)

Four leftovers from splitting SesController by domain, none of them changing
behavior.

SesInspectionController now injects SesSentEmailService and calls listAll and
clear on it. SesService.getEmails and clearEmails were one-line forwards to
that service, the last pure delegations the split missed, so they go; the
field comment and the class Javadoc that still claimed inspection read through
the facade are corrected. SesServiceTestBuilder gains a sentEmailService
accessor and SesServiceSmtpTest reads through it, matching how the other
domain services are reached from tests.

Three test classes are renamed to the service they actually drive:
SesServiceDkimLookupCacheTest and SesServiceLegacyDkimTokensTest become
SesIdentityDkimLookupCacheTest and SesIdentityLegacyDkimTokensTest, and
SesServiceSuppressionLegacyKeyTest becomes SesSuppressionLegacyKeyTest. None
of them was referenced from anywhere else.

SesSendController imports JsonProcessingException instead of writing it out
inline, and SesService drops six imports left unused by earlier steps.
This commit is contained in:
Kenshin Okinaka authored and GitHub committed 2026-09-18 06:59:25 -04:00
1 parent 18a2f36eda
commit 6e53c5275a
8 files changed
+32 -33

No files matched your search

@@ -1,9 +1,9 @@
package io.github.hectorvent.floci.services.ses;
import io.github.hectorvent.floci.services.ses.model.SentEmail;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ArrayNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
import io.github.hectorvent.floci.services.ses.model.SentEmail;
import jakarta.inject.Inject;
import jakarta.ws.rs.DELETE;
import jakarta.ws.rs.GET;
@@ -23,19 +23,20 @@ import java.util.List;
@Produces(MediaType.APPLICATION_JSON)
public class SesInspectionController {
private final SesService sesService;
private final SesSentEmailService sentEmailService;
private final ObjectMapper objectMapper;
@Inject
public SesInspectionController(SesService sesService, ObjectMapper objectMapper) {
this.sesService = sesService;
public SesInspectionController(SesSentEmailService sentEmailService,
ObjectMapper objectMapper) {
this.sentEmailService = sentEmailService;
this.objectMapper = objectMapper;
}
@GET
public Response getEmails(@QueryParam("id") String messageId,
@QueryParam("email") String recipient) {
List<SentEmail> emails = sesService.getEmails();
List<SentEmail> emails = sentEmailService.listAll();
ArrayNode messages = objectMapper.createArrayNode();
for (SentEmail email : emails) {
@@ -120,7 +121,7 @@ public class SesInspectionController {
@DELETE
public Response clearEmails() {
sesService.clearEmails();
sentEmailService.clear();
return Response.ok().build();
}
}
@@ -1,5 +1,10 @@
package io.github.hectorvent.floci.services.ses;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ArrayNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
import io.github.hectorvent.floci.core.common.AwsException;
import io.github.hectorvent.floci.core.common.RegionResolver;
import io.github.hectorvent.floci.services.ses.model.BulkEmailEntry;
@@ -9,10 +14,6 @@ import io.github.hectorvent.floci.services.ses.model.ListManagementOptions;
import io.github.hectorvent.floci.services.ses.model.MessageHeader;
import io.github.hectorvent.floci.services.ses.model.MessageTag;
import io.github.hectorvent.floci.services.ses.model.Tag;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ArrayNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
import jakarta.inject.Inject;
import jakarta.ws.rs.Consumes;
import jakarta.ws.rs.DELETE;
@@ -372,7 +373,7 @@ public class SesSendController {
"Custom verification email template <" + templateName + "> does not exist", 404);
}
throw remapV1Exception(e);
} catch (com.fasterxml.jackson.core.JsonProcessingException e) {
} catch (JsonProcessingException e) {
throw new AwsException("BadRequestException", e.getMessage(), 400);
}
}
@@ -4,23 +4,19 @@ import io.github.hectorvent.floci.config.EmulatorConfig;
import io.github.hectorvent.floci.core.common.AwsArnUtils;
import io.github.hectorvent.floci.core.common.AwsException;
import io.github.hectorvent.floci.core.common.RegionResolver;
import io.github.hectorvent.floci.services.ses.model.ArchivingOptions;
import io.github.hectorvent.floci.services.ses.model.BulkEmailEntry;
import io.github.hectorvent.floci.services.ses.model.BulkEmailEntryResult;
import io.github.hectorvent.floci.services.ses.model.CloudWatchDimensionConfiguration;
import io.github.hectorvent.floci.services.ses.model.ConfigurationSet;
import io.github.hectorvent.floci.services.ses.model.Contact;
import io.github.hectorvent.floci.services.ses.model.CustomVerificationEmailTemplate;
import io.github.hectorvent.floci.services.ses.model.DeliveryOptions;
import io.github.hectorvent.floci.services.ses.model.EmailTemplate;
import io.github.hectorvent.floci.services.ses.model.EventDestination;
import io.github.hectorvent.floci.services.ses.model.Identity;
import io.github.hectorvent.floci.services.ses.model.ListManagementOptions;
import io.github.hectorvent.floci.services.ses.model.MessageHeader;
import io.github.hectorvent.floci.services.ses.model.MessageTag;
import io.github.hectorvent.floci.services.ses.model.Topic;
import io.github.hectorvent.floci.services.ses.model.TrackingOptions;
import io.github.hectorvent.floci.services.ses.model.VdmOptions;
import io.github.hectorvent.floci.services.ses.model.SentEmail;
import io.github.hectorvent.floci.services.ses.model.Tenant;
import io.github.hectorvent.floci.services.ses.model.TenantResourceAssociation;
@@ -39,8 +35,6 @@ import java.time.Instant;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Locale;
@@ -68,8 +62,7 @@ import java.util.UUID;
* <li>the ARN dispatch behind the tag operations, which routes one ARN to one of seven
* domains;</li>
* <li>the tenant-scoped suppression routing, which picks the tenant store or the account-wide
* one from a {@code TenantName};</li>
* <li>the inspection reads over recorded mail.</li>
* one from a {@code TenantName}.</li>
* </ul>
*
* <p>The name is historical. This is not the service for SES as a whole: SES is served by the
@@ -89,9 +82,8 @@ public class SesService {
// check, the tenant-guarded delete with its policy cascade, the default configuration set) and
// the send-path reads, reaching the store through its find/save.
private final SesIdentityService identityService;
// Sent-email records extracted to SesSentEmailService. The send path records finished emails via
// it; the account and v1 statistics reads go to the service directly, inspection still reads
// back through the facade.
// Sent-email records extracted to SesSentEmailService. The send path records finished emails
// via it; every read goes to the service directly.
private final SesSentEmailService sentEmailService;
// Email templates extracted to SesTemplateService. The facade delegates; the templated-send path
// reads via it, and ARN-dispatched tagging reads/writes via its find/save.
@@ -621,13 +613,7 @@ public class SesService {
return cs;
}
public List<SentEmail> getEmails() {
return sentEmailService.listAll();
}
public void clearEmails() {
sentEmailService.clear();
}
// ──────────────────────────── Templates ────────────────────────────