Skip to content

Commit

Permalink
Merge spring-client and spring-zeebe-sdk (#17387)
Browse files Browse the repository at this point in the history
## Description

Merge SpringBoot starter SDK and Spring Client into the same subfolder.
This merge is not affecting users.
We are keeping `spring-boot-starter-camunda-sdk` at root, as this is the
start of the common camunda sdk to provide access to the general C8 REST
API. I removed the `zeebe-client-spring` module and integrate the
classes into `spring-boot-starter-camunda-sdk`

## Related issues

closes #17339
  • Loading branch information
nicpuppa committed Apr 11, 2024
2 parents d058cdb + bbbcfdf commit c52bf3c
Show file tree
Hide file tree
Showing 81 changed files with 119 additions and 214 deletions.
6 changes: 0 additions & 6 deletions parent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -773,12 +773,6 @@
<version>${version.spring-boot}</version>
</dependency>

<dependency>
<groupId>io.camunda</groupId>
<artifactId>zeebe-client-spring</artifactId>
<version>${project.version}</version>
</dependency>

<dependency>
<groupId>io.camunda</groupId>
<artifactId>zeebe-broker</artifactId>
Expand Down
37 changes: 32 additions & 5 deletions spring-boot-starter-camunda-sdk/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@

<properties>
<version.java>17</version.java>
<version.commons-beanutils>1.9.4</version.commons-beanutils>
<license.header>com/mycila/maven/plugin/license/templates/APACHE-2.txt</license.header>
</properties>

Expand All @@ -50,11 +51,6 @@
<artifactId>zeebe-client-java</artifactId>
</dependency>

<dependency>
<groupId>io.camunda</groupId>
<artifactId>zeebe-client-spring</artifactId>
</dependency>

<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
Expand Down Expand Up @@ -145,6 +141,25 @@
<artifactId>grpc-api</artifactId>
</dependency>

<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
<version>${version.spring}</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils</artifactId>
<version>${version.commons-beanutils}</version>
<exclusions>
<exclusion>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
Expand All @@ -162,6 +177,18 @@
<artifactId>spring-test</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-junit-jupiter</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.camunda.zeebe.spring.client;
package io.camunda.zeebe.spring.client.configuration;

import io.camunda.zeebe.client.ZeebeClient;
import io.camunda.zeebe.spring.client.configuration.CommonClientConfiguration;
import io.camunda.zeebe.spring.client.configuration.JsonMapperConfiguration;
import io.camunda.zeebe.spring.client.configuration.MetricsDefaultConfiguration;
import io.camunda.zeebe.spring.client.configuration.ZeebeActuatorConfiguration;
import io.camunda.zeebe.spring.client.configuration.ZeebeClientAllAutoConfiguration;
import io.camunda.zeebe.spring.client.configuration.ZeebeClientProdAutoConfiguration;
import io.camunda.zeebe.spring.client.event.ZeebeLifecycleEventProducer;
import io.camunda.zeebe.spring.client.testsupport.SpringZeebeTestContext;
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,19 @@

import static org.springframework.util.StringUtils.hasText;

import io.camunda.common.auth.*;
import io.camunda.common.auth.identity.IdentityConfig;
import io.camunda.common.json.JsonMapper;
import io.camunda.identity.sdk.IdentityConfiguration;
import io.camunda.zeebe.spring.client.properties.*;
import io.camunda.zeebe.spring.common.auth.Authentication;
import io.camunda.zeebe.spring.common.auth.DefaultNoopAuthentication;
import io.camunda.zeebe.spring.common.auth.Product;
import io.camunda.zeebe.spring.common.auth.identity.IdentityConfig;
import io.camunda.zeebe.spring.common.auth.jwt.JwtConfig;
import io.camunda.zeebe.spring.common.auth.jwt.JwtCredential;
import io.camunda.zeebe.spring.common.auth.saas.SaaSAuthentication;
import io.camunda.zeebe.spring.common.auth.selfmanaged.SelfManagedAuthentication;
import io.camunda.zeebe.spring.common.auth.simple.SimpleAuthentication;
import io.camunda.zeebe.spring.common.auth.simple.SimpleConfig;
import io.camunda.zeebe.spring.common.json.JsonMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
package io.camunda.zeebe.spring.client.configuration;

import com.fasterxml.jackson.databind.ObjectMapper;
import io.camunda.common.json.SdkObjectMapper;
import io.camunda.zeebe.client.api.JsonMapper;
import io.camunda.zeebe.client.impl.ZeebeObjectMapper;
import io.camunda.zeebe.spring.common.json.SdkObjectMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
Expand All @@ -44,7 +44,7 @@ public JsonMapper jsonMapper() {

@Bean(name = "commonJsonMapper")
@ConditionalOnMissingBean
public io.camunda.common.json.JsonMapper commonJsonMapper() {
public io.camunda.zeebe.spring.common.json.JsonMapper commonJsonMapper() {
if (objectMapper == null) {
return new SdkObjectMapper();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@

import static org.springframework.util.StringUtils.hasText;

import io.camunda.common.auth.Authentication;
import io.camunda.common.auth.DefaultNoopAuthentication;
import io.camunda.common.auth.Product;
import io.camunda.zeebe.client.CredentialsProvider;
import io.camunda.zeebe.client.ZeebeClientConfiguration;
import io.camunda.zeebe.client.api.JsonMapper;
Expand All @@ -28,6 +25,9 @@
import io.camunda.zeebe.spring.client.jobhandling.ZeebeClientExecutorService;
import io.camunda.zeebe.spring.client.properties.CommonConfigurationProperties;
import io.camunda.zeebe.spring.client.properties.ZeebeClientConfigurationProperties;
import io.camunda.zeebe.spring.common.auth.Authentication;
import io.camunda.zeebe.spring.common.auth.DefaultNoopAuthentication;
import io.camunda.zeebe.spring.common.auth.Product;
import io.grpc.ClientInterceptor;
import io.grpc.Status.Code;
import jakarta.annotation.PostConstruct;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
import io.camunda.zeebe.spring.client.annotation.*;
import io.camunda.zeebe.spring.client.annotation.value.ZeebeWorkerValue;
import io.camunda.zeebe.spring.client.bean.ParameterInfo;
import io.camunda.zeebe.spring.client.exception.ZeebeBpmnError;
import io.camunda.zeebe.spring.client.metrics.MetricsRecorder;
import io.camunda.zeebe.spring.common.exception.ZeebeBpmnError;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.camunda.common.auth;
package io.camunda.zeebe.spring.common.auth;

import java.util.Map;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.camunda.common.auth;
package io.camunda.zeebe.spring.common.auth;

import io.camunda.common.exception.SdkException;
import io.camunda.zeebe.spring.common.exception.SdkException;
import java.lang.invoke.MethodHandles;
import java.util.Map;
import org.slf4j.Logger;
Expand All @@ -37,12 +37,12 @@ public DefaultNoopAuthentication() {
}

@Override
public void resetToken(final Product product) {
throw new SdkException(errorMessage);
public Map.Entry<String, String> getTokenHeader(final Product product) {
throw new UnsupportedOperationException("Unable to determine authentication");
}

@Override
public Map.Entry<String, String> getTokenHeader(final Product product) {
throw new UnsupportedOperationException("Unable to determine authentication");
public void resetToken(final Product product) {
throw new SdkException(errorMessage);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.camunda.common.auth;
package io.camunda.zeebe.spring.common.auth;

/** Enum for different C8 Products */
public enum Product {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.camunda.common.auth.identity;
package io.camunda.zeebe.spring.common.auth.identity;

import io.camunda.common.auth.Product;
import io.camunda.zeebe.spring.common.auth.Product;
import java.util.HashMap;
import java.util.Map;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.camunda.common.auth.identity;
package io.camunda.zeebe.spring.common.auth.identity;

import io.camunda.identity.sdk.Identity;
import io.camunda.identity.sdk.IdentityConfiguration;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.camunda.common.auth;
package io.camunda.zeebe.spring.common.auth.jwt;

import io.camunda.zeebe.spring.common.auth.Authentication;
import io.camunda.zeebe.spring.common.auth.Product;
import java.time.LocalDateTime;
import java.util.AbstractMap;
import java.util.HashMap;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.camunda.common.auth;
package io.camunda.zeebe.spring.common.auth.jwt;

import io.camunda.common.auth.Authentication.AuthenticationBuilder;
import io.camunda.zeebe.spring.common.auth.Authentication;
import io.camunda.zeebe.spring.common.auth.Authentication.AuthenticationBuilder;

public abstract class JwtAuthenticationBuilder<T extends JwtAuthenticationBuilder<?>>
implements AuthenticationBuilder {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.camunda.common.auth;
package io.camunda.zeebe.spring.common.auth.jwt;

import io.camunda.zeebe.spring.common.auth.Product;
import java.util.HashMap;
import java.util.Map;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.camunda.common.auth;
package io.camunda.zeebe.spring.common.auth.jwt;

/** Contains credential for particular product. Used for JWT authentication. */
public class JwtCredential {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.camunda.common.auth;
package io.camunda.zeebe.spring.common.auth.saas;

import io.camunda.common.json.JsonMapper;
import io.camunda.zeebe.spring.common.auth.Product;
import io.camunda.zeebe.spring.common.auth.jwt.JwtAuthentication;
import io.camunda.zeebe.spring.common.auth.jwt.JwtConfig;
import io.camunda.zeebe.spring.common.auth.jwt.JwtCredential;
import io.camunda.zeebe.spring.common.json.JsonMapper;
import java.time.LocalDateTime;
import org.apache.hc.client5.http.classic.methods.HttpPost;
import org.apache.hc.client5.http.impl.classic.CloseableHttpClient;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.camunda.common.auth;
package io.camunda.zeebe.spring.common.auth.saas;

import io.camunda.common.json.JsonMapper;
import io.camunda.zeebe.spring.common.auth.jwt.JwtAuthenticationBuilder;
import io.camunda.zeebe.spring.common.auth.jwt.JwtConfig;
import io.camunda.zeebe.spring.common.json.JsonMapper;

public class SaaSAuthenticationBuilder extends JwtAuthenticationBuilder<SaaSAuthenticationBuilder> {
private JsonMapper jsonMapper;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.camunda.common.auth;
package io.camunda.zeebe.spring.common.auth.saas;

import com.fasterxml.jackson.annotation.JsonProperty;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.camunda.common.auth;
package io.camunda.zeebe.spring.common.auth.saas;

import com.fasterxml.jackson.annotation.JsonProperty;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.camunda.common.auth;
package io.camunda.zeebe.spring.common.auth.selfmanaged;

import io.camunda.common.auth.identity.IdentityConfig;
import io.camunda.identity.sdk.Identity;
import io.camunda.identity.sdk.authentication.Tokens;
import io.camunda.zeebe.spring.common.auth.Product;
import io.camunda.zeebe.spring.common.auth.identity.IdentityConfig;
import io.camunda.zeebe.spring.common.auth.jwt.JwtAuthentication;
import io.camunda.zeebe.spring.common.auth.jwt.JwtConfig;
import io.camunda.zeebe.spring.common.auth.jwt.JwtCredential;
import java.time.LocalDateTime;

public class SelfManagedAuthentication extends JwtAuthentication {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.camunda.common.auth;
package io.camunda.zeebe.spring.common.auth.selfmanaged;

import io.camunda.common.auth.identity.IdentityConfig;
import io.camunda.zeebe.spring.common.auth.Authentication;
import io.camunda.zeebe.spring.common.auth.identity.IdentityConfig;
import io.camunda.zeebe.spring.common.auth.jwt.JwtAuthenticationBuilder;
import io.camunda.zeebe.spring.common.auth.jwt.JwtConfig;

public class SelfManagedAuthenticationBuilder
extends JwtAuthenticationBuilder<SelfManagedAuthenticationBuilder> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.camunda.common.auth;
package io.camunda.zeebe.spring.common.auth.simple;

import io.camunda.zeebe.spring.common.auth.Authentication;
import io.camunda.zeebe.spring.common.auth.Product;
import java.util.*;
import org.apache.hc.client5.http.classic.methods.HttpPost;
import org.apache.hc.client5.http.entity.UrlEncodedFormEntity;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.camunda.common.auth;
package io.camunda.zeebe.spring.common.auth.simple;

import io.camunda.common.auth.Authentication.AuthenticationBuilder;
import io.camunda.zeebe.spring.common.auth.Authentication;
import io.camunda.zeebe.spring.common.auth.Authentication.AuthenticationBuilder;

public class SimpleAuthenticationBuilder implements AuthenticationBuilder {
private String simpleUrl;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.camunda.common.auth;
package io.camunda.zeebe.spring.common.auth.simple;

import io.camunda.zeebe.spring.common.auth.Product;
import java.util.HashMap;
import java.util.Map;

Expand Down
Loading

0 comments on commit c52bf3c

Please sign in to comment.