Skip to content
This repository has been archived by the owner on Mar 30, 2023. It is now read-only.

Commit

Permalink
Upgrade to latest releases
Browse files Browse the repository at this point in the history
* Upgrade to Gradle 6.1.1
* Fix for latest Checkstyle
* Fix for latest SI-Kotlin-DSL
  • Loading branch information
artembilan committed Feb 14, 2020
1 parent c61c02e commit a6f1b8a
Show file tree
Hide file tree
Showing 7 changed files with 60 additions and 67 deletions.
28 changes: 13 additions & 15 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
buildscript {
ext.kotlinVersion = '1.3.50'
ext.kotlinVersion = '1.3.61'
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
classpath "org.jetbrains.kotlin:kotlin-allopen:$kotlinVersion"
Expand All @@ -13,8 +13,8 @@ plugins {
id 'jacoco'
id 'org.sonarqube' version '2.8'
id 'checkstyle'
id 'org.ajoberstar.grgit' version '3.1.1'
id 'io.spring.dependency-management' version '1.0.8.RELEASE'
id 'org.ajoberstar.grgit' version '4.0.1'
id 'io.spring.dependency-management' version '1.0.9.RELEASE'
}

description = 'Spring Integration Kafka Support'
Expand Down Expand Up @@ -49,25 +49,24 @@ compileJava {

compileTestKotlin {
kotlinOptions {
freeCompilerArgs = ['-Xjsr305=strict']
jvmTarget = '1.8'
}
}

ext {
assertkVersion = '0.20'
jacksonVersion = '2.10.0'
junitJupiterVersion = '5.5.2'
log4jVersion = '2.12.1'
springIntegrationVersion = '5.2.1.RELEASE'
springIntegrationKotlinVersion = '0.0.2.RELEASE'
springKafkaVersion = '2.3.3.RELEASE'
jacksonVersion = '2.10.1'
junitJupiterVersion = '5.6.0'
log4jVersion = '2.13.0'
springIntegrationVersion = '5.2.3.RELEASE'
springIntegrationKotlinVersion = '0.0.3.BUILD-SNAPSHOT'
springKafkaVersion = '2.3.5.RELEASE'

idPrefix = 'kafka'

linkHomepage = 'https://github.com/spring-projects/spring-integration-kafka'
linkCi = 'https://build.spring.io/browse/INTEXT'
linkIssue = 'https://jira.spring.io/browse/INTEXT'
linkIssue = 'https://github.com/spring-projects/spring-integration-kafka/issues'
linkScmUrl = 'https://github.com/spring-projects/spring-integration-kafka'
linkScmConnection = 'https://github.com/spring-projects/spring-integration-kafka.git'
linkScmDevConnection = 'git@github.com:spring-projects/spring-integration-kafka.git'
Expand Down Expand Up @@ -95,7 +94,7 @@ dependencyManagement {
eclipse.project.natures += 'org.springframework.ide.eclipse.core.springnature'

jacoco {
toolVersion = '0.8.4'
toolVersion = '0.8.5'
}

dependencies {
Expand Down Expand Up @@ -128,15 +127,14 @@ test {
logging.captureStandardOutput(LogLevel.INFO)
maxHeapSize = '1024m'
jacoco {
append = false
destinationFile = file("$buildDir/jacoco.exec")
}
useJUnitPlatform()
}

checkstyle {
configFile = new File(rootDir, 'src/checkstyle/checkstyle.xml')
toolVersion = '8.25'
configFile = file("$rootDir/src/checkstyle/checkstyle.xml")
toolVersion = '8.29'
}

task updateCopyrights {
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -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 changes: 12 additions & 17 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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" "$@"
13 changes: 7 additions & 6 deletions publish-maven.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -67,16 +67,17 @@ 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"]
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2013-2019 the original author or authors.
* Copyright 2013-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.
Expand Down Expand Up @@ -522,7 +522,7 @@ private byte[] getSingleReplyTopic() {
}

private void determineValidReplyTopicsAndPartitions() {
ReplyingKafkaTemplate<?, ?, ?> rkt = (ReplyingKafkaTemplate<?, ?, ?>) kafkaTemplate;
ReplyingKafkaTemplate<?, ?, ?> rkt = (ReplyingKafkaTemplate<?, ?, ?>) this.kafkaTemplate;
Collection<TopicPartition> replyTopics = rkt.getAssignedReplyTopicPartitions();
Map<String, Set<Integer>> topicsAndPartitions = new HashMap<>();
if (replyTopics != null) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2018-2019 the original author or authors.
* Copyright 2018-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.
Expand All @@ -14,7 +14,7 @@
* limitations under the License.
*/

package org.springframework.integration.kafka.dsl
package org.springframework.integration.kafka.dsl.kotlin

import assertk.assertThat
import assertk.assertions.isEqualTo
Expand All @@ -27,7 +27,7 @@ import org.apache.kafka.clients.consumer.ConsumerConfig
import org.apache.kafka.clients.consumer.ConsumerRebalanceListener
import org.apache.kafka.clients.producer.ProducerConfig
import org.apache.kafka.common.TopicPartition
import org.junit.Test
import org.junit.jupiter.api.Test
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.beans.factory.annotation.Qualifier
import org.springframework.context.annotation.Bean
Expand All @@ -37,8 +37,9 @@ import org.springframework.integration.MessageRejectedException
import org.springframework.integration.channel.QueueChannel
import org.springframework.integration.config.EnableIntegration
import org.springframework.integration.dsl.Pollers
import org.springframework.integration.dsl.integrationFlow
import org.springframework.integration.dsl.kotlin.integrationFlow
import org.springframework.integration.handler.advice.ErrorMessageSendingRecoverer
import org.springframework.integration.kafka.dsl.Kafka
import org.springframework.integration.kafka.inbound.KafkaMessageDrivenChannelAdapter
import org.springframework.integration.kafka.outbound.KafkaProducerMessageHandler
import org.springframework.integration.kafka.support.RawRecordHeaderErrorMessageStrategy
Expand Down Expand Up @@ -251,9 +252,9 @@ class KafkaDslKotlinTests {
RawRecordHeaderErrorMessageStrategy()))
.retryTemplate(RetryTemplate())
.filterInRetry(true)) {
filter<Message<*>>({ m -> (m.headers[KafkaHeaders.RECEIVED_MESSAGE_KEY] as Int) < 101 }) { f -> f.throwExceptionOnRejection(true) }
transform<String, String>({ it.toUpperCase() })
channel { c -> c.queue("listeningFromKafkaResults1") }
filter<Message<*>>({ m -> (m.headers[KafkaHeaders.RECEIVED_MESSAGE_KEY] as Int) < 101 }) { throwExceptionOnRejection(true) }
transform<String> { it.toUpperCase() }
channel { queue("listeningFromKafkaResults1") }
}

@Bean
Expand All @@ -266,9 +267,9 @@ class KafkaDslKotlinTests {
RawRecordHeaderErrorMessageStrategy()))
.retryTemplate(RetryTemplate())
.filterInRetry(true)) {
filter<Message<*>>({ m -> (m.headers[KafkaHeaders.RECEIVED_MESSAGE_KEY] as Int) < 101 }) { it.throwExceptionOnRejection(true) }
transform<String, String>({ it.toUpperCase() })
channel { c -> c.queue("listeningFromKafkaResults2") }
filter<Message<*>>({ m -> (m.headers[KafkaHeaders.RECEIVED_MESSAGE_KEY] as Int) < 101 }) { throwExceptionOnRejection(true) }
transform<String> { it.toUpperCase() }
channel { queue("listeningFromKafkaResults2") }
}

@Bean
Expand All @@ -281,20 +282,18 @@ class KafkaDslKotlinTests {
@Bean
fun sendToKafkaFlow() =
integrationFlow {
split<String>({ p -> Stream.generate { p }.limit(101) })
split<String> { p -> Stream.generate { p }.limit(101) }
publishSubscribeChannel {
it
.subscribe {
it.handle(kafkaMessageHandler(producerFactory(), TEST_TOPIC1)
.timestampExpression("T(Long).valueOf('1487694048633')")
) { it.id("kafkaProducer1") }
}
.subscribe {
it.handle(
kafkaMessageHandler(producerFactory(), TEST_TOPIC2)
.timestamp<Any> { 1487694048644L }
) { it.id("kafkaProducer2") }
}
subscribe(integrationFlow {
handle(kafkaMessageHandler(producerFactory(), TEST_TOPIC1)
.timestampExpression("T(Long).valueOf('1487694048633')")
) { id("kafkaProducer1") }
})
subscribe(integrationFlow {
handle(kafkaMessageHandler(producerFactory(), TEST_TOPIC2)
.timestamp<Any> { 1487694048644L }
) { id("kafkaProducer2") }
})
}
}

Expand All @@ -303,7 +302,7 @@ class KafkaDslKotlinTests {

private fun kafkaMessageHandler(producerFactory: ProducerFactory<Int, String>, topic: String) =
Kafka.outboundChannelAdapter(producerFactory)
.messageKey<Any> { m -> m.headers[IntegrationMessageHeaderAccessor.SEQUENCE_NUMBER] }
.messageKey<Any> { it.headers[IntegrationMessageHeaderAccessor.SEQUENCE_NUMBER] }
.headerMapper(mapper())
.sync(true)
.partitionId<Any> { 0 }
Expand All @@ -314,7 +313,7 @@ class KafkaDslKotlinTests {
@Bean
fun sourceFlow() =
integrationFlow(Kafka.inboundChannelAdapter(consumerFactory(), ConsumerProperties(TEST_TOPIC3)),
{ e -> e.poller(Pollers.fixedDelay(100)) }) {
{ poller(Pollers.fixedDelay(100)) }) {
handle { m ->
this@ContextConfiguration.fromSource = m.payload
this@ContextConfiguration.sourceFlowLatch.countDown()
Expand Down Expand Up @@ -355,7 +354,7 @@ class KafkaDslKotlinTests {
@Bean
fun serverGateway() =
integrationFlow(Kafka.inboundGateway(consumerFactory(), containerProperties(), producerFactory())) {
transform<String, String>({ it.toUpperCase() })
transform<String> { it.toUpperCase() }
}

private fun containerProperties() =
Expand Down

0 comments on commit a6f1b8a

Please sign in to comment.