Adapt to upcoming changes in core framework.
This commit makes sure to move off deprecated API and changes event listener generics in tests to comply with java assignability rules. Closes: #4749
This commit is contained in:
@@ -20,11 +20,11 @@ import java.util.ArrayList;
|
||||
import org.springframework.context.ApplicationEvent;
|
||||
import org.springframework.context.ApplicationListener;
|
||||
|
||||
public class AfterSaveListener implements ApplicationListener<AfterSaveEvent<Object>> {
|
||||
public class AfterSaveListener implements ApplicationListener<AfterSaveEvent<? extends Object>> {
|
||||
|
||||
public final ArrayList<ApplicationEvent> seenEvents = new ArrayList<ApplicationEvent>();
|
||||
|
||||
public void onApplicationEvent(AfterSaveEvent<Object> event) {
|
||||
public void onApplicationEvent(AfterSaveEvent<? extends Object> event) {
|
||||
this.seenEvents.add(event);
|
||||
}
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ import static org.springframework.data.mongodb.core.query.Criteria.*;
|
||||
import static org.springframework.data.mongodb.core.query.Query.*;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Base64;
|
||||
|
||||
import org.bson.types.Binary;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
@@ -29,7 +30,6 @@ import org.springframework.data.annotation.Id;
|
||||
import org.springframework.data.mongodb.test.util.MongoTemplateExtension;
|
||||
import org.springframework.data.mongodb.test.util.MongoTestTemplate;
|
||||
import org.springframework.data.mongodb.test.util.Template;
|
||||
import org.springframework.util.Base64Utils;
|
||||
|
||||
/**
|
||||
* Integration tests for {@link Criteria} usage as part of a {@link Query}.
|
||||
@@ -50,7 +50,7 @@ class CriteriaTests {
|
||||
static final DocumentWithBitmask TWENTY_FLOAT/*00010100*/ = new DocumentWithBitmask("3", Float.valueOf(20),
|
||||
Integer.toBinaryString(20));
|
||||
static final DocumentWithBitmask ONE_HUNDRED_TWO/*01100110*/ = new DocumentWithBitmask("4",
|
||||
new Binary(Base64Utils.decodeFromString("Zg==")), "01100110");
|
||||
new Binary(Base64.getDecoder().decode("Zg==")), "01100110");
|
||||
|
||||
@BeforeEach
|
||||
void beforeEach() {
|
||||
|
||||
@@ -25,6 +25,7 @@ import reactor.core.publisher.Flux;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Base64;
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -55,7 +56,6 @@ import org.springframework.data.repository.query.ReactiveQueryMethodEvaluationCo
|
||||
import org.springframework.data.spel.spi.EvaluationContextExtension;
|
||||
import org.springframework.data.spel.spi.ReactiveEvaluationContextExtension;
|
||||
import org.springframework.expression.spel.standard.SpelExpressionParser;
|
||||
import org.springframework.util.Base64Utils;
|
||||
|
||||
/**
|
||||
* Unit tests for {@link ReactiveStringBasedMongoQuery}.
|
||||
@@ -224,7 +224,7 @@ public class ReactiveStringBasedMongoQueryUnitTests {
|
||||
|
||||
org.springframework.data.mongodb.core.query.Query query = mongoQuery.createQuery(accesor).block();
|
||||
org.springframework.data.mongodb.core.query.Query reference = new BasicQuery(
|
||||
"{'lastname' : { '$binary' : '" + Base64Utils.encodeToString(binaryData) + "', '$type' : '" + 0 + "'}}");
|
||||
"{'lastname' : { '$binary' : '" + Base64.getEncoder().encodeToString(binaryData) + "', '$type' : '" + 0 + "'}}");
|
||||
|
||||
assertThat(query.getQueryObject().toJson()).isEqualTo(reference.getQueryObject().toJson());
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ import java.lang.reflect.Method;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Base64;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -60,7 +61,6 @@ import org.springframework.data.repository.Repository;
|
||||
import org.springframework.data.repository.core.support.DefaultRepositoryMetadata;
|
||||
import org.springframework.data.repository.query.QueryMethodEvaluationContextProvider;
|
||||
import org.springframework.expression.spel.standard.SpelExpressionParser;
|
||||
import org.springframework.util.Base64Utils;
|
||||
|
||||
import com.mongodb.MongoClientSettings;
|
||||
import com.mongodb.reactivestreams.client.MongoClients;
|
||||
@@ -329,7 +329,7 @@ public class StringBasedMongoQueryUnitTests {
|
||||
|
||||
org.springframework.data.mongodb.core.query.Query query = mongoQuery.createQuery(accessor);
|
||||
org.springframework.data.mongodb.core.query.Query reference = new BasicQuery("{'lastname' : { '$binary' : '"
|
||||
+ Base64Utils.encodeToString(binaryData) + "', '$type' : '" + BsonBinarySubType.BINARY.getValue() + "'}}");
|
||||
+ Base64.getEncoder().encodeToString(binaryData) + "', '$type' : '" + BsonBinarySubType.BINARY.getValue() + "'}}");
|
||||
|
||||
assertThat(query.getQueryObject().toJson()).isEqualTo(reference.getQueryObject().toJson());
|
||||
}
|
||||
@@ -344,7 +344,7 @@ public class StringBasedMongoQueryUnitTests {
|
||||
|
||||
org.springframework.data.mongodb.core.query.Query query = mongoQuery.createQuery(accessor);
|
||||
org.springframework.data.mongodb.core.query.Query reference = new BasicQuery("{'lastname' : { $in: [{'$binary' : '"
|
||||
+ Base64Utils.encodeToString(binaryData) + "', '$type' : '" + BsonBinarySubType.BINARY.getValue() + "'}] }}");
|
||||
+ Base64.getEncoder().encodeToString(binaryData) + "', '$type' : '" + BsonBinarySubType.BINARY.getValue() + "'}] }}");
|
||||
|
||||
assertThat(query.getQueryObject().toJson()).isEqualTo(reference.getQueryObject().toJson());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user