DATAGEODE-306 - Fix compilation errors in GemfireTemplate and MappingPdxSerializer.
The compilation errors were caused by the downmerge from Neumann/2.3 to Moore/2.2 and API changes in Spring Data Commons and Mockito.
This commit is contained in:
@@ -23,7 +23,6 @@ import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import org.apache.geode.GemFireCheckedException;
|
||||
import org.apache.geode.GemFireException;
|
||||
@@ -426,7 +425,7 @@ public class GemfireTemplate extends GemfireAccessor implements GemfireOperation
|
||||
|
||||
if (RegionUtils.isLocal(region)) {
|
||||
|
||||
Supplier<Boolean> hasServerProxyMethod = () ->
|
||||
SpringUtils.ValueReturningThrowableOperation<Boolean> hasServerProxyMethod = () ->
|
||||
Optional.ofNullable(ReflectionUtils.findMethod(region.getClass(), "hasServerProxy"))
|
||||
.map(method -> ReflectionUtils.invokeMethod(method, region))
|
||||
.map(Boolean.FALSE::equals)
|
||||
|
||||
@@ -34,6 +34,8 @@ import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.ApplicationContextAware;
|
||||
import org.springframework.core.convert.ConversionService;
|
||||
import org.springframework.core.convert.support.DefaultConversionService;
|
||||
import org.springframework.data.convert.EntityInstantiator;
|
||||
import org.springframework.data.convert.EntityInstantiators;
|
||||
import org.springframework.data.gemfire.util.Filter;
|
||||
import org.springframework.data.mapping.MappingException;
|
||||
import org.springframework.data.mapping.PersistentEntity;
|
||||
@@ -41,8 +43,6 @@ import org.springframework.data.mapping.PersistentProperty;
|
||||
import org.springframework.data.mapping.PersistentPropertyAccessor;
|
||||
import org.springframework.data.mapping.PropertyHandler;
|
||||
import org.springframework.data.mapping.model.ConvertingPropertyAccessor;
|
||||
import org.springframework.data.mapping.model.EntityInstantiator;
|
||||
import org.springframework.data.mapping.model.EntityInstantiators;
|
||||
import org.springframework.data.mapping.model.PersistentEntityParameterValueProvider;
|
||||
import org.springframework.data.mapping.model.SpELContext;
|
||||
import org.springframework.lang.NonNull;
|
||||
@@ -72,8 +72,8 @@ import org.slf4j.LoggerFactory;
|
||||
* @see org.springframework.data.mapping.PersistentPropertyAccessor
|
||||
* @see org.springframework.data.mapping.PropertyHandler
|
||||
* @see org.springframework.data.mapping.model.ConvertingPropertyAccessor
|
||||
* @see org.springframework.data.mapping.model.EntityInstantiator
|
||||
* @see org.springframework.data.mapping.model.EntityInstantiators
|
||||
* @see org.springframework.data.convert.EntityInstantiator
|
||||
* @see org.springframework.data.convert.EntityInstantiators
|
||||
* @see org.springframework.data.mapping.model.PersistentEntityParameterValueProvider
|
||||
* @since 1.2.0
|
||||
*/
|
||||
@@ -323,7 +323,7 @@ public class MappingPdxSerializer implements PdxSerializer, ApplicationContextAw
|
||||
*
|
||||
* @param entityInstantiators {@link EntityInstantiator EntityInstantiators} used to create the instances
|
||||
* read by this {@link PdxSerializer}; must not be {@literal null}.
|
||||
* @see org.springframework.data.mapping.model.EntityInstantiator
|
||||
* @see org.springframework.data.convert.EntityInstantiator
|
||||
*/
|
||||
public void setEntityInstantiators(@NonNull EntityInstantiators entityInstantiators) {
|
||||
|
||||
@@ -338,7 +338,7 @@ public class MappingPdxSerializer implements PdxSerializer, ApplicationContextAw
|
||||
*
|
||||
* @param gemfireInstantiators mapping of {@link Class types} to {@link EntityInstantiator} objects;
|
||||
* must not be {@literal null}.
|
||||
* @see org.springframework.data.mapping.model.EntityInstantiator
|
||||
* @see org.springframework.data.convert.EntityInstantiator
|
||||
* @see java.util.Map
|
||||
*/
|
||||
public void setEntityInstantiators(@NonNull Map<Class<?>, EntityInstantiator> gemfireInstantiators) {
|
||||
@@ -349,7 +349,7 @@ public class MappingPdxSerializer implements PdxSerializer, ApplicationContextAw
|
||||
* Returns the configured {@link EntityInstantiators} handling instantiation for GemFire persistent entities.
|
||||
*
|
||||
* @return the configured {@link EntityInstantiators} handling instantiation for GemFire persistent entities.
|
||||
* @see org.springframework.data.mapping.model.EntityInstantiators
|
||||
* @see org.springframework.data.convert.EntityInstantiators
|
||||
*/
|
||||
protected EntityInstantiators getEntityInstantiators() {
|
||||
return this.entityInstantiators;
|
||||
@@ -709,7 +709,7 @@ public class MappingPdxSerializer implements PdxSerializer, ApplicationContextAw
|
||||
* @param entity {@link PersistentEntity} object used to lookup a custom, registered {@link EntityInstantiator}
|
||||
* for the entity.
|
||||
* @return an {@link EntityInstantiator} for the given {@link PersistentEntity}.
|
||||
* @see org.springframework.data.mapping.model.EntityInstantiator
|
||||
* @see org.springframework.data.convert.EntityInstantiator
|
||||
* @see org.springframework.data.mapping.PersistentEntity
|
||||
*/
|
||||
@SuppressWarnings("rawtypes")
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.data.gemfire.mapping;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
@@ -28,7 +28,7 @@ import static org.mockito.Mockito.never;
|
||||
import static org.mockito.Mockito.spy;
|
||||
import static org.mockito.Mockito.times;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.verifyNoInteractions;
|
||||
import static org.mockito.Mockito.verifyZeroInteractions;
|
||||
import static org.mockito.Mockito.when;
|
||||
import static org.springframework.data.gemfire.util.RuntimeExceptionFactory.newIllegalArgumentException;
|
||||
|
||||
@@ -55,6 +55,8 @@ import org.springframework.core.convert.ConversionService;
|
||||
import org.springframework.core.convert.support.DefaultConversionService;
|
||||
import org.springframework.core.convert.support.GenericConversionService;
|
||||
import org.springframework.core.type.ClassMetadata;
|
||||
import org.springframework.data.convert.EntityInstantiator;
|
||||
import org.springframework.data.convert.EntityInstantiators;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.gemfire.GemfireTemplate;
|
||||
import org.springframework.data.gemfire.repository.sample.Account;
|
||||
@@ -72,8 +74,6 @@ import org.springframework.data.gemfire.test.support.MapBuilder;
|
||||
import org.springframework.data.mapping.MappingException;
|
||||
import org.springframework.data.mapping.PersistentEntity;
|
||||
import org.springframework.data.mapping.PersistentProperty;
|
||||
import org.springframework.data.mapping.model.EntityInstantiator;
|
||||
import org.springframework.data.mapping.model.EntityInstantiators;
|
||||
import org.springframework.data.mapping.model.ParameterValueProvider;
|
||||
|
||||
/**
|
||||
@@ -483,8 +483,8 @@ public class MappingPdxSerializerUnitTests {
|
||||
|
||||
verify(this.pdxSerializer, times(1)).getEntityInstantiators();
|
||||
verify(mockEntityInstantiators, times(1)).getInstantiatorFor(eq(mockEntity));
|
||||
verifyNoInteractions(mockEntityInstantiator);
|
||||
verifyNoInteractions(mockEntity);
|
||||
verifyZeroInteractions(mockEntityInstantiator);
|
||||
verifyZeroInteractions(mockEntity);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -503,8 +503,8 @@ public class MappingPdxSerializerUnitTests {
|
||||
|
||||
verify(this.pdxSerializer, times(1)).getEntityInstantiators();
|
||||
verify(mockEntityInstantiators, times(1)).getInstantiatorFor(eq(mockEntity));
|
||||
verifyNoInteractions(mockEntityInstantiator);
|
||||
verifyNoInteractions(mockEntity);
|
||||
verifyZeroInteractions(mockEntityInstantiator);
|
||||
verifyZeroInteractions(mockEntity);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -27,8 +27,8 @@ import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.spy;
|
||||
import static org.mockito.Mockito.times;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.verifyNoInteractions;
|
||||
import static org.mockito.Mockito.verifyNoMoreInteractions;
|
||||
import static org.mockito.Mockito.verifyZeroInteractions;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -208,7 +208,7 @@ public class SimpleGemfireRepositoryUnitTests {
|
||||
assertThat(repository.getLogger()).isNotNull();
|
||||
assertThat(repository.getTemplate()).isEqualTo(template);
|
||||
|
||||
verifyNoInteractions(template, mockRegion, mockEntityInformation);
|
||||
verifyZeroInteractions(template, mockRegion, mockEntityInformation);
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
@@ -258,7 +258,7 @@ public class SimpleGemfireRepositoryUnitTests {
|
||||
assertThat(repository.getRegion()).isEqualTo(mockRegion);
|
||||
|
||||
verify(template, times(1)).getRegion();
|
||||
verifyNoInteractions(mockRegion, mockEntityInformation);
|
||||
verifyZeroInteractions(mockRegion, mockEntityInformation);
|
||||
verifyNoMoreInteractions(template);
|
||||
}
|
||||
|
||||
@@ -383,7 +383,7 @@ public class SimpleGemfireRepositoryUnitTests {
|
||||
assertThat(iterable).isNotNull();
|
||||
assertThat(iterable).isEmpty();
|
||||
|
||||
verifyNoInteractions(mockRegion);
|
||||
verifyZeroInteractions(mockRegion);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -698,7 +698,7 @@ public class SimpleGemfireRepositoryUnitTests {
|
||||
assertThat(animals).isNotNull();
|
||||
assertThat(animals).isEmpty();
|
||||
|
||||
verifyNoInteractions(mockRegion);
|
||||
verifyZeroInteractions(mockRegion);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -734,7 +734,7 @@ public class SimpleGemfireRepositoryUnitTests {
|
||||
|
||||
assertThat(repository.findById(null).isPresent()).isFalse();
|
||||
|
||||
verifyNoInteractions(mockRegion);
|
||||
verifyZeroInteractions(mockRegion);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -26,8 +26,8 @@ import static org.mockito.Mockito.never;
|
||||
import static org.mockito.Mockito.spy;
|
||||
import static org.mockito.Mockito.times;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.verifyNoInteractions;
|
||||
import static org.mockito.Mockito.verifyNoMoreInteractions;
|
||||
import static org.mockito.Mockito.verifyZeroInteractions;
|
||||
import static org.mockito.Mockito.when;
|
||||
import static org.springframework.data.gemfire.util.ArrayUtils.asArray;
|
||||
import static org.springframework.data.gemfire.util.RuntimeExceptionFactory.newIllegalStateException;
|
||||
@@ -460,7 +460,7 @@ public class SpringUtilsUnitTests {
|
||||
assertThat(SpringUtils.safeDoOperation(() -> operationValue.set("MOCK"), mockRunnable)).isTrue();
|
||||
assertThat(operationValue.get()).isEqualTo("MOCK");
|
||||
|
||||
verifyNoInteractions(mockRunnable);
|
||||
verifyZeroInteractions(mockRunnable);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user