Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FMWK-356 Update dependencies and version number #235

Merged
merged 5 commits into from
Mar 21, 2024
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
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:

# See: https://github.com/actions/cache/blob/master/examples.md#java---maven
- name: Maven cache and restore deps
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-drafter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ jobs:
update_release_draft:
runs-on: ubuntu-latest
steps:
- uses: release-drafter/release-drafter@v5
- uses: release-drafter/release-drafter@v6
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5 changes: 5 additions & 0 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ image:https://github.com/aerospike-community/spring-data-aerospike-starters/work

|===
|`spring-data-aerospike-starters` |`spring-data-aerospike` |`aerospike-client` |`aerospike-reactor-client`
|0.14.x
|4.7.x
|7.2.x
|7.1.x

|0.13.x
|4.6.x
|7.2.x
Expand Down
13 changes: 7 additions & 6 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>3.2.0</version>
<version>3.2.3</version>
</parent>

<groupId>com.aerospike</groupId>
Expand All @@ -31,20 +31,21 @@
</modules>

<properties>
<revision>0.13.0</revision>
<revision>0.14.0</revision>
<java.version>17</java.version>
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<maven.gpg.plugin.version>1.6</maven.gpg.plugin.version>
<flatten.maven.plugin.version>1.5.0</flatten.maven.plugin.version>
<flatten.maven.plugin.version>1.6.0</flatten.maven.plugin.version>

<spring-data-aerospike.version>4.6.0</spring-data-aerospike.version>
<spring-data-aerospike.version>4.7.1</spring-data-aerospike.version>
<aerospike-reactor-client.version>7.1.0</aerospike-reactor-client.version>
<aerospike-client.version>7.2.0</aerospike-client.version>
<aerospike-client.version>7.2.1</aerospike-client.version>
<embedded-aerospike.version>3.1.5</embedded-aerospike.version>

<spring-cloud-starter.version>4.1.0</spring-cloud-starter.version>
<spring-cloud-starter.version>4.1.1</spring-cloud-starter.version>
</properties>

<licenses>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import com.aerospike.client.policy.AuthMode;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.data.aerospike.config.AerospikeDataSettings;

import java.time.Duration;

Expand All @@ -36,14 +37,22 @@ public class AerospikeProperties {
* Potential hosts to seed the cluster from string format: hostname1:port1,hostname2:port2 ... .
* <p>
* See {@link com.aerospike.client.Host#parseHosts} documentation for more details.
*
* @deprecated since 0.14.0, {@link AerospikeDataSettings} with the prefix "spring-data-aerospike.connection".
* will be used instead to read from application.properties
*/
@Deprecated(since = "0.14.0", forRemoval = true)
private String hosts;

/**
* Port is used if no port specified in AerospikeProperties#hosts.
* <p>
* See {@link com.aerospike.client.Host#parseHosts} documentation for more details.
*
* @deprecated since 0.14.0, {@link AerospikeDataSettings} with the prefix "spring-data-aerospike.connection".
* will be used instead to read from application.properties
*/
@Deprecated(since = "0.14.0", forRemoval = true)
private int defaultPort = 3000;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import org.springframework.boot.autoconfigure.domain.EntityScanner;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.data.aerospike.config.AerospikeConnectionSettings;
import org.springframework.data.aerospike.config.AerospikeDataSettings;
import org.springframework.data.aerospike.convert.AerospikeCustomConversions;
import org.springframework.data.aerospike.convert.AerospikeTypeAliasAccessor;
Expand Down Expand Up @@ -58,9 +59,10 @@ public IndexesCacheHolder aerospikeIndexCache() {
public MappingAerospikeConverter mappingAerospikeConverter(AerospikeMappingContext aerospikeMappingContext,
AerospikeTypeAliasAccessor aerospikeTypeAliasAccessor,
AerospikeCustomConversions aerospikeCustomConversions,
AerospikeDataProperties aerospikeDataProperties) {
AerospikeDataProperties aerospikeDataProperties,
AerospikeDataSettings dataSettings) {
return new MappingAerospikeConverter(aerospikeMappingContext, aerospikeCustomConversions,
aerospikeTypeAliasAccessor, aerospikeDataSettings(aerospikeDataProperties));
aerospikeTypeAliasAccessor, aerospikeDataSettings(aerospikeDataProperties, dataSettings));
}

@Bean(name = "aerospikeTypeAliasAccessor")
Expand Down Expand Up @@ -98,16 +100,25 @@ public AerospikeExceptionTranslator aerospikeExceptionTranslator() {
return new DefaultAerospikeExceptionTranslator();
}

private AerospikeDataSettings aerospikeDataSettings(AerospikeDataProperties aerospikeDataProperties) {
AerospikeDataSettings.AerospikeDataSettingsBuilder builder = AerospikeDataSettings.builder();
configureDataSettings(builder, aerospikeDataProperties);
return builder.build();
@Bean
public AerospikeDataSettings readAerospikeDataSettings() {
return new AerospikeDataSettings();
}

private void configureDataSettings(AerospikeDataSettings.AerospikeDataSettingsBuilder builder,
AerospikeDataProperties aerospikeDataProperties) {
builder.scansEnabled(aerospikeDataProperties.isScansEnabled());
builder.sendKey(aerospikeDataProperties.isSendKey());
builder.createIndexesOnStartup(aerospikeDataProperties.isCreateIndexesOnStartup());
@Bean
public AerospikeConnectionSettings readAerospikeSettings() {
return new AerospikeConnectionSettings();
}

private AerospikeDataSettings aerospikeDataSettings(AerospikeDataProperties aerospikeDataProperties,
AerospikeDataSettings dataSettings) {
return configureDataSettings(dataSettings, aerospikeDataProperties);
}

private AerospikeDataSettings configureDataSettings(AerospikeDataSettings dataSettings,
AerospikeDataProperties aerospikeDataProperties) {
dataSettings.setScansEnabled(aerospikeDataProperties.isScansEnabled());
dataSettings.setCreateIndexesOnStartup(aerospikeDataProperties.isCreateIndexesOnStartup());
return dataSettings;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,12 @@ public QueryEngine aerospikeQueryEngine(IAerospikeClient aerospikeClient,
@ConditionalOnMissingBean(name = "aerospikeIndexRefresher")
public IndexRefresher indexRefresher(IAerospikeClient aerospikeClient, IndexesCacheUpdater indexesCacheUpdater,
ServerVersionSupport serverVersionSupport,
AerospikeDataProperties aerospikeDataProperties) {
AerospikeDataProperties aerospikeDataProperties,
AerospikeDataSettings dataSettings) {
IndexRefresher refresher = new IndexRefresher(aerospikeClient, aerospikeClient.getInfoPolicyDefault(),
new InternalIndexOperations(new IndexInfoParser()), indexesCacheUpdater, serverVersionSupport);
refresher.refreshIndexes();
int refreshFrequency = aerospikeDataSettings(aerospikeDataProperties).getIndexCacheRefreshSeconds();
int refreshFrequency = aerospikeDataSettings(aerospikeDataProperties, dataSettings).getIndexCacheRefreshSeconds();
processCacheRefreshFrequency(refreshFrequency, refresher);
return refresher;
}
Expand All @@ -111,16 +112,15 @@ public AerospikePersistenceEntityIndexCreator aerospikePersistenceEntityIndexCre
aerospikeDataProperties.isCreateIndexesOnStartup(), aerospikeIndexResolver, template);
}

private AerospikeDataSettings aerospikeDataSettings(AerospikeDataProperties aerospikeDataProperties) {
AerospikeDataSettings.AerospikeDataSettingsBuilder builder = AerospikeDataSettings.builder();
configureDataSettings(builder, aerospikeDataProperties);
return builder.build();
private AerospikeDataSettings aerospikeDataSettings(AerospikeDataProperties aerospikeDataProperties,
AerospikeDataSettings dataSettings) {
return configureDataSettings(dataSettings, aerospikeDataProperties);
}

private void configureDataSettings(AerospikeDataSettings.AerospikeDataSettingsBuilder builder,
AerospikeDataProperties aerospikeDataProperties) {
builder.scansEnabled(aerospikeDataProperties.isScansEnabled());
builder.sendKey(aerospikeDataProperties.isSendKey());
builder.createIndexesOnStartup(aerospikeDataProperties.isCreateIndexesOnStartup());
private AerospikeDataSettings configureDataSettings(AerospikeDataSettings dataSettings,
AerospikeDataProperties aerospikeDataProperties) {
dataSettings.setScansEnabled(aerospikeDataProperties.isScansEnabled());
dataSettings.setCreateIndexesOnStartup(aerospikeDataProperties.isCreateIndexesOnStartup());
return dataSettings;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@

/**
* Configuration properties for Spring Data Aerospike.
* @deprecated since 0.14.0, {@link AerospikeDataSettings} will be used instead.
* @deprecated since 0.14.0, {@link AerospikeDataSettings} with the prefix "spring-data-aerospike.data".
* will be used instead to read from application.properties.
*
* @author Igor Ermolenko
* @author Anastasiia Smirnova
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import org.springframework.boot.autoconfigure.data.aerospike.city.City;
import org.springframework.boot.test.context.FilteredClassLoader;
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
import org.springframework.data.aerospike.convert.AerospikeConverter;
import org.springframework.data.aerospike.convert.AerospikeTypeAliasAccessor;
import org.springframework.data.aerospike.convert.MappingAerospikeConverter;
import org.springframework.data.aerospike.core.AerospikeTemplate;
Expand Down Expand Up @@ -76,18 +77,17 @@ public void entityScanShouldSetInitialEntitySet() {
}

@Test
public void typeKeyDefault() {
public void classKeyDefault() {
contextRunner
.withPropertyValues("spring.aerospike.hosts=localhost:3000")
.withPropertyValues("spring.data.aerospike.namespace=TEST")
.withUserConfiguration(AerospikeClientMockConfiguration.class,
AerospikeServerVersionSupportMockConfiguration.class)
.run(context -> {
AerospikeTypeAliasAccessor aliasAccessor = context.getBean(AerospikeTypeAliasAccessor.class);
String typeKey = getField(aliasAccessor, "typeKey");
String defaultTypeKey = getField(aliasAccessor, "TYPE_KEY");
String classKey = getField(aliasAccessor, "classKey");

assertThat(typeKey).isEqualTo(defaultTypeKey);
assertThat(classKey).isEqualTo(AerospikeConverter.CLASS_KEY);
});
}

Expand All @@ -101,7 +101,7 @@ public void typeKeyCanBeCustomized() {
.withPropertyValues("spring.data.aerospike.type-key=++amazing++")
.run((context) -> {
AerospikeTypeAliasAccessor aliasAccessor = context.getBean(AerospikeTypeAliasAccessor.class);
String typeKey = getField(aliasAccessor, "typeKey");
String typeKey = getField(aliasAccessor, "classKey");

assertThat(typeKey).isEqualTo("++amazing++");
});
Expand All @@ -117,7 +117,7 @@ public void typeKeyCanBeNull() {
.withPropertyValues("spring.data.aerospike.type-key=")
.run((context) -> {
AerospikeTypeAliasAccessor aliasAccessor = context.getBean(AerospikeTypeAliasAccessor.class);
String typeKey = getField(aliasAccessor, "typeKey");
String typeKey = getField(aliasAccessor, "classKey");

assertThat(typeKey).isNull();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import org.springframework.boot.autoconfigure.data.aerospike.AerospikeTestConfigurations.MockReactiveIndexRefresher;
import org.springframework.boot.autoconfigure.data.aerospike.city.City;
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
import org.springframework.data.aerospike.convert.AerospikeConverter;
import org.springframework.data.aerospike.convert.AerospikeTypeAliasAccessor;
import org.springframework.data.aerospike.convert.MappingAerospikeConverter;
import org.springframework.data.aerospike.core.AerospikeTemplate;
Expand Down Expand Up @@ -74,18 +75,17 @@ public void entityScanShouldSetInitialEntitySet() {
}

@Test
public void typeKeyDefault() {
public void classKeyDefault() {
contextRunner
.withPropertyValues("spring.aerospike.hosts=localhost:3000")
.withPropertyValues("spring.data.aerospike.namespace=TEST")
.withUserConfiguration(AerospikeClientMockConfiguration.class, MockReactiveIndexRefresher.class,
AerospikeServerVersionSupportMockConfiguration.class)
.run(context -> {
AerospikeTypeAliasAccessor aliasAccessor = context.getBean(AerospikeTypeAliasAccessor.class);
String typeKey = getField(aliasAccessor, "typeKey");
String defaultTypeKey = getField(aliasAccessor, "TYPE_KEY");
String typeKey = getField(aliasAccessor, "classKey");

assertThat(typeKey).isEqualTo(defaultTypeKey);
assertThat(typeKey).isEqualTo(AerospikeConverter.CLASS_KEY);
});
}

Expand All @@ -99,7 +99,7 @@ public void typeKeyCanBeCustomized() {
.withPropertyValues("spring.data.aerospike.type-key=++amazing++")
.run((context) -> {
AerospikeTypeAliasAccessor aliasAccessor = context.getBean(AerospikeTypeAliasAccessor.class);
String typeKey = getField(aliasAccessor, "typeKey");
String typeKey = getField(aliasAccessor, "classKey");

assertThat(typeKey).isEqualTo("++amazing++");
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
package org.springframework.boot.autoconfigure.data.aerospike;

import org.springframework.data.aerospike.convert.AerospikeTypeAliasAccessor;
import org.springframework.util.ReflectionUtils;

import java.lang.reflect.Field;

public class TestUtils {

public static <T> T getField(AerospikeTypeAliasAccessor aliasAccessor, String fieldName) {
Field typeKeyField = ReflectionUtils.findField(AerospikeTypeAliasAccessor.class, fieldName);
public static <T> T getField(Object object, String fieldName) {
Field typeKeyField = ReflectionUtils.findField(object.getClass(), fieldName);
typeKeyField.setAccessible(true);
return (T) ReflectionUtils.getField(typeKeyField, aliasAccessor);
return (T) ReflectionUtils.getField(typeKeyField, object);
}
}
4 changes: 0 additions & 4 deletions spring-boot-starter-data-aerospike-example/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@
<artifactId>spring-boot-starter-data-aerospike-example</artifactId>
<description>Example for using Spring Boot Data Aerospike Starter</description>

<properties>
<embedded-aerospike.version>3.1.1</embedded-aerospike.version>
</properties>

<modules>
<module>reactive</module>
<module>sync</module>
Expand Down
Loading