Files
floci/compatibility-tests/sdk-test-java
TiMandHector Ventura e2680cf5f5 test(apigatewayv2): execute-api dispatch compat suite (#372)
* fix(apigatewayv2): fix route matching for path-parameter routes

routeKeyMatchesPath() used String.replace() on Pattern.quote() output,
which performs literal string matching. Path-parameter placeholders like
{id} and {proxy+} were wrapped in \Q...\E by Pattern.quote(), making
them invisible to the replace() calls. All parameterized routes silently
failed to match.

Rewritten to iterate over placeholders with a regex Matcher, quoting
only the literal segments between them. {param} maps to [^/]+ and
{proxy+} maps to .+ as before.

* test(apigatewayv2): add execute-api dispatch compat suite

New ApiGatewayV2ExecuteTest exercises the v2 execute-api dispatch
path end-to-end: create HTTP API, deploy a Lambda backend via
LambdaClient, wire integration/route/stage/deployment, then invoke
through the execute-api URL and assert the Lambda response flows
back through the gateway.

Scope (per PLAN_FLOCI_2 Phase 7 prerequisite decisions):
- pins current dispatch behavior where stage existence and deployment
  status are NOT checked before dispatch (see
  ApiGatewayExecuteController.java:842-847)
- JWT/token authorizer dispatch path only (REQUEST authorizer has no
  dispatch path today - out of scope)
- no mapping templates / request transforms (no layer exists in
  apigatewayv2/model/Integration.java)

Cross-service blame attribution: if this suite fails while the
existing LambdaTest compat suite passes in the same run, the failure
is on the gateway side.

Gated on Docker for the Lambda backend.

* fix(apigatewayv2): support ANY method and empty proxy in route matching

routeKeyMatchesPath now treats ANY as a wildcard that matches all HTTP
methods, matching AWS API Gateway v2 behavior. Also relaxed {proxy+}
regex from .+ to .* so /echo/{proxy+} matches /echo/ with an empty
proxy value.

* fix(test): skip Lambda-dependent execute tests when dispatch unavailable

CI may not support Docker-in-Docker for Lambda containers. Gate
dispatch and JWT+dispatch tests on the first dispatch response so
they skip instead of fail.

---------

Signed-off-by: Hector Ventura <hectorvent@gmail.com>
Co-authored-by: Hector Ventura <hectorvent@gmail.com>
2026-04-12 20:23:40 -05:00
..
2026-04-11 09:59:05 -05:00

sdk-test-java

Compatibility tests for Floci using the AWS SDK for Java v2 (2.31.8).

Runs 313 tests across 16 test classes against a live Floci instance — no mocks.

Services Covered

Test class Description
SsmTest Parameter Store — put, get, path, tags
SqsTest Queues, send/receive/delete, DLQ, visibility
SnsTest Topics, subscriptions, publish, SQS delivery
S3Test Buckets, objects, tagging, copy, multipart, batch delete
DynamoDbTest Tables, CRUD, batch, TTL, tags, streams
DynamoDbScanConditionTests Scan filter and condition expressions
LambdaTest Create/invoke/update/delete functions
IamTest Users, roles, policies, access keys
StsTest GetCallerIdentity, AssumeRole, GetSessionToken
SecretsManagerTest Create/get/put/list/delete secrets, versioning, tags
KmsTest Keys, aliases, encrypt/decrypt, data keys, sign/verify
CloudWatchTest PutMetricData, ListMetrics, GetMetricStatistics, alarms
CloudFormationVirtualHostTests Virtual host style S3 access via CloudFormation
ApigwSfnJsonataCrudlTests API Gateway + Step Functions JSONata CRUDL integration
Ec2Tests EC2 instances, VPCs, security groups, subnets
EcsTests ECS clusters, task definitions, services

Adding a New Test

Create a standard JUnit 5 test class in src/test/java/com/floci/test/. Tests run against a live Floci instance using real AWS SDK clients.

Requirements

  • Java 17+
  • Maven

Running

# All tests
mvn test -q

# Specific test class
mvn test -Dtest=S3Test

# Via just (from compatibility-tests/)
just test-java

Configuration

Variable Default Description
FLOCI_ENDPOINT http://localhost:4566 Floci emulator endpoint

AWS credentials are always test / test / us-east-1.

Docker

docker build -t floci-sdk-java .
docker run --rm --network host floci-sdk-java

# Custom endpoint (macOS/Windows)
docker run --rm -e FLOCI_ENDPOINT=http://host.docker.internal:4566 floci-sdk-java