Skip to content

Commit edde973

Browse files
committed
Merge branch 'master' of https://github.com/siri-varma/java-sdk
2 parents 29eac2e + a822f8b commit edde973

File tree

37 files changed

+1387
-82
lines changed

37 files changed

+1387
-82
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
GOPROXY: https://proxy.golang.org
4040
JDK_VER: ${{ matrix.java }}
4141
DAPR_CLI_VER: 1.15.0
42-
DAPR_RUNTIME_VER: 1.15.4
42+
DAPR_RUNTIME_VER: 1.15.7
4343
DAPR_INSTALL_URL: https://raw.githubusercontent.com/dapr/cli/v1.15.0/install/install.sh
4444
DAPR_CLI_REF:
4545
DAPR_REF:
@@ -191,3 +191,4 @@ jobs:
191191
export GPG_TTY=$(tty)
192192
gpg --batch --import private-key.gpg
193193
./mvnw -V -B -Dgpg.skip=false -s settings.xml deploy
194+
curl -X POST https://ossrh-staging-api.central.sonatype.com/manual/upload/defaultRepository/io.dapr

.github/workflows/validate.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838
GOPROXY: https://proxy.golang.org
3939
JDK_VER: ${{ matrix.java }}
4040
DAPR_CLI_VER: 1.15.0
41-
DAPR_RUNTIME_VER: 1.15.4
41+
DAPR_RUNTIME_VER: 1.15.7
4242
DAPR_INSTALL_URL: https://raw.githubusercontent.com/dapr/cli/v1.15.0/install/install.sh
4343
DAPR_CLI_REF:
4444
DAPR_REF:

dapr-spring/dapr-spring-boot-autoconfigure/src/main/java/io/dapr/spring/boot/autoconfigure/client/ClientPropertiesDaprConnectionDetails.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,10 @@ public Integer getHttpPort() {
4040
public Integer getGrpcPort() {
4141
return this.daprClientProperties.getGrpcPort();
4242
}
43+
44+
@Override
45+
public String getApiToken() {
46+
return this.daprClientProperties.getApiToken();
47+
}
48+
4349
}

dapr-spring/dapr-spring-boot-autoconfigure/src/main/java/io/dapr/spring/boot/autoconfigure/client/DaprClientAutoConfiguration.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,11 @@ DaprClientBuilder daprClientBuilder(DaprConnectionDetails daprConnectionDetails)
6868
builder.withPropertyOverride(Properties.GRPC_PORT, String.valueOf(grpcPort));
6969
}
7070

71+
String apiToken = daprConnectionDetails.getApiToken();
72+
if (apiToken != null) {
73+
builder.withPropertyOverride(Properties.API_TOKEN, apiToken);
74+
}
75+
7176
return builder;
7277
}
7378

@@ -145,6 +150,11 @@ protected Properties createPropertiesFromConnectionDetails(DaprConnectionDetails
145150
propertyOverrides.put(Properties.GRPC_PORT.getName(), String.valueOf(grpcPort));
146151
}
147152

153+
String apiToken = daprConnectionDetails.getApiToken();
154+
if (apiToken != null) {
155+
propertyOverrides.put(Properties.API_TOKEN.getName(), apiToken);
156+
}
157+
148158
return new Properties(propertyOverrides);
149159
}
150160

dapr-spring/dapr-spring-boot-autoconfigure/src/main/java/io/dapr/spring/boot/autoconfigure/client/DaprClientProperties.java

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313

1414
package io.dapr.spring.boot.autoconfigure.client;
1515

16-
import io.dapr.spring.data.DaprKeyValueAdapterResolver;
1716
import org.springframework.boot.context.properties.ConfigurationProperties;
1817

1918
@ConfigurationProperties(prefix = "dapr.client")
@@ -22,6 +21,7 @@ public class DaprClientProperties {
2221
private String grpcEndpoint;
2322
private Integer httpPort;
2423
private Integer grpcPort;
24+
private String apiToken;
2525

2626
/**
2727
* Constructs a {@link DaprClientProperties}.
@@ -35,12 +35,15 @@ public DaprClientProperties() {
3535
* @param grpcEndpoint grpc endpoint to interact with the Dapr Sidecar
3636
* @param httpPort http port to interact with the Dapr Sidecar
3737
* @param grpcPort grpc port to interact with the Dapr Sidecar
38+
* @param apiToken dapr API token to interact with the Dapr Sidecar
3839
*/
39-
public DaprClientProperties(String httpEndpoint, String grpcEndpoint, Integer httpPort, Integer grpcPort) {
40+
public DaprClientProperties(String httpEndpoint, String grpcEndpoint, Integer httpPort, Integer grpcPort,
41+
String apiToken) {
4042
this.httpEndpoint = httpEndpoint;
4143
this.grpcEndpoint = grpcEndpoint;
4244
this.httpPort = httpPort;
4345
this.grpcPort = grpcPort;
46+
this.apiToken = apiToken;
4447
}
4548

4649
public String getHttpEndpoint() {
@@ -74,4 +77,12 @@ public void setHttpPort(Integer httpPort) {
7477
public void setGrpcPort(Integer grpcPort) {
7578
this.grpcPort = grpcPort;
7679
}
80+
81+
public String getApiToken() {
82+
return apiToken;
83+
}
84+
85+
public void setApiToken(String apiToken) {
86+
this.apiToken = apiToken;
87+
}
7788
}

dapr-spring/dapr-spring-boot-autoconfigure/src/main/java/io/dapr/spring/boot/autoconfigure/client/DaprConnectionDetails.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,6 @@ public interface DaprConnectionDetails extends ConnectionDetails {
2525

2626
Integer getGrpcPort();
2727

28+
String getApiToken();
29+
2830
}

dapr-spring/dapr-spring-boot-autoconfigure/src/test/java/io/dapr/spring/boot/autoconfigure/client/DaprClientPropertiesTest.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,15 @@ public class DaprClientPropertiesTest {
3131
public void shouldCreateDaprClientPropertiesCorrectly() {
3232

3333
DaprClientProperties properties = new DaprClientProperties(
34-
"http://localhost", "localhost", 3500, 50001
34+
"http://localhost", "localhost", 3500, 50001, "ABC"
3535
);
3636

3737
SoftAssertions.assertSoftly(softly -> {
3838
softly.assertThat(properties.getGrpcEndpoint()).isEqualTo("localhost");
3939
softly.assertThat(properties.getHttpEndpoint()).isEqualTo("http://localhost");
4040
softly.assertThat(properties.getHttpPort()).isEqualTo(3500);
4141
softly.assertThat(properties.getGrpcPort()).isEqualTo(50001);
42+
softly.assertThat(properties.getApiToken()).isEqualTo("ABC");
4243
});
4344
}
4445

@@ -52,12 +53,14 @@ public void shouldSetDaprClientPropertiesCorrectly() {
5253
properties.setGrpcPort(50001);
5354
properties.setHttpEndpoint("http://localhost");
5455
properties.setHttpPort(3500);
56+
properties.setApiToken("ABC");
5557

5658
SoftAssertions.assertSoftly(softAssertions -> {
5759
softAssertions.assertThat(properties.getGrpcEndpoint()).isEqualTo("localhost");
5860
softAssertions.assertThat(properties.getHttpEndpoint()).isEqualTo("http://localhost");
5961
softAssertions.assertThat(properties.getHttpPort()).isEqualTo(3500);
6062
softAssertions.assertThat(properties.getGrpcPort()).isEqualTo(50001);
63+
softAssertions.assertThat(properties.getApiToken()).isEqualTo("ABC");
6164
});
6265
}
6366

dapr-spring/dapr-spring-boot-tests/src/main/java/io/dapr/spring/boot/testcontainers/service/connection/DaprContainerConnectionDetailsFactory.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,5 +54,13 @@ public Integer getHttpPort() {
5454
public Integer getGrpcPort() {
5555
return getContainer().getGrpcPort();
5656
}
57+
58+
/*
59+
* No API Token for local container
60+
*/
61+
@Override
62+
public String getApiToken() {
63+
return "";
64+
}
5765
}
5866
}

daprdocs/content/en/java-sdk-contributing/java-contributing.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ When contributing to the [Java SDK](https://github.com/dapr/java-sdk) the follow
1212

1313
The `examples` directory contains code samples for users to run to try out specific functionality of the various Java SDK packages and extensions. When writing new and updated samples keep in mind:
1414

15-
- All examples should be runnable on Windows, Linux, and MacOS. While Java code is consistent among operating systems, any pre/post example commands should provide options through [codetabs]({{< ref "contributing-docs.md#tabbed-content" >}})
15+
- All examples should be runnable on Windows, Linux, and MacOS. While Java code is consistent among operating systems, any pre/post example commands should provide options through [tabpane]({{% ref "contributing-docs.md#tabbed-content" %}})
1616
- Contain steps to download/install any required pre-requisites. Someone coming in with a fresh OS install should be able to start on the example and complete it without an error. Links to external download pages are fine.
1717

1818
## Docs
1919

2020
The `daprdocs` directory contains the markdown files that are rendered into the [Dapr Docs](https://docs.dapr.io) website. When the documentation website is built, this repo is cloned and configured so that its contents are rendered with the docs content. When writing docs, keep in mind:
2121

22-
- All rules in the [docs guide]({{< ref contributing-docs.md >}}) should be followed in addition to these.
22+
- All rules in the [docs guide]({{% ref contributing-docs.md %}}) should be followed in addition to these.
2323
- All files and directories should be prefixed with `java-` to ensure all file/directory names are globally unique across all Dapr documentation.
2424

2525
## Github Dapr Bot Commands

daprdocs/content/en/java-sdk-docs/_index.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ Dapr offers a variety of packages to help with the development of Java applicati
1515

1616
## Prerequisites
1717

18-
- [Dapr CLI]({{< ref install-dapr-cli.md >}}) installed
19-
- Initialized [Dapr environment]({{< ref install-dapr-selfhost.md >}})
18+
- [Dapr CLI]({{% ref install-dapr-cli.md %}}) installed
19+
- Initialized [Dapr environment]({{% ref install-dapr-selfhost.md %}})
2020
- JDK 11 or above - the published jars are compatible with Java 8:
2121
- [AdoptOpenJDK 11 - LTS](https://adoptopenjdk.net/)
2222
- [Oracle's JDK 15](https://www.oracle.com/java/technologies/javase-downloads.html)
@@ -30,9 +30,9 @@ Dapr offers a variety of packages to help with the development of Java applicati
3030

3131
Next, import the Java SDK packages to get started. Select your preferred build tool to learn how to import.
3232

33-
{{< tabs Maven Gradle >}}
33+
{{< tabpane text=true >}}
3434

35-
{{% codetab %}}
35+
{{% tab header="Maven" %}}
3636
<!--Maven-->
3737

3838
For a Maven project, add the following to your `pom.xml` file:
@@ -65,9 +65,9 @@ For a Maven project, add the following to your `pom.xml` file:
6565
...
6666
</project>
6767
```
68-
{{% /codetab %}}
68+
{{% /tab %}}
6969

70-
{{% codetab %}}
70+
{{% tab header="Gradle" %}}
7171
<!--Gradle-->
7272

7373
For a Gradle project, add the following to your `build.gradle` file:
@@ -84,9 +84,9 @@ dependencies {
8484
}
8585
```
8686

87-
{{% /codetab %}}
87+
{{% /tab %}}
8888

89-
{{< /tabs >}}
89+
{{< /tabpane >}}
9090

9191
If you are also using Spring Boot, you may run into a common issue where the `OkHttp` version that the Dapr SDK uses conflicts with the one specified in the Spring Boot _Bill of Materials_.
9292

@@ -106,7 +106,7 @@ Put the Dapr Java SDK to the test. Walk through the Java quickstarts and tutoria
106106

107107
| SDK samples | Description |
108108
| ----------- | ----------- |
109-
| [Quickstarts]({{< ref quickstarts >}}) | Experience Dapr's API building blocks in just a few minutes using the Java SDK. |
109+
| [Quickstarts]({{% ref quickstarts %}}) | Experience Dapr's API building blocks in just a few minutes using the Java SDK. |
110110
| [SDK samples](https://github.com/dapr/java-sdk/tree/master/examples) | Clone the SDK repo to try out some examples and get started. |
111111

112112
```java
@@ -122,7 +122,7 @@ try (DaprClient client = (new DaprClientBuilder()).build()) {
122122
}
123123
```
124124

125-
- For a full guide on output bindings visit [How-To: Output bindings]({{< ref howto-bindings.md >}}).
125+
- For a full guide on output bindings visit [How-To: Output bindings]({{% ref howto-bindings.md %}}).
126126
- Visit [Java SDK examples](https://github.com/dapr/java-sdk/tree/master/examples/src/main/java/io/dapr/examples/bindings/http) for code samples and instructions to try out output bindings.
127127

128128
## Available packages
@@ -132,14 +132,14 @@ try (DaprClient client = (new DaprClientBuilder()).build()) {
132132
<div class="card-body">
133133
<h5 class="card-title"><b>Client</b></h5>
134134
<p class="card-text">Create Java clients that interact with a Dapr sidecar and other Dapr applications.</p>
135-
<a href="{{< ref java-client >}}" class="stretched-link"></a>
135+
<a href="{{% ref java-client %}}" class="stretched-link"></a>
136136
</div>
137137
</div>
138138
<div class="card">
139139
<div class="card-body">
140140
<h5 class="card-title"><b>Workflow</b></h5>
141141
<p class="card-text">Create and manage workflows that work with other Dapr APIs in Java.</p>
142-
<a href="{{< ref workflow >}}" class="stretched-link"></a>
142+
<a href="{{% ref workflow %}}" class="stretched-link"></a>
143143
</div>
144144
</div>
145145
</div>

0 commit comments

Comments
 (0)