Disable tests on Java 16 that require class-based proxies.
Original pull request: #3687. Resolves #3656
This commit is contained in:
committed by
Mark Paluch
parent
bf3375d8d7
commit
c7faedf85d
@@ -26,6 +26,7 @@ import org.springframework.data.mapping.model.FieldNamingStrategy;
|
||||
import org.springframework.data.mapping.model.Property;
|
||||
import org.springframework.data.mapping.model.PropertyNameFieldNamingStrategy;
|
||||
import org.springframework.data.mapping.model.SimpleTypeHolder;
|
||||
import org.springframework.data.util.NullableWrapperConverters;
|
||||
import org.springframework.data.util.TypeInformation;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
@@ -69,6 +70,11 @@ public class MongoMappingContext extends AbstractMappingContext<MongoPersistentE
|
||||
*/
|
||||
@Override
|
||||
protected boolean shouldCreatePersistentEntityFor(TypeInformation<?> type) {
|
||||
|
||||
if (NullableWrapperConverters.supports(type.getType())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return !MongoSimpleTypes.HOLDER.isSimpleType(type.getType()) && !AbstractMap.class.isAssignableFrom(type.getType());
|
||||
}
|
||||
|
||||
@@ -133,7 +139,7 @@ public class MongoMappingContext extends AbstractMappingContext<MongoPersistentE
|
||||
|
||||
MongoPersistentEntity<?> entity = super.getPersistentEntity(persistentProperty);
|
||||
|
||||
if(entity == null || !persistentProperty.isUnwrapped()) {
|
||||
if (entity == null || !persistentProperty.isUnwrapped()) {
|
||||
return entity;
|
||||
}
|
||||
|
||||
|
||||
@@ -36,6 +36,8 @@ import org.bson.conversions.Bson;
|
||||
import org.bson.types.ObjectId;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.condition.DisabledForJreRange;
|
||||
import org.junit.jupiter.api.condition.JRE;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.Mockito;
|
||||
@@ -179,6 +181,7 @@ public class DbRefMappingMongoConverterUnitTests {
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-348
|
||||
@DisabledForJreRange(min = JRE.JAVA_16, disabledReason = "Class Proxies for eg. ArrayList require to open java.util.")
|
||||
public void lazyLoadingProxyForLazyDbRefOnConcreteCollection() {
|
||||
|
||||
String id = "42";
|
||||
@@ -506,6 +509,7 @@ public class DbRefMappingMongoConverterUnitTests {
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1076
|
||||
@DisabledForJreRange(min = JRE.JAVA_16, disabledReason = "Class Proxies for eg. ArrayList require to open java.util.")
|
||||
public void shouldNotTriggerResolvingOfLazyLoadedProxyWhenFinalizeMethodIsInvoked() throws Exception {
|
||||
|
||||
MongoPersistentEntity<?> entity = mappingContext
|
||||
@@ -524,6 +528,7 @@ public class DbRefMappingMongoConverterUnitTests {
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1194
|
||||
@DisabledForJreRange(min = JRE.JAVA_16, disabledReason = "Class Proxies for eg. ArrayList require to open java.util.")
|
||||
public void shouldBulkFetchListOfReferences() {
|
||||
|
||||
String id1 = "1";
|
||||
@@ -574,6 +579,7 @@ public class DbRefMappingMongoConverterUnitTests {
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1194
|
||||
@DisabledForJreRange(min = JRE.JAVA_16, disabledReason = "Class Proxies for eg. ArrayList require to open java.util.")
|
||||
public void shouldFallbackToOneByOneFetchingWhenElementsInListOfReferencesPointToDifferentCollections() {
|
||||
|
||||
String id1 = "1";
|
||||
|
||||
@@ -22,14 +22,15 @@ import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.condition.DisabledForJreRange;
|
||||
import org.junit.jupiter.api.condition.JRE;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.mongodb.core.MongoOperations;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
import org.springframework.test.context.junit.jupiter.SpringExtension;
|
||||
|
||||
/**
|
||||
* Integration test for {@link PersonRepository} for lazy loading support.
|
||||
@@ -38,13 +39,13 @@ import org.springframework.test.context.junit4.SpringRunner;
|
||||
* @author Oliver Gierke
|
||||
*/
|
||||
@ContextConfiguration(locations = "PersonRepositoryIntegrationTests-context.xml")
|
||||
@RunWith(SpringRunner.class)
|
||||
@ExtendWith(SpringExtension.class)
|
||||
public class PersonRepositoryLazyLoadingIntegrationTests {
|
||||
|
||||
@Autowired PersonRepository repository;
|
||||
@Autowired MongoOperations operations;
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void setUp() throws InterruptedException {
|
||||
|
||||
repository.deleteAll();
|
||||
@@ -61,7 +62,6 @@ public class PersonRepositoryLazyLoadingIntegrationTests {
|
||||
Person person = new Person();
|
||||
person.setFirstname("Oliver");
|
||||
person.setFans(Arrays.asList(thomas));
|
||||
person.setRealFans(new ArrayList<User>(Arrays.asList(thomas)));
|
||||
repository.save(person);
|
||||
|
||||
Person oliver = repository.findById(person.id).get();
|
||||
@@ -75,7 +75,8 @@ public class PersonRepositoryLazyLoadingIntegrationTests {
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-348
|
||||
public void shouldLoadAssociationWithDbRefOnConcreteCollectionAndLazyLoadingEnabled() throws Exception {
|
||||
@DisabledForJreRange(min = JRE.JAVA_16, disabledReason = "Class Proxies for eg. ArrayList require to open java.util.")
|
||||
public void shouldLoadAssociationWithDbRefOnConcreteCollectionAndLazyLoadingEnabled() {
|
||||
|
||||
User thomas = new User();
|
||||
thomas.username = "Thomas";
|
||||
@@ -83,7 +84,6 @@ public class PersonRepositoryLazyLoadingIntegrationTests {
|
||||
|
||||
Person person = new Person();
|
||||
person.setFirstname("Oliver");
|
||||
person.setFans(Arrays.asList(thomas));
|
||||
person.setRealFans(new ArrayList<User>(Arrays.asList(thomas)));
|
||||
repository.save(person);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user