Skip to content

moving things around #2

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

Open
wants to merge 34 commits into
base: gh-1088
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
b03da38
Adding multiple Spring Boot enhancements
Jul 23, 2024
fb842fd
Use the proper version
Jul 24, 2024
f2ab6eb
Ensure we send non-nullable values via messaging interface
Jul 24, 2024
197568b
Fix Dapr Workflows version
Jul 24, 2024
e6a69d5
Simplify Dapr Messaging interface
Jul 25, 2024
56b25d2
Extract classes to top level packages
Jul 25, 2024
b0ebde1
Adjust Spring Modules version
Jul 30, 2024
0575c53
Fix version numbers per guidelines
Jul 30, 2024
a1ad4ce
Add dapr-spring module, revert sdk-springboot module
Jul 31, 2024
5d70f47
Add the missing deps for autoconfiguration
Aug 1, 2024
9c8ba5b
Adding dapr-spring-data and dapr-spring-messaging modules
Aug 1, 2024
42129ac
Fixing tests based on Testcontainers PR
Aug 1, 2024
1f78f63
Move ITs to sdk-tests
Aug 1, 2024
901faaf
Adding container log consumer
Aug 5, 2024
2b934b1
Adjust Dapr Spring Modules names
Aug 5, 2024
5ec1a29
Fix Spotbugs
Aug 5, 2024
9d833a4
Add missing version properties
Aug 5, 2024
ec6d9ca
Adding auto-configuration condition on darp.statestore.enabled=true
Aug 5, 2024
4e94d52
Remove conditional property
Aug 5, 2024
498e686
Use @Lazy for KV template to avoid metadata lookup
Aug 5, 2024
c5b3981
Move tests to sdk-tests, move autoconfig to starter
Aug 6, 2024
f2a10ff
Remove redundant dependencies
Aug 6, 2024
4835a20
Instantiate Dapr client in BeforeEach
Aug 6, 2024
5dc39e0
Fix some minor cosmetics
Aug 6, 2024
a8b1cea
Revert unneeded change
Aug 6, 2024
b77818d
Expose Dapr ports explicitly
Aug 6, 2024
9b519da
Expose ports explicitly
Aug 6, 2024
b1f2f35
Add waitForSidecar() to see if this will help
Aug 6, 2024
bea0fb8
Forcibly start the Dapr container in the test
Aug 6, 2024
0cccd32
Ensure waitForSidecar() is used in all tests
Aug 6, 2024
f3900ea
Add logging for more information
Aug 6, 2024
a90baa4
Fix configuration for repository test
Aug 6, 2024
49c8141
moving things around
salaboy Aug 7, 2024
544b4fd
remove wait for sidecar
salaboy Aug 7, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 79 additions & 0 deletions dapr-spring/dapr-spring-boot-autoconfigure/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
<?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.12.0-SNAPSHOT</version>
</parent>

<artifactId>dapr-spring-boot-autoconfigure</artifactId>
<name>dapr-spring-boot-autoconfigure</name>
<description>Dapr Spring Boot Autoconfigure</description>
<packaging>jar</packaging>

<dependencies>
<dependency>
<groupId>io.dapr.spring</groupId>
<artifactId>dapr-spring-core</artifactId>
<version>${project.parent.version}</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>io.dapr.spring</groupId>
<artifactId>dapr-spring-data</artifactId>
<version>${project.parent.version}</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>io.dapr.spring</groupId>
<artifactId>dapr-spring-messaging</artifactId>
<version>${project.parent.version}</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-autoconfigure-processor</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-keyvalue</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>testcontainers</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>junit-jupiter</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>com.vaadin.external.google</groupId>
<artifactId>android-json</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.dapr</groupId>
<artifactId>testcontainers-dapr</artifactId>
<version>${testcontainers-dapr.version}</version>
<scope>test</scope>
</dependency>
</dependencies>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/*
* 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.client.DaprClient;
import io.dapr.client.DaprClientBuilder;
import io.dapr.spring.core.client.DaprClientCustomizer;
import org.springframework.beans.factory.ObjectProvider;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;

import java.util.stream.Collectors;

@AutoConfiguration
@ConditionalOnClass(DaprClient.class)
public class DaprClientAutoConfiguration {

@Bean
@ConditionalOnMissingBean
DaprClientBuilderConfigurer daprClientBuilderConfigurer(ObjectProvider<DaprClientCustomizer> customizerProvider) {
DaprClientBuilderConfigurer configurer = new DaprClientBuilderConfigurer();
configurer.setDaprClientCustomizer(customizerProvider.orderedStream().collect(Collectors.toList()));

return configurer;
}

@Bean
@ConditionalOnMissingBean
DaprClientBuilder daprClientBuilder(DaprClientBuilderConfigurer daprClientBuilderConfigurer) {
DaprClientBuilder builder = new DaprClientBuilder();

return daprClientBuilderConfigurer.configure(builder);
}

@Bean
@ConditionalOnMissingBean
DaprClient daprClient(DaprClientBuilder daprClientBuilder) {
return daprClientBuilder.build();
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/*
* 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.client.DaprClientBuilder;
import io.dapr.spring.core.client.DaprClientCustomizer;

import java.util.List;

/**
* Builder for configuring a {@link DaprClientBuilder}.
*/
public class DaprClientBuilderConfigurer {

private List<DaprClientCustomizer> customizers;

void setDaprClientCustomizer(List<DaprClientCustomizer> customizers) {
this.customizers = customizers;
}

/**
* Configure the specified {@link DaprClientBuilder}. The builder can be further
* tuned and default settings can be overridden.
*
* @param builder the {@link DaprClientBuilder} instance to configure
* @return the configured builder
*/
public DaprClientBuilder configure(DaprClientBuilder builder) {
applyCustomizers(builder);
return builder;
}

private void applyCustomizers(DaprClientBuilder builder) {
if (this.customizers != null) {
for (DaprClientCustomizer customizer : this.customizers) {
customizer.customize(builder);
}
}
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
* 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.pubsub;

import org.springframework.boot.context.properties.ConfigurationProperties;

@ConfigurationProperties(prefix = DaprPubSubProperties.CONFIG_PREFIX)
public class DaprPubSubProperties {

public static final String CONFIG_PREFIX = "dapr.pubsub";

/**
* Name of the PubSub Dapr component.
*/
private String name;

public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
* 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.statestore;

import org.springframework.boot.context.properties.ConfigurationProperties;

@ConfigurationProperties(prefix = DaprStateStoreProperties.CONFIG_PREFIX)
public class DaprStateStoreProperties {

public static final String CONFIG_PREFIX = "dapr.statestore";

/**
* Name of the StateStore Dapr component.
*/
private String name;
private String binding;

public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}

public String getBinding() {
return binding;
}

public void setBinding(String binding) {
this.binding = binding;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
io.dapr.spring.boot.autoconfigure.client.DaprClientAutoConfiguration
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
* 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.client.DaprClientBuilder;
import org.junit.jupiter.api.Test;
import org.springframework.boot.autoconfigure.AutoConfigurations;
import org.springframework.boot.test.context.runner.ApplicationContextRunner;

import static org.assertj.core.api.Assertions.assertThat;

/**
* Unit tests for {@link DaprClientAutoConfiguration}.
*/
class DaprClientAutoConfigurationTests {

private final ApplicationContextRunner contextRunner = new ApplicationContextRunner()
.withConfiguration(AutoConfigurations.of(DaprClientAutoConfiguration.class));

@Test
void daprClientBuilderConfigurer() {
contextRunner.run(context -> {
assertThat(context).hasSingleBean(DaprClientBuilderConfigurer.class);
});
}

@Test
void daprClientBuilder() {
contextRunner.run(context -> {
assertThat(context).hasSingleBean(DaprClientBuilder.class);
});
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?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.12.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

<artifactId>dapr-spring-boot-starter</artifactId>
<name>dapr-spring-boot-starter</name>
<description>Dapr Client Spring Boot Starter</description>
<packaging>jar</packaging>

<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>io.dapr.spring</groupId>
<artifactId>dapr-spring-core</artifactId>
<version>${project.parent.version}</version>
</dependency>
<dependency>
<groupId>io.dapr.spring</groupId>
<artifactId>dapr-spring-boot-autoconfigure</artifactId>
<version>${project.parent.version}</version>
</dependency>
</dependencies>

</project>
42 changes: 42 additions & 0 deletions dapr-spring/dapr-spring-boot-testcontainers/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?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.12.0-SNAPSHOT</version>
</parent>

<artifactId>dapr-spring-boot-testcontainers</artifactId>
<name>dapr-spring-boot-testcontainers</name>
<description>Dapr Spring Boot Testcontainers</description>
<packaging>jar</packaging>

<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>testcontainers</artifactId>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>junit-jupiter</artifactId>
<exclusions>
<exclusion>
<groupId>com.vaadin.external.google</groupId>
<artifactId>android-json</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.dapr</groupId>
<artifactId>testcontainers-dapr</artifactId>
<version>${testcontainers-dapr.version}</version>
</dependency>
</dependencies>
</project>
Loading