Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions test-server/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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; \
Expand All @@ -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"

# ----------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion test-server/server-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down Expand Up @@ -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();
}
}
Original file line number Diff line number Diff line change
@@ -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();
}
}
Loading