diff --git a/modules/extensions/galasa-extensions-parent/dev.galasa.cps.etcd/bnd.bnd b/modules/extensions/galasa-extensions-parent/dev.galasa.cps.etcd/bnd.bnd index cc26a1e8c..f96024132 100644 --- a/modules/extensions/galasa-extensions-parent/dev.galasa.cps.etcd/bnd.bnd +++ b/modules/extensions/galasa-extensions-parent/dev.galasa.cps.etcd/bnd.bnd @@ -17,15 +17,15 @@ Embed-Dependency: *;scope=compile|runtime checker-qual-*.jar; lib:=true,\ failsafe-*.jar; lib:=true,\ failureaccess-*.jar; lib:=true,\ - grpc-api-1.66.0.jar; lib:=true,\ - grpc-context-1.66.0.jar; lib:=true,\ - grpc-core-1.66.0.jar; lib:=true,\ - grpc-grpclb-1.66.0.jar; lib:=true,\ - grpc-netty-1.66.0.jar; lib:=true,\ - grpc-protobuf-1.66.0.jar; lib:=true,\ - grpc-protobuf-lite-1.66.0.jar; lib:=true,\ - grpc-stub-1.66.0.jar; lib:=true,\ - grpc-util-1.66.0.jar; lib:=true,\ + grpc-api-1.76.0.jar; lib:=true,\ + grpc-context-1.76.0.jar; lib:=true,\ + grpc-core-1.76.0.jar; lib:=true,\ + grpc-grpclb-1.76.0.jar; lib:=true,\ + grpc-netty-1.76.0.jar; lib:=true,\ + grpc-protobuf-1.76.0.jar; lib:=true,\ + grpc-protobuf-lite-1.76.0.jar; lib:=true,\ + grpc-stub-1.76.0.jar; lib:=true,\ + grpc-util-1.76.0.jar; lib:=true,\ gson-*.jar; lib:=true,\ guava-*.jar; lib:=true,\ jackson-core-*.jar; lib:=true,\ @@ -49,10 +49,10 @@ Embed-Dependency: *;scope=compile|runtime netty-transport-*.jar; lib:=true,\ netty-transport-native-unix-common-*.jar; lib:=true,\ perfmark-api-0.27.0.jar; lib:=true,\ - proto-google-common-protos-2.41.0.jar; lib:=true,\ - protobuf-java-3.25.3.jar; lib:=true,\ + proto-google-common-protos-2.59.2.jar; lib:=true,\ + protobuf-java-3.25.8.jar; lib:=true,\ protobuf-java-util-*.jar; lib:=true,\ - slf4j-api-2.0.16.jar; lib:=true,\ + slf4j-api-2.0.17.jar; lib:=true,\ validation-api-*.jar; lib:=true,\ vertx-core-*.jar; lib:=true,\ vertx-grpc-*.jar; lib:=true diff --git a/modules/extensions/galasa-extensions-parent/dev.galasa.cps.etcd/build.gradle b/modules/extensions/galasa-extensions-parent/dev.galasa.cps.etcd/build.gradle index 41ab24c8d..a79d63c44 100644 --- a/modules/extensions/galasa-extensions-parent/dev.galasa.cps.etcd/build.gradle +++ b/modules/extensions/galasa-extensions-parent/dev.galasa.cps.etcd/build.gradle @@ -15,26 +15,26 @@ dependencies { // Not required for compile, but required to force the download of the jars to embed by bnd implementation('com.fasterxml.jackson.core:jackson-core') - implementation('com.google.api.grpc:proto-google-common-protos:2.41.0') + implementation('com.google.api.grpc:proto-google-common-protos:2.59.2') implementation('com.google.guava:failureaccess') implementation('com.google.guava:guava') implementation('com.google.guava:listenablefuture') implementation('com.google.protobuf:protobuf-java-util') - implementation('com.google.protobuf:protobuf-java:3.25.3') + implementation('com.google.protobuf:protobuf-java:3.25.8') implementation('dev.failsafe:failsafe') implementation('io.etcd:jetcd-api') implementation('io.etcd:jetcd-common') implementation('io.etcd:jetcd-core') implementation('io.etcd:jetcd-grpc') - implementation('io.grpc:grpc-api:1.66.0') - implementation('io.grpc:grpc-context:1.66.0') - implementation('io.grpc:grpc-core:1.66.0') - implementation('io.grpc:grpc-grpclb:1.66.0') - implementation('io.grpc:grpc-netty:1.66.0') - implementation('io.grpc:grpc-protobuf-lite:1.66.0') - implementation('io.grpc:grpc-protobuf:1.66.0') - implementation('io.grpc:grpc-stub:1.66.0') - implementation('io.grpc:grpc-util:1.66.0') + implementation('io.grpc:grpc-api:1.76.0') + implementation('io.grpc:grpc-context:1.76.0') + implementation('io.grpc:grpc-core:1.76.0') + implementation('io.grpc:grpc-grpclb:1.76.0') + implementation('io.grpc:grpc-netty:1.76.0') + implementation('io.grpc:grpc-protobuf-lite:1.76.0') + implementation('io.grpc:grpc-protobuf:1.76.0') + implementation('io.grpc:grpc-stub:1.76.0') + implementation('io.grpc:grpc-util:1.76.0') implementation('io.netty:netty-buffer') implementation('io.netty:netty-codec-dns') implementation('io.netty:netty-codec-http2') @@ -58,7 +58,7 @@ dependencies { // implementation('org.apache.logging.log4j:log4j-core:2.17.1') // implementation('org.apache.logging.log4j:log4j-slf4j-impl:2.17.1') implementation('org.checkerframework:checker-qual') - implementation('org.slf4j:slf4j-api:2.0.16') + implementation('org.slf4j:slf4j-api:2.0.17') } // Note: These values are consumed by the parent build process diff --git a/modules/extensions/galasa-extensions-parent/dev.galasa.cps.etcd/src/main/java/dev/galasa/cps/etcd/internal/Etcd3ConfigurationPropertyStore.java b/modules/extensions/galasa-extensions-parent/dev.galasa.cps.etcd/src/main/java/dev/galasa/cps/etcd/internal/Etcd3ConfigurationPropertyStore.java index b589a7196..4c8be9b1e 100644 --- a/modules/extensions/galasa-extensions-parent/dev.galasa.cps.etcd/src/main/java/dev/galasa/cps/etcd/internal/Etcd3ConfigurationPropertyStore.java +++ b/modules/extensions/galasa-extensions-parent/dev.galasa.cps.etcd/src/main/java/dev/galasa/cps/etcd/internal/Etcd3ConfigurationPropertyStore.java @@ -5,7 +5,7 @@ */ package dev.galasa.cps.etcd.internal; -import static com.google.common.base.Charsets.UTF_8; +import static java.nio.charset.StandardCharsets.UTF_8; import java.net.URI; import java.nio.charset.StandardCharsets; @@ -136,7 +136,7 @@ public void deleteProperty(@NotNull String key) throws ConfigurationPropertyStor public void deletePrefixedProperties(@NotNull String prefix) throws ConfigurationPropertyStoreException { try { - deletePrefix(prefix); + deletePropertiesWithPrefix(prefix); } catch (InterruptedException | ExecutionException e) { Thread.currentThread().interrupt(); throw new ConfigurationPropertyStoreException("Failed to delete properties", e); diff --git a/modules/extensions/galasa-extensions-parent/dev.galasa.cps.etcd/src/main/java/dev/galasa/cps/etcd/internal/Etcd3CredentialsStore.java b/modules/extensions/galasa-extensions-parent/dev.galasa.cps.etcd/src/main/java/dev/galasa/cps/etcd/internal/Etcd3CredentialsStore.java index dd5e9e9b5..17e987d46 100644 --- a/modules/extensions/galasa-extensions-parent/dev.galasa.cps.etcd/src/main/java/dev/galasa/cps/etcd/internal/Etcd3CredentialsStore.java +++ b/modules/extensions/galasa-extensions-parent/dev.galasa.cps.etcd/src/main/java/dev/galasa/cps/etcd/internal/Etcd3CredentialsStore.java @@ -90,7 +90,7 @@ public Etcd3CredentialsStore(SecretKeySpec key, IEncryptionService encryptionSer public ICredentials getCredentials(String credentialsId) throws CredentialsException { ICredentials credentials = null; try { - Map credentialsProperties = getPrefix(CREDS_PROPERTY_PREFIX + credentialsId); + Map credentialsProperties = getPropertiesWithPrefix(CREDS_PROPERTY_PREFIX + credentialsId); credentials = convertPropertiesIntoCredentials(credentialsProperties, credentialsId); } catch (InterruptedException | ExecutionException e) { @@ -133,7 +133,7 @@ public void setCredentials(String credentialsId, ICredentials credentials) throw @Override public void deleteCredentials(String credentialsId) throws CredentialsException { try { - deletePrefix(CREDS_PROPERTY_PREFIX + credentialsId); + deletePropertiesWithPrefix(CREDS_PROPERTY_PREFIX + credentialsId); } catch (InterruptedException | ExecutionException e) { Thread.currentThread().interrupt(); throw new CredentialsException("Failed to delete credentials", e); @@ -144,7 +144,7 @@ public void deleteCredentials(String credentialsId) throws CredentialsException public Map getAllCredentials() throws CredentialsException { Map credentials = new HashMap<>(); try { - Map credentialsKeyValues = getPrefix(CREDS_PROPERTY_PREFIX); + Map credentialsKeyValues = getPropertiesWithPrefix(CREDS_PROPERTY_PREFIX); // Build a set of all credential IDs stored in etcd Set> credentialsEntries = credentialsKeyValues.entrySet(); @@ -229,7 +229,7 @@ private void putAllProperties(Properties properties, boolean encryptValues) thro if (encryptValues) { value = encryptionService.encrypt(value); } - put(key, value); + putProperty(key, value); } } } diff --git a/modules/extensions/galasa-extensions-parent/dev.galasa.cps.etcd/src/main/java/dev/galasa/cps/etcd/internal/Etcd3DynamicStatusStore.java b/modules/extensions/galasa-extensions-parent/dev.galasa.cps.etcd/src/main/java/dev/galasa/cps/etcd/internal/Etcd3DynamicStatusStore.java index 78f8b7d97..daa10f183 100644 --- a/modules/extensions/galasa-extensions-parent/dev.galasa.cps.etcd/src/main/java/dev/galasa/cps/etcd/internal/Etcd3DynamicStatusStore.java +++ b/modules/extensions/galasa-extensions-parent/dev.galasa.cps.etcd/src/main/java/dev/galasa/cps/etcd/internal/Etcd3DynamicStatusStore.java @@ -5,7 +5,7 @@ */ package dev.galasa.cps.etcd.internal; -import static com.google.common.base.Charsets.UTF_8; +import static java.nio.charset.StandardCharsets.UTF_8; import java.net.URI; import java.util.ArrayList; @@ -37,7 +37,6 @@ import dev.galasa.framework.spi.IDynamicStatusStoreWatcher.Event; import io.etcd.jetcd.ByteSequence; import io.etcd.jetcd.Client; -import io.etcd.jetcd.KV; import io.etcd.jetcd.KeyValue; import io.etcd.jetcd.Lease; import io.etcd.jetcd.Txn; @@ -67,9 +66,7 @@ * * @author James Davies */ -public class Etcd3DynamicStatusStore implements IDynamicStatusStore { - private final Client client; - private final KV kvClient; +public class Etcd3DynamicStatusStore extends Etcd3Store implements IDynamicStatusStore { private final Watch watchClient; private final Lease leaseClient; private Log logger = LogFactory.getLog(Etcd3DynamicStatusStore.class); @@ -88,12 +85,13 @@ public class Etcd3DynamicStatusStore implements IDynamicStatusStore { * @param dssUri - http:// uri for th etcd cluster. */ public Etcd3DynamicStatusStore(URI dssUri) { - this(Client.builder().endpoints(dssUri).build()); + super(dssUri); + this.watchClient = client.getWatchClient(); + this.leaseClient = client.getLeaseClient(); } public Etcd3DynamicStatusStore(Client client) { - this.client = client; - this.kvClient = client.getKVClient(); + super(client); this.watchClient = client.getWatchClient(); this.leaseClient = client.getLeaseClient(); } diff --git a/modules/extensions/galasa-extensions-parent/dev.galasa.cps.etcd/src/main/java/dev/galasa/cps/etcd/internal/Etcd3Store.java b/modules/extensions/galasa-extensions-parent/dev.galasa.cps.etcd/src/main/java/dev/galasa/cps/etcd/internal/Etcd3Store.java index 8aa25bd7c..1aef1f156 100644 --- a/modules/extensions/galasa-extensions-parent/dev.galasa.cps.etcd/src/main/java/dev/galasa/cps/etcd/internal/Etcd3Store.java +++ b/modules/extensions/galasa-extensions-parent/dev.galasa.cps.etcd/src/main/java/dev/galasa/cps/etcd/internal/Etcd3Store.java @@ -29,6 +29,9 @@ import io.etcd.jetcd.options.DeleteOption; import io.etcd.jetcd.options.GetOption; import io.etcd.jetcd.options.PutOption; +import io.vertx.core.Vertx; +import io.vertx.core.VertxOptions; +import io.vertx.core.file.FileSystemOptions; /** * Abstract class containing common methods used to interact with etcd, like getting, setting, @@ -45,10 +48,31 @@ public Etcd3Store(Client client) { } public Etcd3Store(URI etcdUri) { - this(Client.builder().endpoints(etcdUri).build()); + this(Client.builder() + .vertx(createVertx()) + .endpoints(etcdUri).build()); } - protected String get(String key) throws InterruptedException, ExecutionException { + /** + * Creates a Vertx instance to use when building the etcd client. + */ + private static Vertx createVertx() { + FileSystemOptions fileSystemOptions = new FileSystemOptions(); + + // By default, Vertx creates a cache directory ".vertx" which is typically used + // in web applications to serve content from jar files. Galasa doesn't use this, + // and it's causing OSGi wiring errors when the framework shuts down, so we're + // disabling this Vertx functionality here + fileSystemOptions.setClassPathResolvingEnabled(false); + fileSystemOptions.setFileCachingEnabled(false); + + VertxOptions vertxOptions = new VertxOptions(); + vertxOptions.setFileSystemOptions(fileSystemOptions); + + return Vertx.vertx(vertxOptions); + } + + protected String getPropertyByKey(String key) throws InterruptedException, ExecutionException { ByteSequence bsKey = ByteSequence.from(key, UTF_8); CompletableFuture getFuture = kvClient.get(bsKey); GetResponse response = getFuture.get(); @@ -61,7 +85,7 @@ protected String get(String key) throws InterruptedException, ExecutionException return retrievedKey; } - protected Map getPrefix(String keyPrefix) throws InterruptedException, ExecutionException { + protected Map getPropertiesWithPrefix(String keyPrefix) throws InterruptedException, ExecutionException { Map keyValues = new HashMap<>(); ByteSequence bsPrefix = ByteSequence.from(keyPrefix, UTF_8); @@ -83,7 +107,7 @@ protected Map getPrefix(String keyPrefix) throws InterruptedExce return keyValues; } - protected void put(String key, String value) throws InterruptedException, ExecutionException { + protected void putProperty(String key, String value) throws InterruptedException, ExecutionException { ByteSequence bytesKey = ByteSequence.from(key, UTF_8); ByteSequence bytesValue = ByteSequence.from(value, UTF_8); kvClient.put(bytesKey, bytesValue).get(); @@ -107,12 +131,12 @@ protected void putAll(Map propertiesToSet) throws InterruptedExc response.get(); } - protected void delete(@NotNull String key) throws InterruptedException, ExecutionException { + protected void deletePropertyByKey(@NotNull String key) throws InterruptedException, ExecutionException { ByteSequence bytesKey = ByteSequence.from(key, StandardCharsets.UTF_8); kvClient.delete(bytesKey).get(); } - protected void deletePrefix(@NotNull String keyPrefix) throws InterruptedException, ExecutionException { + protected void deletePropertiesWithPrefix(@NotNull String keyPrefix) throws InterruptedException, ExecutionException { ByteSequence bsKey = ByteSequence.from(keyPrefix, UTF_8); DeleteOption options = DeleteOption.builder().isPrefix(true).build(); kvClient.delete(bsKey, options).get(); diff --git a/modules/extensions/galasa-extensions-parent/dev.galasa.cps.etcd/src/test/java/dev/galasa/etcd/internal/mocks/MockEtcdKvClient.java b/modules/extensions/galasa-extensions-parent/dev.galasa.cps.etcd/src/test/java/dev/galasa/etcd/internal/mocks/MockEtcdKvClient.java index 56a13bf54..1bc969ed6 100644 --- a/modules/extensions/galasa-extensions-parent/dev.galasa.cps.etcd/src/test/java/dev/galasa/etcd/internal/mocks/MockEtcdKvClient.java +++ b/modules/extensions/galasa-extensions-parent/dev.galasa.cps.etcd/src/test/java/dev/galasa/etcd/internal/mocks/MockEtcdKvClient.java @@ -31,6 +31,7 @@ import io.etcd.jetcd.options.DeleteOption; import io.etcd.jetcd.options.GetOption; import io.etcd.jetcd.options.PutOption; +import io.etcd.jetcd.options.TxnOption; public class MockEtcdKvClient implements KV { @@ -154,4 +155,9 @@ public CompletableFuture compact(long key, CompactOption option public CompletableFuture delete(ByteSequence key) { throw new UnsupportedOperationException("Unimplemented method 'delete'"); } + + @Override + public Txn txn(TxnOption option) { + throw new UnsupportedOperationException("Unimplemented method 'txn'"); + } } diff --git a/modules/platform/dev.galasa.platform/build.gradle b/modules/platform/dev.galasa.platform/build.gradle index da13ab779..339e744b4 100644 --- a/modules/platform/dev.galasa.platform/build.gradle +++ b/modules/platform/dev.galasa.platform/build.gradle @@ -53,17 +53,17 @@ dependencies { api 'com.google.code.gson:gson:2.10.1' // If updating, also update in obr/release.yaml. - api 'com.google.errorprone:error_prone_annotations:2.28.0' + api 'com.google.errorprone:error_prone_annotations:2.41.0' // api 'com.google.protobuf:protobuf-java:4.28.3' - dangerous. Protobuf versions are all explicit elsewhere right now. api 'com.google.protobuf:protobuf-javalite:3.25.8' api 'com.google.protobuf:protobuf-java-util:3.25.3' - api 'com.google.guava:guava:33.2.1-jre' - api 'com.google.guava:failureaccess:1.0.2' + api 'com.google.guava:guava:33.5.0-jre' + api 'com.google.guava:failureaccess:1.0.3' api 'com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava' - api 'com.google.j2objc:j2objc-annotations:3.0.0' + api 'com.google.j2objc:j2objc-annotations:3.1' api 'com.ibm.db2.jcc:db2jcc:db2jcc4' @@ -112,10 +112,10 @@ dependencies { api 'dev.galasa:galasa-boot:'+version api 'dev.galasa:galasa-testharness:'+version - api 'io.etcd:jetcd-api:0.8.3' - api 'io.etcd:jetcd-common:0.8.3' - api 'io.etcd:jetcd-core:0.8.3' - api 'io.etcd:jetcd-grpc:0.8.3' + api 'io.etcd:jetcd-api:0.8.6' + api 'io.etcd:jetcd-common:0.8.6' + api 'io.etcd:jetcd-core:0.8.6' + api 'io.etcd:jetcd-grpc:0.8.6' api 'io.gsonfire:gson-fire:1.9.0' @@ -123,19 +123,19 @@ dependencies { api 'io.kubernetes:client-java-api:25.0.0' api 'io.kubernetes:client-java-proto:25.0.0' - api 'io.netty:netty-buffer:4.1.111.Final' - api 'io.netty:netty-codec:4.1.111.Final' - api 'io.netty:netty-codec-dns:4.1.111.Final' - api 'io.netty:netty-codec-http:4.1.111.Final' - api 'io.netty:netty-codec-http2:4.1.111.Final' - api 'io.netty:netty-codec-socks:4.1.111.Final' - api 'io.netty:netty-common:4.1.111.Final' - api 'io.netty:netty-handler:4.1.111.Final' - api 'io.netty:netty-handler-proxy:4.1.111.Final' - api 'io.netty:netty-resolver:4.1.111.Final' - api 'io.netty:netty-resolver-dns:4.1.111.Final' - api 'io.netty:netty-transport:4.1.111.Final' - api 'io.netty:netty-transport-native-unix-common:4.1.111.Final' + api 'io.netty:netty-buffer:4.1.124.Final' + api 'io.netty:netty-codec:4.1.124.Final' + api 'io.netty:netty-codec-dns:4.1.124.Final' + api 'io.netty:netty-codec-http:4.1.124.Final' + api 'io.netty:netty-codec-http2:4.1.124.Final' + api 'io.netty:netty-codec-socks:4.1.124.Final' + api 'io.netty:netty-common:4.1.124.Final' + api 'io.netty:netty-handler:4.1.124.Final' + api 'io.netty:netty-handler-proxy:4.1.124.Final' + api 'io.netty:netty-resolver:4.1.124.Final' + api 'io.netty:netty-resolver-dns:4.1.124.Final' + api 'io.netty:netty-transport:4.1.124.Final' + api 'io.netty:netty-transport-native-unix-common:4.1.124.Final' api 'io.opentelemetry:opentelemetry-api:1.44.1' api 'io.opentelemetry:opentelemetry-api-incubator:1.44.1-alpha' @@ -166,8 +166,8 @@ dependencies { api 'io.swagger.codegen.v3:swagger-codegen-cli:3.0.41' - api 'io.vertx:vertx-core:4.5.9' - api 'io.vertx:vertx-grpc:4.5.9' + api 'io.vertx:vertx-core:5.0.5' + api 'io.vertx:vertx-grpc:5.0.5' api 'jakarta.activation:jakarta.activation-api:2.1.3' @@ -259,7 +259,7 @@ dependencies { api 'org.bouncycastle:bcutil-jdk18on:1.82' api 'org.checkerframework:checker-qual:3.43.0' - api 'org.codehaus.mojo:animal-sniffer-annotations:1.23' + api 'org.codehaus.mojo:animal-sniffer-annotations:1.24' api 'org.codehaus.plexus:plexus-utils:3.0.24'