Skip to content

Commit

Permalink
Version bump (#395)
Browse files Browse the repository at this point in the history
* version bump

* Fix or suppress some findbugs warnings

* bump nFlow version to 7.2.0-SNAPSHOT and update changelog

Co-authored-by: Mikko Tiihonen <gmokki@gmail.com>
Co-authored-by: Edvard Fonsell <edvard.fonsell@nitorcreations.com>
  • Loading branch information
3 people committed Apr 19, 2020
1 parent 8379b55 commit 00cc8b9
Show file tree
Hide file tree
Showing 28 changed files with 56 additions and 42 deletions.
12 changes: 7 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## 7.1.1-SNAPSHOT (future release)
## 7.2.0-SNAPSHOT (future release)

**Highlights**
- `nflow-engine`
Expand All @@ -13,18 +13,20 @@
- spring 5.2.5
- jackson 2.10.3
- javassist 3.27.0
- jetty 9.4.27
- jetty 9.4.28
- cxf 3.3.6
- metrics 4.1.5
- metrics 4.1.6
- netty 0.9.6
- swagger 1.6.1
- lang3 3.10
- mariadb 2.6.0
- mssql 8.2.2
- postgresql 42.2.10
- junit 5.6.1
- junit 5.6.2
- mockito 3.3.3
- spotbugs 4.0.1
- spotbugs 4.0.2
- hibernate 6.1.4
- commons-lang3 3.10
- `nflow-explorer`
- Dependency updates:
- swagger-ui 2.2.10
Expand Down
2 changes: 1 addition & 1 deletion nflow-engine/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<parent>
<artifactId>nflow-root</artifactId>
<groupId>io.nflow</groupId>
<version>7.1.1-SNAPSHOT</version>
<version>7.2.0-SNAPSHOT</version>
</parent>
<dependencies>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import org.springframework.dao.EmptyResultDataAccessException;
import org.springframework.util.Assert;

import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import io.nflow.engine.internal.dao.MaintenanceDao;
import io.nflow.engine.internal.dao.WorkflowInstanceDao;
import io.nflow.engine.internal.util.PeriodicLogger;
Expand All @@ -59,6 +60,7 @@

class WorkflowStateProcessor implements Runnable {

@SuppressFBWarnings(value = "LO_NON_PRIVATE_STATIC_LOGGER", justification = "Used by inner class")
static final Logger logger = getLogger(WorkflowStateProcessor.class);
private static final PeriodicLogger laggingLogger = new PeriodicLogger(logger, 30);
private static final PeriodicLogger threadStuckLogger = new PeriodicLogger(logger, 60);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
import static org.joda.time.DateTimeUtils.setCurrentMillisSystem;
import static org.joda.time.Duration.standardHours;
import static org.joda.time.Period.hours;
import static org.junit.Assert.assertFalse;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTimeoutPreemptively;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.ArgumentMatchers.any;
Expand Down Expand Up @@ -948,7 +948,7 @@ public void handlePotentiallyStuckInterruptsThreadWhenListenerReturnsTrue() thro
executor.handlePotentiallyStuck(processingTime);

thread.join(1000);
assertFalse("Processing thread did not die after interruption", thread.isAlive());
assertFalse(thread.isAlive(), "Processing thread did not die after interruption");

verify(listener1).handlePotentiallyStuck(any(ListenerContext.class), eq(processingTime));
verify(listener2).handlePotentiallyStuck(any(ListenerContext.class), eq(processingTime));
Expand Down
2 changes: 1 addition & 1 deletion nflow-explorer/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<parent>
<artifactId>nflow-root</artifactId>
<groupId>io.nflow</groupId>
<version>7.1.1-SNAPSHOT</version>
<version>7.2.0-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
<properties>
Expand Down
2 changes: 1 addition & 1 deletion nflow-jetty/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<parent>
<artifactId>nflow-root</artifactId>
<groupId>io.nflow</groupId>
<version>7.1.1-SNAPSHOT</version>
<version>7.2.0-SNAPSHOT</version>
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import static io.nflow.rest.config.RestConfiguration.REST_OBJECT_MAPPER;
import static java.util.Arrays.asList;
import static java.util.Collections.singletonList;

import java.util.Arrays;

Expand All @@ -16,13 +17,11 @@
import org.apache.cxf.endpoint.Server;
import org.apache.cxf.ext.logging.LoggingFeature;
import org.apache.cxf.feature.Feature;
import org.apache.cxf.interceptor.Interceptor;
import org.apache.cxf.jaxrs.JAXRSServerFactoryBean;
import org.apache.cxf.jaxrs.impl.WebApplicationExceptionMapper;
import org.apache.cxf.jaxrs.swagger.Swagger2Feature;
import org.apache.cxf.jaxrs.validation.JAXRSBeanValidationInInterceptor;
import org.apache.cxf.jaxrs.validation.JAXRSBeanValidationOutInterceptor;
import org.apache.cxf.message.Message;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
Expand Down Expand Up @@ -84,8 +83,8 @@ public Server jaxRsServer(WorkflowInstanceResource workflowInstanceResource,
));
factory.setFeatures(asList(new LoggingFeature(), swaggerFeature()));
factory.setBus(cxf());
factory.setInInterceptors(Arrays.< Interceptor< ? extends Message > >asList(new JAXRSBeanValidationInInterceptor()));
factory.setOutInterceptors(Arrays.< Interceptor< ? extends Message > >asList(new JAXRSBeanValidationOutInterceptor()));
factory.setInInterceptors(singletonList(new JAXRSBeanValidationInInterceptor()));
factory.setOutInterceptors(singletonList(new JAXRSBeanValidationOutInterceptor()));
return factory.create();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
@Provider
public class CustomValidationExceptionMapper implements ExceptionMapper<ValidationException> {

static final Logger logger = LoggerFactory.getLogger(CustomValidationExceptionMapper.class);
private static final Logger logger = LoggerFactory.getLogger(CustomValidationExceptionMapper.class);

@Override
public Response toResponse(ValidationException exception) {
Expand Down
2 changes: 1 addition & 1 deletion nflow-metrics/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<parent>
<groupId>io.nflow</groupId>
<artifactId>nflow-root</artifactId>
<version>7.1.1-SNAPSHOT</version>
<version>7.2.0-SNAPSHOT</version>
</parent>
<dependencies>
<dependency>
Expand Down
2 changes: 1 addition & 1 deletion nflow-netty/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<parent>
<artifactId>nflow-root</artifactId>
<groupId>io.nflow</groupId>
<version>7.1.1-SNAPSHOT</version>
<version>7.2.0-SNAPSHOT</version>
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand Down
6 changes: 4 additions & 2 deletions nflow-netty/src/main/java/io/nflow/netty/StartNflow.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import java.util.Set;
import java.util.stream.Stream;

import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.ApplicationContext;
Expand All @@ -30,6 +31,7 @@
import io.nflow.server.spring.NflowStandardEnvironment;
import reactor.netty.http.server.HttpServer;

@SuppressFBWarnings(value = "OPM_OVERLY_PERMISSIVE_METHOD", justification = "All public methods are public on purpose")
public class StartNflow {

private static final Logger logger = LoggerFactory.getLogger(StartNflow.class);
Expand Down Expand Up @@ -94,12 +96,12 @@ public ApplicationContext startNetty(Map<String, Object> properties) throws Exce
// Create context
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
NflowStandardEnvironment env = new NflowStandardEnvironment(properties);
propertiesSources.stream().forEach(propertiesSource -> env.getPropertySources().addLast(propertiesSource));
propertiesSources.forEach(propertiesSource -> env.getPropertySources().addLast(propertiesSource));
context.setEnvironment(env);
annotatedContextClasses.add(DelegatingWebFluxConfiguration.class);
annotatedContextClasses.add(NflowNettyConfiguration.class);
context.register(annotatedContextClasses.stream().toArray(Class<?>[]::new));
applicationListeners.forEach(applicationListener -> context.addApplicationListener(applicationListener));
applicationListeners.forEach(context::addApplicationListener);
context.refresh();

// Start netty
Expand Down
2 changes: 1 addition & 1 deletion nflow-perf-test/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<parent>
<groupId>io.nflow</groupId>
<artifactId>nflow-root</artifactId>
<version>7.1.1-SNAPSHOT</version>
<version>7.2.0-SNAPSHOT</version>
</parent>
<build>
<plugins>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import static com.fasterxml.jackson.annotation.JsonInclude.Include.NON_EMPTY;
import static com.fasterxml.jackson.databind.SerializationFeature.WRITE_DATES_AS_TIMESTAMPS;
import static java.util.Arrays.asList;
import static java.util.Collections.singletonList;
import static javax.ws.rs.core.MediaType.APPLICATION_JSON;
import static org.springframework.beans.factory.config.ConfigurableBeanFactory.SCOPE_PROTOTYPE;

Expand Down Expand Up @@ -37,7 +37,7 @@ public WebClient baseWebClient() {
JAXRSClientFactoryBean bean = new JAXRSClientFactoryBean();
bean.setAddress(env.getProperty("nflow.url", "http://localhost:7500"));
bean.getFeatures().add(new LoggingFeature());
bean.setProviders(asList(jsonProvider));
bean.setProviders(singletonList(jsonProvider));
bean.setBus(cxf());
return bean.createWebClient().type(APPLICATION_JSON).accept(APPLICATION_JSON).path("api").path("v1");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import static io.nflow.engine.workflow.instance.WorkflowInstanceAction.WorkflowActionType.stateExecutionFailed;
import static java.util.Arrays.asList;
import static java.util.Collections.reverse;
import static java.util.Collections.singletonList;
import static java.util.UUID.randomUUID;
import static org.joda.time.DateTime.now;

Expand Down Expand Up @@ -96,13 +97,13 @@ private <T> T selectRandom(List<T> alternatives) {
@SuppressWarnings({ "unchecked", "rawtypes" })
private WorkflowState selectRandomState(AbstractWorkflowDefinition definition, DateTime instanceNextActivation) {
if (instanceNextActivation.isAfterNow()) {
return selectRandomState(definition.getStates(), asList(start));
return selectRandomState(definition.getStates(), singletonList(start));
} else if (instanceNextActivation.isAfter(new DateTime().minusWeeks(1))) {
return selectRandomState(definition.getStates(), asList(end, manual, normal));
} else if (instanceNextActivation.isAfter(new DateTime().minusMonths(6))) {
return selectRandomState(definition.getStates(), asList(end, manual));
}
return selectRandomState(definition.getStates(), asList(end));
return selectRandomState(definition.getStates(), singletonList(end));
}

private WorkflowState selectRandomState(Set<WorkflowState> allStates, List<WorkflowStateType> stateTypeFilter) {
Expand Down
2 changes: 1 addition & 1 deletion nflow-rest-api-common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<parent>
<artifactId>nflow-root</artifactId>
<groupId>io.nflow</groupId>
<version>7.1.1-SNAPSHOT</version>
<version>7.2.0-SNAPSHOT</version>
</parent>
<properties>
<EMPTY></EMPTY>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public ListWorkflowDefinitionResponse convert(AbstractWorkflowDefinition<? exten
resp.name = definition.getName();
resp.description = definition.getDescription();
resp.onError = definition.getErrorState().name();
Map<String, State> states = new LinkedHashMap<>();
Map<String, State> states = new LinkedHashMap<>(definition.getStates().size() * 2);
for (WorkflowState state : definition.getStates()) {
states.put(state.name(), new State(state.name(), state.getType().name(),
state.getDescription()));
Expand Down Expand Up @@ -76,7 +76,7 @@ public ListWorkflowDefinitionResponse convert(StoredWorkflowDefinition storedDef
resp.type = storedDefinition.type;
resp.description = storedDefinition.description;
resp.onError = storedDefinition.onError;
List<State> states = new ArrayList<>();
List<State> states = new ArrayList<>(storedDefinition.states.size());
for (StoredWorkflowDefinition.State state : storedDefinition.states) {
State tmp = new State(state.id, state.type, state.description);
tmp.transitions.addAll(state.transitions);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ private Map<String, Object> stateVariablesToJson(Map<String, String> stateVariab
if (isEmpty(stateVariables)) {
return null;
}
Map<String, Object> jsonStateVariables = new LinkedHashMap<>();
Map<String, Object> jsonStateVariables = new LinkedHashMap<>(stateVariables.size() * 2);
for (Entry<String, String> entry : stateVariables.entrySet()) {
String key = entry.getKey();
jsonStateVariables.put(key, stringToJson(key, entry.getValue()));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package io.nflow.rest.v1.msg;

import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import io.nflow.engine.model.ModelObject;

@SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD", justification = "jackson reads dto fields")
public class ErrorResponse extends ModelObject {

public String error;
Expand Down
2 changes: 1 addition & 1 deletion nflow-rest-api-jax-rs/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<parent>
<artifactId>nflow-root</artifactId>
<groupId>io.nflow</groupId>
<version>7.1.1-SNAPSHOT</version>
<version>7.2.0-SNAPSHOT</version>
</parent>
<properties>
<EMPTY></EMPTY>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Response;

import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import org.springframework.dao.EmptyResultDataAccessException;
import org.springframework.stereotype.Component;

Expand Down Expand Up @@ -116,6 +117,7 @@ public Response updateWorkflowInstance(@ApiParam("Internal id for workflow insta
@GET
@Path("/id/{id}")
@ApiOperation(value = "Fetch a workflow instance", notes = "Fetch full state and action history of a single workflow instance.")
@SuppressFBWarnings(value = "LEST_LOST_EXCEPTION_STACK_TRACE", justification = "The empty result exception contains no useful information")
public ListWorkflowInstanceResponse fetchWorkflowInstance(
@ApiParam("Internal id for workflow instance") @PathParam("id") long id,
@QueryParam("include") @ApiParam(value = INCLUDE_PARAM_DESC, allowableValues = INCLUDE_PARAM_VALUES, allowMultiple = true) String include,
Expand Down
2 changes: 1 addition & 1 deletion nflow-rest-api-spring-web/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<parent>
<artifactId>nflow-root</artifactId>
<groupId>io.nflow</groupId>
<version>7.1.1-SNAPSHOT</version>
<version>7.2.0-SNAPSHOT</version>
</parent>
<properties>
<EMPTY></EMPTY>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import javax.inject.Inject;
import javax.validation.Valid;

import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import org.springframework.dao.EmptyResultDataAccessException;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Component;
Expand Down Expand Up @@ -102,6 +103,7 @@ public ResponseEntity<?> updateWorkflowInstance(@ApiParam("Internal id for workf

@GetMapping(path = "/id/{id}")
@ApiOperation(value = "Fetch a workflow instance", notes = "Fetch full state and action history of a single workflow instance.")
@SuppressFBWarnings(value = "LEST_LOST_EXCEPTION_STACK_TRACE", justification = "The empty result exception contains no useful information")
public ResponseEntity<ListWorkflowInstanceResponse> fetchWorkflowInstance(
@ApiParam("Internal id for workflow instance") @PathVariable("id") long id,
@RequestParam(value = "include", required = false) @ApiParam(value = INCLUDE_PARAM_DESC, allowableValues = INCLUDE_PARAM_VALUES, allowMultiple = true) String include,
Expand Down
2 changes: 1 addition & 1 deletion nflow-server-common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<parent>
<artifactId>nflow-root</artifactId>
<groupId>io.nflow</groupId>
<version>7.1.1-SNAPSHOT</version>
<version>7.2.0-SNAPSHOT</version>
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand Down
2 changes: 1 addition & 1 deletion nflow-tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<parent>
<groupId>io.nflow</groupId>
<artifactId>nflow-root</artifactId>
<version>7.1.1-SNAPSHOT</version>
<version>7.2.0-SNAPSHOT</version>
</parent>
<dependencies>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public NextAction startCreditDecisionWorkflow(StateExecution execution,

public NextAction waitCreditDecisionWorkflow(StateExecution execution,
@StateVar(value = CREDIT_DECISION_RESULT) Mutable<String> creditDecisionResult) {
WorkflowInstance decisionWorkflow = execution.getAllChildWorkflows().iterator().next();
WorkflowInstance decisionWorkflow = execution.getAllChildWorkflows().get(0);
creditDecisionResult.setVal(decisionWorkflow.state);
if (CreditDecisionWorkflow.State.approved.name().equals(decisionWorkflow.state)) {
return moveToState(createLoan, "Credit decision approved");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import static org.joda.time.Period.days;

import java.util.Random;
import java.util.concurrent.ThreadLocalRandom;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand All @@ -25,7 +26,7 @@ public WordGeneratorErrorsWorkflow() {

@Override
protected NextAction update(StateExecution execution, String state) {
Random random = new Random();
Random random = ThreadLocalRandom.current();
if (random.nextDouble() < ERROR_FRACTION / 2.0) {
logger.info("Generating error at state {} before new state is set", state);
throw new RuntimeException("error at state " + state + " before new state is set");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import java.util.Locale;
import java.util.Random;
import java.util.concurrent.ThreadLocalRandom;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down Expand Up @@ -66,7 +67,7 @@ public WordGeneratorWorkflow() {
}

protected static State randState() {
Random random = new Random();
Random random = ThreadLocalRandom.current();
double sum = 0;
for (State v : State.values()) {
sum += v.fraction;
Expand Down
Loading

0 comments on commit 00cc8b9

Please sign in to comment.