From 4e2fcd0ad6d8bdca4efa7dc54b0e16ddc8dc2ab4 Mon Sep 17 00:00:00 2001 From: agrgr Date: Sun, 23 Jun 2024 10:58:32 +0300 Subject: [PATCH] add comment, rename test class --- .../aerospike/convert/MappingAerospikeWriteConverter.java | 1 + .../convert/MappingAerospikeConverterTypesTests.java | 6 +++--- .../data/aerospike/sample/SampleClasses.java | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/springframework/data/aerospike/convert/MappingAerospikeWriteConverter.java b/src/main/java/org/springframework/data/aerospike/convert/MappingAerospikeWriteConverter.java index 838ee7a6c..aaa794203 100644 --- a/src/main/java/org/springframework/data/aerospike/convert/MappingAerospikeWriteConverter.java +++ b/src/main/java/org/springframework/data/aerospike/convert/MappingAerospikeWriteConverter.java @@ -95,6 +95,7 @@ public void write(Object source, final AerospikeWriteData data) { AerospikePersistentProperty versionProperty = entity.getVersionProperty(); if (versionProperty != null) { + // version is read as Integer because Record.generation is integer Integer version = accessor.getProperty(versionProperty, Integer.class); data.setVersion(version); } diff --git a/src/test/java/org/springframework/data/aerospike/convert/MappingAerospikeConverterTypesTests.java b/src/test/java/org/springframework/data/aerospike/convert/MappingAerospikeConverterTypesTests.java index 67bd43c44..c35bbd391 100644 --- a/src/test/java/org/springframework/data/aerospike/convert/MappingAerospikeConverterTypesTests.java +++ b/src/test/java/org/springframework/data/aerospike/convert/MappingAerospikeConverterTypesTests.java @@ -763,7 +763,7 @@ void shouldWriteAndReadNestedPOJOs() { new Address(new Street("Street1", 1), 1), new Address(new Street("Street2", 2), 2) ); - SampleClasses.idAndAddressesList testObj = new idAndAddressesList("testId", addressesList); + IdAndAddressesList testObj = new IdAndAddressesList("testId", addressesList); converter.write(testObj, forWrite); assertThat(forWrite.getBins()).containsOnly( @@ -774,9 +774,9 @@ void shouldWriteAndReadNestedPOJOs() { ); AerospikeReadData forRead = AerospikeReadData.forRead(forWrite.getKey(), aeroRecord(forWrite.getBins())); - SampleClasses.idAndAddressesList actual = converter.read(idAndAddressesList.class, forRead); + IdAndAddressesList actual = converter.read(IdAndAddressesList.class, forRead); - assertThat(actual).isEqualTo(new idAndAddressesList("testId", addressesList)); + assertThat(actual).isEqualTo(new IdAndAddressesList("testId", addressesList)); } private void assertWriteAndRead(int converterOption, diff --git a/src/test/java/org/springframework/data/aerospike/sample/SampleClasses.java b/src/test/java/org/springframework/data/aerospike/sample/SampleClasses.java index da256a304..dd19f00df 100644 --- a/src/test/java/org/springframework/data/aerospike/sample/SampleClasses.java +++ b/src/test/java/org/springframework/data/aerospike/sample/SampleClasses.java @@ -552,7 +552,7 @@ private Person(Set
addresses) { } @Data - public static class idAndAddressesList { + public static class IdAndAddressesList { @Id final String id;