diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 8cee3da9..5f8f14b0 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -1,7 +1,6 @@ name: CWS CI -# Triggers the workflow on push or pull request -#on: [push, pull_request] +# Triggers the workflow on push on: push: schedule: @@ -42,15 +41,11 @@ jobs: cd install/docker/es-only docker-compose up -d - name: Set up CWS database using Docker - run: docker run -d -p 3306:3306 -e MYSQL_DATABASE=cws_dev -e MYSQL_ROOT_PASSWORD=rootpw --name mdb103 mariadb:10.3 + run: docker run -d -p 3306:3306 -e MYSQL_DATABASE=cws_dev -e MYSQL_ROOT_PASSWORD=adminpw --name mdb103 mariadb:10.3 - name: Show Docker containers run: | sleep 5s docker ps -a - - name: Stop CWS - run: | - chmod +x stop_dev.sh - ./stop_dev.sh - name: Run CWS run: | cd ci @@ -63,10 +58,11 @@ jobs: ls -al - uses: browser-actions/setup-chrome@latest - run: chrome --version - - name: Run Unit and Integration Tests - run: | - chmod +x test.sh - ./test.sh + - name: Run Unit Tests + run: mvn -Dmaven.compiler.debug=true -Dmaven.compiler.debuglevel=lines,vars,source clean test jacoco:report-aggregate + shell: bash + - name: Run Integration Tests + run: mvn -Dmaven.compiler.debug=true -Dmaven.compiler.debuglevel=lines,vars,source integration-test verify -DskipTests shell: bash - name: Upload Jacoco report uses: actions/upload-artifact@v3 @@ -79,6 +75,7 @@ jobs: name: test-screenshots path: test-screenshots/ - name: Send custom JSON data to Slack workflow + if: ${{ always() }} id: slack uses: slackapi/slack-github-action@v1.19.0 with: diff --git a/ci/run_ci.sh b/ci/run_ci.sh index af40b703..8dc8f470 100755 --- a/ci/run_ci.sh +++ b/ci/run_ci.sh @@ -17,7 +17,7 @@ DB_TYPE=mariadb DB_HOST=127.0.0.1 DB_NAME=cws_dev # needs to match the db you set up beforehand DB_USER=root # needs to match the user you set up beforehand -DB_PASS=rootpw # could also be specified with environment vars +DB_PASS=adminpw # could also be specified with environment vars DB_PORT=3306 # mariadb default USER=cwsci diff --git a/cws-service/src/main/java/jpl/cws/service/CwsConsoleService.java b/cws-service/src/main/java/jpl/cws/service/CwsConsoleService.java index 4d21bff1..6ecfdfaa 100644 --- a/cws-service/src/main/java/jpl/cws/service/CwsConsoleService.java +++ b/cws-service/src/main/java/jpl/cws/service/CwsConsoleService.java @@ -481,8 +481,8 @@ private void getHistoryVarDetails(List history, String processIns if (variable.getSerializerName().equals("json")) { - // TODO: Update this to display the actual JSON data in history (Collapsible table hopefully?) - message = "Setting (json) " + variable.getVariableName() + " = " + " "; + // TODO: Update this to be a collapsible table + message = "Setting (json) " + variable.getVariableName() + " = " + variable.getValue(); } else { message = "Setting (" + variable.getTypeName() + ") " + variable.getVariableName() + " = " + variable.getValue(); diff --git a/cws-test/src/test/java/jpl/cws/test/CmdLineExecTaskTest.java b/cws-test/src/test/java/jpl/cws/test/CmdLineExecTaskTest.java index 771f3cf9..1d9bb035 100644 --- a/cws-test/src/test/java/jpl/cws/test/CmdLineExecTaskTest.java +++ b/cws-test/src/test/java/jpl/cws/test/CmdLineExecTaskTest.java @@ -1,6 +1,5 @@ package jpl.cws.test; -//import static org.camunda.bpm.engine.test.assertions.ProcessEngineAssertions.assertThat; import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.*; import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.runtimeService; import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.withVariables; @@ -18,7 +17,6 @@ * Tests related to EmailTask * */ -@Ignore public class CmdLineExecTaskTest extends CwsTestBase { @Rule diff --git a/cws-test/src/test/java/jpl/cws/test/CustomMethodCallTest.java b/cws-test/src/test/java/jpl/cws/test/CustomMethodCallTest.java index 34e16ef0..2c3bb9c1 100644 --- a/cws-test/src/test/java/jpl/cws/test/CustomMethodCallTest.java +++ b/cws-test/src/test/java/jpl/cws/test/CustomMethodCallTest.java @@ -1,6 +1,5 @@ package jpl.cws.test; -//import static org.camunda.bpm.engine.test.assertions.ProcessEngineAssertions.assertThat; import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.*; import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.runtimeService; import static org.junit.Assert.fail; diff --git a/cws-test/src/test/java/jpl/cws/test/Cws331Test.java b/cws-test/src/test/java/jpl/cws/test/Cws331Test.java index 43271c02..87187bed 100644 --- a/cws-test/src/test/java/jpl/cws/test/Cws331Test.java +++ b/cws-test/src/test/java/jpl/cws/test/Cws331Test.java @@ -1,6 +1,5 @@ package jpl.cws.test; -//import static org.camunda.bpm.engine.test.assertions.ProcessEngineAssertions.assertThat; import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.*; import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.execute; import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.job; diff --git a/cws-test/src/test/java/jpl/cws/test/CwsTestBase.java b/cws-test/src/test/java/jpl/cws/test/CwsTestBase.java index d01bcf9b..8772e4b4 100644 --- a/cws-test/src/test/java/jpl/cws/test/CwsTestBase.java +++ b/cws-test/src/test/java/jpl/cws/test/CwsTestBase.java @@ -1,6 +1,5 @@ package jpl.cws.test; -//import static org.camunda.bpm.engine.test.assertions.ProcessEngineAssertions.assertThat; import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.*; import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.claim; import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.complete; diff --git a/cws-test/src/test/java/jpl/cws/test/CwsTestBase2.java b/cws-test/src/test/java/jpl/cws/test/CwsTestBase2.java index f617fad3..b9cf1a00 100644 --- a/cws-test/src/test/java/jpl/cws/test/CwsTestBase2.java +++ b/cws-test/src/test/java/jpl/cws/test/CwsTestBase2.java @@ -1,6 +1,5 @@ package jpl.cws.test; -//import static org.camunda.bpm.engine.test.assertions.ProcessEngineAssertions.assertThat; import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.*; import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.claim; import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.complete; diff --git a/cws-test/src/test/java/jpl/cws/test/EmailTaskTest.java b/cws-test/src/test/java/jpl/cws/test/EmailTaskTest.java index 29bf1638..1606ac68 100644 --- a/cws-test/src/test/java/jpl/cws/test/EmailTaskTest.java +++ b/cws-test/src/test/java/jpl/cws/test/EmailTaskTest.java @@ -1,6 +1,5 @@ package jpl.cws.test; -//import static org.camunda.bpm.engine.test.assertions.ProcessEngineAssertions.assertThat; import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.*; import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.runtimeService; import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.withVariables; @@ -13,10 +12,7 @@ import org.camunda.bpm.engine.test.Deployment; import org.camunda.bpm.engine.test.ProcessEngineRule; import org.camunda.bpm.engine.test.mock.Mocks; -import org.junit.After; -import org.junit.Before; -import org.junit.Ignore; -import org.junit.Rule; +import org.junit.*; import com.dumbster.smtp.SimpleSmtpServer; import com.dumbster.smtp.SmtpMessage; @@ -50,8 +46,7 @@ public void tearDown() { * Tests BPMN process that sends an email using EmailTask. * */ - //@Test - @Ignore + @Test @Deployment(resources = {"bpmn/test_email_task.bpmn"}) public void testCase1() { try { @@ -81,8 +76,8 @@ public void testCase1() { assertTrue(email.getBody().contains("this
has
line
breaks!")); // verify to/from - assertTrue(email.getHeaderValue("From").equals("user@localhost")); - assertTrue(email.getHeaderValue("To").equals("user@localhost")); + assertTrue(email.getHeaderValue("From").equals("user@domain.com")); + assertTrue(email.getHeaderValue("To").equals("user@domain.org")); } } \ No newline at end of file diff --git a/cws-test/src/test/java/jpl/cws/test/InstallerTest.java b/cws-test/src/test/java/jpl/cws/test/InstallerTest.java index f39f22a0..af6a34a6 100644 --- a/cws-test/src/test/java/jpl/cws/test/InstallerTest.java +++ b/cws-test/src/test/java/jpl/cws/test/InstallerTest.java @@ -3,6 +3,7 @@ import static org.junit.Assert.assertTrue; import java.io.BufferedReader; +import java.io.File; import java.io.IOException; import java.io.InputStreamReader; import java.nio.charset.Charset; @@ -20,19 +21,18 @@ * Tests related to Security * */ -@Ignore public class InstallerTest { private static Charset charset = StandardCharsets.UTF_8; private static final String NL = System.getProperty("line.separator"); @Before - public void setup() { - + public void setup() throws IOException { + shutdownConsole(); } @After - public void tearDown() { - + public void tearDown() throws IOException { + startConsole(); } /** @@ -109,4 +109,51 @@ public static void writeToFile(Path filePath, String content) throws IOException Files.write(filePath, content.getBytes(charset)); } + public static void shutdownConsole() throws IOException { + try { + String cwsDir = new File(System.getProperty("user.dir")).getParent(); + System.out.println(cwsDir); + String stopConsoleScript = cwsDir + "/dist/console-only/cws/stop_cws.sh"; + String[] command = {"bash", "-c", "bash " + stopConsoleScript}; + + Process proc = Runtime.getRuntime().exec(command); + proc.waitFor(); + StringBuffer output = new StringBuffer(); + BufferedReader reader = new BufferedReader(new InputStreamReader(proc.getInputStream())); + String line = ""; + while ((line = reader.readLine())!= null) { + output.append(line + "\n"); + } + System.out.println("### " + output); + + //Thread.sleep(75000); //wait for shutdown of console. + } + catch (Throwable e) { + System.out.println(e.toString()); + } + } + + public static void startConsole() throws IOException { + try { + String startConsoleScript = new File(System.getProperty("user.dir")).getParent() + "/dist/console-only/cws/start_cws.sh"; + String commandStart = "bash " + startConsoleScript; + + Process procStart = Runtime.getRuntime().exec(commandStart); + procStart.waitFor(); + StringBuffer outputStart = new StringBuffer(); + BufferedReader readerStart = new BufferedReader(new InputStreamReader(procStart.getInputStream())); + String lineStart = ""; + while ((lineStart = readerStart.readLine())!= null) { + outputStart.append(lineStart + "\n"); + } + System.out.println("### " + outputStart); + + //wait for start up of console. + // Thread.sleep(75000); + } + catch (Throwable e) { + System.out.println(e.toString()); + } + } + } diff --git a/cws-test/src/test/java/jpl/cws/test/Issue16Test.java b/cws-test/src/test/java/jpl/cws/test/Issue16Test.java index 590c24ad..3afe54f3 100644 --- a/cws-test/src/test/java/jpl/cws/test/Issue16Test.java +++ b/cws-test/src/test/java/jpl/cws/test/Issue16Test.java @@ -15,7 +15,6 @@ /** * */ -@Ignore public class Issue16Test extends CwsTestBase { private static final Logger log = LoggerFactory.getLogger(Issue16Test.class); diff --git a/cws-test/src/test/java/jpl/cws/test/SecurityTest.java b/cws-test/src/test/java/jpl/cws/test/SecurityTest.java index c7bd52ca..b5ba5640 100644 --- a/cws-test/src/test/java/jpl/cws/test/SecurityTest.java +++ b/cws-test/src/test/java/jpl/cws/test/SecurityTest.java @@ -21,7 +21,6 @@ * Tests related to Security * */ -@Ignore public class SecurityTest { private static Charset charset = StandardCharsets.UTF_8; private static final String NL = System.getProperty("line.separator"); diff --git a/cws-test/src/test/java/jpl/cws/test/SleepTaskTest.java b/cws-test/src/test/java/jpl/cws/test/SleepTaskTest.java index 93100b4c..e6e859e8 100644 --- a/cws-test/src/test/java/jpl/cws/test/SleepTaskTest.java +++ b/cws-test/src/test/java/jpl/cws/test/SleepTaskTest.java @@ -1,6 +1,5 @@ package jpl.cws.test; -//import static org.camunda.bpm.engine.test.assertions.ProcessEngineAssertions.assertThat; import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.*; import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.runtimeService; import static org.junit.Assert.assertTrue; diff --git a/cws-test/src/test/java/jpl/cws/test/SubProcessBoundaryCatchTest.java b/cws-test/src/test/java/jpl/cws/test/SubProcessBoundaryCatchTest.java index 5590131f..1ab022f8 100644 --- a/cws-test/src/test/java/jpl/cws/test/SubProcessBoundaryCatchTest.java +++ b/cws-test/src/test/java/jpl/cws/test/SubProcessBoundaryCatchTest.java @@ -1,6 +1,5 @@ package jpl.cws.test; -//import static org.camunda.bpm.engine.test.assertions.ProcessEngineAssertions.assertThat; import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.*; import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.runtimeService; import static org.junit.Assert.fail; diff --git a/cws-test/src/test/java/jpl/cws/test/TaskInstanceCountTest.java b/cws-test/src/test/java/jpl/cws/test/TaskInstanceCountTest.java index 85f117ad..8d00a121 100644 --- a/cws-test/src/test/java/jpl/cws/test/TaskInstanceCountTest.java +++ b/cws-test/src/test/java/jpl/cws/test/TaskInstanceCountTest.java @@ -1,6 +1,5 @@ package jpl.cws.test; -//import static org.camunda.bpm.engine.test.assertions.ProcessEngineAssertions.assertThat; import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.*; import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.runtimeService; import static org.junit.Assert.fail; diff --git a/cws-test/src/test/resources/bpmn/test_email_task.bpmn b/cws-test/src/test/resources/bpmn/test_email_task.bpmn index c6125946..91ed23eb 100644 --- a/cws-test/src/test/resources/bpmn/test_email_task.bpmn +++ b/cws-test/src/test/resources/bpmn/test_email_task.bpmn @@ -1,56 +1,61 @@ - - - - - - - - - - - - - SequenceFlow_1 - SequenceFlow_2 - - - SequenceFlow_1 - - - - - SequenceFlow_2 - - + + + + SequenceFlow_1 + + + + + ${execution.getVariable('smtpHost') == null ? 'localhost' : smtpHost} + + + ${execution.getVariable('smtpPort') == null ? '25' : smtpPort} + + + user@domain.com + + + user@domain.org + + + test from CWS + + + ${body} + + + html + + + SequenceFlow_1 + SequenceFlow_2 + + + SequenceFlow_2 + + + + - + + + + + + + + + - - - - + - - + + - - - - - + + - - - - - - - - - - - - \ No newline at end of file + diff --git a/cws-test/src/test/resources/camunda.cfg.xml b/cws-test/src/test/resources/camunda.cfg.xml index 4180f3ae..70987a4a 100644 --- a/cws-test/src/test/resources/camunda.cfg.xml +++ b/cws-test/src/test/resources/camunda.cfg.xml @@ -11,5 +11,12 @@ + + + + + + + diff --git a/cws-test/src/test/resources/configure_with_jacoco.sh b/cws-test/src/test/resources/configure_with_jacoco.sh index f78e4afa..a37f72ce 100755 --- a/cws-test/src/test/resources/configure_with_jacoco.sh +++ b/cws-test/src/test/resources/configure_with_jacoco.sh @@ -11,6 +11,10 @@ source ${ROOT}/utils.sh CONF_FILE=$1 PROMPT_VALUE=$2 +# ================ +# SETUP VARIABLES +# ================ +export CWS_HOME=${ROOT} export CWS_INSTALLER_PRESET_FILE=${ROOT}/configuration.properties cd $ROOT diff --git a/cws-test/src/test/resources/installerTest.sh b/cws-test/src/test/resources/installerTest.sh index ca4ed43a..ebea28d0 100755 --- a/cws-test/src/test/resources/installerTest.sh +++ b/cws-test/src/test/resources/installerTest.sh @@ -22,7 +22,8 @@ cd $ROOT/../../../newCWSDir/console-only tar zxf cws_server.tar.gz cd cws -cp $ROOT/configuration.properties ./ +#cp $ROOT/configuration.properties ./ +cp $ROOT/../../../../dist/console-only/cws/configuration.properties ./ cp $ROOT/configure_with_jacoco.sh ./ echo "CONFIGURING CWS..." diff --git a/install/cws-ui/applicationContext.xml b/install/cws-ui/applicationContext.xml index 7387350a..8f438875 100644 --- a/install/cws-ui/applicationContext.xml +++ b/install/cws-ui/applicationContext.xml @@ -57,6 +57,7 @@ + __LDAP_PLUGIN_REF__