chore: adopt shared ARN and XML utilities across services (#1780)

Replace hand-built "arn:aws:..." string concatenation with
AwsArnUtils.Arn.of/RegionResolver.buildArn (13 files) and migrate 16
manual ARN-parsing sites (split/substring/regex helpers) to
AwsArnUtils regionOrDefault/accountOrDefault/parse. Adds
XmlParser.childElementNames and moves S3SelectService off
indexOf/substring parsing and string-concat XML onto
XmlParser/XmlBuilder.

Also fixes the websocket $connect methodArn hardcoding account
000000000000 instead of resolving the caller account. Resource-tail
slicers (:stream/, :repository/, ...) are intentionally kept: parse()
would not remove the suffix logic.
This commit is contained in:
Hector Ventura authored and GitHub committed 2026-07-08 22:18:38 -05:00
1 parent 07476f09fe
commit 959eb16700
30 files changed
+189 -117

No files matched your search

@@ -1,6 +1,7 @@
package io.github.hectorvent.floci.services.memorydb;
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.core.storage.InMemoryStorage;
@@ -59,6 +60,9 @@ class MemoryDbServiceTest {
when(mdbConfig.defaultImage()).thenReturn("valkey/valkey:8");
when(config.hostname()).thenReturn(Optional.of("localhost"));
when(regionResolver.getAccountId()).thenReturn("000000000000");
when(regionResolver.buildArn(anyString(), anyString(), anyString())).thenAnswer(inv ->
AwsArnUtils.Arn.of(inv.getArgument(0), inv.getArgument(1),
"000000000000", inv.getArgument(2)).toString());
when(storageFactory.create(anyString(), anyString(), any())).thenAnswer(inv -> new InMemoryStorage<>());
when(containerManager.start(anyString(), anyString()))