diff --git a/.github/workflows/github-actions.yaml b/.github/workflows/github-actions.yaml index f73ed267ca8..d897083a740 100755 --- a/.github/workflows/github-actions.yaml +++ b/.github/workflows/github-actions.yaml @@ -277,6 +277,27 @@ jobs: max_attempts: 3 command: ./ci-output.sh mvn -B ${BUILD_OPTS} ${CONFIG_OVERRIDES} -Dgroups='!org.eclipse.kapua.qa.markers.junit.JUnitTests' -Dcucumber.options="--tags @account" verify - run: bash <(curl -s https://codecov.io/bash) + test-jobEngineStepDefinitions: + needs: build-kapua + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-java@v1 + with: + java-version: '8' + - uses: actions/cache@v2 + with: + path: ~/.m2/repository + key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} + restore-keys: | + ${{ runner.os }}-maven- + - uses: nick-invision/retry@v2.4.0 + with: + timeout_minutes: 30 + retry_on: error + max_attempts: 3 + command: ./ci-output.sh mvn -B ${BUILD_OPTS} ${CONFIG_OVERRIDES} -Dgroups='!org.eclipse.kapua.qa.markers.junit.JUnitTests' -Dcucumber.options="--tags @jobEngineStepDefinitions" verify + - run: bash <(curl -s https://codecov.io/bash) test-jobEngineStartOfflineDevice: needs: build-kapua runs-on: ubuntu-latest diff --git a/qa/integration/src/test/java/org/eclipse/kapua/integration/service/jobEngine/RunJobEngineServiceOnlineDeviceI9nTest.java b/qa/integration/src/test/java/org/eclipse/kapua/integration/service/jobEngine/RunJobEngineServiceOnlineDeviceI9nTest.java index 1ec1af13f50..3c2fd6d756a 100644 --- a/qa/integration/src/test/java/org/eclipse/kapua/integration/service/jobEngine/RunJobEngineServiceOnlineDeviceI9nTest.java +++ b/qa/integration/src/test/java/org/eclipse/kapua/integration/service/jobEngine/RunJobEngineServiceOnlineDeviceI9nTest.java @@ -22,17 +22,17 @@ "classpath:features/jobEngine/JobEngineServiceStartOnlineDeviceI9n.feature", "classpath:features/jobEngine/JobEngineServiceRestartOnlineDeviceI9n.feature", "classpath:features/jobEngine/JobEngineServiceRestartOnlineDeviceSecondPartI9n.feature", - "classpath:features/jobEngine/JobEngineServiceStopOnlineDeviceI9n.feature" + "classpath:features/jobEngine/JobEngineServiceStopOnlineDeviceI9n.feature", }, - glue = { "org.eclipse.kapua.service.job.steps", + glue = {"org.eclipse.kapua.service.job.steps", "org.eclipse.kapua.service.user.steps", "org.eclipse.kapua.qa.common", "org.eclipse.kapua.service.account.steps", "org.eclipse.kapua.service.device.registry.steps", }, - plugin = { "pretty", + plugin = {"pretty", "html:target/cucumber/JobEngineOnlineDeviceI9n", - "json:target/JobEngineOnlineDeviceI9n_cucumber.json" }, + "json:target/JobEngineOnlineDeviceI9n_cucumber.json"}, strict = true, monochrome = true) public class RunJobEngineServiceOnlineDeviceI9nTest { diff --git a/qa/integration/src/test/java/org/eclipse/kapua/integration/service/jobEngine/stepDefinitions/RunJobEngineServiceKeystoreStepDefinitionsI9nTest.java b/qa/integration/src/test/java/org/eclipse/kapua/integration/service/jobEngine/stepDefinitions/RunJobEngineServiceKeystoreStepDefinitionsI9nTest.java new file mode 100644 index 00000000000..f9be3bc6e64 --- /dev/null +++ b/qa/integration/src/test/java/org/eclipse/kapua/integration/service/jobEngine/stepDefinitions/RunJobEngineServiceKeystoreStepDefinitionsI9nTest.java @@ -0,0 +1,36 @@ +/******************************************************************************* + * Copyright (c) 2019, 2021 Eurotech and/or its affiliates and others + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Eurotech - initial API and implementation + *******************************************************************************/ +package org.eclipse.kapua.integration.service.jobEngine.stepDefinitions; + +import cucumber.api.CucumberOptions; +import org.eclipse.kapua.qa.common.cucumber.CucumberWithProperties; +import org.junit.runner.RunWith; + +@RunWith(CucumberWithProperties.class) +@CucumberOptions( + features = { + "classpath:features/jobEngine/JobEngineServiceKeystoreStepDefinitionsI9n.feature" + }, + glue = {"org.eclipse.kapua.service.job.steps", + "org.eclipse.kapua.service.user.steps", + "org.eclipse.kapua.qa.common", + "org.eclipse.kapua.service.account.steps", + "org.eclipse.kapua.service.device.registry.steps", + }, + plugin = {"pretty", + "html:target/cucumber/JobEngineOnlineDeviceI9n", + "json:target/JobEngineOnlineDeviceI9n_cucumber.json"}, + strict = true, + monochrome = true) +public class RunJobEngineServiceKeystoreStepDefinitionsI9nTest { +} diff --git a/qa/integration/src/test/resources/features/deviceManagement/DeviceManagementKeystoreI9n.feature b/qa/integration/src/test/resources/features/deviceManagement/DeviceManagementKeystoreI9n.feature index cba8fc52135..022b03c3a24 100644 --- a/qa/integration/src/test/resources/features/deviceManagement/DeviceManagementKeystoreI9n.feature +++ b/qa/integration/src/test/resources/features/deviceManagement/DeviceManagementKeystoreI9n.feature @@ -31,7 +31,7 @@ Feature: Device Management Keystore Service Tests Given Start Broker # - # Setup + # Tests # Scenario: Request Keystores to a Device diff --git a/qa/integration/src/test/resources/features/jobEngine/JobEngineServiceKeystoreStepDefinitionsI9n.feature b/qa/integration/src/test/resources/features/jobEngine/JobEngineServiceKeystoreStepDefinitionsI9n.feature new file mode 100644 index 00000000000..4e811581228 --- /dev/null +++ b/qa/integration/src/test/resources/features/jobEngine/JobEngineServiceKeystoreStepDefinitionsI9n.feature @@ -0,0 +1,180 @@ +############################################################################### +# Copyright (c) 2021 Eurotech and/or its affiliates and others +# +# This program and the accompanying materials are made +# available under the terms of the Eclipse Public License 2.0 +# which is available at https://www.eclipse.org/legal/epl-2.0/ +# +# SPDX-License-Identifier: EPL-2.0 +# +# Contributors: +# Eurotech - initial API and implementation +############################################################################### +@deviceManagementKeystore +@integration +@jobEngineStepDefinitions + +Feature: Job Engine Service - Keystore Step Definitions + + # + # Setup + # + + Scenario: Set environment variables + Given System property "broker.ip" with value "localhost" + And System property "commons.db.connection.host" with value "localhost" + + Scenario: Start event broker for all scenarios + Given Start Event Broker + + Scenario: Start broker for all scenarios + Given Start Broker + + # + # Tests + # + + Scenario: Running a Job with Keystore Certificate Create Step Definition + + Given I start the Kura Mock + When Device is connected + And I wait 1 second + Then Device status is "CONNECTED" + And I login as user with name "kapua-sys" and password "kapua-password" + And I select account "kapua-sys" + And I get the KuraMock device + When I search for events from device "rpione3" in account "kapua-sys" + Then I find 1 device event + And The type of the last event is "BIRTH" + Given I create a job with the name "TestJob - Keystore Steps" + And I create a new job target item + And Search for step definition with the name "Keystore Certificate Create" + And A regular step creator with the name "Keystore Certificate Create" and the following properties + | name | type | value | + | keystoreId | java.lang.String | SSLKeystore | + | alias | java.lang.String | qaCertificate | + | certificate | java.lang.String | -----BEGIN CERTIFICATE-----\nMIIFVzCCBD+gAwIBAgISA38CzQctm3+HkSyZPnDL8TFsMA0GCSqGSIb3DQEBCwUA\nMEoxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1MZXQncyBFbmNyeXB0MSMwIQYDVQQD\nExpMZXQncyBFbmNyeXB0IEF1dGhvcml0eSBYMzAeFw0xOTA3MTkxMDIxMTdaFw0x\nOTEwMTcxMDIxMTdaMBsxGTAXBgNVBAMTEG1xdHQuZWNsaXBzZS5vcmcwggEiMA0G\nCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDQnt6ZBEZ/vDG0JLqVB45lO6xlLazt\nYpEqZlGBket6PtjUGLdE2XivTpjtUkERS1cvPBqT1DH/yEZ1CU7iT/gfZtZotR0c\nqEMogSGkmrN1sAV6Eb+xGT3sPm1WFeKZqKdzAScdULoweUgwbNXa9kAB1uaSYBTe\ncq2ynfxBKWL/7bVtoeXUOyyaiIxVPTYz5XgpjSUB+9ML/v/+084XhIKA/avGPOSi\nRHOB+BsqTGyGhDgAHF+CDrRt8U1preS9AKXUvZ0aQL+djV8Y5nXPQPR8c2wplMwL\n5W/YMrM/dBm64vclKQLVPyEPqMOLMqcf+LkfQi6WOH+JByJfywAlme6jAgMBAAGj\nggJkMIICYDAOBgNVHQ8BAf8EBAMCBaAwHQYDVR0lBBYwFAYIKwYBBQUHAwEGCCsG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hEVOZ4JYPb3xVXkzIjSWmnDVbwC9MFtRaER9MhugKmiAp8SRLbylD0GKOhSB\n2BDf6JrzhIddKxQ75KgMZE6FQaC3Bz1DFyrj\n-----END CERTIFICATE----- | + | timeout | java.lang.Long | 10000 | + When I create a new step entity from the existing creator + Then No exception was thrown + And I start a job + And I wait 10 seconds + And I confirm job target has step index 0 and status "PROCESS_OK" + And I query for the job with the name "TestJob - Keystore Steps" and I find it + And I query for the execution items for the current job and I count 1 + And I confirm the executed job is finished + And I search for events from device "rpione3" in account "kapua-sys" + Then I find 2 device events + And KuraMock is disconnected + And I logout + + Scenario: Running a Job with Keystore Keypair Create Step Definition + + Given I start the Kura Mock + When Device is connected + And I wait 1 second + Then Device status is "CONNECTED" + And I login as user with name "kapua-sys" and password "kapua-password" + And I select account "kapua-sys" + And I get the KuraMock device + When I search for events from device "rpione3" in account "kapua-sys" + Then I find 1 device event + And The type of the last event is "BIRTH" + Given I create a job with the name "TestJob - Keystore Steps" + And I create a new job target item + And Search for step definition with the name "Keystore Keypair Create" + And A regular step creator with the name "Keystore Keypair Create" and the following properties + | name | type | value | + | keystoreId | java.lang.String | SSLKeystore | + | alias | java.lang.String | qaKeypair | + | size | java.lang.Integer | 4096 | + | algorithm | java.lang.String | RSA | + | signatureAlgorithm | java.lang.String | SHA256withRSA | + | attributes | java.lang.String | CN=Let's Encrypt Authority X3,O=Let's Encrypt,C=US | + | timeout | java.lang.Long | 10000 | + When I create a new step entity from the existing creator + Then No exception was thrown + And I start a job + And I wait 10 seconds + And I confirm job target has step index 0 and status "PROCESS_OK" + And I query for the job with the name "TestJob - Keystore Steps" and I find it + And I query for the execution items for the current job and I count 1 + And I confirm the executed job is finished + And I search for events from device "rpione3" in account "kapua-sys" + Then I find 2 device events + And KuraMock is disconnected + And I logout + + Scenario: Running a Job with Keystore Item Delete Step Definition + Multi-step job with a Keystore Certificate Install and Ketstore Keypair Create and then + the deletion of those two new added Keystore Items + + Given I start the Kura Mock + When Device is connected + And I wait 1 second + Then Device status is "CONNECTED" + And I login as user with name "kapua-sys" and password "kapua-password" + And I select account "kapua-sys" + And I get the KuraMock device + When I search for events from device "rpione3" in account "kapua-sys" + Then I find 1 device event + And The type of the last event is "BIRTH" + Given I create a job with the name "TestJob - Keystore Steps" + And I create a new job target item + And Search for step definition with the name "Keystore Certificate Create" + And A regular step creator with the name "Keystore Certificate Create" and the following properties + | name | type | value | + | keystoreId | java.lang.String | SSLKeystore | + | alias | java.lang.String | qaCertificate | + | certificate | java.lang.String | -----BEGIN CERTIFICATE-----\nMIIFVzCCBD+gAwIBAgISA38CzQctm3+HkSyZPnDL8TFsMA0GCSqGSIb3DQEBCwUA\nMEoxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1MZXQncyBFbmNyeXB0MSMwIQYDVQQD\nExpMZXQncyBFbmNyeXB0IEF1dGhvcml0eSBYMzAeFw0xOTA3MTkxMDIxMTdaFw0x\nOTEwMTcxMDIxMTdaMBsxGTAXBgNVBAMTEG1xdHQuZWNsaXBzZS5vcmcwggEiMA0G\nCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDQnt6ZBEZ/vDG0JLqVB45lO6xlLazt\nYpEqZlGBket6PtjUGLdE2XivTpjtUkERS1cvPBqT1DH/yEZ1CU7iT/gfZtZotR0c\nqEMogSGkmrN1sAV6Eb+xGT3sPm1WFeKZqKdzAScdULoweUgwbNXa9kAB1uaSYBTe\ncq2ynfxBKWL/7bVtoeXUOyyaiIxVPTYz5XgpjSUB+9ML/v/+084XhIKA/avGPOSi\nRHOB+BsqTGyGhDgAHF+CDrRt8U1preS9AKXUvZ0aQL+djV8Y5nXPQPR8c2wplMwL\n5W/YMrM/dBm64vclKQLVPyEPqMOLMqcf+LkfQi6WOH+JByJfywAlme6jAgMBAAGj\nggJkMIICYDAOBgNVHQ8BAf8EBAMCBaAwHQYDVR0lBBYwFAYIKwYBBQUHAwEGCCsG\nAQUFBwMCMAwGA1UdEwEB/wQCMAAwHQYDVR0OBBYEFH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8SRLbylD0GKOhSB\n2BDf6JrzhIddKxQ75KgMZE6FQaC3Bz1DFyrj\n-----END CERTIFICATE----- | + | timeout | java.lang.Long | 10000 | + When I create a new step entity from the existing creator + Then No exception was thrown + And Search for step definition with the name "Keystore Keypair Create" + And A regular step creator with the name "Keystore Keypair Create" and the following properties + | name | type | value | + | keystoreId | java.lang.String | SSLKeystore | + | alias | java.lang.String | qaKeypair | + | size | java.lang.Integer | 4096 | + | algorithm | java.lang.String | RSA | + | signatureAlgorithm | java.lang.String | SHA256withRSA | + | attributes | java.lang.String | CN=Let's Encrypt Authority X3,O=Let's Encrypt,C=US | + | timeout | java.lang.Long | 10000 | + When I create a new step entity from the existing creator + Then No exception was thrown + And Search for step definition with the name "Keystore Item Delete" + And A regular step creator with the name "Keystore Keypair Delete Keypair" and the following properties + | name | type | value | + | keystoreId | java.lang.String | SSLKeystore | + | alias | java.lang.String | qaKeypair | + | timeout | java.lang.Long | 10000 | + When I create a new step entity from the existing creator + Then No exception was thrown + And Search for step definition with the name "Keystore Item Delete" + And A regular step creator with the name "Keystore Keypair Delete Certificate" and the following properties + | name | type | value | + | keystoreId | java.lang.String | SSLKeystore | + | alias | java.lang.String | qaCertificate | + | timeout | java.lang.Long | 10000 | + When I create a new step entity from the existing creator + Then No exception was thrown + And I start a job + And I wait 10 seconds + And I confirm job target has step index 3 and status "PROCESS_OK" + And I query for the job with the name "TestJob - Keystore Steps" and I find it + And I query for the execution items for the current job and I count 1 + And I confirm the executed job is finished + And I search for events from device "rpione3" in account "kapua-sys" + Then I find 5 device events + And KuraMock is disconnected + And I logout + + # + # Teardown + # + + Scenario: Stop broker after all scenarios + Given Stop Broker + + Scenario: Stop event broker for all scenarios + Given Stop Event Broker diff --git a/service/job/test-steps/src/main/java/org/eclipse/kapua/service/job/steps/JobServiceSteps.java b/service/job/test-steps/src/main/java/org/eclipse/kapua/service/job/steps/JobServiceSteps.java index 27f7f594f8a..2cbba0aeae7 100644 --- a/service/job/test-steps/src/main/java/org/eclipse/kapua/service/job/steps/JobServiceSteps.java +++ b/service/job/test-steps/src/main/java/org/eclipse/kapua/service/job/steps/JobServiceSteps.java @@ -1854,13 +1854,13 @@ public void iCountTheTargetsInTheCurrentScopeAndICount(Long targetNum) throws Ex public void iConfirmJobTargetHasStatus(int stepIndex, String jobStatus) throws Exception { try { - startOrRestartJob(100, 2, stepIndex, jobStatus); + iConfirmJobTargetHasStatus(100, 2, stepIndex, jobStatus); } catch (InterruptedException ex) { ex.printStackTrace(); } } - public void startOrRestartJob(int secondsToWait, int secondsToTry, int stepIndex, String jobTargetStatus) throws InterruptedException, KapuaException { + public void iConfirmJobTargetHasStatus(int secondsToWait, int secondsToTry, int stepIndex, String jobTargetStatus) throws InterruptedException, KapuaException { JobTarget jobTarget = (JobTarget) stepData.get(JOB_TARGET); long endWaitTime = System.currentTimeMillis() + secondsToWait * 1000; while (System.currentTimeMillis() < endWaitTime) { @@ -1887,7 +1887,7 @@ public void iPrepareAJobWithNameAndDescription(String name, String description) @When("^I try to create job with permitted symbols \"([^\"]*)\" in name$") public void iTryToCreateJobWithPermittedSymbolsInName(String validCharacters) throws Throwable { JobCreator jobCreator = jobFactory.newCreator(getCurrentScopeId()); - for (int i = 0; i < validCharacters.length(); i++){ + for (int i = 0; i < validCharacters.length(); i++) { String jobName = JOB_NAME + validCharacters.charAt(i); jobCreator.setName(jobName); try { @@ -1895,7 +1895,7 @@ public void iTryToCreateJobWithPermittedSymbolsInName(String validCharacters) th Job job = jobService.create(jobCreator); stepData.put("Job", job); stepData.put(CURRENT_JOB_ID, job.getId()); - } catch (KapuaException ex){ + } catch (KapuaException ex) { verifyException(ex); } } @@ -1903,7 +1903,7 @@ public void iTryToCreateJobWithPermittedSymbolsInName(String validCharacters) th @When("^I try to create job with invalid symbols \"([^\"]*)\" in name$") public void iTryToCreateJobWithInvalidSymbolsInName(String invalidCharacters) throws Throwable { - JobCreator jobCreator = jobFactory.newCreator(getCurrentScopeId()); + JobCreator jobCreator = jobFactory.newCreator(getCurrentScopeId()); for (int i = 0; i < invalidCharacters.length(); i++) { String jobName = JOB_NAME + invalidCharacters.charAt(i); jobCreator.setName(jobName); @@ -1927,7 +1927,7 @@ public void iFindAJobWithDescription(String jobDescription) throws Throwable { @Then("^I try to update job name with permitted symbols \"([^\"]*)\" in name$") public void iTryToUpdateJobNameWithPermittedSymbolsInName(String validCharacters) throws Throwable { JobCreator jobCreator = jobFactory.newCreator(getCurrentScopeId()); - for (int i = 0; i < validCharacters.length(); i++){ + for (int i = 0; i < validCharacters.length(); i++) { String jobName = JOB_NAME + validCharacters.charAt(i); jobCreator.setName(JOB_NAME + i); @@ -1939,7 +1939,7 @@ public void iTryToUpdateJobNameWithPermittedSymbolsInName(String validCharacters jobService.update(job); stepData.put(CURRENT_JOB_ID, job.getId()); stepData.put("Job", job); - } catch (KapuaException ex){ + } catch (KapuaException ex) { verifyException(ex); } } @@ -1948,7 +1948,7 @@ public void iTryToUpdateJobNameWithPermittedSymbolsInName(String validCharacters @When("^I try to update job name with invalid symbols \"([^\"]*)\" in name$") public void iTryToUpdateJobNameWithInvalidSymbolsInName(String invalidCharacters) throws Throwable { JobCreator jobCreator = jobFactory.newCreator(getCurrentScopeId()); - for (int i = 0; i < invalidCharacters.length(); i++){ + for (int i = 0; i < invalidCharacters.length(); i++) { String jobName = JOB_NAME + invalidCharacters.charAt(i); jobCreator.setName(JOB_NAME + i); @@ -1960,7 +1960,7 @@ public void iTryToUpdateJobNameWithInvalidSymbolsInName(String invalidCharacters jobService.update(job); stepData.put(CURRENT_JOB_ID, job.getId()); stepData.put("Job", job); - } catch (KapuaException ex){ + } catch (KapuaException ex) { verifyException(ex); } } @@ -1968,17 +1968,17 @@ public void iTryToUpdateJobNameWithInvalidSymbolsInName(String invalidCharacters @Then("^I change name of job from \"([^\"]*)\" to \"([^\"]*)\"$") public void iChangeNameOfJobFromTo(String oldName, String newName) throws Throwable { - try { - JobQuery query = jobFactory.newQuery(getCurrentScopeId()); - query.setPredicate(query.attributePredicate(JobAttributes.NAME, oldName, Operator.EQUAL)); - JobListResult queryResult = jobService.query(query); - Job job = queryResult.getFirstItem(); - job.setName(newName); - jobService.update(job); - stepData.put("Job", job); - } catch (Exception e){ - verifyException(e); - } + try { + JobQuery query = jobFactory.newQuery(getCurrentScopeId()); + query.setPredicate(query.attributePredicate(JobAttributes.NAME, oldName, Operator.EQUAL)); + JobListResult queryResult = jobService.query(query); + Job job = queryResult.getFirstItem(); + job.setName(newName); + jobService.update(job); + stepData.put("Job", job); + } catch (Exception e) { + verifyException(e); + } } @And("^There is no job with name \"([^\"]*)\" in database$") @@ -1997,7 +1997,7 @@ public void iChangeTheJobDescriptionFromTo(String oldDescription, String newDesc job.setDescription(newDescription); jobService.update(job); stepData.put("Job", job); - } catch (Exception e){ + } catch (Exception e) { verifyException(e); } }