Support for jMolecules' Association type.
We no recognize properties of type org.jmolecules.ddd.types.Association as associations in our PersistentProperty model. Also, we now register JMolecules Converter implementations for Association and Identifier in CustomConversions so that they can persisted like their embedded primitive value out of the box. Fixes #2315. Original pull request: #2316.
This commit is contained in:
committed by
Mark Paluch
parent
3f1609587e
commit
6b0292cc66
@@ -16,6 +16,7 @@
|
||||
package org.springframework.data.convert;
|
||||
|
||||
import static org.assertj.core.api.Assertions.*;
|
||||
import static org.mockito.ArgumentMatchers.*;
|
||||
import static org.mockito.Mockito.*;
|
||||
|
||||
import java.text.DateFormat;
|
||||
@@ -28,6 +29,8 @@ import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
import org.jmolecules.ddd.types.Association;
|
||||
import org.jmolecules.ddd.types.Identifier;
|
||||
import org.joda.time.DateTime;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.aop.framework.ProxyFactory;
|
||||
@@ -272,6 +275,24 @@ class CustomConversionsUnitTests {
|
||||
verify(registry).addConverter(any(LocalDateTimeToDateConverter.class));
|
||||
}
|
||||
|
||||
@Test // GH-2315
|
||||
void addsAssociationConvertersByDefault() {
|
||||
|
||||
CustomConversions conversions = new CustomConversions(StoreConversions.NONE, Collections.emptyList());
|
||||
|
||||
assertThat(conversions.hasCustomWriteTarget(Association.class)).isTrue();
|
||||
assertThat(conversions.hasCustomReadTarget(Object.class, Association.class)).isTrue();
|
||||
}
|
||||
|
||||
@Test // GH-2315
|
||||
void addsIdentifierConvertersByDefault() {
|
||||
|
||||
CustomConversions conversions = new CustomConversions(StoreConversions.NONE, Collections.emptyList());
|
||||
|
||||
assertThat(conversions.hasCustomWriteTarget(Identifier.class)).isTrue();
|
||||
assertThat(conversions.hasCustomReadTarget(String.class, Identifier.class)).isTrue();
|
||||
}
|
||||
|
||||
private static Class<?> createProxyTypeFor(Class<?> type) {
|
||||
|
||||
ProxyFactory factory = new ProxyFactory();
|
||||
|
||||
Reference in New Issue
Block a user