From e642af5d47b6d45ae21fa72534c269973375647d Mon Sep 17 00:00:00 2001 From: James Rosewell Date: Mon, 23 Nov 2026 09:11:51 +0000 Subject: [PATCH 1/2] TEST: Set the variable in the configuration order test CloudEndPoint_Configuration_Setting now gives the pipeline a builder whose variable is set through the getEnvVar hook, so the test proves configuration over the variable wherever it runs, not only where the outer environment sets the variable. Add a test that the engine and ExpectedEndpoint agree for a missing, empty, unslashed and slashed variable. --- .../CloudRequestEngineBuilderTests.java | 39 +++++++++++++++++-- 1 file changed, 36 insertions(+), 3 deletions(-) diff --git a/pipeline/pipeline.cloudrequestengine/src/test/java/fiftyone/pipeline/cloudrequestengine/flowelements/CloudRequestEngineBuilderTests.java b/pipeline/pipeline.cloudrequestengine/src/test/java/fiftyone/pipeline/cloudrequestengine/flowelements/CloudRequestEngineBuilderTests.java index e35b77bfe..d835b2c5b 100644 --- a/pipeline/pipeline.cloudrequestengine/src/test/java/fiftyone/pipeline/cloudrequestengine/flowelements/CloudRequestEngineBuilderTests.java +++ b/pipeline/pipeline.cloudrequestengine/src/test/java/fiftyone/pipeline/cloudrequestengine/flowelements/CloudRequestEngineBuilderTests.java @@ -165,11 +165,43 @@ public void CloudEndPoint_Matches_Expected() throws Exception { } /** - * An address given in configuration is used whatever the environment - * variable holds, so every request goes to that address. + * With no address given, the engine uses the address + * {@link ExpectedEndpoint} works out from the variable, for a missing, + * empty, unslashed and slashed value. + */ + @Test + public void CloudEndPoint_Matches_Expected_For_Each_Variable() + throws Exception { + String[] values = { + null, + "", + "https://a.example/api/v4", + "https://a.example/api/v4/" + }; + for (String value : values) { + CloudRequestEngineBuilder builder = + new CloudRequestEngineBuilder(loggerFactory, httpClient); + setExpectedEnvVarValue(builder, value); + + builder.setResourceKey(testResourceKey) + .build(); + assertEquals( + ExpectedEndpoint.root(value), + getEndpointValue(builder), + String.valueOf(value)); + } + } + + /** + * An address given in configuration is used over the environment + * variable, so every request goes to that address. */ @Test public void CloudEndPoint_Configuration_Setting() throws Exception { + CloudRequestEngineBuilder builder = + new CloudRequestEngineBuilder(loggerFactory, httpClient); + setExpectedEnvVarValue(builder, testEnvVarEndpoint); + ElementOptions element = new ElementOptions(); element.builderName = "CloudRequestEngineBuilder"; element.buildParameters.put("ResourceKey", testResourceKey); @@ -178,10 +210,11 @@ public void CloudEndPoint_Configuration_Setting() throws Exception { options.elements.add(element); try (Pipeline pipeline = new PipelineBuilder(loggerFactory) - .addService(httpClient) + .addElementBuilder(builder) .buildFromConfiguration(options)) { assertNotNull(pipeline.getElement(CloudRequestEngine.class)); } + assertEquals(testEndpoint, getEndpointValue(builder)); ArgumentCaptor urls = ArgumentCaptor.forClass(URL.class); verify(httpClient, atLeastOnce()).connect(urls.capture()); From b8c1ce810617ebea074a5ddc837a00c07bb508f4 Mon Sep 17 00:00:00 2001 From: James Rosewell Date: Mon, 23 Nov 2026 09:18:15 +0000 Subject: [PATCH 2/2] TEST: Describe the variable values in plain words --- .../flowelements/CloudRequestEngineBuilderTests.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pipeline/pipeline.cloudrequestengine/src/test/java/fiftyone/pipeline/cloudrequestengine/flowelements/CloudRequestEngineBuilderTests.java b/pipeline/pipeline.cloudrequestengine/src/test/java/fiftyone/pipeline/cloudrequestengine/flowelements/CloudRequestEngineBuilderTests.java index d835b2c5b..5346d943b 100644 --- a/pipeline/pipeline.cloudrequestengine/src/test/java/fiftyone/pipeline/cloudrequestengine/flowelements/CloudRequestEngineBuilderTests.java +++ b/pipeline/pipeline.cloudrequestengine/src/test/java/fiftyone/pipeline/cloudrequestengine/flowelements/CloudRequestEngineBuilderTests.java @@ -166,8 +166,9 @@ public void CloudEndPoint_Matches_Expected() throws Exception { /** * With no address given, the engine uses the address - * {@link ExpectedEndpoint} works out from the variable, for a missing, - * empty, unslashed and slashed value. + * {@link ExpectedEndpoint} works out from the variable, when the + * variable is missing, empty, an address without a trailing slash or + * an address with one. */ @Test public void CloudEndPoint_Matches_Expected_For_Each_Variable()