diff --git a/.github/badges/jacoco.svg b/.github/badges/jacoco.svg new file mode 100644 index 0000000..eeebec0 --- /dev/null +++ b/.github/badges/jacoco.svg @@ -0,0 +1 @@ +coverage48.9% \ No newline at end of file diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..9a2803e --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,53 @@ +# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-maven + +# This workflow uses actions that are not certified by GitHub. +# They are provided by a third-party and are governed by +# separate terms of service, privacy policy, and support +# documentation. + +name: Java CI with Maven + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Set up JDK 17 + uses: actions/setup-java@v3 + with: + java-version: '17' + distribution: 'temurin' + cache: maven + - name: Verify + run: xvfb-run mvn -B verify + - name: Package + run: mvn -B package + + - name: Generate JaCoCo Badge + uses: cicirello/jacoco-badge-generator@v2 + with: + jacoco-csv-file: tests/target/jacoco/report/jacoco.csv + + - name: Commit and push the badge (if it changed) + uses: EndBug/add-and-commit@v9 + with: + default_author: github_actions + message: 'commit badge' + add: '.github/badges/jacoco.svg' + + - name: Upload JaCoCo coverage report + uses: actions/upload-artifact@v3 + with: + name: jacoco-report + path: tests/target/jacoco/report/ + + # Optional: Uploads the full dependency graph to GitHub to improve the quality of Dependabot alerts this repository can receive + - name: Update dependency graph + uses: advanced-security/maven-dependency-submission-action@v3 diff --git a/.mvn/extensions.xml b/.mvn/extensions.xml new file mode 100644 index 0000000..3fceb34 --- /dev/null +++ b/.mvn/extensions.xml @@ -0,0 +1,8 @@ + + + + org.eclipse.tycho + tycho-build + 2.7.5 + + diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 42a3db8..0000000 --- a/.travis.yml +++ /dev/null @@ -1,15 +0,0 @@ -cache: - directories: - - $HOME/.m2 -language: java -matrix: - include: - - os: linux - jdk: oraclejdk8 - script: xvfb-run mvn verify -B - - os: osx - osx_image: xcode9.3 - script: Xvfb :5009 & export DISPLAY=:5009 && mvn verify -B -before_install: - - if [ "$TRAVIS_OS_NAME" == "osx" ]; then export JAVA_HOME=$(/usr/libexec/java_home); fi -install: mvn package -B diff --git a/CHANGELOG.md b/CHANGELOG.md index 61f2c37..f766f51 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,12 @@ All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/). The file is formatted as described on http://keepachangelog.com/. +## [1.0.4] - 2023-11-20 + +### Changes + +- Builds by default with KNIME 5.1, can be configured to build with KNIME 4.7 [#10](https://github.com/3D-e-Chem/knime-testflow/issues/10) + ## [Unreleased] ### Changes diff --git a/README.md b/README.md index 8e7cc63..229f8e6 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ Test Knime workflows from a Junit test. -[![Build Status](https://travis-ci.org/3D-e-Chem/knime-testflow.svg?branch=master)](https://travis-ci.org/3D-e-Chem/knime-testflow) -[![Codacy Badge](https://api.codacy.com/project/badge/Grade/ba09652161144d9abbe4827fd16bbaec)](https://www.codacy.com/app/3D-e-Chem/knime-testflow?utm_source=github.com&utm_medium=referral&utm_content=3D-e-Chem/knime-testflow&utm_campaign=Badge_Grade) +[![Java CI with Maven](https://github.com/3D-e-Chem/knime-testflow/actions/workflows/ci.yml/badge.svg)](https://github.com/3D-e-Chem/knime-testflow/actions/workflows/ci.yml) +![Coverage](.github/badges/jacoco.svg) [![DOI](https://zenodo.org/badge/doi/10.5281/zenodo.55805.svg)](http://dx.doi.org/10.5281/zenodo.55805) The Knime Testing Framework can run a test workflow either: @@ -34,12 +34,12 @@ To make use of in a Tycho based project add to the `` tag of the ` In the `Require-Bundle` attribute of the `META-INF/MANIFEST.MF` of the tests module add ``` nl.esciencecenter.e3dchem.knime.testing.plugin;bundle-version="[1.0.0,2.0.0)", -org.knime.testing;bundle-version="[4.0.0,5.0.0)", +org.knime.testing;bundle-version="[4.0.0,6.0.0)", ``` ## 3. Add test workflow -Create a test workflow as described in the "Testing Framework" manual that you get when you install the "KNIME Testing Framework" (look in plugins/org.knime.testing_x.y.z/doc/Regression Tests.pdf). +Create a test workflow as described in the ["Testing Framework" manual](https://github.com/knime/knime-core/blob/bf6f8c378694d5a435ef29cb469a7ced26ffca9f/org.knime.testing/doc/Regression%20Tests.pdf). Place the workflow as a directory inside the `src/knime/` directory of the tests module. @@ -83,13 +83,13 @@ mvn verify The test results can be found in the `T E S T S` section of the standard output. -## 6. Add GUI testing to Travis-CI. +## 6. Add GUI testing on GitHub actions. As you might have noticed during the previouse step, running test will quickly show some dialogs and windows. -To show graphical user elements an X-server is required, sadly Travis-CI does not run an X-server. -A temporary X-server can be run with Xvfb, which is luckily available on all Travis-CI environments. +To show graphical user elements an X-server is required, sadly GitHub actions does not run an X-server. +A temporary X-server can be run with Xvfb, which is luckily available on all GitHub actions environments. -Prepend `xvfb-run` before the `mvn verify` command in the `.travis.yml` file. +Prepend `xvfb-run` before the `mvn verify` command in the `.github/workflows/*.yml` file. For example ``` @@ -102,18 +102,24 @@ script: xvfb-run mvn verify -B mvn verify ``` -An Eclipse update site will be made in `p2/target/repository` repository. +An Eclipse update site will be made in `p2/target/repository/` repository. The update site can be used to perform a local installation. +By default this will compile against KNIME AP v5.1, using the [KNIME-AP-5.1](targetPlatform/KNIME-AP-5.1.target) file. +To build instead for KNIME AP v4.7, use: +``` +mvn verify -Dknime.version=4.7 +``` + # Development Steps to get development environment setup based on https://github.com/knime/knime-sdk-setup#sdk-setup: -1. Install Java 8 +1. Install Java 17 2. Install Eclipse for [RCP and RAP developers](https://www.eclipse.org/downloads/packages/release/2018-12/r/eclipse-ide-rcp-and-rap-developers) -3. Configure Java 8 inside Eclipse Window > Preferences > Java > Installed JREs +3. Configure Java 17 inside Eclipse Window > Preferences > Java > Installed JREs 4. Import this repo as an Existing Maven project -5. Activate target platform by going to Window > Preferences > Plug-in Development > Target Platform and check the `KNIME Analytics Platform (4.0) - nl.esciencecenter.e3dchem.knime.testing.targetplatform/KNIME-AP-4.0.target` target definition. +5. Activate target platform by going to Window > Preferences > Plug-in Development > Target Platform and check the `KNIME Analytics Platform (5.1) - nl.esciencecenter.e3dchem.knime.testing.targetplatform/KNIME-AP-5.1.target` target definition. During import the Tycho Eclipse providers must be installed. diff --git a/p2/category.xml b/p2/category.xml index 52909b9..5edda1b 100644 --- a/p2/category.xml +++ b/p2/category.xml @@ -1,6 +1,6 @@ - + diff --git a/p2/pom.xml b/p2/pom.xml index f8bfa96..a4ffd3e 100644 --- a/p2/pom.xml +++ b/p2/pom.xml @@ -4,7 +4,7 @@ nl.esciencecenter.e3dchem.knime.testing nl.esciencecenter.e3dchem.knime.testing - 1.0.3-SNAPSHOT + 1.0.4-SNAPSHOT nl.esciencecenter.e3dchem.knime.testing.p2 eclipse-repository diff --git a/plugin/META-INF/MANIFEST.MF b/plugin/META-INF/MANIFEST.MF index a282be2..5ac2b6c 100644 --- a/plugin/META-INF/MANIFEST.MF +++ b/plugin/META-INF/MANIFEST.MF @@ -2,13 +2,13 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Test Knime workflows from a JUnit test Bundle-SymbolicName: nl.esciencecenter.e3dchem.knime.testing.plugin;singleton:=true -Bundle-Version: 1.0.3.qualifier -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-Version: 1.0.4.qualifier +Bundle-RequiredExecutionEnvironment: JavaSE-17 Bundle-Vendor: Netherlands eScience Center -Require-Bundle: org.knime.workbench.repository;bundle-version="[4.0.0,5.0.0)", - org.knime.workbench.core;bundle-version="[4.0.0,5.0.0)", - org.knime.testing;bundle-version="[4.0.0,5.0.0)", - org.junit;bundle-version="[4.8.0,5.0.0)", +Require-Bundle: org.knime.workbench.repository;bundle-version="[4.0.0,6.0.0)", + org.knime.workbench.core;bundle-version="[4.0.0,6.0.0)", + org.knime.testing;bundle-version="[4.0.0,6.0.0)", + org.junit;bundle-version="[4.8.0,6.0.0)", org.apache.log4j;bundle-version="[1.2.15,1.3.0)" Bundle-ClassPath: . Export-Package: nl.esciencecenter.e3dchem.knime.testing diff --git a/plugin/pom.xml b/plugin/pom.xml index ae49419..6f560b6 100644 --- a/plugin/pom.xml +++ b/plugin/pom.xml @@ -4,7 +4,7 @@ nl.esciencecenter.e3dchem.knime.testing nl.esciencecenter.e3dchem.knime.testing - 1.0.3-SNAPSHOT + 1.0.4-SNAPSHOT nl.esciencecenter.e3dchem.knime.testing.plugin eclipse-plugin diff --git a/plugin/src/java/nl/esciencecenter/e3dchem/knime/testing/core/ng/WorkflowExecuteTest.java b/plugin/src/java/nl/esciencecenter/e3dchem/knime/testing/core/ng/WorkflowExecuteTest.java index 8d886c6..97e904c 100644 --- a/plugin/src/java/nl/esciencecenter/e3dchem/knime/testing/core/ng/WorkflowExecuteTest.java +++ b/plugin/src/java/nl/esciencecenter/e3dchem/knime/testing/core/ng/WorkflowExecuteTest.java @@ -63,7 +63,7 @@ import org.knime.core.node.workflow.SingleNodeContainer; import org.knime.core.node.workflow.SubNodeContainer; import org.knime.core.node.workflow.WorkflowManager; -import org.knime.core.util.GUIDeadlockDetector; +import org.knime.core.util.ThreadUtils; import org.knime.testing.core.TestrunConfiguration; import org.knime.testing.node.config.TestConfigNodeModel; @@ -128,7 +128,7 @@ private void internalRun() { (usage.getMax() - usage.getUsed()) / 1024.0 / 1024.0); message += "\n" + formatter.out().toString(); formatter.close(); - message += "\nThread status:\n" + GUIDeadlockDetector.createStacktrace(); + message += "\nThread status:\n" + ThreadUtils.getJVMStacktraces(); } NodeLogger.getLogger(WorkflowExecuteTest.class).info(message); collector.addError(new Throwable(message)); diff --git a/plugin/src/java/nl/esciencecenter/e3dchem/knime/testing/core/ng/WorkflowLoadTest.java b/plugin/src/java/nl/esciencecenter/e3dchem/knime/testing/core/ng/WorkflowLoadTest.java index b2a81d0..f923adb 100644 --- a/plugin/src/java/nl/esciencecenter/e3dchem/knime/testing/core/ng/WorkflowLoadTest.java +++ b/plugin/src/java/nl/esciencecenter/e3dchem/knime/testing/core/ng/WorkflowLoadTest.java @@ -57,7 +57,7 @@ import org.knime.core.node.ExecutionMonitor; import org.knime.core.node.InvalidSettingsException; import org.knime.core.node.workflow.UnsupportedWorkflowVersionException; -import org.knime.core.node.workflow.WorkflowContext; +import org.knime.core.node.workflow.contextv2.WorkflowContextV2; import org.knime.core.node.workflow.WorkflowLoadHelper; import org.knime.core.node.workflow.WorkflowManager; import org.knime.core.node.workflow.WorkflowPersistor.LoadResultEntry.LoadResultEntryType; @@ -121,10 +121,8 @@ static WorkflowManager loadWorkflow(final WorkflowTest test, final ErrorCollecto * {@inheritDoc} */ @Override - public WorkflowContext getWorkflowContext() { - WorkflowContext.Factory fac = new WorkflowContext.Factory(workflowDir); - fac.setMountpointRoot(testcaseRoot); - return fac.createContext(); + public WorkflowContextV2 getWorkflowContext() { + return WorkflowContextV2.forTemporaryWorkflow(workflowDir.toPath(), null); } }; diff --git a/pom.xml b/pom.xml index de8eaf7..8053235 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ 4.0.0 nl.esciencecenter.e3dchem.knime.testing nl.esciencecenter.e3dchem.knime.testing - 1.0.3-SNAPSHOT + 1.0.4-SNAPSHOT pom @@ -18,8 +18,8 @@ https://github.com/3D-e-Chem/knime-testflow/issues - Travis CI - http://travis-ci.org/3D-e-Chem/knime-testflow + GitHub Actions + https://github.com/3D-e-Chem/knime-testflow/actions @@ -27,13 +27,32 @@ - 1.4.0 - 1.4.0 + 2.7.5 + ${tycho.version} -Xmx512m - UTF-8 + 0.8.10 + 17 + 3.10.1 + UTF-8 UTF-8 scm:git:https://github.com/3D-e-Chem/knime-testflow.git - KNIME-AP-4.0 + 5.1 + KNIME-AP-${knime.version} + + --add-opens=java.security.jgss/sun.security.jgss.krb5=ALL-UNNAMED + --add-opens=java.base/sun.security.ssl=ALL-UNNAMED + --add-opens=java.base/sun.security.util=ALL-UNNAMED + --add-opens=java.base/java.lang=ALL-UNNAMED + --add-opens=java.base/java.lang.invoke=ALL-UNNAMED + --add-opens=java.base/java.net=ALL-UNNAMED + --add-opens=java.base/java.nio=ALL-UNNAMED + --add-opens=java.base/java.nio.channels=ALL-UNNAMED + --add-opens=java.base/java.util=ALL-UNNAMED + --add-opens=java.base/sun.nio.ch=ALL-UNNAMED + --add-opens=java.base/sun.nio=ALL-UNNAMED + --add-opens=java.desktop/javax.swing.plaf.basic=ALL-UNNAMED + --add-opens=java.base/sun.net.www.protocol.http=ALL-UNNAMED + -Dmisc.io.testing=true diff --git a/targetplatform/KNIME-AP-4.0.target b/targetplatform/KNIME-AP-4.7.target similarity index 88% rename from targetplatform/KNIME-AP-4.0.target rename to targetplatform/KNIME-AP-4.7.target index 5278cb9..abdc349 100644 --- a/targetplatform/KNIME-AP-4.0.target +++ b/targetplatform/KNIME-AP-4.7.target @@ -1,5 +1,5 @@ - + @@ -12,13 +12,13 @@ - + - + - + -server -Dsun.java2d.d3d=false diff --git a/targetplatform/KNIME-AP-5.1.target b/targetplatform/KNIME-AP-5.1.target new file mode 100644 index 0000000..4502706 --- /dev/null +++ b/targetplatform/KNIME-AP-5.1.target @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + + + +-server +-Dsun.java2d.d3d=false +-Dosgi.classloader.lock=classname +-XX:+UnlockDiagnosticVMOptions +-XX:+UnsyncloadClass +-XX:+UseG1GC +-ea +-Dorg.eclipse.swt.internal.gtk.cairoGraphics=false +-Dorg.eclipse.swt.internal.gtk.useCairo=false +-Dorg.eclipse.swt.browser.IEVersion=10001 +-Dsun.awt.noerasebackground=true +-Dsun.net.client.defaultReadTimeout=0 +-Dorg.eclipse.swt.internal.gtk.disablePrinting + + diff --git a/targetplatform/pom.xml b/targetplatform/pom.xml index 83fc8d3..f0460b6 100644 --- a/targetplatform/pom.xml +++ b/targetplatform/pom.xml @@ -20,7 +20,7 @@ Contributors: nl.esciencecenter.e3dchem.knime.testing nl.esciencecenter.e3dchem.knime.testing - 1.0.3-SNAPSHOT + 1.0.4-SNAPSHOT diff --git a/tests/META-INF/MANIFEST.MF b/tests/META-INF/MANIFEST.MF index 37f0938..23c5186 100644 --- a/tests/META-INF/MANIFEST.MF +++ b/tests/META-INF/MANIFEST.MF @@ -2,11 +2,11 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Tests Bundle-SymbolicName: nl.esciencecenter.e3dchem.knime.testing.tests -Bundle-Version: 1.0.3.qualifier -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-Version: 1.0.4.qualifier +Bundle-RequiredExecutionEnvironment: JavaSE-17 Require-Bundle: org.junit;bundle-version="4.12.0", - org.knime.core;bundle-version="[4.0.0,5.0.0)", - org.knime.base;bundle-version="[4.0.0,5.0.0)", + org.knime.core;bundle-version="[4.0.0,6.0.0)", + org.knime.base;bundle-version="[4.0.0,6.0.0)", nl.esciencecenter.e3dchem.knime.testing.plugin Bundle-Vendor: Your Name Bundle-ClassPath: . diff --git a/tests/pom.xml b/tests/pom.xml index 94da2a8..0b3ccab 100644 --- a/tests/pom.xml +++ b/tests/pom.xml @@ -5,7 +5,7 @@ nl.esciencecenter.e3dchem.knime.testing nl.esciencecenter.e3dchem.knime.testing - 1.0.3-SNAPSHOT + 1.0.4-SNAPSHOT nl.esciencecenter.e3dchem.knime.testing.tests @@ -16,7 +16,7 @@ org.jacoco jacoco-maven-plugin - 0.7.8 + ${jacoco.version} @@ -38,7 +38,7 @@ org.jacoco org.jacoco.ant - 0.7.8 + ${jacoco.version} ant-contrib @@ -85,6 +85,7 @@ + @@ -106,11 +107,51 @@ tycho-surefire-plugin ${tycho.version} - ${tycho.testArgLine} ${tycho.test.jvmArgs} + ${tycho.testArgLine} + ${tycho.test.jvmArgs} + ${knime.ini.testArgs} true ${custom.UIThread} + + org.eclipse.tycho + target-platform-configuration + ${tycho.version} + + + + + + eclipse-feature + org.knime.features.clfixes + 0.0.0 + + + eclipse-feature + org.knime.features.workbench + 0.0.0 + + + eclipse-feature + org.knime.features.core + 0.0.0 + + + eclipse-feature + org.knime.features.testing.application + 0.0.0 + + + eclipse-feature + org.knime.features.base + 0.0.0 + + + + + diff --git a/tests/src/java/nl/esciencecenter/e3dchem/knime/testing/TestFlowRunnerTest.java b/tests/src/java/nl/esciencecenter/e3dchem/knime/testing/TestFlowRunnerTest.java index 4edba7e..bd0f85f 100644 --- a/tests/src/java/nl/esciencecenter/e3dchem/knime/testing/TestFlowRunnerTest.java +++ b/tests/src/java/nl/esciencecenter/e3dchem/knime/testing/TestFlowRunnerTest.java @@ -76,7 +76,7 @@ public void test_workflow_2messages() throws IOException, InvalidSettingsExcepti File workflow = new File("src/knime/messages"); List expected = new ArrayList(); expected.add( - "Node 'Table Creator 0:2' has unexpected warning message: expected 'This is not the warning message you are looking for.', got 'Node created an empty data table.'"); + "Node 'Table Creator 3:2' has unexpected warning message: expected 'This is not the warning message you are looking for.', got 'Node created an empty data table.'"); expected.add("Expected WARN log message 'This is not the warning message you are looking for.' not found"); assertWorkflowErrors(workflow, expected);