Skip to content

Commit

Permalink
adapt quickstart sample
Browse files Browse the repository at this point in the history
  • Loading branch information
octonato committed Nov 21, 2023
1 parent 9f4c566 commit 5862de3
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 24 deletions.
18 changes: 15 additions & 3 deletions samples/java-protobuf-customer-registry-kafka-quickstart/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -284,9 +284,21 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.2</version>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.10.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>5.10.1 </version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<version>5.10.1</version>
<scope>test</scope>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
import kalix.javasdk.testkit.EventingTestKit;
import kalix.javasdk.testkit.KalixTestKit;
import kalix.javasdk.testkit.junit.KalixTestKitResource;
import org.junit.ClassRule;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;

import java.time.Duration;
import java.time.temporal.ChronoUnit;
Expand All @@ -16,7 +16,7 @@
import java.util.concurrent.TimeoutException;

import static java.util.concurrent.TimeUnit.SECONDS;
import static org.junit.Assert.assertEquals;
import static org.junit.jupiter.api.Assertions.assertEquals;

// This class was initially generated based on the .proto definition by Kalix tooling.
//
Expand All @@ -30,10 +30,11 @@ public class CustomerActionIntegrationTest {
/**
* The test kit starts both the service container and the Kalix proxy.
*/
@ClassRule
@RegisterExtension
public static final KalixTestKitResource testKit =
new KalixTestKitResource(Main.createKalix(), KalixTestKit.Settings.DEFAULT.withTopicOutgoingMessages("customer_changes"));


/**
* Use the generated gRPC client to call the service through the Kalix proxy.
*/
Expand Down Expand Up @@ -70,7 +71,7 @@ public void createAndPublish() throws Exception {
.get(5, SECONDS);

// wait for action to publish the change of state
var nameChangeMsgOut = outTopic.expectOneTyped(CustomerApi.Customer.class);
var nameChangeMsgOut = outTopic.expectOneTyped(CustomerApi.Customer.class, Duration.of(10, ChronoUnit.SECONDS));
assertEquals(completeName, nameChangeMsgOut.getPayload().getName());

outTopic.expectNone(); // no more messages are sent
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,19 @@
import org.apache.kafka.clients.consumer.KafkaConsumer;
import org.apache.kafka.common.serialization.ByteArrayDeserializer;
import org.apache.kafka.common.serialization.StringDeserializer;
import org.junit.ClassRule;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;

import java.time.Duration;
import java.time.temporal.ChronoUnit;
import java.util.*;
import java.util.Collections;
import java.util.Properties;
import java.util.UUID;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;

import static java.time.Duration.ofSeconds;
import static java.util.concurrent.TimeUnit.SECONDS;
import static org.junit.Assert.assertTrue;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.testcontainers.shaded.org.awaitility.Awaitility.await;

// This class was initially generated based on the .proto definition by Kalix tooling.
Expand All @@ -38,7 +38,7 @@ public class CustomerActionWithKafkaIntegrationTest {
/**
* The test kit starts both the service container and the Kalix proxy.
*/
@ClassRule
@RegisterExtension
public static final KalixTestKitResource testKit;
static KalixTestKit.Settings settings;

Expand All @@ -48,6 +48,7 @@ public class CustomerActionWithKafkaIntegrationTest {
settings);
}


/**
* Use the generated gRPC client to call the service through the Kalix proxy.
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
package customer.api;

import java.util.UUID;

import kalix.javasdk.testkit.junit.KalixTestKitResource;
import customer.Main;
import customer.api.CustomerApi;
import customer.api.CustomerService;
import org.junit.ClassRule;
import org.junit.Test;
import kalix.javasdk.testkit.junit.KalixTestKitResource;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;

import java.util.UUID;

import static java.util.concurrent.TimeUnit.SECONDS;
import static org.junit.Assert.assertEquals;
import static org.junit.jupiter.api.Assertions.assertEquals;

// This class was initially generated based on the .proto definition by Kalix tooling.
//
Expand All @@ -24,7 +22,7 @@ public class CustomerIntegrationTest {
/**
* The test kit starts both the service container and the Kalix proxy.
*/
@ClassRule
@RegisterExtension
public static final KalixTestKitResource testKit =
new KalixTestKitResource(Main.createKalix());

Expand Down

0 comments on commit 5862de3

Please sign in to comment.