Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -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,\
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public Etcd3CredentialsStore(SecretKeySpec key, IEncryptionService encryptionSer
public ICredentials getCredentials(String credentialsId) throws CredentialsException {
ICredentials credentials = null;
try {
Map<String, String> credentialsProperties = getPrefix(CREDS_PROPERTY_PREFIX + credentialsId);
Map<String, String> credentialsProperties = getPropertiesWithPrefix(CREDS_PROPERTY_PREFIX + credentialsId);
credentials = convertPropertiesIntoCredentials(credentialsProperties, credentialsId);

} catch (InterruptedException | ExecutionException e) {
Expand Down Expand Up @@ -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);
Expand All @@ -144,7 +144,7 @@ public void deleteCredentials(String credentialsId) throws CredentialsException
public Map<String, ICredentials> getAllCredentials() throws CredentialsException {
Map<String, ICredentials> credentials = new HashMap<>();
try {
Map<String, String> credentialsKeyValues = getPrefix(CREDS_PROPERTY_PREFIX);
Map<String, String> credentialsKeyValues = getPropertiesWithPrefix(CREDS_PROPERTY_PREFIX);

// Build a set of all credential IDs stored in etcd
Set<Entry<String, String>> credentialsEntries = credentialsKeyValues.entrySet();
Expand Down Expand Up @@ -229,7 +229,7 @@ private void putAllProperties(Properties properties, boolean encryptValues) thro
if (encryptValues) {
value = encryptionService.encrypt(value);
}
put(key, value);
putProperty(key, value);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand All @@ -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();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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<GetResponse> getFuture = kvClient.get(bsKey);
GetResponse response = getFuture.get();
Expand All @@ -61,7 +85,7 @@ protected String get(String key) throws InterruptedException, ExecutionException
return retrievedKey;
}

protected Map<String, String> getPrefix(String keyPrefix) throws InterruptedException, ExecutionException {
protected Map<String, String> getPropertiesWithPrefix(String keyPrefix) throws InterruptedException, ExecutionException {
Map<String, String> keyValues = new HashMap<>();

ByteSequence bsPrefix = ByteSequence.from(keyPrefix, UTF_8);
Expand All @@ -83,7 +107,7 @@ protected Map<String, String> 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();
Expand All @@ -107,12 +131,12 @@ protected void putAll(Map<String, String> 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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down Expand Up @@ -154,4 +155,9 @@ public CompletableFuture<CompactResponse> compact(long key, CompactOption option
public CompletableFuture<DeleteResponse> delete(ByteSequence key) {
throw new UnsupportedOperationException("Unimplemented method 'delete'");
}

@Override
public Txn txn(TxnOption option) {
throw new UnsupportedOperationException("Unimplemented method 'txn'");
}
}
48 changes: 24 additions & 24 deletions modules/platform/dev.galasa.platform/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand Down Expand Up @@ -112,30 +112,30 @@ 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'

api 'io.kubernetes:client-java:25.0.0'
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'
Expand Down Expand Up @@ -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'

Expand Down Expand Up @@ -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'

Expand Down
Loading