Skip to content

Commit

Permalink
fix(GH-3229): Update Activiti Cloud to Spring Boot 2.4.1 (#253)
Browse files Browse the repository at this point in the history
* fix: Update Spring Boot version to 2.4.1

* fix: Update Spring Cloud version to 2020.0.0-M6

* build: add Spring Milestones repository

* fix: use Spring Boot version 2.4.1

* build: move Spring Milestones repository to build

* fix: update deprecated websocket client spec builder

* fix: remove SI deprecated classes from messages core module

* fix: update spring-integration-hazelcast to 3.0.0

* fix: add io.projectreactor.addons:reactor-extra module events

* fix: update removed api in graphql-ws

* fix: update removed api in graphq-starter test

* fix(modeling): set default spring.jackson.dateFormat to yyyy-MM-dd'T'HH:mm:ss.SSSZ

* fix(rb): set default spring.jackson.dateFormat to yyyy-MM-dd'T'HH:mm:ss.SSSZ

* fix: extract default jackson.date-format to activiti-cloud-service-common-config

* fix: update default date format to yyyy-MM-dd'T'HH:mm:ss.SSSZZZ

* fix: set jackson.date-format to yyyy-MM-dd'T'HH:mm:ss.SSSZ

* fix: override StdDateFormat without colon in time zone

* fix: use super constructor for StdDateFormat override

* fix(version): update spring-cloud.version to 2020.0.0-RC1

* fix(build): add activiti-snapshots repository

* fix(version): update spring-cloud.version to 2020.0.0 (GA)

* fix: add argLine -Xmx2048m -XX:MaxPermSize=256m for maven-failsafe-plugin

* Revert "fix: add argLine -Xmx2048m -XX:MaxPermSize=256m for maven-failsafe-plugin "

This reverts commit 0cddb00.

* Include error message

* Remove Spring milestones repository

Co-authored-by: Elias Ricken de Medeiros <26007058+erdemedeiros@users.noreply.github.com>
  • Loading branch information
igdianov and erdemedeiros authored Jan 14, 2021
1 parent ed547f3 commit ad5e45d
Show file tree
Hide file tree
Showing 17 changed files with 487 additions and 448 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,24 +17,27 @@

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

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.time.Duration;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.function.Consumer;
import net.thucydides.core.annotations.Step;

import org.activiti.cloud.acc.core.config.RuntimeTestsConfigurationProperties;
import org.activiti.cloud.acc.core.rest.RuntimeDirtyContextHandler;
import org.activiti.cloud.acc.core.rest.feign.EnableRuntimeFeignContext;
import org.activiti.cloud.acc.shared.service.BaseService;
import org.reactivestreams.Subscription;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import net.thucydides.core.annotations.Step;
import reactor.core.publisher.Mono;
import reactor.core.publisher.ReplayProcessor;
import reactor.netty.http.client.HttpClient;
import reactor.netty.http.client.HttpClient.WebsocketSender;
import reactor.netty.http.client.WebsocketClientSpec;
import reactor.test.StepVerifier;

@EnableRuntimeFeignContext
Expand All @@ -43,6 +46,9 @@ public class NotificationsSteps {
private static final String GRAPHQL_WS = "graphql-ws";
private static final String AUTHORIZATION = "Authorization";
private static final Duration TIMEOUT = Duration.ofMillis(90000);
private static final WebsocketClientSpec graphqlWsClientSpec = WebsocketClientSpec.builder()
.protocols(GRAPHQL_WS)
.build();

@Autowired
private RuntimeDirtyContextHandler dirtyContextHandler;
Expand All @@ -56,30 +62,30 @@ public class NotificationsSteps {

@Autowired
private ObjectMapper objectMapper;

@Step
public void checkServicesHealth() {
assertThat(baseService.isServiceUp()).isTrue();
}

public String getRuntimeBundleServiceName() {
return properties.getRuntimeBundleServiceName();
}

@SuppressWarnings({"serial"})
@Step
public ReplayProcessor<String> subscribe(String accessToken,
String query,
Map<String,Object> variables,
public ReplayProcessor<String> subscribe(String accessToken,
String query,
Map<String,Object> variables,
Consumer<Subscription> action) throws InterruptedException {
ReplayProcessor<String> data = ReplayProcessor.create();

WebsocketSender client = HttpClient.create()
.wiretap(true)
.headers(h -> h.add(AUTHORIZATION, "Bearer " + accessToken))
.websocket(GRAPHQL_WS)
.websocket(graphqlWsClientSpec)
.uri(properties.getGraphqlWsUrl());

Map<String, Object> json = new LinkedHashMap<String, Object>() {{
put("type", "start");
put("id", "1");
Expand All @@ -95,8 +101,8 @@ public ReplayProcessor<String> subscribe(String accessToken,
} catch (JsonProcessingException e) {
throw new RuntimeException(e);
}


// handle start subscription
client.handle((i, o) -> {
o.sendString(Mono.just(startMessage))
Expand Down Expand Up @@ -125,11 +131,11 @@ public ReplayProcessor<String> subscribe(String accessToken,

@Step
public void verifyData(ReplayProcessor<String> data, String...messages) {

StepVerifier.create(data)
.expectNext(messages)
.expectComplete()
.verify(TIMEOUT);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<packaging>pom</packaging>
<name>Activiti Cloud :: Dependencies Parent</name>
<properties>
<spring-cloud.version>Hoxton.SR5</spring-cloud.version>
<spring-cloud.version>2020.0.0</spring-cloud.version>
<testcontainers.version>1.14.2</testcontainers.version>
</properties>
<dependencyManagement>
Expand Down
6 changes: 5 additions & 1 deletion activiti-cloud-build/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@
<maven-site-plugin.version>3.8.2</maven-site-plugin.version>
<maven-source-plugin.version>3.2.1</maven-source-plugin.version>
<maven-surefire-plugin.version>2.22.2</maven-surefire-plugin.version>
<spring-boot.version>2.2.8.RELEASE</spring-boot.version>
<spring-boot.version>2.4.1</spring-boot.version>
</properties>
<modules>
<module>activiti-cloud-build-dependencies-parent</module>
Expand All @@ -218,6 +218,10 @@
<id>activiti-releases</id>
<url>https://artifacts.alfresco.com/nexus/content/repositories/activiti-releases</url>
</repository>
<repository>
<id>activiti-snapshots</id>
<url>https://artifacts.alfresco.com/nexus/content/repositories/activiti-snapshots</url>
</repository>
</repositories>
<build>
<pluginManagement>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
import org.springframework.integration.handler.advice.HandleMessageAdvice;
import org.springframework.integration.store.MessageGroupStore;
import org.springframework.integration.support.locks.LockRegistry;
import org.springframework.integration.support.management.AbstractMessageHandlerMetrics;
import org.springframework.messaging.MessageChannel;
import org.springframework.messaging.MessageHandler;
import org.springframework.scheduling.TaskScheduler;
Expand All @@ -49,12 +48,6 @@ public class MessageConnectorAggregatorFactoryBean extends AbstractSimpleMessage

private String outputChannelName;

private AbstractMessageHandlerMetrics metrics;

private Boolean statsEnabled;

private Boolean countsEnabled;

private LockRegistry lockRegistry;

private MessageGroupStore messageStore;
Expand All @@ -80,32 +73,30 @@ public class MessageConnectorAggregatorFactoryBean extends AbstractSimpleMessage
private Boolean expireGroupsUponTimeout;

private Boolean completeGroupsWhenEmpty;

private Boolean popSequence;

private Boolean releaseLockBeforeSend;

public MessageConnectorAggregatorFactoryBean() {
super();

// defaults
this.popSequence(false)
.completeGroupsWhenEmpty(true)
.expireGroupsUponCompletion(true)
.sendPartialResultOnExpiry(true)
.statsEnabled(true)
.countsEnabled(true);
.sendPartialResultOnExpiry(true);
}

public MessageConnectorAggregatorFactoryBean processorBean(MessageGroupProcessor processorBean) {
this.processorBean = processorBean;

return this;
}

public MessageConnectorAggregatorFactoryBean expireGroupsUponCompletion(Boolean expireGroupsUponCompletion) {
this.expireGroupsUponCompletion = expireGroupsUponCompletion;

return this;
}

Expand All @@ -127,24 +118,6 @@ public MessageConnectorAggregatorFactoryBean outputChannel(MessageChannel output
return this;
}

public MessageConnectorAggregatorFactoryBean metrics(AbstractMessageHandlerMetrics metrics) {
this.metrics = metrics;

return this;
}

public MessageConnectorAggregatorFactoryBean statsEnabled(Boolean statsEnabled) {
this.statsEnabled = statsEnabled;

return this;
}

public MessageConnectorAggregatorFactoryBean countsEnabled(Boolean countsEnabled) {
this.countsEnabled = countsEnabled;

return this;
}

public MessageConnectorAggregatorFactoryBean lockRegistry(LockRegistry lockRegistry) {
this.lockRegistry = lockRegistry;

Expand Down Expand Up @@ -195,7 +168,7 @@ public MessageConnectorAggregatorFactoryBean discardChannel(MessageChannel disca

public MessageConnectorAggregatorFactoryBean discardChannelName(String discardChannelName) {
this.discardChannelName = discardChannelName;

return this;
}

Expand Down Expand Up @@ -234,19 +207,19 @@ public MessageConnectorAggregatorFactoryBean completeGroupsWhenEmpty(Boolean com

return this;
}

public MessageConnectorAggregatorFactoryBean beanFactory(BeanFactory beanFactory) {
this.setBeanFactory(beanFactory);

return this;
}

public MessageConnectorAggregatorFactoryBean adviceChain(List<? extends HandleMessageAdvice> adviceChain) {
this.setAdviceChain(Arrays.asList(adviceChain.toArray(new HandleMessageAdvice[] {})));

return this;
}

@Override
protected MessageConnectorAggregator createHandler() {
MessageConnectorAggregator aggregator = new MessageConnectorAggregator(this.processorBean);
Expand All @@ -263,18 +236,6 @@ protected MessageConnectorAggregator createHandler() {
aggregator.setOutputChannelName(this.outputChannelName);
}

if (this.metrics != null) {
aggregator.configureMetrics(this.metrics);
}

if (this.statsEnabled != null) {
aggregator.setStatsEnabled(this.statsEnabled);
}

if (this.countsEnabled != null) {
aggregator.setCountsEnabled(this.countsEnabled);
}

if (this.lockRegistry != null) {
aggregator.setLockRegistry(this.lockRegistry);
}
Expand Down Expand Up @@ -326,7 +287,7 @@ protected MessageConnectorAggregator createHandler() {
if (this.completeGroupsWhenEmpty != null) {
aggregator.setCompleteGroupsWhenEmpty(this.completeGroupsWhenEmpty);
}

if (this.popSequence != null) {
aggregator.setPopSequence(this.popSequence);
}
Expand Down
4 changes: 2 additions & 2 deletions activiti-cloud-messages-service/starters/hazelcast/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
</parent>
<artifactId>activiti-cloud-starter-messages-hazelcast</artifactId>
<properties>
<spring-integration-hazelcast.version>2.0.0.RELEASE</spring-integration-hazelcast.version>
<hazelcast.version>3.12.4</hazelcast.version>
<spring-integration-hazelcast.version>3.0.0</spring-integration-hazelcast.version>
<hazelcast.version>4.0.3</hazelcast.version>
</properties>
<dependencyManagement>
<dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
<artifactId>activiti-cloud-services-modeling-rest</artifactId>
<name>Activiti Cloud Services :: Modeling REST</name>
<dependencies>
<dependency>
<groupId>org.activiti.cloud</groupId>
<artifactId>activiti-cloud-service-common-config</artifactId>
</dependency>
<dependency>
<groupId>org.activiti.cloud</groupId>
<artifactId>activiti-cloud-services-modeling-core</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@
<artifactId>activiti-cloud-starter-modeling</artifactId>
<name>Activiti Cloud Starter :: Modeling</name>
<dependencies>
<dependency>
<groupId>org.activiti.cloud</groupId>
<artifactId>activiti-cloud-service-common-config</artifactId>
</dependency>
<dependency>
<groupId>org.activiti.cloud</groupId>
<artifactId>activiti-cloud-services-modeling-api</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,5 +74,9 @@
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>io.projectreactor.addons</groupId>
<artifactId>reactor-extra</artifactId>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@

import reactor.core.publisher.Flux;
import reactor.core.publisher.FluxSink;
import reactor.core.publisher.TopicProcessor;
import reactor.extra.processor.TopicProcessor;

/**
* Notification Gateway configuration that enables messaging channel bindings
Expand All @@ -51,7 +51,7 @@
@EnableConfigurationProperties(EngineEventsConsumerProperties.class)
@ConditionalOnProperty(name = "spring.activiti.cloud.services.notifications.graphql.events.enabled", matchIfMissing = true)
@PropertySources({
@PropertySource(value = "classpath:META-INF/graphql-events.properties"),
@PropertySource(value = "classpath:META-INF/graphql-events.properties"),
@PropertySource(value = "classpath:graphql-events.properties", ignoreResourceNotFound = true)
})
public class EngineEventsConsumerAutoConfiguration {
Expand Down Expand Up @@ -88,7 +88,7 @@ public EngineEventsConsumerMessageHandler engineEventsMessageHandler(Transformer
}

}

@Configuration
public static class EngineEventsFluxProcessorConfiguration implements SmartLifecycle {

Expand Down Expand Up @@ -142,5 +142,5 @@ public boolean isRunning() {
return running;
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
*/
package org.activiti.cloud.services.notifications.graphql.ws.config;

import graphql.GraphQL;
import graphql.schema.GraphQLSchema;
import org.activiti.cloud.services.notifications.graphql.ws.transport.GraphQLBrokerMessageHandler;
import org.activiti.cloud.services.notifications.graphql.ws.transport.GraphQLBrokerSubProtocolHandler;
import org.activiti.cloud.services.notifications.graphql.ws.transport.GraphQLSubscriptionExecutor;
Expand All @@ -30,6 +28,7 @@
import org.springframework.messaging.MessageHandler;
import org.springframework.messaging.SubscribableChannel;
import org.springframework.messaging.simp.config.MessageBrokerRegistry;
import org.springframework.messaging.support.AbstractSubscribableChannel;
import org.springframework.scheduling.TaskScheduler;
import org.springframework.web.socket.WebSocketHandler;
import org.springframework.web.socket.config.annotation.DelegatingWebSocketMessageBrokerConfiguration;
Expand All @@ -41,6 +40,9 @@
import org.springframework.web.socket.server.support.DefaultHandshakeHandler;
import org.springframework.web.socket.server.support.HttpSessionHandshakeInterceptor;

import graphql.GraphQL;
import graphql.schema.GraphQLSchema;

@Configuration
@ConditionalOnWebApplication
@ConditionalOnClass({GraphQL.class, EnableWebSocketMessageBroker.class})
Expand Down Expand Up @@ -98,9 +100,11 @@ public MessageHandler graphQLBrokerMessageHandler(SubscribableChannel clientInbo
@Override
@Bean
@ConditionalOnMissingBean(SubProtocolWebSocketHandler.class)
public WebSocketHandler subProtocolWebSocketHandler() {
SubProtocolWebSocketHandler handler = new SubProtocolWebSocketHandler(clientInboundChannel(),
clientOutboundChannel());
public WebSocketHandler subProtocolWebSocketHandler(AbstractSubscribableChannel clientInboundChannel,
AbstractSubscribableChannel clientOutboundChannel) {
SubProtocolWebSocketHandler handler = new SubProtocolWebSocketHandler(clientInboundChannel,
clientOutboundChannel);

handler.addProtocolHandler(graphQLBrokerSubProtocolHandler());
handler.setDefaultProtocolHandler(graphQLBrokerSubProtocolHandler());

Expand Down
Loading

0 comments on commit ad5e45d

Please sign in to comment.