Skip to content

armgit / floci

Public Imported from GitHub
0

Light, fluffy, and always free - The AWS Local Emulator alternative

refactor(redshift): align Redshift code with AGENTS.md style rules (#3992)

Vũ Thế Huy5f1f80b4964c
diff --git a/src/main/java/io/github/hectorvent/floci/services/redshift/RedshiftQueryHandler.java b/src/main/java/io/github/hectorvent/floci/services/redshift/RedshiftQueryHandler.java
index 3194f2e80e..bddc944830 100644
--- a/src/main/java/io/github/hectorvent/floci/services/redshift/RedshiftQueryHandler.java
+++ b/src/main/java/io/github/hectorvent/floci/services/redshift/RedshiftQueryHandler.java
@@ -26,6 +26,7 @@ import java.util.Comparator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
+import java.util.regex.Matcher;
import java.util.regex.Pattern;
@ApplicationScoped
@@ -1090,7 +1091,7 @@ public class RedshiftQueryHandler {
private static List<RedshiftService.IntegrationFilter> integrationFilters(MultivaluedMap<String, String> params) {
Map<String, RedshiftService.IntegrationFilter> byIndex = new LinkedHashMap<>();
for (String key : params.keySet()) {
- java.util.regex.Matcher matcher = FILTER_NAME.matcher(key);
+ Matcher matcher = FILTER_NAME.matcher(key);
if (!matcher.matches()) {
continue;
}
diff --git a/src/main/java/io/github/hectorvent/floci/services/redshift/RedshiftService.java b/src/main/java/io/github/hectorvent/floci/services/redshift/RedshiftService.java
index 6457ee1a9b..5bfb744af4 100644
--- a/src/main/java/io/github/hectorvent/floci/services/redshift/RedshiftService.java
+++ b/src/main/java/io/github/hectorvent/floci/services/redshift/RedshiftService.java
@@ -1,5 +1,6 @@
package io.github.hectorvent.floci.services.redshift;
+import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import io.github.hectorvent.floci.config.EmulatorConfig;
import io.github.hectorvent.floci.core.common.AwsArnUtils;
@@ -14,15 +15,11 @@ import io.github.hectorvent.floci.services.dynamodb.DynamoDbStreamService;
import io.github.hectorvent.floci.services.rds.proxy.PasswordValidator;
import io.github.hectorvent.floci.services.redshift.container.RedshiftContainerHandle;
import io.github.hectorvent.floci.services.redshift.container.RedshiftContainerManager;
-import io.github.hectorvent.floci.services.redshift.model.Integration;
-import java.time.Instant;
-import java.time.format.DateTimeFormatter;
-import java.util.UUID;
-import java.util.regex.Pattern;
import io.github.hectorvent.floci.services.redshift.model.Cluster;
import io.github.hectorvent.floci.services.redshift.model.ClusterParameterGroup;
import io.github.hectorvent.floci.services.redshift.model.ClusterSubnetGroup;
import io.github.hectorvent.floci.services.redshift.model.Endpoint;
+import io.github.hectorvent.floci.services.redshift.model.Integration;
import io.github.hectorvent.floci.services.redshift.model.Parameter;
import io.github.hectorvent.floci.services.redshift.model.Snapshot;
import io.github.hectorvent.floci.services.redshift.model.SnapshotCopyGrant;
@@ -30,28 +27,31 @@ import io.github.hectorvent.floci.services.redshift.proxy.RedshiftProxyManager;
import io.github.hectorvent.floci.services.secretsmanager.RandomPasswordGenerator;
import io.github.hectorvent.floci.services.secretsmanager.SecretsManagerService;
import io.github.hectorvent.floci.services.secretsmanager.model.Secret;
+import io.quarkus.runtime.StartupEvent;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.enterprise.event.Observes;
import jakarta.inject.Inject;
-import com.fasterxml.jackson.core.type.TypeReference;
-import io.quarkus.runtime.StartupEvent;
import org.jboss.logging.Logger;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
+import java.time.Instant;
+import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
-import java.util.Comparator;
import java.util.Collection;
+import java.util.Comparator;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
+import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
import java.util.function.Consumer;
+import java.util.regex.Pattern;
@ApplicationScoped
public class RedshiftService {
@@ -637,7 +637,7 @@ public class RedshiftService {
.orElseThrow(() -> new AwsException("ClusterNotFound", "Cluster " + clusterIdentifier + " not found", 404));
// alterUserPassword runs before any mutation of the cluster object (a live reference
- // from HybridStorage, not a copy) — if it throws, no metadata has been changed yet.
+ // from HybridStorage, not a copy); if it throws, no metadata has been changed yet.
if (masterUserPassword != null && !masterUserPassword.isBlank()) {
containerManager.alterUserPassword(clusters.accountId(), clusterIdentifier,
cluster.getMasterUsername(), masterUserPassword);
@@ -648,9 +648,9 @@ public class RedshiftService {
updateManagedMasterSecret(cluster, masterUserPassword);
}
- // NodeType only updates metadata — it does not resize the underlying Postgres container
+ // NodeType only updates metadata: it does not resize the underlying Postgres container
// (Redshift node-count has no equivalent here). NumberOfNodes is accepted for API-shape
- // compatibility but is not modelled or stored anywhere — known gap, see plan Task 9.
+ // compatibility but is not modelled or stored anywhere: known gap, see plan Task 9.
if (nodeType != null && !nodeType.isBlank()) {
cluster.setNodeType(nodeType);
}
@@ -767,7 +767,7 @@ public class RedshiftService {
// The container backing a cluster has no persistent volume (see RedshiftContainerManager),
// so a plain stop+recreate would silently drop the cluster's data. Dump before stopping and
- // restore immediately after starting, using a throwaway temp file — no Snapshot resource is
+ // restore immediately after starting, using a throwaway temp file, so no Snapshot resource is
// created or exposed to the caller.
Path tempDump;
try {
@@ -835,13 +835,14 @@ public class RedshiftService {
} else {
if (originalTornDown) {
// Once the original container is torn down it holds no volume, so this dump can
- // be the only surviving copy of the cluster's data — keep it for manual recovery.
+ // be the only surviving copy of the cluster's data, so keep it for manual recovery.
LOG.warnv("Reboot of cluster {0} did not complete; retained pre-reboot data dump at {1}",
clusterIdentifier, tempDump);
} else {
try {
Files.deleteIfExists(tempDump);
- } catch (IOException ignored) {
+ } catch (IOException ex) {
+ LOG.warnv(ex, "Failed to clean up temporary dump file {0} after aborted reboot of cluster {1}", tempDump, clusterIdentifier);
}
}
}
@@ -972,7 +973,7 @@ public class RedshiftService {
try {
Files.deleteIfExists(Paths.get(snapshot.getSqlDump()));
} catch (IOException e) {
- // ignore
+ LOG.warnv(e, "Could not delete the dump file of snapshot {0}", snapshotIdentifier);
}
}
snapshot.setStatus("deleted");
@@ -1411,7 +1412,7 @@ public class RedshiftService {
* where {@code <type>} is one of {@code cluster}, {@code snapshot} (id shape
* {@code <clusterId>/<snapshotId>}), {@code parametergroup}, {@code subnetgroup} or
* {@code snapshotcopygrant}. Unlike RDS's tag
- * resolution, there is no bare-name fallback — Redshift tagging is new, so there is no
+ * resolution, there is no bare-name fallback: Redshift tagging is new, so there is no
* existing caller to stay backward compatible with.
*/
private TagHandle resolveTagHandle(String resourceName) {
@@ -1533,7 +1534,7 @@ public class RedshiftService {
* the original proxy + container were stopped, so the original data-bearing container
* is still running and nothing must be touched. Once it is true the original is gone:
* tear down the (replacement's) proxy and return its port, and remove any container
- * running under the cluster's name — {@code containerManager.stop} works by name, so
+ * running under the cluster's name: {@code containerManager.stop} works by name, so
* this also cleans a replacement that {@code containerManager.start} created before
* throwing (e.g. its readiness check timed out). The pre-reboot data dump is kept by
* the caller.
diff --git a/src/main/java/io/github/hectorvent/floci/services/redshift/container/RedshiftContainerManager.java b/src/main/java/io/github/hectorvent/floci/services/redshift/container/RedshiftContainerManager.java
index 08012a458c..8e67a8b4b7 100644
--- a/src/main/java/io/github/hectorvent/floci/services/redshift/container/RedshiftContainerManager.java
+++ b/src/main/java/io/github/hectorvent/floci/services/redshift/container/RedshiftContainerManager.java
@@ -1,6 +1,7 @@
package io.github.hectorvent.floci.services.redshift.container;
import com.github.dockerjava.api.async.ResultCallback;
+import com.github.dockerjava.api.model.Container;
import com.github.dockerjava.api.model.Frame;
import com.github.dockerjava.api.model.StreamType;
import io.github.hectorvent.floci.config.EmulatorConfig;
@@ -98,14 +99,14 @@ public class RedshiftContainerManager {
* persistent volume, so a blind recreate would silently discard the cluster's data;
* adopting preserves it whenever the physical container survived. If no such container
* exists (first start, or the container itself was removed), this falls back to
- * {@link #start} — in that case the previous data is unrecoverable, matching this
+ * {@link #start}, and in that case the previous data is unrecoverable, matching this
* project's decision not to back Redshift containers with a Docker volume.
*/
public RedshiftContainerHandle adoptOrStart(String accountId, String clusterIdentifier, String masterUsername, String masterPassword) {
String containerName = containerName(accountId, clusterIdentifier);
- var existing = lifecycleManager.findByName(containerName);
+ Optional<Container> existing = lifecycleManager.findByName(containerName);
if (existing.isEmpty()) {
- LOG.warnv("No surviving container for cluster {0}; starting a fresh empty one — the previous"
+ LOG.warnv("No surviving container for cluster {0}; starting a fresh empty one: the previous"
+ " contents are not recoverable (no Docker volume backs Redshift containers)", clusterIdentifier);
return start(accountId, clusterIdentifier, masterUsername, masterPassword);
}
@@ -212,10 +213,10 @@ public class RedshiftContainerManager {
throw new AwsException("InvalidParameterValue", "Username must be a valid SQL identifier", 400);
}
// AWS ModifyCluster rejects ', ", \, / and @ in MasterUserPassword and enforces an
- // 8-64 length plus at least one uppercase, one lowercase and one digit — we enforce
+ // 8-64 length plus at least one uppercase, one lowercase and one digit, and we enforce
// the same set for parity. The single-quote rejection is doubly load-bearing: the
// password is spliced into a psql -c SQL literal here, so ' would also break that
- // literal — but it is AWS-correct regardless, so do not "fix" it away by escaping.
+ // literal, but it is AWS-correct regardless, so do not "fix" it away by escaping.
if (newPassword != null) {
for (char forbidden : new char[]{'\'', '"', '\\', '/', '@'}) {
if (newPassword.indexOf(forbidden) >= 0) {
@@ -334,7 +335,8 @@ public class RedshiftContainerManager {
} else {
out.write(payload);
}
- } catch (IOException ignored) {
+ } catch (IOException e) {
+ LOG.warnv(e, "Failed to capture output of container exec {0}", execId);
}
}
@@ -364,6 +366,7 @@ public class RedshiftContainerManager {
try {
callback.close();
} catch (IOException ignored) {
+ // The exec result is already collected, so a failure to release the callback stream cannot change it.
}
}
}
diff --git a/src/test/java/io/github/hectorvent/floci/services/redshift/RedshiftCatalogSeedIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/redshift/RedshiftCatalogSeedIntegrationTest.java
index e7f9206256..5154dda40d 100644
--- a/src/test/java/io/github/hectorvent/floci/services/redshift/RedshiftCatalogSeedIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/redshift/RedshiftCatalogSeedIntegrationTest.java
@@ -75,7 +75,7 @@ class RedshiftCatalogSeedIntegrationTest {
}
@Test
- void testCatalogViewsIntrospection() throws Exception {
+ void catalogViewsIntrospection() throws Exception {
clusterId = "cat-seed-" + UUID.randomUUID().toString().substring(0, 8);
Cluster cluster = service.createCluster(clusterId, "dc2.large", "admin", "Secret123");
@@ -250,7 +250,7 @@ class RedshiftCatalogSeedIntegrationTest {
}
@Test
- void testAllDocumentedRedshiftColumnsContract() throws Exception {
+ void allDocumentedRedshiftColumnsContract() throws Exception {
clusterId = "cat-contract-" + UUID.randomUUID().toString().substring(0, 8);
Cluster cluster = service.createCluster(clusterId, "dc2.large", "admin", "Secret123");
diff --git a/src/test/java/io/github/hectorvent/floci/services/redshift/RedshiftOperationsTest.java b/src/test/java/io/github/hectorvent/floci/services/redshift/RedshiftOperationsTest.java
index efbfe27366..8ee9c49c4f 100644
--- a/src/test/java/io/github/hectorvent/floci/services/redshift/RedshiftOperationsTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/redshift/RedshiftOperationsTest.java
@@ -49,7 +49,7 @@ public class RedshiftOperationsTest {
@Test
@Order(1)
- void testParameterGroupLifecycle() {
+ void parameterGroupLifecycle() {
// 1. CreateClusterParameterGroup
given()
.contentType("application/x-www-form-urlencoded")
@@ -125,7 +125,7 @@ public class RedshiftOperationsTest {
@Test
@Order(2)
- void testClusterAndSnapshotLifecycle() {
+ void clusterAndSnapshotLifecycle() {
when(containerManager.start(any(), eq("cluster-src"), any(), any()))
.thenReturn(new RedshiftContainerHandle("c1", "cluster-src", "localhost", 5439));
doAnswer(invocation -> {
@@ -155,7 +155,7 @@ public class RedshiftOperationsTest {
.body(containsString("<ClusterAvailabilityStatus>Available</ClusterAvailabilityStatus>"))
.body(containsString("<AvailabilityZoneRelocationStatus>disabled</AvailabilityZoneRelocationStatus>"));
- // 1b. RebootCluster — must preserve data (no Docker volume backs this container)
+ // 1b. RebootCluster: must preserve data (no Docker volume backs this container)
when(containerManager.getContainer(any(), eq("cluster-src")))
.thenReturn(Optional.of(new RedshiftContainerHandle("c1", "cluster-src", "localhost", 5439)));
given()
@@ -320,7 +320,7 @@ public class RedshiftOperationsTest {
@Test
@Order(4)
- void testClusterSubnetGroupLifecycle() {
+ void clusterSubnetGroupLifecycle() {
given()
.contentType("application/x-www-form-urlencoded")
.header("Authorization", AUTH_HEADER)
@@ -636,7 +636,7 @@ public class RedshiftOperationsTest {
@Test
@Order(3)
- void testTagLifecycle() {
+ void tagLifecycle() {
when(containerManager.start(any(), eq("cluster-tags"), any(), any()))
.thenReturn(new RedshiftContainerHandle("c3", "cluster-tags", "localhost", 5441));
diff --git a/src/test/java/io/github/hectorvent/floci/services/redshift/RedshiftQueryHandlerTest.java b/src/test/java/io/github/hectorvent/floci/services/redshift/RedshiftQueryHandlerTest.java
index 6183c2ea8f..377247c6f9 100644
--- a/src/test/java/io/github/hectorvent/floci/services/redshift/RedshiftQueryHandlerTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/redshift/RedshiftQueryHandlerTest.java
@@ -60,7 +60,7 @@ class RedshiftQueryHandlerTest {
}
@Test
- void testCreateClusterAction() {
+ void createClusterAction() {
MultivaluedMap<String, String> params = new MultivaluedHashMap<>();
params.putSingle("ClusterIdentifier", "test-cluster");
params.putSingle("NodeType", "dc2.large");
@@ -135,7 +135,7 @@ class RedshiftQueryHandlerTest {
}
@Test
- void testDescribeClusters() {
+ void describeClusters() {
MultivaluedMap<String, String> params = new MultivaluedHashMap<>();
params.putSingle("ClusterIdentifier", "test-cluster");
@@ -151,7 +151,7 @@ class RedshiftQueryHandlerTest {
}
@Test
- void testDescribeClustersIncludesAvailabilityStatuses() {
+ void describeClustersIncludesAvailabilityStatuses() {
MultivaluedMap<String, String> params = new MultivaluedHashMap<>();
params.putSingle("ClusterIdentifier", "test-cluster");
@@ -167,7 +167,7 @@ class RedshiftQueryHandlerTest {
}
@Test
- void testClusterAvailabilityStatusMapsTransientStatesToModifying() {
+ void clusterAvailabilityStatusMapsTransientStatesToModifying() {
MultivaluedMap<String, String> params = new MultivaluedHashMap<>();
params.putSingle("ClusterIdentifier", "test-cluster");
@@ -182,7 +182,7 @@ class RedshiftQueryHandlerTest {
}
@Test
- void testClusterAvailabilityStatusMapsFailed() {
+ void clusterAvailabilityStatusMapsFailed() {
MultivaluedMap<String, String> params = new MultivaluedHashMap<>();
params.putSingle("ClusterIdentifier", "test-cluster");
@@ -197,7 +197,7 @@ class RedshiftQueryHandlerTest {
}
@Test
- void testDeleteCluster() {
+ void deleteCluster() {
MultivaluedMap<String, String> params = new MultivaluedHashMap<>();
params.putSingle("ClusterIdentifier", "test-cluster");
@@ -214,7 +214,7 @@ class RedshiftQueryHandlerTest {
}
@Test
- void testCreateClusterSnapshot() {
+ void createClusterSnapshot() {
MultivaluedMap<String, String> params = new MultivaluedHashMap<>();
params.putSingle("SnapshotIdentifier", "test-snapshot");
params.putSingle("ClusterIdentifier", "test-cluster");
@@ -238,7 +238,7 @@ class RedshiftQueryHandlerTest {
}
@Test
- void testDescribeClusterSnapshots() {
+ void describeClusterSnapshots() {
MultivaluedMap<String, String> params = new MultivaluedHashMap<>();
params.putSingle("SnapshotIdentifier", "test-snapshot");
params.putSingle("ClusterIdentifier", "test-cluster");
@@ -260,7 +260,7 @@ class RedshiftQueryHandlerTest {
}
@Test
- void testDeleteClusterSnapshot() {
+ void deleteClusterSnapshot() {
MultivaluedMap<String, String> params = new MultivaluedHashMap<>();
params.putSingle("SnapshotIdentifier", "test-snapshot");
@@ -275,7 +275,7 @@ class RedshiftQueryHandlerTest {
}
@Test
- void testRestoreFromClusterSnapshot() {
+ void restoreFromClusterSnapshot() {
MultivaluedMap<String, String> params = new MultivaluedHashMap<>();
params.putSingle("ClusterIdentifier", "restored-cluster");
params.putSingle("SnapshotIdentifier", "test-snapshot");
@@ -299,7 +299,7 @@ class RedshiftQueryHandlerTest {
}
@Test
- void testRestoreFromClusterSnapshotBySnapshotArn() {
+ void restoreFromClusterSnapshotBySnapshotArn() {
MultivaluedMap<String, String> params = new MultivaluedHashMap<>();
params.putSingle("ClusterIdentifier", "restored-cluster");
params.putSingle("SnapshotArn", "arn:aws:redshift:us-east-1:acc:snapshot:src/my-snap");
@@ -312,7 +312,7 @@ class RedshiftQueryHandlerTest {
}
@Test
- void testRestoreFromClusterSnapshotMalformedArnIs400() {
+ void restoreFromClusterSnapshotMalformedArnIs400() {
MultivaluedMap<String, String> params = new MultivaluedHashMap<>();
params.putSingle("ClusterIdentifier", "restored-cluster");
params.putSingle("SnapshotArn", "not-an-arn");
@@ -324,7 +324,7 @@ class RedshiftQueryHandlerTest {
}
@Test
- void testRestoreFromClusterSnapshotWithoutSnapshotIs400() {
+ void restoreFromClusterSnapshotWithoutSnapshotIs400() {
MultivaluedMap<String, String> params = new MultivaluedHashMap<>();
params.putSingle("ClusterIdentifier", "restored-cluster");
@@ -334,7 +334,7 @@ class RedshiftQueryHandlerTest {
}
@Test
- void testRestoreFromClusterSnapshotForeignAccountArnNotFound() {
+ void restoreFromClusterSnapshotForeignAccountArnNotFound() {
MultivaluedMap<String, String> params = new MultivaluedHashMap<>();
params.putSingle("ClusterIdentifier", "restored-cluster");
params.putSingle("SnapshotArn", "arn:aws:redshift:us-east-1:999999999999:snapshot:src/my-snap");
@@ -346,7 +346,7 @@ class RedshiftQueryHandlerTest {
}
@Test
- void testClusterXmlCarriesDefaultParameterGroupAndMultiAZ() {
+ void clusterXmlCarriesDefaultParameterGroupAndMultiAZ() {
MultivaluedMap<String, String> params = new MultivaluedHashMap<>();
params.putSingle("ClusterIdentifier", "c1");
when(service.describeClusters("c1")).thenReturn(List.of(availableCluster("c1")));
@@ -357,7 +357,7 @@ class RedshiftQueryHandlerTest {
}
@Test
- void testCreateClusterParameterGroup() {
+ void createClusterParameterGroup() {
MultivaluedMap<String, String> params = new MultivaluedHashMap<>();
params.putSingle("ParameterGroupName", "test-pg");
params.putSingle("ParameterGroupFamily", "redshift-1.0");
@@ -375,7 +375,7 @@ class RedshiftQueryHandlerTest {
}
@Test
- void testDescribeClusterParameterGroups() {
+ void describeClusterParameterGroups() {
MultivaluedMap<String, String> params = new MultivaluedHashMap<>();
params.putSingle("ParameterGroupName", "test-pg");
@@ -391,7 +391,7 @@ class RedshiftQueryHandlerTest {
}
@Test
- void testDescribeClusterParameters() {
+ void describeClusterParameters() {
MultivaluedMap<String, String> params = new MultivaluedHashMap<>();
params.putSingle("ParameterGroupName", "test-pg");
@@ -406,7 +406,7 @@ class RedshiftQueryHandlerTest {
}
@Test
- void testDeleteClusterParameterGroup() {
+ void deleteClusterParameterGroup() {
MultivaluedMap<String, String> params = new MultivaluedHashMap<>();
params.putSingle("ParameterGroupName", "test-pg");
@@ -420,7 +420,7 @@ class RedshiftQueryHandlerTest {
}
@Test
- void testCreateTagsAcceptsNamedMemberForm() {
+ void createTagsAcceptsNamedMemberForm() {
// Real Redshift SDK sends "Tags.Tag.N.Key/.Value", không phải "Tags.member.N...".
MultivaluedMap<String, String> params = new MultivaluedHashMap<>();
params.putSingle("ResourceName", "arn:aws:redshift:us-east-1:000000000000:cluster:test-cluster");
@@ -437,7 +437,7 @@ class RedshiftQueryHandlerTest {
}
@Test
- void testCreateClusterSubnetGroupAcceptsNamedMemberForm() {
+ void createClusterSubnetGroupAcceptsNamedMemberForm() {
// Real Redshift SDK sends "SubnetIds.SubnetIdentifier.N", không phải "SubnetIds.member.N".
MultivaluedMap<String, String> params = new MultivaluedHashMap<>();
params.putSingle("ClusterSubnetGroupName", "test-sng");
@@ -458,7 +458,7 @@ class RedshiftQueryHandlerTest {
}
@Test
- void testModifyClusterParameterGroupAcceptsNamedMemberForm() {
+ void modifyClusterParameterGroupAcceptsNamedMemberForm() {
// Real Redshift SDK sends "Parameters.Parameter.N.ParameterName/.ParameterValue".
MultivaluedMap<String, String> params = new MultivaluedHashMap<>();
params.putSingle("ParameterGroupName", "test-pg");
@@ -477,7 +477,7 @@ class RedshiftQueryHandlerTest {
}
@Test
- void testCreateClusterSubnetGroupRequiresName() {
+ void createClusterSubnetGroupRequiresName() {
MultivaluedMap<String, String> params = new MultivaluedHashMap<>();
params.putSingle("Description", "desc");
@@ -488,7 +488,7 @@ class RedshiftQueryHandlerTest {
}
@Test
- void testModifyClusterRequiresClusterIdentifier() {
+ void modifyClusterRequiresClusterIdentifier() {
MultivaluedMap<String, String> params = new MultivaluedHashMap<>();
params.putSingle("NodeType", "dc2.large");
@@ -622,7 +622,7 @@ class RedshiftQueryHandlerTest {
}
@Test
- void testDescribeLoggingStatus() {
+ void describeLoggingStatus() {
MultivaluedMap<String, String> params = new MultivaluedHashMap<>();
params.putSingle("ClusterIdentifier", "test-cluster");
@@ -637,7 +637,7 @@ class RedshiftQueryHandlerTest {
assertEquals(200, response.getStatus());
String xml = (String) response.getEntity();
// The real AWS wire format wraps the fields in a *Result element matching the
- // operation name — verified against the SDK's own deserializer, not guessed.
+ // operation name, verified against the SDK's own deserializer, not guessed.
assertTrue(xml.contains("<DescribeLoggingStatusResult>"));
assertTrue(xml.contains("<LoggingEnabled>true</LoggingEnabled>"));
assertTrue(xml.contains("<BucketName>my-bucket</BucketName>"));
@@ -645,7 +645,7 @@ class RedshiftQueryHandlerTest {
}
@Test
- void testDescribeLoggingStatusRequiresClusterIdentifier() {
+ void describeLoggingStatusRequiresClusterIdentifier() {
MultivaluedMap<String, String> params = new MultivaluedHashMap<>();
AwsException ex = assertThrows(
@@ -655,7 +655,7 @@ class RedshiftQueryHandlerTest {
}
@Test
- void testEnableLogging() {
+ void enableLogging() {
MultivaluedMap<String, String> params = new MultivaluedHashMap<>();
params.putSingle("ClusterIdentifier", "test-cluster");
params.putSingle("BucketName", "my-bucket");
@@ -676,7 +676,7 @@ class RedshiftQueryHandlerTest {
}
@Test
- void testDisableLogging() {
+ void disableLogging() {
MultivaluedMap<String, String> params = new MultivaluedHashMap<>();
params.putSingle("ClusterIdentifier", "test-cluster");
@@ -798,7 +798,7 @@ class RedshiftQueryHandlerTest {
}
@Test
- void testBuildClusterXmlIncludesParameterGroupAndTags() {
+ void buildClusterXmlIncludesParameterGroupAndTags() {
MultivaluedMap<String, String> params = new MultivaluedHashMap<>();
params.putSingle("ClusterIdentifier", "test-cluster");
@@ -871,8 +871,8 @@ class RedshiftQueryHandlerTest {
handler.handle("GetClusterCredentials", params);
- java.time.Instant expiresAt = credentialBroker.resolve("acc", "c1", "IAM:analyst").orElseThrow().expiresAt();
- assertTrue(expiresAt.isAfter(java.time.Instant.now().plusSeconds(800)),
+ Instant expiresAt = credentialBroker.resolve("acc", "c1", "IAM:analyst").orElseThrow().expiresAt();
+ assertTrue(expiresAt.isAfter(Instant.now().plusSeconds(800)),
"an out-of-range config default must fall back to the AWS minimum, not be used as-is");
}
diff --git a/src/test/java/io/github/hectorvent/floci/services/redshift/RedshiftServiceTest.java b/src/test/java/io/github/hectorvent/floci/services/redshift/RedshiftServiceTest.java
index 4709993e8e..d1c5e27eee 100644
--- a/src/test/java/io/github/hectorvent/floci/services/redshift/RedshiftServiceTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/redshift/RedshiftServiceTest.java
@@ -37,6 +37,7 @@ import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
+import java.util.Set;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
@@ -159,7 +160,7 @@ class RedshiftServiceTest {
ArgumentCaptor<String> keyCaptor = ArgumentCaptor.forClass(String.class);
verify(integrationBackend).put(keyCaptor.capture(), eq(integration));
String storageKey = keyCaptor.getValue();
- when(integrationBackend.keysForAccount("111111111111")).thenReturn(java.util.Set.of(storageKey));
+ when(integrationBackend.keysForAccount("111111111111")).thenReturn(Set.of(storageKey));
when(integrationBackend.getForAccount("111111111111", storageKey)).thenReturn(Optional.of(integration));
service.updateIntegrationBackfillProgress("111111111111", integration.getIntegrationArn(),
@@ -176,7 +177,7 @@ class RedshiftServiceTest {
@Test
void updateIntegrationBackfillProgressOnUnknownIntegrationThrows() {
- when(integrationBackend.keysForAccount("111111111111")).thenReturn(java.util.Set.of());
+ when(integrationBackend.keysForAccount("111111111111")).thenReturn(Set.of());
assertThrows(AwsException.class, () -> service.updateIntegrationBackfillProgress(
"111111111111", "arn:aws:redshift:us-east-1:111111111111:integration:missing", null, true));
@@ -237,7 +238,7 @@ class RedshiftServiceTest {
}
@Test
- void testOnStartRecreatesContainersAcrossAccounts() {
+ void onStartRecreatesContainersAcrossAccounts() {
Cluster clusterA = new Cluster();
clusterA.setClusterIdentifier("cluster-a");
clusterA.setMasterUsername("admin");
@@ -270,7 +271,7 @@ class RedshiftServiceTest {
}
@Test
- void testOnStartSkipsClusterWithRunningContainer() {
+ void onStartSkipsClusterWithRunningContainer() {
Cluster cluster = new Cluster();
cluster.setClusterIdentifier("cluster-a");
cluster.setClusterStatus("available");
@@ -286,7 +287,7 @@ class RedshiftServiceTest {
}
@Test
- void testOnStartMarksClusterUnavailableOnStartFailure() {
+ void onStartMarksClusterUnavailableOnStartFailure() {
Cluster cluster = new Cluster();
cluster.setClusterIdentifier("cluster-a");
cluster.setMasterUsername("admin");
@@ -314,7 +315,7 @@ class RedshiftServiceTest {
persisted.setClusterStatus("available");
persisted.setProxyPort(7108);
- var entry = mock(AccountAwareStorageBackend.AccountEntry.class);
+ AccountAwareStorageBackend.AccountEntry<Cluster> entry = mock(AccountAwareStorageBackend.AccountEntry.class);
when(entry.value()).thenReturn(persisted);
when(entry.accountId()).thenReturn("111111111111");
when(entry.key()).thenReturn("c1");
@@ -333,7 +334,7 @@ class RedshiftServiceTest {
}
@Test
- void testCreateCluster() {
+ void createCluster() {
when(clusterBackend.get(anyString())).thenReturn(Optional.empty());
when(cm.start(any(), any(), any(), any())).thenReturn(new RedshiftContainerHandle("c1", "my-cluster", "localhost", 5432));
@@ -346,7 +347,7 @@ class RedshiftServiceTest {
}
@Test
- void testCreateClusterWithVpcMetadata() {
+ void createClusterWithVpcMetadata() {
when(clusterBackend.get(anyString())).thenReturn(Optional.empty());
when(cm.start(any(), any(), any(), any())).thenReturn(new RedshiftContainerHandle("c1", "my-cluster", "localhost", 5432));
@@ -381,7 +382,7 @@ class RedshiftServiceTest {
}
@Test
- void testCreateClusterAlreadyExists() {
+ void createClusterAlreadyExists() {
when(clusterBackend.get("existing-cluster")).thenReturn(Optional.of(new Cluster()));
assertThrows(AwsException.class, () ->
@@ -474,7 +475,7 @@ class RedshiftServiceTest {
}
@Test
- void testDescribeClusters() {
+ void describeClusters() {
Cluster c = new Cluster();
c.setClusterIdentifier("test-c");
when(clusterBackend.get("test-c")).thenReturn(Optional.of(c));
@@ -498,7 +499,7 @@ class RedshiftServiceTest {
}
@Test
- void testDeleteCluster() {
+ void deleteCluster() {
Cluster c = new Cluster();
c.setClusterIdentifier("test-c");
when(clusterBackend.get("test-c")).thenReturn(Optional.of(c));
@@ -557,7 +558,7 @@ class RedshiftServiceTest {
}
@Test
- void testRebootClusterDumpsAndRestoresData() throws Exception {
+ void rebootClusterDumpsAndRestoresData() throws Exception {
Cluster cluster = new Cluster();
cluster.setClusterIdentifier("my-cluster");
cluster.setMasterUsername("admin");
@@ -610,7 +611,7 @@ class RedshiftServiceTest {
}
@Test
- void testRebootClusterNotFound() {
+ void rebootClusterNotFound() {
when(clusterBackend.get("missing")).thenReturn(Optional.empty());
assertThrows(AwsException.class, () -> service.rebootCluster("missing"));
@@ -634,8 +635,8 @@ class RedshiftServiceTest {
assertThrows(AwsException.class, () -> service.rebootCluster("c1"));
// The proxy started during the reboot must be stopped again on failure, and the
- // replacement container must be stopped too — once before the restart, once in
- // rollback — so it is not left running behind a "failed" cluster.
+ // replacement container must be stopped too, once before the restart, once in
+ // rollback, so it is not left running behind a "failed" cluster.
verify(proxyManager).startProxy(eq("111111111111:c1"), eq(7107), any(), anyInt(),
any(), any(), any(), any(), any(), any());
verify(proxyManager, times(2)).stopProxy("111111111111:c1");
@@ -675,7 +676,7 @@ class RedshiftServiceTest {
assertThrows(AwsException.class, () -> service.rebootCluster("c1"));
// start() can create the container before throwing (readiness check); the
- // original is already gone, so rollback removes anything under the name —
+ // original is already gone, so rollback removes anything under the name:
// once for the original teardown, once for the possible orphan.
verify(cm, times(2)).stop("111111111111", "c1");
@@ -705,7 +706,7 @@ class RedshiftServiceTest {
}
@Test
- void testCreateSnapshot() {
+ void createSnapshot() {
Cluster cluster = new Cluster();
cluster.setClusterIdentifier("my-cluster");
cluster.setMasterUsername("admin");
@@ -737,7 +738,7 @@ class RedshiftServiceTest {
}
@Test
- void testCreateSnapshotClusterNotFound() {
+ void createSnapshotClusterNotFound() {
when(clusterBackend.get("missing-cluster")).thenReturn(Optional.empty());
assertThrows(AwsException.class, () ->
@@ -745,7 +746,7 @@ class RedshiftServiceTest {
}
@Test
- void testCreateSnapshotAlreadyExists() {
+ void createSnapshotAlreadyExists() {
Cluster cluster = new Cluster();
cluster.setClusterIdentifier("my-cluster");
when(clusterBackend.get("my-cluster")).thenReturn(Optional.of(cluster));
@@ -756,7 +757,7 @@ class RedshiftServiceTest {
}
@Test
- void testCreateSnapshotRejectsTraversalOrMalformedIdentifier() {
+ void createSnapshotRejectsTraversalOrMalformedIdentifier() {
Cluster cluster = new Cluster();
cluster.setClusterIdentifier("my-cluster");
cluster.setMasterUsername("admin");
@@ -778,7 +779,7 @@ class RedshiftServiceTest {
}
@Test
- void testModifyClusterUpdatesMetadataAndPassword() {
+ void modifyClusterUpdatesMetadataAndPassword() {
Cluster cluster = new Cluster();
cluster.setClusterIdentifier("my-cluster");
cluster.setNodeType("dc2.large");
@@ -796,7 +797,7 @@ class RedshiftServiceTest {
}
@Test
- void testModifyClusterUpdatesVpcSecurityGroups() {
+ void modifyClusterUpdatesVpcSecurityGroups() {
Cluster cluster = new Cluster();
cluster.setClusterIdentifier("my-cluster");
cluster.setMasterUsername("admin");
@@ -810,7 +811,7 @@ class RedshiftServiceTest {
}
@Test
- void testModifyClusterNotFound() {
+ void modifyClusterNotFound() {
when(clusterBackend.get("missing")).thenReturn(Optional.empty());
assertThrows(AwsException.class, () ->
@@ -837,7 +838,7 @@ class RedshiftServiceTest {
}
@Test
- void testDescribeLoggingStatusDefaultsToDisabled() {
+ void describeLoggingStatusDefaultsToDisabled() {
Cluster cluster = new Cluster();
cluster.setClusterIdentifier("my-cluster");
when(clusterBackend.get("my-cluster")).thenReturn(Optional.of(cluster));
@@ -849,14 +850,14 @@ class RedshiftServiceTest {
}
@Test
- void testDescribeLoggingStatusNotFound() {
+ void describeLoggingStatusNotFound() {
when(clusterBackend.get("missing")).thenReturn(Optional.empty());
assertThrows(AwsException.class, () -> service.describeLoggingStatus("missing"));
}
@Test
- void testEnableLogging() {
+ void enableLogging() {
Cluster cluster = new Cluster();
cluster.setClusterIdentifier("my-cluster");
when(clusterBackend.get("my-cluster")).thenReturn(Optional.of(cluster));
@@ -908,7 +909,7 @@ class RedshiftServiceTest {
}
@Test
- void testEnableLoggingRequiresBucketName() {
+ void enableLoggingRequiresBucketName() {
Cluster cluster = new Cluster();
cluster.setClusterIdentifier("my-cluster");
when(clusterBackend.get("my-cluster")).thenReturn(Optional.of(cluster));
@@ -917,7 +918,7 @@ class RedshiftServiceTest {
}
@Test
- void testEnableLoggingCloudWatchDoesNotRequireBucketName() {
+ void enableLoggingCloudWatchDoesNotRequireBucketName() {
Cluster cluster = new Cluster();
cluster.setClusterIdentifier("my-cluster");
when(clusterBackend.get("my-cluster")).thenReturn(Optional.of(cluster));
@@ -929,7 +930,7 @@ class RedshiftServiceTest {
}
@Test
- void testCreateClusterAssignsDefaultParameterGroup() {
+ void createClusterAssignsDefaultParameterGroup() {
when(clusterBackend.get(anyString())).thenReturn(Optional.empty());
when(cm.start(any(), any(), any(), any())).thenReturn(new RedshiftContainerHandle("c1", "my-cluster", "localhost", 5432));
@@ -938,7 +939,7 @@ class RedshiftServiceTest {
}
@Test
- void testModifyClusterStoresMultiAZ() {
+ void modifyClusterStoresMultiAZ() {
Cluster cluster = new Cluster();
cluster.setClusterIdentifier("my-cluster");
when(clusterBackend.get("my-cluster")).thenReturn(Optional.of(cluster));
@@ -947,7 +948,7 @@ class RedshiftServiceTest {
}
@Test
- void testDescribeDefaultParameterGroupIsSynthesized() {
+ void describeDefaultParameterGroupIsSynthesized() {
when(parameterGroupBackend.get("default.redshift-1.0")).thenReturn(Optional.empty());
List<ClusterParameterGroup> groups = service.describeClusterParameterGroups("default.redshift-1.0");
@@ -956,14 +957,14 @@ class RedshiftServiceTest {
}
@Test
- void testEnableLoggingNotFound() {
+ void enableLoggingNotFound() {
when(clusterBackend.get("missing")).thenReturn(Optional.empty());
assertThrows(AwsException.class, () -> service.enableLogging("missing", "my-bucket", null, null, null));
}
@Test
- void testDisableLoggingClearsConfig() {
+ void disableLoggingClearsConfig() {
Cluster cluster = new Cluster();
cluster.setClusterIdentifier("my-cluster");
cluster.setLoggingEnabled(true);
@@ -981,14 +982,14 @@ class RedshiftServiceTest {
}
@Test
- void testDisableLoggingNotFound() {
+ void disableLoggingNotFound() {
when(clusterBackend.get("missing")).thenReturn(Optional.empty());
assertThrows(AwsException.class, () -> service.disableLogging("missing"));
}
@Test
- void testDescribeSnapshots() {
+ void describeSnapshots() {
Snapshot s = new Snapshot("snap-1", "my-cluster", "available", 5439, "admin");
when(snapshotBackend.get("snap-1")).thenReturn(Optional.of(s));
@@ -998,14 +999,14 @@ class RedshiftServiceTest {
}
@Test
- void testDescribeSnapshotsNotFound() {
+ void describeSnapshotsNotFound() {
when(snapshotBackend.get("missing-snap")).thenReturn(Optional.empty());
assertThrows(AwsException.class, () -> service.describeSnapshots("missing-snap"));
}
@Test
- void testDeleteSnapshot() {
+ void deleteSnapshot() {
Snapshot s = new Snapshot("snap-1", "my-cluster", "available", 5439, "admin");
s.setSqlDump(dumpPath("snap-1"));
when(snapshotBackend.get("snap-1")).thenReturn(Optional.of(s));
@@ -1018,14 +1019,14 @@ class RedshiftServiceTest {
}
@Test
- void testDeleteSnapshotNotFound() {
+ void deleteSnapshotNotFound() {
when(snapshotBackend.get("missing-snap")).thenReturn(Optional.empty());
assertThrows(AwsException.class, () -> service.deleteSnapshot("missing-snap"));
}
@Test
- void testRestoreFromClusterSnapshot() {
+ void restoreFromClusterSnapshot() {
Cluster sourceCluster = new Cluster();
sourceCluster.setClusterIdentifier("source-cluster");
sourceCluster.setMasterPassword("password123");
@@ -1056,7 +1057,7 @@ class RedshiftServiceTest {
}
@Test
- void testRestoreFromClusterSnapshotUsesStoredPasswordAfterSourceClusterDeleted() {
+ void restoreFromClusterSnapshotUsesStoredPasswordAfterSourceClusterDeleted() {
Snapshot snapshot = new Snapshot("my-snapshot", "deleted-source", "available", 5439, "admin");
snapshot.setMasterPassword("original-secret");
snapshot.setSqlDump(dumpPath("my-snapshot"));
@@ -1074,7 +1075,7 @@ class RedshiftServiceTest {
}
@Test
- void testRestoreFromClusterSnapshotFallsBackToAdminWhenSourceClusterGone() {
+ void restoreFromClusterSnapshotFallsBackToAdminWhenSourceClusterGone() {
Snapshot snapshot = new Snapshot("my-snapshot", "deleted-source", "available", 5439, "admin");
snapshot.setSqlDump(dumpPath("my-snapshot"));
when(clusterBackend.get("restored-cluster")).thenReturn(Optional.empty());
@@ -1090,7 +1091,7 @@ class RedshiftServiceTest {
}
@Test
- void testRestoreFromClusterSnapshotAlreadyExists() {
+ void restoreFromClusterSnapshotAlreadyExists() {
when(clusterBackend.get("existing-cluster")).thenReturn(Optional.of(new Cluster()));
assertThrows(AwsException.class, () ->
@@ -1098,7 +1099,7 @@ class RedshiftServiceTest {
}
@Test
- void testRestoreFromClusterSnapshotNotFound() {
+ void restoreFromClusterSnapshotNotFound() {
when(clusterBackend.get("new-cluster")).thenReturn(Optional.empty());
when(snapshotBackend.get("missing-snapshot")).thenReturn(Optional.empty());
@@ -1107,7 +1108,7 @@ class RedshiftServiceTest {
}
@Test
- void testRestoreFromClusterSnapshotFailure() {
+ void restoreFromClusterSnapshotFailure() {
Snapshot snapshot = new Snapshot("my-snapshot", "source-cluster", "available", 5439, "admin", dumpPath("my-snapshot"));
when(clusterBackend.get("failed-cluster")).thenReturn(Optional.empty());
when(snapshotBackend.get("my-snapshot")).thenReturn(Optional.of(snapshot));
@@ -1118,9 +1119,9 @@ class RedshiftServiceTest {
}
@Test
- void testRestoreFromClusterSnapshotRejectsUntrustedDumpPathBeforeProvisioning() {
+ void restoreFromClusterSnapshotRejectsUntrustedDumpPathBeforeProvisioning() {
// A dump path persisted outside the account dir (e.g. by pre-validation code) must be
- // rejected up front — no cluster record, no container.
+ // rejected up front: no cluster record, no container.
Snapshot snapshot = new Snapshot("my-snapshot", "source-cluster", "available", 5439, "admin", "/etc/shadow");
when(clusterBackend.get("restored-cluster")).thenReturn(Optional.empty());
when(snapshotBackend.get("my-snapshot")).thenReturn(Optional.of(snapshot));
@@ -1187,7 +1188,7 @@ class RedshiftServiceTest {
}
@Test
- void testCreateClusterParameterGroup() {
+ void createClusterParameterGroup() {
when(parameterGroupBackend.get("my-pg")).thenReturn(Optional.empty());
ClusterParameterGroup pg = service.createClusterParameterGroup("my-pg", "redshift-1.0", "custom pg");
@@ -1200,7 +1201,7 @@ class RedshiftServiceTest {
}
@Test
- void testCreateClusterParameterGroupAlreadyExists() {
+ void createClusterParameterGroupAlreadyExists() {
when(parameterGroupBackend.get("my-pg")).thenReturn(Optional.of(new ClusterParameterGroup()));
assertThrows(AwsException.class, () ->
@@ -1208,7 +1209,7 @@ class RedshiftServiceTest {
}
@Test
- void testDescribeClusterParameterGroups() {
+ void describeClusterParameterGroups() {
ClusterParameterGroup pg = new ClusterParameterGroup("my-pg", "redshift-1.0", "custom pg");
when(parameterGroupBackend.get("my-pg")).thenReturn(Optional.of(pg));
@@ -1218,7 +1219,7 @@ class RedshiftServiceTest {
}
@Test
- void testDescribeClusterParameterGroupsNotFound() {
+ void describeClusterParameterGroupsNotFound() {
when(parameterGroupBackend.get("missing-pg")).thenReturn(Optional.empty());
assertThrows(AwsException.class, () ->
@@ -1226,7 +1227,7 @@ class RedshiftServiceTest {
}
@Test
- void testDeleteClusterParameterGroup() {
+ void deleteClusterParameterGroup() {
ClusterParameterGroup pg = new ClusterParameterGroup("my-pg", "redshift-1.0", "custom pg");
when(parameterGroupBackend.get("my-pg")).thenReturn(Optional.of(pg));
@@ -1238,7 +1239,7 @@ class RedshiftServiceTest {
}
@Test
- void testDeleteClusterParameterGroupNotFound() {
+ void deleteClusterParameterGroupNotFound() {
when(parameterGroupBackend.get("missing-pg")).thenReturn(Optional.empty());
assertThrows(AwsException.class, () ->
@@ -1246,7 +1247,7 @@ class RedshiftServiceTest {
}
@Test
- void testModifyClusterParameterGroup() {
+ void modifyClusterParameterGroup() {
ClusterParameterGroup group = new ClusterParameterGroup("my-pg", "redshift-1.0", "custom pg");
when(parameterGroupBackend.get("my-pg")).thenReturn(Optional.of(group));
@@ -1261,7 +1262,7 @@ class RedshiftServiceTest {
}
@Test
- void testModifyClusterParameterGroupAppendsUnknownParameter() {
+ void modifyClusterParameterGroupAppendsUnknownParameter() {
ClusterParameterGroup group = new ClusterParameterGroup("my-pg", "redshift-1.0", "custom pg");
when(parameterGroupBackend.get("my-pg")).thenReturn(Optional.of(group));
@@ -1273,7 +1274,7 @@ class RedshiftServiceTest {
}
@Test
- void testModifyClusterParameterGroupNotFound() {
+ void modifyClusterParameterGroupNotFound() {
when(parameterGroupBackend.get("missing")).thenReturn(Optional.empty());
assertThrows(AwsException.class, () ->
@@ -1281,7 +1282,7 @@ class RedshiftServiceTest {
}
@Test
- void testDescribeClusterParametersReturnsStoredValues() {
+ void describeClusterParametersReturnsStoredValues() {
ClusterParameterGroup group = new ClusterParameterGroup("my-pg", "redshift-1.0", "custom pg");
group.setParameters(new ArrayList<>(List.of(new Parameter("statement_timeout", "5000"))));
when(parameterGroupBackend.get("my-pg")).thenReturn(Optional.of(group));
@@ -1294,7 +1295,7 @@ class RedshiftServiceTest {
}
@Test
- void testModifyClusterParameterGroupPreservesMetadata() {
+ void modifyClusterParameterGroupPreservesMetadata() {
ClusterParameterGroup group = new ClusterParameterGroup("my-pg", "redshift-1.0", "custom pg");
when(parameterGroupBackend.get("my-pg")).thenReturn(Optional.of(group));
@@ -1311,7 +1312,7 @@ class RedshiftServiceTest {
}
@Test
- void testCreateAndListTagsForCluster() {
+ void createAndListTagsForCluster() {
Cluster cluster = new Cluster();
cluster.setClusterIdentifier("my-cluster");
when(clusterBackend.get("my-cluster")).thenReturn(Optional.of(cluster));
@@ -1324,7 +1325,7 @@ class RedshiftServiceTest {
}
@Test
- void testDeleteTagsForCluster() {
+ void deleteTagsForCluster() {
Cluster cluster = new Cluster();
cluster.setClusterIdentifier("my-cluster");
cluster.setTags(new LinkedHashMap<>(Map.of("env", "test", "team", "data")));
@@ -1336,19 +1337,19 @@ class RedshiftServiceTest {
}
@Test
- void testCreateTagsRejectsNonArnResourceName() {
+ void createTagsRejectsNonArnResourceName() {
assertThrows(AwsException.class, () ->
service.createTags("my-cluster", Map.of("env", "test")));
}
@Test
- void testCreateTagsRejectsUnknownResourceType() {
+ void createTagsRejectsUnknownResourceType() {
assertThrows(AwsException.class, () ->
service.createTags("arn:aws:redshift:us-east-1:111111111111:reservednode:foo", Map.of("env", "test")));
}
@Test
- void testDescribeTagsForSpecificResource() {
+ void describeTagsForSpecificResource() {
Cluster cluster = new Cluster();
cluster.setClusterIdentifier("my-cluster");
cluster.setTags(new LinkedHashMap<>(Map.of("env", "test")));
@@ -1364,7 +1365,7 @@ class RedshiftServiceTest {
}
@Test
- void testDescribeTagsScansAllResourcesOfType() {
+ void describeTagsScansAllResourcesOfType() {
Cluster a = new Cluster();
a.setClusterIdentifier("cluster-a");
a.setTags(new LinkedHashMap<>(Map.of("env", "prod")));
@@ -1383,7 +1384,7 @@ class RedshiftServiceTest {
}
@Test
- void testCreateClusterSubnetGroup() {
+ void createClusterSubnetGroup() {
when(subnetGroupBackend.get("my-subnet-group")).thenReturn(Optional.empty());
ClusterSubnetGroup group = service.createClusterSubnetGroup(
@@ -1396,7 +1397,7 @@ class RedshiftServiceTest {
}
@Test
- void testCreateClusterSubnetGroupAlreadyExists() {
+ void createClusterSubnetGroupAlreadyExists() {
when(subnetGroupBackend.get("existing")).thenReturn(Optional.of(new ClusterSubnetGroup()));
assertThrows(AwsException.class, () ->
@@ -1404,7 +1405,7 @@ class RedshiftServiceTest {
}
@Test
- void testDescribeClusterSubnetGroups() {
+ void describeClusterSubnetGroups() {
ClusterSubnetGroup group = new ClusterSubnetGroup("my-group", "d", "vpc-1", List.of("subnet-1"));
when(subnetGroupBackend.get("my-group")).thenReturn(Optional.of(group));
@@ -1415,7 +1416,7 @@ class RedshiftServiceTest {
}
@Test
- void testModifyClusterSubnetGroup() {
+ void modifyClusterSubnetGroup() {
ClusterSubnetGroup group = new ClusterSubnetGroup("my-group", "old", "vpc-1", List.of("subnet-1"));
when(subnetGroupBackend.get("my-group")).thenReturn(Optional.of(group));
@@ -1426,7 +1427,7 @@ class RedshiftServiceTest {
}
@Test
- void testDeleteClusterSubnetGroup() {
+ void deleteClusterSubnetGroup() {
ClusterSubnetGroup group = new ClusterSubnetGroup("my-group", "d", "vpc-1", List.of("subnet-1"));
when(subnetGroupBackend.get("my-group")).thenReturn(Optional.of(group));
@@ -1438,7 +1439,7 @@ class RedshiftServiceTest {
}
@Test
- void testDeleteClusterSubnetGroupNotFound() {
+ void deleteClusterSubnetGroupNotFound() {
when(subnetGroupBackend.get("missing")).thenReturn(Optional.empty());
assertThrows(AwsException.class, () -> service.deleteClusterSubnetGroup("missing"));
diff --git a/src/test/java/io/github/hectorvent/floci/services/redshift/container/RedshiftCatalogResourceTest.java b/src/test/java/io/github/hectorvent/floci/services/redshift/container/RedshiftCatalogResourceTest.java
index 063eef6758..5211a46864 100644
--- a/src/test/java/io/github/hectorvent/floci/services/redshift/container/RedshiftCatalogResourceTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/redshift/container/RedshiftCatalogResourceTest.java
@@ -11,7 +11,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
class RedshiftCatalogResourceTest {
@Test
- void testBootstrapCatalogResourceExistsAndContainsExpectedViews() throws Exception {
+ void bootstrapCatalogResourceExistsAndContainsExpectedViews() throws Exception {
try (InputStream in = getClass().getResourceAsStream("/redshift/bootstrap-catalog.sql")) {
assertNotNull(in, "bootstrap-catalog.sql must exist on classpath");
String sql = new String(in.readAllBytes(), StandardCharsets.UTF_8);
diff --git a/src/test/java/io/github/hectorvent/floci/services/redshift/container/RedshiftContainerManagerTest.java b/src/test/java/io/github/hectorvent/floci/services/redshift/container/RedshiftContainerManagerTest.java
index 462f460379..c83d56fa5e 100644
--- a/src/test/java/io/github/hectorvent/floci/services/redshift/container/RedshiftContainerManagerTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/redshift/container/RedshiftContainerManagerTest.java
@@ -110,7 +110,7 @@ class RedshiftContainerManagerTest {
private static final String ACCOUNT_ID = "111111111111";
@Test
- void testTakeSnapshotContainerNotFound() {
+ void takeSnapshotContainerNotFound() {
AwsException ex = assertThrows(AwsException.class, () ->
manager.takeSnapshot(ACCOUNT_ID, "non-existent-cluster", "admin", "dev", Path.of("dummy.sql")));
assertEquals("ClusterNotFound", ex.getErrorCode());
@@ -118,7 +118,7 @@ class RedshiftContainerManagerTest {
}
@Test
- void testRestoreSnapshotContainerNotFound() {
+ void restoreSnapshotContainerNotFound() {
AwsException ex = assertThrows(AwsException.class, () ->
manager.restoreSnapshot(ACCOUNT_ID, "non-existent-cluster", "admin", "dev", Path.of("dummy.sql")));
assertEquals("ClusterNotFound", ex.getErrorCode());
@@ -126,7 +126,7 @@ class RedshiftContainerManagerTest {
}
@Test
- void testCreateSnapshotNullCluster() {
+ void createSnapshotNullCluster() {
AwsException ex = assertThrows(AwsException.class, () ->
manager.createSnapshot(ACCOUNT_ID, null, Path.of("dummy.sql")));
assertEquals("InvalidParameterValue", ex.getErrorCode());
@@ -134,7 +134,7 @@ class RedshiftContainerManagerTest {
}
@Test
- void testRestoreSnapshotNullCluster() {
+ void restoreSnapshotNullCluster() {
AwsException ex = assertThrows(AwsException.class, () ->
manager.restoreSnapshot(ACCOUNT_ID, (Cluster) null, Path.of("dummy.sql")));
assertEquals("InvalidParameterValue", ex.getErrorCode());
@@ -142,7 +142,7 @@ class RedshiftContainerManagerTest {
}
@Test
- void testTakeSnapshotSuccess() throws Exception {
+ void takeSnapshotSuccess() throws Exception {
ContainerBuilder.Builder specBuilder = mock(ContainerBuilder.Builder.class, org.mockito.Mockito.RETURNS_SELF);
when(containerBuilder.newContainer(anyString())).thenReturn(specBuilder);
ContainerInfo info = new ContainerInfo("cont-123", Map.of(5432, new EndpointInfo("localhost", 5432)));
@@ -201,7 +201,7 @@ class RedshiftContainerManagerTest {
}
@Test
- void testTakeSnapshotFailureExitCode() throws Exception {
+ void takeSnapshotFailureExitCode() throws Exception {
ContainerBuilder.Builder specBuilder = mock(ContainerBuilder.Builder.class, org.mockito.Mockito.RETURNS_SELF);
when(containerBuilder.newContainer(anyString())).thenReturn(specBuilder);
ContainerInfo info = new ContainerInfo("cont-123", Map.of(5432, new EndpointInfo("localhost", 5432)));
@@ -239,7 +239,7 @@ class RedshiftContainerManagerTest {
}
@Test
- void testRestoreSnapshotEmptyDump() {
+ void restoreSnapshotEmptyDump() {
ContainerBuilder.Builder specBuilder = mock(ContainerBuilder.Builder.class, org.mockito.Mockito.RETURNS_SELF);
when(containerBuilder.newContainer(anyString())).thenReturn(specBuilder);
ContainerInfo info = new ContainerInfo("cont-123", Map.of(5432, new EndpointInfo("localhost", 5432)));
@@ -253,7 +253,7 @@ class RedshiftContainerManagerTest {
}
@Test
- void testRestoreSnapshotSuccess() throws Exception {
+ void restoreSnapshotSuccess() throws Exception {
ContainerBuilder.Builder specBuilder = mock(ContainerBuilder.Builder.class, org.mockito.Mockito.RETURNS_SELF);
when(containerBuilder.newContainer(anyString())).thenReturn(specBuilder);
ContainerInfo info = new ContainerInfo("cont-123", Map.of(5432, new EndpointInfo("localhost", 5432)));
@@ -298,7 +298,7 @@ class RedshiftContainerManagerTest {
}
@Test
- void testStopRemovesContainer() {
+ void stopRemovesContainer() {
ContainerBuilder.Builder specBuilder = mock(ContainerBuilder.Builder.class, org.mockito.Mockito.RETURNS_SELF);
when(containerBuilder.newContainer(anyString())).thenReturn(specBuilder);
ContainerInfo info = new ContainerInfo("cont-123", Map.of(5432, new EndpointInfo("localhost", 5432)));
@@ -313,7 +313,7 @@ class RedshiftContainerManagerTest {
}
@Test
- void testSameClusterIdentifierAcrossAccountsDoesNotCollide() {
+ void sameClusterIdentifierAcrossAccountsDoesNotCollide() {
ContainerBuilder.Builder specBuilder = mock(ContainerBuilder.Builder.class, org.mockito.Mockito.RETURNS_SELF);
when(containerBuilder.newContainer(anyString())).thenReturn(specBuilder);
ContainerInfo infoA = new ContainerInfo("cont-account-a", Map.of(5432, new EndpointInfo("localhost", 5432)));
@@ -332,7 +332,7 @@ class RedshiftContainerManagerTest {
}
@Test
- void testAdoptOrStartAdoptsExistingContainerInsteadOfRecreatingIt() {
+ void adoptOrStartAdoptsExistingContainerInsteadOfRecreatingIt() {
String containerName = "floci-redshift-" + ACCOUNT_ID + "-test-cluster";
Container existing = mock(Container.class);
when(existing.getId()).thenReturn("cont-existing");
@@ -345,13 +345,13 @@ class RedshiftContainerManagerTest {
assertEquals("cont-existing", handle.getContainerId());
assertEquals(6000, handle.getPort());
assertTrue(manager.getContainer(ACCOUNT_ID, "test-cluster").isPresent());
- // Data lives only in the container's writable layer (no volume) — recreating it
+ // Data lives only in the container's writable layer (no volume): recreating it
// would silently discard it, so a container found by name must never be recreated.
verify(lifecycleManager, never()).createAndStart(any());
}
@Test
- void testAdoptOrStartFallsBackToStartWhenNoExistingContainer() {
+ void adoptOrStartFallsBackToStartWhenNoExistingContainer() {
String containerName = "floci-redshift-" + ACCOUNT_ID + "-test-cluster";
when(lifecycleManager.findByName(containerName)).thenReturn(Optional.empty());
ContainerBuilder.Builder specBuilder = mock(ContainerBuilder.Builder.class, org.mockito.Mockito.RETURNS_SELF);
@@ -366,7 +366,7 @@ class RedshiftContainerManagerTest {
}
@Test
- void testAlterUserPasswordSuccess() throws Exception {
+ void alterUserPasswordSuccess() throws Exception {
ContainerBuilder.Builder specBuilder = mock(ContainerBuilder.Builder.class, org.mockito.Mockito.RETURNS_SELF);
when(containerBuilder.newContainer(anyString())).thenReturn(specBuilder);
ContainerInfo info = new ContainerInfo("cont-123", Map.of(5432, new EndpointInfo("localhost", 5432)));
@@ -400,7 +400,7 @@ class RedshiftContainerManagerTest {
}
@Test
- void testAlterUserPasswordContainerNotFound() {
+ void alterUserPasswordContainerNotFound() {
AwsException ex = assertThrows(AwsException.class, () ->
manager.alterUserPassword(ACCOUNT_ID, "non-existent-cluster", "admin", "new-secret"));
assertEquals("ClusterNotFound", ex.getErrorCode());
@@ -408,7 +408,7 @@ class RedshiftContainerManagerTest {
}
@Test
- void testAlterUserPasswordInvalidUsername() throws Exception {
+ void alterUserPasswordInvalidUsername() throws Exception {
ContainerBuilder.Builder specBuilder = mock(ContainerBuilder.Builder.class, org.mockito.Mockito.RETURNS_SELF);
when(containerBuilder.newContainer(anyString())).thenReturn(specBuilder);
ContainerInfo info = new ContainerInfo("cont-123", Map.of(5432, new EndpointInfo("localhost", 5432)));
@@ -429,7 +429,7 @@ class RedshiftContainerManagerTest {
}
@Test
- void testAlterUserPasswordInvalidPassword() throws Exception {
+ void alterUserPasswordInvalidPassword() throws Exception {
ContainerBuilder.Builder specBuilder = mock(ContainerBuilder.Builder.class, org.mockito.Mockito.RETURNS_SELF);
when(containerBuilder.newContainer(anyString())).thenReturn(specBuilder);
ContainerInfo info = new ContainerInfo("cont-123", Map.of(5432, new EndpointInfo("localhost", 5432)));
@@ -462,7 +462,7 @@ class RedshiftContainerManagerTest {
}
@Test
- void testAlterUserPasswordExecFailure() throws Exception {
+ void alterUserPasswordExecFailure() throws Exception {
ContainerBuilder.Builder specBuilder = mock(ContainerBuilder.Builder.class, org.mockito.Mockito.RETURNS_SELF);
when(containerBuilder.newContainer(anyString())).thenReturn(specBuilder);
ContainerInfo info = new ContainerInfo("cont-123", Map.of(5432, new EndpointInfo("localhost", 5432)));
@@ -499,7 +499,7 @@ class RedshiftContainerManagerTest {
}
@Test
- void testStartAttachesLogStreamerAndToleratesFailure() throws Exception {
+ void startAttachesLogStreamerAndToleratesFailure() throws Exception {
ContainerBuilder.Builder specBuilder = mock(ContainerBuilder.Builder.class, RETURNS_SELF);
when(containerBuilder.newContainer(anyString())).thenReturn(specBuilder);
ContainerInfo info = new ContainerInfo("cont-stream", Map.of(5432, new EndpointInfo("localhost", 5432)));
@@ -522,7 +522,7 @@ class RedshiftContainerManagerTest {
}
@Test
- void testAdoptOrStartAttachesLogStreamerAndToleratesFailure() throws Exception {
+ void adoptOrStartAttachesLogStreamerAndToleratesFailure() throws Exception {
String containerName = "floci-redshift-" + ACCOUNT_ID + "-test-cluster";
Container existing = mock(Container.class);
when(existing.getId()).thenReturn("cont-adopt-stream");
@@ -547,7 +547,7 @@ class RedshiftContainerManagerTest {
}
@Test
- void testBootstrapCatalogSuccess() {
+ void bootstrapCatalogSuccess() {
CopyArchiveToContainerCmd copyCmd = mock(CopyArchiveToContainerCmd.class, org.mockito.Mockito.RETURNS_SELF);
when(dockerClient.copyArchiveToContainerCmd("cont-bootstrap")).thenReturn(copyCmd);
@@ -570,7 +570,7 @@ class RedshiftContainerManagerTest {
}
@Test
- void testBootstrapCatalogFailureDoesNotThrow() {
+ void bootstrapCatalogFailureDoesNotThrow() {
CopyArchiveToContainerCmd copyCmd = mock(CopyArchiveToContainerCmd.class, org.mockito.Mockito.RETURNS_SELF);
when(copyCmd.exec()).thenThrow(new RuntimeException("Docker copy error"));
when(dockerClient.copyArchiveToContainerCmd("cont-bootstrap-fail")).thenReturn(copyCmd);
diff --git a/src/test/java/io/github/hectorvent/floci/services/redshift/proxy/S3CopySimulatorTest.java b/src/test/java/io/github/hectorvent/floci/services/redshift/proxy/S3CopySimulatorTest.java
index d87eb18d73..aad137b3c7 100644
--- a/src/test/java/io/github/hectorvent/floci/services/redshift/proxy/S3CopySimulatorTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/redshift/proxy/S3CopySimulatorTest.java
@@ -20,6 +20,7 @@ import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
+import java.util.Optional;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicReference;
import java.util.zip.GZIPInputStream;
@@ -203,7 +204,7 @@ class S3CopySimulatorTest {
CopyStatementParser.S3CopyFrom spec = new CopyStatementParser.S3CopyFrom(
"t", List.of(), "b", "k", "|", 0, false, false, null, ROLE_ARN);
IamService iamService = mock(IamService.class);
- when(iamService.findRole(any(), any())).thenReturn(java.util.Optional.empty());
+ when(iamService.findRole(any(), any())).thenReturn(Optional.empty());
S3CopySimulator.S3TransferException error = assertThrows(
S3CopySimulator.S3TransferException.class,
@@ -252,7 +253,7 @@ class S3CopySimulatorTest {
IamService iamService = mock(IamService.class);
IamRole role = mock(IamRole.class);
when(iamService.findRole("000000000000", "CopyRole"))
- .thenReturn(java.util.Optional.of(role));
+ .thenReturn(Optional.of(role));
when(role.getAssumeRolePolicyDocument()).thenReturn(""
+ "{\"Statement\":[{\"Effect\":\"Allow\","
+ "\"Principal\":{\"Service\":\"lambda.amazonaws.com\"},"
@@ -274,7 +275,7 @@ class S3CopySimulatorTest {
"t", List.of(), "b", "k", "|", 0, false, false, null, ROLE_ARN);
IamService iamService = mock(IamService.class);
when(iamService.findRole(any(), any()))
- .thenReturn(java.util.Optional.of(mock(io.github.hectorvent.floci.services.iam.model.IamRole.class)));
+ .thenReturn(Optional.of(mock(IamRole.class)));
S3CopySimulator.CopyInput input = S3CopySimulator.prepareCopy(spec, s3, iamService);
@@ -296,7 +297,7 @@ class S3CopySimulatorTest {
"t", List.of(), "b", "k", "|", 0, false, false, null, ROLE_ARN);
IamService iamService = mock(IamService.class);
when(iamService.findRole(any(), any()))
- .thenReturn(java.util.Optional.of(mock(io.github.hectorvent.floci.services.iam.model.IamRole.class)));
+ .thenReturn(Optional.of(mock(IamRole.class)));
S3CopySimulator.CopyInput input = S3CopySimulator.prepareCopy(spec, s3, iamService);
S3CopySimulator.streamCopyInput(input, new ByteArrayOutputStream());
@@ -1415,7 +1416,7 @@ class S3CopySimulatorTest {
String ndjson = "{\"id\": 1, \"name\": \"Alice\"}\n";
ByteArrayOutputStream gzippedOut = new ByteArrayOutputStream();
- try (java.util.zip.GZIPOutputStream gzip = new java.util.zip.GZIPOutputStream(gzippedOut)) {
+ try (GZIPOutputStream gzip = new GZIPOutputStream(gzippedOut)) {
gzip.write(ndjson.getBytes(StandardCharsets.UTF_8));
}
@@ -1537,7 +1538,7 @@ class S3CopySimulatorTest {
IamRole role = mock(IamRole.class);
when(role.getAssumeRolePolicyDocument()).thenReturn(
"{\"Statement\":[{\"Effect\":\"Allow\",\"Principal\":{\"Service\":\"redshift.amazonaws.com\"}}]}");
- when(iamService.findRole("000000000000", "Role")).thenReturn(java.util.Optional.of(role));
+ when(iamService.findRole("000000000000", "Role")).thenReturn(Optional.of(role));
CopyStatementParser.S3CopyFrom spec = new CopyStatementParser.S3CopyFrom(
"missing_table", List.of(), "wh", "data.json", null, 0, false, false, null,
diff --git a/src/test/java/io/github/hectorvent/floci/services/redshiftdata/RedshiftDataApiIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/redshiftdata/RedshiftDataApiIntegrationTest.java
index 951e074801..a4acc99808 100644
--- a/src/test/java/io/github/hectorvent/floci/services/redshiftdata/RedshiftDataApiIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/redshiftdata/RedshiftDataApiIntegrationTest.java
@@ -3,6 +3,8 @@ package io.github.hectorvent.floci.services.redshiftdata;
import io.github.hectorvent.floci.services.redshift.RedshiftService;
import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
import io.quarkus.test.junit.QuarkusTest;
+import io.restassured.response.ExtractableResponse;
+import io.restassured.response.Response;
import jakarta.inject.Inject;
import org.awaitility.Awaitility;
import org.junit.jupiter.api.AfterAll;
@@ -92,7 +94,7 @@ class RedshiftDataApiIntegrationTest {
assertEquals(2, asInt(insertRows));
String selectId = executeAndWait("SELECT id, name FROM t ORDER BY id");
- var result = RestAssuredJsonUtils.awsAction("RedshiftData", "GetStatementResult",
+ ExtractableResponse<Response> result = RestAssuredJsonUtils.awsAction("RedshiftData", "GetStatementResult",
"{\"Id\":\"" + selectId + "\"}").then().statusCode(200).extract();
assertEquals(2, asInt(result.path("TotalNumRows")));
assertEquals("id", result.path("ColumnMetadata[0].name"));
diff --git a/src/test/java/io/github/hectorvent/floci/services/redshiftdata/RedshiftDataColumnMetadataTest.java b/src/test/java/io/github/hectorvent/floci/services/redshiftdata/RedshiftDataColumnMetadataTest.java
index fa1a5f7d84..53b365d6b7 100644
--- a/src/test/java/io/github/hectorvent/floci/services/redshiftdata/RedshiftDataColumnMetadataTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/redshiftdata/RedshiftDataColumnMetadataTest.java
@@ -1,6 +1,7 @@
package io.github.hectorvent.floci.services.redshiftdata;
import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.ArrayNode;
import org.h2.Driver;
import org.junit.jupiter.api.Test;
@@ -31,7 +32,7 @@ class RedshiftDataColumnMetadataTest {
try (ResultSet rs = st.executeQuery("select id as id, name as name from t")) {
ArrayNode columns = RedshiftDataColumnMetadata.toColumnMetadata(om, rs.getMetaData());
assertEquals(2, columns.size());
- var id = columns.get(0);
+ JsonNode id = columns.get(0);
assertEquals("ID", id.get("name").asText().toUpperCase());
assertTrue(id.has("label"));
assertTrue(id.has("typeName"));
diff --git a/src/test/java/io/github/hectorvent/floci/services/redshiftdata/RedshiftDataServiceTest.java b/src/test/java/io/github/hectorvent/floci/services/redshiftdata/RedshiftDataServiceTest.java
index 0b2315dd39..b23e164403 100644
--- a/src/test/java/io/github/hectorvent/floci/services/redshiftdata/RedshiftDataServiceTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/redshiftdata/RedshiftDataServiceTest.java
@@ -1,6 +1,7 @@
package io.github.hectorvent.floci.services.redshiftdata;
import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.node.ArrayNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
import io.github.hectorvent.floci.core.common.AwsException;
import org.h2.Driver;
@@ -155,7 +156,7 @@ class RedshiftDataServiceTest {
r.put("ClusterIdentifier", "wh");
r.put("DbUser", "admin");
r.put("Database", "dev");
- var array = r.putArray("Sqls");
+ ArrayNode array = r.putArray("Sqls");
for (String sql : sqls) {
array.add(sql);
}
diff --git a/src/test/java/io/github/hectorvent/floci/services/redshiftdata/RedshiftDataSqlParametersTest.java b/src/test/java/io/github/hectorvent/floci/services/redshiftdata/RedshiftDataSqlParametersTest.java
index 349129abb6..ef3702c39c 100644
--- a/src/test/java/io/github/hectorvent/floci/services/redshiftdata/RedshiftDataSqlParametersTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/redshiftdata/RedshiftDataSqlParametersTest.java
@@ -1,6 +1,7 @@
package io.github.hectorvent.floci.services.redshiftdata;
import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.node.ArrayNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
import io.github.hectorvent.floci.core.common.AwsException;
import io.github.hectorvent.floci.core.common.SqlParameterParser.ParsedSql;
@@ -72,7 +73,7 @@ class RedshiftDataSqlParametersTest {
@Test
void parseParametersReadsNameValueObjectsAndRejectsDuplicates() {
ObjectNode request = om.createObjectNode();
- var params = request.putArray("Parameters");
+ ArrayNode params = request.putArray("Parameters");
params.addObject().put("name", "id").put("value", "1");
params.addObject().put("name", "id").put("value", "2");
AwsException e = assertThrows(AwsException.class,