mirror of
https://github.com/floci-io/floci.git
synced 2026-11-22 21:50:46 -05:00
* test(appsync): add remaining SDK tests and fix listDomainNames field name
- Add 4 SDK tests: getIntrospectionSchema, listDomainNames, getFunction, listResolversByFunction
- Fix listDomainNames response field from 'domainNames' to 'domainNameConfigs' (AWS SDK v2 expects domainNameConfigs)
- Update integration test assertion to match corrected field name
* feat(appsync): add $util runtime library for VTL resolvers
Standalone utility library matching AWS AppSync $util namespace.
Validated against official AWS AppSync documentation.
Classes:
- VtlErrorSignal: exception for $util.error() and $util.unauthorized()
- AppSyncUtil: top-level $util with error/validate/type-check methods
- StrUtil: $util.str (toUpper, toLower, toReplace, normalize)
- TimeUtil: $util.time (12 methods, epochMilliSeconds-based per AWS)
- MathUtil: $util.math (roundNum, minVal, maxVal, randomDouble, randomWithinRange)
- DynamoDbUtil: $util.dynamodb (24 methods: value + JSON variants)
- TransformUtil: $util.transform (DynamoDB filter, Elasticsearch DSL, subscription filter)
- ListUtil: $util.list (copyAndRetainAll, copyAndRemoveAll, sortList)
- MapUtil: $util.map (copyAndRetainAllKeys, copyAndRemoveAllKeys)
* test(appsync): add unit tests for $util runtime library
234 test cases covering all $util methods with edge cases:
- AppSyncUtilTest: root methods, error, validate, type checks (85 tests)
- DynamoDbUtilTest: DynamoDB attribute value conversion (47 tests)
- StrUtilTest: string operations (21 tests)
- TimeUtilTest: time operations (21 tests)
- MathUtilTest: math operations (19 tests)
- ListUtilTest: list operations (17 tests)
- TransformUtilTest: filter/DSL conversion (12 tests)
- MapUtilTest: map operations (12 tests)
* fix(appsync): fix DynamoDbUtil *Json methods and refactor utils
- Fix 10 *Json methods to return JSON String instead of Map
- Add private helpers: toJson(Map), base64Encode(String) to DynamoDbUtil
- Extract parseInput(Object) helper in TransformUtil to remove duplication
- Chain qr() to quiet() in AppSyncUtil
- Chain validate() overloads in AppSyncUtil
- Update tests to verify *Json methods return correct JSON strings
* fix(appsync): address review feedback on $util methods
- toMapValues: return inner map without M wrapper (matches AWS: toMapValues = toMap.get("M"))
- toBinary/toBinarySet: wrap input as-is, don't re-encode base64
- str.normalize: use Unicode normalization (NFC/NFD/NFKC/NFKD) instead of whitespace collapse
- typeOf: return exact AWS values (Null/Number/String/Map/List/Boolean/Object)
- unauthorized: errorType 'Unauthorized' not 'UnauthorizedException'
- nowISO8601: always include 3 fractional digits per AWS format
- Mark transform.* methods as not-yet-implemented (complex expression building)
- Update all affected tests
* fix(appsync): change default errorType from UnknownError to Unknown
Research confirms AWS AppSync uses 'Unknown' as default errorType when
$util.error(message) is called without errorType argument.
* chore(appsync): remove dead base64Encode helper from DynamoDbUtil
sdk-test-java
Compatibility tests for Floci using the AWS SDK for Java v2 (2.31.8).
Runs 352 tests across 17 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 |
ApiGatewayV2WebSocketAndExtendedOpsTest |
API GW v2 WebSocket APIs, Update ops, Route/Integration Responses, Models, Tagging |
Ec2Tests |
EC2 instances, VPCs, security groups, subnets |
AppSyncTest |
GraphQL API CRUDL, data sources, resolvers, functions, types, API keys, tags, schema validation |
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