Skip to content

Commit

Permalink
Version bump (#466)
Browse files Browse the repository at this point in the history
* Version bump
* Make h2 trigger more robust
* Go back one version for jetty. It works only in spring 6+ which is not yet released
* Override too old reactor-core version from spring to make nflow-netty start
* Move back hibernate-validator so that it works with our spring version
* Drop junit4 dependency
* Reimplement old multithreaded test runner
* Add servlet-api dep to nflow-jetty, it seems to be neededd
* Add note about h2 upgrade
* update plugins
* update rules and deps, downgrade jetty and hikaricp to be jdk8 compatible
* get rid of fieldmatcher, use more type-aware argumentcaptor
* update changelog
* Document the minimum maven version change, and make it 3.8 since that is what our build system uses

Co-authored-by: Edvard Fonsell <edvard.fonsell@nitor.com>
  • Loading branch information
gmokki and efonsell committed Jan 11, 2022
1 parent 833d0c0 commit 0fbc0fe
Show file tree
Hide file tree
Showing 46 changed files with 501 additions and 307 deletions.
4 changes: 4 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ addons:
services:
- docker
before_install:
- wget --no-check-certificate https://dlcdn.apache.org/maven/maven-3/3.8.4/binaries/apache-maven-3.8.4-bin.zip
- unzip -qq apache-maven-3.8.4-bin.zip
- export M2_HOME=$PWD/apache-maven-3.8.4
- export PATH=$M2_HOME/bin:$PATH
- mkdir -p $HOME/.m2
- cp travis/maven_settings.xml $HOME/.m2/settings.xml
before_script:
Expand Down
38 changes: 34 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,42 @@
- Customizable workflow search result table columns

**Details**
- `nflow-engine`
- logback-classic update to version 1.2.9
- http://mailman.qos.ch/pipermail/announce/2021/000164.html
- https://jira.qos.ch/browse/LOGBACK-1591
- `nflow-explorer`
- Make some external urls https instead of http
- `nflow-engine`
- Dependency updates:
- minimum supported maven version for buliding is 3.8
- logback-classic update to version 1.2.10
- http://mailman.qos.ch/pipermail/announce/2021/000164.html
- https://jira.qos.ch/browse/LOGBACK-1591
- cxf 3.5.0
- commons.lang3 3.12.0
- guice 5.0.1
- hibernate validator 6.2.0
- hikaricp 4.0.3
- jackson 2.13.1
- javassist 3.28.0
- jodatime 2.10.3
- slf4j 1.7.32
- `nflow-rest-api`
- swagger 1.6.4
- `nflow-jetty`
- Dependency updates
- jetty 9.4.44.v20210927
- reflections 0.10.2
- `nflow-netty`
- Dependency updates
- reactor-netty 1.0.14
- `nflow-metrics`
- Dependency updates
- metrics 4.2.7
- `nflow-tests`
- h2 2.0.204
- Note: If you have persisted any h2 databases you must take a backup and restore. Also the nflow h2 schema changed to work with 2.x release of h2.
- mssql 9.4.1
- mysql 8.0.27
- mariadb 2.7.4
- postgresql 42.3.1

## 7.3.1 (2021-09-15)

Expand Down
16 changes: 16 additions & 0 deletions maven-version-rules.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,14 @@
<rule groupId="org.hibernate.validator">
<ignoreVersions>
<ignoreVersion type="regex">.*(Alpha|CR).*</ignoreVersion>
<!-- newer hibernate work on jakarta instead of javax -->
<ignoreVersion type="regex">^[7-9].*</ignoreVersion>
</ignoreVersions>
</rule>
<rule groupId="com.zaxxer">
<ignoreVersions>
<!-- newer hikaricp requires Java 11 -->
<ignoreVersion type="regex">^[5-9].*</ignoreVersion>
</ignoreVersions>
</rule>
<rule groupId="io.swagger">
Expand All @@ -46,6 +54,9 @@
<rule groupId="org.eclipse.jetty">
<ignoreVersions>
<ignoreVersion type="regex">.*(alpha|beta).*</ignoreVersion>
<!-- jetty 11 moves from javax.servlet-api to jakarta.servlet-api, requires spring 6.x -->
<!-- jetty 10 requires Java 11 -->
<ignoreVersion type="regex">^1[0-9].*</ignoreVersion>
</ignoreVersions>
</rule>
<rule groupId="ch.qos.logback">
Expand Down Expand Up @@ -78,6 +89,11 @@
<ignoreVersion type="regex">.*M*</ignoreVersion>
</ignoreVersions>
</rule>
<rule groupId="org.mariadb.jdbc">
<ignoreVersions>
<ignoreVersion type="regex">.*-(rc|beta|alpha)</ignoreVersion>
</ignoreVersions>
</rule>
<rule groupId="com.google.inject">
<ignoreVersions>
<ignoreVersion type="regex">.*BETA.*</ignoreVersion>
Expand Down
17 changes: 1 addition & 16 deletions nflow-engine/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,6 @@
<groupId>com.github.spotbugs</groupId>
<artifactId>spotbugs-annotations</artifactId>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
Expand All @@ -103,7 +98,7 @@
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-library</artifactId>
<artifactId>hamcrest</artifactId>
<scope>test</scope>
</dependency>
<dependency>
Expand All @@ -116,15 +111,5 @@
<artifactId>mockito-junit-jupiter</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.nitorcreations</groupId>
<artifactId>matchers</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.googlecode.multithreadedtc</groupId>
<artifactId>multithreadedtc</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,33 @@
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Timestamp;
import java.util.Objects;
import java.time.LocalDateTime;
import java.time.OffsetDateTime;
import java.time.ZoneId;

import org.h2.tools.TriggerAdapter;

public class H2ModifiedColumnTrigger extends TriggerAdapter {
@Override
public void fire(Connection conn, ResultSet oldRow, ResultSet newRow) throws SQLException {
Timestamp oldModified = oldRow.getTimestamp("modified");
Timestamp newModified = newRow.getTimestamp("modified");
if (Objects.equals(oldModified, newModified)) {
long oldModified = getMillis(oldRow.getObject("modified"));
long newModified = getMillis(newRow.getObject("modified"));
if (oldModified == newModified) {
newRow.updateTimestamp("modified", new Timestamp(currentTimeMillis()));
}
}

private long getMillis(Object h2Time) {
if (h2Time instanceof Timestamp) {
return ((Timestamp) h2Time).getTime();
}
if (h2Time instanceof OffsetDateTime) {
return ((OffsetDateTime) h2Time).toInstant().toEpochMilli();
}
if (h2Time instanceof LocalDateTime) {
return ((LocalDateTime) h2Time).toInstant(ZoneId.systemDefault().getRules().getOffset((LocalDateTime) h2Time))
.toEpochMilli();
}
throw new UnsupportedOperationException("No support for converting " + h2Time.getClass() + " to milliseconds");
}
}
40 changes: 20 additions & 20 deletions nflow-engine/src/main/resources/scripts/db/h2.create.ddl.sql
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ create table if not exists nflow_workflow (
external_id varchar(64) not null,
state varchar(64) not null,
state_text varchar(128),
next_activation timestamp,
external_next_activation timestamp,
next_activation timestamp with time zone,
external_next_activation timestamp with time zone,
executor_id int,
retries int not null default 0,
created timestamp not null default current_timestamp,
modified timestamp not null default current_timestamp,
started timestamp,
created timestamp with time zone not null default current_timestamp,
modified timestamp with time zone not null default current_timestamp,
started timestamp with time zone,
executor_group varchar(64) not null,
workflow_signal int
);
Expand All @@ -37,8 +37,8 @@ create table if not exists nflow_workflow_action (
state varchar(64) not null,
state_text varchar(128),
retry_no int not null,
execution_start timestamp not null,
execution_end timestamp not null,
execution_start timestamp with time zone not null,
execution_end timestamp with time zone not null,
constraint fk_action_workflow_id foreign key (workflow_id) references nflow_workflow(id)
);

Expand All @@ -58,18 +58,18 @@ create table if not exists nflow_executor (
host varchar(253) not null,
pid int not null,
executor_group varchar(64),
started timestamp not null default current_timestamp,
active timestamp not null,
expires timestamp not null,
stopped timestamp
started timestamp with time zone not null default current_timestamp,
active timestamp with time zone not null,
expires timestamp with time zone not null,
stopped timestamp with time zone
);

create table if not exists nflow_workflow_definition (
type varchar(64) not null,
definition_sha1 varchar(40) not null,
definition text not null,
created timestamp not null default current_timestamp,
modified timestamp not null default current_timestamp,
created timestamp with time zone not null default current_timestamp,
modified timestamp with time zone not null default current_timestamp,
modified_by int not null,
executor_group varchar(64) not null,
constraint pk_workflow_definition primary key (type, executor_group)
Expand All @@ -91,13 +91,13 @@ create table if not exists nflow_archive_workflow (
external_id varchar(64) not null,
state varchar(64) not null,
state_text varchar(128),
next_activation timestamp,
external_next_activation timestamp,
next_activation timestamp with time zone,
external_next_activation timestamp with time zone,
executor_id int,
retries int not null,
created timestamp not null,
modified timestamp not null,
started timestamp,
created timestamp with time zone not null,
modified timestamp with time zone not null,
started timestamp with time zone,
executor_group varchar(64) not null,
workflow_signal int
);
Expand All @@ -113,8 +113,8 @@ create table if not exists nflow_archive_workflow_action (
state varchar(64) not null,
state_text varchar(128),
retry_no int not null,
execution_start timestamp not null,
execution_end timestamp not null,
execution_start timestamp with time zone not null,
execution_end timestamp with time zone not null,
constraint fk_arch_action_wf_id foreign key (workflow_id) references nflow_archive_workflow(id)
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import java.util.Properties;

import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.core.env.Environment;

import com.google.inject.Guice;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import javax.sql.DataSource;

import org.joda.time.DateTime;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.core.io.AbstractResource;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
Expand Down Expand Up @@ -70,8 +70,8 @@ public void testEngineConfiguration() {
DataSource dataSource = injector.getInstance(Key.get(DataSource.class, NFlow.class));
assertThat(dataSource, instanceOf(HikariDataSource.class));
assertThat(((HikariDataSource) dataSource).getPoolName(), is("nflow"));
assertThat(((HikariDataSource) dataSource).getDataSourceClassName(), is("org.h2.jdbcx.JdbcDataSource"));
assertThat(((HikariDataSource) dataSource).getDataSourceProperties().get("url"), is("jdbc:h2:mem:test;TRACE_LEVEL_FILE=4"));
assertThat(((HikariDataSource) dataSource).getDriverClassName(), is("org.h2.Driver"));
assertThat(((HikariDataSource) dataSource).getJdbcUrl(), is("jdbc:h2:mem:test;TRACE_LEVEL_FILE=4"));
assertThat(((HikariDataSource) dataSource).getMaximumPoolSize(), is(4));
assertThat(((HikariDataSource) dataSource).getIdleTimeout(), is(600000L));
assertThat(((HikariDataSource) dataSource).isAutoCommit(), is(true));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package io.nflow.engine.internal.dao;

import static org.hamcrest.CoreMatchers.nullValue;
import static org.hamcrest.Matchers.nullValue;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.notNullValue;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
import static io.nflow.engine.workflow.instance.WorkflowInstanceAction.WorkflowActionType.stateExecution;
import static java.util.Arrays.asList;
import static java.util.Collections.emptySet;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.joda.time.DateTime.now;
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertThrows;
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;

import java.util.ArrayList;
Expand Down Expand Up @@ -64,7 +64,7 @@ public void getOldWorkflowIdsReturnPassiveWorkflowsModifiedBeforeGivenTimeOrdere
expectedIds.add(storePassiveWorkflow(archiveTime2));

List<Long> oldWorkflowIds = maintenanceDao.getOldWorkflowIds(MAIN, archiveTimeLimit, 10, emptySet());
assertArrayEquals(oldWorkflowIds.toArray(), expectedIds.toArray());
assertArrayEquals(expectedIds.toArray(), oldWorkflowIds.toArray());
}

@Test
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package io.nflow.engine.internal.dao;

import static io.nflow.engine.config.Profiles.H2;
import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.jupiter.api.Assertions.assertThrows;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package io.nflow.engine.internal.dao;

import static com.nitorcreations.Matchers.containsElementsInAnyOrder;
import static com.nitorcreations.Matchers.reflectEquals;
import static java.util.Arrays.asList;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains;
import static org.hamcrest.Matchers.containsInAnyOrder;
import static org.hamcrest.Matchers.is;

import java.util.ArrayList;
Expand Down Expand Up @@ -51,14 +51,8 @@ private void roundTrip(List<String> typeQueryParameters) {
assertThat(stored.type, is(convertedOriginal.type));
assertThat(stored.onError, is(convertedOriginal.onError));
assertThat(stored.description, is(convertedOriginal.description));
assertThat(stored.states.size(), is(convertedOriginal.states.size()));
for (int i = 0; i < convertedOriginal.states.size(); i++) {
assertThat(stored.states.get(i), reflectEquals(convertedOriginal.states.get(i)));
}
assertThat(stored.supportedSignals.size(), is(convertedOriginal.supportedSignals.size()));
for (int i = 0; i < convertedOriginal.supportedSignals.size(); i++) {
assertThat(stored.supportedSignals.get(i), reflectEquals(convertedOriginal.supportedSignals.get(i)));
}
assertThat(stored.states, contains(convertedOriginal.states.toArray()));
assertThat(stored.supportedSignals, contains(convertedOriginal.supportedSignals.toArray()));
}

@Test
Expand All @@ -77,7 +71,7 @@ public void convertStoredDefinitionWorks() {
assertThat(convertedState.onFailure, is(originalFailureTransition != null ? originalFailureTransition.name() : null));
List<String> originalStateTransitions = original.getAllowedTransitions().get(originalState.name());
if (originalStateTransitions != null) {
assertThat(convertedState.transitions, containsElementsInAnyOrder(originalStateTransitions));
assertThat(convertedState.transitions, containsInAnyOrder(originalStateTransitions.toArray()));
} else {
assertThat(convertedState.transitions.size(), is(0));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
import static java.util.Collections.emptySet;
import static org.apache.commons.lang3.StringUtils.countMatches;
import static org.apache.commons.lang3.StringUtils.repeat;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.notNullValue;
import static org.hamcrest.CoreMatchers.nullValue;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.notNullValue;
import static org.hamcrest.Matchers.nullValue;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains;
import static org.hamcrest.Matchers.containsInAnyOrder;
Expand Down
Loading

0 comments on commit 0fbc0fe

Please sign in to comment.