-
Notifications
You must be signed in to change notification settings - Fork 207
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding @ServiceConnection spring boot support with Testcontainers #1118
Merged
Merged
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
1548595
adding service connection plumbing
salaboy d70bc0d
fixing style
salaboy 227283d
updating sdk-tests
salaboy 23d111e
Update dapr-spring/dapr-spring-boot-autoconfigure/src/main/java/io/da…
salaboy 4c4a25e
Update dapr-spring/dapr-spring-boot-autoconfigure/src/main/java/io/da…
salaboy 841d603
fixing details
salaboy b98240e
adding @ServiceConnection to Dapr
salaboy 8cd1bb7
fixing tests and style
salaboy 78d6849
removing test that is not needed anymore
salaboy 9f507c3
updating starter dependencies
salaboy 8a52c4b
adding juniper testcontainers support
salaboy 2720f91
adding new testing module
salaboy bec5a9f
cleaning sdk-tests deps
salaboy c16f5af
removing dead code
salaboy 8c052ec
removing core that is not needed
salaboy f23514a
adding setters
salaboy 82eb498
default constructor
salaboy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 0 additions & 52 deletions
52
...e/src/main/java/io/dapr/spring/boot/autoconfigure/client/DaprClientBuilderConfigurer.java
This file was deleted.
Oops, something went wrong.
78 changes: 78 additions & 0 deletions
78
...onfigure/src/main/java/io/dapr/spring/boot/autoconfigure/client/DaprClientProperties.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
/* | ||
* Copyright 2024 The Dapr Authors | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package io.dapr.spring.boot.autoconfigure.client; | ||
|
||
import io.dapr.spring.data.DaprKeyValueAdapterResolver; | ||
import org.springframework.boot.context.properties.ConfigurationProperties; | ||
|
||
@ConfigurationProperties(prefix = "dapr.client") | ||
public class DaprClientProperties { | ||
private String httpEndpoint; | ||
private String grpcEndpoint; | ||
private Integer httpPort; | ||
private Integer grpcPort; | ||
|
||
|
||
/** | ||
* Constructs a {@link DaprClientProperties}. | ||
*/ | ||
public DaprClientProperties() { | ||
} | ||
|
||
/** | ||
* Constructs a {@link DaprClientProperties}. | ||
* @param httpEndpoint http endpoint to interact with the Dapr Sidecar | ||
* @param grpcEndpoint grpc endpoint to interact with the Dapr Sidecar | ||
* @param httpPort http port to interact with the Dapr Sidecar | ||
* @param grpcPort grpc port to interact with the Dapr Sidecar | ||
*/ | ||
public DaprClientProperties(String httpEndpoint, String grpcEndpoint, Integer httpPort, Integer grpcPort) { | ||
this.httpEndpoint = httpEndpoint; | ||
this.grpcEndpoint = grpcEndpoint; | ||
this.httpPort = httpPort; | ||
this.grpcPort = grpcPort; | ||
} | ||
|
||
public String getHttpEndpoint() { | ||
return httpEndpoint; | ||
} | ||
|
||
public String getGrpcEndpoint() { | ||
return grpcEndpoint; | ||
} | ||
|
||
public Integer getHttpPort() { | ||
return httpPort; | ||
} | ||
|
||
public Integer getGrpcPort() { | ||
return grpcPort; | ||
} | ||
|
||
salaboy marked this conversation as resolved.
Show resolved
Hide resolved
|
||
public void setHttpEndpoint(String httpEndpoint) { | ||
this.httpEndpoint = httpEndpoint; | ||
} | ||
|
||
public void setGrpcEndpoint(String grpcEndpoint) { | ||
this.grpcEndpoint = grpcEndpoint; | ||
} | ||
|
||
public void setHttpPort(Integer httpPort) { | ||
this.httpPort = httpPort; | ||
} | ||
|
||
public void setGrpcPort(Integer grpcPort) { | ||
this.grpcPort = grpcPort; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
...c/main/java/io/dapr/spring/boot/autoconfigure/client/PropertiesDaprConnectionDetails.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
* Copyright 2024 The Dapr Authors | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package io.dapr.spring.boot.autoconfigure.client; | ||
|
||
class PropertiesDaprConnectionDetails implements DaprConnectionDetails { | ||
|
||
private final DaprClientProperties daprClientProperties; | ||
|
||
public PropertiesDaprConnectionDetails(DaprClientProperties daprClientProperties) { | ||
this.daprClientProperties = daprClientProperties; | ||
} | ||
|
||
@Override | ||
public String httpEndpoint() { | ||
return this.daprClientProperties.getHttpEndpoint(); | ||
} | ||
|
||
@Override | ||
public String grpcEndpoint() { | ||
return this.daprClientProperties.getGrpcEndpoint(); | ||
} | ||
|
||
@Override | ||
public Integer httpPort() { | ||
return this.daprClientProperties.getHttpPort(); | ||
} | ||
|
||
@Override | ||
public Integer grpcPort() { | ||
return this.daprClientProperties.getGrpcPort(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
dapr-spring/dapr-spring-boot-starters/dapr-spring-boot-starter-test/pom.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" | ||
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.spring</groupId> | ||
<artifactId>dapr-spring-parent</artifactId> | ||
<version>0.13.0-SNAPSHOT</version> | ||
<relativePath>../../pom.xml</relativePath> | ||
</parent> | ||
|
||
<artifactId>dapr-spring-boot-starter-test</artifactId> | ||
<name>dapr-spring-boot-starter-test</name> | ||
<description>Dapr Spring Boot Starter Tests (with Testcontainers Support)</description> | ||
<packaging>jar</packaging> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-test</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.dapr.spring</groupId> | ||
<artifactId>dapr-spring-boot-tests</artifactId> | ||
<version>${project.parent.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.dapr</groupId> | ||
<artifactId>testcontainers-dapr</artifactId> | ||
<version>${project.parent.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-testcontainers</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.testcontainers</groupId> | ||
<artifactId>junit-jupiter</artifactId> | ||
<optional>true</optional> | ||
</dependency> | ||
</dependencies> | ||
|
||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a small question, should we use the old Java style Java Beans or should we recommend users to go with
Java records
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
both should be fine right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO, I would go with java beans in order to add javadoc and could generate the metadata, the configuration processor is already in the classpath. See https://docs.spring.io/spring-boot/specification/configuration-metadata/annotation-processor.html