Skip to content

Commit

Permalink
Back to Spring Boot 2.x (#15)
Browse files Browse the repository at this point in the history
* Back to Spring Boot 2.x

* Mock lambda does not work
  • Loading branch information
rogervinas authored Dec 1, 2023
1 parent 4e90a28 commit 066b023
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- name: Set up Java
uses: actions/setup-java@v3
with:
java-version: 21
java-version: 17
distribution: 'temurin'
- name: Gradle cache
uses: actions/cache@v3
Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[![CI](https://github.com/rogervinas/spring-cloud-stream-kafka-avro-schema-registry/actions/workflows/gradle.yml/badge.svg)](https://github.com/rogervinas/spring-cloud-stream-kafka-avro-schema-registry/actions/workflows/gradle.yml)
![Java](https://img.shields.io/badge/Java-21-blue?labelColor=black)
![Java](https://img.shields.io/badge/Java-17-blue?labelColor=black)
![Kotlin](https://img.shields.io/badge/Kotlin-1.9.21-blue?labelColor=black)
![SpringBoot](https://img.shields.io/badge/SpringBoot-3.2.0-blue?labelColor=black)
![SpringCloud](https://img.shields.io/badge/SpringCloud-2023.0.0_RC1-blue?labelColor=black)
![SpringBoot](https://img.shields.io/badge/SpringBoot-2.7.8-blue?labelColor=black)
![SpringCloud](https://img.shields.io/badge/SpringCloud-2021.0.8-blue?labelColor=black)

# Spring Cloud Stream Kafka & Confluent Avro Schema Registry

Expand Down Expand Up @@ -308,7 +308,7 @@ To produce test messages we will use a simple [KafkaProducer using the Avro Seri
First of all we will mock the `process` @Bean so we can verify it has been called:
```kotlin
@MockBean(name = "myConsumer")
private lateinit var myConsumer: (Sensor) -> Unit
private lateinit var myConsumer: Consumer<Sensor>
```

Then we test that we can consume Sensor v1 messages:
Expand Down Expand Up @@ -344,7 +344,7 @@ fun `should consume sensor v1 message`() {
produceRecord(id, recordV1)

verify(myConsumer, timeout(TIMEOUT.toMillis()))
.invoke(Sensor(id, temperature, 0f, acceleration, velocity))
.accept(Sensor(id, temperature, 0f, acceleration, velocity))
}
```

Expand Down Expand Up @@ -388,7 +388,7 @@ fun `should consume sensor v2 message`() {
produceRecord(id, recordV2)

verify(myConsumer, timeout(TIMEOUT.toMillis()))
.invoke(Sensor(id, internalTemperature, externalTemperature, acceleration, velocity))
.accept(Sensor(id, internalTemperature, externalTemperature, acceleration, velocity))
}
```

Expand Down
10 changes: 5 additions & 5 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@ import org.gradle.api.tasks.testing.logging.TestLogEvent.*
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
id("org.springframework.boot") version "3.2.0" apply false
id("io.spring.dependency-management") version "1.1.4"
id("org.springframework.boot") version "2.7.8" apply false
id("io.spring.dependency-management") version "1.0.15.RELEASE"
id("com.github.davidmc24.gradle.plugin.avro") version "1.9.1"
id("org.jetbrains.kotlin.jvm") version "1.9.21"
id("org.jetbrains.kotlin.plugin.spring") version "1.9.21"
}

group = "com.rogervinas"
version = "0.0.1-SNAPSHOT"
java.sourceCompatibility = JavaVersion.VERSION_21
java.sourceCompatibility = JavaVersion.VERSION_17

val springCloudVersion = "2023.0.0-RC1"
val springCloudVersion = "2021.0.8"

allprojects {
repositories {
Expand Down Expand Up @@ -54,7 +54,7 @@ subprojects {
tasks.withType<KotlinCompile> {
kotlinOptions {
freeCompilerArgs = listOf("-Xjsr305=strict")
jvmTarget = "21"
jvmTarget = "17"
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class ConsumerApplicationTest {
}

@MockBean(name = "myConsumer")
private lateinit var myConsumer: (Sensor) -> Unit
private lateinit var myConsumer: Consumer<Sensor>

@Test
fun `should consume sensor v1 message`() {
Expand Down Expand Up @@ -77,7 +77,7 @@ class ConsumerApplicationTest {
produceRecord(id, recordV1)

verify(myConsumer, timeout(TIMEOUT.toMillis()))
.invoke(Sensor(id, temperature, 0f, acceleration, velocity))
.accept(Sensor(id, temperature, 0f, acceleration, velocity))
}

@Test
Expand Down Expand Up @@ -118,7 +118,7 @@ class ConsumerApplicationTest {
produceRecord(id, recordV2)

verify(myConsumer, timeout(TIMEOUT.toMillis()))
.invoke(Sensor(id, internalTemperature, externalTemperature, acceleration, velocity))
.accept(Sensor(id, internalTemperature, externalTemperature, acceleration, velocity))
}

private fun createRecord(schema: String): GenericRecord {
Expand Down

0 comments on commit 066b023

Please sign in to comment.