Skip to content

Commit

Permalink
update configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
agrgr committed Sep 25, 2024
1 parent 6be772c commit 13a2f22
Show file tree
Hide file tree
Showing 11 changed files with 24 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
* @author Anastasiia Smirnova
*/
@AutoConfiguration
@ConditionalOnClass(AerospikeClient.class)
@ConditionalOnClass(IAerospikeClient.class)
@ConditionalOnProperty("spring.aerospike.hosts")
@EnableConfigurationProperties(AerospikeProperties.class)
public class AerospikeAutoConfiguration {
Expand Down Expand Up @@ -85,7 +85,7 @@ public ClientPolicy aerospikeClientPolicy(AerospikeProperties properties,
return clientPolicy;
}

@ConditionalOnClass({AerospikeReactorClient.class, Flux.class})
@ConditionalOnClass({IAerospikeReactorClient.class, Flux.class})
public static class AerospikeReactiveAutoConfiguration {

@Bean(name = "aerospikeReactorClient", destroyMethod = "")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
import org.springframework.boot.autoconfigure.domain.EntityScanner;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.data.aerospike.cache.AerospikeCacheKeyProcessor;
import org.springframework.data.aerospike.cache.AerospikeCacheKeyProcessorImpl;
import org.springframework.data.aerospike.config.AerospikeConnectionSettings;
import org.springframework.data.aerospike.config.AerospikeDataSettings;
import org.springframework.data.aerospike.config.AerospikeSettings;
Expand Down Expand Up @@ -75,11 +73,6 @@ public IndexesCacheHolder aerospikeIndexCache() {
return new IndexesCacheHolder();
}

@Bean(name = "aerospikeCacheKeyProcessor")
public AerospikeCacheKeyProcessor cacheKeyProcessor() {
return new AerospikeCacheKeyProcessorImpl();
}

@Bean(name = "mappingAerospikeConverter")
@ConditionalOnMissingBean(name = "mappingAerospikeConverter")
public MappingAerospikeConverter mappingAerospikeConverter(AerospikeMappingContext aerospikeMappingContext,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

package org.springframework.boot.autoconfigure.data.aerospike;

import com.aerospike.client.AerospikeClient;
import com.aerospike.client.IAerospikeClient;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
Expand All @@ -39,8 +38,8 @@
@AutoConfiguration
// match only if we do not have reactive client
// we want sync context to be loaded when only sync client is on classpath
@ConditionalOnMissingClass("com.aerospike.client.reactor.AerospikeReactorClient")
@ConditionalOnClass({AerospikeClient.class, AerospikeRepository.class})
@ConditionalOnMissingClass("com.aerospike.client.reactor.IAerospikeReactorClient")
@ConditionalOnClass({IAerospikeClient.class, AerospikeRepository.class})
@ConditionalOnSingleCandidate(IAerospikeClient.class)
@ConditionalOnProperty("spring.data.aerospike.namespace")
@EnableConfigurationProperties(AerospikeDataProperties.class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

package org.springframework.boot.autoconfigure.data.aerospike;

import com.aerospike.client.reactor.AerospikeReactorClient;
import com.aerospike.client.reactor.IAerospikeReactorClient;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
Expand All @@ -36,8 +36,8 @@
* @author Anastasiia Smirnova
*/
@AutoConfiguration
@ConditionalOnClass({AerospikeReactorClient.class, ReactiveAerospikeRepository.class, Flux.class})
@ConditionalOnSingleCandidate(AerospikeReactorClient.class)
@ConditionalOnClass({IAerospikeReactorClient.class, ReactiveAerospikeRepository.class, Flux.class})
@ConditionalOnSingleCandidate(IAerospikeReactorClient.class)
@ConditionalOnProperty("spring.data.aerospike.namespace")
@AutoConfigureAfter(AerospikeAutoConfiguration.class)
@EnableConfigurationProperties(AerospikeDataProperties.class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

package org.springframework.boot.autoconfigure.data.aerospike;

import com.aerospike.client.reactor.AerospikeReactorClient;
import com.aerospike.client.reactor.IAerospikeReactorClient;
import org.springframework.beans.factory.ObjectProvider;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
Expand Down Expand Up @@ -53,7 +53,7 @@ public ReactiveAerospikeTemplate reactiveAerospikeTemplate(MappingAerospikeConve
AerospikeDataProperties aerospikeDataProperties,
AerospikeMappingContext aerospikeMappingContext,
AerospikeExceptionTranslator aerospikeExceptionTranslator,
AerospikeReactorClient aerospikeReactorClient,
IAerospikeReactorClient aerospikeReactorClient,
ReactorQueryEngine reactorQueryEngine,
ReactorIndexRefresher reactorIndexRefresher,
ServerVersionSupport serverVersionSupport) {
Expand All @@ -64,7 +64,7 @@ public ReactiveAerospikeTemplate reactiveAerospikeTemplate(MappingAerospikeConve

@Bean(name = "reactiveAerospikeQueryEngine")
@ConditionalOnMissingBean(name = "reactiveAerospikeQueryEngine")
public ReactorQueryEngine reactiveAerospikeQueryEngine(AerospikeReactorClient aerospikeReactorClient,
public ReactorQueryEngine reactiveAerospikeQueryEngine(IAerospikeReactorClient aerospikeReactorClient,
AerospikeDataProperties aerospikeDataProperties,
FilterExpressionsBuilder filterExpressionsBuilder,
StatementBuilder statementBuilder,
Expand All @@ -78,7 +78,7 @@ public ReactorQueryEngine reactiveAerospikeQueryEngine(AerospikeReactorClient ae

@Bean(name = "reactiveAerospikeIndexRefresher")
@ConditionalOnMissingBean(name = "reactiveAerospikeIndexRefresher")
public ReactorIndexRefresher reactiveAerospikeIndexRefresher(AerospikeReactorClient aerospikeReactorClient,
public ReactorIndexRefresher reactiveAerospikeIndexRefresher(IAerospikeReactorClient aerospikeReactorClient,
IndexesCacheUpdater indexesCacheUpdater,
ServerVersionSupport serverVersionSupport) {
ReactorIndexRefresher refresher = new ReactorIndexRefresher(aerospikeReactorClient, aerospikeReactorClient.getInfoPolicyDefault(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

package org.springframework.boot.autoconfigure.data.aerospike;

import com.aerospike.client.reactor.AerospikeReactorClient;
import com.aerospike.client.reactor.IAerospikeReactorClient;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
Expand All @@ -34,7 +34,7 @@
* @author Igor Ermolenko
*/
@AutoConfiguration
@ConditionalOnClass({AerospikeReactorClient.class, ReactiveAerospikeRepository.class, Flux.class})
@ConditionalOnClass({IAerospikeReactorClient.class, ReactiveAerospikeRepository.class, Flux.class})
@ConditionalOnRepositoryType(store = "aerospike", type = RepositoryType.REACTIVE)
@ConditionalOnMissingBean(ReactiveAerospikeRepositoryFactoryBean.class)
@Import(AerospikeReactiveRepositoriesRegistrar.class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

package org.springframework.boot.autoconfigure.data.aerospike;

import com.aerospike.client.AerospikeClient;
import com.aerospike.client.IAerospikeClient;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
Expand All @@ -33,7 +33,7 @@
* @author Igor Ermolenko
*/
@AutoConfiguration
@ConditionalOnClass({AerospikeClient.class, ReactiveAerospikeRepository.class})
@ConditionalOnClass({IAerospikeClient.class, ReactiveAerospikeRepository.class})
@ConditionalOnRepositoryType(store = "aerospike", type = RepositoryType.IMPERATIVE)
@ConditionalOnMissingBean(AerospikeRepositoryFactoryBean.class)
@Import(AerospikeRepositoriesRegistrar.class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
package org.springframework.boot.autoconfigure.data.aerospike;

import com.aerospike.client.AerospikeClient;
import com.aerospike.client.reactor.AerospikeReactorClient;
import com.aerospike.client.reactor.IAerospikeReactorClient;
import org.junit.jupiter.api.Test;
import org.springframework.boot.autoconfigure.AutoConfigurations;
import org.springframework.boot.autoconfigure.aerospike.AerospikeAutoConfiguration;
Expand Down Expand Up @@ -49,7 +49,7 @@
public class AerospikeDataAutoConfigurationTest {

private final ApplicationContextRunner contextRunner = new ApplicationContextRunner()
.withClassLoader(new FilteredClassLoader(AerospikeReactorClient.class))
.withClassLoader(new FilteredClassLoader(IAerospikeReactorClient.class))
.withConfiguration(AutoConfigurations.of(
AerospikeAutoConfiguration.class, AerospikeDataAutoConfiguration.class));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

package org.springframework.boot.autoconfigure.data.aerospike;

import com.aerospike.client.AerospikeClient;
import com.aerospike.client.IAerospikeClient;
import org.junit.jupiter.api.Test;
import org.springframework.boot.autoconfigure.AutoConfigurations;
import org.springframework.boot.autoconfigure.aerospike.AerospikeAutoConfiguration;
Expand Down Expand Up @@ -52,7 +52,7 @@ public class AerospikeReactiveDataAutoConfigurationTest {
@Test
public void aerospikeTemplateAndClientAreNotSetupWhenNeitherClientNorDataPropertiesConfigured() {
contextRunner.run(context -> {
assertThat(context).doesNotHaveBean(AerospikeClient.class);
assertThat(context).doesNotHaveBean(IAerospikeClient.class);
assertThat(context).doesNotHaveBean(AerospikeTemplate.class);
assertThat(context).doesNotHaveBean(ReactiveAerospikeTemplate.class);
assertThat(context).doesNotHaveBean(AerospikeDataProperties.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,7 @@ void savesAndGets() {
.assertThat()
.statusCode(200)
.body("id", equalTo("andrea"))
.body("age", equalTo(61))
;
.body("age", equalTo(61));
}

@Order(2)
Expand All @@ -82,7 +81,6 @@ void savesAndFindsByLastName() {
.assertThat()
.statusCode(200)
.body("[0].id", equalTo("andrea"))
.body("[0].age", equalTo(61))
;
.body("[0].age", equalTo(61));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,7 @@

import io.restassured.RestAssured;
import io.restassured.http.ContentType;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.MethodOrderer;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestMethodOrder;
import org.junit.jupiter.api.*;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.web.server.LocalServerPort;

Expand Down Expand Up @@ -66,8 +61,7 @@ void savesAndGets() {
.assertThat()
.statusCode(200)
.body("id", equalTo("andrea"))
.body("age", equalTo(61))
;
.body("age", equalTo(61));
}

@Order(2)
Expand All @@ -87,8 +81,6 @@ void savesAndFindsByLastName() {
.assertThat()
.statusCode(200)
.body("[0].id", equalTo("andrea"))
.body("[0].age", equalTo(61))
;
.body("[0].age", equalTo(61));
}

}

0 comments on commit 13a2f22

Please sign in to comment.