From 7ac1734b3614e3d14f1972d3c27330b023a6e7ed Mon Sep 17 00:00:00 2001 From: Liz Chatman <113339341+echatman-ias@users.noreply.github.com> Date: Mon, 30 Jan 2023 09:51:13 -0800 Subject: [PATCH] Use IAerospikeReactorClient where possible instead of AerospikeReactorClient (#477) Co-authored-by: Eugene R --- .../reference/aerospike-reactive-repositories.adoc | 4 ++-- .../AbstractReactiveAerospikeDataConfiguration.java | 9 +++++---- .../data/aerospike/core/ReactiveAerospikeTemplate.java | 5 ++--- .../data/aerospike/BaseReactiveIntegrationTests.java | 4 ++-- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/main/asciidoc/reference/aerospike-reactive-repositories.adoc b/src/main/asciidoc/reference/aerospike-reactive-repositories.adoc index 4370bef20..9ed6925d6 100644 --- a/src/main/asciidoc/reference/aerospike-reactive-repositories.adoc +++ b/src/main/asciidoc/reference/aerospike-reactive-repositories.adoc @@ -150,12 +150,12 @@ public class ReactiveRepositoryExample { @Autowired ReactiveAerospikeOperations aerospikeOperations; @Autowired - AerospikeReactorClient client; + IAerospikeReactorClient client; public RepositoryExample(ApplicationContext ctx) { aerospikeOperations = ctx.getBean(ReactiveAerospikeTemplate.class); repository = (ReactivePersonRepository) ctx.getBean("reactivePersonRepository"); - client = ctx.getBean(AerospikeReactorClient.class); + client = ctx.getBean(IAerospikeReactorClient.class); } protected void setUp() { diff --git a/src/main/java/org/springframework/data/aerospike/config/AbstractReactiveAerospikeDataConfiguration.java b/src/main/java/org/springframework/data/aerospike/config/AbstractReactiveAerospikeDataConfiguration.java index 166d3cce7..82f09ae2c 100644 --- a/src/main/java/org/springframework/data/aerospike/config/AbstractReactiveAerospikeDataConfiguration.java +++ b/src/main/java/org/springframework/data/aerospike/config/AbstractReactiveAerospikeDataConfiguration.java @@ -19,6 +19,7 @@ import com.aerospike.client.async.EventLoops; import com.aerospike.client.policy.ClientPolicy; import com.aerospike.client.reactor.AerospikeReactorClient; +import com.aerospike.client.reactor.IAerospikeReactorClient; import org.springframework.beans.factory.ObjectProvider; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -49,14 +50,14 @@ public abstract class AbstractReactiveAerospikeDataConfiguration extends Aerospi public ReactiveAerospikeTemplate reactiveAerospikeTemplate(MappingAerospikeConverter mappingAerospikeConverter, AerospikeMappingContext aerospikeMappingContext, AerospikeExceptionTranslator aerospikeExceptionTranslator, - AerospikeReactorClient aerospikeReactorClient, + IAerospikeReactorClient aerospikeReactorClient, ReactorQueryEngine reactorQueryEngine, ReactorIndexRefresher reactorIndexRefresher) { return new ReactiveAerospikeTemplate(aerospikeReactorClient, nameSpace(), mappingAerospikeConverter, aerospikeMappingContext, aerospikeExceptionTranslator, reactorQueryEngine, reactorIndexRefresher); } @Bean(name = "reactiveAerospikeQueryEngine") - public ReactorQueryEngine reactorQueryEngine(AerospikeReactorClient aerospikeReactorClient, + public ReactorQueryEngine reactorQueryEngine(IAerospikeReactorClient aerospikeReactorClient, StatementBuilder statementBuilder, FilterExpressionsBuilder filterExpressionsBuilder) { ReactorQueryEngine queryEngine = new ReactorQueryEngine(aerospikeReactorClient, statementBuilder, filterExpressionsBuilder, aerospikeReactorClient.getQueryPolicyDefault()); @@ -65,7 +66,7 @@ public ReactorQueryEngine reactorQueryEngine(AerospikeReactorClient aerospikeRea } @Bean(name = "reactiveAerospikeIndexRefresher") - public ReactorIndexRefresher reactorIndexRefresher(AerospikeReactorClient aerospikeReactorClient, IndexesCacheUpdater indexesCacheUpdater) { + public ReactorIndexRefresher reactorIndexRefresher(IAerospikeReactorClient aerospikeReactorClient, IndexesCacheUpdater indexesCacheUpdater) { ReactorIndexRefresher refresher = new ReactorIndexRefresher(aerospikeReactorClient, aerospikeReactorClient.getInfoPolicyDefault(), new InternalIndexOperations(new IndexInfoParser()), indexesCacheUpdater); refresher.refreshIndexes().block(); @@ -73,7 +74,7 @@ public ReactorIndexRefresher reactorIndexRefresher(AerospikeReactorClient aerosp } @Bean(name = "aerospikeReactorClient") - public AerospikeReactorClient aerospikeReactorClient(IAerospikeClient aerospikeClient) { + public IAerospikeReactorClient aerospikeReactorClient(IAerospikeClient aerospikeClient) { return new AerospikeReactorClient(aerospikeClient); } diff --git a/src/main/java/org/springframework/data/aerospike/core/ReactiveAerospikeTemplate.java b/src/main/java/org/springframework/data/aerospike/core/ReactiveAerospikeTemplate.java index 4f5af11d2..18cad545d 100644 --- a/src/main/java/org/springframework/data/aerospike/core/ReactiveAerospikeTemplate.java +++ b/src/main/java/org/springframework/data/aerospike/core/ReactiveAerospikeTemplate.java @@ -25,7 +25,6 @@ import com.aerospike.client.query.IndexCollectionType; import com.aerospike.client.query.IndexType; import com.aerospike.client.query.KeyRecord; -import com.aerospike.client.reactor.AerospikeReactorClient; import com.aerospike.client.reactor.IAerospikeReactorClient; import lombok.extern.slf4j.Slf4j; import org.springframework.data.aerospike.convert.AerospikeWriteData; @@ -63,11 +62,11 @@ @Slf4j public class ReactiveAerospikeTemplate extends BaseAerospikeTemplate implements ReactiveAerospikeOperations { - private final AerospikeReactorClient reactorClient; + private final IAerospikeReactorClient reactorClient; private final ReactorQueryEngine queryEngine; private final ReactorIndexRefresher reactorIndexRefresher; - public ReactiveAerospikeTemplate(AerospikeReactorClient reactorClient, + public ReactiveAerospikeTemplate(IAerospikeReactorClient reactorClient, String namespace, MappingAerospikeConverter converter, AerospikeMappingContext mappingContext, diff --git a/src/test/java/org/springframework/data/aerospike/BaseReactiveIntegrationTests.java b/src/test/java/org/springframework/data/aerospike/BaseReactiveIntegrationTests.java index 214c32bd0..769957011 100644 --- a/src/test/java/org/springframework/data/aerospike/BaseReactiveIntegrationTests.java +++ b/src/test/java/org/springframework/data/aerospike/BaseReactiveIntegrationTests.java @@ -1,6 +1,6 @@ package org.springframework.data.aerospike; -import com.aerospike.client.reactor.AerospikeReactorClient; +import com.aerospike.client.reactor.IAerospikeReactorClient; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.data.aerospike.config.CommonTestConfig; @@ -22,7 +22,7 @@ public abstract class BaseReactiveIntegrationTests extends BaseIntegrationTests @Autowired protected ReactiveAerospikeTemplate reactiveTemplate; @Autowired - protected AerospikeReactorClient reactorClient; + protected IAerospikeReactorClient reactorClient; protected T findById(Serializable id, Class type) { return reactiveTemplate.findById(id, type).block();