Upgrade to SI-5.3 and SD-Nuemann (#224)
* Upgrade to SI-5.3 and SD-Nuemann * Fix test entity for LocalDate * * Disable test with embedded Cassandra on Windows
This commit is contained in:
@@ -5,7 +5,7 @@ plugins {
|
||||
id 'jacoco'
|
||||
id 'org.sonarqube' version '2.8'
|
||||
id 'checkstyle'
|
||||
id 'io.spring.dependency-management' version '1.0.8.RELEASE'
|
||||
id 'io.spring.dependency-management' version '1.0.9.RELEASE'
|
||||
}
|
||||
|
||||
apply from: "${rootProject.projectDir}/publish-maven.gradle"
|
||||
@@ -23,19 +23,19 @@ repositories {
|
||||
}
|
||||
|
||||
ext {
|
||||
assertjVersion = '3.14.0'
|
||||
cassandraUnitVersion = '3.11.2.0'
|
||||
junitVersion = '5.5.2'
|
||||
reactorVersion = 'Dysprosium-SR1'
|
||||
slf4jVersion = '1.7.28'
|
||||
springDataVersion = 'Moore-SR1'
|
||||
springIntegrationVersion = '5.2.1.RELEASE'
|
||||
assertjVersion = '3.15.0'
|
||||
cassandraUnitVersion = '4.3.1.0'
|
||||
junitVersion = '5.6.0'
|
||||
reactorVersion = 'Dysprosium-SR4'
|
||||
slf4jVersion = '1.7.30'
|
||||
springDataVersion = 'Neumann-BUILD-SNAPSHOT'
|
||||
springIntegrationVersion = '5.3.0.BUILD-SNAPSHOT'
|
||||
|
||||
idPrefix = 'cassandra'
|
||||
|
||||
linkHomepage = 'https://github.com/spring-projects/spring-integration-extensions'
|
||||
linkCi = 'https://build.spring.io/browse/INTEXT'
|
||||
linkIssue = 'https://jira.spring.io/browse/INTEXT'
|
||||
linkIssue = 'https://github.com/spring-projects/spring-integration-extensions/issues'
|
||||
linkScmUrl = 'https://github.com/spring-projects/spring-integration-extensions'
|
||||
linkScmConnection = 'https://github.com/spring-projects/spring-integration-extensions.git'
|
||||
linkScmDevConnection = 'git@github.com:spring-projects/spring-integration-extensions.git'
|
||||
@@ -76,12 +76,12 @@ sourceSets {
|
||||
}
|
||||
|
||||
jacoco {
|
||||
toolVersion = '0.8.4'
|
||||
toolVersion = '0.8.5'
|
||||
}
|
||||
|
||||
checkstyle {
|
||||
configFile = file("${rootDir}/src/checkstyle/checkstyle.xml")
|
||||
toolVersion = '8.25'
|
||||
toolVersion = '8.29'
|
||||
}
|
||||
|
||||
|
||||
@@ -112,7 +112,6 @@ test {
|
||||
// suppress all console output during testing unless running `gradle -i`
|
||||
logging.captureStandardOutput(LogLevel.INFO)
|
||||
jacoco {
|
||||
append = false
|
||||
destinationFile = file("$buildDir/jacoco.exec")
|
||||
}
|
||||
useJUnitPlatform()
|
||||
|
||||
Binary file not shown.
@@ -1,5 +1,5 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
|
||||
29
spring-integration-cassandra/gradlew
vendored
29
spring-integration-cassandra/gradlew
vendored
@@ -154,19 +154,19 @@ if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
|
||||
else
|
||||
eval `echo args$i`="\"$arg\""
|
||||
fi
|
||||
i=$((i+1))
|
||||
i=`expr $i + 1`
|
||||
done
|
||||
case $i in
|
||||
(0) set -- ;;
|
||||
(1) set -- "$args0" ;;
|
||||
(2) set -- "$args0" "$args1" ;;
|
||||
(3) set -- "$args0" "$args1" "$args2" ;;
|
||||
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||
0) set -- ;;
|
||||
1) set -- "$args0" ;;
|
||||
2) set -- "$args0" "$args1" ;;
|
||||
3) set -- "$args0" "$args1" "$args2" ;;
|
||||
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
@@ -175,14 +175,9 @@ save () {
|
||||
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
||||
echo " "
|
||||
}
|
||||
APP_ARGS=$(save "$@")
|
||||
APP_ARGS=`save "$@"`
|
||||
|
||||
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
||||
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
||||
|
||||
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
|
||||
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
|
||||
cd "$(dirname "$0")"
|
||||
fi
|
||||
|
||||
exec "$JAVACMD" "$@"
|
||||
|
||||
@@ -67,17 +67,19 @@ def customizePom(pom, gradleProject) {
|
||||
}
|
||||
|
||||
developers {
|
||||
developer {
|
||||
id = 'garyrussell'
|
||||
name = 'Gary Russell'
|
||||
email = 'grussell@pivotal.io'
|
||||
roles = ['project lead']
|
||||
}
|
||||
developer {
|
||||
id = 'abilan'
|
||||
name = 'Artem Bilan'
|
||||
email = 'abilan@pivotal.io'
|
||||
roles = ['project lead']
|
||||
}
|
||||
developer {
|
||||
id = 'garyrussell'
|
||||
name = 'Gary Russell'
|
||||
email = 'grussell@pivotal.io'
|
||||
roles = ["project lead emeritus"]
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2015-2019 the original author or authors.
|
||||
* Copyright 2015-2020 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -44,10 +44,14 @@ import org.springframework.integration.handler.MessageProcessor;
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
import com.datastax.driver.core.BatchStatement;
|
||||
import com.datastax.driver.core.ResultSet;
|
||||
import com.datastax.driver.core.Statement;
|
||||
import com.datastax.driver.core.exceptions.DriverException;
|
||||
import com.datastax.oss.driver.api.core.DriverException;
|
||||
import com.datastax.oss.driver.api.core.cql.AsyncResultSet;
|
||||
import com.datastax.oss.driver.api.core.cql.BatchStatementBuilder;
|
||||
import com.datastax.oss.driver.api.core.cql.BatchType;
|
||||
import com.datastax.oss.driver.api.core.cql.SimpleStatement;
|
||||
import com.datastax.oss.driver.api.core.cql.Statement;
|
||||
import com.datastax.oss.driver.api.querybuilder.QueryBuilder;
|
||||
import com.datastax.oss.driver.internal.core.cql.SinglePageResultSet;
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
@@ -124,8 +128,9 @@ public class CassandraMessageHandler extends AbstractReplyProducingMessageHandle
|
||||
setStatementExpression(EXPRESSION_PARSER.parseExpression(statementExpression));
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
public void setStatementExpression(Expression statementExpression) {
|
||||
setStatementProcessor(
|
||||
ExpressionEvaluatingMessageProcessor<?> expressionEvaluatingMessageProcessor =
|
||||
new ExpressionEvaluatingMessageProcessor<Statement>(statementExpression, Statement.class) {
|
||||
|
||||
@Override
|
||||
@@ -133,7 +138,8 @@ public class CassandraMessageHandler extends AbstractReplyProducingMessageHandle
|
||||
return (StandardEvaluationContext) CassandraMessageHandler.this.evaluationContext;
|
||||
}
|
||||
|
||||
});
|
||||
};
|
||||
setStatementProcessor((ExpressionEvaluatingMessageProcessor<Statement<?>>) expressionEvaluatingMessageProcessor);
|
||||
}
|
||||
|
||||
public void setQuery(String query) {
|
||||
@@ -154,7 +160,7 @@ public class CassandraMessageHandler extends AbstractReplyProducingMessageHandle
|
||||
this.parameterExpressions.putAll(parameterExpressions);
|
||||
}
|
||||
|
||||
public void setStatementProcessor(MessageProcessor<Statement> statementProcessor) {
|
||||
public void setStatementProcessor(MessageProcessor<Statement<?>> statementProcessor) {
|
||||
Assert.notNull(statementProcessor, "'statementProcessor' must not be null.");
|
||||
this.sessionMessageCallback =
|
||||
(session, requestMessage) ->
|
||||
@@ -179,7 +185,7 @@ public class CassandraMessageHandler extends AbstractReplyProducingMessageHandle
|
||||
/*
|
||||
* Register the Cassandra Query DSL package so they don't need a FQCN for QueryBuilder, for example.
|
||||
*/
|
||||
((StandardTypeLocator) typeLocator).registerImport("com.datastax.driver.core.querybuilder");
|
||||
((StandardTypeLocator) typeLocator).registerImport(QueryBuilder.class.getPackage().getName());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -237,12 +243,15 @@ public class CassandraMessageHandler extends AbstractReplyProducingMessageHandle
|
||||
List<List<?>> rows = (List<List<?>>) payload;
|
||||
return this.cassandraOperations.getReactiveCqlOperations()
|
||||
.execute((ReactiveSessionCallback<WriteResult>) session ->
|
||||
session.prepare(this.ingestQuery)
|
||||
.map(s -> QueryOptionsUtil.addPreparedStatementOptions(s, this.writeOptions))
|
||||
session.prepare(
|
||||
QueryOptionsUtil.addQueryOptions(SimpleStatement.newInstance(this.ingestQuery),
|
||||
this.writeOptions))
|
||||
.flatMapMany(s ->
|
||||
Flux.fromIterable(rows)
|
||||
.map(row -> s.bind(row.toArray())))
|
||||
.collect(BatchStatement::new, BatchStatement::add)
|
||||
.collect(() -> new BatchStatementBuilder(BatchType.UNLOGGED),
|
||||
BatchStatementBuilder::addStatement)
|
||||
.map(BatchStatementBuilder::build)
|
||||
.flatMap(session::execute)
|
||||
.transform(this::transformToWriteResult))
|
||||
.next();
|
||||
@@ -285,7 +294,8 @@ public class CassandraMessageHandler extends AbstractReplyProducingMessageHandle
|
||||
Object payload = requestMessage.getPayload();
|
||||
Mono<ReactiveResultSet> resultSetMono;
|
||||
if (payload instanceof Statement) {
|
||||
resultSetMono = this.cassandraOperations.getReactiveCqlOperations().queryForResultSet((Statement) payload);
|
||||
resultSetMono = this.cassandraOperations.getReactiveCqlOperations()
|
||||
.queryForResultSet((Statement<?>) payload);
|
||||
}
|
||||
else {
|
||||
resultSetMono = this.cassandraOperations.getReactiveCqlOperations()
|
||||
@@ -301,7 +311,8 @@ public class CassandraMessageHandler extends AbstractReplyProducingMessageHandle
|
||||
return resultSetMono
|
||||
.map(DirectFieldAccessor::new)
|
||||
.map(accessor -> accessor.getPropertyValue("resultSet"))
|
||||
.cast(ResultSet.class)
|
||||
.cast(AsyncResultSet.class)
|
||||
.map(SinglePageResultSet::new)
|
||||
.map(WriteResult::of);
|
||||
}
|
||||
|
||||
|
||||
@@ -23,11 +23,13 @@
|
||||
</cassandra:entity>
|
||||
</cassandra:mapping>
|
||||
|
||||
<cassandra:cluster contact-points="${cassandra.contactpoints}" port="${cassandra.port}">
|
||||
<cassandra:keyspace action="CREATE_DROP" name="${cassandra.keyspace}"/>
|
||||
</cassandra:cluster>
|
||||
|
||||
<cassandra:session id="cassandraSession" keyspace-name="${cassandra.keyspace}" schema-action="RECREATE"/>
|
||||
<cassandra:session id="cassandraSession" keyspace-name="${cassandra.keyspace}"
|
||||
contact-points="${cassandra.contactpoints}" port="${cassandra.port}"
|
||||
local-datacenter="datacenter1"
|
||||
cassandra-converter-ref="cassandraConverter"
|
||||
schema-action="RECREATE">
|
||||
<cassandra:keyspace name="${cassandra.keyspace}" action="CREATE_DROP" durable-writes="true"/>
|
||||
</cassandra:session>
|
||||
|
||||
<cassandra:converter id="cassandraConverter"/>
|
||||
|
||||
@@ -55,7 +57,7 @@
|
||||
|
||||
<int-cassandra:outbound-channel-adapter id="cassandraMessageHandler4"
|
||||
cassandra-template="reactiveCassandraTemplate"
|
||||
statement-expression="T(QueryBuilder).truncate('book')"
|
||||
statement-expression="T(QueryBuilder).truncate('book').build()"
|
||||
async="false"/>
|
||||
|
||||
<int:channel id="inputChannel"/>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2015-2019 the original author or authors.
|
||||
* Copyright 2015-2020 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -23,11 +23,12 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.cassandra.exceptions.ConfigurationException;
|
||||
import org.apache.thrift.transport.TTransportException;
|
||||
import org.cassandraunit.utils.EmbeddedCassandraServerHelper;
|
||||
import org.junit.jupiter.api.AfterAll;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.condition.DisabledOnOs;
|
||||
import org.junit.jupiter.api.condition.OS;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.cassandra.core.CassandraTemplate;
|
||||
@@ -42,8 +43,8 @@ import org.springframework.messaging.support.GenericMessage;
|
||||
import org.springframework.test.annotation.DirtiesContext;
|
||||
import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
|
||||
|
||||
import com.datastax.driver.core.querybuilder.QueryBuilder;
|
||||
import com.datastax.driver.core.querybuilder.Select;
|
||||
import com.datastax.oss.driver.api.querybuilder.QueryBuilder;
|
||||
import com.datastax.oss.driver.api.querybuilder.select.Select;
|
||||
import reactor.core.publisher.Mono;
|
||||
import reactor.test.StepVerifier;
|
||||
|
||||
@@ -51,6 +52,7 @@ import reactor.test.StepVerifier;
|
||||
* @author Filippo Balicchia
|
||||
* @author Artem Bilan
|
||||
*/
|
||||
@DisabledOnOs(OS.WINDOWS)
|
||||
@SpringJUnitConfig
|
||||
@DirtiesContext
|
||||
class CassandraOutboundAdapterIntegrationTests {
|
||||
@@ -79,7 +81,7 @@ class CassandraOutboundAdapterIntegrationTests {
|
||||
private FluxMessageChannel resultChannel;
|
||||
|
||||
@BeforeAll
|
||||
static void init() throws TTransportException, IOException, ConfigurationException {
|
||||
static void init() throws IOException, ConfigurationException {
|
||||
EmbeddedCassandraServerHelper.startEmbeddedCassandra(CASSANDRA_CONFIG, "build/embeddedCassandra");
|
||||
EmbeddedCassandraServerHelper.getSession();
|
||||
}
|
||||
@@ -94,8 +96,8 @@ class CassandraOutboundAdapterIntegrationTests {
|
||||
Book b1 = BookSampler.getBook();
|
||||
Message<Book> message = MessageBuilder.withPayload(b1).build();
|
||||
this.cassandraMessageHandler1.send(message);
|
||||
Select select = QueryBuilder.select().all().from("book");
|
||||
List<Book> books = this.cassandraTemplate.select(select, Book.class);
|
||||
Select select = QueryBuilder.selectFrom("book").all();
|
||||
List<Book> books = this.cassandraTemplate.select(select.build(), Book.class);
|
||||
assertThat(books).hasSize(1);
|
||||
this.cassandraTemplate.delete(b1);
|
||||
}
|
||||
@@ -118,7 +120,7 @@ class CassandraOutboundAdapterIntegrationTests {
|
||||
.expectComplete()
|
||||
.verify();
|
||||
|
||||
this.cassandraMessageHandler1.send(new GenericMessage<>(QueryBuilder.truncate("book")));
|
||||
this.cassandraMessageHandler1.send(new GenericMessage<>(QueryBuilder.truncate("book").build()));
|
||||
|
||||
}
|
||||
|
||||
@@ -140,8 +142,8 @@ class CassandraOutboundAdapterIntegrationTests {
|
||||
|
||||
Message<List<List<?>>> message = MessageBuilder.withPayload(ingestBooks).build();
|
||||
this.cassandraMessageHandler3.send(message);
|
||||
Select select = QueryBuilder.select().all().from("book");
|
||||
books = this.cassandraTemplate.select(select, Book.class);
|
||||
Select select = QueryBuilder.selectFrom("book").all();
|
||||
books = this.cassandraTemplate.select(select.build(), Book.class);
|
||||
assertThat(books).hasSize(5);
|
||||
this.cassandraTemplate.batchOps().delete(books);
|
||||
}
|
||||
@@ -150,11 +152,11 @@ class CassandraOutboundAdapterIntegrationTests {
|
||||
void testExpressionTruncate() {
|
||||
Message<Book> message = MessageBuilder.withPayload(BookSampler.getBook()).build();
|
||||
this.cassandraMessageHandler1.send(message);
|
||||
Select select = QueryBuilder.select().all().from("book");
|
||||
List<Book> books = this.cassandraTemplate.select(select, Book.class);
|
||||
Select select = QueryBuilder.selectFrom("book").all();
|
||||
List<Book> books = this.cassandraTemplate.select(select.build(), Book.class);
|
||||
assertThat(books).hasSize(1);
|
||||
this.cassandraMessageHandler4.send(MessageBuilder.withPayload("Empty").build());
|
||||
books = this.cassandraTemplate.select(select, Book.class);
|
||||
books = this.cassandraTemplate.select(select.build(), Book.class);
|
||||
assertThat(books).hasSize(0);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2015-2019 the original author or authors.
|
||||
* Copyright 2015-2020 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -71,4 +71,9 @@ public class IntegrationTestConfig extends AbstractReactiveCassandraConfiguratio
|
||||
.withSimpleReplication());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getLocalDataCenter() {
|
||||
return "datacenter1";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2015-2019 the original author or authors.
|
||||
* Copyright 2015-2020 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -18,8 +18,8 @@ package org.springframework.integration.cassandra.outbound;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -28,6 +28,8 @@ import org.cassandraunit.utils.EmbeddedCassandraServerHelper;
|
||||
import org.junit.jupiter.api.AfterAll;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.condition.DisabledOnOs;
|
||||
import org.junit.jupiter.api.condition.OS;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
@@ -53,9 +55,9 @@ import org.springframework.messaging.support.GenericMessage;
|
||||
import org.springframework.test.annotation.DirtiesContext;
|
||||
import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
|
||||
|
||||
import com.datastax.driver.core.ConsistencyLevel;
|
||||
import com.datastax.driver.core.querybuilder.QueryBuilder;
|
||||
import com.datastax.driver.core.querybuilder.Select;
|
||||
import com.datastax.oss.driver.api.core.ConsistencyLevel;
|
||||
import com.datastax.oss.driver.api.querybuilder.QueryBuilder;
|
||||
import com.datastax.oss.driver.api.querybuilder.select.Select;
|
||||
import reactor.core.publisher.Mono;
|
||||
import reactor.test.StepVerifier;
|
||||
|
||||
@@ -63,6 +65,7 @@ import reactor.test.StepVerifier;
|
||||
* @author Soby Chacko
|
||||
* @author Artem Bilan
|
||||
*/
|
||||
@DisabledOnOs(OS.WINDOWS)
|
||||
@SpringJUnitConfig
|
||||
@DirtiesContext
|
||||
public class CassandraMessageHandlerTests {
|
||||
@@ -107,14 +110,14 @@ public class CassandraMessageHandlerTests {
|
||||
b1.setTitle("Spring Integration Cassandra");
|
||||
b1.setAuthor("Cassandra Guru");
|
||||
b1.setPages(521);
|
||||
b1.setSaleDate(new Date());
|
||||
b1.setSaleDate(LocalDate.now());
|
||||
b1.setInStock(true);
|
||||
|
||||
Message<Book> message = MessageBuilder.withPayload(b1).build();
|
||||
this.cassandraMessageHandler1.handleMessage(message);
|
||||
|
||||
Select select = QueryBuilder.select().all().from("book");
|
||||
List<Book> books = this.template.select(select, Book.class);
|
||||
Select select = QueryBuilder.selectFrom("book").all();
|
||||
List<Book> books = this.template.select(select.build(), Book.class);
|
||||
assertThat(books).hasSize(1);
|
||||
|
||||
this.template.delete(b1);
|
||||
@@ -140,7 +143,7 @@ public class CassandraMessageHandlerTests {
|
||||
.expectComplete()
|
||||
.verify();
|
||||
|
||||
this.cassandraMessageHandler1.handleMessage(new GenericMessage<>(QueryBuilder.truncate("book")));
|
||||
this.cassandraMessageHandler1.handleMessage(new GenericMessage<>(QueryBuilder.truncate("book").build()));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -161,8 +164,8 @@ public class CassandraMessageHandlerTests {
|
||||
Message<List<List<?>>> message = MessageBuilder.withPayload(ingestBooks).build();
|
||||
this.cassandraMessageHandler3.handleMessage(message);
|
||||
|
||||
Select select = QueryBuilder.select().all().from("book");
|
||||
books = this.template.select(select, Book.class);
|
||||
Select select = QueryBuilder.selectFrom("book").all();
|
||||
books = this.template.select(select.build(), Book.class);
|
||||
assertThat(books).hasSize(5);
|
||||
|
||||
this.template.batchOps().delete(books);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2015-2019 the original author or authors.
|
||||
* Copyright 2015-2020 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
package org.springframework.integration.cassandra.test.domain;
|
||||
|
||||
import java.util.Date;
|
||||
import java.time.LocalDate;
|
||||
import java.util.Objects;
|
||||
|
||||
import org.springframework.data.cassandra.core.mapping.Indexed;
|
||||
@@ -43,7 +43,7 @@ public class Book {
|
||||
|
||||
private int pages;
|
||||
|
||||
private Date saleDate;
|
||||
private LocalDate saleDate;
|
||||
|
||||
private boolean isInStock;
|
||||
|
||||
@@ -57,14 +57,14 @@ public class Book {
|
||||
/**
|
||||
* @return Returns the saleDate.
|
||||
*/
|
||||
public Date getSaleDate() {
|
||||
public LocalDate getSaleDate() {
|
||||
return this.saleDate;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param saleDate The saleDate to set.
|
||||
*/
|
||||
public void setSaleDate(Date saleDate) {
|
||||
public void setSaleDate(LocalDate saleDate) {
|
||||
this.saleDate = saleDate;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2015-2019 the original author or authors.
|
||||
* Copyright 2015-2020 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -16,8 +16,8 @@
|
||||
|
||||
package org.springframework.integration.cassandra.test.domain;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
@@ -36,7 +36,7 @@ public final class BookSampler {
|
||||
b.setAuthor("Cassandra Guru puppy");
|
||||
b.setPages(i * 10 + 5);
|
||||
b.setInStock(true);
|
||||
b.setSaleDate(new Date());
|
||||
b.setSaleDate(LocalDate.now());
|
||||
books.add(b);
|
||||
}
|
||||
books.add(getBook());
|
||||
@@ -49,7 +49,7 @@ public final class BookSampler {
|
||||
b1.setTitle("Spring Integration Cassandra");
|
||||
b1.setAuthor("Cassandra Guru");
|
||||
b1.setPages(521);
|
||||
b1.setSaleDate(new Date());
|
||||
b1.setSaleDate(LocalDate.now());
|
||||
b1.setInStock(true);
|
||||
return b1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user