diff --git a/test-server/Makefile b/test-server/Makefile index 9dd96478..5f344f5b 100644 --- a/test-server/Makefile +++ b/test-server/Makefile @@ -100,7 +100,10 @@ COMMONS_REPO ?= CLONE_DIR ?= $(MAKEFILE_DIR)/.commons-clone # Path to the orchestrator core inside the clone. -CLONE_ORCH_DIR := $(CLONE_DIR)/esdk/test-server/orchestrator +CLONE_ORCH_DIR := $(CLONE_DIR)/test-server-common/orchestrator + +# The ESDK TestServer tree inside the clone, passed to the orchestrator as testserver.root. +CLONE_ROOT_DIR := $(CLONE_DIR)/esdk/test-server # The relocated Java Language_Server module (task 12.1): handlers, registry, # config marshalling, protocol, ServerBootstrap, and its jqwik/unit tests. @@ -217,7 +220,7 @@ test-server: check-harness-java ## Bootstrap + delegate the complete Language_Re exit 1; \ fi; \ if [ ! -d "$(CLONE_ORCH_DIR)" ]; then \ - echo "ERROR: the cloned Commons_Repository has no orchestrator core at esdk/test-server/orchestrator." >&2; \ + echo "ERROR: the cloned Commons_Repository has no orchestrator core at test-server-common/orchestrator." >&2; \ echo " url: $$url" >&2; \ echo " branch: $$branch" >&2; \ echo " The branch may not contain the ESDK TestServer." >&2; \ @@ -231,7 +234,7 @@ test-server: check-harness-java ## Bootstrap + delegate the complete Language_Re echo " commonsOrigin.url=$$url commonsOrigin.branch=$$branch commonsOrigin.reason=$$reason"; \ export JAVA_HOME="$(HARNESS_JAVA_HOME)"; \ cd "$(CLONE_ORCH_DIR)"; \ - ./gradlew --console=plain run \ + ./gradlew --console=plain run -Dtestserver.root="$(CLONE_ROOT_DIR)" \ --args="context=language:java languageRepoRoot=$(REPO_ROOT) commonsOrigin.url=$$url commonsOrigin.branch=$$branch commonsOrigin.reason=$$reason" # ---------------------------------------------------------------------------- diff --git a/test-server/server-config.json b/test-server/server-config.json index 18012872..c7c89c20 100644 --- a/test-server/server-config.json +++ b/test-server/server-config.json @@ -2,7 +2,7 @@ "commonsRepository": { "name": "aws-crypto-tools-commons", "url": "git@github.com:aws/aws-crypto-tools-commons.git", - "branch": "lucmcdon/esdk-test-server-all-languages" + "branch": "lucmcdon/caching-cmm-tests" }, "product": "esdk" } diff --git a/test-server/server/src/main/java/aws/cryptography/esdk/testserver/server/handler/EsdkTestServerHandlers.java b/test-server/server/src/main/java/aws/cryptography/esdk/testserver/server/handler/EsdkTestServerHandlers.java index 33a98257..cb535548 100644 --- a/test-server/server/src/main/java/aws/cryptography/esdk/testserver/server/handler/EsdkTestServerHandlers.java +++ b/test-server/server/src/main/java/aws/cryptography/esdk/testserver/server/handler/EsdkTestServerHandlers.java @@ -25,6 +25,7 @@ public final class EsdkTestServerHandlers { private final DecryptHandler decrypt; private final EncryptStreamHandler encryptStream; private final DecryptStreamHandler decryptStream; + private final TestOnlyOperationsHandler testOnly = new TestOnlyOperationsHandler(); public EsdkTestServerHandlers() { this(new ClientRegistry()); @@ -72,11 +73,15 @@ public DecryptStreamHandler decryptStreamHandler() { /** Build the generated service wired to these handlers. */ public ESDKTestServer service() { return ESDKTestServer.builder() + .addAdvanceClockOperation(testOnly) .addCreateClientOperation(createClient) .addDecryptOperation(decrypt) + .addDecryptConcurrentlyOperation(testOnly) .addDecryptStreamOperation(decryptStream) .addEncryptOperation(encrypt) + .addEncryptConcurrentlyOperation(testOnly) .addEncryptStreamOperation(encryptStream) + .addGetCallCountsOperation(testOnly) .build(); } } diff --git a/test-server/server/src/main/java/aws/cryptography/esdk/testserver/server/handler/TestOnlyOperationsHandler.java b/test-server/server/src/main/java/aws/cryptography/esdk/testserver/server/handler/TestOnlyOperationsHandler.java new file mode 100644 index 00000000..f9c1eaba --- /dev/null +++ b/test-server/server/src/main/java/aws/cryptography/esdk/testserver/server/handler/TestOnlyOperationsHandler.java @@ -0,0 +1,52 @@ +package aws.cryptography.esdk.testserver.server.handler; + +import aws.cryptography.esdk.testserver.server.model.AdvanceClockInput; +import aws.cryptography.esdk.testserver.server.model.AdvanceClockOutput; +import aws.cryptography.esdk.testserver.server.model.DecryptConcurrentlyInput; +import aws.cryptography.esdk.testserver.server.model.DecryptConcurrentlyOutput; +import aws.cryptography.esdk.testserver.server.model.EncryptConcurrentlyInput; +import aws.cryptography.esdk.testserver.server.model.EncryptConcurrentlyOutput; +import aws.cryptography.esdk.testserver.server.model.GenericServerError; +import aws.cryptography.esdk.testserver.server.model.GetCallCountsInput; +import aws.cryptography.esdk.testserver.server.model.GetCallCountsOutput; +import aws.cryptography.esdk.testserver.server.service.AdvanceClockOperation; +import aws.cryptography.esdk.testserver.server.service.DecryptConcurrentlyOperation; +import aws.cryptography.esdk.testserver.server.service.EncryptConcurrentlyOperation; +import aws.cryptography.esdk.testserver.server.service.GetCallCountsOperation; +import software.amazon.smithy.java.server.RequestContext; + +/** + * The test-only operations the caching CMM tests use. This server declares the caching feature + * unsupported, so the tests never call them; each one rejects the call. + */ +public final class TestOnlyOperationsHandler implements GetCallCountsOperation, + EncryptConcurrentlyOperation, DecryptConcurrentlyOperation, AdvanceClockOperation { + + @Override + public GetCallCountsOutput getCallCounts(GetCallCountsInput input, RequestContext context) { + throw unsupported("GetCallCounts"); + } + + @Override + public EncryptConcurrentlyOutput encryptConcurrently( + EncryptConcurrentlyInput input, RequestContext context) { + throw unsupported("EncryptConcurrently"); + } + + @Override + public DecryptConcurrentlyOutput decryptConcurrently( + DecryptConcurrentlyInput input, RequestContext context) { + throw unsupported("DecryptConcurrently"); + } + + @Override + public AdvanceClockOutput advanceClock(AdvanceClockInput input, RequestContext context) { + throw unsupported("AdvanceClock"); + } + + private static GenericServerError unsupported(String operation) { + return GenericServerError.builder() + .message(operation + " is not supported by the Java test server") + .build(); + } +}