Skip to content

Commit

Permalink
add a test
Browse files Browse the repository at this point in the history
  • Loading branch information
agrgr committed Sep 25, 2024
1 parent 13a2f22 commit 6c47dd4
Showing 1 changed file with 33 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@
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 com.aerospike.client.reactor.retry.AerospikeReactorRetryClient;
import org.junit.jupiter.api.Test;
import org.springframework.boot.autoconfigure.AutoConfigurations;
import org.springframework.boot.autoconfigure.aerospike.AerospikeAutoConfiguration;
Expand Down Expand Up @@ -151,4 +153,35 @@ public void configurationIsApplied() {
assertThat(context).hasSingleBean(AerospikeMappingContext.class);
});
}

@Test
public void dataConfigurationIsNotAppliedWithBothClients() {
contextRunner
.withPropertyValues("spring.aerospike.hosts=localhost:3000")
.withPropertyValues("spring.data.aerospike.namespace=TEST")
.withUserConfiguration(AerospikeClientMockConfiguration.class,
AerospikeServerVersionSupportMockConfiguration.class)
.withClassLoader(AerospikeReactorClient.class.getClassLoader())
.run(context -> {
assertThat(context).doesNotHaveBean(ReactiveAerospikeTemplate.class);
assertThat(context).doesNotHaveBean(AerospikeTemplate.class);
assertThat(context).doesNotHaveBean(AerospikeDataProperties.class);
assertThat(context).hasSingleBean(AerospikeProperties.class);
assertThat(context).doesNotHaveBean(AerospikeMappingContext.class);
});

contextRunner
.withPropertyValues("spring.aerospike.hosts=localhost:3000")
.withPropertyValues("spring.data.aerospike.namespace=TEST")
.withUserConfiguration(AerospikeClientMockConfiguration.class,
AerospikeServerVersionSupportMockConfiguration.class)
.withClassLoader(AerospikeReactorRetryClient.class.getClassLoader())
.run(context -> {
assertThat(context).doesNotHaveBean(ReactiveAerospikeTemplate.class);
assertThat(context).doesNotHaveBean(AerospikeTemplate.class);
assertThat(context).doesNotHaveBean(AerospikeDataProperties.class);
assertThat(context).hasSingleBean(AerospikeProperties.class);
assertThat(context).doesNotHaveBean(AerospikeMappingContext.class);
});
}
}

0 comments on commit 6c47dd4

Please sign in to comment.