Skip to content

Commit

Permalink
adding new lines and formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
salaboy committed Feb 13, 2025
1 parent fb66683 commit a06fd49
Show file tree
Hide file tree
Showing 14 changed files with 311 additions and 309 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,10 @@ public class DaprContainerIT {

@Container
private static final DaprContainer DAPR_CONTAINER = new DaprContainer("daprio/daprd")
.withAppName("dapr-app")
.withAppPort(8081)
.withAppChannelAddress("host.testcontainers.internal");
.withAppName("dapr-app")
.withAppPort(8081)
.withAppHealthCheckPath("/actuator/health")
.withAppChannelAddress("host.testcontainers.internal");

/**
* Sets the Dapr properties for the test.
Expand All @@ -80,31 +81,31 @@ private void configStub() {
.willReturn(aResponse().withBody("[]").withStatus(200)));

stubFor(any(urlMatching("/dapr/subscribe"))
.willReturn(aResponse().withBody("[]").withStatus(200)));
.willReturn(aResponse().withBody("[]").withStatus(200)));

stubFor(get(urlMatching("/dapr/config"))
.willReturn(aResponse().withBody("[]").withStatus(200)));
.willReturn(aResponse().withBody("[]").withStatus(200)));

stubFor(any(urlMatching("/([a-z1-9]*)"))
.willReturn(aResponse().withBody("[]").withStatus(200)));
.willReturn(aResponse().withBody("[]").withStatus(200)));

// create a stub
stubFor(post(urlEqualTo("/events"))
.willReturn(aResponse().withBody("event received!").withStatus(200)));
.willReturn(aResponse().withBody("event received!").withStatus(200)));

configureFor("localhost", 8081);
}

@Test
public void testDaprContainerDefaults() {
assertEquals(2,
DAPR_CONTAINER.getComponents().size(),
"The pubsub and kvstore component should be configured by default"
DAPR_CONTAINER.getComponents().size(),
"The pubsub and kvstore component should be configured by default"
);
assertEquals(
1,
DAPR_CONTAINER.getSubscriptions().size(),
"A subscription should be configured by default if none is provided"
1,
DAPR_CONTAINER.getSubscriptions().size(),
"A subscription should be configured by default if none is provided"
);
}

Expand All @@ -131,10 +132,10 @@ public void testPlacement() throws Exception {
Thread.sleep(1000);

OkHttpClient okHttpClient = new OkHttpClient.Builder()
.build();
.build();
Request request = new Request.Builder()
.url(DAPR_CONTAINER.getHttpEndpoint() + "/v1.0/metadata")
.build();
.url(DAPR_CONTAINER.getHttpEndpoint() + "/v1.0/metadata")
.build();

try (Response response = okHttpClient.newCall(request).execute()) {
if (response.isSuccessful() && response.body() != null) {
Expand All @@ -160,7 +161,7 @@ public void testPubSub() throws Exception {

private DaprClientBuilder createDaprClientBuilder() {
return new DaprClientBuilder()
.withPropertyOverride(Properties.HTTP_ENDPOINT, DAPR_CONTAINER.getHttpEndpoint())
.withPropertyOverride(Properties.GRPC_ENDPOINT, DAPR_CONTAINER.getGrpcEndpoint());
.withPropertyOverride(Properties.HTTP_ENDPOINT, DAPR_CONTAINER.getHttpEndpoint())
.withPropertyOverride(Properties.GRPC_ENDPOINT, DAPR_CONTAINER.getGrpcEndpoint());
}
}
174 changes: 87 additions & 87 deletions spring-boot-examples/consumer-app/pom.xml
Original file line number Diff line number Diff line change
@@ -1,99 +1,99 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>io.dapr</groupId>
<artifactId>spring-boot-examples</artifactId>
<version>0.14.0-SNAPSHOT</version>
</parent>
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>io.dapr</groupId>
<artifactId>spring-boot-examples</artifactId>
<version>0.14.0-SNAPSHOT</version>
</parent>

<artifactId>consumer-app</artifactId>
<name>consumer-app</name>
<description>Spring Boot, Testcontainers and Dapr Integration Examples :: Consumer App</description>
<artifactId>consumer-app</artifactId>
<name>consumer-app</name>
<description>Spring Boot, Testcontainers and Dapr Integration Examples :: Consumer App</description>

<properties>
<springboot.version>3.2.6</springboot.version>
</properties>
<properties>
<springboot.version>3.2.6</springboot.version>
</properties>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>${springboot.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>${springboot.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>

<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>io.dapr.spring</groupId>
<artifactId>dapr-spring-boot-starter</artifactId>
<version>${dapr-java-sdk.alpha-version}</version>
</dependency>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>io.dapr.spring</groupId>
<artifactId>dapr-spring-boot-starter</artifactId>
<version>${dapr-java-sdk.alpha-version}</version>
</dependency>

<dependency>
<groupId>io.dapr.spring</groupId>
<artifactId>dapr-spring-boot-starter</artifactId>
<version>${dapr.sdk.alpha.version}</version>
</dependency>
<dependency>
<groupId>io.dapr.spring</groupId>
<artifactId>dapr-spring-boot-starter</artifactId>
<version>${dapr.sdk.alpha.version}</version>
</dependency>

<dependency>
<groupId>io.dapr.spring</groupId>
<artifactId>dapr-spring-boot-starter-test</artifactId>
<version>${dapr.sdk.alpha.version}</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>junit-jupiter</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>postgresql</artifactId>
<version>1.20.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>rabbitmq</artifactId>
<version>1.20.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>kafka</artifactId>
<version>1.20.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.dapr.spring</groupId>
<artifactId>dapr-spring-boot-starter-test</artifactId>
<version>${dapr.sdk.alpha.version}</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>io.rest-assured</groupId>
<artifactId>rest-assured</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>junit-jupiter</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>postgresql</artifactId>
<version>1.20.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>rabbitmq</artifactId>
<version>1.20.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>kafka</artifactId>
<version>1.20.0</version>
<scope>test</scope>
</dependency>

<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
<dependency>
<groupId>io.rest-assured</groupId>
<artifactId>rest-assured</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>

</project>
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
dapr.pubsub.name=pubsub
spring.application.name=consumer-app
server.port=8081

Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,10 @@
public class TestConsumerApplication {

public static void main(String[] args) {
org.testcontainers.Testcontainers.exposeHostPorts(8081);
SpringApplication
.from(ConsumerApplication::main)
SpringApplication.from(ConsumerApplication::main)
.with(DaprTestContainersConfig.class)
.run(args);
org.testcontainers.Testcontainers.exposeHostPorts(8081);
}


Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
dapr.pubsub.name=pubsub
server.port=8081
server.port=8081
2 changes: 1 addition & 1 deletion spring-boot-examples/kubernetes/consumer-app.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@ spec:
imagePullPolicy: Always
ports:
- containerPort: 8081
name: consumer-app
name: consumer-app
2 changes: 1 addition & 1 deletion spring-boot-examples/kubernetes/kvbinding.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ spec:
value: host=postgresql.default.svc.cluster.local user=postgres password=password port=5432 connect_timeout=10
database=dapr
scopes:
- producer-app
- producer-app
2 changes: 1 addition & 1 deletion spring-boot-examples/kubernetes/kvstore.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ spec:
value: host=postgresql.default.svc.cluster.local user=postgres password=password port=5432 connect_timeout=10
database=dapr
scopes:
- producer-app
- producer-app
2 changes: 1 addition & 1 deletion spring-boot-examples/kubernetes/producer-app.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@ spec:
imagePullPolicy: Always
ports:
- containerPort: 8080
name: producer-app
name: producer-app
2 changes: 1 addition & 1 deletion spring-boot-examples/kubernetes/pubsub.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ spec:
- name: user
value: guest
- name: password
value: guest
value: guest
Loading

0 comments on commit a06fd49

Please sign in to comment.