From 4212600ffa7373a8bb6a89cc43a5be22b18b9ced Mon Sep 17 00:00:00 2001 From: Alberto Codutti Date: Fri, 20 Dec 2024 16:09:39 +0100 Subject: [PATCH 1/9] :recycle: [Test] Added new set of test cases to test JobEngine Device Management Keystore Target Processors Signed-off-by: Alberto Codutti --- .github/workflows/kapua-ci.yaml | 2 +- ...t.java => RunJobEngineServiceI9nTest.java} | 9 +- ...ServiceKeystoreStepDefinitionsI9nTest.java | 38 ----- ...eServiceKeystoreStepDefinitionsI9n.feature | 156 ------------------ .../JobEngineServiceOperations.feature | 27 ++- ...bEngineServiceProcessorKeystoreI9n.feature | 108 ++++++++++++ ...gineServiceRestartOfflineDeviceI9n.feature | 1 - ...ngineServiceRestartOnlineDeviceI9n.feature | 1 - ...ceRestartOnlineDeviceSecondPartI9n.feature | 1 - ...EngineServiceStartOfflineDeviceI9n.feature | 1 - ...bEngineServiceStartOnlineDeviceI9n.feature | 1 - ...obEngineServiceStopOnlineDeviceI9n.feature | 1 - 12 files changed, 127 insertions(+), 219 deletions(-) rename qa/integration/src/test/java/org/eclipse/kapua/integration/service/jobEngine/{RunJobEngineService9nTest.java => RunJobEngineServiceI9nTest.java} (77%) delete mode 100644 qa/integration/src/test/java/org/eclipse/kapua/integration/service/jobEngine/stepDefinitions/RunJobEngineServiceKeystoreStepDefinitionsI9nTest.java delete mode 100644 qa/integration/src/test/resources/features/jobEngine/JobEngineServiceKeystoreStepDefinitionsI9n.feature create mode 100644 qa/integration/src/test/resources/features/jobEngine/JobEngineServiceProcessorKeystoreI9n.feature diff --git a/.github/workflows/kapua-ci.yaml b/.github/workflows/kapua-ci.yaml index 7fb3b56c726..71619d91923 100755 --- a/.github/workflows/kapua-ci.yaml +++ b/.github/workflows/kapua-ci.yaml @@ -182,7 +182,7 @@ jobs: uses: actions/checkout@v4 - uses: ./.github/actions/runTestsTaggedAs with: - tag: '@jobEngineOperations' + tag: '@jobEngine' needs-docker-images: 'true' test-jobsIntegration: needs: build diff --git a/qa/integration/src/test/java/org/eclipse/kapua/integration/service/jobEngine/RunJobEngineService9nTest.java b/qa/integration/src/test/java/org/eclipse/kapua/integration/service/jobEngine/RunJobEngineServiceI9nTest.java similarity index 77% rename from qa/integration/src/test/java/org/eclipse/kapua/integration/service/jobEngine/RunJobEngineService9nTest.java rename to qa/integration/src/test/java/org/eclipse/kapua/integration/service/jobEngine/RunJobEngineServiceI9nTest.java index 4f277d8da84..8fa5eda1dfc 100644 --- a/qa/integration/src/test/java/org/eclipse/kapua/integration/service/jobEngine/RunJobEngineService9nTest.java +++ b/qa/integration/src/test/java/org/eclipse/kapua/integration/service/jobEngine/RunJobEngineServiceI9nTest.java @@ -19,7 +19,8 @@ @RunWith(Cucumber.class) @CucumberOptions( features = { - "classpath:features/jobEngine/JobEngineServiceOperations.feature", +// "classpath:features/jobEngine/JobEngineServiceOperations.feature", + "classpath:features/jobEngine/JobEngineServiceProcessorKeystoreI9n.feature", }, glue = { "org.eclipse.kapua.service.job.steps", @@ -31,9 +32,9 @@ }, plugin = { "pretty", - "html:target/cucumber/JobEngineServiceOfflineDeviceI9n", - "json:target/JobEngineServiceOfflineDeviceI9n_cucumber.json" + "html:target/cucumber/RunJobEngineServiceI9n", + "json:target/RunJobEngineServiceI9n_cucumber.json" }, monochrome = true) -public class RunJobEngineService9nTest { +public class RunJobEngineServiceI9nTest { } 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 deleted file mode 100644 index 86b85ee8fcf..00000000000 --- a/qa/integration/src/test/java/org/eclipse/kapua/integration/service/jobEngine/stepDefinitions/RunJobEngineServiceKeystoreStepDefinitionsI9nTest.java +++ /dev/null @@ -1,38 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2021, 2022 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 org.junit.runner.RunWith; - -import io.cucumber.junit.Cucumber; -import io.cucumber.junit.CucumberOptions; - -@RunWith(Cucumber.class) -@CucumberOptions( - features = { - "classpath:features/jobEngine/JobEngineServiceKeystoreStepDefinitionsI9n.feature" - }, - glue = { - "org.eclipse.kapua.qa.common", - "org.eclipse.kapua.qa.integration.steps", - "org.eclipse.kapua.service.job.steps", - "org.eclipse.kapua.service.user.steps", - "org.eclipse.kapua.service.account.steps", - "org.eclipse.kapua.service.device.registry.steps", - }, - plugin = {"pretty", - "html:target/cucumber/JobEngineServiceKeystoreStepDefinitionsI9n", - "json:target/JobEngineServiceKeystoreStepDefinitionsI9n_cucumber.json"}, - monochrome = true) -public class RunJobEngineServiceKeystoreStepDefinitionsI9nTest { -} diff --git a/qa/integration/src/test/resources/features/jobEngine/JobEngineServiceKeystoreStepDefinitionsI9n.feature b/qa/integration/src/test/resources/features/jobEngine/JobEngineServiceKeystoreStepDefinitionsI9n.feature deleted file mode 100644 index f276d267cba..00000000000 --- a/qa/integration/src/test/resources/features/jobEngine/JobEngineServiceKeystoreStepDefinitionsI9n.feature +++ /dev/null @@ -1,156 +0,0 @@ -############################################################################### -# Copyright (c) 2021, 2024 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 -############################################################################### -@env_docker -@it -@jobEngine -@jobEngineStepDefinitions -@deviceManagementKeystore - -Feature: Job Engine Service - Keystore Step Definitions - - @setup - Scenario: Setup test resources - Given Init Security Context - And Start Docker environment with resources - | db | - | events-broker | - | job-engine | - | message-broker | - | broker-auth-service | - | consumer-lifecycle | - - # - # Tests - # - - Scenario: Running a Job with Keystore Certificate Create Step Definition - - Given I login as user with name "kapua-sys" and password "kapua-password" - And I start the Kura Mock - When Device is connected within 10 seconds - Then Device status is "CONNECTED" within 10 seconds - And I select account "kapua-sys" - And I get the KuraMock device after 5 seconds - When I search for events from device "rpione3" in account "kapua-sys" I find 1 event within 30 seconds - 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 I prepare a JobStepCreator 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/wQCMAAwHQYDVR0OBBYEFHc+PmokFlx8Fh/0Lob125ef\nfLNyMB8GA1UdIwQYMBaAFKhKamMEfd265tE5t6ZFZe/zqOyhMG8GCCsGAQUFBwEB\nBGMwYTAuBggrBgEFBQcwAYYiaHR0cDovL29jc3AuaW50LXgzLmxldHNlbmNyeXB0\nLm9yZzAvBggrBgEFBQcwAoYjaHR0cDovL2NlcnQuaW50LXgzLmxldHNlbmNyeXB0\nLm9yZy8wGwYDVR0RBBQwEoIQbXF0dC5lY2xpcHNlLm9yZzBMBgNVHSAERTBDMAgG\nBmeBDAECATA3BgsrBgEEAYLfEwEBATAoMCYGCCsGAQUFBwIBFhpodHRwOi8vY3Bz\nLmxldHNlbmNyeXB0Lm9yZzCCAQMGCisGAQQB1nkCBAIEgfQEgfEA7wB2AHR+2oMx\nrTMQkSGcziVPQnDCv/1eQiAIxjc1eeYQe8xWAAABbAn2/p8AAAQDAEcwRQIhAIBl\nIZC2ZCMDs7bkBQN79xNO84VFpe7bQcMeaqHsQH9jAiAYV5kdZBgl17M5RB44NQ+y\nY/WOF1PWOrNrP3XdeEo7HAB1ACk8UZZUyDlluqpQ/FgH1Ldvv1h6KXLcpMMM9OVF\nR/R4AAABbAn2/o4AAAQDAEYwRAIgNYxfY0bjRfjhXjjAgyPRSLKq4O5tWTd2W4mn\nCpE3aCYCIGeKPyuuo9tvHbyVKF4bsoN76FmnOkdsYE0MCKeKkUOkMA0GCSqGSIb3\nDQEBCwUAA4IBAQCB0ykl1N2U2BMhzFo6dwrECBSFO+ePV2UYGrb+nFunWE4MMKBb\ndyu7dj3cYRAFCM9A3y0H967IcY+h0u9FgZibmNs+y/959wcbr8F1kvgpVKDb1FGs\ncuEArADQd3X+4TMM+IeIlqbGVXv3mYPrsP78LmUXkS7ufhMXsD5GSbSc2Zp4/v0o\n3bsJz6qwzixhqg30tf6siOs9yrpHpPnDnbRrahbwnYTpm6JP0lK53GeFec4ckNi3\nzT5+hEVOZ4JYPb3xVXkzIjSWmnDVbwC9MFtRaER9MhugKmiAp8SRLbylD0GKOhSB\n2BDf6JrzhIddKxQ75KgMZE6FQaC3Bz1DFyrj\n-----END CERTIFICATE----- | - | timeout | java.lang.Long | 10000 | - When I create a new JobStep from the existing creator - Then No exception was thrown - And I start a job - And I confirm job target has step index 0 and status "PROCESS_OK" within 31 seconds - And I query for the job with the name "TestJob - Keystore Steps" and I count 1 execution item and I confirm the executed job is finished within 20 seconds - And I search for events from device "rpione3" in account "kapua-sys" I find 2 events within 30 seconds - And KuraMock is disconnected - And I logout - - Scenario: Running a Job with Keystore Keypair Create Step Definition - - Given I login as user with name "kapua-sys" and password "kapua-password" - And I start the Kura Mock - When Device is connected within 10 seconds - Then Device status is "CONNECTED" within 10 seconds - And I select account "kapua-sys" - And I get the KuraMock device after 5 seconds - When I search for events from device "rpione3" in account "kapua-sys" I find 1 event within 30 seconds - 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 I prepare a JobStepCreator 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 JobStep from the existing creator - Then No exception was thrown - And I start a job - And I confirm job target has step index 0 and status "PROCESS_OK" within 31 seconds - And I query for the job with the name "TestJob - Keystore Steps" and I count 1 execution item and I confirm the executed job is finished within 20 seconds - And I search for events from device "rpione3" in account "kapua-sys" I find 2 events within 30 seconds - 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 login as user with name "kapua-sys" and password "kapua-password" - And I start the Kura Mock - When Device is connected within 10 seconds - Then Device status is "CONNECTED" within 10 seconds - And I select account "kapua-sys" - And I get the KuraMock device after 5 seconds - When I search for events from device "rpione3" in account "kapua-sys" I find 1 event within 30 seconds - 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 I prepare a JobStepCreator 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/wQCMAAwHQYDVR0OBBYEFHc+PmokFlx8Fh/0Lob125ef\nfLNyMB8GA1UdIwQYMBaAFKhKamMEfd265tE5t6ZFZe/zqOyhMG8GCCsGAQUFBwEB\nBGMwYTAuBggrBgEFBQcwAYYiaHR0cDovL29jc3AuaW50LXgzLmxldHNlbmNyeXB0\nLm9yZzAvBggrBgEFBQcwAoYjaHR0cDovL2NlcnQuaW50LXgzLmxldHNlbmNyeXB0\nLm9yZy8wGwYDVR0RBBQwEoIQbXF0dC5lY2xpcHNlLm9yZzBMBgNVHSAERTBDMAgG\nBmeBDAECATA3BgsrBgEEAYLfEwEBATAoMCYGCCsGAQUFBwIBFhpodHRwOi8vY3Bz\nLmxldHNlbmNyeXB0Lm9yZzCCAQMGCisGAQQB1nkCBAIEgfQEgfEA7wB2AHR+2oMx\nrTMQkSGcziVPQnDCv/1eQiAIxjc1eeYQe8xWAAABbAn2/p8AAAQDAEcwRQIhAIBl\nIZC2ZCMDs7bkBQN79xNO84VFpe7bQcMeaqHsQH9jAiAYV5kdZBgl17M5RB44NQ+y\nY/WOF1PWOrNrP3XdeEo7HAB1ACk8UZZUyDlluqpQ/FgH1Ldvv1h6KXLcpMMM9OVF\nR/R4AAABbAn2/o4AAAQDAEYwRAIgNYxfY0bjRfjhXjjAgyPRSLKq4O5tWTd2W4mn\nCpE3aCYCIGeKPyuuo9tvHbyVKF4bsoN76FmnOkdsYE0MCKeKkUOkMA0GCSqGSIb3\nDQEBCwUAA4IBAQCB0ykl1N2U2BMhzFo6dwrECBSFO+ePV2UYGrb+nFunWE4MMKBb\ndyu7dj3cYRAFCM9A3y0H967IcY+h0u9FgZibmNs+y/959wcbr8F1kvgpVKDb1FGs\ncuEArADQd3X+4TMM+IeIlqbGVXv3mYPrsP78LmUXkS7ufhMXsD5GSbSc2Zp4/v0o\n3bsJz6qwzixhqg30tf6siOs9yrpHpPnDnbRrahbwnYTpm6JP0lK53GeFec4ckNi3\nzT5+hEVOZ4JYPb3xVXkzIjSWmnDVbwC9MFtRaER9MhugKmiAp8SRLbylD0GKOhSB\n2BDf6JrzhIddKxQ75KgMZE6FQaC3Bz1DFyrj\n-----END CERTIFICATE----- | - | timeout | java.lang.Long | 10000 | - When I create a new JobStep from the existing creator - Then No exception was thrown - And Search for step definition with the name "Keystore Keypair Create" - And I prepare a JobStepCreator 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 JobStep from the existing creator - Then No exception was thrown - And Search for step definition with the name "Keystore Item Delete" - And I prepare a JobStepCreator 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 JobStep from the existing creator - Then No exception was thrown - And Search for step definition with the name "Keystore Item Delete" - And I prepare a JobStepCreator 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 JobStep from the existing creator - Then No exception was thrown - And I start a job - And I confirm job target has step index 3 and status "PROCESS_OK" within 31 seconds - And I query for the job with the name "TestJob - Keystore Steps" and I count 1 execution item and I confirm the executed job is finished within 20 seconds - And I search for events from device "rpione3" in account "kapua-sys" I find 5 events within 30 seconds - And KuraMock is disconnected - And I logout - - @teardown - Scenario: Tear down test resources - Given Stop Docker environment - And Clean Locator Instance \ No newline at end of file diff --git a/qa/integration/src/test/resources/features/jobEngine/JobEngineServiceOperations.feature b/qa/integration/src/test/resources/features/jobEngine/JobEngineServiceOperations.feature index a896428cadf..4b35a73a19b 100644 --- a/qa/integration/src/test/resources/features/jobEngine/JobEngineServiceOperations.feature +++ b/qa/integration/src/test/resources/features/jobEngine/JobEngineServiceOperations.feature @@ -15,9 +15,8 @@ @jobEngine @jobEngineOperations -Feature: JobEngineService stop job tests with online device - Job Engine Service test scenarios for stopping job. This feature file contains scenarios for stopping job with one target and one step, - one target and multiple steps, multiple targets and one step and multiple targets and multiple steps. +Feature: Job Engine Service - Operations + Job Engine Service tests for basic operations @setup Scenario: Setup test resources @@ -30,7 +29,7 @@ Feature: JobEngineService stop job tests with online device | broker-auth-service | | consumer-lifecycle | - Scenario: Start a Job - Without JobTarget + Scenario: Start - Without JobTarget Given I login as user with name "kapua-sys" and password "kapua-password" And I create a job with the name "Test Job - Empty Targets" @@ -38,7 +37,7 @@ Feature: JobEngineService stop job tests with online device And I start a job And An exception was thrown - Scenario: Start a Job - Without JobStep + Scenario: Start - Without JobStep Given I login as user with name "kapua-sys" and password "kapua-password" And I create a device with name "Test Target" @@ -49,7 +48,7 @@ Feature: JobEngineService stop job tests with online device And I start a job And An exception was thrown - Scenario: Start a Job - JobTarget ok + Scenario: Start - JobTarget ok Given I login as user with name "kapua-sys" and password "kapua-password" And I start the Kura Mock @@ -69,7 +68,7 @@ Feature: JobEngineService stop job tests with online device Then I confirm that job has 1 job execution And I confirm that job target in job has step index 0 and status "PROCESS_OK" - Scenario: Start a Job - JobTarget failed + Scenario: Start - JobTarget failed Given I login as user with name "kapua-sys" and password "kapua-password" And I create a device with name "Test Target" @@ -87,7 +86,7 @@ Feature: JobEngineService stop job tests with online device Then I confirm that job has 1 job execution And I confirm that job target in job has step index 0 and status "PROCESS_FAILED" - Scenario: Start a Job - JobTarget ok then ok + Scenario: Start - JobTarget ok then ok Given I login as user with name "kapua-sys" and password "kapua-password" And I start the Kura Mock @@ -111,7 +110,7 @@ Feature: JobEngineService stop job tests with online device Then I confirm that job has 2 job execution And I confirm that job target in job has step index 0 and status "PROCESS_OK" - Scenario: Start a Job - JobTarget failed then ok + Scenario: Start - JobTarget failed then ok Given I login as user with name "kapua-sys" and password "kapua-password" And I create a device with name "rpione3" @@ -136,7 +135,7 @@ Feature: JobEngineService stop job tests with online device Then I confirm that job has 2 job execution And I confirm that job target in job has step index 0 and status "PROCESS_OK" - Scenario: Start a Job - Two JobSteps + Scenario: Start - Two JobSteps Given I login as user with name "kapua-sys" and password "kapua-password" And I start the Kura Mock @@ -162,7 +161,7 @@ Feature: JobEngineService stop job tests with online device Then I confirm that job has 1 job execution And I confirm that job target in job has step index 1 and status "PROCESS_OK" - Scenario: Check a Job - Running status + Scenario: Is Running - Check running status Given I login as user with name "kapua-sys" and password "kapua-password" And I start the Kura Mock @@ -186,7 +185,7 @@ Feature: JobEngineService stop job tests with online device Then I confirm that job has 1 job execution And I confirm that job target in job has step index 0 and status "PROCESS_OK" - Scenario: Stop a Job - Not running, never run + Scenario: Stop - Not running, never run Given I login as user with name "kapua-sys" and password "kapua-password" And I create a device with name "Test Target" And I create a job with the name "TestJob" @@ -202,7 +201,7 @@ Feature: JobEngineService stop job tests with online device And I stop the job And An exception was thrown - Scenario: Stop a Job - Not running, but was + Scenario: Stop - Not running, but was Given I login as user with name "kapua-sys" and password "kapua-password" And I start the Kura Mock @@ -223,7 +222,7 @@ Feature: JobEngineService stop job tests with online device And I stop the job And An exception was thrown - Scenario: Stop a Job - Running + Scenario: Stop - Running Given I login as user with name "kapua-sys" and password "kapua-password" And I start the Kura Mock And Device birth message is sent diff --git a/qa/integration/src/test/resources/features/jobEngine/JobEngineServiceProcessorKeystoreI9n.feature b/qa/integration/src/test/resources/features/jobEngine/JobEngineServiceProcessorKeystoreI9n.feature new file mode 100644 index 00000000000..0cc4d37aa12 --- /dev/null +++ b/qa/integration/src/test/resources/features/jobEngine/JobEngineServiceProcessorKeystoreI9n.feature @@ -0,0 +1,108 @@ +############################################################################### +# Copyright (c) 2024, 2024 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 +############################################################################### +@env_docker +@it +@jobEngine +@jobEngineTargetProcessors + +Feature: Job Engine Service - Keystore Step Processors + Tests for Device Management Keystore Processor + + @setup + Scenario: Setup test resources + Given Init Security Context + And Start Docker environment with resources + | db | + | events-broker | + | job-engine | + | message-broker | + | broker-auth-service | + | consumer-lifecycle | + + Scenario: Keystore Certificate Create + + Given I login as user with name "kapua-sys" and password "kapua-password" + And I start the Kura Mock + And Device birth message is sent + And Device "rpione3" is connected within 10s + And I create a job with the name "TestJob" + And I add device targets to job + | rpione3 | + And I search for step definition with the name + | Keystore Certificate Create | + And I add job step to job with name "Test Step - Keystore Certificate Create" and with selected job step definition and 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/wQCMAAwHQYDVR0OBBYEFHc+PmokFlx8Fh/0Lob125ef\nfLNyMB8GA1UdIwQYMBaAFKhKamMEfd265tE5t6ZFZe/zqOyhMG8GCCsGAQUFBwEB\nBGMwYTAuBggrBgEFBQcwAYYiaHR0cDovL29jc3AuaW50LXgzLmxldHNlbmNyeXB0\nLm9yZzAvBggrBgEFBQcwAoYjaHR0cDovL2NlcnQuaW50LXgzLmxldHNlbmNyeXB0\nLm9yZy8wGwYDVR0RBBQwEoIQbXF0dC5lY2xpcHNlLm9yZzBMBgNVHSAERTBDMAgG\nBmeBDAECATA3BgsrBgEEAYLfEwEBATAoMCYGCCsGAQUFBwIBFhpodHRwOi8vY3Bz\nLmxldHNlbmNyeXB0Lm9yZzCCAQMGCisGAQQB1nkCBAIEgfQEgfEA7wB2AHR+2oMx\nrTMQkSGcziVPQnDCv/1eQiAIxjc1eeYQe8xWAAABbAn2/p8AAAQDAEcwRQIhAIBl\nIZC2ZCMDs7bkBQN79xNO84VFpe7bQcMeaqHsQH9jAiAYV5kdZBgl17M5RB44NQ+y\nY/WOF1PWOrNrP3XdeEo7HAB1ACk8UZZUyDlluqpQ/FgH1Ldvv1h6KXLcpMMM9OVF\nR/R4AAABbAn2/o4AAAQDAEYwRAIgNYxfY0bjRfjhXjjAgyPRSLKq4O5tWTd2W4mn\nCpE3aCYCIGeKPyuuo9tvHbyVKF4bsoN76FmnOkdsYE0MCKeKkUOkMA0GCSqGSIb3\nDQEBCwUAA4IBAQCB0ykl1N2U2BMhzFo6dwrECBSFO+ePV2UYGrb+nFunWE4MMKBb\ndyu7dj3cYRAFCM9A3y0H967IcY+h0u9FgZibmNs+y/959wcbr8F1kvgpVKDb1FGs\ncuEArADQd3X+4TMM+IeIlqbGVXv3mYPrsP78LmUXkS7ufhMXsD5GSbSc2Zp4/v0o\n3bsJz6qwzixhqg30tf6siOs9yrpHpPnDnbRrahbwnYTpm6JP0lK53GeFec4ckNi3\nzT5+hEVOZ4JYPb3xVXkzIjSWmnDVbwC9MFtRaER9MhugKmiAp8SRLbylD0GKOhSB\n2BDf6JrzhIddKxQ75KgMZE6FQaC3Bz1DFyrj\n-----END CERTIFICATE----- | + | timeout | java.lang.Long | 5000 | + When I start a job + And I wait job to finish its execution up to 10s + Then I confirm that job has 1 job execution + And I confirm that job target in job has step index 0 and status "PROCESS_OK" + # TODO: check that Item has been installed when KuraMock gets refactored + + Scenario: Keystore Keypair Create Processor + + Given I login as user with name "kapua-sys" and password "kapua-password" + And I start the Kura Mock + And Device birth message is sent + And Device "rpione3" is connected within 10s + And I create a job with the name "TestJob" + And I add device targets to job + | rpione3 | + And I search for step definition with the name + | Keystore Keypair Create | + And I add job step to job with name "Test Step - Keystore Keypair Create" and with selected job step definition and 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 start a job + And I wait job to finish its execution up to 10s + Then I confirm that job has 1 job execution + And I confirm that job target in job has step index 0 and status "PROCESS_OK" + # TODO: check that Item has been installed when KuraMock gets refactored + + Scenario: Keystore Item Delete Processor + + Given I login as user with name "kapua-sys" and password "kapua-password" + And I start the Kura Mock + And Device birth message is sent + And Device "rpione3" is connected within 10s + And I create a job with the name "TestJob" + And I add device targets to job + | rpione3 | + And I search for step definition with the name + | Keystore Item Delete | + And I add job step to job with name "Test Step - Keystore Item Delete" and with selected job step definition and properties + | name | type | value | + | keystoreId | java.lang.String | SSLKeystore | + | alias | java.lang.String | qaCertificate | + | timeout | java.lang.Long | 10000 | + When I start a job + And I wait job to finish its execution up to 10s + Then I confirm that job has 1 job execution + And I confirm that job target in job has step index 0 and status "PROCESS_OK" + # TODO: check that Item has been installed when KuraMock gets refactored + + @teardown + Scenario: Tear down test resources + Given I logout + And KuraMock is disconnected + And Stop Docker environment + And Clean Locator Instance \ No newline at end of file diff --git a/qa/integration/src/test/resources/features/jobEngine/JobEngineServiceRestartOfflineDeviceI9n.feature b/qa/integration/src/test/resources/features/jobEngine/JobEngineServiceRestartOfflineDeviceI9n.feature index 91343912621..86abf46646d 100644 --- a/qa/integration/src/test/resources/features/jobEngine/JobEngineServiceRestartOfflineDeviceI9n.feature +++ b/qa/integration/src/test/resources/features/jobEngine/JobEngineServiceRestartOfflineDeviceI9n.feature @@ -12,7 +12,6 @@ ############################################################################### @env_docker @it -@jobEngine @jobEngineRestartOfflineDevice Feature: JobEngineService tests for restarting job with offline device diff --git a/qa/integration/src/test/resources/features/jobEngine/JobEngineServiceRestartOnlineDeviceI9n.feature b/qa/integration/src/test/resources/features/jobEngine/JobEngineServiceRestartOnlineDeviceI9n.feature index 4c238143fb0..b7143da3e38 100644 --- a/qa/integration/src/test/resources/features/jobEngine/JobEngineServiceRestartOnlineDeviceI9n.feature +++ b/qa/integration/src/test/resources/features/jobEngine/JobEngineServiceRestartOnlineDeviceI9n.feature @@ -12,7 +12,6 @@ ############################################################################### @env_docker @it -@jobEngine @jobEngineRestartOnlineDevice Feature: JobEngineService restart job tests with online device diff --git a/qa/integration/src/test/resources/features/jobEngine/JobEngineServiceRestartOnlineDeviceSecondPartI9n.feature b/qa/integration/src/test/resources/features/jobEngine/JobEngineServiceRestartOnlineDeviceSecondPartI9n.feature index bd517a6c55a..091abf4b764 100644 --- a/qa/integration/src/test/resources/features/jobEngine/JobEngineServiceRestartOnlineDeviceSecondPartI9n.feature +++ b/qa/integration/src/test/resources/features/jobEngine/JobEngineServiceRestartOnlineDeviceSecondPartI9n.feature @@ -12,7 +12,6 @@ ############################################################################### @env_docker @it -@jobEngine @jobEngineRestartOnlineDeviceSecondPart Feature: JobEngineService restart job tests with online device - second part diff --git a/qa/integration/src/test/resources/features/jobEngine/JobEngineServiceStartOfflineDeviceI9n.feature b/qa/integration/src/test/resources/features/jobEngine/JobEngineServiceStartOfflineDeviceI9n.feature index 228678f872d..f034ae8f659 100644 --- a/qa/integration/src/test/resources/features/jobEngine/JobEngineServiceStartOfflineDeviceI9n.feature +++ b/qa/integration/src/test/resources/features/jobEngine/JobEngineServiceStartOfflineDeviceI9n.feature @@ -12,7 +12,6 @@ ############################################################################### @env_docker @it -@jobEngine @jobEngineStartOfflineDevice Feature: JobEngineService tests for starting job with offline device diff --git a/qa/integration/src/test/resources/features/jobEngine/JobEngineServiceStartOnlineDeviceI9n.feature b/qa/integration/src/test/resources/features/jobEngine/JobEngineServiceStartOnlineDeviceI9n.feature index fc70d79fc55..6dec95a2886 100644 --- a/qa/integration/src/test/resources/features/jobEngine/JobEngineServiceStartOnlineDeviceI9n.feature +++ b/qa/integration/src/test/resources/features/jobEngine/JobEngineServiceStartOnlineDeviceI9n.feature @@ -12,7 +12,6 @@ ############################################################################### @env_docker @it -@jobEngine @jobEngineStartOnlineDevice Feature: JobEngineService start job tests with online device diff --git a/qa/integration/src/test/resources/features/jobEngine/JobEngineServiceStopOnlineDeviceI9n.feature b/qa/integration/src/test/resources/features/jobEngine/JobEngineServiceStopOnlineDeviceI9n.feature index a142ee947dc..bd4438cacf9 100644 --- a/qa/integration/src/test/resources/features/jobEngine/JobEngineServiceStopOnlineDeviceI9n.feature +++ b/qa/integration/src/test/resources/features/jobEngine/JobEngineServiceStopOnlineDeviceI9n.feature @@ -12,7 +12,6 @@ ############################################################################### @env_docker @it -@jobEngine @jobEngineServiceStop Feature: JobEngineService stop job tests with online device From f34aeb55d32d23c0f4a380d9d6d3ee979c4241eb Mon Sep 17 00:00:00 2001 From: Alberto Codutti Date: Fri, 20 Dec 2024 16:17:04 +0100 Subject: [PATCH 2/9] :recycle: [Test] Added new set of test cases to test JobEngine Device Management Asset Target Processors Signed-off-by: Alberto Codutti --- .../jobEngine/RunJobEngineServiceI9nTest.java | 3 +- .../JobEngineServiceProcessorAssetI9n.feature | 58 +++++++++++++++++++ ...bEngineServiceProcessorKeystoreI9n.feature | 6 +- 3 files changed, 63 insertions(+), 4 deletions(-) create mode 100644 qa/integration/src/test/resources/features/jobEngine/JobEngineServiceProcessorAssetI9n.feature diff --git a/qa/integration/src/test/java/org/eclipse/kapua/integration/service/jobEngine/RunJobEngineServiceI9nTest.java b/qa/integration/src/test/java/org/eclipse/kapua/integration/service/jobEngine/RunJobEngineServiceI9nTest.java index 8fa5eda1dfc..139f8aafb60 100644 --- a/qa/integration/src/test/java/org/eclipse/kapua/integration/service/jobEngine/RunJobEngineServiceI9nTest.java +++ b/qa/integration/src/test/java/org/eclipse/kapua/integration/service/jobEngine/RunJobEngineServiceI9nTest.java @@ -20,7 +20,8 @@ @CucumberOptions( features = { // "classpath:features/jobEngine/JobEngineServiceOperations.feature", - "classpath:features/jobEngine/JobEngineServiceProcessorKeystoreI9n.feature", +// "classpath:features/jobEngine/JobEngineServiceProcessorKeystoreI9n.feature", + "classpath:features/jobEngine/JobEngineServiceProcessorAssetI9n.feature", }, glue = { "org.eclipse.kapua.service.job.steps", diff --git a/qa/integration/src/test/resources/features/jobEngine/JobEngineServiceProcessorAssetI9n.feature b/qa/integration/src/test/resources/features/jobEngine/JobEngineServiceProcessorAssetI9n.feature new file mode 100644 index 00000000000..f584b4aa641 --- /dev/null +++ b/qa/integration/src/test/resources/features/jobEngine/JobEngineServiceProcessorAssetI9n.feature @@ -0,0 +1,58 @@ +############################################################################### +# Copyright (c) 2024, 2024 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 +############################################################################### +@env_docker +@it +@jobEngine +@jobEngineTargetProcessors + +Feature: Job Engine Service - Asset Step Processors + Tests for Device Management Asset Processor + + @setup + Scenario: Setup test resources + Given Init Security Context + And Start Docker environment with resources + | db | + | events-broker | + | job-engine | + | message-broker | + | broker-auth-service | + | consumer-lifecycle | + + Scenario: Asset Write + + Given I login as user with name "kapua-sys" and password "kapua-password" + And I start the Kura Mock + And Device birth message is sent + And Device "rpione3" is connected within 10s + And I create a job with the name "TestJob" + And I add device targets to job + | rpione3 | + And I search for step definition with the name + | Asset Write | + And I add job step to job with name "Test Step - Asset Write" and with selected job step definition and properties + | name | type | value | + | assets | org.eclipse.kapua.service.device.management.asset.DeviceAssets | assetNamebinaryEGVzdCBzdHJpbmcgdmFsdWU=binaryTest | + | timeout | java.lang.Long | 5000 | + When I start a job + And I wait job to finish its execution up to 10s + Then I confirm that job has 1 job execution + And I confirm that job target in job has step index 0 and status "PROCESS_OK" + # TODO: check that asset has been written when KuraMock gets refactored + + @teardown + Scenario: Tear down test resources + Given I logout + And KuraMock is disconnected + And Stop Docker environment + And Clean Locator Instance \ No newline at end of file diff --git a/qa/integration/src/test/resources/features/jobEngine/JobEngineServiceProcessorKeystoreI9n.feature b/qa/integration/src/test/resources/features/jobEngine/JobEngineServiceProcessorKeystoreI9n.feature index 0cc4d37aa12..a620ee29c6a 100644 --- a/qa/integration/src/test/resources/features/jobEngine/JobEngineServiceProcessorKeystoreI9n.feature +++ b/qa/integration/src/test/resources/features/jobEngine/JobEngineServiceProcessorKeystoreI9n.feature @@ -16,7 +16,7 @@ @jobEngineTargetProcessors Feature: Job Engine Service - Keystore Step Processors - Tests for Device Management Keystore Processor + Tests for Device Management Keystore Processor @setup Scenario: Setup test resources @@ -71,7 +71,7 @@ Feature: Job Engine Service - Keystore Step Processors | 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 | + | timeout | java.lang.Long | 5000 | When I start a job And I wait job to finish its execution up to 10s Then I confirm that job has 1 job execution @@ -93,7 +93,7 @@ Feature: Job Engine Service - Keystore Step Processors | name | type | value | | keystoreId | java.lang.String | SSLKeystore | | alias | java.lang.String | qaCertificate | - | timeout | java.lang.Long | 10000 | + | timeout | java.lang.Long | 5000 | When I start a job And I wait job to finish its execution up to 10s Then I confirm that job has 1 job execution From 120a65c335c9f938cdd7d3cb7a95c052557d9578 Mon Sep 17 00:00:00 2001 From: Alberto Codutti Date: Fri, 20 Dec 2024 16:24:44 +0100 Subject: [PATCH 3/9] :recycle: [Test] Added new set of test cases to test JobEngine Device Management Bundle Target Processors Signed-off-by: Alberto Codutti --- .../jobEngine/RunJobEngineServiceI9nTest.java | 3 +- ...JobEngineServiceProcessorBundleI9n.feature | 79 +++++++++++++++++++ ...bEngineServiceProcessorKeystoreI9n.feature | 6 +- 3 files changed, 84 insertions(+), 4 deletions(-) create mode 100644 qa/integration/src/test/resources/features/jobEngine/JobEngineServiceProcessorBundleI9n.feature diff --git a/qa/integration/src/test/java/org/eclipse/kapua/integration/service/jobEngine/RunJobEngineServiceI9nTest.java b/qa/integration/src/test/java/org/eclipse/kapua/integration/service/jobEngine/RunJobEngineServiceI9nTest.java index 139f8aafb60..962d7b602b7 100644 --- a/qa/integration/src/test/java/org/eclipse/kapua/integration/service/jobEngine/RunJobEngineServiceI9nTest.java +++ b/qa/integration/src/test/java/org/eclipse/kapua/integration/service/jobEngine/RunJobEngineServiceI9nTest.java @@ -21,7 +21,8 @@ features = { // "classpath:features/jobEngine/JobEngineServiceOperations.feature", // "classpath:features/jobEngine/JobEngineServiceProcessorKeystoreI9n.feature", - "classpath:features/jobEngine/JobEngineServiceProcessorAssetI9n.feature", +// "classpath:features/jobEngine/JobEngineServiceProcessorAssetI9n.feature", + "classpath:features/jobEngine/JobEngineServiceProcessorBundleI9n.feature", }, glue = { "org.eclipse.kapua.service.job.steps", diff --git a/qa/integration/src/test/resources/features/jobEngine/JobEngineServiceProcessorBundleI9n.feature b/qa/integration/src/test/resources/features/jobEngine/JobEngineServiceProcessorBundleI9n.feature new file mode 100644 index 00000000000..01ad0a8d509 --- /dev/null +++ b/qa/integration/src/test/resources/features/jobEngine/JobEngineServiceProcessorBundleI9n.feature @@ -0,0 +1,79 @@ +############################################################################### +# Copyright (c) 2024, 2024 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 +############################################################################### +@env_docker +@it +@jobEngine +@jobEngineTargetProcessors + +Feature: Job Engine Service - Bundle Step Processors + Tests for Device Management Bundle Processor + + @setup + Scenario: Setup test resources + Given Init Security Context + And Start Docker environment with resources + | db | + | events-broker | + | job-engine | + | message-broker | + | broker-auth-service | + | consumer-lifecycle | + + Scenario: Bundle Start + + Given I login as user with name "kapua-sys" and password "kapua-password" + And I start the Kura Mock + And Device birth message is sent + And Device "rpione3" is connected within 10s + And I create a job with the name "TestJob" + And I add device targets to job + | rpione3 | + And I search for step definition with the name + | Bundle Start | + And I add job step to job with name "Test Step - Bundle Start" and with selected job step definition and properties + | name | type | value | + | bundleId | java.lang.String | 34 | + | timeout | java.lang.Long | 5000 | + When I start a job + And I wait job to finish its execution up to 10s + Then I confirm that job has 1 job execution + And I confirm that job target in job has step index 0 and status "PROCESS_OK" + # TODO: check that bundle has been started when KuraMock gets refactored + + Scenario: Bundle Stop + + Given I login as user with name "kapua-sys" and password "kapua-password" + And I start the Kura Mock + And Device birth message is sent + And Device "rpione3" is connected within 10s + And I create a job with the name "TestJob" + And I add device targets to job + | rpione3 | + And I search for step definition with the name + | Bundle Stop | + And I add job step to job with name "Test Step - Bundle Stop" and with selected job step definition and properties + | name | type | value | + | bundleId | java.lang.String | 34 | + | timeout | java.lang.Long | 5000 | + When I start a job + And I wait job to finish its execution up to 10s + Then I confirm that job has 1 job execution + And I confirm that job target in job has step index 0 and status "PROCESS_OK" + # TODO: check that bundle has been stopped when KuraMock gets refactored + + @teardown + Scenario: Tear down test resources + Given I logout + And KuraMock is disconnected + And Stop Docker environment + And Clean Locator Instance \ No newline at end of file diff --git a/qa/integration/src/test/resources/features/jobEngine/JobEngineServiceProcessorKeystoreI9n.feature b/qa/integration/src/test/resources/features/jobEngine/JobEngineServiceProcessorKeystoreI9n.feature index a620ee29c6a..3dd38a74bfa 100644 --- a/qa/integration/src/test/resources/features/jobEngine/JobEngineServiceProcessorKeystoreI9n.feature +++ b/qa/integration/src/test/resources/features/jobEngine/JobEngineServiceProcessorKeystoreI9n.feature @@ -50,7 +50,7 @@ Feature: Job Engine Service - Keystore Step Processors And I wait job to finish its execution up to 10s Then I confirm that job has 1 job execution And I confirm that job target in job has step index 0 and status "PROCESS_OK" - # TODO: check that Item has been installed when KuraMock gets refactored + # TODO: check that certificate has been installed when KuraMock gets refactored Scenario: Keystore Keypair Create Processor @@ -76,7 +76,7 @@ Feature: Job Engine Service - Keystore Step Processors And I wait job to finish its execution up to 10s Then I confirm that job has 1 job execution And I confirm that job target in job has step index 0 and status "PROCESS_OK" - # TODO: check that Item has been installed when KuraMock gets refactored + # TODO: check that keypair has been created when KuraMock gets refactored Scenario: Keystore Item Delete Processor @@ -98,7 +98,7 @@ Feature: Job Engine Service - Keystore Step Processors And I wait job to finish its execution up to 10s Then I confirm that job has 1 job execution And I confirm that job target in job has step index 0 and status "PROCESS_OK" - # TODO: check that Item has been installed when KuraMock gets refactored + # TODO: check that item has been deleted when KuraMock gets refactored @teardown Scenario: Tear down test resources From addc26bc47b81b9bf429b7a460b64defbf7646f6 Mon Sep 17 00:00:00 2001 From: Alberto Codutti Date: Fri, 20 Dec 2024 16:32:08 +0100 Subject: [PATCH 4/9] :recycle: [Test] Added new set of test cases to test JobEngine Device Management Command Target Processors Signed-off-by: Alberto Codutti --- .../jobEngine/RunJobEngineServiceI9nTest.java | 3 +- ...obEngineServiceProcessorCommandI9n.feature | 79 +++++++++++++++++++ 2 files changed, 81 insertions(+), 1 deletion(-) create mode 100644 qa/integration/src/test/resources/features/jobEngine/JobEngineServiceProcessorCommandI9n.feature diff --git a/qa/integration/src/test/java/org/eclipse/kapua/integration/service/jobEngine/RunJobEngineServiceI9nTest.java b/qa/integration/src/test/java/org/eclipse/kapua/integration/service/jobEngine/RunJobEngineServiceI9nTest.java index 962d7b602b7..85210dfd101 100644 --- a/qa/integration/src/test/java/org/eclipse/kapua/integration/service/jobEngine/RunJobEngineServiceI9nTest.java +++ b/qa/integration/src/test/java/org/eclipse/kapua/integration/service/jobEngine/RunJobEngineServiceI9nTest.java @@ -22,7 +22,8 @@ // "classpath:features/jobEngine/JobEngineServiceOperations.feature", // "classpath:features/jobEngine/JobEngineServiceProcessorKeystoreI9n.feature", // "classpath:features/jobEngine/JobEngineServiceProcessorAssetI9n.feature", - "classpath:features/jobEngine/JobEngineServiceProcessorBundleI9n.feature", +// "classpath:features/jobEngine/JobEngineServiceProcessorBundleI9n.feature", + "classpath:features/jobEngine/JobEngineServiceProcessorCommandI9n.feature", }, glue = { "org.eclipse.kapua.service.job.steps", diff --git a/qa/integration/src/test/resources/features/jobEngine/JobEngineServiceProcessorCommandI9n.feature b/qa/integration/src/test/resources/features/jobEngine/JobEngineServiceProcessorCommandI9n.feature new file mode 100644 index 00000000000..df4a09d0b78 --- /dev/null +++ b/qa/integration/src/test/resources/features/jobEngine/JobEngineServiceProcessorCommandI9n.feature @@ -0,0 +1,79 @@ +############################################################################### +# Copyright (c) 2024, 2024 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 +############################################################################### +@env_docker +@it +@jobEngine +@jobEngineTargetProcessors + +Feature: Job Engine Service - Command Step Processors + Tests for Device Management Command Processor + + @setup + Scenario: Setup test resources + Given Init Security Context + And Start Docker environment with resources + | db | + | events-broker | + | job-engine | + | message-broker | + | broker-auth-service | + | consumer-lifecycle | + + Scenario: Command Exec - XML + + Given I login as user with name "kapua-sys" and password "kapua-password" + And I start the Kura Mock + And Device birth message is sent + And Device "rpione3" is connected within 10s + And I create a job with the name "TestJob" + And I add device targets to job + | rpione3 | + And I search for step definition with the name + | Command Execution | + And I add job step to job with name "Test Step - Command Exec - XML" and with selected job step definition and properties + | name | type | value | + | commandInput | org.eclipse.kapua.service.device.management.command.DeviceCommandInput | touchxml.test2500false | + | timeout | java.lang.Long | 5000 | + When I start a job + And I wait job to finish its execution up to 10s + Then I confirm that job has 1 job execution + And I confirm that job target in job has step index 0 and status "PROCESS_OK" + # TODO: check that command has been executed when KuraMock gets refactored + + Scenario: Command Exec - JSON + + Given I login as user with name "kapua-sys" and password "kapua-password" + And I start the Kura Mock + And Device birth message is sent + And Device "rpione3" is connected within 10s + And I create a job with the name "TestJob" + And I add device targets to job + | rpione3 | + And I search for step definition with the name + | Command Execution | + And I add job step to job with name "Test Step - Command Exec - JSON" and with selected job step definition and properties + | name | type | value | + | commandInput | org.eclipse.kapua.service.device.management.command.DeviceCommandInput | { "command" : "touch", "arguments" : { "argument" : ["json.test" ] }, "timeout" : "5000" } | + | timeout | java.lang.Long | 5000 | + When I start a job + And I wait job to finish its execution up to 10s + Then I confirm that job has 1 job execution + And I confirm that job target in job has step index 0 and status "PROCESS_OK" + # TODO: check that command has been executed when KuraMock gets refactored + +# @teardown +# Scenario: Tear down test resources +# Given I logout +# And KuraMock is disconnected +# And Stop Docker environment +# And Clean Locator Instance \ No newline at end of file From aa3e98dd250db73d59eaea3cdc145f98159b2ce1 Mon Sep 17 00:00:00 2001 From: Alberto Codutti Date: Fri, 20 Dec 2024 18:10:51 +0100 Subject: [PATCH 5/9] :recycle: [Test] Added new set of test cases to test JobEngine Device Management Configuration Target Processors Signed-off-by: Alberto Codutti --- .../jobEngine/RunJobEngineServiceI9nTest.java | 9 ++- ...obEngineServiceProcessorCommandI9n.feature | 12 +-- ...neServiceProcessorConfigurationI9n.feature | 79 +++++++++++++++++++ 3 files changed, 90 insertions(+), 10 deletions(-) create mode 100644 qa/integration/src/test/resources/features/jobEngine/JobEngineServiceProcessorConfigurationI9n.feature diff --git a/qa/integration/src/test/java/org/eclipse/kapua/integration/service/jobEngine/RunJobEngineServiceI9nTest.java b/qa/integration/src/test/java/org/eclipse/kapua/integration/service/jobEngine/RunJobEngineServiceI9nTest.java index 85210dfd101..408d12e1cee 100644 --- a/qa/integration/src/test/java/org/eclipse/kapua/integration/service/jobEngine/RunJobEngineServiceI9nTest.java +++ b/qa/integration/src/test/java/org/eclipse/kapua/integration/service/jobEngine/RunJobEngineServiceI9nTest.java @@ -19,11 +19,12 @@ @RunWith(Cucumber.class) @CucumberOptions( features = { -// "classpath:features/jobEngine/JobEngineServiceOperations.feature", -// "classpath:features/jobEngine/JobEngineServiceProcessorKeystoreI9n.feature", -// "classpath:features/jobEngine/JobEngineServiceProcessorAssetI9n.feature", -// "classpath:features/jobEngine/JobEngineServiceProcessorBundleI9n.feature", + "classpath:features/jobEngine/JobEngineServiceOperations.feature", + "classpath:features/jobEngine/JobEngineServiceProcessorAssetI9n.feature", + "classpath:features/jobEngine/JobEngineServiceProcessorBundleI9n.feature", "classpath:features/jobEngine/JobEngineServiceProcessorCommandI9n.feature", + "classpath:features/jobEngine/JobEngineServiceProcessorConfigurationI9n.feature", + "classpath:features/jobEngine/JobEngineServiceProcessorKeystoreI9n.feature", }, glue = { "org.eclipse.kapua.service.job.steps", diff --git a/qa/integration/src/test/resources/features/jobEngine/JobEngineServiceProcessorCommandI9n.feature b/qa/integration/src/test/resources/features/jobEngine/JobEngineServiceProcessorCommandI9n.feature index df4a09d0b78..d90db76b46b 100644 --- a/qa/integration/src/test/resources/features/jobEngine/JobEngineServiceProcessorCommandI9n.feature +++ b/qa/integration/src/test/resources/features/jobEngine/JobEngineServiceProcessorCommandI9n.feature @@ -71,9 +71,9 @@ Feature: Job Engine Service - Command Step Processors And I confirm that job target in job has step index 0 and status "PROCESS_OK" # TODO: check that command has been executed when KuraMock gets refactored -# @teardown -# Scenario: Tear down test resources -# Given I logout -# And KuraMock is disconnected -# And Stop Docker environment -# And Clean Locator Instance \ No newline at end of file + @teardown + Scenario: Tear down test resources + Given I logout + And KuraMock is disconnected + And Stop Docker environment + And Clean Locator Instance \ No newline at end of file diff --git a/qa/integration/src/test/resources/features/jobEngine/JobEngineServiceProcessorConfigurationI9n.feature b/qa/integration/src/test/resources/features/jobEngine/JobEngineServiceProcessorConfigurationI9n.feature new file mode 100644 index 00000000000..cbe47417d0f --- /dev/null +++ b/qa/integration/src/test/resources/features/jobEngine/JobEngineServiceProcessorConfigurationI9n.feature @@ -0,0 +1,79 @@ +############################################################################### +# Copyright (c) 2024, 2024 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 +############################################################################### +@env_docker +@it +@jobEngine +@jobEngineTargetProcessors + +Feature: Job Engine Service - Configuration Step Processors + Tests for Device Management Configuration Processor + + @setup + Scenario: Setup test resources + Given Init Security Context + And Start Docker environment with resources + | db | + | events-broker | + | job-engine | + | message-broker | + | broker-auth-service | + | consumer-lifecycle | + + Scenario: Configuration Put - XML + + Given I login as user with name "kapua-sys" and password "kapua-password" + And I start the Kura Mock + And Device birth message is sent + And Device "rpione3" is connected within 10s + And I create a job with the name "TestJob" + And I add device targets to job + | rpione3 | + And I search for step definition with the name + | Configuration Put | + And I add job step to job with name "Test Step - Configuration Put - XML" and with selected job step definition and properties + | name | type | value | + | configuration | org.eclipse.kapua.service.device.management.configuration.DeviceConfiguration | org.eclipse.kura.demo.heater.Heater10 | + | timeout | java.lang.Long | 5000 | + When I start a job + And I wait job to finish its execution up to 10s + Then I confirm that job has 1 job execution + And I confirm that job target in job has step index 0 and status "PROCESS_OK" + # TODO: check that configuration has been applied when KuraMock gets refactored + + Scenario: Configuration Put - JSON + + Given I login as user with name "kapua-sys" and password "kapua-password" + And I start the Kura Mock + And Device birth message is sent + And Device "rpione3" is connected within 10s + And I create a job with the name "TestJob" + And I add device targets to job + | rpione3 | + And I search for step definition with the name + | Configuration Put | + And I add job step to job with name "Test Step - Configuration Put - JSON" and with selected job step definition and properties + | name | type | value | + | configuration | org.eclipse.kapua.service.device.management.configuration.DeviceConfiguration | { "configuration": [{ "id": "org.eclipse.kura.demo.heater.Heater", "properties": { "property": [{ "name": "publish.rate", "array": false, "encrypted": false, "type": "Integer", "value": [ "10" ]} ]} }] } | + | timeout | java.lang.Long | 5000 | + When I start a job + And I wait job to finish its execution up to 10s + Then I confirm that job has 1 job execution + And I confirm that job target in job has step index 0 and status "PROCESS_OK" + # TODO: check that configuration has been applied when KuraMock gets refactored + + @teardown + Scenario: Tear down test resources + Given I logout + And KuraMock is disconnected + And Stop Docker environment + And Clean Locator Instance \ No newline at end of file From 18e4fc59c7c72168d39a86570f8f0998c67fc435 Mon Sep 17 00:00:00 2001 From: Alberto Codutti Date: Fri, 20 Dec 2024 18:13:20 +0100 Subject: [PATCH 6/9] :recycle: [Test] Removed TODO. Checking of DeviceEvents and effectivness of the Device Management operation will be tested by the Device Management tests Signed-off-by: Alberto Codutti --- .../jobEngine/JobEngineServiceProcessorAssetI9n.feature | 1 - .../jobEngine/JobEngineServiceProcessorBundleI9n.feature | 2 -- .../jobEngine/JobEngineServiceProcessorCommandI9n.feature | 2 -- .../JobEngineServiceProcessorConfigurationI9n.feature | 2 -- .../jobEngine/JobEngineServiceProcessorKeystoreI9n.feature | 3 --- 5 files changed, 10 deletions(-) diff --git a/qa/integration/src/test/resources/features/jobEngine/JobEngineServiceProcessorAssetI9n.feature b/qa/integration/src/test/resources/features/jobEngine/JobEngineServiceProcessorAssetI9n.feature index f584b4aa641..2eabc15f6ca 100644 --- a/qa/integration/src/test/resources/features/jobEngine/JobEngineServiceProcessorAssetI9n.feature +++ b/qa/integration/src/test/resources/features/jobEngine/JobEngineServiceProcessorAssetI9n.feature @@ -48,7 +48,6 @@ Feature: Job Engine Service - Asset Step Processors And I wait job to finish its execution up to 10s Then I confirm that job has 1 job execution And I confirm that job target in job has step index 0 and status "PROCESS_OK" - # TODO: check that asset has been written when KuraMock gets refactored @teardown Scenario: Tear down test resources diff --git a/qa/integration/src/test/resources/features/jobEngine/JobEngineServiceProcessorBundleI9n.feature b/qa/integration/src/test/resources/features/jobEngine/JobEngineServiceProcessorBundleI9n.feature index 01ad0a8d509..68a11f8d3f2 100644 --- a/qa/integration/src/test/resources/features/jobEngine/JobEngineServiceProcessorBundleI9n.feature +++ b/qa/integration/src/test/resources/features/jobEngine/JobEngineServiceProcessorBundleI9n.feature @@ -48,7 +48,6 @@ Feature: Job Engine Service - Bundle Step Processors And I wait job to finish its execution up to 10s Then I confirm that job has 1 job execution And I confirm that job target in job has step index 0 and status "PROCESS_OK" - # TODO: check that bundle has been started when KuraMock gets refactored Scenario: Bundle Stop @@ -69,7 +68,6 @@ Feature: Job Engine Service - Bundle Step Processors And I wait job to finish its execution up to 10s Then I confirm that job has 1 job execution And I confirm that job target in job has step index 0 and status "PROCESS_OK" - # TODO: check that bundle has been stopped when KuraMock gets refactored @teardown Scenario: Tear down test resources diff --git a/qa/integration/src/test/resources/features/jobEngine/JobEngineServiceProcessorCommandI9n.feature b/qa/integration/src/test/resources/features/jobEngine/JobEngineServiceProcessorCommandI9n.feature index d90db76b46b..543279dfc6c 100644 --- a/qa/integration/src/test/resources/features/jobEngine/JobEngineServiceProcessorCommandI9n.feature +++ b/qa/integration/src/test/resources/features/jobEngine/JobEngineServiceProcessorCommandI9n.feature @@ -48,7 +48,6 @@ Feature: Job Engine Service - Command Step Processors And I wait job to finish its execution up to 10s Then I confirm that job has 1 job execution And I confirm that job target in job has step index 0 and status "PROCESS_OK" - # TODO: check that command has been executed when KuraMock gets refactored Scenario: Command Exec - JSON @@ -69,7 +68,6 @@ Feature: Job Engine Service - Command Step Processors And I wait job to finish its execution up to 10s Then I confirm that job has 1 job execution And I confirm that job target in job has step index 0 and status "PROCESS_OK" - # TODO: check that command has been executed when KuraMock gets refactored @teardown Scenario: Tear down test resources diff --git a/qa/integration/src/test/resources/features/jobEngine/JobEngineServiceProcessorConfigurationI9n.feature b/qa/integration/src/test/resources/features/jobEngine/JobEngineServiceProcessorConfigurationI9n.feature index cbe47417d0f..212f431ca24 100644 --- a/qa/integration/src/test/resources/features/jobEngine/JobEngineServiceProcessorConfigurationI9n.feature +++ b/qa/integration/src/test/resources/features/jobEngine/JobEngineServiceProcessorConfigurationI9n.feature @@ -48,7 +48,6 @@ Feature: Job Engine Service - Configuration Step Processors And I wait job to finish its execution up to 10s Then I confirm that job has 1 job execution And I confirm that job target in job has step index 0 and status "PROCESS_OK" - # TODO: check that configuration has been applied when KuraMock gets refactored Scenario: Configuration Put - JSON @@ -69,7 +68,6 @@ Feature: Job Engine Service - Configuration Step Processors And I wait job to finish its execution up to 10s Then I confirm that job has 1 job execution And I confirm that job target in job has step index 0 and status "PROCESS_OK" - # TODO: check that configuration has been applied when KuraMock gets refactored @teardown Scenario: Tear down test resources diff --git a/qa/integration/src/test/resources/features/jobEngine/JobEngineServiceProcessorKeystoreI9n.feature b/qa/integration/src/test/resources/features/jobEngine/JobEngineServiceProcessorKeystoreI9n.feature index 3dd38a74bfa..53f3a8d60d5 100644 --- a/qa/integration/src/test/resources/features/jobEngine/JobEngineServiceProcessorKeystoreI9n.feature +++ b/qa/integration/src/test/resources/features/jobEngine/JobEngineServiceProcessorKeystoreI9n.feature @@ -50,7 +50,6 @@ Feature: Job Engine Service - Keystore Step Processors And I wait job to finish its execution up to 10s Then I confirm that job has 1 job execution And I confirm that job target in job has step index 0 and status "PROCESS_OK" - # TODO: check that certificate has been installed when KuraMock gets refactored Scenario: Keystore Keypair Create Processor @@ -76,7 +75,6 @@ Feature: Job Engine Service - Keystore Step Processors And I wait job to finish its execution up to 10s Then I confirm that job has 1 job execution And I confirm that job target in job has step index 0 and status "PROCESS_OK" - # TODO: check that keypair has been created when KuraMock gets refactored Scenario: Keystore Item Delete Processor @@ -98,7 +96,6 @@ Feature: Job Engine Service - Keystore Step Processors And I wait job to finish its execution up to 10s Then I confirm that job has 1 job execution And I confirm that job target in job has step index 0 and status "PROCESS_OK" - # TODO: check that item has been deleted when KuraMock gets refactored @teardown Scenario: Tear down test resources From 0bf42a0bf9976dff507edb71c257e819b5b8b61f Mon Sep 17 00:00:00 2001 From: Alberto Codutti Date: Mon, 23 Dec 2024 13:08:11 +0100 Subject: [PATCH 7/9] :recycle: [Test] Added new set of test cases to test JobEngine Device Management Packages Target Processors Signed-off-by: Alberto Codutti --- .../jobEngine/RunJobEngineServiceI9nTest.java | 1 + ...bEngineServiceProcessorPackagesI9n.feature | 137 ++++++++++++++++ .../device/registry/steps/KuraDevice.java | 147 +++++++++++------- .../service/job/steps/JobEngineSteps.java | 28 +++- .../job/steps/JobTargetServiceSteps.java | 36 ++++- 5 files changed, 286 insertions(+), 63 deletions(-) create mode 100644 qa/integration/src/test/resources/features/jobEngine/JobEngineServiceProcessorPackagesI9n.feature diff --git a/qa/integration/src/test/java/org/eclipse/kapua/integration/service/jobEngine/RunJobEngineServiceI9nTest.java b/qa/integration/src/test/java/org/eclipse/kapua/integration/service/jobEngine/RunJobEngineServiceI9nTest.java index 408d12e1cee..fa4758d8275 100644 --- a/qa/integration/src/test/java/org/eclipse/kapua/integration/service/jobEngine/RunJobEngineServiceI9nTest.java +++ b/qa/integration/src/test/java/org/eclipse/kapua/integration/service/jobEngine/RunJobEngineServiceI9nTest.java @@ -25,6 +25,7 @@ "classpath:features/jobEngine/JobEngineServiceProcessorCommandI9n.feature", "classpath:features/jobEngine/JobEngineServiceProcessorConfigurationI9n.feature", "classpath:features/jobEngine/JobEngineServiceProcessorKeystoreI9n.feature", + "classpath:features/jobEngine/JobEngineServiceProcessorPackagesI9n.feature", }, glue = { "org.eclipse.kapua.service.job.steps", diff --git a/qa/integration/src/test/resources/features/jobEngine/JobEngineServiceProcessorPackagesI9n.feature b/qa/integration/src/test/resources/features/jobEngine/JobEngineServiceProcessorPackagesI9n.feature new file mode 100644 index 00000000000..5e1cb019314 --- /dev/null +++ b/qa/integration/src/test/resources/features/jobEngine/JobEngineServiceProcessorPackagesI9n.feature @@ -0,0 +1,137 @@ +############################################################################### +# Copyright (c) 2024, 2024 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 +############################################################################### +@env_docker +@it +@jobEngine +@jobEngineTargetProcessors + +Feature: Job Engine Service - Packages Step Processors + Tests for Device Management Packages Processor + + @setup + Scenario: Setup test resources + Given Init Security Context + And Start Docker environment with resources + | db | + | events-broker | + | job-engine | + | message-broker | + | broker-auth-service | + | consumer-lifecycle | + + Scenario: Package Install - XML + + Given I login as user with name "kapua-sys" and password "kapua-password" + And I start the Kura Mock + And Device birth message is sent + And Device "rpione3" is connected within 10s + And I create a job with the name "TestJob" + And I add device targets to job + | rpione3 | + And I search for step definition with the name + | Package Download / Install | + And I add job step to job with name "Test Step - Package Download and Install - XML" and with selected job step definition and properties + | name | type | value | + | packageDownloadRequest | org.eclipse.kapua.service.device.management.packages.model.download.DevicePackageDownloadRequest | http://download.eclipse.org/kura/releases/3.2.0/org.eclipse.kura.demo.heater_1.0.300.dpheater1.0.300true | + | timeout | java.lang.Long | 5000 | + When I start a job + And I wait job to finish its execution up to 5s + Then I confirm that job has 1 job execution + And I confirm that job target in job has step index 0 and status "AWAITING_COMPLETION" + Then I wait job target to finish processing and notify completion up to 10s + And I wait for another job start up to 10s + And I wait job to finish its execution up to 5s + And I confirm that job has 2 job execution + And I confirm that job target in job has step index 0 and status "PROCESS_OK" + + Scenario: Package Install - JSON + + Given I login as user with name "kapua-sys" and password "kapua-password" + And I start the Kura Mock + And Device birth message is sent + And Device "rpione3" is connected within 10s + And I create a job with the name "TestJob" + And I add device targets to job + | rpione3 | + And I search for step definition with the name + | Package Download / Install | + And I add job step to job with name "Test Step - Package Download and Install - JSON" and with selected job step definition and properties + | name | type | value | + | packageDownloadRequest | org.eclipse.kapua.service.device.management.packages.model.download.DevicePackageDownloadRequest | { "uri": "http://download.eclipse.org/kura/releases/3.2.0/org.eclipse.kura.demo.heater_1.0.300.dp", "name": "heater", "version": "1.0.300", "install": true } | + | timeout | java.lang.Long | 5000 | + When I start a job + And I wait job to finish its execution up to 5s + Then I confirm that job has 1 job execution + And I confirm that job target in job has step index 0 and status "AWAITING_COMPLETION" + Then I wait job target to finish processing and notify completion up to 10s + And I wait for another job start up to 10s + And I wait job to finish its execution up to 5s + And I confirm that job has 2 job execution + And I confirm that job target in job has step index 0 and status "PROCESS_OK" + + Scenario: Package Uninstall - XML + + Given I login as user with name "kapua-sys" and password "kapua-password" + And I start the Kura Mock + And Device birth message is sent + And Device "rpione3" is connected within 10s + And I create a job with the name "TestJob" + And I add device targets to job + | rpione3 | + And I search for step definition with the name + | Package Uninstall | + And I add job step to job with name "Test Step - Package Uninstall - XML" and with selected job step definition and properties + | name | type | value | + | packageUninstallRequest | org.eclipse.kapua.service.device.management.packages.model.uninstall.DevicePackageUninstallRequest | heater1.0.300false30000 | + | timeout | java.lang.Long | 5000 | + When I start a job + And I wait job to finish its execution up to 5s + Then I confirm that job has 1 job execution + And I confirm that job target in job has step index 0 and status "AWAITING_COMPLETION" + Then I wait job target to finish processing and notify completion up to 10s + And I wait for another job start up to 10s + And I wait job to finish its execution up to 5s + And I confirm that job has 2 job execution + And I confirm that job target in job has step index 0 and status "PROCESS_OK" + + Scenario: Package Uninstall - JSON + + Given I login as user with name "kapua-sys" and password "kapua-password" + And I start the Kura Mock + And Device birth message is sent + And Device "rpione3" is connected within 10s + And I create a job with the name "TestJob" + And I add device targets to job + | rpione3 | + And I search for step definition with the name + | Package Uninstall | + And I add job step to job with name "Test Step - Package Uninstall - JSON" and with selected job step definition and properties + | name | type | value | + | packageUninstallRequest | org.eclipse.kapua.service.device.management.packages.model.uninstall.DevicePackageUninstallRequest | { "name": "org.eclipse.kura.demo.heater", "version": "1.0.500", "reboot": false, "rebootDelay": 30000 } | + | timeout | java.lang.Long | 5000 | + When I start a job + And I wait job to finish its execution up to 5s + Then I confirm that job has 1 job execution + And I confirm that job target in job has step index 0 and status "AWAITING_COMPLETION" + Then I wait job target to finish processing and notify completion up to 10s + And I wait for another job start up to 10s + And I wait job to finish its execution up to 5s + And I confirm that job has 2 job execution + And I confirm that job target in job has step index 0 and status "PROCESS_OK" + + @teardown + Scenario: Tear down test resources + Given I logout + And KuraMock is disconnected + And Stop Docker environment + And Clean Locator Instance \ No newline at end of file diff --git a/service/device/registry/test-steps/src/main/java/org/eclipse/kapua/service/device/registry/steps/KuraDevice.java b/service/device/registry/test-steps/src/main/java/org/eclipse/kapua/service/device/registry/steps/KuraDevice.java index 9c30988b186..65076a8f0d3 100644 --- a/service/device/registry/test-steps/src/main/java/org/eclipse/kapua/service/device/registry/steps/KuraDevice.java +++ b/service/device/registry/test-steps/src/main/java/org/eclipse/kapua/service/device/registry/steps/KuraDevice.java @@ -453,79 +453,106 @@ else if (topic.equals(deployGetPackages)) { mqttClient.publish(responseTopic, responsePayload, 0, false); } else if (topic.equals(deployExecDownload)) { callbackParam = extractCallback(requestPayload); - KuraPayload kuraPayloadInitial = new KuraPayload(); - kuraPayloadInitial.readFromByteArray(requestPayload); + KuraPayload kuraRequestPayload = new KuraPayload(); + kuraRequestPayload.readFromByteArray(requestPayload); + + // Reply responseTopic = $EDC + CLIENT_ACCOUNT + "/" + callbackParam.getClientId() + DEPLOY_V2_REPLY + callbackParam.getRequestId(); - KuraPayload customKuraPayload1 = new KuraPayload(); - customKuraPayload1.setTimestamp(new Date()); - customKuraPayload1.getMetrics().put("response.code", 200); - responsePayload = customKuraPayload1.toByteArray(); - mqttClient.publish(responseTopic, responsePayload, 0, false); - Thread.sleep(100); - - responseTopic = $EDC + CLIENT_ACCOUNT + "/" + callbackParam.getClientId() + DEPLOY_V2_NOTIFY + clientId + "/download"; - KuraPayload customKuraPayload2 = new KuraPayload(); - customKuraPayload2.setTimestamp(new Date()); - customKuraPayload2.getMetrics().put(JOB_ID, kuraPayloadInitial.getMetrics().get(JOB_ID)); - customKuraPayload2.getMetrics().put(CLIENT_ID, clientId); - customKuraPayload2.getMetrics().put("dp.download.progress", 50); - customKuraPayload2.getMetrics().put("dp.download.size", 20409); - customKuraPayload2.getMetrics().put("dp.download.status", "IN_PROGRESS"); - customKuraPayload2.getMetrics().put("dp.download.index", 0); - responsePayload = customKuraPayload2.toByteArray(); - mqttClient.publish(responseTopic, responsePayload, 0, false); - Thread.sleep(100); - - responseTopic = $EDC + CLIENT_ACCOUNT + "/" + callbackParam.getClientId() + DEPLOY_V2_NOTIFY + clientId + "/download"; - KuraPayload customKuraPayload3 = new KuraPayload(); - customKuraPayload3.setTimestamp(new Date()); - customKuraPayload3.getMetrics().put(JOB_ID, kuraPayloadInitial.getMetrics().get(JOB_ID)); - customKuraPayload3.getMetrics().put(CLIENT_ID, clientId); - customKuraPayload3.getMetrics().put("dp.download.progress", 100); - customKuraPayload3.getMetrics().put("dp.download.size", 20409); - customKuraPayload3.getMetrics().put("dp.download.status", COMPLETED); - customKuraPayload3.getMetrics().put("dp.download.index", 0); - responsePayload = customKuraPayload3.toByteArray(); - mqttClient.publish(responseTopic, responsePayload, 0, false); - Thread.sleep(100); - - responseTopic = $EDC + CLIENT_ACCOUNT + "/" + callbackParam.getClientId() + DEPLOY_V2_NOTIFY + clientId + "/install"; - KuraPayload customKuraPayload4 = new KuraPayload(); - customKuraPayload4.setTimestamp(new Date()); - customKuraPayload4.getMetrics().put("dp.name", "Example Publisher-1.0.300.dp"); - customKuraPayload4.getMetrics().put(JOB_ID, kuraPayloadInitial.getMetrics().get(JOB_ID)); - customKuraPayload4.getMetrics().put("dp.install.progress", 100); - customKuraPayload4.getMetrics().put("dp.install.status", COMPLETED); - customKuraPayload4.getMetrics().put(CLIENT_ID, clientId); - responsePayload = customKuraPayload4.toByteArray(); + + KuraPayload replyKuraResponsePayload = new KuraPayload(); + replyKuraResponsePayload.setTimestamp(new Date()); + replyKuraResponsePayload.getMetrics().put("response.code", 200); + responsePayload = replyKuraResponsePayload.toByteArray(); + mqttClient.publish(responseTopic, responsePayload, 0, false); + Thread.sleep(1000); + + // Download Notification 25% + String downloadNotifyTopic = $EDC + CLIENT_ACCOUNT + "/" + callbackParam.getClientId() + DEPLOY_V2_NOTIFY + clientId + "/download"; + + KuraPayload downloadNotifyPayload = new KuraPayload(); + downloadNotifyPayload.setTimestamp(new Date()); + downloadNotifyPayload.getMetrics().put(CLIENT_ID, clientId); + downloadNotifyPayload.getMetrics().put(JOB_ID, kuraRequestPayload.getMetrics().get(JOB_ID)); + downloadNotifyPayload.getMetrics().put("dp.download.progress", 25); + downloadNotifyPayload.getMetrics().put("dp.download.size", 20409); + downloadNotifyPayload.getMetrics().put("dp.download.status", "IN_PROGRESS"); + downloadNotifyPayload.getMetrics().put("dp.download.index", 0); + responsePayload = downloadNotifyPayload.toByteArray(); + + mqttClient.publish(downloadNotifyTopic, responsePayload, 0, false); + Thread.sleep(1000); + + // Download Notification 50% + downloadNotifyPayload.setTimestamp(new Date()); + downloadNotifyPayload.getMetrics().put("dp.download.progress", 50); + responsePayload = downloadNotifyPayload.toByteArray(); + + mqttClient.publish(downloadNotifyTopic, responsePayload, 0, false); + Thread.sleep(1000); + + // Download Notification 75% + downloadNotifyPayload.setTimestamp(new Date()); + downloadNotifyPayload.getMetrics().put("dp.download.progress", 75); + responsePayload = downloadNotifyPayload.toByteArray(); + + mqttClient.publish(downloadNotifyTopic, responsePayload, 0, false); + Thread.sleep(1000); + + // Download Notification 100% + downloadNotifyPayload.setTimestamp(new Date()); + downloadNotifyPayload.getMetrics().put("dp.download.progress", 100); + downloadNotifyPayload.getMetrics().put("dp.download.status", COMPLETED); + responsePayload = downloadNotifyPayload.toByteArray(); + + mqttClient.publish(downloadNotifyTopic, responsePayload, 0, false); + Thread.sleep(1000); + + // Install Notification 100% + String installNotifyTopic = $EDC + CLIENT_ACCOUNT + "/" + callbackParam.getClientId() + DEPLOY_V2_NOTIFY + clientId + "/install"; + + KuraPayload installNotifyPayload = new KuraPayload(); + installNotifyPayload.setTimestamp(new Date()); + installNotifyPayload.getMetrics().put(CLIENT_ID, clientId); + installNotifyPayload.getMetrics().put(JOB_ID, kuraRequestPayload.getMetrics().get(JOB_ID)); + installNotifyPayload.getMetrics().put("dp.name", "heater-1.0.300.dp"); + installNotifyPayload.getMetrics().put("dp.install.progress", 100); + installNotifyPayload.getMetrics().put("dp.install.status", COMPLETED); + responsePayload = installNotifyPayload.toByteArray(); + + mqttClient.publish(installNotifyTopic, responsePayload, 0, false); packageListChanged = true; } else if (topic.equals(deployExecUninstall)) { callbackParam = extractCallback(requestPayload); - KuraPayload kuraPayloadInitial = new KuraPayload(); - kuraPayloadInitial.readFromByteArray(requestPayload); + KuraPayload kuraRequestPayload = new KuraPayload(); + kuraRequestPayload.readFromByteArray(requestPayload); + + // Reply topic responseTopic = $EDC + CLIENT_ACCOUNT + "/" + callbackParam.getClientId() + DEPLOY_V2_REPLY + callbackParam.getRequestId(); - KuraPayload customKuraPayload = new KuraPayload(); - customKuraPayload.setTimestamp(new Date()); - customKuraPayload.getMetrics().put("response.code", 200); - responsePayload = customKuraPayload.toByteArray(); + KuraPayload replyResponsePayload = new KuraPayload(); + replyResponsePayload.setTimestamp(new Date()); + replyResponsePayload.getMetrics().put("response.code", 200); + responsePayload = replyResponsePayload.toByteArray(); + mqttClient.publish(responseTopic, responsePayload, 0, false); - Thread.sleep(5000); + Thread.sleep(3000); + // Uninstall notification 100% responseTopic = $EDC + CLIENT_ACCOUNT + "/" + callbackParam.getClientId() + DEPLOY_V2_NOTIFY + clientId + "/uninstall"; - KuraPayload customKuraPayload2 = new KuraPayload(); - - customKuraPayload2.setTimestamp(new Date()); - customKuraPayload2.getMetrics().put(JOB_ID, kuraPayloadInitial.getMetrics().get(JOB_ID)); - customKuraPayload2.getMetrics().put("dp.name", "org.eclipse.kura.example.beacon"); - customKuraPayload2.getMetrics().put("dp.uninstall.progress", 100); - customKuraPayload2.getMetrics().put("dp.uninstall.status", COMPLETED); - customKuraPayload2.getMetrics().put(CLIENT_ID, clientId); - responsePayload = customKuraPayload2.toByteArray(); + + KuraPayload uninstallNotifyPayload = new KuraPayload(); + uninstallNotifyPayload.setTimestamp(new Date()); + uninstallNotifyPayload.getMetrics().put(CLIENT_ID, clientId); + uninstallNotifyPayload.getMetrics().put(JOB_ID, kuraRequestPayload.getMetrics().get(JOB_ID)); + uninstallNotifyPayload.getMetrics().put("dp.name", "org.eclipse.kura.demo.heater"); + uninstallNotifyPayload.getMetrics().put("dp.uninstall.progress", 100); + uninstallNotifyPayload.getMetrics().put("dp.uninstall.status", COMPLETED); + responsePayload = uninstallNotifyPayload.toByteArray(); + mqttClient.publish(responseTopic, responsePayload, 0, false); packageListChangedAfterUninstall = true; diff --git a/service/job/test-steps/src/main/java/org/eclipse/kapua/service/job/steps/JobEngineSteps.java b/service/job/test-steps/src/main/java/org/eclipse/kapua/service/job/steps/JobEngineSteps.java index 17d735bfce0..267b6aed576 100644 --- a/service/job/test-steps/src/main/java/org/eclipse/kapua/service/job/steps/JobEngineSteps.java +++ b/service/job/test-steps/src/main/java/org/eclipse/kapua/service/job/steps/JobEngineSteps.java @@ -70,6 +70,32 @@ public void startJob() throws Exception { // Wait Job Running + /** + * Waits the {@link Job} in context to start. + * + * @param waitSeconds The max time to wait + * @throws Exception + * @since 2.1.0 + */ + @And("I wait for another job start up to {int}s") + public void waitJobInContextToStart(int waitSeconds) throws Exception { + Job job = (Job) stepData.get(JOB); + + long now = System.currentTimeMillis(); + while ((System.currentTimeMillis() - now) < (waitSeconds * 1000L)) { + if (jobEngineService.isRunning(job.getScopeId(), job.getId())) { + return; + } + + // Check frequently! + TimeUnit.MILLISECONDS.sleep(25); + } + + Assert.fail("Job " + job.getName() + " did not start an execution within " + waitSeconds + "s"); + } + + // Wait Job Finish Run + /** * Waits the last {@link Job} in context to finish it execution up the given wait time * @@ -117,7 +143,7 @@ private void waitJobUpTo(Job job, int waitSeconds) throws Exception { TimeUnit.MILLISECONDS.sleep(100); } - Assert.fail("Job " + job.getName() + "did not completed its execution within " + waitSeconds + "s"); + Assert.fail("Job " + job.getName() + " did not completed its execution within " + waitSeconds + "s"); } // Check Job Running diff --git a/service/job/test-steps/src/main/java/org/eclipse/kapua/service/job/steps/JobTargetServiceSteps.java b/service/job/test-steps/src/main/java/org/eclipse/kapua/service/job/steps/JobTargetServiceSteps.java index ea7e630c583..9921b83de09 100644 --- a/service/job/test-steps/src/main/java/org/eclipse/kapua/service/job/steps/JobTargetServiceSteps.java +++ b/service/job/test-steps/src/main/java/org/eclipse/kapua/service/job/steps/JobTargetServiceSteps.java @@ -27,6 +27,7 @@ import org.eclipse.kapua.model.id.KapuaId; import org.eclipse.kapua.model.query.predicate.AttributePredicate; import org.eclipse.kapua.qa.common.StepData; +import org.eclipse.kapua.service.device.management.registry.operation.notification.ManagementOperationNotification; import org.eclipse.kapua.service.device.registry.Device; import org.eclipse.kapua.service.device.registry.DeviceAttributes; import org.eclipse.kapua.service.device.registry.DeviceFactory; @@ -49,11 +50,14 @@ import javax.inject.Inject; import java.util.ArrayList; import java.util.List; +import java.util.concurrent.TimeUnit; import java.util.stream.Collectors; @Singleton public class JobTargetServiceSteps extends JobServiceTestBase { + private final static Logger LOG = LoggerFactory.getLogger(JobTargetServiceSteps.class); + private static final String DEVICE = "Device"; private DeviceFactory deviceFactory; @@ -61,7 +65,6 @@ public class JobTargetServiceSteps extends JobServiceTestBase { private JobTargetService jobTargetService; private JobTargetFactory jobTargetFactory; - final Logger logger = LoggerFactory.getLogger(this.getClass()); @Inject public JobTargetServiceSteps(StepData stepData) { @@ -214,7 +217,7 @@ public void findLastJobTarget() throws Exception { public void checkStepIndexAndStatus(int stepIndex, String status) throws KapuaException { JobTarget jobTarget = (JobTarget) stepData.get(JOB_TARGET); JobTarget target = jobTargetService.find(jobTarget.getScopeId(), jobTarget.getId()); - logger.error("step: {}, status: {}", target.getStepIndex(), target.getStatus().name()); + LOG.error("step: {}, status: {}", target.getStepIndex(), target.getStatus().name()); Assert.assertEquals(stepIndex, target.getStepIndex()); Assert.assertEquals(status, target.getStatus().toString()); } @@ -448,6 +451,35 @@ private void checkJobTargetForJobHas(JobTarget jobTarget, int expectedStepIndex, stepData.put(JOB_TARGET, updatedJobTarget); } + /** + * Waits the {@link JobTarget} in context to finish its processing and to have {@link JobTarget#getStatus()} set to {@link JobTargetStatus#NOTIFIED_COMPLETION} + *

+ * It also takes as a valid {@link JobTarget#getStatus()} {@link JobTargetStatus#PROCESS_OK} because the {@link ManagementOperationNotification} can be processed fast and + * {@link JobTarget} can switch from {@link JobTargetStatus#NOTIFIED_COMPLETION} to {@link JobTargetStatus#PROCESS_OK} while waiting for the next check. + * + * @param waitSeconds The max time to wait + * @throws Exception + * @since 2.1.0 + */ + @Then("I wait job target to finish processing and notify completion up to {int}s") + public void waitJobTargetInContextToNotifyCompletion(int waitSeconds) throws Exception { + JobTarget jobTarget = (JobTarget) stepData.get(JOB_TARGET); + + long now = System.currentTimeMillis(); + while ((System.currentTimeMillis() - now) < (waitSeconds * 1000L)) { + JobTarget updatedJobTarget = jobTargetService.find(jobTarget.getScopeId(), jobTarget.getId()); + if (JobTargetStatus.NOTIFIED_COMPLETION.equals(updatedJobTarget.getStatus()) || + // Processing of notification is fast so we accept also PROCESS_OK as a valid status + JobTargetStatus.PROCESS_OK.equals(updatedJobTarget.getStatus())) { + return; + } + + TimeUnit.MILLISECONDS.sleep(100); + } + + Assert.fail("Job Target" + jobTarget.getId() + " did not notified completion of processing within " + waitSeconds + "s"); + } + // // Private methods // From 861fad23095f6f4f55603f7ef6bb354b0f81334a Mon Sep 17 00:00:00 2001 From: Alberto Codutti Date: Mon, 23 Dec 2024 16:40:31 +0100 Subject: [PATCH 8/9] :recycle: [Test] Removed old test cases and reviewed Kapua CI github workflow Signed-off-by: Alberto Codutti --- .github/workflows/kapua-ci.yaml | 83 +- ...nJobEngineServiceOfflineDeviceI9nTest.java | 38 - ...unJobEngineServiceOnlineDeviceI9nTest.java | 39 - ...gineServiceRestartOfflineDeviceI9n.feature | 1024 --------------- ...ngineServiceRestartOnlineDeviceI9n.feature | 507 -------- ...ceRestartOnlineDeviceSecondPartI9n.feature | 434 ------- ...EngineServiceStartOfflineDeviceI9n.feature | 1138 ----------------- ...bEngineServiceStartOnlineDeviceI9n.feature | 867 ------------- ...obEngineServiceStopOnlineDeviceI9n.feature | 518 -------- .../jobScheduling/TriggerServiceI9n.feature | 2 +- .../resources/features/JobService.feature | 2 +- .../features/JobStepDefinitionService.feature | 2 +- .../resources/features/JobStepService.feature | 2 +- 13 files changed, 7 insertions(+), 4649 deletions(-) delete mode 100644 qa/integration/src/test/java/org/eclipse/kapua/integration/service/jobEngine/RunJobEngineServiceOfflineDeviceI9nTest.java delete mode 100644 qa/integration/src/test/java/org/eclipse/kapua/integration/service/jobEngine/RunJobEngineServiceOnlineDeviceI9nTest.java delete mode 100644 qa/integration/src/test/resources/features/jobEngine/JobEngineServiceRestartOfflineDeviceI9n.feature delete mode 100644 qa/integration/src/test/resources/features/jobEngine/JobEngineServiceRestartOnlineDeviceI9n.feature delete mode 100644 qa/integration/src/test/resources/features/jobEngine/JobEngineServiceRestartOnlineDeviceSecondPartI9n.feature delete mode 100644 qa/integration/src/test/resources/features/jobEngine/JobEngineServiceStartOfflineDeviceI9n.feature delete mode 100644 qa/integration/src/test/resources/features/jobEngine/JobEngineServiceStartOnlineDeviceI9n.feature delete mode 100644 qa/integration/src/test/resources/features/jobEngine/JobEngineServiceStopOnlineDeviceI9n.feature diff --git a/.github/workflows/kapua-ci.yaml b/.github/workflows/kapua-ci.yaml index 71619d91923..94a1b2be8bb 100755 --- a/.github/workflows/kapua-ci.yaml +++ b/.github/workflows/kapua-ci.yaml @@ -160,9 +160,9 @@ jobs: uses: actions/checkout@v4 - uses: ./.github/actions/runTestsTaggedAs with: - tag: '@jobs or @scheduler' + tag: '@job or @scheduler and not @it' needs-docker-images: 'false' - test-jobService: + test-job-it: needs: build runs-on: ubuntu-latest timeout-minutes: 45 @@ -173,7 +173,7 @@ jobs: with: tag: '@job and @it' needs-docker-images: 'true' - test-jobEngineOperations: + test-job-engine-it: needs: build runs-on: ubuntu-latest timeout-minutes: 45 @@ -206,83 +206,6 @@ jobs: with: tag: '@account or @translator' needs-docker-images: 'false' - test-jobEngineStepDefinitions: - needs: build - runs-on: ubuntu-latest - timeout-minutes: 45 - steps: - - name: Clones Kapua repo inside the runner - uses: actions/checkout@v4 - - uses: ./.github/actions/runTestsTaggedAs - with: - tag: '@jobEngineStepDefinitions' - needs-docker-images: 'true' - test-jobEngineStartOfflineDevice: - needs: build - runs-on: ubuntu-latest - timeout-minutes: 45 - steps: - - name: Clones Kapua repo inside the runner - uses: actions/checkout@v4 - - uses: ./.github/actions/runTestsTaggedAs - with: - tag: '@jobEngineStartOfflineDevice' - needs-docker-images: 'true' - test-jobEngineStartOnlineDevice: - needs: build - runs-on: ubuntu-latest - timeout-minutes: 45 - steps: - - name: Clones Kapua repo inside the runner - uses: actions/checkout@v4 - - uses: ./.github/actions/runTestsTaggedAs - with: - tag: '@jobEngineStartOnlineDevice' - needs-docker-images: 'true' - test-jobEngineRestartOfflineDevice: - needs: build - runs-on: ubuntu-latest - timeout-minutes: 45 - steps: - - name: Clones Kapua repo inside the runner - uses: actions/checkout@v4 - - uses: ./.github/actions/runTestsTaggedAs - with: - tag: '@jobEngineRestartOfflineDevice' - needs-docker-images: 'true' - test-jobEngineRestartOnlineDevice: - needs: build - runs-on: ubuntu-latest - timeout-minutes: 45 - steps: - - name: Clones Kapua repo inside the runner - uses: actions/checkout@v4 - - uses: ./.github/actions/runTestsTaggedAs - with: - tag: '@jobEngineRestartOnlineDevice' - needs-docker-images: 'true' - test-jobEngineRestartOnlineDeviceSecondPart: - needs: build - runs-on: ubuntu-latest - timeout-minutes: 45 - steps: - - name: Clones Kapua repo inside the runner - uses: actions/checkout@v4 - - uses: ./.github/actions/runTestsTaggedAs - with: - tag: '@jobEngineRestartOnlineDeviceSecondPart' - needs-docker-images: 'true' - test-jobEngineServiceStop: - needs: build - runs-on: ubuntu-latest - timeout-minutes: 45 - steps: - - name: Clones Kapua repo inside the runner - uses: actions/checkout@v4 - - uses: ./.github/actions/runTestsTaggedAs - with: - tag: '@jobEngineServiceStop' - needs-docker-images: 'true' test-RoleAndGroup: needs: build runs-on: ubuntu-latest diff --git a/qa/integration/src/test/java/org/eclipse/kapua/integration/service/jobEngine/RunJobEngineServiceOfflineDeviceI9nTest.java b/qa/integration/src/test/java/org/eclipse/kapua/integration/service/jobEngine/RunJobEngineServiceOfflineDeviceI9nTest.java deleted file mode 100644 index ad9bb8a0f3f..00000000000 --- a/qa/integration/src/test/java/org/eclipse/kapua/integration/service/jobEngine/RunJobEngineServiceOfflineDeviceI9nTest.java +++ /dev/null @@ -1,38 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2019, 2022 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; - -import io.cucumber.junit.Cucumber; -import io.cucumber.junit.CucumberOptions; - -import org.junit.runner.RunWith; - -@RunWith(Cucumber.class) -@CucumberOptions( - features = { - "classpath:features/jobEngine/JobEngineServiceStartOfflineDeviceI9n.feature", - "classpath:features/jobEngine/JobEngineServiceRestartOfflineDeviceI9n.feature" - }, - glue = { "org.eclipse.kapua.service.job.steps", - "org.eclipse.kapua.service.user.steps", - "org.eclipse.kapua.qa.common", - "org.eclipse.kapua.qa.integration.steps", - "org.eclipse.kapua.service.account.steps", - "org.eclipse.kapua.service.device.registry.steps", - }, - plugin = { "pretty", - "html:target/cucumber/JobEngineServiceOfflineDeviceI9n", - "json:target/JobEngineServiceOfflineDeviceI9n_cucumber.json" }, - monochrome = true) -public class RunJobEngineServiceOfflineDeviceI9nTest { -} 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 deleted file mode 100644 index 8d38fd6441a..00000000000 --- a/qa/integration/src/test/java/org/eclipse/kapua/integration/service/jobEngine/RunJobEngineServiceOnlineDeviceI9nTest.java +++ /dev/null @@ -1,39 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2019, 2022 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; - -import io.cucumber.junit.Cucumber; -import io.cucumber.junit.CucumberOptions; -import org.junit.runner.RunWith; - -@RunWith(Cucumber.class) -@CucumberOptions( - features = { - "classpath:features/jobEngine/JobEngineServiceStartOnlineDeviceI9n.feature", - "classpath:features/jobEngine/JobEngineServiceRestartOnlineDeviceI9n.feature", - "classpath:features/jobEngine/JobEngineServiceRestartOnlineDeviceSecondPartI9n.feature", - "classpath:features/jobEngine/JobEngineServiceStopOnlineDeviceI9n.feature", - }, - glue = {"org.eclipse.kapua.service.job.steps", - "org.eclipse.kapua.service.user.steps", - "org.eclipse.kapua.qa.common", - "org.eclipse.kapua.qa.integration.steps", - "org.eclipse.kapua.service.account.steps", - "org.eclipse.kapua.service.device.registry.steps" - }, - plugin = {"pretty", - "html:target/cucumber/JobEngineOnlineDeviceI9n", - "json:target/JobEngineOnlineDeviceI9n_cucumber.json"}, - monochrome = true) -public class RunJobEngineServiceOnlineDeviceI9nTest { -} diff --git a/qa/integration/src/test/resources/features/jobEngine/JobEngineServiceRestartOfflineDeviceI9n.feature b/qa/integration/src/test/resources/features/jobEngine/JobEngineServiceRestartOfflineDeviceI9n.feature deleted file mode 100644 index 86abf46646d..00000000000 --- a/qa/integration/src/test/resources/features/jobEngine/JobEngineServiceRestartOfflineDeviceI9n.feature +++ /dev/null @@ -1,1024 +0,0 @@ -############################################################################### -# Copyright (c) 2019, 2024 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 -############################################################################### -@env_docker -@it -@jobEngineRestartOfflineDevice - -Feature: JobEngineService tests for restarting job with offline device - - @setup - Scenario: Setup test resources - Given Init Security Context - And Start Docker environment with resources - | db | - | events-broker | - | job-engine | - | message-broker | - | broker-auth-service | - | consumer-lifecycle | - - # ************************************************* - # * Restarting a job with one Target and one Step * - # ************************************************* - - Scenario: Restarting job with Command Execution step - Create a new job and set a disconnected KuraMock device as the job target. - Add a new Asset Write step to the created job. Restart the job before starting. - After the executed job is finished, the executed target's step index should - be 0 and the status PROCESS_FAILED. - - Given I login as user with name "kapua-sys" and password "kapua-password" - And I start the Kura Mock - And Device is connected within 10 seconds - Then Device status is "CONNECTED" within 10 seconds - When KuraMock is disconnected - And I wait 1 second - Then Device status is "DISCONNECTED" within 10 seconds - And I select account "kapua-sys" - And I get the KuraMock device after 5 seconds - And I create a job with the name "TestJob" - And A new job target item - And Search for step definition with the name "Command Execution" - And I prepare a JobStepCreator with the name "TestStep" and the following properties - | name | type | value | - | commandInput | org.eclipse.kapua.service.device.management.command.DeviceCommandInput | pwd30000false | - | timeout | java.lang.Long | 10000 | - And I create a new JobStep from the existing creator - Then No exception was thrown - When I restart a job - And I query for the job with the name "TestJob" and I count 1 execution item and I confirm the executed job is finished within 20 seconds - And I search for the last job target in the database - Then I confirm the step index is 0 and status is "PROCESS_FAILED" - And I logout - - Scenario: Restarting job with Asset Write step - Create a new job and set a disconnected KuraMock device as the job target. - Add a new Asset Write step to the created job. Restart the job before starting. - After the executed job is finished, the executed target's step index should - be 0 and the status PROCESS_FAILED. - - Given I login as user with name "kapua-sys" and password "kapua-password" - And I start the Kura Mock - And Device is connected within 10 seconds - Then Device status is "CONNECTED" within 10 seconds - When KuraMock is disconnected - And I wait 1 second - Then Device status is "DISCONNECTED" within 10 seconds - And I select account "kapua-sys" - And I get the KuraMock device after 5 seconds - And I create a job with the name "TestJob" - And A new job target item - And Search for step definition with the name "Asset Write" - And I prepare a JobStepCreator with the name "TestStep" and the following properties - | name | type | value | - | assets | org.eclipse.kapua.service.device.management.asset.DeviceAssets | assetNamebinaryEGVzdCBzdHJpbmcgdmFsdWU=binaryTest | - | timeout | java.lang.Long | 10000 | - And I create a new JobStep from the existing creator - Then No exception was thrown - When I restart a job - And I query for the job with the name "TestJob" and I count 1 execution item and I confirm the executed job is finished within 20 seconds - And I search for the last job target in the database - Then I confirm the step index is 0 and status is "PROCESS_FAILED" - And I logout - - Scenario: Restarting job with Configuration Put step - Create a new job and set a disconnected KuraMock device as the job target. - Add a new Configuration Put step to the created job. Restart the job before starting. - After the executed job is finished, the executed target's step index should - be 0 and the status PROCESS_FAILED. - - Given I login as user with name "kapua-sys" and password "kapua-password" - And I start the Kura Mock - And Device is connected within 10 seconds - Then Device status is "CONNECTED" within 10 seconds - When KuraMock is disconnected - And I wait 1 second - Then Device status is "DISCONNECTED" within 10 seconds - And I select account "kapua-sys" - And I get the KuraMock device after 5 seconds - And I create a job with the name "TestJob" - And A new job target item - And Search for step definition with the name "Configuration Put" - And I prepare a JobStepCreator with the name "TestStep" and the following properties - | name | type | value | - | configuration | org.eclipse.kapua.service.device.management.configuration.DeviceConfiguration | org.eclipse.kura.demo.heater.Heater0.256022:00falseorg.eclipse.kura.demo.heater.Heaterorg.eclipse.kura.demo.heater.Heater06:00Programdata/21030.0213.030.0 | - | timeout | java.lang.Long | 10000 | - And I create a new JobStep from the existing creator - Then No exception was thrown - When I restart a job - And I query for the job with the name "TestJob" and I count 1 execution item and I confirm the executed job is finished within 20 seconds - And I search for the last job target in the database - Then I confirm the step index is 0 and status is "PROCESS_FAILED" - And I logout - - Scenario: Restarting job with Bundle Start step - Create a new job and set a disconnected KuraMock device as the job target. - Add a new Bundle Start step to the created job. Restart the job before starting. - After the executed job is finished, the executed target's step index should - be 0 and the status PROCESS_FAILED. - - Given I login as user with name "kapua-sys" and password "kapua-password" - And I start the Kura Mock - And Device is connected within 10 seconds - Then Device status is "CONNECTED" within 10 seconds - When KuraMock is disconnected - And I wait 1 second - Then Device status is "DISCONNECTED" within 10 seconds - And I select account "kapua-sys" - And I get the KuraMock device after 5 seconds - And I create a job with the name "TestJob" - And A new job target item - And Search for step definition with the name "Bundle Start" - And I prepare a JobStepCreator with the name "TestStep" and the following properties - | name | type | value | - | bundleId | java.lang.String | 34 | - | timeout | java.lang.Long | 10000 | - And I create a new JobStep from the existing creator - Then No exception was thrown - When I restart a job - And I query for the job with the name "TestJob" and I count 1 execution item and I confirm the executed job is finished within 20 seconds - And I search for the last job target in the database - Then I confirm the step index is 0 and status is "PROCESS_FAILED" - And I logout - - Scenario: Restarting job with Bundle Stop step - Create a new job and set a disconnected KuraMock device as the job target. - Add a new Bundle Stop step to the created job. Restart the job before starting. - After the executed job is finished, the executed target's step index should - be 0 and the status PROCESS_FAILED. - - Given I login as user with name "kapua-sys" and password "kapua-password" - And I start the Kura Mock - When Device is connected within 10 seconds - Then Device status is "CONNECTED" within 10 seconds - When KuraMock is disconnected - And I wait 1 second - Then Device status is "DISCONNECTED" within 10 seconds - And I select account "kapua-sys" - And I get the KuraMock device after 5 seconds - And I create a job with the name "TestJob" - And A new job target item - And Search for step definition with the name "Bundle Stop" - And I prepare a JobStepCreator with the name "TestStep" and the following properties - | name | type | value | - | bundleId | java.lang.String | 77 | - | timeout | java.lang.Long | 10000 | - And I create a new JobStep from the existing creator - Then No exception was thrown - When I restart a job - And I query for the job with the name "TestJob" and I count 1 execution item and I confirm the executed job is finished within 20 seconds - And I search for the last job target in the database - Then I confirm the step index is 0 and status is "PROCESS_FAILED" - And I logout - - Scenario: Restarting job with Package Install step - Create a new job and set a disconnected KuraMock device as the job target. - Add a new Package Install step to the created job. Restart the job before starting. - After the executed job is finished, the executed target's step index should - be 0 and the status PROCESS_FAILED. - - Given I login as user with name "kapua-sys" and password "kapua-password" - And I start the Kura Mock - When Device is connected within 10 seconds - Then Device status is "CONNECTED" within 10 seconds - When KuraMock is disconnected - And I wait 1 second - Then Device status is "DISCONNECTED" within 10 seconds - And I select account "kapua-sys" - And I get the KuraMock device after 5 seconds - And I create a job with the name "TestJob" - And A new job target item - And Search for step definition with the name "Package Download / Install" - And I prepare a JobStepCreator with the name "TestStep" and the following properties - | name | type | value | - | packageDownloadRequest | org.eclipse.kapua.service.device.management.packages.model.download.DevicePackageDownloadRequest | http://download.eclipse.org/kura/releases/3.2.0/org.eclipse.kura.demo.heater_1.0.300.dpheater1.0.300true | - | timeout | java.lang.Long | 10000 | - And I create a new JobStep from the existing creator - Then No exception was thrown - When I restart a job - And I query for the job with the name "TestJob" and I count 1 execution item and I confirm the executed job is finished within 20 seconds - And I search for the last job target in the database - Then I confirm the step index is 0 and status is "PROCESS_FAILED" - And I logout - - Scenario: Restarting job with Package Uninstall step - Create a new job and set a disconnected KuraMock device as the job target. - Add a new Package Uninstall step to the created job. Restart the job before starting. - After the executed job is finished, the executed target's step index should - be 0 and the status PROCESS_FAILED. - - Given I login as user with name "kapua-sys" and password "kapua-password" - And I start the Kura Mock - When Device is connected within 10 seconds - Then Device status is "CONNECTED" within 10 seconds - When KuraMock is disconnected - And I wait 1 second - Then Device status is "DISCONNECTED" within 10 seconds - And I select account "kapua-sys" - And I get the KuraMock device after 5 seconds - And I create a job with the name "TestJob" - And A new job target item - And Search for step definition with the name "Package Uninstall" - And I prepare a JobStepCreator with the name "TestStep" and the following properties - | name | type | value | - | packageUninstallRequest | org.eclipse.kapua.service.device.management.packages.model.uninstall.DevicePackageUninstallRequest | org.eclipse.kura.example.ble.tisensortag1.0.0true10000 | - | timeout | java.lang.Long | 10000 | - And I create a new JobStep from the existing creator - Then No exception was thrown - When I restart a job - And I query for the job with the name "TestJob" and I count 1 execution item and I confirm the executed job is finished within 20 seconds - And I search for the last job target in the database - Then I confirm the step index is 0 and status is "PROCESS_FAILED" - And I logout - - # ******************************************************* - # * Restarting a job with one Target and multiple Steps * - # ******************************************************* - - Scenario: Restarting job with two Bundle Start steps - Create a new job and set a disconnected KuraMock device as the job target. - Add a two new Bundle Start steps to the created job. Restart the job before starting. - After the executed job is finished, the executed target's step index should - be 0 and the status PROCESS_FAILED. - - Given I login as user with name "kapua-sys" and password "kapua-password" - And I start the Kura Mock - When Device is connected within 10 seconds - Then Device status is "CONNECTED" within 10 seconds - When KuraMock is disconnected - And I wait 1 second - Then Device status is "DISCONNECTED" within 10 seconds - And I select account "kapua-sys" - And I get the KuraMock device after 5 seconds - And I create a job with the name "TestJob" - And A new job target item - And Search for step definition with the name "Bundle Start" - And I prepare a JobStepCreator with the name "TestStep1" and the following properties - | name | type | value | - | bundleId | java.lang.String | 34 | - | timeout | java.lang.Long | 10000 | - And I create a new JobStep from the existing creator - And Search for step definition with the name "Bundle Start" - And I prepare a JobStepCreator with the name "TestStep2" and the following properties - | name | type | value | - | bundleId | java.lang.String | 77 | - | timeout | java.lang.Long | 10000 | - And I create a new JobStep from the existing creator - And I count the JobSteps and I find 2 JobStep within 30 seconds - Then No exception was thrown - When I restart a job - And I query for the job with the name "TestJob" and I count 1 execution item and I confirm the executed job is finished within 20 seconds - And I search for the last job target in the database - Then I confirm the step index is 0 and status is "PROCESS_FAILED" - And I logout - - Scenario: Restarting job with Bundle Stop and Bundle Start steps - Create a new job and set a disconnected KuraMock device as the job target. - Add a new Bundle Stop and Bundle Start steps to the created job. Restart the job before starting. - After the executed job is finished, the executed target's step index should - be 0 and the status PROCESS_FAILED. - - Given I login as user with name "kapua-sys" and password "kapua-password" - And I start the Kura Mock - And Device is connected within 10 seconds - Then Device status is "CONNECTED" within 10 seconds - When KuraMock is disconnected - And I wait 1 second - Then Device status is "DISCONNECTED" within 10 seconds - And I select account "kapua-sys" - And I get the KuraMock device after 5 seconds - And I create a job with the name "TestJob" - And A new job target item - And Search for step definition with the name "Bundle Start" - And I prepare a JobStepCreator with the name "TestStep1" and the following properties - | name | type | value | - | bundleId | java.lang.String | 34 | - | timeout | java.lang.Long | 10000 | - And I create a new JobStep from the existing creator - And Search for step definition with the name "Bundle Stop" - And I prepare a JobStepCreator with the name "TestStep2" and the following properties - | name | type | value | - | bundleId | java.lang.String | 77 | - | timeout | java.lang.Long | 10000 | - And I create a new JobStep from the existing creator - And I count the JobSteps and I find 2 JobStep within 30 seconds - Then No exception was thrown - When I restart a job - And I query for the job with the name "TestJob" and I count 1 execution item and I confirm the executed job is finished within 20 seconds - And I search for the last job target in the database - Then I confirm the step index is 0 and status is "PROCESS_FAILED" - And I logout - - Scenario: Restarting job with Package Download/Install and Bundle Start steps and multiple devices - Create a new job. Set a disconnected Kura Mock devices as a job targets. - Add a new Package Install and Bundle Start steps to the created job. Restart the job. - After the executed job is finished, the step index of executed targets should - be 0 and the status PROCESS_FAILED. - - Given I login as user with name "kapua-sys" and password "kapua-password" - And I start the Kura Mock - And Device is connected within 10 seconds - Then Device status is "CONNECTED" within 10 seconds - When KuraMock is disconnected - And I wait 1 second - Then Device status is "DISCONNECTED" within 10 seconds - And I select account "kapua-sys" - And I get the KuraMock device after 5 seconds - And I create a job with the name "TestJob" - And A new job target item - And Search for step definition with the name "Package Download / Install" - And I prepare a JobStepCreator with the name "TestStep1" and the following properties - | name | type | value | - | packageDownloadRequest | org.eclipse.kapua.service.device.management.packages.model.download.DevicePackageDownloadRequest | http://download.eclipse.org/kura/releases/3.2.0/org.eclipse.kura.demo.heater_1.0.300.dpheater1.0.300true | - | timeout | java.lang.Long | 10000 | - And I create a new JobStep from the existing creator - And Search for step definition with the name "Bundle Start" - And I prepare a JobStepCreator with the name "TestStep2" and the following properties - | name | type | value | - | bundleId | java.lang.String | 34 | - | timeout | java.lang.Long | 10000 | - And I create a new JobStep from the existing creator - And I count the JobSteps and I find 2 JobStep within 30 seconds - And I restart a job - And I query for the job with the name "TestJob" and I count 1 execution item and I confirm the executed job is finished within 20 seconds - And I search for the last job target in the database - Then I confirm the step index is 0 and status is "PROCESS_FAILED" - And I logout - - Scenario: Restarting a job with Package Uninstall and Bundle Start steps - Create a new job and set a disconnected KuraMock device as the job target. - Add a new Package Uninstall and Bundle Start steps to the created job. Restart the job. - After the executed job is finished, the executed target's step index should - be 0 and the status PROCESS_FAILED. - - Given I login as user with name "kapua-sys" and password "kapua-password" - And I start the Kura Mock - When Device is connected within 10 seconds - Then Device status is "CONNECTED" within 10 seconds - When KuraMock is disconnected - And I wait 1 second - Then Device status is "DISCONNECTED" within 10 seconds - And I select account "kapua-sys" - And I get the KuraMock device after 5 seconds - And I create a job with the name "TestJob" - And A new job target item - And Search for step definition with the name "Package Uninstall" - And I prepare a JobStepCreator with the name "TestStep1" and the following properties - | name | type | value | - | packageUninstallRequest | org.eclipse.kapua.service.device.management.packages.model.uninstall.DevicePackageUninstallRequest | org.eclipse.kura.example.ble.tisensortag1.0.0true10000 | - | timeout | java.lang.Long | 10000 | - And I create a new JobStep from the existing creator - And Search for step definition with the name "Bundle Start" - And I prepare a JobStepCreator with the name "TestStep2" and the following properties - | name | type | value | - | bundleId | java.lang.String | 34 | - | timeout | java.lang.Long | 10000 | - And I create a new JobStep from the existing creator - And I count the JobSteps and I find 2 JobStep within 30 seconds - When I restart a job - And I query for the job with the name "TestJob" and I count 1 execution item and I confirm the executed job is finished within 20 seconds - And I search for the last job target in the database - Then I confirm the step index is 0 and status is "PROCESS_FAILED" - And I logout - - Scenario: Restarting a job with Command Execution and Bundle Start steps - Create a new job and set a disconnected KuraMock device as the job target. - Add a new Command Execution and Bundle Stop steps to the created job. Restart the job. - After the executed job is finished, the executed target's step index should - be 0 and the status PROCESS_FAILED. - - Given I login as user with name "kapua-sys" and password "kapua-password" - And I start the Kura Mock - And Device is connected within 10 seconds - Then Device status is "CONNECTED" within 10 seconds - And KuraMock is disconnected - And I wait 1 second - Then Device status is "DISCONNECTED" within 10 seconds - And I select account "kapua-sys" - And I get the KuraMock device after 5 seconds - Given I create a job with the name "TestJob" - And A new job target item - And Search for step definition with the name "Command Execution" - And I prepare a JobStepCreator with the name "TestStep1" and the following properties - | name | type | value | - | commandInput | org.eclipse.kapua.service.device.management.command.DeviceCommandInput | pwd30000false | - | timeout | java.lang.Long | 10000 | - And I create a new JobStep from the existing creator - Then Search for step definition with the name "Bundle Start" - And I prepare a JobStepCreator with the name "TestStep2" and the following properties - | name | type | value | - | bundleId | java.lang.String | 34 | - | timeout | java.lang.Long | 10000 | - When I create a new JobStep from the existing creator - And I count the JobSteps and I find 2 JobStep within 30 seconds - And I restart a job - And I query for the job with the name "TestJob" and I count 1 execution item and I confirm the executed job is finished within 20 seconds - And I search for the last job target in the database - And I confirm the step index is 0 and status is "PROCESS_FAILED" - And I logout - - Scenario: Restarting a job with Asset Write and Bundle Start steps - Create a new job and set a disconnected KuraMock device as the job target. - Add a new Asset Write and Bundle Start steps to the created job. Restart the job. - After the executed job is finished, the executed target's step index should - be 0 and the status PROCESS_FAILED. - - Given I login as user with name "kapua-sys" and password "kapua-password" - And I start the Kura Mock - And Device is connected within 10 seconds - Then Device status is "CONNECTED" within 10 seconds - When KuraMock is disconnected - And I wait 1 second - Then Device status is "DISCONNECTED" within 10 seconds - And I select account "kapua-sys" - And I get the KuraMock device after 5 seconds - Given I create a job with the name "TestJob" - And A new job target item - And Search for step definition with the name "Asset Write" - And I prepare a JobStepCreator with the name "TestStep1" and the following properties - | name | type | value | - | assets | org.eclipse.kapua.service.device.management.asset.DeviceAssets | assetNamebinaryEGVzdCBzdHJpbmcgdmFsdWU=binaryTest | - | timeout | java.lang.Long | 10000 | - And I create a new JobStep from the existing creator - Then Search for step definition with the name "Bundle Start" - And I prepare a JobStepCreator with the name "TestStep2" and the following properties - | name | type | value | - | bundleId | java.lang.String | 34 | - | timeout | java.lang.Long | 10000 | - When I create a new JobStep from the existing creator - And I count the JobSteps and I find 2 JobStep within 30 seconds - And I restart a job - And I query for the job with the name "TestJob" and I count 1 execution item and I confirm the executed job is finished within 20 seconds - And I search for the last job target in the database - And I confirm the step index is 0 and status is "PROCESS_FAILED" - And I logout - - Scenario: Restarting a job with Configuration Put and Bundle Start steps - Create a new job and set a disconnected KuraMock device as the job target. - Add a new Configuration Put and Bundle Start steps to the created job. Restart the job. - After the executed job is finished, the executed target's step index should - be 0 and the status PROCESS_FAILED. - - Given I login as user with name "kapua-sys" and password "kapua-password" - And I start the Kura Mock - And Device is connected within 10 seconds - Then Device status is "CONNECTED" within 10 seconds - When KuraMock is disconnected - And I wait 1 second - Then Device status is "DISCONNECTED" within 10 seconds - And I select account "kapua-sys" - And I get the KuraMock device after 5 seconds - Given I create a job with the name "TestJob" - And A new job target item - And Search for step definition with the name "Configuration Put" - And I prepare a JobStepCreator with the name "TestStep1" and the following properties - | name | type | value | - | configuration | org.eclipse.kapua.service.device.management.configuration.DeviceConfiguration | org.eclipse.kura.demo.heater.Heater0.256022:00falseorg.eclipse.kura.demo.heater.Heaterorg.eclipse.kura.demo.heater.Heater06:00Programdata/21030.0213.030.0 | - | timeout | java.lang.Long | 10000 | - When I create a new JobStep from the existing creator - Then Search for step definition with the name "Bundle Start" - And I prepare a JobStepCreator with the name "TestStep2" and the following properties - | name | type | value | - | bundleId | java.lang.String | 34 | - | timeout | java.lang.Long | 10000 | - And I create a new JobStep from the existing creator - And I count the JobSteps and I find 2 JobStep within 30 seconds - And I restart a job - And I query for the job with the name "TestJob" and I count 1 execution item and I confirm the executed job is finished within 20 seconds - And I search for the last job target in the database - And I confirm the step index is 0 and status is "PROCESS_FAILED" - And I logout - - # ******************************************************* - # * Restarting a job with multiple Targets and one Step * - # ******************************************************* - - Scenario: Restarting job with Bundle Start step and multiple devices - Create a new job. Set a disconnected Kura Mock devices as a job targets. - Add a new Bundle Start step to the created job. Restart the job. - After the executed job is finished, the step index of executed targets should - be 0 and the status PROCESS_FAILED. - - Given I login as user with name "kapua-sys" and password "kapua-password" - And I add 2 devices to Kura Mock - And Devices are connected within 10 seconds - And I wait 1 second - Then Device status is "CONNECTED" within 10 seconds - When KuraMock is disconnected - And I wait 1 second - Then Device status is "DISCONNECTED" within 10 seconds - And I select account "kapua-sys" - And I get the KuraMock devices after 5 seconds - Given I create a job with the name "TestJob" - And I add targets to job - When I count the targets in the current scope - Then I count 2 - And Search for step definition with the name "Bundle Start" - And I prepare a JobStepCreator with the name "TestStep" and the following properties - | name | type | value | - | bundleId | java.lang.String | 34 | - | timeout | java.lang.Long | 50000 | - When I create a new JobStep from the existing creator - Then No exception was thrown - And I restart a job - And I query for the job with the name "TestJob" and I count 1 execution item and I confirm the executed job is finished within 20 seconds - And I search for the last job target in the database - And I confirm the step index is 0 and status is "PROCESS_FAILED" - And I logout - - Scenario: Restarting job with Bundle Stop step and multiple devices - Create a new job. Set a disconnected Kura Mock devices as a job targets. - Add a new Bundle Stop step to the created job. Restart the job. - After the executed job is finished, the step index of executed targets should - be 0 and the status PROCESS_FAILED. - - Given I login as user with name "kapua-sys" and password "kapua-password" - And I add 2 devices to Kura Mock - And Devices are connected within 10 seconds - And I wait 1 second - Then Device status is "CONNECTED" within 10 seconds - When KuraMock is disconnected - And I wait 1 second - Then Device status is "DISCONNECTED" within 10 seconds - And I select account "kapua-sys" - And I get the KuraMock devices after 5 seconds - Given I create a job with the name "TestJob" - And I add targets to job - When I count the targets in the current scope - Then I count 2 - And Search for step definition with the name "Bundle Stop" - And I prepare a JobStepCreator with the name "TestStep" and the following properties - | name | type | value | - | bundleId | java.lang.String | 34 | - | timeout | java.lang.Long | 50000 | - When I create a new JobStep from the existing creator - Then No exception was thrown - And I restart a job - And I query for the job with the name "TestJob" and I count 1 execution item and I confirm the executed job is finished within 20 seconds - And I search for the last job target in the database - And I confirm the step index is 0 and status is "PROCESS_FAILED" - And I logout - - Scenario: Restarting job with Package Download/Install step and multiple devices - Create a new job. Set a disconnected Kura Mock devices as a job targets. - Add a new Package Install step to the created job. Restart the job. - After the executed job is finished, the step index of executed targets should - be 0 and the status PROCESS_FAILED. - - Given I login as user with name "kapua-sys" and password "kapua-password" - And I add 2 devices to Kura Mock - And Devices are connected within 10 seconds - And I wait 1 second - Then Device status is "CONNECTED" within 10 seconds - When KuraMock is disconnected - And I wait 1 second - Then Device status is "DISCONNECTED" within 10 seconds - And I select account "kapua-sys" - And I get the KuraMock devices after 5 seconds - Given I create a job with the name "TestJob" - And I add targets to job - When I count the targets in the current scope - Then I count 2 - And Search for step definition with the name "Package Download / Install" - And I prepare a JobStepCreator with the name "TestStep" and the following properties - | name | type | value | - | packageDownloadRequest | org.eclipse.kapua.service.device.management.packages.model.download.DevicePackageDownloadRequest | http://download.eclipse.org/kura/releases/3.2.0/org.eclipse.kura.demo.heater_1.0.300.dpheater1.0.300true | - | timeout | java.lang.Long | 10000 | - When I create a new JobStep from the existing creator - Then No exception was thrown - And I restart a job - And I query for the job with the name "TestJob" and I count 1 execution item and I confirm the executed job is finished within 20 seconds - And I search for the last job target in the database - And I confirm the step index is 0 and status is "PROCESS_FAILED" - And I logout - - Scenario: Restarting job with Package Uninstall step and multiple device - Create a new job. Set a disconnected Kura Mock devices as a job targets. - Add a new Package Uninstall step to the created job. Restart the job. - After the executed job is finished, the step index of executed targets should - be 0 and the status PROCESS_FAILED. - - Given I login as user with name "kapua-sys" and password "kapua-password" - And I add 2 devices to Kura Mock - When Devices are connected within 10 seconds - And I wait 1 second - Then Device status is "CONNECTED" within 10 seconds - When KuraMock is disconnected - And I wait 1 second - Then Device status is "DISCONNECTED" within 10 seconds - And I select account "kapua-sys" - And I get the KuraMock devices after 5 seconds - Given I create a job with the name "TestJob" - And I add targets to job - When I count the targets in the current scope - Then I count 2 - And Search for step definition with the name "Package Uninstall" - And I prepare a JobStepCreator with the name "TestStep" and the following properties - | name | type | value | - | packageUninstallRequest | org.eclipse.kapua.service.device.management.packages.model.uninstall.DevicePackageUninstallRequest | heater1.0.300true30000 | - | timeout | java.lang.Long | 10000 | - When I create a new JobStep from the existing creator - Then No exception was thrown - And I restart a job - And I query for the job with the name "TestJob" and I count 1 execution item and I confirm the executed job is finished within 20 seconds - And I search for the last job target in the database - And I confirm the step index is 0 and status is "PROCESS_FAILED" - And I logout - - Scenario: Restarting job with Asset Write step and multiple devices - Create a new job. Set a disconnected Kura Mock devices as a job targets. - Add a new Asset Write step to the created job. Restart the job. - After the executed job is finished, the step index of executed targets should - be 0 and the status PROCESS_FAILED. - - Given I login as user with name "kapua-sys" and password "kapua-password" - And I add 2 devices to Kura Mock - And Devices are connected within 10 seconds - And I wait 1 second - Then Device status is "CONNECTED" within 10 seconds - When KuraMock is disconnected - And I wait 1 second - Then Device status is "DISCONNECTED" within 10 seconds - And I select account "kapua-sys" - And I get the KuraMock devices after 5 seconds - Given I create a job with the name "TestJob" - And I add targets to job - When I count the targets in the current scope - Then I count 2 - And Search for step definition with the name "Asset Write" - And I prepare a JobStepCreator with the name "TestStep" and the following properties - | name | type | value | - | assets | org.eclipse.kapua.service.device.management.asset.DeviceAssets | assetNamebinaryEGVzdCBzdHJpbmcgdmFsdWU=binaryTest | - | timeout | java.lang.Long | 10000 | - When I create a new JobStep from the existing creator - Then No exception was thrown - And I restart a job - And I query for the job with the name "TestJob" and I count 1 execution item and I confirm the executed job is finished within 20 seconds - And I search for the last job target in the database - And I confirm the step index is 0 and status is "PROCESS_FAILED" - And I logout - - Scenario: Restarting job with Configuration Put step and multiple devices - Create a new job. Set a disconnected Kura Mock devices as a job targets. - Add a new Configuration Put step to the created job. Restart the job. - After the executed job is finished, the step index of executed targets should - be 0 and the status PROCESS_FAILED. - - Given I login as user with name "kapua-sys" and password "kapua-password" - And I add 2 devices to Kura Mock - When Devices are connected within 10 seconds - And I wait 1 second - Then Device status is "CONNECTED" within 10 seconds - When KuraMock is disconnected - And I wait 1 second - Then Device status is "DISCONNECTED" within 10 seconds - And I select account "kapua-sys" - And I get the KuraMock devices after 5 seconds - Given I create a job with the name "TestJob" - And I add targets to job - When I count the targets in the current scope - Then I count 2 - And Search for step definition with the name "Configuration Put" - And I prepare a JobStepCreator with the name "TestStep" and the following properties - | name | type | value | - | configuration | org.eclipse.kapua.service.device.management.configuration.DeviceConfiguration | org.eclipse.kura.demo.heater.Heater0.256022:00falseorg.eclipse.kura.demo.heater.Heaterorg.eclipse.kura.demo.heater.Heater06:00Programdata/21030.0213.030.0 | - | timeout | java.lang.Long | 10000 | - When I create a new JobStep from the existing creator - Then No exception was thrown - And I restart a job - And I query for the job with the name "TestJob" and I count 1 execution item and I confirm the executed job is finished within 20 seconds - And I search for the last job target in the database - And I confirm the step index is 0 and status is "PROCESS_FAILED" - And I logout - - Scenario: Restarting job with Command Execution step and multiple devices - Create a new job. Set a disconnected Kura Mock devices as a job targets. - Add a new Command Execution step to the created job. Restart the job. - After the executed job is finished, the step index of executed targets should - be 0 and the status PROCESS_FAILED. - - Given I login as user with name "kapua-sys" and password "kapua-password" - And I add 2 devices to Kura Mock - And Devices are connected within 10 seconds - And I wait 1 second - Then Device status is "CONNECTED" within 10 seconds - When KuraMock is disconnected - And I wait 1 second - Then Device status is "DISCONNECTED" within 10 seconds - And I select account "kapua-sys" - And I get the KuraMock devices after 5 seconds - Given I create a job with the name "TestJob" - And I add targets to job - When I count the targets in the current scope - Then I count 2 - And Search for step definition with the name "Command Execution" - And I prepare a JobStepCreator with the name "TestStep" and the following properties - | name | type | value | - | commandInput | org.eclipse.kapua.service.device.management.command.DeviceCommandInput | pwd30000false | - | timeout | java.lang.Long | 10000 | - When I create a new JobStep from the existing creator - Then No exception was thrown - And I restart a job - And I query for the job with the name "TestJob" and I count 1 execution item and I confirm the executed job is finished within 20 seconds - And I search for the last job target in the database - And I confirm the step index is 0 and status is "PROCESS_FAILED" - And I logout - - # ************************************************************* - # * Restarting a job with multiple Targets and multiple Steps * - # ************************************************************* - - Scenario: Restarting job with two Bundle Start steps and multiple devices - Create a new job. Set a disconnected Kura Mock devices as a job targets. - Add a two Bundle Start steps to the created job. Start the job. - After the executed job is finished, the step index of executed targets should - be 0 and the status PROCESS_FAILED. - - Given I login as user with name "kapua-sys" and password "kapua-password" - And I add 2 devices to Kura Mock - And Devices are connected within 10 seconds - And I wait 1 second - Then Device status is "CONNECTED" within 10 seconds - When KuraMock is disconnected - And I wait 1 second - Then Device status is "DISCONNECTED" within 10 seconds - And I select account "kapua-sys" - And I get the KuraMock devices after 5 seconds - Given I create a job with the name "TestJob" - And I add targets to job - When I count the targets in the current scope - Then I count 2 - And Search for step definition with the name "Bundle Start" - And I prepare a JobStepCreator with the name "TestStep" and the following properties - | name | type | value | - | bundleId | java.lang.String | 34 | - | timeout | java.lang.Long | 50000 | - When I create a new JobStep from the existing creator - And Search for step definition with the name "Bundle Start" - And I prepare a JobStepCreator with the name "TestStep1" and the following properties - | name | type | value | - | bundleId | java.lang.String | 77 | - | timeout | java.lang.Long | 50000 | - When I create a new JobStep from the existing creator - And I count the JobSteps and I find 2 JobStep within 30 seconds - Then No exception was thrown - And I restart a job - And I query for the job with the name "TestJob" and I count 1 execution item and I confirm the executed job is finished within 20 seconds - And I search for the last job target in the database - And I confirm the step index is 0 and status is "PROCESS_FAILED" - And I logout - - Scenario: Restarting job with Bundle Stop and Bundle Start step and multiple devices - Create a new job. Set a disconnected Kura Mock devices as a job targets. - Add a new Bundle Stop and Bundle Start step to the created job. Restart the job. - After the executed job is finished, the step index of executed targets should - be 0 and the status PROCESS_FAILED. - - Given I login as user with name "kapua-sys" and password "kapua-password" - And I add 2 devices to Kura Mock - When Devices are connected within 10 seconds - And I wait 1 second - Then Device status is "CONNECTED" within 10 seconds - When KuraMock is disconnected - And I wait 1 second - Then Device status is "DISCONNECTED" within 10 seconds - And I select account "kapua-sys" - And I get the KuraMock devices after 5 seconds - Given I create a job with the name "TestJob" - And I add targets to job - When I count the targets in the current scope - Then I count 2 - And Search for step definition with the name "Bundle Stop" - And I prepare a JobStepCreator with the name "TestStep" and the following properties - | name | type | value | - | bundleId | java.lang.String | 34 | - | timeout | java.lang.Long | 10000 | - When I create a new JobStep from the existing creator - And Search for step definition with the name "Bundle Start" - And I prepare a JobStepCreator with the name "TestStep1" and the following properties - | name | type | value | - | bundleId | java.lang.String | 77 | - | timeout | java.lang.Long | 10000 | - When I create a new JobStep from the existing creator - And I count the JobSteps and I find 2 JobStep within 30 seconds - Then No exception was thrown - And I restart a job - Given I query for the job with the name "TestJob" and I count 1 execution item and I confirm the executed job is finished within 20 seconds - And I search for the last job target in the database - And I confirm the step index is 0 and status is "PROCESS_FAILED" - And I logout - - Scenario: Restarting job with Package Download/Install and Bundle Start steps and multiple devices - Create a new job. Set a disconnected Kura Mock devices as a job targets. - Add a new Package Install and Bundle Start steps to the created job. Restart the job. - After the executed job is finished, the step index of executed targets should - be 0 and the status PROCESS_FAILED. - - Given I login as user with name "kapua-sys" and password "kapua-password" - And I add 2 devices to Kura Mock - When Devices are connected within 10 seconds - And I wait 1 second - Then Device status is "CONNECTED" within 10 seconds - When KuraMock is disconnected - And I wait 1 second - Then Device status is "DISCONNECTED" within 10 seconds - And I select account "kapua-sys" - And I get the KuraMock devices after 5 seconds - Given I create a job with the name "TestJob" - And I add targets to job - When I count the targets in the current scope - Then I count 2 - And Search for step definition with the name "Package Download / Install" - And I prepare a JobStepCreator with the name "TestStep" and the following properties - | name | type | value | - | packageDownloadRequest | org.eclipse.kapua.service.device.management.packages.model.download.DevicePackageDownloadRequest | http://download.eclipse.org/kura/releases/3.2.0/org.eclipse.kura.demo.heater_1.0.300.dpheater1.0.300true | - | timeout | java.lang.Long | 10000 | - When I create a new JobStep from the existing creator - And Search for step definition with the name "Bundle Start" - And I prepare a JobStepCreator with the name "TestStep1" and the following properties - | name | type | value | - | bundleId | java.lang.String | 34 | - | timeout | java.lang.Long | 10000 | - When I create a new JobStep from the existing creator - And I count the JobSteps and I find 2 JobStep within 30 seconds - Then No exception was thrown - And I restart a job - Given I query for the job with the name "TestJob" and I count 1 execution item and I confirm the executed job is finished within 20 seconds - And I search for the last job target in the database - And I confirm the step index is 0 and status is "PROCESS_FAILED" - And I logout - - Scenario: Restarting job with Package Uninstall and Bundle start steps and multiple device - Create a new job. Set a disconnected Kura Mock devices as a job targets. - Add a new Package Uninstall and Bundle Start steps to the created job. Restart the job. - After the executed job is finished, the step index of executed targets should - be 0 and the status PROCESS_FAILED. - - Given I login as user with name "kapua-sys" and password "kapua-password" - And I add 2 devices to Kura Mock - When Devices are connected within 10 seconds - And I wait 1 second - Then Device status is "CONNECTED" within 10 seconds - When KuraMock is disconnected - And I wait 1 second - Then Device status is "DISCONNECTED" within 10 seconds - And I select account "kapua-sys" - And I get the KuraMock devices after 5 seconds - Given I create a job with the name "TestJob" - And I add targets to job - When I count the targets in the current scope - Then I count 2 - And Search for step definition with the name "Package Uninstall" - And I prepare a JobStepCreator with the name "TestStep" and the following properties - | name | type | value | - | packageUninstallRequest | org.eclipse.kapua.service.device.management.packages.model.uninstall.DevicePackageUninstallRequest | heater1.0.300true30000 | - | timeout | java.lang.Long | 10000 | - When I create a new JobStep from the existing creator - And Search for step definition with the name "Bundle Start" - And I prepare a JobStepCreator with the name "TestStep1" and the following properties - | name | type | value | - | bundleId | java.lang.String | 34 | - | timeout | java.lang.Long | 10000 | - When I create a new JobStep from the existing creator - And I count the JobSteps and I find 2 JobStep within 30 seconds - Then No exception was thrown - And I restart a job - Given I query for the job with the name "TestJob" and I count 1 execution item and I confirm the executed job is finished within 20 seconds - And I search for the last job target in the database - And I confirm the step index is 0 and status is "PROCESS_FAILED" - And I logout - - Scenario: Restarting job with Asset Write and Bundle Start steps and multiple devices - Create a new job. Set a disconnected Kura Mock devices as a job targets. - Add a new Asset Write and Bundle Start steps to the created job. Restart the job. - After the executed job is finished, the step index of executed targets should - be 0 and the status PROCESS_FAILED. - - Given I login as user with name "kapua-sys" and password "kapua-password" - And I add 2 devices to Kura Mock - When Devices are connected within 10 seconds - And I wait 1 second - Then Device status is "CONNECTED" within 10 seconds - When KuraMock is disconnected - And I wait 1 second - Then Device status is "DISCONNECTED" within 10 seconds - And I select account "kapua-sys" - And I get the KuraMock devices after 5 seconds - Given I create a job with the name "TestJob" - And I add targets to job - When I count the targets in the current scope - Then I count 2 - And Search for step definition with the name "Asset Write" - And I prepare a JobStepCreator with the name "TestStep" and the following properties - | name | type | value | - | assets | org.eclipse.kapua.service.device.management.asset.DeviceAssets | assetNamebinaryEGVzdCBzdHJpbmcgdmFsdWU=binaryTest | - | timeout | java.lang.Long | 10000 | - When I create a new JobStep from the existing creator - And Search for step definition with the name "Bundle Start" - And I prepare a JobStepCreator with the name "TestStep1" and the following properties - | name | type | value | - | bundleId | java.lang.String | 34 | - | timeout | java.lang.Long | 10000 | - When I create a new JobStep from the existing creator - And I count the JobSteps and I find 2 JobStep within 30 seconds - Then No exception was thrown - And I restart a job - Given I query for the job with the name "TestJob" and I count 1 execution item and I confirm the executed job is finished within 20 seconds - And I search for the last job target in the database - And I confirm the step index is 0 and status is "PROCESS_FAILED" - And I logout - - Scenario: Restarting job with Configuration Put and Bundle Start steps and multiple devices - Create a new job. Set a disconnected Kura Mock devices as a job targets. - Add a new Configuration Put and BundleStart steps to the created job. Restart the job. - After the executed job is finished, the step index of executed targets should - be 0 and the status PROCESS_FAILED. - - Given I login as user with name "kapua-sys" and password "kapua-password" - And I add 2 devices to Kura Mock - When Devices are connected within 10 seconds - And I wait 1 second - Then Device status is "CONNECTED" within 10 seconds - When KuraMock is disconnected - And I wait 1 second - Then Device status is "DISCONNECTED" within 10 seconds - And I select account "kapua-sys" - And I get the KuraMock devices after 5 seconds - Given I create a job with the name "TestJob" - And I add targets to job - When I count the targets in the current scope - Then I count 2 - And Search for step definition with the name "Configuration Put" - And I prepare a JobStepCreator with the name "TestStep" and the following properties - | name | type | value | - | configuration | org.eclipse.kapua.service.device.management.configuration.DeviceConfiguration | org.eclipse.kura.demo.heater.Heater0.256022:00falseorg.eclipse.kura.demo.heater.Heaterorg.eclipse.kura.demo.heater.Heater06:00Programdata/21030.0213.030.0 | - | timeout | java.lang.Long | 10000 | - When I create a new JobStep from the existing creator - And Search for step definition with the name "Bundle Start" - And I prepare a JobStepCreator with the name "TestStep1" and the following properties - | name | type | value | - | bundleId | java.lang.String | 34 | - | timeout | java.lang.Long | 10000 | - When I create a new JobStep from the existing creator - And I count the JobSteps and I find 2 JobStep within 30 seconds - Then No exception was thrown - And I restart a job - Given I query for the job with the name "TestJob" and I count 1 execution item and I confirm the executed job is finished within 20 seconds - And I search for the last job target in the database - And I confirm the step index is 0 and status is "PROCESS_FAILED" - And I logout - - Scenario: Restarting job with Command Execution and Bundle Start steps and multiple devices - Create a new job. Set a disconnected Kura Mock devices as a job targets. - Add a new Command Execution and Bundle Start steps to the created job. Restart the job. - After the executed job is finished, the step index of executed targets should - be 0 and the status PROCESS_FAILED. - - Given I login as user with name "kapua-sys" and password "kapua-password" - And I add 2 devices to Kura Mock - When Devices are connected within 10 seconds - And I wait 1 second - Then Device status is "CONNECTED" within 10 seconds - When KuraMock is disconnected - And I wait 1 second - Then Device status is "DISCONNECTED" within 10 seconds - And I select account "kapua-sys" - And I get the KuraMock devices after 5 seconds - Given I create a job with the name "TestJob" - And I add targets to job - When I count the targets in the current scope - Then I count 2 - And Search for step definition with the name "Command Execution" - And I prepare a JobStepCreator with the name "TestStep" and the following properties - | name | type | value | - | commandInput | org.eclipse.kapua.service.device.management.command.DeviceCommandInput | pwd30000false | - | timeout | java.lang.Long | 10000 | - When I create a new JobStep from the existing creator - And Search for step definition with the name "Bundle Start" - And I prepare a JobStepCreator with the name "TestStep1" and the following properties - | name | type | value | - | bundleId | java.lang.String | 34 | - | timeout | java.lang.Long | 10000 | - When I create a new JobStep from the existing creator - And I count the JobSteps and I find 2 JobStep within 30 seconds - Then No exception was thrown - And I restart a job - Given I query for the job with the name "TestJob" and I count 1 execution item and I confirm the executed job is finished within 20 seconds - And I search for the last job target in the database - And I confirm the step index is 0 and status is "PROCESS_FAILED" - And I logout - - @teardown - Scenario: Tear down test resources - Given Stop Docker environment - And Clean Locator Instance diff --git a/qa/integration/src/test/resources/features/jobEngine/JobEngineServiceRestartOnlineDeviceI9n.feature b/qa/integration/src/test/resources/features/jobEngine/JobEngineServiceRestartOnlineDeviceI9n.feature deleted file mode 100644 index b7143da3e38..00000000000 --- a/qa/integration/src/test/resources/features/jobEngine/JobEngineServiceRestartOnlineDeviceI9n.feature +++ /dev/null @@ -1,507 +0,0 @@ -############################################################################### -# Copyright (c) 2019, 2024 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 -############################################################################### -@env_docker -@it -@jobEngineRestartOnlineDevice - -Feature: JobEngineService restart job tests with online device - - @setup - Scenario: Setup test resources - Given Init Security Context - And Start Docker environment with resources - | db | - | events-broker | - | job-engine | - | message-broker | - | broker-auth-service | - | consumer-lifecycle | - - # ************************************************* - # * Restarting a job with one Target and one Step * - # ************************************************* - - Scenario: Restarting job with valid Command Execution step two times - Create a new job and set a connected KuraMock device as the job target. - Add a new valid Command Execution step to the created job. Restart the job two times. - After the executed job is finished, the executed target's step index should - be 0 and the status PROCESS_OK - - Given I login as user with name "kapua-sys" and password "kapua-password" - And I start the Kura Mock - When Device is connected within 10 seconds - Then Device status is "CONNECTED" within 10 seconds - And I select account "kapua-sys" - And I get the KuraMock device after 5 seconds - When I search for events from device "rpione3" in account "kapua-sys" I find 1 event within 30 seconds - And The type of the last event is "BIRTH" - And I create a job with the name "TestJob" - And I create a new job target item - And Search for step definition with the name "Command Execution" - And I prepare a JobStepCreator with the name "TestStep" and the following properties - | name | type | value | - | commandInput | org.eclipse.kapua.service.device.management.command.DeviceCommandInput | pwd30000false | - | timeout | java.lang.Long | 10000 | - And I create a new JobStep from the existing creator - Then I restart a job - And I confirm job target has step index 0 and status "PROCESS_OK" within 31 seconds - And I query for the job with the name "TestJob" and I count 1 execution item and I confirm the executed job is finished within 20 seconds - Then I restart a job - And I confirm job target has step index 0 and status "PROCESS_OK" within 31 seconds - Given I query for the job with the name "TestJob" and I count 2 execution items and I confirm the executed jobs are finished within 45 seconds - When I search for events from device "rpione3" in account "kapua-sys" I find 2 or more events within 30 seconds - Then KuraMock is disconnected - And I logout - - Scenario: Restarting job with valid Bundle Start step two times - Create a new job and set a connected KuraMock device as the job target. - Add a new Bundle Start step to the created job. Restart the job two times. - After the executed job is finished, the executed target's step index should - be 0 and the status PROCESS_OK - - Given I login as user with name "kapua-sys" and password "kapua-password" - And I start the Kura Mock - And Device is connected within 10 seconds - Then Device status is "CONNECTED" within 10 seconds - And I select account "kapua-sys" - And I get the KuraMock device after 5 seconds - And Bundles are requested - Then A bundle named "slf4j.api" with id 34 and version "1.7.21" is present and "RESOLVED" - When I search for events from device "rpione3" in account "kapua-sys" I find 2 events within 30 seconds - And The type of the last event is "BUNDLE" - Given I create a job with the name "TestJob" - And I create a new job target item - And Search for step definition with the name "Bundle Start" - And I prepare a JobStepCreator with the name "TestStep" and the following properties - | name | type | value | - | bundleId | java.lang.String | 34 | - | timeout | java.lang.Long | 10000 | - When I create a new JobStep from the existing creator - Then No exception was thrown - And I restart a job - And I confirm job target has step index 0 and status "PROCESS_OK" within 31 seconds - Given I query for the job with the name "TestJob" and I count 1 execution item and I confirm the executed job is finished within 20 seconds - Then I restart a job - And I confirm job target has step index 0 and status "PROCESS_OK" within 31 seconds - Given I query for the job with the name "TestJob" and I count 2 execution items and I confirm the executed jobs are finished within 45 seconds - When I search for events from device "rpione3" in account "kapua-sys" I find 3 or more events within 30 seconds - And Bundles are requested - Then A bundle named "slf4j.api" with id 34 and version "1.7.21" is present and "ACTIVE" - And KuraMock is disconnected - And I logout - - Scenario: Restarting job with valid Bundle Stop step two times - Create a new job and set a connected KuraMock device as the job target. - Add a new valid Bundle Stop step to the created job. Restart the job two times. - After the executed job is finished, the executed target's step index should - be 0 and the status PROCESS_OK - - Given I login as user with name "kapua-sys" and password "kapua-password" - And I start the Kura Mock - And Device is connected within 10 seconds - Then Device status is "CONNECTED" within 10 seconds - And I select account "kapua-sys" - And I get the KuraMock device after 5 seconds - And Bundles are requested - And A bundle named "org.eclipse.kura.linux.bluetooth" with id 77 and version "1.0.300" is present and "ACTIVE" - When I search for events from device "rpione3" in account "kapua-sys" I find 2 events within 30 seconds - And The type of the last event is "BUNDLE" - Given I create a job with the name "TestJob" - And I create a new job target item - And Search for step definition with the name "Bundle Stop" - And I prepare a JobStepCreator with the name "TestStep" and the following properties - | name | type | value | - | bundleId | java.lang.String | 77 | - | timeout | java.lang.Long | 10000 | - When I create a new JobStep from the existing creator - Then No exception was thrown - And I restart a job - And I confirm job target has step index 0 and status "PROCESS_OK" within 31 seconds - Given I query for the job with the name "TestJob" and I count 1 execution item and I confirm the executed job is finished within 20 seconds - Then I restart a job - And I confirm job target has step index 0 and status "PROCESS_OK" within 31 seconds - Given I query for the job with the name "TestJob" and I count 2 execution items and I confirm the executed jobs are finished within 45 seconds - When I search for events from device "rpione3" in account "kapua-sys" I find 3 or more events within 30 seconds - Then Bundles are requested - And A bundle named "org.eclipse.kura.linux.bluetooth" with id 77 and version "1.0.300" is present and "RESOLVED" - And KuraMock is disconnected - And I logout - - Scenario: Restarting a job with valid Package Uninstall step two times - Create a new job and set a connected KuraMock device as the job target. - Add a new valid Package Uninstall step to the created job. Restart the job two times. - After the executed job is finished, the executed target's step index should - be 0 and the status PROCESS_OK - - Given I login as user with name "kapua-sys" and password "kapua-password" - And I start the Kura Mock - And Device is connected within 10 seconds - Then Device status is "CONNECTED" within 10 seconds - And I select account "kapua-sys" - And I get the KuraMock device after 5 seconds - Then Packages are requested and 1 package is received - And I search for events from device "rpione3" in account "kapua-sys" I find 2 events within 30 seconds - And The type of the last event is "DEPLOY" - Given I create a job with the name "TestJob" - And I create a new job target item - And Search for step definition with the name "Package Uninstall" - And I prepare a JobStepCreator with the name "TestStep" and the following properties - | name | type | value | - | packageUninstallRequest | org.eclipse.kapua.service.device.management.packages.model.uninstall.DevicePackageUninstallRequest | org.eclipse.kura.example.beacon1.0.300true10000 | - | timeout | java.lang.Long | 10000 | - When I create a new JobStep from the existing creator - Then I restart a job - And I confirm job target has step index 0 and status "PROCESS_OK" within 31 seconds - Given I query for the job with the name "TestJob" and I count 1 execution items or more and I confirm the executed jobs are finished within 45 seconds - Then I restart a job - And I confirm job target has step index 0 and status "PROCESS_OK" within 31 seconds - Given I query for the job with the name "TestJob" and I count 2 execution items or more and I confirm the executed jobs are finished within 45 seconds - And I search for events from device "rpione3" in account "kapua-sys" I find 2 or more events within 30 seconds - Then Packages are requested and 0 packages are received - And KuraMock is disconnected - And I logout - - #******************************************************* - #* Restarting a job with one Target and multiple Steps * - #******************************************************* - - Scenario: Restarting job with valid Command Execution and Package Install steps two times - Create a new job and set a connected KuraMock device as the job target. - Add new valid Command Execution and valid Package Install steps to the created job. - Restart the job two times. After the executed job is finished, the executed target's - step index should be 1 and the status PROCESS_OK - - Given I login as user with name "kapua-sys" and password "kapua-password" - And I start the Kura Mock - When Device is connected within 10 seconds - Then Device status is "CONNECTED" within 10 seconds - And I select account "kapua-sys" - And I get the KuraMock device after 5 seconds - And Command "pwd" is executed - And Packages are requested and 1 package is received - When I search for events from device "rpione3" in account "kapua-sys" I find 3 events within 30 seconds - And The type of the last event is "DEPLOY" - Given I create a job with the name "TestJob" - And I create a new job target item - And I search for step definition with the name - | Command Execution | - | Package Download / Install | - And I prepare a JobStepCreator with the name "TestStep1" and properties - | name | type | value | - | commandInput | org.eclipse.kapua.service.device.management.command.DeviceCommandInput | pwd30000false | - | packageDownloadRequest | org.eclipse.kapua.service.device.management.packages.model.download.DevicePackageDownloadRequest | http://download.eclipse.org/kura/releases/3.2.0/org.eclipse.kura.example.publisher_1.0.300.dpExample Publisher1.0.300true | - | timeout | java.lang.Long | 10000 | - And I create multiple new JobSteps from the existing creators - Then No exception was thrown - And I count the JobSteps and I find 2 JobStep within 30 seconds - Then I restart a job - And I confirm job target has step index 1 and status "PROCESS_OK" within 31 seconds - Given I query for the job with the name "TestJob" and I count 1 execution items or more and I confirm the executed jobs are finished within 45 seconds - Then I restart a job - And I confirm job target has step index 1 and status "PROCESS_OK" within 31 seconds - Given I query for the job with the name "TestJob" and I count 2 execution items or more and I confirm the executed jobs are finished within 45 seconds - When I search for events from device "rpione3" in account "kapua-sys" I find 3 or more events within 30 seconds - Then KuraMock is disconnected - And I logout - - Scenario: Restarting job with valid Bundle Start And Bundle Stop steps two times - Create a new job and set a connected KuraMock device as the job target. - Add new Bundle Start and Bundle Stop steps to the created job. Restart the job two times. - After the executed job is finished, the executed target's step index should - be 1 and the status PROCESS_OK - - Given I login as user with name "kapua-sys" and password "kapua-password" - And I start the Kura Mock - And Device is connected within 10 seconds - And Device status is "CONNECTED" within 10 seconds - And I select account "kapua-sys" - And I get the KuraMock device after 5 seconds - And Bundles are requested - Then A bundle named "slf4j.api" with id 34 and version "1.7.21" is present and "RESOLVED" - And A bundle named "org.eclipse.kura.linux.bluetooth" with id 77 and version "1.0.300" is present and "ACTIVE" - When I search for events from device "rpione3" in account "kapua-sys" I find 2 events within 30 seconds - And The type of the last event is "BUNDLE" - Given I create a job with the name "TestJob" - And I create a new job target item - And Search for step definition with the name "Bundle Start" - And I prepare a JobStepCreator with the name "TestStep" and the following properties - | name | type | value | - | bundleId | java.lang.String | 34 | - | timeout | java.lang.Long | 10000 | - When I create a new JobStep from the existing creator - And Search for step definition with the name "Bundle Stop" - And I prepare a JobStepCreator with the name "TestStep2" and the following properties - | name | type | value | - | bundleId | java.lang.String | 77 | - | timeout | java.lang.Long | 10000 | - When I create a new JobStep from the existing creator - Then No exception was thrown - And I count the JobSteps and I find 2 JobStep within 30 seconds - And I restart a job - And I confirm job target has step index 1 and status "PROCESS_OK" within 31 seconds - Given I query for the job with the name "TestJob" and I count 1 execution item and I confirm the executed job is finished within 20 seconds - Then I restart a job - And I confirm job target has step index 1 and status "PROCESS_OK" within 31 seconds - Given I query for the job with the name "TestJob" and I count 2 execution items and I confirm the executed jobs are finished within 45 seconds - When I search for events from device "rpione3" in account "kapua-sys" I find 4 or more events within 30 seconds - And Bundles are requested - Then A bundle named "slf4j.api" with id 34 and version "1.7.21" is present and "ACTIVE" - And A bundle named "org.eclipse.kura.linux.bluetooth" with id 77 and version "1.0.300" is present and "RESOLVED" - And KuraMock is disconnected - And I logout - - #******************************************************* - #* Restarting a job with multiple Targets and one Step * - #******************************************************* - - Scenario: Restarting job with valid Command Execution step and multiple devices two times - Create a new job and set a connected KuraMock devices as the job targets. - Add a new valid Command Execution step to the created job. Restart the job two times. - After the executed job is finished, the executed target's step index should - be 0 and the status PROCESS_OK - - Given I login as user with name "kapua-sys" and password "kapua-password" - And I add 2 devices to Kura Mock - When Devices are connected within 10 seconds - And I wait 1 second - Then Devices status is "CONNECTED" within 10 seconds - And I select account "kapua-sys" - And I get the KuraMock devices after 5 seconds - And Command "pwd" is executed - When I search events from devices in account "kapua-sys" and 2 events are found - And The type of the last event is "COMMAND" - Given I create a job with the name "TestJob" - And I add targets to job - And Search for step definition with the name "Command Execution" - And I prepare a JobStepCreator with the name "TestStep" and the following properties - | name | type | value | - | commandInput | org.eclipse.kapua.service.device.management.command.DeviceCommandInput | pwd30000false | - | timeout | java.lang.Long | 10000 | - And I create a new JobStep from the existing creator - Then I restart a job - And I confirm job target has step index 0 and status "PROCESS_OK" within 31 seconds - Given I query for the job with the name "TestJob" and I count 1 execution item and I confirm the executed job is finished within 20 seconds - Then I restart a job - And I confirm job target has step index 0 and status "PROCESS_OK" within 31 seconds - Given I query for the job with the name "TestJob" and I count 2 execution items and I confirm the executed jobs are finished within 45 seconds - When I search events from devices in account "kapua-sys" and 3 or more events are found - Then KuraMock is disconnected - And I logout - - Scenario: Restarting job with valid Bundle Start step and multiple devices two times - Create a new job and set a connected KuraMock devices as the job targets. - Add a new Bundle Start step to the created job. Restart the job two times. - After the executed job is finished, the executed target's step index should - be 0 and the status PROCESS_OK - - Given I login as user with name "kapua-sys" and password "kapua-password" - And I add 2 devices to Kura Mock - And Devices are connected within 10 seconds - And I wait 1 second - Then Device status is "CONNECTED" within 10 seconds - And I select account "kapua-sys" - And I get the KuraMock devices after 5 seconds - And Bundles are requested - Then A bundle named "slf4j.api" with id 34 and version "1.7.21" is present and "RESOLVED" - When I search events from devices in account "kapua-sys" and 2 events are found - And The type of the last event is "BUNDLE" - Given I create a job with the name "TestJob" - And I add targets to job - And Search for step definition with the name "Bundle Start" - And I prepare a JobStepCreator with the name "TestStep" and the following properties - | name | type | value | - | bundleId | java.lang.String | 34 | - | timeout | java.lang.Long | 10000 | - When I create a new JobStep from the existing creator - Then No exception was thrown - And I restart a job - And I confirm job target has step index 0 and status "PROCESS_OK" within 31 seconds - Given I query for the job with the name "TestJob" and I count 1 execution item and I confirm the executed job is finished within 20 seconds - Then I restart a job - And I confirm job target has step index 0 and status "PROCESS_OK" within 31 seconds - Given I query for the job with the name "TestJob" and I count 2 execution items and I confirm the executed jobs are finished within 45 seconds - When I search events from devices in account "kapua-sys" and 3 or more events are found - And Bundles are requested - Then A bundle named "slf4j.api" with id 34 and version "1.7.21" is present and "ACTIVE" - And KuraMock is disconnected - And I logout - - Scenario: Restarting job with valid Bundle Stop step and multiple devices two times - Create a new job and set a connected KuraMock devices as the job targets. - Add a new valid Bundle Stop step to the created job. Restart the job two times. - After the executed job is finished, the executed target's step index should - be 0 and the status PROCESS_OK - - Given I login as user with name "kapua-sys" and password "kapua-password" - And I add 2 devices to Kura Mock - And Devices are connected within 10 seconds - And I wait 1 second - Then Device status is "CONNECTED" within 10 seconds - And I select account "kapua-sys" - And I get the KuraMock devices after 5 seconds - And Bundles are requested - And A bundle named "org.eclipse.kura.linux.bluetooth" with id 77 and version "1.0.300" is present and "ACTIVE" - When I search events from devices in account "kapua-sys" and 2 events are found - And The type of the last event is "BUNDLE" - Given I create a job with the name "TestJob" - And I add targets to job - And Search for step definition with the name "Bundle Stop" - And I prepare a JobStepCreator with the name "TestStep" and the following properties - | name | type | value | - | bundleId | java.lang.String | 77 | - | timeout | java.lang.Long | 10000 | - When I create a new JobStep from the existing creator - Then No exception was thrown - And I restart a job - And I confirm job target has step index 0 and status "PROCESS_OK" within 31 seconds - Given I query for the job with the name "TestJob" and I count 1 execution item and I confirm the executed job is finished within 20 seconds - Then I restart a job - And I confirm job target has step index 0 and status "PROCESS_OK" within 31 seconds - Given I query for the job with the name "TestJob" and I count 2 execution items and I confirm the executed jobs are finished within 45 seconds - When I search events from devices in account "kapua-sys" and 3 or more events are found - Then Bundles are requested - And A bundle named "org.eclipse.kura.linux.bluetooth" with id 77 and version "1.0.300" is present and "RESOLVED" - And KuraMock is disconnected - And I logout - - Scenario: Restarting a job with valid Package Uninstall step and multiple devices two times - Create a new job and set a connected KuraMock devices as the job targets. - Add a new valid Package Uninstall step to the created job. Restart the job two times. - After the executed job is finished, the executed target's step index should - be 0 and the status PROCESS_OK - - Given I login as user with name "kapua-sys" and password "kapua-password" - And I add 2 devices to Kura Mock - And Devices are connected within 10 seconds - And I wait 1 second - Then Devices status is "CONNECTED" within 10 seconds - And I select account "kapua-sys" - And I get the KuraMock device after 5 seconds - Then Packages are requested and 1 package is received - And I search events from devices in account "kapua-sys" and 2 events are found - And The type of the last event is "DEPLOY" - Given I create a job with the name "TestJob" - And I add targets to job - And Search for step definition with the name "Package Uninstall" - And I prepare a JobStepCreator with the name "TestStep" and the following properties - | name | type | value | - | packageUninstallRequest | org.eclipse.kapua.service.device.management.packages.model.uninstall.DevicePackageUninstallRequest | org.eclipse.kura.example.beacon1.0.300true10000 | - | timeout | java.lang.Long | 10000 | - When I create a new JobStep from the existing creator - Then I restart a job - And I confirm job target has step index 0 and status "PROCESS_OK" within 31 seconds - Given I query for the job with the name "TestJob" and I count 1 execution items or more and I confirm the executed jobs are finished within 45 seconds - Then I restart a job - And I confirm job target has step index 0 and status "PROCESS_OK" within 31 seconds - Given I query for the job with the name "TestJob" and I count 2 execution items or more and I confirm the executed jobs are finished within 45 seconds - And I search events from devices in account "kapua-sys" and 2 or more events are found - And Packages are requested and 0 packages are received - And KuraMock is disconnected - And I logout - - # ************************************************************* - # * Restarting a job with multiple Targets and multiple Steps * - # ************************************************************* - - Scenario: Restarting job with valid Command Execution and Package Install steps and multiple devices two times - Create a new job and set a connected KuraMock devices as the job targets. - Add a new valid Command Execution and valid Package Install steps to the created job. - Restart the job two times. After the executed job is finished, the executed target's - step index should be 1 and the status PROCESS_OK - - Given I login as user with name "kapua-sys" and password "kapua-password" - And I add 2 devices to Kura Mock - When Devices are connected within 10 seconds - And I wait 1 second - Then Devices status is "CONNECTED" within 10 seconds - And I select account "kapua-sys" - And I get the KuraMock devices after 5 seconds - And Command "pwd" is executed - And Packages are requested and 1 package is received - When I search events from devices in account "kapua-sys" and 3 events are found - And The type of the last event is "DEPLOY" - Given I create a job with the name "TestJob" - And I add targets to job - And I search for step definition with the name - | Command Execution | - | Package Download / Install | - And I prepare a JobStepCreator with the name "TestStep1" and properties - | name | type | value | - | commandInput | org.eclipse.kapua.service.device.management.command.DeviceCommandInput | pwd30000false | - | packageDownloadRequest | org.eclipse.kapua.service.device.management.packages.model.download.DevicePackageDownloadRequest | http://download.eclipse.org/kura/releases/3.2.0/org.eclipse.kura.example.publisher_1.0.300.dpExample Publisher1.0.300true | - | timeout | java.lang.Long | 10000 | - And I create multiple new JobSteps from the existing creators - Then No exception was thrown - And I count the JobSteps and I find 2 JobStep within 30 seconds - Then I restart a job - And I confirm job target has step index 1 and status "PROCESS_OK" within 31 seconds - Given I query for the job with the name "TestJob" and I count 1 execution items or more and I confirm the executed jobs are finished within 45 seconds - Then I restart a job - And I confirm job target has step index 1 and status "PROCESS_OK" within 31 seconds - Given I query for the job with the name "TestJob" and I count 2 execution items or more and I confirm the executed jobs are finished within 45 seconds - When I search events from devices in account "kapua-sys" and 3 or more events are found - And Packages are requested and 2 packages are received - Then KuraMock is disconnected - And I logout - - Scenario: Restarting job with valid Bundle Start and Bundle Stop steps and multiple devices two times - Create a new job and set a connected KuraMock devices as the job targets. - Add a new valid Bundle Start and Bundle Stop steps to the created job. Restart the job two times. - After the executed job is finished, the executed target's step index should - be 1 and the status PROCESS_OK - - Given I login as user with name "kapua-sys" and password "kapua-password" - And I add 2 devices to Kura Mock - And Devices are connected within 10 seconds - And I wait 1 second - Then Devices status is "CONNECTED" within 10 seconds - And I select account "kapua-sys" - And I get the KuraMock devices after 5 seconds - And Bundles are requested - Then A bundle named "slf4j.api" with id 34 and version "1.7.21" is present and "RESOLVED" - And A bundle named "org.eclipse.kura.linux.bluetooth" with id 77 and version "1.0.300" is present and "ACTIVE" - When I search events from devices in account "kapua-sys" and 2 events are found - And The type of the last event is "BUNDLE" - Given I create a job with the name "TestJob" - And I add targets to job - And Search for step definition with the name "Bundle Start" - And I prepare a JobStepCreator with the name "TestStep" and the following properties - | name | type | value | - | bundleId | java.lang.String | 34 | - | timeout | java.lang.Long | 10000 | - When I create a new JobStep from the existing creator - And Search for step definition with the name "Bundle Stop" - And I prepare a JobStepCreator with the name "TestStep2" and the following properties - | name | type | value | - | bundleId | java.lang.String | 77 | - | timeout | java.lang.Long | 10000 | - When I create a new JobStep from the existing creator - Then No exception was thrown - And I count the JobSteps and I find 2 JobStep within 30 seconds - And I restart a job - And I confirm job target has step index 1 and status "PROCESS_OK" within 31 seconds - Given I query for the job with the name "TestJob" and I count 1 execution item and I confirm the executed job is finished within 20 seconds - Then I restart a job - And I confirm job target has step index 1 and status "PROCESS_OK" within 31 seconds - Given I query for the job with the name "TestJob" and I count 2 execution items and I confirm the executed jobs are finished within 45 seconds - When I search events from devices in account "kapua-sys" and 4 or more events are found - And Bundles are requested - Then A bundle named "slf4j.api" with id 34 and version "1.7.21" is present and "ACTIVE" - And A bundle named "org.eclipse.kura.linux.bluetooth" with id 77 and version "1.0.300" is present and "RESOLVED" - And KuraMock is disconnected - And I logout - - @teardown - Scenario: Tear down test resources - Given Stop Docker environment - And Clean Locator Instance diff --git a/qa/integration/src/test/resources/features/jobEngine/JobEngineServiceRestartOnlineDeviceSecondPartI9n.feature b/qa/integration/src/test/resources/features/jobEngine/JobEngineServiceRestartOnlineDeviceSecondPartI9n.feature deleted file mode 100644 index 091abf4b764..00000000000 --- a/qa/integration/src/test/resources/features/jobEngine/JobEngineServiceRestartOnlineDeviceSecondPartI9n.feature +++ /dev/null @@ -1,434 +0,0 @@ -############################################################################### -# Copyright (c) 2019, 2024 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 -############################################################################### -@env_docker -@it -@jobEngineRestartOnlineDeviceSecondPart - -Feature: JobEngineService restart job tests with online device - second part - - @setup - Scenario: Setup test resources - Given Init Security Context - And Start Docker environment with resources - | db | - | events-broker | - | job-engine | - | message-broker | - | broker-auth-service | - | consumer-lifecycle | - - # ************************************************* - # * Restarting a job with one Target and one Step * - # ************************************************* - - Scenario: Restarting a job with valid Configuration Put step two times - Create a new job and set a connected KuraMock device as the job target. - Add a new valid Configuration Put step to the created job. Restart the job two times. - After the executed job is finished, the executed target's step index should - be 0 and the status PROCESS_OK - - Given I login as user with name "kapua-sys" and password "kapua-password" - And I start the Kura Mock - When Device is connected within 10 seconds - Then Device status is "CONNECTED" within 10 seconds - And I select account "kapua-sys" - And I get the KuraMock device after 5 seconds - Then Configuration is requested - And A Configuration named "org.eclipse.kura.clock.ClockService" has property "clock.ntp.retry.interval" with value "5" - When I search for events from device "rpione3" in account "kapua-sys" I find 2 events within 30 seconds - And The type of the last event is "CONFIGURATION" - Given I create a job with the name "TestJob" - And I create a new job target item - And Search for step definition with the name "Configuration Put" - And I prepare a JobStepCreator with the name "TestStep" and the following properties - | name | type | value | - | configuration | org.eclipse.kapua.service.device.management.configuration.DeviceConfiguration | org.eclipse.kura.clock.ClockService>0.pool.ntp.orgjava-ntp12303600truetrue1000010 | - | timeout | java.lang.Long | 10000 | - Then I create a new JobStep from the existing creator - And I restart a job - And I confirm job target has step index 0 and status "PROCESS_OK" within 31 seconds - When I query for the job with the name "TestJob" and I count 1 execution item and I confirm the executed job is finished within 20 seconds - Then I restart a job - And I confirm job target has step index 0 and status "PROCESS_OK" within 31 seconds - When I query for the job with the name "TestJob" and I count 2 execution items and I confirm the executed jobs are finished within 45 seconds - When I search for events from device "rpione3" in account "kapua-sys" I find 3 or more events within 30 seconds - Then Configuration is requested - And A Configuration named "org.eclipse.kura.clock.ClockService" has property "clock.ntp.retry.interval" with value "10" - And KuraMock is disconnected - And I logout - - Scenario: Restarting a job with valid Package Install step two times - Create a new job and set a connected KuraMock device as the job target. - Add a new valid Package Install step to the created job. Restart the job two times. - After the executed job is finished, the executed target's step index should - be 0 and the status PROCESS_OK - - Given I login as user with name "kapua-sys" and password "kapua-password" - And I start the Kura Mock - And Device is connected within 10 seconds - Then Device status is "CONNECTED" within 10 seconds - And I select account "kapua-sys" - And I get the KuraMock device after 5 seconds - And Packages are requested and 1 package is received - When I search for events from device "rpione3" in account "kapua-sys" I find 2 events within 30 seconds - And The type of the last event is "DEPLOY" - Given I create a job with the name "TestJob" - And I create a new job target item - And Search for step definition with the name "Package Download / Install" - And I prepare a JobStepCreator with the name "TestStep" and the following properties - | name | type | value | - | packageDownloadRequest | org.eclipse.kapua.service.device.management.packages.model.download.DevicePackageDownloadRequest | http://download.eclipse.org/kura/releases/3.2.0/org.eclipse.kura.example.publisher_1.0.300.dpExample Publisher1.0.300true | - | timeout | java.lang.Long | 30000 | - When I create a new JobStep from the existing creator - And I restart a job - And I confirm job target has step index 0 and status "PROCESS_OK" within 31 seconds - Then I query for the job with the name "TestJob" and I count 1 execution item or more and I confirm the executed job is finished within 20 seconds - When I restart a job - And I confirm job target has step index 0 and status "PROCESS_OK" within 31 seconds - Then I query for the job with the name "TestJob" and I count 2 execution items or more and I confirm the executed jobs are finished within 45 seconds - When I search for events from device "rpione3" in account "kapua-sys" I find 3 or more events within 30 seconds - When Packages are requested and 2 packages are received - And KuraMock is disconnected - And I logout - - Scenario: Restarting job With valid Asset Write step two times - Create a new job and set a connected KuraMock device as the job target. - Add a new valid Asset Write step to the created job. Restart the job two times. - After the executed job is finished, the executed target's step index should - be 0 and the status PROCESS_OK - - Given I login as user with name "kapua-sys" and password "kapua-password" - And I start the Kura Mock - When Device is connected within 10 seconds - Then Device status is "CONNECTED" within 10 seconds - And I select account "kapua-sys" - And I get the KuraMock device after 5 seconds - And Device assets are requested - And Asset with name "asset1" and channel with name "channel1" and value 123 are received - When I search for events from device "rpione3" in account "kapua-sys" I find 2 events within 30 seconds - And The type of the last event is "ASSET" - Given I create a job with the name "TestJob" - And I create a new job target item - And Search for step definition with the name "Asset Write" - And I prepare a JobStepCreator with the name "TestStep" and the following properties - | name | type | value | - | assets | org.eclipse.kapua.service.device.management.asset.DeviceAssets | asset1java.lang.Integer1233channel1 | - | timeout | java.lang.Long | 10000 | - When I create a new JobStep from the existing creator - Then I restart a job - And I confirm job target has step index 0 and status "PROCESS_OK" within 31 seconds - Given I query for the job with the name "TestJob" and I count 1 execution item and I confirm the executed job is finished within 20 seconds - Then I restart a job - And I confirm job target has step index 0 and status "PROCESS_OK" within 31 seconds - Given I query for the job with the name "TestJob" and I count 2 execution items and I confirm the executed jobs are finished within 45 seconds - When I search for events from device "rpione3" in account "kapua-sys" I find 3 or more events within 30 seconds - And Device assets are requested - And Asset with name "asset1" and channel with name "channel1" and value 1233 are received - Then KuraMock is disconnected - And I logout - - # ******************************************************* - # * Restarting a job with one Target and multiple Steps * - # ******************************************************* - - Scenario: Restarting job with valid Configuration Put and Command Execution steps two times - Create a new job. Set a connected Kura Mock device as a job target. - Add a new valid Configuration Put and Command Execution steps to the created job. Restart the job two times. - After the executed job is finished, the step index of executed targets should - be 1 and the status PROCESS_OK - - Given I login as user with name "kapua-sys" and password "kapua-password" - And I start the Kura Mock - And Device is connected within 10 seconds - Then Device status is "CONNECTED" within 10 seconds - And I select account "kapua-sys" - And I get the KuraMock device after 5 seconds - Then Configuration is requested - And A Configuration named "org.eclipse.kura.clock.ClockService" has property "clock.ntp.retry.interval" with value "5" - And Command "pwd" is executed - When I search for events from device "rpione3" in account "kapua-sys" I find 3 events within 30 seconds - And The type of the last event is "COMMAND" - Given I create a job with the name "TestJob" - And I create a new job target item - And I search for step definitions with the name - | Configuration Put | - | Command Execution | - And I prepare a JobStepCreator with the name "TestStep1" and properties - | name | type | value | - | configuration | org.eclipse.kapua.service.device.management.configuration.DeviceConfiguration | org.eclipse.kura.clock.ClockService>0.pool.ntp.orgjava-ntp12303600truetrue1000010 | - | commandInput | org.eclipse.kapua.service.device.management.command.DeviceCommandInput | pwd30000false | - | timeout | java.lang.Long | 10000 | - When I create multiple new JobSteps from the existing creators - And No exception was thrown - And I count the JobSteps and I find 2 JobStep within 30 seconds - Then I restart a job - And I confirm job target has step index 1 and status "PROCESS_OK" within 31 seconds - Given I query for the job with the name "TestJob" and I count 1 execution item or more and I confirm the executed job is finished within 20 seconds - Then I restart a job - And I confirm job target has step index 1 and status "PROCESS_OK" within 31 seconds - Given I query for the job with the name "TestJob" and I count 2 execution items and I confirm the executed jobs are finished within 45 seconds - When I search for events from device "rpione3" in account "kapua-sys" I find 3 or more events within 30 seconds - Then Configuration is requested - And A Configuration named "org.eclipse.kura.clock.ClockService" has property "clock.ntp.retry.interval" with value "10" - When KuraMock is disconnected - And I logout - - Scenario: Restarting job with valid Package Uninstall and Asset Write steps two times - Create a new job and set a connected KuraMock device as the job target. - Add new valid Package Uninstall and valid Asset Write steps to the created job. - Restart the job two times. After the executed job is finished, the executed target's - step index should be 1 and the status PROCESS_OK - - Given I login as user with name "kapua-sys" and password "kapua-password" - And I start the Kura Mock - When Device is connected within 10 seconds - Then Device status is "CONNECTED" within 10 seconds - And I select account "kapua-sys" - And I get the KuraMock device after 5 seconds - And Device assets are requested - And Asset with name "asset1" and channel with name "channel1" and value 123 are received - And Packages are requested and 1 package is received - When I search for events from device "rpione3" in account "kapua-sys" I find 3 events within 30 seconds - And The type of the last event is "DEPLOY" - Given I create a job with the name "TestJob" - And I create a new job target item - And I search for step definitions with the name - | Package Uninstall | - | Asset Write | - And I prepare a JobStepCreator with the name "TestStep1" and properties - | name | type | value | - | packageUninstallRequest | org.eclipse.kapua.service.device.management.packages.model.uninstall.DevicePackageUninstallRequest | org.eclipse.kura.example.beacon1.0.300true10000 | - | assets | org.eclipse.kapua.service.device.management.asset.DeviceAssets | asset1java.lang.Integer1233channel1 | - | timeout | java.lang.Long | 10000 | - When I create multiple new JobSteps from the existing creators - And No exception was thrown - And I count the JobSteps and I find 2 JobStep within 30 seconds - Then I restart a job - And I confirm job target has step index 1 and status "PROCESS_OK" within 31 seconds - Given I query for the job with the name "TestJob" and I count 1 execution items or more and I confirm the executed jobs are finished within 45 seconds - Then I restart a job - And I confirm job target has step index 1 and status "PROCESS_OK" within 31 seconds - Given I query for the job with the name "TestJob" and I count 2 execution items or more and I confirm the executed jobs are finished within 45 seconds - When I search for events from device "rpione3" in account "kapua-sys" I find 3 or more events within 30 seconds - And Device assets are requested - And Asset with name "asset1" and channel with name "channel1" and value 1233 are received - And Packages are requested and 0 packages are received - Then KuraMock is disconnected - And I logout - - # ******************************************************* - # * Restarting a job with multiple Targets and one Step * - # ******************************************************* - - Scenario: Restarting a job with valid Configuration Put step and multiple devices two times - Create a new job and set a connected KuraMock devices as the job target. - Add a new valid Configuration Put step to the created job. Restart the job two times. - After the executed job is finished, the executed target's step index should - be 0 and the status PROCESS_OK - - Given I login as user with name "kapua-sys" and password "kapua-password" - And I add 2 devices to Kura Mock - And Devices are connected within 10 seconds - And I wait 1 second - Then Device status is "CONNECTED" within 10 seconds - And I select account "kapua-sys" - And I get the KuraMock devices after 5 seconds - Then Configuration is requested - And A Configuration named "org.eclipse.kura.clock.ClockService" has property "clock.ntp.retry.interval" with value "5" - And I search events from devices in account "kapua-sys" and 2 events is found - Given I create a job with the name "TestJob" - And I add targets to job - And Search for step definition with the name "Configuration Put" - And I prepare a JobStepCreator with the name "TestStep" and the following properties - | name | type | value | - | configuration | org.eclipse.kapua.service.device.management.configuration.DeviceConfiguration | org.eclipse.kura.clock.ClockService>0.pool.ntp.orgjava-ntp12303600truetrue1000010 | - | timeout | java.lang.Long | 10000 | - When I create a new JobStep from the existing creator - Then I restart a job - And I confirm job target has step index 0 and status "PROCESS_OK" within 31 seconds - Given I query for the job with the name "TestJob" and I count 1 execution item and I confirm the executed job is finished within 20 seconds - Then I restart a job - And I confirm job target has step index 0 and status "PROCESS_OK" within 31 seconds - Given I query for the job with the name "TestJob" and I count 2 execution items and I confirm the executed jobs are finished within 45 seconds - And I search events from devices in account "kapua-sys" and 3 or more events are found - Then Configuration is requested - And A Configuration named "org.eclipse.kura.clock.ClockService" has property "clock.ntp.retry.interval" with value "10" - And KuraMock is disconnected - And I logout - - Scenario: Restarting a job with valid Package Install step and multiple devices two times - Create a new job and set a connected KuraMock device as the job target. Add a new valid Package Install - step to the created job. Restart the job two times. After the executed job is finished, the executed - target's step index should be 0 and the status PROCESS_OK. - - Given I login as user with name "kapua-sys" and password "kapua-password" - And I add 2 devices to Kura Mock - And Devices are connected within 10 seconds - And I wait 1 second - Then Device status is "CONNECTED" within 10 seconds - And I select account "kapua-sys" - And I get the KuraMock devices after 5 seconds - And Packages are requested and 1 package is received - And I search events from devices in account "kapua-sys" and 2 events is found - Given I create a job with the name "TestJob" - And I add targets to job - And Search for step definition with the name "Package Download / Install" - And I prepare a JobStepCreator with the name "TestStep" and the following properties - | name | type | value | - | packageDownloadRequest | org.eclipse.kapua.service.device.management.packages.model.download.DevicePackageDownloadRequest | http://download.eclipse.org/kura/releases/3.2.0/org.eclipse.kura.example.publisher_1.0.300.dpExample Publisher1.0.300true | - | timeout | java.lang.Long | 30000 | - When I create a new JobStep from the existing creator - And I restart a job - And I confirm job target has step index 0 and status "PROCESS_OK" within 31 seconds - Then I query for the job with the name "TestJob" and I count 1 execution items or more and I confirm the executed jobs are finished within 45 seconds - When I restart a job - And I confirm job target has step index 0 and status "PROCESS_OK" within 31 seconds - Then I query for the job with the name "TestJob" and I count 2 execution items or more and I confirm the executed jobs are finished within 45 seconds - And I search events from devices in account "kapua-sys" and 3 or more events is found - When Packages are requested and 2 packages are received - And KuraMock is disconnected - And I logout - - Scenario: Restarting job with valid Asset Write step and multiple devices two times - Create a new job and set a connected KuraMock devices as the job targets. - Add a new valid Asset Write step to the created job. Restart the job two times. - After the executed job is finished, the executed target's step index should - be 0 and the status PROCESS_OK - - Given I login as user with name "kapua-sys" and password "kapua-password" - And I add 2 devices to Kura Mock - When Devices are connected within 10 seconds - And I wait 1 second - Then Devices status is "CONNECTED" within 10 seconds - And I select account "kapua-sys" - And I get the KuraMock devices after 5 seconds - And Device assets are requested - And Asset with name "asset1" and channel with name "channel1" and value 123 are received - And I search events from devices in account "kapua-sys" and 2 events is found - And The type of the last event is "ASSET" - Given I create a job with the name "TestJob" - And I add targets to job - And Search for step definition with the name "Asset Write" - And I prepare a JobStepCreator with the name "TestStep" and the following properties - | name | type | value | - | assets | org.eclipse.kapua.service.device.management.asset.DeviceAssets | asset1java.lang.Integer1233channel1 | - | timeout | java.lang.Long | 10000 | - When I create a new JobStep from the existing creator - Then I restart a job - And I confirm job target has step index 0 and status "PROCESS_OK" within 31 seconds - Given I query for the job with the name "TestJob" and I count 1 execution item and I confirm the executed job is finished within 20 seconds - Then I restart a job - And I confirm job target has step index 0 and status "PROCESS_OK" within 31 seconds - Given I query for the job with the name "TestJob" and I count 2 execution items and I confirm the executed jobs are finished within 45 seconds - And I search events from devices in account "kapua-sys" and 3 or more events is found - And Device assets are requested - And Asset with name "asset1" and channel with name "channel1" and value 1233 are received - Then KuraMock is disconnected - And I logout - - # ************************************************************* - # * Restarting a job with multiple Targets and multiple Steps * - # ************************************************************* - - Scenario: Restarting job with valid Configuration Put and Command Execution steps and multiple devices two times - Create a new job. Set a connected Kura Mock devices as a job target. - Add a new valid Configuration Put and Command Execution steps to the created job. Restart the job two times. - After the executed job is finished, the step index of executed targets should - be 1 and the status PROCESS_OK - - Given I login as user with name "kapua-sys" and password "kapua-password" - And I start the Kura Mock - Then I add 2 devices to Kura Mock - And Devices are connected within 10 seconds - And I wait 1 second - Then Device status is "CONNECTED" within 10 seconds - And I select account "kapua-sys" - And I get the KuraMock devices after 5 seconds - Then Configuration is requested - And A Configuration named "org.eclipse.kura.clock.ClockService" has property "clock.ntp.retry.interval" with value "5" - And Command "pwd" is executed - When I search events from devices in account "kapua-sys" and 3 events is found - And The type of the last event is "COMMAND" - Given I create a job with the name "TestJob" - And I add targets to job - And I search for step definitions with the name - | Configuration Put | - | Command Execution | - And I prepare a JobStepCreator with the name "TestStep1" and properties - | name | type | value | - | configuration | org.eclipse.kapua.service.device.management.configuration.DeviceConfiguration | org.eclipse.kura.clock.ClockService>0.pool.ntp.orgjava-ntp12303600truetrue1000010 | - | commandInput | org.eclipse.kapua.service.device.management.command.DeviceCommandInput | pwd30000false | - | timeout | java.lang.Long | 10000 | - When I create multiple new JobSteps from the existing creators - And No exception was thrown - And I count the JobSteps and I find 2 JobStep within 30 seconds - Then I restart a job - And I confirm job target has step index 1 and status "PROCESS_OK" within 31 seconds - Given I query for the job with the name "TestJob" and I count 1 execution item and I confirm the executed job is finished within 20 seconds - Then I restart a job - And I confirm job target has step index 1 and status "PROCESS_OK" within 31 seconds - Given I query for the job with the name "TestJob" and I count 2 execution items and I confirm the executed jobs are finished within 45 seconds - When I search events from devices in account "kapua-sys" and 3 or more events is found - Then Configuration is requested - And A Configuration named "org.eclipse.kura.clock.ClockService" has property "clock.ntp.retry.interval" with value "10" - When KuraMock is disconnected - And I logout - - Scenario: Restarting job with valid Package Uninstall and Asset Write steps and multiple devices two times - Create a new job and set a connected KuraMock devices as the job targets. - Add a new valid Package Uninstall and valid Asset Write steps to the created job. - Restart the job two times. After the executed job is finished, the executed target's - step index should be 1 and the status PROCESS_OK - - Given I login as user with name "kapua-sys" and password "kapua-password" - And I add 2 devices to Kura Mock - When Devices are connected within 10 seconds - And I wait 1 second - Then Devices status is "CONNECTED" within 10 seconds - And I select account "kapua-sys" - And I get the KuraMock devices after 5 seconds - And Packages are requested and 1 package is received - And Device assets are requested - And Asset with name "asset1" and channel with name "channel1" and value 123 are received - When I search events from devices in account "kapua-sys" and 3 events is found - And The type of the last event is "ASSET" - Given I create a job with the name "TestJob" - And I add targets to job - And I search for step definitions with the name - | Package Uninstall | - | Asset Write | - And I prepare a JobStepCreator with the name "TestStep1" and properties - | name | type | value | - | packageUninstallRequest | org.eclipse.kapua.service.device.management.packages.model.uninstall.DevicePackageUninstallRequest | org.eclipse.kura.example.beacon1.0.300true10000 | - | assets | org.eclipse.kapua.service.device.management.asset.DeviceAssets | asset1java.lang.Integer1233channel1 | - | timeout | java.lang.Long | 10000 | - When I create multiple new JobSteps from the existing creators - And No exception was thrown - And I count the JobSteps and I find 2 JobStep within 30 seconds - Then I restart a job - And I confirm job target has step index 1 and status "PROCESS_OK" within 31 seconds - Given I query for the job with the name "TestJob" and I count 1 execution items or more and I confirm the executed jobs are finished within 45 seconds - Then I restart a job - And I confirm job target has step index 1 and status "PROCESS_OK" within 31 seconds - Given I query for the job with the name "TestJob" and I count 2 execution items or more and I confirm the executed jobs are finished within 45 seconds - When I search events from devices in account "kapua-sys" and 3 or more events is found - And Device assets are requested - And Asset with name "asset1" and channel with name "channel1" and value 1233 are received - And Packages are requested and 0 packages are received - Then KuraMock is disconnected - And I logout - - @teardown - Scenario: Tear down test resources - Given Stop Docker environment - And Clean Locator Instance diff --git a/qa/integration/src/test/resources/features/jobEngine/JobEngineServiceStartOfflineDeviceI9n.feature b/qa/integration/src/test/resources/features/jobEngine/JobEngineServiceStartOfflineDeviceI9n.feature deleted file mode 100644 index f034ae8f659..00000000000 --- a/qa/integration/src/test/resources/features/jobEngine/JobEngineServiceStartOfflineDeviceI9n.feature +++ /dev/null @@ -1,1138 +0,0 @@ -############################################################################### -# Copyright (c) 2019, 2024 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 -############################################################################### -@env_docker -@it -@jobEngineStartOfflineDevice - -Feature: JobEngineService tests for starting job with offline device - - @setup - Scenario: Setup test resources - Given Init Security Context - And Start Docker environment with resources - | db | - | events-broker | - | job-engine | - | message-broker | - | broker-auth-service | - | consumer-lifecycle | - - # *********************************************** - # * Starting a job with one Target and one Step * - # *********************************************** - - Scenario: Starting a job with Command Execution step - Create a new job and set a disconnected KuraMock device as the job target. - Add a new Command Execution step to the created job. Start the job. - After the executed job is finished, the executed target's step index should - be 0 and the status PROCESS_FAILED. - - Given I login as user with name "kapua-sys" and password "kapua-password" - And I start the Kura Mock - When Device is connected within 10 seconds - And I wait 1 second - Then Device status is "CONNECTED" within 10 seconds - When KuraMock is disconnected - And I wait 1 second - Then Device status is "DISCONNECTED" within 10 seconds - And I select account "kapua-sys" - And I get the KuraMock device after 5 seconds - Given I create a job with the name "TestJob" - And A new job target item - And Search for step definition with the name "Command Execution" - And I prepare a JobStepCreator with the name "TestStep" and the following properties - | name | type | value | - | commandInput | org.eclipse.kapua.service.device.management.command.DeviceCommandInput | pwd30000false | - | timeout | java.lang.Long | 10000 | - When I create a new JobStep from the existing creator - Then No exception was thrown - And I start a job - Given I query for the job with the name "TestJob" and I count 1 execution item and I confirm the executed job is finished within 20 seconds - And I search for the last job target in the database - And I confirm the step index is 0 and status is "PROCESS_FAILED" - And I logout - - Scenario: Starting a job with Asset Write step - Create a new job and set a disconnected KuraMock device as the job target. - Add a new Asset Write step to the created job. Start the job. - After the executed job is finished, the executed target's step index should - be 0 and the status PROCESS_FAILED. - - Given I login as user with name "kapua-sys" and password "kapua-password" - And I start the Kura Mock - When Device is connected within 10 seconds - Then Device status is "CONNECTED" within 10 seconds - When KuraMock is disconnected - And I wait 1 second - Then Device status is "DISCONNECTED" within 10 seconds - And I select account "kapua-sys" - And I get the KuraMock device after 5 seconds - Given I create a job with the name "TestJob" - And A new job target item - And Search for step definition with the name "Asset Write" - And I prepare a JobStepCreator with the name "TestStep" and the following properties - | name | type | value | - | assets | org.eclipse.kapua.service.device.management.asset.DeviceAssets | assetNamebinaryEGVzdCBzdHJpbmcgdmFsdWU=binaryTest | - | timeout | java.lang.Long | 10000 | - When I create a new JobStep from the existing creator - Then No exception was thrown - And I start a job - Given I query for the job with the name "TestJob" and I count 1 execution item and I confirm the executed job is finished within 20 seconds - And I search for the last job target in the database - And I confirm the step index is 0 and status is "PROCESS_FAILED" - And I logout - - Scenario: Starting a job with Bundle Start step - Create a new job and set a disconnected KuraMock device as the job target. - Add a new Bundle Start step to the created job. Start the job. - After the executed job is finished, the executed target's step index should - be 0 and the status PROCESS_FAILED. - - Given I login as user with name "kapua-sys" and password "kapua-password" - And I start the Kura Mock - And Device is connected within 10 seconds - Then Device status is "CONNECTED" within 10 seconds - And I select account "kapua-sys" - And I get the KuraMock device after 5 seconds - And Bundles are requested - Then A bundle named "slf4j.api" with id 34 and version "1.7.21" is present and "RESOLVED" - When KuraMock is disconnected - And I wait 1 second - Then Device status is "DISCONNECTED" within 10 seconds - Given I create a job with the name "TestJob" - And A new job target item - And Search for step definition with the name "Bundle Start" - And I prepare a JobStepCreator with the name "TestStep" and the following properties - | name | type | value | - | bundleId | java.lang.String | 34 | - | timeout | java.lang.Long | 10000 | - When I create a new JobStep from the existing creator - Then No exception was thrown - And I start a job - Given I query for the job with the name "TestJob" and I count 1 execution item and I confirm the executed job is finished within 20 seconds - And I search for the last job target in the database - And I confirm the step index is 0 and status is "PROCESS_FAILED" - When I start the Kura Mock - And Device is connected within 10 seconds - And Bundles are requested - Then A bundle named "slf4j.api" with id 34 and version "1.7.21" is present and "RESOLVED" - When KuraMock is disconnected - And I wait 1 second - And Device status is "DISCONNECTED" within 10 seconds - And I logout - - Scenario: Starting a job with Bundle Stop step - Create a new job and set a disconnected KuraMock device as the job target. - Add a new Bundle Stop step to the created job. Start the job. - After the executed job is finished, the executed target's step index should - be 0 and the status PROCESS_FAILED. - - Given I login as user with name "kapua-sys" and password "kapua-password" - And I start the Kura Mock - And Device is connected within 10 seconds - Then Device status is "CONNECTED" within 10 seconds - And I select account "kapua-sys" - And I get the KuraMock device after 5 seconds - And Bundles are requested - And A bundle named "org.eclipse.kura.linux.bluetooth" with id 77 and version "1.0.300" is present and "ACTIVE" - Then Device status is "CONNECTED" within 10 seconds - When KuraMock is disconnected - And I wait 1 second - Then Device status is "DISCONNECTED" within 10 seconds - Given I create a job with the name "TestJob" - And A new job target item - And Search for step definition with the name "Bundle Stop" - And I prepare a JobStepCreator with the name "TestStep" and the following properties - | name | type | value | - | bundleId | java.lang.String | 77 | - | timeout | java.lang.Long | 10000 | - When I create a new JobStep from the existing creator - Then No exception was thrown - And I start a job - Given I query for the job with the name "TestJob" and I count 1 execution item and I confirm the executed job is finished within 20 seconds - And I search for the last job target in the database - And I confirm the step index is 0 and status is "PROCESS_FAILED" - When I start the Kura Mock - And Device is connected within 10 seconds - And Bundles are requested - And A bundle named "org.eclipse.kura.linux.bluetooth" with id 77 and version "1.0.300" is present and "ACTIVE" - When KuraMock is disconnected - And I wait 1 second - And Device status is "DISCONNECTED" within 10 seconds - And I logout - - Scenario: Starting a job with Configuration Put step - Create a new job and set a disconnected KuraMock device as the job target. - Add a new Configuration Put step to the created job. Start the job. - After the executed job is finished, the executed target's step index should - be 0 and the status PROCESS_FAILED. - - Given I login as user with name "kapua-sys" and password "kapua-password" - And I start the Kura Mock - When Device is connected within 10 seconds - Then Device status is "CONNECTED" within 10 seconds - When KuraMock is disconnected - And I wait 1 second - Then Device status is "DISCONNECTED" within 10 seconds - And I select account "kapua-sys" - And I get the KuraMock device after 5 seconds - Given I create a job with the name "TestJob" - And A new job target item - And Search for step definition with the name "Configuration Put" - And I prepare a JobStepCreator with the name "TestStep" and the following properties - | name | type | value | - | configuration | org.eclipse.kapua.service.device.management.configuration.DeviceConfiguration | org.eclipse.kura.demo.heater.Heater0.256022:00falseorg.eclipse.kura.demo.heater.Heaterorg.eclipse.kura.demo.heater.Heater06:00Programdata/21030.0213.030.0 | - | timeout | java.lang.Long | 10000 | - When I create a new JobStep from the existing creator - Then No exception was thrown - And I start a job - Given I query for the job with the name "TestJob" and I count 1 execution item and I confirm the executed job is finished within 20 seconds - And I search for the last job target in the database - And I confirm the step index is 0 and status is "PROCESS_FAILED" - And I logout - - Scenario: Starting a job with Package Install step - Create a new job and set a disconnected KuraMock device as the job target. - Add a new Package Install step to the created job. Start the job. - After the executed job is finished, the executed target's step index should - be 0 and the status PROCESS_FAILED. - - Given I login as user with name "kapua-sys" and password "kapua-password" - And I start the Kura Mock - And Device is connected within 10 seconds - Then Device status is "CONNECTED" within 10 seconds - And I select account "kapua-sys" - And I get the KuraMock device after 5 seconds - And Packages are requested and 1 package is received - When KuraMock is disconnected - And I wait 1 second - Then Device status is "DISCONNECTED" within 10 seconds - Given I create a job with the name "TestJob" - And A new job target item - And Search for step definition with the name "Package Download / Install" - And I prepare a JobStepCreator with the name "TestStep" and the following properties - | name | type | value | - | packageDownloadRequest | org.eclipse.kapua.service.device.management.packages.model.download.DevicePackageDownloadRequest | http://download.eclipse.org/kura/releases/3.2.0/org.eclipse.kura.demo.heater_1.0.300.dpheater1.0.300true | - | timeout | java.lang.Long | 10000 | - When I create a new JobStep from the existing creator - Then No exception was thrown - And I start a job - Given I query for the job with the name "TestJob" and I count 1 execution item and I confirm the executed job is finished within 20 seconds - And I search for the last job target in the database - And I confirm the step index is 0 and status is "PROCESS_FAILED" - When I start the Kura Mock - And Device is connected within 10 seconds - And Packages are requested and 1 package is received - When KuraMock is disconnected - And I wait 1 second - And Device status is "DISCONNECTED" within 10 seconds - And I logout - - Scenario: Starting a job with Package Uninstall step - Create a new job and set a disconnected KuraMock device as the job target. - Add a new Package Uninstall step to the created job. Start the job. - After the executed job is finished, the executed target's step index should - be 0 and the status PROCESS_FAILED. - - Given I login as user with name "kapua-sys" and password "kapua-password" - And I start the Kura Mock - When Device is connected within 10 seconds - Then Device status is "CONNECTED" within 10 seconds - And I select account "kapua-sys" - And I get the KuraMock device after 5 seconds - And Packages are requested and 1 package is received - And Package named "org.eclipse.kura.example.beacon" with version "1.0.300" is received - When KuraMock is disconnected - And I wait 1 second - Then Device status is "DISCONNECTED" within 10 seconds - Given I create a job with the name "TestJob" - And A new job target item - And Search for step definition with the name "Package Uninstall" - And I prepare a JobStepCreator with the name "TestStep" and the following properties - | name | type | value | - | packageUninstallRequest | org.eclipse.kapua.service.device.management.packages.model.uninstall.DevicePackageUninstallRequest | org.eclipse.kura.example.beacon1.0.300true10000 | - | timeout | java.lang.Long | 10000 | - When I create a new JobStep from the existing creator - Then No exception was thrown - And I start a job - Given I query for the job with the name "TestJob" and I count 1 execution item and I confirm the executed job is finished within 20 seconds - And I search for the last job target in the database - And I confirm the step index is 0 and status is "PROCESS_FAILED" - When I start the Kura Mock - And Device is connected within 10 seconds - And Packages are requested and 1 package is received - When KuraMock is disconnected - And I wait 1 second - And Device status is "DISCONNECTED" within 10 seconds - And I logout - - # ***************************************************** - # * Starting a job with one Target and multiple Steps * - # ***************************************************** - - Scenario: Starting a job with Command Execution and Bundle Start steps - Create a new job and set a disconnected KuraMock device as the job target. - Add a new Command Execution and Bundle Stop steps to the created job. Start the job. - After the executed job is finished, the executed target's step index should - be 0 and the status PROCESS_FAILED. - - Given I login as user with name "kapua-sys" and password "kapua-password" - And I start the Kura Mock - And Device is connected within 10 seconds - Then Device status is "CONNECTED" within 10 seconds - And I select account "kapua-sys" - And I get the KuraMock device after 5 seconds - And Bundles are requested - Then A bundle named "slf4j.api" with id 34 and version "1.7.21" is present and "RESOLVED" - When KuraMock is disconnected - And I wait 1 second - Then Device status is "DISCONNECTED" within 10 seconds - Given I create a job with the name "TestJob" - And A new job target item - And Search for step definition with the name "Command Execution" - And I prepare a JobStepCreator with the name "TestStep1" and the following properties - | name | type | value | - | commandInput | org.eclipse.kapua.service.device.management.command.DeviceCommandInput | pwd30000false | - | timeout | java.lang.Long | 10000 | - And I create a new JobStep from the existing creator - Then Search for step definition with the name "Bundle Start" - And I prepare a JobStepCreator with the name "TestStep2" and the following properties - | name | type | value | - | bundleId | java.lang.String | 34 | - | timeout | java.lang.Long | 10000 | - When I create a new JobStep from the existing creator - And I count the JobSteps and I find 2 JobStep within 30 seconds - And I start a job - Given I query for the job with the name "TestJob" and I count 1 execution item and I confirm the executed job is finished within 20 seconds - And I search for the last job target in the database - And I confirm the step index is 0 and status is "PROCESS_FAILED" - When I start the Kura Mock - And Device is connected within 10 seconds - And Bundles are requested - Then A bundle named "slf4j.api" with id 34 and version "1.7.21" is present and "RESOLVED" - When KuraMock is disconnected - And I wait 1 second - And Device status is "DISCONNECTED" within 10 seconds - And I logout - - Scenario: Starting a job with Asset Write and Bundle Start steps - Create a new job and set a disconnected KuraMock device as the job target. - Add a new Asset Write and Bundle Start steps to the created job. Start the job. - After the executed job is finished, the executed target's step index should - be 0 and the status PROCESS_FAILED. - - Given I login as user with name "kapua-sys" and password "kapua-password" - And I start the Kura Mock - And Device is connected within 10 seconds - Then Device status is "CONNECTED" within 10 seconds - And I select account "kapua-sys" - And I get the KuraMock device after 5 seconds - And Bundles are requested - Then A bundle named "slf4j.api" with id 34 and version "1.7.21" is present and "RESOLVED" - When KuraMock is disconnected - And I wait 1 second - Then Device status is "DISCONNECTED" within 10 seconds - Given I create a job with the name "TestJob" - And A new job target item - And Search for step definition with the name "Asset Write" - And I prepare a JobStepCreator with the name "TestStep1" and the following properties - | name | type | value | - | assets | org.eclipse.kapua.service.device.management.asset.DeviceAssets | assetNamebinaryEGVzdCBzdHJpbmcgdmFsdWU=binaryTest | - | timeout | java.lang.Long | 10000 | - And I create a new JobStep from the existing creator - Then Search for step definition with the name "Bundle Start" - And I prepare a JobStepCreator with the name "TestStep2" and the following properties - | name | type | value | - | bundleId | java.lang.String | 34 | - | timeout | java.lang.Long | 10000 | - When I create a new JobStep from the existing creator - And I count the JobSteps and I find 2 JobStep within 30 seconds - And I start a job - Given I query for the job with the name "TestJob" and I count 1 execution item and I confirm the executed job is finished within 20 seconds - And I search for the last job target in the database - And I confirm the step index is 0 and status is "PROCESS_FAILED" - When I start the Kura Mock - And Bundles are requested - Then A bundle named "slf4j.api" with id 34 and version "1.7.21" is present and "RESOLVED" - When KuraMock is disconnected - And I wait 1 second - And Device status is "DISCONNECTED" within 10 seconds - And I logout - - Scenario: Starting a job with two Bundle Start steps - Create a new job and set a disconnected KuraMock device as the job target. - Add two new Bundle Start steps to the created job. Start the job. - After the executed job is finished, the executed target's step index should - be 0 and the status PROCESS_FAILED. - - Given I login as user with name "kapua-sys" and password "kapua-password" - And I start the Kura Mock - And Device is connected within 10 seconds - Then Device status is "CONNECTED" within 10 seconds - And I select account "kapua-sys" - And I get the KuraMock device after 5 seconds - And Bundles are requested - Then A bundle named "slf4j.api" with id 34 and version "1.7.21" is present and "RESOLVED" - And A bundle named "com.google.guava" with id 95 and version "19.0.0" is present and "RESOLVED" - When KuraMock is disconnected - And I wait 1 second - Then Device status is "DISCONNECTED" within 10 seconds - Given I create a job with the name "TestJob" - And A new job target item - And Search for step definition with the name "Bundle Start" - And I prepare a JobStepCreator with the name "TestStep1" and the following properties - | name | type | value | - | bundleId | java.lang.String | 34 | - | timeout | java.lang.Long | 10000 | - And I create a new JobStep from the existing creator - Then Search for step definition with the name "Bundle Start" - And I prepare a JobStepCreator with the name "TestStep2" and the following properties - | name | type | value | - | bundleId | java.lang.String | 95 | - | timeout | java.lang.Long | 10000 | - When I create a new JobStep from the existing creator - And I count the JobSteps and I find 2 JobStep within 30 seconds - And I start a job - And I wait 10 seconds - Given I query for the job with the name "TestJob" and I count 1 execution item and I confirm the executed job is finished within 20 seconds - And I search for the last job target in the database - And I confirm the step index is 0 and status is "PROCESS_FAILED" - When I start the Kura Mock - And Device is connected within 10 seconds - And Bundles are requested - Then A bundle named "slf4j.api" with id 34 and version "1.7.21" is present and "RESOLVED" - And A bundle named "com.google.guava" with id 95 and version "19.0.0" is present and "RESOLVED" - When KuraMock is disconnected - And I wait 1 second - And Device status is "DISCONNECTED" within 10 seconds - And I logout - - Scenario: Starting a job with Bundle Stop and Bundle Start steps - Create a new job and set a disconnected KuraMock device as the job target. - Add a new Bundle Stop and Bundle Start steps to the created job. Start the job. - After the executed job is finished, the executed target's step index should - be 0 and the status PROCESS_FAILED. - - Given I login as user with name "kapua-sys" and password "kapua-password" - And I start the Kura Mock - And Device is connected within 10 seconds - Then Device status is "CONNECTED" within 10 seconds - And I select account "kapua-sys" - And I get the KuraMock device after 5 seconds - And Bundles are requested - And A bundle named "org.eclipse.kura.linux.bluetooth" with id 77 and version "1.0.300" is present and "ACTIVE" - And A bundle named "slf4j.api" with id 34 and version "1.7.21" is present and "RESOLVED" - When KuraMock is disconnected - And I wait 1 second - Then Device status is "DISCONNECTED" within 10 seconds - Given I create a job with the name "TestJob" - And A new job target item - And Search for step definition with the name "Bundle Stop" - And I prepare a JobStepCreator with the name "TestStep1" and the following properties - | name | type | value | - | bundleId | java.lang.String | 77 | - | timeout | java.lang.Long | 10000 | - And I create a new JobStep from the existing creator - Then Search for step definition with the name "Bundle Start" - And I prepare a JobStepCreator with the name "TestStep2" and the following properties - | name | type | value | - | bundleId | java.lang.String | 34 | - | timeout | java.lang.Long | 10000 | - When I create a new JobStep from the existing creator - And I count the JobSteps and I find 2 JobStep within 30 seconds - And I start a job - Given I query for the job with the name "TestJob" and I count 1 execution item and I confirm the executed job is finished within 20 seconds - And I search for the last job target in the database - And I confirm the step index is 0 and status is "PROCESS_FAILED" - When I start the Kura Mock - And Device is connected within 10 seconds - And Bundles are requested - And A bundle named "org.eclipse.kura.linux.bluetooth" with id 77 and version "1.0.300" is present and "ACTIVE" - And A bundle named "slf4j.api" with id 34 and version "1.7.21" is present and "RESOLVED" - When KuraMock is disconnected - And I wait 1 second - And Device status is "DISCONNECTED" within 10 seconds - And I logout - - Scenario: Starting a job with Configuration Put and Bundle Start steps - Create a new job and set a disconnected KuraMock device as the job target. - Add a new Configuration Put and Bundle Start steps to the created job. Start the job. - After the executed job is finished, the executed target's step index should - be 0 and the status PROCESS_FAILED. - - Given I login as user with name "kapua-sys" and password "kapua-password" - And I start the Kura Mock - And Device is connected within 10 seconds - Then Device status is "CONNECTED" within 10 seconds - And I select account "kapua-sys" - And I get the KuraMock device after 5 seconds - And Bundles are requested - And A bundle named "slf4j.api" with id 34 and version "1.7.21" is present and "RESOLVED" - When KuraMock is disconnected - And I wait 1 second - Then Device status is "DISCONNECTED" within 10 seconds - Given I create a job with the name "TestJob" - And A new job target item - And Search for step definition with the name "Configuration Put" - And I prepare a JobStepCreator with the name "TestStep1" and the following properties - | name | type | value | - | configuration | org.eclipse.kapua.service.device.management.configuration.DeviceConfiguration | org.eclipse.kura.demo.heater.Heater0.256022:00falseorg.eclipse.kura.demo.heater.Heaterorg.eclipse.kura.demo.heater.Heater06:00Programdata/21030.0213.030.0 | - | timeout | java.lang.Long | 10000 | - When I create a new JobStep from the existing creator - Then Search for step definition with the name "Bundle Start" - And I prepare a JobStepCreator with the name "TestStep2" and the following properties - | name | type | value | - | bundleId | java.lang.String | 34 | - | timeout | java.lang.Long | 10000 | - And I create a new JobStep from the existing creator - And I count the JobSteps and I find 2 JobStep within 30 seconds - And I start a job - Given I query for the job with the name "TestJob" and I count 1 execution item and I confirm the executed job is finished within 20 seconds - And I search for the last job target in the database - And I confirm the step index is 0 and status is "PROCESS_FAILED" - When I start the Kura Mock - And Device is connected within 10 seconds - And Bundles are requested - And A bundle named "slf4j.api" with id 34 and version "1.7.21" is present and "RESOLVED" - When KuraMock is disconnected - And I wait 1 second - And Device status is "DISCONNECTED" within 10 seconds - And I logout - - Scenario: Starting a job with Package Install and Bundle Start steps - Create a new job and set a disconnected KuraMock device as the job target. - Add a new Package Install and Bundle Start steps to the created job. Start the job. - After the executed job is finished, the executed target's step index should - be 0 and the status PROCESS_FAILED. - - Given I login as user with name "kapua-sys" and password "kapua-password" - And I start the Kura Mock - And Device is connected within 10 seconds - Then Device status is "CONNECTED" within 10 seconds - And I select account "kapua-sys" - And I get the KuraMock device after 5 seconds - And Packages are requested and 1 package is received - And Bundles are requested - And A bundle named "slf4j.api" with id 34 and version "1.7.21" is present and "RESOLVED" - When KuraMock is disconnected - And I wait 1 second - Then Device status is "DISCONNECTED" within 10 seconds - Given I create a job with the name "TestJob" - And A new job target item - And Search for step definition with the name "Package Download / Install" - And I prepare a JobStepCreator with the name "TestStep1" and the following properties - | name | type | value | - | packageDownloadRequest | org.eclipse.kapua.service.device.management.packages.model.download.DevicePackageDownloadRequest | http://download.eclipse.org/kura/releases/3.2.0/org.eclipse.kura.demo.heater_1.0.300.dpheater1.0.300true | - | timeout | java.lang.Long | 10000 | - And I create a new JobStep from the existing creator - Then Search for step definition with the name "Bundle Start" - And I prepare a JobStepCreator with the name "TestStep2" and the following properties - | name | type | value | - | bundleId | java.lang.String | 34 | - | timeout | java.lang.Long | 10000 | - When I create a new JobStep from the existing creator - And I count the JobSteps and I find 2 JobStep within 30 seconds - And I start a job - Given I query for the job with the name "TestJob" and I count 1 execution item and I confirm the executed job is finished within 20 seconds - And I search for the last job target in the database - And I confirm the step index is 0 and status is "PROCESS_FAILED" - When I start the Kura Mock - And Device is connected within 10 seconds - And Packages are requested and 1 package is received - And Bundles are requested - And A bundle named "slf4j.api" with id 34 and version "1.7.21" is present and "RESOLVED" - When KuraMock is disconnected - And I wait 1 second - And Device status is "DISCONNECTED" within 10 seconds - And I logout - - Scenario: Starting a job with Package Uninstall and Bundle Start steps - Create a new job and set a disconnected KuraMock device as the job target. - Add a new Package Uninstall and Bundle Start steps to the created job. Start the job. - After the executed job is finished, the executed target's step index should - be 0 and the status PROCESS_FAILED. - - Given I login as user with name "kapua-sys" and password "kapua-password" - And I start the Kura Mock - When Device is connected within 10 seconds - Then Device status is "CONNECTED" within 10 seconds - And I select account "kapua-sys" - And I get the KuraMock device after 5 seconds - And Packages are requested and 1 package is received - And Package named "org.eclipse.kura.example.beacon" with version "1.0.300" is received - And Bundles are requested - And A bundle named "slf4j.api" with id 34 and version "1.7.21" is present and "RESOLVED" - When KuraMock is disconnected - And I wait 1 second - Then Device status is "DISCONNECTED" within 10 seconds - Given I create a job with the name "TestJob" - And A new job target item - And Search for step definition with the name "Package Uninstall" - And I prepare a JobStepCreator with the name "TestStep1" and the following properties - | name | type | value | - | packageUninstallRequest | org.eclipse.kapua.service.device.management.packages.model.uninstall.DevicePackageUninstallRequest | org.eclipse.kura.example.beacon1.0.300true10000 | - | timeout | java.lang.Long | 10000 | - And I create a new JobStep from the existing creator - Then Search for step definition with the name "Bundle Start" - And I prepare a JobStepCreator with the name "TestStep2" and the following properties - | name | type | value | - | bundleId | java.lang.String | 34 | - | timeout | java.lang.Long | 10000 | - When I create a new JobStep from the existing creator - And I count the JobSteps and I find 2 JobStep within 30 seconds - And I start a job - Given I query for the job with the name "TestJob" and I count 1 execution item and I confirm the executed job is finished within 20 seconds - And I search for the last job target in the database - And I confirm the step index is 0 and status is "PROCESS_FAILED" - When I start the Kura Mock - And Device is connected within 10 seconds - And Packages are requested and 1 package is received - And KuraMock is disconnected - And I logout - - # ***************************************************** - # * Starting a job with multiple Targets and one Step * - # ***************************************************** - - Scenario: Starting job with Bundle Start step and multiple devices - Create a new job. Set a disconnected Kura Mock devices as a job targets. - Add a new Bundle Start step to the created job. Start the job. - After the executed job is finished, the step index of executed targets should - be 0 and the status PROCESS_FAILED - - Given I login as user with name "kapua-sys" and password "kapua-password" - And I add 2 devices to Kura Mock - When Devices are connected within 10 seconds - And I wait 1 second - Then Device status is "CONNECTED" within 10 seconds - When KuraMock is disconnected - And I wait 1 second - Then Device status is "DISCONNECTED" within 10 seconds - And I select account "kapua-sys" - And I get the KuraMock device after 5 seconds - Given I create a job with the name "TestJob" - And I add targets to job - When I count the targets in the current scope - Then I count 2 - And Search for step definition with the name "Bundle Start" - And I prepare a JobStepCreator with the name "TestStep" and the following properties - | name | type | value | - | bundleId | java.lang.String | 136 | - | timeout | java.lang.Long | 50000 | - When I create a new JobStep from the existing creator - Then No exception was thrown - And I start a job - And I query for the job with the name "TestJob" and I count 1 execution item and I confirm the executed job is finished within 20 seconds - And I search for the last job target in the database - And I confirm the step index is 0 and status is "PROCESS_FAILED" - And I logout - - Scenario: Starting job with Bundle Stop step and multiple devices - Create a new job. Set a disconnected Kura Mock devices as a job targets. - Add a new Bundle Stop step to the created job. Start the job. - After the executed job is finished, the step index of executed targets should - be 0 and the status PROCESS_FAILED - - Given I login as user with name "kapua-sys" and password "kapua-password" - And I add 2 devices to Kura Mock - When Devices are connected within 10 seconds - And I wait 1 second - Then Device status is "CONNECTED" within 10 seconds - When KuraMock is disconnected - And I wait 1 second - Then Device status is "DISCONNECTED" within 10 seconds - And I select account "kapua-sys" - And I get the KuraMock device after 5 seconds - Given I create a job with the name "TestJob" - And I add targets to job - When I count the targets in the current scope - Then I count 2 - And Search for step definition with the name "Bundle Stop" - And I prepare a JobStepCreator with the name "TestStep" and the following properties - | name | type | value | - | bundleId | java.lang.String | 136 | - | timeout | java.lang.Long | 50000 | - When I create a new JobStep from the existing creator - Then No exception was thrown - And I start a job - Given I query for the job with the name "TestJob" and I count 1 execution item and I confirm the executed job is finished within 20 seconds - And I search for the last job target in the database - And I confirm the step index is 0 and status is "PROCESS_FAILED" - And I logout - - Scenario: Starting job with Package Download/Install step and multiple devices - Create a new job. Set a disconnected Kura Mock devices as a job targets. - Add a new Package Install step to the created job. Start the job. - After the executed job is finished, the step index of executed targets should - be 0 and the status PROCESS_FAILED - - Given I login as user with name "kapua-sys" and password "kapua-password" - And I add 2 devices to Kura Mock - When Devices are connected within 10 seconds - And I wait 1 second - Then Device status is "CONNECTED" within 10 seconds - And I select account "kapua-sys" - And I get the KuraMock device after 5 seconds - And Packages are requested and 1 package is received - When KuraMock is disconnected - And I wait 1 second - Then Device status is "DISCONNECTED" within 10 seconds - Given I create a job with the name "TestJob" - And I add targets to job - When I count the targets in the current scope - Then I count 2 - And Search for step definition with the name "Package Download / Install" - And I prepare a JobStepCreator with the name "TestStep" and the following properties - | name | type | value | - | packageDownloadRequest | org.eclipse.kapua.service.device.management.packages.model.download.DevicePackageDownloadRequest | http://download.eclipse.org/kura/releases/3.2.0/org.eclipse.kura.demo.heater_1.0.300.dpheater1.0.300true | - | timeout | java.lang.Long | 10000 | - When I create a new JobStep from the existing creator - Then No exception was thrown - And I start a job - Given I query for the job with the name "TestJob" and I count 1 execution item and I confirm the executed job is finished within 20 seconds - And I search for the last job target in the database - And I confirm the step index is 0 and status is "PROCESS_FAILED" - And I add 2 devices to Kura Mock - And Devices are connected within 10 seconds - And Packages are requested - Then Number of received packages is 1 - And KuraMock is disconnected - And I logout - - Scenario: Starting job with Package Uninstall step and multiple device - Create a new job. Set a disconnected Kura Mock devices as a job targets. - Add a new Package Uninstall step to the created job. Start the job. - After the executed job is finished, the step index of executed targets should - be 0 and the status PROCESS_FAILED - - Given I login as user with name "kapua-sys" and password "kapua-password" - And I add 2 devices to Kura Mock - When Devices are connected within 10 seconds - And I wait 1 second - Then Device status is "CONNECTED" within 10 seconds - When KuraMock is disconnected - And I wait 1 second - Then Device status is "DISCONNECTED" within 10 seconds - And I select account "kapua-sys" - And I get the KuraMock device after 5 seconds - Given I create a job with the name "TestJob" - And I add targets to job - When I count the targets in the current scope - Then I count 2 - And Search for step definition with the name "Package Uninstall" - And I prepare a JobStepCreator with the name "TestStep" and the following properties - | name | type | value | - | packageUninstallRequest | org.eclipse.kapua.service.device.management.packages.model.uninstall.DevicePackageUninstallRequest | org.eclipse.kura.example.beacon1.0.300true10000 | - | timeout | java.lang.Long | 30000 | - When I create a new JobStep from the existing creator - Then No exception was thrown - And I start a job - Given I query for the job with the name "TestJob" and I count 1 execution item and I confirm the executed job is finished within 20 seconds - And I search for the last job target in the database - And I confirm the step index is 0 and status is "PROCESS_FAILED" - And I logout - - Scenario: Starting job with Asset Write step and multiple devices - Create a new job. Set a disconnected Kura Mock devices as a job targets. - Add a new Asset Write step to the created job. Start the job. - After the executed job is finished, the step index of executed targets should - be 0 and the status PROCESS_FAILED - - Given I login as user with name "kapua-sys" and password "kapua-password" - And I add 2 devices to Kura Mock - When Devices are connected within 10 seconds - And I wait 1 second - Then Device status is "CONNECTED" within 10 seconds - When KuraMock is disconnected - And I wait 1 second - Then Device status is "DISCONNECTED" within 10 seconds - And I select account "kapua-sys" - And I get the KuraMock device after 5 seconds - Given I create a job with the name "TestJob" - And I add targets to job - When I count the targets in the current scope - Then I count 2 - And Search for step definition with the name "Asset Write" - And I prepare a JobStepCreator with the name "TestStep" and the following properties - | name | type | value | - | assets | org.eclipse.kapua.service.device.management.asset.DeviceAssets | assetNamebinaryEGVzdCBzdHJpbmcgdmFsdWU=binaryTest | - | timeout | java.lang.Long | 50000 | - When I create a new JobStep from the existing creator - Then No exception was thrown - And I start a job - Given I query for the job with the name "TestJob" and I count 1 execution item and I confirm the executed job is finished within 20 seconds - And I search for the last job target in the database - And I confirm the step index is 0 and status is "PROCESS_FAILED" - And I logout - - Scenario: Starting job with Configuration Put step and multiple devices - Create a new job. Set a disconnected Kura Mock devices as a job targets. - Add a new Configuration Put step to the created job. Start the job. - After the executed job is finished, the step index of executed targets should - be 0 and the status PROCESS_FAILED - - Given I login as user with name "kapua-sys" and password "kapua-password" - And I add 2 devices to Kura Mock - When Devices are connected within 10 seconds - And I wait 1 second - Then Device status is "CONNECTED" within 10 seconds - When KuraMock is disconnected - And I wait 1 second - Then Device status is "DISCONNECTED" within 10 seconds - And I select account "kapua-sys" - And I get the KuraMock device after 5 seconds - Given I create a job with the name "TestJob" - And I add targets to job - When I count the targets in the current scope - Then I count 2 - And Search for step definition with the name "Configuration Put" - And I prepare a JobStepCreator with the name "TestStep" and the following properties - | name | type | value | - | configuration | org.eclipse.kapua.service.device.management.configuration.DeviceConfiguration | org.eclipse.kura.demo.heater.Heater0.256022:00falseorg.eclipse.kura.demo.heater.Heaterorg.eclipse.kura.demo.heater.Heater06:00Programdata/21030.0213.030.0 | - | timeout | java.lang.Long | 50000 | - When I create a new JobStep from the existing creator - Then No exception was thrown - And I start a job - Given I query for the job with the name "TestJob" and I count 1 execution item and I confirm the executed job is finished within 20 seconds - And I search for the last job target in the database - And I confirm the step index is 0 and status is "PROCESS_FAILED" - And I logout - - Scenario: Starting job with Command Execution step and multiple devices - Create a new job. Set a disconnected Kura Mock devices as a job targets. - Add a new Command Execution step to the created job. Start the job. - After the executed job is finished, the step index of executed targets should - be 0 and the status PROCESS_FAILED - - Given I login as user with name "kapua-sys" and password "kapua-password" - And I add 2 devices to Kura Mock - When Devices are connected within 10 seconds - And I wait 1 second - Then Device status is "CONNECTED" within 10 seconds - When KuraMock is disconnected - And I wait 1 second - Then Device status is "DISCONNECTED" within 10 seconds - And I select account "kapua-sys" - And I get the KuraMock device after 5 seconds - Given I create a job with the name "TestJob" - And I add targets to job - When I count the targets in the current scope - Then I count 2 - And Search for step definition with the name "Command Execution" - And I prepare a JobStepCreator with the name "TestStep" and the following properties - | name | type | value | - | commandInput | org.eclipse.kapua.service.device.management.command.DeviceCommandInput | pwd30000false | - | timeout | java.lang.Long | 50000 | - When I create a new JobStep from the existing creator - Then No exception was thrown - And I start a job - Given I query for the job with the name "TestJob" and I count 1 execution item and I confirm the executed job is finished within 20 seconds - And I search for the last job target in the database - And I confirm the step index is 0 and status is "PROCESS_FAILED" - And I logout - - # *********************************************************** - # * Starting a job with multiple Targets and multiple Steps * - # *********************************************************** - - Scenario: Starting job with two Bundle Start steps and multiple devices - Create a new job. Set a disconnected Kura Mock devices as a job targets. - Add a two Bundle Start steps to the created job. Start the job. - After the executed job is finished, the step index of executed targets should - be 0 and the status PROCESS_FAILED - - Given I login as user with name "kapua-sys" and password "kapua-password" - And I add 2 devices to Kura Mock - When Devices are connected within 10 seconds - And I wait 1 second - Then Device status is "CONNECTED" within 10 seconds - When KuraMock is disconnected - And I wait 1 second - Then Device status is "DISCONNECTED" within 10 seconds - And I select account "kapua-sys" - And I get the KuraMock device after 5 seconds - Given I create a job with the name "TestJob" - And I add targets to job - When I count the targets in the current scope - Then I count 2 - And Search for step definition with the name "Bundle Start" - And I prepare a JobStepCreator with the name "TestStep" and the following properties - | name | type | value | - | bundleId | java.lang.String | 136 | - | timeout | java.lang.Long | 50000 | - When I create a new JobStep from the existing creator - And Search for step definition with the name "Bundle Start" - And I prepare a JobStepCreator with the name "TestStep1" and the following properties - | name | type | value | - | bundleId | java.lang.String | 36 | - | timeout | java.lang.Long | 50000 | - When I create a new JobStep from the existing creator - And I count the JobSteps and I find 2 JobStep within 30 seconds - Then No exception was thrown - And I start a job - Given I query for the job with the name "TestJob" and I count 1 execution item and I confirm the executed job is finished within 20 seconds - And I search for the last job target in the database - And I confirm the step index is 0 and status is "PROCESS_FAILED" - And I logout - - Scenario: Starting job with Bundle Stop and Bundle Start step and multiple devices - Create a new job. Set a disconnected Kura Mock devices as a job targets. - Add a new Bundle Stop and Bundle Start step to the created job. Start the job. - After the executed job is finished, the step index of executed targets should - be 0 and the status PROCESS_FAILED - - Given I login as user with name "kapua-sys" and password "kapua-password" - And I add 2 devices to Kura Mock - When Devices are connected within 10 seconds - And I wait 1 second - Then Device status is "CONNECTED" within 10 seconds - And I wait 1 second - When KuraMock is disconnected - And I wait 1 second - Then Device status is "DISCONNECTED" within 10 seconds - And I select account "kapua-sys" - And I get the KuraMock device after 5 seconds - Given I create a job with the name "TestJob" - And I add targets to job - When I count the targets in the current scope - Then I count 2 - And Search for step definition with the name "Bundle Stop" - And I prepare a JobStepCreator with the name "TestStep" and the following properties - | name | type | value | - | bundleId | java.lang.String | 136 | - | timeout | java.lang.Long | 50000 | - When I create a new JobStep from the existing creator - And Search for step definition with the name "Bundle Start" - And I prepare a JobStepCreator with the name "TestStep1" and the following properties - | name | type | value | - | bundleId | java.lang.String | 36 | - | timeout | java.lang.Long | 50000 | - When I create a new JobStep from the existing creator - And I count the JobSteps and I find 2 JobStep within 30 seconds - Then No exception was thrown - And I start a job - Given I query for the job with the name "TestJob" and I count 1 execution item and I confirm the executed job is finished within 20 seconds - And I search for the last job target in the database - And I confirm the step index is 0 and status is "PROCESS_FAILED" - And I logout - - Scenario: Starting job with Package Download/Install and Bundle Start steps and multiple devices - Create a new job. Set a disconnected Kura Mock devices as a job targets. - Add a new Package Install and Bundle Start steps to the created job. Start the job. - After the executed job is finished, the step index of executed targets should - be 0 and the status PROCESS_FAILED - - Given I login as user with name "kapua-sys" and password "kapua-password" - And I add 2 devices to Kura Mock - When Devices are connected within 10 seconds - And I wait 1 second - Then Device status is "CONNECTED" within 10 seconds - And I select account "kapua-sys" - And I get the KuraMock device after 5 seconds - And Packages are requested and 1 package is received - When KuraMock is disconnected - And I wait 1 second - Then Device status is "DISCONNECTED" within 10 seconds - Given I create a job with the name "TestJob" - And I add targets to job - When I count the targets in the current scope - Then I count 2 - And Search for step definition with the name "Package Download / Install" - And I prepare a JobStepCreator with the name "TestStep" and the following properties - | name | type | value | - | packageDownloadRequest | org.eclipse.kapua.service.device.management.packages.model.download.DevicePackageDownloadRequest | http://download.eclipse.org/kura/releases/3.2.0/org.eclipse.kura.demo.heater_1.0.300.dpheater1.0.300true | - | timeout | java.lang.Long | 10000 | - When I create a new JobStep from the existing creator - And Search for step definition with the name "Bundle Start" - And I prepare a JobStepCreator with the name "TestStep1" and the following properties - | name | type | value | - | bundleId | java.lang.String | 36 | - | timeout | java.lang.Long | 50000 | - When I create a new JobStep from the existing creator - And I count the JobSteps and I find 2 JobStep within 30 seconds - Then No exception was thrown - And I start a job - Given I query for the job with the name "TestJob" and I count 1 execution item and I confirm the executed job is finished within 20 seconds - And I search for the last job target in the database - And I confirm the step index is 0 and status is "PROCESS_FAILED" - And I add 2 devices to Kura Mock - And Devices are connected within 10 seconds - And Packages are requested - Then Number of received packages is 1 - And Bundles are requested - And I logout - - Scenario: Starting job with Package Uninstall and Bundle start steps and multiple device - Create a new job. Set a disconnected Kura Mock devices as a job targets. - Add a new Package Uninstall and Bundle Start steps to the created job. Start the job. - After the executed job is finished, the step index of executed targets should - be 0 and the status PROCESS_FAILED - - Given I login as user with name "kapua-sys" and password "kapua-password" - And I add 2 devices to Kura Mock - When Devices are connected within 10 seconds - And I wait 1 second - Then Device status is "CONNECTED" within 10 seconds - When KuraMock is disconnected - And I wait 1 second - Then Device status is "DISCONNECTED" within 10 seconds - And I select account "kapua-sys" - And I get the KuraMock device after 5 seconds - Given I create a job with the name "TestJob" - And I add targets to job - When I count the targets in the current scope - Then I count 2 - And Search for step definition with the name "Package Uninstall" - And I prepare a JobStepCreator with the name "TestStep" and the following properties - | name | type | value | - | packageUninstallRequest | org.eclipse.kapua.service.device.management.packages.model.uninstall.DevicePackageUninstallRequest | org.eclipse.kura.example.beacon1.0.300true10000 | - | timeout | java.lang.Long | 30000 | - When I create a new JobStep from the existing creator - And Search for step definition with the name "Bundle Start" - And I prepare a JobStepCreator with the name "TestStep1" and the following properties - | name | type | value | - | bundleId | java.lang.String | 36 | - | timeout | java.lang.Long | 50000 | - When I create a new JobStep from the existing creator - And I count the JobSteps and I find 2 JobStep within 30 seconds - Then No exception was thrown - And I start a job - Given I query for the job with the name "TestJob" and I count 1 execution item and I confirm the executed job is finished within 20 seconds - And I search for the last job target in the database - And I confirm the step index is 0 and status is "PROCESS_FAILED" - And I logout - - Scenario: Starting job with Asset Write and Bundle Start steps and multiple devices - Create a new job. Set a disconnected Kura Mock devices as a job targets. - Add a new Asset Write and Bundle Start steps to the created job. Start the job. - After the executed job is finished, the step index of executed targets should - be 0 and the status PROCESS_FAILED - - Given I login as user with name "kapua-sys" and password "kapua-password" - And I add 2 devices to Kura Mock - When Devices are connected within 10 seconds - And I wait 1 second - Then Device status is "CONNECTED" within 10 seconds - When KuraMock is disconnected - And I wait 1 second - Then Device status is "DISCONNECTED" within 10 seconds - And I select account "kapua-sys" - And I get the KuraMock device after 5 seconds - Given I create a job with the name "TestJob" - And I add targets to job - When I count the targets in the current scope - Then I count 2 - And Search for step definition with the name "Asset Write" - And I prepare a JobStepCreator with the name "TestStep" and the following properties - | name | type | value | - | assets | org.eclipse.kapua.service.device.management.asset.DeviceAssets | assetNamebinaryEGVzdCBzdHJpbmcgdmFsdWU=binaryTest | - | timeout | java.lang.Long | 50000 | - When I create a new JobStep from the existing creator - And Search for step definition with the name "Bundle Start" - And I prepare a JobStepCreator with the name "TestStep1" and the following properties - | name | type | value | - | bundleId | java.lang.String | 36 | - | timeout | java.lang.Long | 50000 | - When I create a new JobStep from the existing creator - And I count the JobSteps and I find 2 JobStep within 30 seconds - Then No exception was thrown - And I start a job - Given I query for the job with the name "TestJob" and I count 1 execution item and I confirm the executed job is finished within 20 seconds - And I search for the last job target in the database - And I confirm the step index is 0 and status is "PROCESS_FAILED" - And I logout - - Scenario: Starting job with Configuration Put and Bundle Start steps and multiple devices - Create a new job. Set a disconnected Kura Mock devices as a job targets. - Add a new Configuration Put and BundleStart steps to the created job. Start the job. - After the executed job is finished, the step index of executed targets should - be 0 and the status PROCESS_FAILED - - Given I login as user with name "kapua-sys" and password "kapua-password" - And I add 2 devices to Kura Mock - When Devices are connected within 10 seconds - And I wait 1 second - Then Device status is "CONNECTED" within 10 seconds - When KuraMock is disconnected - And I wait 1 second - Then Device status is "DISCONNECTED" within 10 seconds - And I select account "kapua-sys" - And I get the KuraMock device after 5 seconds - Given I create a job with the name "TestJob" - And I add targets to job - When I count the targets in the current scope - Then I count 2 - And Search for step definition with the name "Configuration Put" - And I prepare a JobStepCreator with the name "TestStep" and the following properties - | name | type | value | - | configuration | org.eclipse.kapua.service.device.management.configuration.DeviceConfiguration | org.eclipse.kura.demo.heater.Heater0.256022:00falseorg.eclipse.kura.demo.heater.Heaterorg.eclipse.kura.demo.heater.Heater06:00Programdata/21030.0213.030.0 | - | timeout | java.lang.Long | 50000 | - When I create a new JobStep from the existing creator - And Search for step definition with the name "Bundle Start" - And I prepare a JobStepCreator with the name "TestStep1" and the following properties - | name | type | value | - | bundleId | java.lang.String | 36 | - | timeout | java.lang.Long | 50000 | - When I create a new JobStep from the existing creator - And I count the JobSteps and I find 2 JobStep within 30 seconds - Then No exception was thrown - And I start a job - Given I query for the job with the name "TestJob" and I count 1 execution item and I confirm the executed job is finished within 20 seconds - And I search for the last job target in the database - And I confirm the step index is 0 and status is "PROCESS_FAILED" - And I logout - - Scenario: Starting job with Command Execution and Bundle Start steps and multiple devices - Create a new job. Set a disconnected Kura Mock devices as a job targets. - Add a new Command Execution and Bundle Start steps to the created job. Start the job. - After the executed job is finished, the step index of executed targets should - be 0 and the status PROCESS_FAILED - - Given I login as user with name "kapua-sys" and password "kapua-password" - And I add 2 devices to Kura Mock - When Devices are connected within 10 seconds - And I wait 1 second - Then Device status is "CONNECTED" within 10 seconds - When KuraMock is disconnected - And I wait 1 second - Then Device status is "DISCONNECTED" within 10 seconds - And I select account "kapua-sys" - And I get the KuraMock device after 5 seconds - Given I create a job with the name "TestJob" - And I add targets to job - When I count the targets in the current scope - Then I count 2 - And Search for step definition with the name "Command Execution" - And I prepare a JobStepCreator with the name "TestStep" and the following properties - | name | type | value | - | commandInput | org.eclipse.kapua.service.device.management.command.DeviceCommandInput | pwd30000false | - | timeout | java.lang.Long | 50000 | - When I create a new JobStep from the existing creator - And Search for step definition with the name "Bundle Start" - And I prepare a JobStepCreator with the name "TestStep1" and the following properties - | name | type | value | - | bundleId | java.lang.String | 36 | - | timeout | java.lang.Long | 50000 | - When I create a new JobStep from the existing creator - And I count the JobSteps and I find 2 JobStep within 30 seconds - Then No exception was thrown - And I start a job - Given I query for the job with the name "TestJob" and I count 1 execution item and I confirm the executed job is finished within 20 seconds - And I search for the last job target in the database - And I confirm the step index is 0 and status is "PROCESS_FAILED" - And I logout - - @teardown - Scenario: Tear down test resources - Given Stop Docker environment - And Clean Locator Instance diff --git a/qa/integration/src/test/resources/features/jobEngine/JobEngineServiceStartOnlineDeviceI9n.feature b/qa/integration/src/test/resources/features/jobEngine/JobEngineServiceStartOnlineDeviceI9n.feature deleted file mode 100644 index 6dec95a2886..00000000000 --- a/qa/integration/src/test/resources/features/jobEngine/JobEngineServiceStartOnlineDeviceI9n.feature +++ /dev/null @@ -1,867 +0,0 @@ -############################################################################### -# Copyright (c) 2019, 2024 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 -############################################################################### -@env_docker -@it -@jobEngineStartOnlineDevice - -Feature: JobEngineService start job tests with online device - - @setup - Scenario: Setup test resources - Given Init Security Context - And Start Docker environment with resources - | db | - | events-broker | - | job-engine | - | message-broker | - | broker-auth-service | - | consumer-lifecycle | - - # *********************************************** - # * Starting a job with one Target and one Step * - # *********************************************** - - Scenario: Starting a job with valid Command Execution step - Create a new job and set a connected KuraMock device as the job target. - Add a new Command Execution step to the created job. Start the job. - After the executed job is finished, the executed target's step index should - be 0 and the status PROCESS_OK. - - Given I login as user with name "kapua-sys" and password "kapua-password" - And I start the Kura Mock - When Device is connected within 10 seconds - Then Device status is "CONNECTED" within 10 seconds - And I select account "kapua-sys" - And I get the KuraMock device after 5 seconds - When I search for events from device "rpione3" in account "kapua-sys" I find 1 event within 30 seconds - And The type of the last event is "BIRTH" - Given I create a job with the name "TestJob" - And I create a new job target item - And Search for step definition with the name "Command Execution" - And I prepare a JobStepCreator with the name "TestStep" and the following properties - | name | type | value | - | commandInput | org.eclipse.kapua.service.device.management.command.DeviceCommandInput | pwd30000false | - | timeout | java.lang.Long | 10000 | - When I create a new JobStep from the existing creator - Then No exception was thrown - And I start a job - And I confirm job target has step index 0 and status "PROCESS_OK" within 31 seconds - And I query for the job with the name "TestJob" and I count 1 execution item and I confirm the executed job is finished within 20 seconds - And I search for events from device "rpione3" in account "kapua-sys" I find 2 events within 30 seconds - And KuraMock is disconnected - And I logout - - Scenario: Starting a job with valid Bundle Start step - Create a new job and set a connected KuraMock device as the job target. - Add a new Bundle Start step to the created job. Start the job. - After the executed job is finished, the executed target's step index should - be 0 and the status PROCESS_OK - - Given I login as user with name "kapua-sys" and password "kapua-password" - And I start the Kura Mock - And Device is connected within 10 seconds - Then Device status is "CONNECTED" within 10 seconds - And I select account "kapua-sys" - And I get the KuraMock device after 5 seconds - And Bundles are requested - Then A bundle named "slf4j.api" with id 34 and version "1.7.21" is present and "RESOLVED" - When I search for events from device "rpione3" in account "kapua-sys" I find 2 events within 30 seconds - And The type of the last event is "BUNDLE" - And I create a job with the name "TestJob" - And I create a new job target item - And Search for step definition with the name "Bundle Start" - And I prepare a JobStepCreator with the name "TestStep" and the following properties - | name | type | value | - | bundleId | java.lang.String | 34 | - | timeout | java.lang.Long | 10000 | - When I create a new JobStep from the existing creator - Then No exception was thrown - And I start a job - And I confirm job target has step index 0 and status "PROCESS_OK" within 31 seconds - And I query for the job with the name "TestJob" and I count 1 execution item and I confirm the executed job is finished within 20 seconds - When I search for events from device "rpione3" in account "kapua-sys" I find 3 events within 30 seconds - And Bundles are requested - And A bundle named "slf4j.api" with id 34 and version "1.7.21" is present and "ACTIVE" - When KuraMock is disconnected - And I logout - - Scenario: Starting a job with valid Bundle Stop step - Create a new job and set a connected KuraMock device as the job target. - Add a new Bundle Stop step to the created job. Start the job. - After the executed job is finished, the executed target's step index should - be 0 and the status PROCESS_OK - - Given I login as user with name "kapua-sys" and password "kapua-password" - And I start the Kura Mock - And Device is connected within 10 seconds - And Device status is "CONNECTED" within 10 seconds - And I select account "kapua-sys" - And I get the KuraMock device after 5 seconds - And Bundles are requested - And A bundle named "org.eclipse.kura.linux.bluetooth" with id 77 and version "1.0.300" is present and "ACTIVE" - When I search for events from device "rpione3" in account "kapua-sys" I find 2 events within 30 seconds - And The type of the last event is "BUNDLE" - And I create a job with the name "TestJob" - And I create a new job target item - And Search for step definition with the name "Bundle Stop" - And I prepare a JobStepCreator with the name "TestStep" and the following properties - | name | type | value | - | bundleId | java.lang.String | 77 | - | timeout | java.lang.Long | 10000 | - When I create a new JobStep from the existing creator - Then No exception was thrown - And I start a job - And I confirm job target has step index 0 and status "PROCESS_OK" within 31 seconds - And I query for the job with the name "TestJob" and I count 1 execution item and I confirm the executed job is finished within 20 seconds - When I search for events from device "rpione3" in account "kapua-sys" I find 3 events within 30 seconds - And Bundles are requested - And A bundle named "org.eclipse.kura.linux.bluetooth" with id 77 and version "1.0.300" is present and "RESOLVED" - And KuraMock is disconnected - And I logout - - Scenario: Starting a job with valid Configuration Put step - Create a new job and set a connected KuraMock device as the job target. - Add a new valid Configuration Put step to the created job. Start the job. - After the executed job is finished, the executed target's step index should - be 0 and the status PROCESS_OK - - Given I login as user with name "kapua-sys" and password "kapua-password" - And I start the Kura Mock - When Device is connected within 10 seconds - Then Device status is "CONNECTED" within 10 seconds - And I select account "kapua-sys" - And I get the KuraMock device after 5 seconds - When Configuration is requested - Then A Configuration named "org.eclipse.kura.clock.ClockService" has property "clock.ntp.retry.interval" with value "5" - When I search for events from device "rpione3" in account "kapua-sys" I find 2 events within 30 seconds - And The type of the last event is "CONFIGURATION" - And I create a job with the name "TestJob" - And I create a new job target item - And Search for step definition with the name "Configuration Put" - And I prepare a JobStepCreator with the name "TestStep" and the following properties - | name | type | value | - | configuration | org.eclipse.kapua.service.device.management.configuration.DeviceConfiguration | org.eclipse.kura.clock.ClockService>0.pool.ntp.orgjava-ntp12303600truetrue1000010 | - | timeout | java.lang.Long | 10000 | - Then I create a new JobStep from the existing creator - And I start a job - And I confirm job target has step index 0 and status "PROCESS_OK" within 31 seconds - When I query for the job with the name "TestJob" and I count 1 execution item and I confirm the executed job is finished within 20 seconds - When I search for events from device "rpione3" in account "kapua-sys" I find 3 events within 30 seconds - And The type of the last event is "CONFIGURATION" - And Configuration is requested - And A Configuration named "org.eclipse.kura.clock.ClockService" has property "clock.ntp.retry.interval" with value "10" - And KuraMock is disconnected - And I logout - - Scenario: Starting a job with valid Package Install step - Create a new job and set a connected KuraMock device as the job target. - Add a new valid Package Install step to the created job. Start the job. - After the executed job is finished, the executed target's step index should - be 0 and the status PROCESS_OK. - - Given I login as user with name "kapua-sys" and password "kapua-password" - And I start the Kura Mock - And Device is connected within 10 seconds - Then Device status is "CONNECTED" within 10 seconds - And I select account "kapua-sys" - And I get the KuraMock device after 5 seconds - And Packages are requested and 1 package is received - When I search for events from device "rpione3" in account "kapua-sys" I find 2 events within 30 seconds - And The type of the last event is "DEPLOY" - And I create a job with the name "TestJob" - And I create a new job target item - And Search for step definition with the name "Package Download / Install" - And I prepare a JobStepCreator with the name "TestStep" and the following properties - | name | type | value | - | packageDownloadRequest | org.eclipse.kapua.service.device.management.packages.model.download.DevicePackageDownloadRequest | http://download.eclipse.org/kura/releases/3.2.0/org.eclipse.kura.example.publisher_1.0.300.dpExample Publisher1.0.300true | - | timeout | java.lang.Long | 30000 | - When I create a new JobStep from the existing creator - Then No exception was thrown - And I start a job - And I confirm job target has step index 0 and status "PROCESS_OK" within 31 seconds - And I query for the job with the name "TestJob" and I count 1 execution items or more and I confirm the executed jobs are finished within 45 seconds - When I search for events from device "rpione3" in account "kapua-sys" I find 3 or more events within 30 seconds - And Packages are requested and 2 packages are received - And KuraMock is disconnected - And I logout - - Scenario: Starting a job with valid Asset Write step - Create a new job and set a connected KuraMock device as the job target. - Add a new valid Asset Write step to the created job. Start the job. - After the executed job is finished, the executed target's step index should - be 0 and the status PROCESS_OK - - Given I login as user with name "kapua-sys" and password "kapua-password" - And I start the Kura Mock - When Device is connected within 10 seconds - Then Device status is "CONNECTED" within 10 seconds - And I select account "kapua-sys" - And I get the KuraMock device after 5 seconds - When Device assets are requested - Then Asset with name "asset1" and channel with name "channel1" and value 123 are received - When I search for events from device "rpione3" in account "kapua-sys" I find 2 events within 30 seconds - And The type of the last event is "ASSET" - And I create a job with the name "TestJob" - And I create a new job target item - And Search for step definition with the name "Asset Write" - And I prepare a JobStepCreator with the name "TestStep" and the following properties - | name | type | value | - | assets | org.eclipse.kapua.service.device.management.asset.DeviceAssets | asset1java.lang.Integer1233channel1 | - | timeout | java.lang.Long | 10000 | - When I create a new JobStep from the existing creator - Then No exception was thrown - And I start a job - And I confirm job target has step index 0 and status "PROCESS_OK" within 31 seconds - And I query for the job with the name "TestJob" and I count 1 execution item and I confirm the executed job is finished within 20 seconds - When I search for events from device "rpione3" in account "kapua-sys" I find 3 events within 30 seconds - When Device assets are requested - Then Asset with name "asset1" and channel with name "channel1" and value 1233 are received - And KuraMock is disconnected - And I logout - - Scenario: Starting a job with valid Package Uninstall step - Create a new job. Set a connected Kura Mock device as a job target. - Add a new valid Package Uninstall step to the created job. Start the job. - After the executed job is finished, the step index of executed targets should - be 0 and the status PROCESS_OK - - Given I login as user with name "kapua-sys" and password "kapua-password" - And I start the Kura Mock - When Device is connected within 10 seconds - Then Device status is "CONNECTED" within 10 seconds - And I select account "kapua-sys" - And I get the KuraMock device after 5 seconds - And Packages are requested and 1 package is received - When I search for events from device "rpione3" in account "kapua-sys" I find 2 events within 30 seconds - And The type of the last event is "DEPLOY" - And I create a job with the name "TestJob" - And I create a new job target item - And Search for step definition with the name "Package Uninstall" - And I prepare a JobStepCreator with the name "TestStep" and the following properties - | name | type | value | - | packageUninstallRequest | org.eclipse.kapua.service.device.management.packages.model.uninstall.DevicePackageUninstallRequest | org.eclipse.kura.example.beacon1.0.300true10000 | - | timeout | java.lang.Long | 10000 | - When I create a new JobStep from the existing creator - Then No exception was thrown - And I start a job - And I confirm job target has step index 0 and status "PROCESS_OK" within 31 seconds - And I query for the job with the name "TestJob" and I count 1 execution items or more and I confirm the executed jobs are finished within 45 seconds - When I search for events from device "rpione3" in account "kapua-sys" I find 3 or more events within 30 seconds - And Packages are requested and 0 packages are received - And KuraMock is disconnected - And I logout - - #***************************************************** - #* Starting a job with one Target and multiple Steps * - #***************************************************** - - Scenario: Starting job with valid Command Execution and Package Install steps - Create a new job. Set a connected Kura Mock device as a job target. - Add a new valid Command Execution and Package Install steps to the created job. Start the job. - After the executed job is finished, the step index of executed targets should - be 0 and the status PROCESS_OK - - Given I login as user with name "kapua-sys" and password "kapua-password" - And I start the Kura Mock - When Device is connected within 10 seconds - Then Device status is "CONNECTED" within 10 seconds - And I select account "kapua-sys" - And I get the KuraMock device after 5 seconds - And Command "pwd" is executed - And Packages are requested and 1 package is received - When I search for events from device "rpione3" in account "kapua-sys" I find 3 events within 30 seconds - Then The type of the last event is "DEPLOY" - And I create a job with the name "TestJob" - And I create a new job target item - And I search for step definition with the name - | Command Execution | - | Package Download / Install | - And I prepare a JobStepCreator with the name "TestStep1" and properties - | name | type | value | - | commandInput | org.eclipse.kapua.service.device.management.command.DeviceCommandInput | pwd30000false | - | packageDownloadRequest | org.eclipse.kapua.service.device.management.packages.model.download.DevicePackageDownloadRequest | http://download.eclipse.org/kura/releases/3.2.0/org.eclipse.kura.example.publisher_1.0.300.dpExample Publisher1.0.300true | - | timeout | java.lang.Long | 10000 | - And I create multiple new JobSteps from the existing creators - Then No exception was thrown - And I count the JobSteps and I find 2 JobStep within 30 seconds - And I start a job - And I confirm job target has step index 1 and status "PROCESS_OK" within 31 seconds - When I query for the job with the name "TestJob" and I count 1 execution items or more and I confirm the executed jobs are finished within 45 seconds - When I search for events from device "rpione3" in account "kapua-sys" I find 3 or more events within 30 seconds - And Packages are requested and 2 packages are received - When KuraMock is disconnected - And I logout - - Scenario: Starting a job with valid Bundle Start and Bundle Stop steps - Create a new job and set a connected KuraMock device as the job target. - Add two new Bundle Start and Bundle Stop steps to the created job. Start the job. - After the executed job is finished, the executed target's step index should - be 1 and the status PROCESS_OK - - Given I login as user with name "kapua-sys" and password "kapua-password" - And I start the Kura Mock - And Device is connected within 10 seconds - Then Device status is "CONNECTED" within 10 seconds - And I select account "kapua-sys" - And I get the KuraMock device after 5 seconds - And Bundles are requested - Then A bundle named "slf4j.api" with id 34 and version "1.7.21" is present and "RESOLVED" - And A bundle named "org.eclipse.kura.linux.bluetooth" with id 77 and version "1.0.300" is present and "ACTIVE" - When I search for events from device "rpione3" in account "kapua-sys" I find 2 events within 30 seconds - And The type of the last event is "BUNDLE" - And I create a job with the name "TestJob" - And I create a new job target item - And Search for step definition with the name "Bundle Start" - And I prepare a JobStepCreator with the name "TestStep1" and the following properties - | name | type | value | - | bundleId | java.lang.String | 34 | - | timeout | java.lang.Long | 10000 | - And I create a new JobStep from the existing creator - Then Search for step definition with the name "Bundle Stop" - And I prepare a JobStepCreator with the name "TestStep2" and the following properties - | name | type | value | - | bundleId | java.lang.String | 77 | - | timeout | java.lang.Long | 10000 | - When I create a new JobStep from the existing creator - And I count the JobSteps and I find 2 JobStep within 30 seconds - And I start a job - And I confirm job target has step index 1 and status "PROCESS_OK" within 31 seconds - Given I query for the job with the name "TestJob" and I count 1 execution item and I confirm the executed job is finished within 20 seconds - When I search for events from device "rpione3" in account "kapua-sys" I find 4 events within 30 seconds - And Bundles are requested - Then A bundle named "slf4j.api" with id 34 and version "1.7.21" is present and "ACTIVE" - And A bundle named "org.eclipse.kura.linux.bluetooth" with id 77 and version "1.0.300" is present and "RESOLVED" - And KuraMock is disconnected - And I logout - - Scenario: Starting job with valid Configuration Put and Command Execution steps - Create a new job. Set a connected Kura Mock device as a job target. - Add a new valid Configuration Put and Command Execution steps to the created job. Start the job. - After the executed job is finished, the step index of executed targets should - be 1 and the status PROCESS_OK - - Given I login as user with name "kapua-sys" and password "kapua-password" - And I start the Kura Mock - And Device is connected within 10 seconds - Then Device status is "CONNECTED" within 10 seconds - And I select account "kapua-sys" - And I get the KuraMock device after 5 seconds - And Configuration is requested - Then A Configuration named "org.eclipse.kura.clock.ClockService" has property "clock.ntp.retry.interval" with value "5" - And Command "pwd" is executed - When I search for events from device "rpione3" in account "kapua-sys" I find 3 events within 30 seconds - And The type of the last event is "COMMAND" - And I create a job with the name "TestJob" - And I create a new job target item - And I search for step definitions with the name - | Configuration Put | - | Command Execution | - And I prepare a JobStepCreator with the name "TestStep1" and properties - | name | type | value | - | configuration | org.eclipse.kapua.service.device.management.configuration.DeviceConfiguration | org.eclipse.kura.clock.ClockService>0.pool.ntp.orgjava-ntp12303600truetrue1000010 | - | commandInput | org.eclipse.kapua.service.device.management.command.DeviceCommandInput | pwd30000false | - | timeout | java.lang.Long | 10000 | - When I create multiple new JobSteps from the existing creators - And No exception was thrown - And I count the JobSteps and I find 2 JobStep within 30 seconds - Then I start a job - And I confirm job target has step index 1 and status "PROCESS_OK" within 31 seconds - Given I query for the job with the name "TestJob" and I count 1 execution item and I confirm the executed job is finished within 20 seconds - When I search for events from device "rpione3" in account "kapua-sys" I find 5 events within 30 seconds - And Configuration is requested - Then A Configuration named "org.eclipse.kura.clock.ClockService" has property "clock.ntp.retry.interval" with value "10" - When KuraMock is disconnected - And I logout - - Scenario: Starting a job with valid Package Uninstall and Asset Write steps - Create a new job and set a connected KuraMock device as the job target. - Add new valid Package Uninstall and Asset Write steps to the created job. Start the job. - After the executed job is finished, the executed target's step index should - be 1 and the status PROCESS_OK - - Given I login as user with name "kapua-sys" and password "kapua-password" - And I start the Kura Mock - And Device is connected within 10 seconds - Then Device status is "CONNECTED" within 10 seconds - And I select account "kapua-sys" - And I get the KuraMock device after 5 seconds - When Device assets are requested - Then Asset with name "asset1" and channel with name "channel1" and value 123 are received - And Packages are requested and 1 package is received - When I search for events from device "rpione3" in account "kapua-sys" I find 3 events within 30 seconds - And The type of the last event is "DEPLOY" - And I create a job with the name "TestJob" - And I create a new job target item - And I search for step definitions with the name - | Package Uninstall | - | Asset Write | - And I prepare a JobStepCreator with the name "TestStep1" and properties - | name | type | value | - | packageUninstallRequest | org.eclipse.kapua.service.device.management.packages.model.uninstall.DevicePackageUninstallRequest | org.eclipse.kura.example.beacon1.0.300true10000 | - | assets | org.eclipse.kapua.service.device.management.asset.DeviceAssets | asset1java.lang.Integer1233channel1 | - | timeout | java.lang.Long | 10000 | - When I create multiple new JobSteps from the existing creators - And No exception was thrown - And I count the JobSteps and I find 2 JobStep within 30 seconds - And I start a job - And I confirm job target has step index 1 and status "PROCESS_OK" within 31 seconds - And I query for the job with the name "TestJob" and I count 1 execution items or more and I confirm the executed jobs are finished within 45 seconds - When I search for events from device "rpione3" in account "kapua-sys" I find 3 or more events within 30 seconds - When Device assets are requested - Then Asset with name "asset1" and channel with name "channel1" and value 1233 are received - And Packages are requested and 0 packages are received - And KuraMock is disconnected - And I logout - - #***************************************************** - #* Starting a job with multiple Targets and one Step * - #***************************************************** - - Scenario: Starting job with valid Command Execution step and multiple devices - Create a new job. Set connected Kura Mock devices as a job targets. - Add a new valid Command Execution step to the created job. Start the job. - After the executed job is finished, the step index of executed targets should - be 0 and the status PROCESS_OK - - Given I login as user with name "kapua-sys" and password "kapua-password" - And I add 2 devices to Kura Mock - And Devices are connected within 10 seconds - And I wait 1 second - Then Device status is "CONNECTED" within 10 seconds - And I select account "kapua-sys" - And I get the KuraMock devices after 5 seconds - And Command "pwd" is executed - And I search events from devices in account "kapua-sys" and 2 events are found - And The type of the last event is "COMMAND" - And I create a job with the name "TestJob" - And I add targets to job - And Search for step definition with the name "Command Execution" - And I prepare a JobStepCreator with the name "TestStep" and the following properties - | name | type | value | - | commandInput | org.eclipse.kapua.service.device.management.command.DeviceCommandInput | pwd30000false | - | timeout | java.lang.Long | 10000 | - When I create a new JobStep from the existing creator - Then No exception was thrown - And I start a job - And I confirm job target has step index 0 and status "PROCESS_OK" within 31 seconds - And I query for the job with the name "TestJob" and I count 1 execution item and I confirm the executed job is finished within 20 seconds - And I search events from devices in account "kapua-sys" and 3 events are found - When KuraMock is disconnected - And I logout - - Scenario: Starting job with valid Bundle Start step and multiple devices - Create a new job. Set connected Kura Mock devices as a job targets. - Add a new Bundle Start step to the created job. Start the job. - After the executed job is finished, the step index of executed targets should - be 0 and the status PROCESS_OK - - Given I login as user with name "kapua-sys" and password "kapua-password" - And I add 2 devices to Kura Mock - And Device are connected within 10 seconds - And I wait 1 second - Then Device status is "CONNECTED" within 10 seconds - And I select account "kapua-sys" - And I get the KuraMock devices after 5 seconds - And Bundles are requested - And A bundle named "slf4j.api" with id 34 and version "1.7.21" is present and "RESOLVED" - And I search events from devices in account "kapua-sys" and 2 events are found - And The type of the last event is "BUNDLE" - And I create a job with the name "TestJob" - And I add targets to job - And Search for step definition with the name "Bundle Start" - And I prepare a JobStepCreator with the name "TestStep" and the following properties - | name | type | value | - | bundleId | java.lang.String | 34 | - | timeout | java.lang.Long | 10000 | - When I create a new JobStep from the existing creator - Then No exception was thrown - And I start a job - And I confirm job target has step index 0 and status "PROCESS_OK" within 31 seconds - And I query for the job with the name "TestJob" and I count 1 execution item and I confirm the executed job is finished within 20 seconds - And I search events from devices in account "kapua-sys" and 3 events are found - And Bundles are requested - Then A bundle named "slf4j.api" with id 34 and version "1.7.21" is present and "ACTIVE" - And KuraMock is disconnected - And I logout - - Scenario: Starting job with invalid Bundle Start step and multiple devices - Create a new job. Set connected Kura Mock devices as a job targets. - Add a new Bundle Start step to the created job. Start the job. - After the executed job is finished, the step index of executed targets should - be 0 and the status PROCESS_FAILED - - Given I login as user with name "kapua-sys" and password "kapua-password" - And I add 2 devices to Kura Mock - And Device are connected within 10 seconds - And I wait 1 second - Then Device status is "CONNECTED" within 10 seconds - And I select account "kapua-sys" - And I get the KuraMock devices after 5 seconds - And Bundles are requested - Then A bundle named "slf4j.api" with id 34 and version "1.7.21" is present and "RESOLVED" - And I search events from devices in account "kapua-sys" and 2 events are found - And The type of the last event is "BUNDLE" - And I create a job with the name "TestJob" - And I add targets to job - And Search for step definition with the name "Bundle Start" - And I prepare a JobStepCreator with the name "TestStep" and the following properties - | name | type | value | - | bundleId | java.lang.String | #34 | - | timeout | java.lang.Long | 10000 | - When I create a new JobStep from the existing creator - Then No exception was thrown - And I start a job - And I confirm job target has step index 0 and status "PROCESS_FAILED" within 31 seconds - And I query for the job with the name "TestJob" and I count 1 execution item and I confirm the executed job is finished within 20 seconds - And I search events from devices in account "kapua-sys" and 2 events are found - And Bundles are requested - Then A bundle named "slf4j.api" with id 34 and version "1.7.21" is present and "RESOLVED" - And KuraMock is disconnected - And I logout - - Scenario: Starting a job with valid Bundle Stop step and multiple devices - Create a new job and set connected KuraMock devices as the job targets. - Add a new valid Bundle Stop step to the created job. Start the job. - After the executed job is finished, the executed target's step index should - be 0 and the status PROCESS_OK - - Given I login as user with name "kapua-sys" and password "kapua-password" - And I add 2 devices to Kura Mock - And Devices are connected within 10 seconds - And I wait 1 second - Then Device status is "CONNECTED" within 10 seconds - And I select account "kapua-sys" - And I get the KuraMock devices after 5 seconds - And Bundles are requested - And A bundle named "org.eclipse.kura.linux.bluetooth" with id 77 and version "1.0.300" is present and "ACTIVE" - And I search events from devices in account "kapua-sys" and 2 events are found - And The type of the last event is "BUNDLE" - And I create a job with the name "TestJob" - And I add targets to job - And Search for step definition with the name "Bundle Stop" - And I prepare a JobStepCreator with the name "TestStep" and the following properties - | name | type | value | - | bundleId | java.lang.String | 77 | - | timeout | java.lang.Long | 10000 | - When I create a new JobStep from the existing creator - Then No exception was thrown - And I start a job - And I confirm job target has step index 0 and status "PROCESS_OK" within 31 seconds - And I query for the job with the name "TestJob" and I count 1 execution item and I confirm the executed job is finished within 20 seconds - And I search events from devices in account "kapua-sys" and 3 events are found - Then Bundles are requested - And A bundle named "org.eclipse.kura.linux.bluetooth" with id 77 and version "1.0.300" is present and "RESOLVED" - Then KuraMock is disconnected - And I logout - - Scenario: Starting a job with valid Configuration Put step and multiple devices - Create a new job and set connected KuraMock devices as the job targets. - Add a new valid Configuration Put step to the created job. Start the job. - After the executed job is finished, the executed target's step index should - be 0 and the status PROCESS_OK - - Given I login as user with name "kapua-sys" and password "kapua-password" - And I add 2 devices to Kura Mock - And Devices are connected within 10 seconds - And I select account "kapua-sys" - And I get the KuraMock devices after 5 seconds - Then Configuration is requested - And A Configuration named "org.eclipse.kura.clock.ClockService" has property "clock.ntp.retry.interval" with value "5" - And I search events from devices in account "kapua-sys" and 2 events are found - And I create a job with the name "TestJob" - And I add targets to job - When I count the targets in the current scope and I count 2 - And Search for step definition with the name "Configuration Put" - And I prepare a JobStepCreator with the name "TestStep" and the following properties - | name | type | value | - | configuration | org.eclipse.kapua.service.device.management.configuration.DeviceConfiguration | org.eclipse.kura.clock.ClockService>0.pool.ntp.orgjava-ntp12303600truetrue1000010 | - | timeout | java.lang.Long | 10000 | - When I create a new JobStep from the existing creator - Then I start a job - And I confirm job target has step index 0 and status "PROCESS_OK" within 31 seconds - And I query for the job with the name "TestJob" and I count 1 execution item and I confirm the executed job is finished within 20 seconds - And I search events from devices in account "kapua-sys" and 3 events are found - Then Configuration is requested - And A Configuration named "org.eclipse.kura.clock.ClockService" has property "clock.ntp.retry.interval" with value "10" - And KuraMock is disconnected - And I logout - - Scenario: Starting a job with valid Asset Write step and multiple targets - Create a new job and set a connected KuraMock devices as the job targets. - Add a new valid Asset Write step to the created job. Start the job. - After the executed job is finished, the executed target's step index should - be 0 and the status PROCESS_OK - - Given I login as user with name "kapua-sys" and password "kapua-password" - And I add 2 devices to Kura Mock - When Devices are connected within 10 seconds - And I wait 1 second - Then Device status is "CONNECTED" within 10 seconds - And I select account "kapua-sys" - And I get the KuraMock devices after 5 seconds - And Device assets are requested - And Asset with name "asset1" and channel with name "channel1" and value 123 are received - And I search events from devices in account "kapua-sys" and 2 events are found - And The type of the last event is "ASSET" - And I create a job with the name "TestJob" - And I add targets to job - And Search for step definition with the name "Asset Write" - And I prepare a JobStepCreator with the name "TestStep" and the following properties - | name | type | value | - | assets | org.eclipse.kapua.service.device.management.asset.DeviceAssets | asset1java.lang.Integer1233channel1 | - | timeout | java.lang.Long | 10000 | - When I create a new JobStep from the existing creator - Then No exception was thrown - And I start a job - And I confirm job target has step index 0 and status "PROCESS_OK" within 31 seconds - And I query for the job with the name "TestJob" and I count 1 execution items and I confirm the executed jobs is finished within 20 seconds - And I search events from devices in account "kapua-sys" and 3 events are found - And Device assets are requested - And Asset with name "asset1" and channel with name "channel1" and value 1233 are received - When KuraMock is disconnected - And I logout - - Scenario: Starting a job with valid Package Uninstall step and multiple targets - Create a new job. Set a connected Kura Mock device as a job target. - Add a new valid Package Uninstall step to the created job. Start the job. - After the executed job is finished, the step index of executed targets should - be 0 and the status PROCESS_OK - - Given I login as user with name "kapua-sys" and password "kapua-password" - And I add 2 devices to Kura Mock - When Devices are connected within 10 seconds - And I wait 1 second - Then Device status is "CONNECTED" within 10 seconds - And I select account "kapua-sys" - And I get the KuraMock devices after 5 seconds - And Packages are requested and 1 package is received - When I search events from devices in account "kapua-sys" and 2 events are found - And I create a job with the name "TestJob" - And I add targets to job - And Search for step definition with the name "Package Uninstall" - And I prepare a JobStepCreator with the name "TestStep" and the following properties - | name | type | value | - | packageUninstallRequest | org.eclipse.kapua.service.device.management.packages.model.uninstall.DevicePackageUninstallRequest | org.eclipse.kura.example.beacon1.0.300true10000 | - | timeout | java.lang.Long | 10000 | - When I create a new JobStep from the existing creator - Then No exception was thrown - And I start a job - And I confirm job target has step index 0 and status "PROCESS_OK" within 31 seconds - Given I query for the job with the name "TestJob" and I count 1 execution items or more and I confirm the executed jobs are finished within 45 seconds - When I search events from devices in account "kapua-sys" and 3 or more events are found - And Packages are requested and 0 packages are received - And KuraMock is disconnected - And I logout - - Scenario: Starting a job with valid Package Install step and multiple devices - Create a new job and set a connected KuraMock devices as the job targets. - Add a new valid Package Install step to the created job. Start the job. - After the executed job is finished, the executed target's step index should - be 0 and the status PROCESS_OK. - - Given I login as user with name "kapua-sys" and password "kapua-password" - And I add 2 devices to Kura Mock - And Devices are connected within 10 seconds - And I wait 1 second - Then Device status is "CONNECTED" within 10 seconds - And I select account "kapua-sys" - And I get the KuraMock devices after 5 seconds - Then Packages are requested and 1 package is received - And I search events from devices in account "kapua-sys" and 2 events are found - And I create a job with the name "TestJob" - And I add targets to job - And Search for step definition with the name "Package Download / Install" - And I prepare a JobStepCreator with the name "TestStep" and the following properties - | name | type | value | - | packageDownloadRequest | org.eclipse.kapua.service.device.management.packages.model.download.DevicePackageDownloadRequest | http://download.eclipse.org/kura/releases/3.2.0/org.eclipse.kura.example.publisher_1.0.300.dpExample Publisher1.0.300true | - | timeout | java.lang.Long | 30000 | - When I create a new JobStep from the existing creator - Then No exception was thrown - And I start a job - And I confirm job target has step index 0 and status "PROCESS_OK" within 31 seconds - And I query for the job with the name "TestJob" and I count 1 execution items or more and I confirm the executed jobs are finished within 45 seconds - And I search events from devices in account "kapua-sys" and 3 or more events are found - When Packages are requested and 2 packages are received - And KuraMock is disconnected - And I logout - - #************************************************************ - #* Starting a job with multiple Targets and multiple Steps * - #************************************************************ - - Scenario: Starting job with valid Command Execution, valid Package Install steps and multiple devices - Create a new job. Set connected Kura Mock devices as a job targets. - Add a new valid Command Execution and Package Install steps to the created job. Start the job. - After the executed job is finished, the step index of executed targets should - be 0 and the status PROCESS_OK - - Given I login as user with name "kapua-sys" and password "kapua-password" - And I add 2 devices to Kura Mock - And Devices are connected within 10 seconds - And I wait 1 second - Then Devices status is "CONNECTED" within 10 seconds - And I select account "kapua-sys" - And I get the KuraMock devices after 5 seconds - And Command "pwd" is executed - And Packages are requested and 1 package is received - When I search events from devices in account "kapua-sys" and 3 events are found - And The type of the last event is "DEPLOY" - And I create a job with the name "TestJob" - And I add targets to job - And I search for step definition with the name - | Command Execution | - | Package Download / Install | - And I prepare a JobStepCreator with the name "TestStep1" and properties - | name | type | value | - | commandInput | org.eclipse.kapua.service.device.management.command.DeviceCommandInput | pwd30000false | - | packageDownloadRequest | org.eclipse.kapua.service.device.management.packages.model.download.DevicePackageDownloadRequest | http://download.eclipse.org/kura/releases/3.2.0/org.eclipse.kura.example.publisher_1.0.300.dpExample Publisher1.0.300true | - | timeout | java.lang.Long | 10000 | - And I create multiple new JobSteps from the existing creators - Then No exception was thrown - And I count the JobSteps and I find 2 JobStep within 30 seconds - And I start a job - And I confirm job target has step index 1 and status "PROCESS_OK" within 31 seconds - And I query for the job with the name "TestJob" and I count 1 execution items or more and I confirm the executed jobs are finished within 45 seconds - When I search events from devices in account "kapua-sys" and 3 or more events are found - And Packages are requested and 2 packages are received - When KuraMock is disconnected - And I logout - - Scenario: Starting a job with valid Bundle Start and Bundle Stop steps and multiple devices - Create a new job and set connected KuraMock devices as the job targets. - Add two new valid Bundle Start and Bundle Stop steps to the created job. Start the job. - After the executed job is finished, the executed target's step index should - be 1 and the status PROCESS_OK - - Given I login as user with name "kapua-sys" and password "kapua-password" - And I add 2 devices to Kura Mock - And Devices are connected within 10 seconds - And I wait 1 second - Then Device status is "CONNECTED" within 10 seconds - And I select account "kapua-sys" - And I get the KuraMock devices after 5 seconds - And Bundles are requested - Then A bundle named "slf4j.api" with id 34 and version "1.7.21" is present and "RESOLVED" - And A bundle named "org.eclipse.kura.linux.bluetooth" with id 77 and version "1.0.300" is present and "ACTIVE" - When I search events from devices in account "kapua-sys" and 2 events are found - And The type of the last event is "BUNDLE" - And I create a job with the name "TestJob" - And I add targets to job - And Search for step definition with the name "Bundle Start" - And I prepare a JobStepCreator with the name "TestStep1" and the following properties - | name | type | value | - | bundleId | java.lang.String | 34 | - | timeout | java.lang.Long | 10000 | - And I create a new JobStep from the existing creator - Then Search for step definition with the name "Bundle Stop" - And I prepare a JobStepCreator with the name "TestStep2" and the following properties - | name | type | value | - | bundleId | java.lang.String | 77 | - | timeout | java.lang.Long | 10000 | - When I create a new JobStep from the existing creator - And I count the JobSteps and I find 2 JobStep within 30 seconds - And I start a job - And I confirm job target has step index 1 and status "PROCESS_OK" within 31 seconds - Given I query for the job with the name "TestJob" and I count 1 execution item and I confirm the executed job is finished within 20 seconds - When I search events from devices in account "kapua-sys" and 4 events are found - And Bundles are requested - Then A bundle named "slf4j.api" with id 34 and version "1.7.21" is present and "ACTIVE" - And A bundle named "org.eclipse.kura.linux.bluetooth" with id 77 and version "1.0.300" is present and "RESOLVED" - And KuraMock is disconnected - And I logout - - Scenario: Starting job with valid Configuration Put and Command Execution steps and multiple devices - Create a new job. Set connected Kura Mock devices as a job targets. - Add a new valid Configuration Put and Command Execution steps to the created job. Start the job. - After the executed job is finished, the step index of executed targets should - be 1 and the status PROCESS_OK - - Given I login as user with name "kapua-sys" and password "kapua-password" - And I add 2 devices to Kura Mock - And Devices are connected within 10 seconds - And I wait 1 second - Then Device status is "CONNECTED" within 10 seconds - And I select account "kapua-sys" - And I get the KuraMock devices after 5 seconds - Then Configuration is requested - And A Configuration named "org.eclipse.kura.clock.ClockService" has property "clock.ntp.retry.interval" with value "5" - And Command "pwd" is executed - When I search events from devices in account "kapua-sys" and 3 events are found - And The type of the last event is "COMMAND" - And I create a job with the name "TestJob" - And I add targets to job - And I search for step definitions with the name - | Configuration Put | - | Command Execution | - And I prepare a JobStepCreator with the name "TestStep1" and properties - | name | type | value | - | configuration | org.eclipse.kapua.service.device.management.configuration.DeviceConfiguration | org.eclipse.kura.clock.ClockService>0.pool.ntp.orgjava-ntp12303600truetrue1000010 | - | commandInput | org.eclipse.kapua.service.device.management.command.DeviceCommandInput | pwd30000false | - | timeout | java.lang.Long | 10000 | - When I create multiple new JobSteps from the existing creators - And No exception was thrown - And I count the JobSteps and I find 2 JobStep within 30 seconds - Then I start a job - And I confirm job target has step index 1 and status "PROCESS_OK" within 31 seconds - And I query for the job with the name "TestJob" and I count 1 execution item and I confirm the executed job is finished within 20 seconds - When I search events from devices in account "kapua-sys" and 5 events are found - Then Configuration is requested - And A Configuration named "org.eclipse.kura.clock.ClockService" has property "clock.ntp.retry.interval" with value "10" - When KuraMock is disconnected - And I logout - - Scenario: Starting a job with valid Package Uninstall and Asset Write steps and multiple devices - Create a new job and set a connected KuraMock devices as the job targets. - Add a new valid Package Uninstall and Asset Write steps to the created job. - Start the job. After the executed job is finished, the executed target's - step index should be 1 and the status PROCESS_OK - - Given I login as user with name "kapua-sys" and password "kapua-password" - And I add 2 devices to Kura Mock - When Devices are connected within 10 seconds - And I wait 1 second - Then Device status is "CONNECTED" within 10 seconds - And I select account "kapua-sys" - And I get the KuraMock devices after 5 seconds - And Packages are requested and 1 package is received - And Device assets are requested - And Asset with name "asset1" and channel with name "channel1" and value 123 are received - When I search events from devices in account "kapua-sys" and 3 events are found - And The type of the last event is "ASSET" - And I create a job with the name "TestJob" - And I add targets to job - And I search for step definitions with the name - | Package Uninstall | - | Asset Write | - And I prepare a JobStepCreator with the name "TestStep1" and properties - | name | type | value | - | packageUninstallRequest | org.eclipse.kapua.service.device.management.packages.model.uninstall.DevicePackageUninstallRequest | org.eclipse.kura.example.beacon1.0.300true10000 | - | assets | org.eclipse.kapua.service.device.management.asset.DeviceAssets | asset1java.lang.Integer1233channel1 | - | timeout | java.lang.Long | 10000 | - When I create multiple new JobSteps from the existing creators - And No exception was thrown - And I count the JobSteps and I find 2 JobStep within 30 seconds - And I start a job - And I confirm job target has step index 1 and status "PROCESS_OK" within 31 seconds - And I query for the job with the name "TestJob" and I count 1 execution items or more and I confirm the executed jobs are finished within 45 seconds - When I search events from devices in account "kapua-sys" and 3 or more events are found - And Device assets are requested - And Asset with name "asset1" and channel with name "channel1" and value 1233 are received - And Packages are requested and 0 packages are received - When KuraMock is disconnected - And I logout - - @teardown - Scenario: Tear down test resources - Given Stop Docker environment - And Clean Locator Instance diff --git a/qa/integration/src/test/resources/features/jobEngine/JobEngineServiceStopOnlineDeviceI9n.feature b/qa/integration/src/test/resources/features/jobEngine/JobEngineServiceStopOnlineDeviceI9n.feature deleted file mode 100644 index bd4438cacf9..00000000000 --- a/qa/integration/src/test/resources/features/jobEngine/JobEngineServiceStopOnlineDeviceI9n.feature +++ /dev/null @@ -1,518 +0,0 @@ -############################################################################### -# Copyright (c) 2019, 2024 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 -############################################################################### -@env_docker -@it -@jobEngineServiceStop - -Feature: JobEngineService stop job tests with online device - Job Engine Service test scenarios for stopping job. This feature file contains scenarios for stopping job with one target and one step, - one target and multiple steps, multiple targets and one step and multiple targets and multiple steps. - - @setup - Scenario: Setup test resources - Given Init Security Context - And Start Docker environment with resources - | db | - | events-broker | - | job-engine | - | message-broker | - | broker-auth-service | - | consumer-lifecycle | - - # ***************************************************** - # * Stopping a job with one Target and multiple Steps * - # ***************************************************** - -# Scenario: Stop job with multiple Bundle Start and Package Install steps and one target -# Create a new job and set a connected KuraMock device as the job target. -# Add Bundle Start and Package Install steps to the created job. Start the job. -# Before job is finished, stop the job. When job is stopped, the executed target's -# step index should be different than 1 and the status PROCESS_AWAITING. Start the job again. -# If job is finished step index should be 1, and the status PROCESS_OK. -# -# Given I login as user with name "kapua-sys" and password "kapua-password" -# And I start the Kura Mock -# And Device is connected within 10 seconds -# And Device status is "CONNECTED" within 10 seconds -# And I select account "kapua-sys" -# And I get the KuraMock device after 5 seconds -# And Bundles are requested -# Then A bundle named "slf4j.api" with id 34 and version "1.7.21" is present and "RESOLVED" -# And Packages are requested and 1 package is received -# When I search for events from device "rpione3" in account "kapua-sys" I find 3 events within 30 seconds -# And The type of the last event is "DEPLOY" -# And I create a job with the name "TestJob" -# And I add target to job -# And I search for the job targets in database -# And I count 1 -# And I search for step definition with the name -# | Bundle Start | -# | Package Download / Install | -# | Package Uninstall | -# And I prepare a JobStepCreator with the name "TestStep1" and properties -# | name | type | value | -# | bundleId | java.lang.String | 34 | -# | packageDownloadRequest | org.eclipse.kapua.service.device.management.packages.model.download.DevicePackageDownloadRequest | http://download.eclipse.org/kura/releases/3.2.0/org.eclipse.kura.example.publisher_1.0.300.dpExample Publisher1.0.300true | -# | packageUninstallRequest | org.eclipse.kapua.service.device.management.packages.model.uninstall.DevicePackageUninstallRequest | org.eclipse.kura.example.beacon1.0.300true10000 | -# | timeout | java.lang.Long | 10000 | -# And I create multiple new JobSteps from the existing creators -# Then No exception was thrown -# And I count the JobSteps and I find 3 JobStep within 30 seconds -# And I start a job -# And I wait for 10 milliseconds for processes to settle down -# And I stop the job -# And I search for the last job target in the database -# And I confirm the step index is different than 2 and status is "PROCESS_AWAITING" -# And I start a job -# And I confirm job target has step index 2 and status "PROCESS_OK" within 31 seconds -# When I query for the execution items for the current job and I count 2 or more finished within 30 seconds -# When Bundles are requested -# Then A bundle named "slf4j.api" with id 34 and version "1.7.21" is present and "ACTIVE" -# And Packages are requested and 2 packages are received -# Then KuraMock is disconnected -# And I logout -# -# Scenario: Stop job with multiple Bundle Stop and Package Uninstall steps and one target -# Create a new job and set a connected KuraMock device as the job target. -# Add two Bundle Stop and Package Uninstall steps to the created job. Start the job. -# Before job is finished, stop the job. When job is stopped, the executed target's -# step index should be different than 2 and the status PROCESS_AWAITING. Start the job again. -# If job is finished step index should be 2, and job target status PROCESS_OK. -# -# Given I login as user with name "kapua-sys" and password "kapua-password" -# And I start the Kura Mock -# And Device is connected within 10 seconds -# And Device status is "CONNECTED" within 10 seconds -# And I select account "kapua-sys" -# And I get the KuraMock device after 5 seconds -# And Bundles are requested -# And A bundle named "org.eclipse.kura.linux.bluetooth" with id 77 and version "1.0.300" is present and "ACTIVE" -# And Packages are requested and 1 package is received -# When I search for events from device "rpione3" in account "kapua-sys" I find 3 events within 30 seconds -# And The type of the last event is "DEPLOY" -# And I create a job with the name "TestJob" -# And I add target to job -# And I search for the job targets in database -# And I count 1 -# And I search for step definition with the name -# | Bundle Stop | -# | Package Uninstall | -# | Package Download / Install | -# And I prepare a JobStepCreator with the name "TestStep1" and properties -# | name | type | value | -# | bundleId | java.lang.String | 77 | -# | packageUninstallRequest | org.eclipse.kapua.service.device.management.packages.model.uninstall.DevicePackageUninstallRequest | org.eclipse.kura.example.beacon1.0.300true10000 | -# | packageDownloadRequest | org.eclipse.kapua.service.device.management.packages.model.download.DevicePackageDownloadRequest | http://download.eclipse.org/kura/releases/3.2.0/org.eclipse.kura.example.publisher_1.0.300.dpExample Publisher1.0.300true | -# | timeout | java.lang.Long | 10000 | -# And I create multiple new JobSteps from the existing creators -# Then No exception was thrown -# And I count the JobSteps and I find 3 JobStep within 30 seconds -# And I start a job -# And I wait for 10 milliseconds for processes to settle down -# And I stop the job -# And I search for the last job target in the database -# And I confirm the step index is different than 2 and status is "PROCESS_AWAITING" -# And I start a job -# And I confirm job target has step index 2 and status "PROCESS_OK" within 31 seconds -# When I query for the execution items for the current job and I count 2 or more finished within 30 seconds -# When Bundles are requested -# And A bundle named "org.eclipse.kura.linux.bluetooth" with id 77 and version "1.0.300" is present and "RESOLVED" -# And Packages are requested and 2 packages are received -# Then KuraMock is disconnected -# And I logout -# -# Scenario: Stop job with multiple Command Execution and Package Install steps and one target -# Create a new job and set a connected KuraMock device as the job target. -# Add two Command Execution and Package Install steps to the created job. Start the job. -# Before job is finished, stop the job. When job is stopped, the executed target's -# step index should be different than 1 and the status PROCESS_AWAITING. Start the job again. -# If job is finished step index should be 1, and job target status PROCESS_OK. -# -# Given I login as user with name "kapua-sys" and password "kapua-password" -# And I start the Kura Mock -# And Device is connected within 10 seconds -# And Device status is "CONNECTED" within 10 seconds -# And I select account "kapua-sys" -# And I get the KuraMock device after 5 seconds -# And Command "pwd" is executed -# And Packages are requested and 1 package is received -# When I search for events from device "rpione3" in account "kapua-sys" I find 3 events within 30 seconds -# And The type of the last event is "DEPLOY" -# And I create a job with the name "TestJob" -# And I add target to job -# And I search for the job targets in database -# And I count 1 -# And I search for step definition with the name -# | Command Execution | -# | Package Download / Install | -# | Package Uninstall | -# And I prepare a JobStepCreator with the name "TestStep1" and properties -# | name | type | value | -# | commandInput | org.eclipse.kapua.service.device.management.command.DeviceCommandInput | pwd30000false | -# | packageDownloadRequest | org.eclipse.kapua.service.device.management.packages.model.download.DevicePackageDownloadRequest | http://download.eclipse.org/kura/releases/3.2.0/org.eclipse.kura.example.publisher_1.0.300.dpExample Publisher1.0.300true | -# | packageUninstallRequest | org.eclipse.kapua.service.device.management.packages.model.uninstall.DevicePackageUninstallRequest | org.eclipse.kura.example.beacon1.0.300true10000 | -# | timeout | java.lang.Long | 10000 | -# And I create multiple new JobSteps from the existing creators -# Then No exception was thrown -# And I count the JobSteps and I find 3 JobStep within 30 seconds -# And I start a job -# And I wait for 10 milliseconds for processes to settle down -# And I stop the job -# And I search for the last job target in the database -# And I confirm the step index is different than 2 and status is "PROCESS_AWAITING" -# And I start a job -# And I confirm job target has step index 2 and status "PROCESS_OK" within 31 seconds -# When I query for the execution items for the current job and I count 2 or more finished within 30 seconds -# And Packages are requested and 2 packages are received -# Then KuraMock is disconnected -# And I logout -# -# Scenario: Stop job with multiple Configuration Put and Package Uninstall steps and one target -# Create a new job and set a connected KuraMock device as the job target. -# Add two Configuration Put and Package Uninstall steps to the created job. Start the job. -# Before job is finished, stop the job. When job is stopped, the executed target's -# step index should be different than 1 and the status PROCESS_AWAITING. Start the job again. -# If job is finished step index should be 1, and job target status PROCESS_OK. -# -# Given I login as user with name "kapua-sys" and password "kapua-password" -# And I start the Kura Mock -# And Device is connected within 10 seconds -# And Device status is "CONNECTED" within 10 seconds -# And I select account "kapua-sys" -# And I get the KuraMock device after 5 seconds -# And Configuration is requested -# Then A Configuration named "org.eclipse.kura.clock.ClockService" has property "clock.ntp.retry.interval" with value "5" -# And Packages are requested and 1 packages is received -# When I search for events from device "rpione3" in account "kapua-sys" I find 3 events within 30 seconds -# And The type of the last event is "DEPLOY" -# And I create a job with the name "TestJob" -# And I add target to job -# And I search for the job targets in database -# And I count 1 -# And I search for step definition with the name -# | Configuration Put | -# | Package Uninstall | -# | Package Download / Install | -# And I prepare a JobStepCreator with the name "TestStep1" and properties -# | name | type | value | -# | configuration | org.eclipse.kapua.service.device.management.configuration.DeviceConfiguration | org.eclipse.kura.clock.ClockService>0.pool.ntp.orgjava-ntp12303600truetrue1000010 | -# | packageUninstallRequest | org.eclipse.kapua.service.device.management.packages.model.uninstall.DevicePackageUninstallRequest | org.eclipse.kura.example.beacon1.0.300true10000 | -# | packageDownloadRequest | org.eclipse.kapua.service.device.management.packages.model.download.DevicePackageDownloadRequest | http://download.eclipse.org/kura/releases/3.2.0/org.eclipse.kura.example.publisher_1.0.300.dpExample Publisher1.0.300true | -# | timeout | java.lang.Long | 10000 | -# And I create multiple new JobSteps from the existing creators -# Then No exception was thrown -# And I count the JobSteps and I find 3 JobStep within 30 seconds -# And I start a job -# And I wait for 10 milliseconds for processes to settle down -# And I stop the job -# And I search for the last job target in the database -# And I confirm the step index is different than 2 and status is "PROCESS_AWAITING" -# And I start a job -# And I confirm job target has step index 2 and status "PROCESS_OK" within 31 seconds -# When I query for the execution items for the current job and I count 2 or more finished within 30 seconds -# Then Packages are requested and 2 packages are received -# Then KuraMock is disconnected -# And I logout -# -# Scenario: Stop job with multiple Asset Write and Package Install steps and one target -# Create a new job and set a connected KuraMock device as the job target. -# Add two Asset Write and Package Install steps to the created job. Start the job. -# Before job is finished, stop the job. When job is stopped, the executed target's -# step index should be different than 1 and the status PROCESS_AWAITING. Start the job again. -# If job is finished step index should be 1, and job target status PROCESS_OK. -# -# Given I login as user with name "kapua-sys" and password "kapua-password" -# And I start the Kura Mock -# And Device is connected within 10 seconds -# And Device status is "CONNECTED" within 10 seconds -# And I select account "kapua-sys" -# And I get the KuraMock device after 5 seconds -# When Device assets are requested -# Then Asset with name "asset1" and channel with name "channel1" and value 123 are received -# And Packages are requested and 1 package is received -# When I search for events from device "rpione3" in account "kapua-sys" I find 3 events within 30 seconds -# And The type of the last event is "DEPLOY" -# And I create a job with the name "TestJob" -# And I add target to job -# And I search for the job targets in database -# And I count 1 -# And I search for step definition with the name -# | Asset Write | -# | Package Download / Install | -# | Package Uninstall | -# And I prepare a JobStepCreator with the name "TestStep1" and properties -# | name | type | value | -# | assets | org.eclipse.kapua.service.device.management.asset.DeviceAssets | asset1java.lang.Integer1233channel1 | -# | packageDownloadRequest | org.eclipse.kapua.service.device.management.packages.model.download.DevicePackageDownloadRequest | http://download.eclipse.org/kura/releases/3.2.0/org.eclipse.kura.example.publisher_1.0.300.dpExample Publisher1.0.300true | -# | packageUninstallRequest | org.eclipse.kapua.service.device.management.packages.model.uninstall.DevicePackageUninstallRequest | org.eclipse.kura.example.beacon1.0.300true10000 | -# | timeout | java.lang.Long | 10000 | -# And I create multiple new JobSteps from the existing creators -# Then No exception was thrown -# And I count the JobSteps and I find 3 JobStep within 30 seconds -# And I start a job -# And I wait for 10 milliseconds for processes to settle down -# And I stop the job -# And I search for the last job target in the database -# And I confirm the step index is different than 2 and status is "PROCESS_AWAITING" -# And I start a job -# And I confirm job target has step index 2 and status "PROCESS_OK" within 31 seconds -# When I query for the execution items for the current job and I count 2 or more finished within 30 seconds -# When Device assets are requested -# Then Asset with name "asset1" and channel with name "channel1" and value 1233 are received -# And Packages are requested and 2 packages are received -# Then KuraMock is disconnected -# And I logout -# -# # ***************************************************** -# # * Stopping a job with multiple Targets and one Step * -# # ***************************************************** -# -# Scenario: Stop job with multiple targets and Bundle Start and Package Install steps -# Create a new job and set a connected KuraMock devices as the job targets. -# Add Bundle Start and Package Install steps to the created job. Start the job. Before -# job is finished, stop the job. When job is stopped, the executed target's -# step index should be different than 0 and the status PROCESS_AWAITING. Start the job again. -# If job is finished step index should be 0, and job target status PROCESS_OK. -# -# Given I login as user with name "kapua-sys" and password "kapua-password" -# And I add 2 devices to Kura Mock -# And Devices are connected within 10 seconds -# And I wait 1 second -# And Devices status is "CONNECTED" within 10 seconds -# And I select account "kapua-sys" -# And I get the KuraMock devices after 5 seconds -# And Bundles are requested -# Then A bundle named "slf4j.api" with id 34 and version "1.7.21" is present and "RESOLVED" -# And Packages are requested and 1 package is received -# When I search for events from device "device0" in account "kapua-sys" I find 3 events within 30 seconds -# And The type of the last event is "DEPLOY" -# And I create a job with the name "TestJob" -# And I add targets to job -# And I search for the job targets in database -# And I count 2 -# And I search for step definition with the name -# | Bundle Start | -# | Package Download / Install | -# And I prepare a JobStepCreator with the name "TestStep1" and properties -# | name | type | value | -# | bundleId | java.lang.String | 34 | -# | packageDownloadRequest | org.eclipse.kapua.service.device.management.packages.model.download.DevicePackageDownloadRequest | http://download.eclipse.org/kura/releases/3.2.0/org.eclipse.kura.example.publisher_1.0.300.dpExample Publisher1.0.300true | -# And I create multiple new JobSteps from the existing creators -# And I count the JobSteps and I find 2 JobStep within 30 seconds -# And I start a job -# And I wait for 10 milliseconds for processes to settle down -# And I stop the job -# And I search for the last job target in the database -# And I confirm the step index is 0 and status is "PROCESS_AWAITING" -# And I start a job -# And I confirm job target has step index 1 and status "PROCESS_OK" within 31 seconds -# When I query for the execution items for the current job and I count 2 or more finished within 30 seconds -# When Bundles are requested -# Then A bundle named "slf4j.api" with id 34 and version "1.7.21" is present and "ACTIVE" -# And Packages are requested and 2 packages are received -# Then KuraMock is disconnected -# And I logout -# -# Scenario: Stop job with multiple targets and Bundle Stop and Package Uninstall steps -# Create a new job and set a connected KuraMock devices as the job targets. -# Add Bundle Stop and Package Uninstall steps to the created job. Start the job. -# Before job is finished, stop the job. When job is stopped, the executed target's -# step index should be different than 0 and the status PROCESS_AWAITING. Start the job again. -# If job is finished step index should be 0, and job target status PROCESS_OK. -# -# Given I login as user with name "kapua-sys" and password "kapua-password" -# And I add 2 devices to Kura Mock -# And Devices are connected within 10 seconds -# And I wait 1 second -# And Devices status is "CONNECTED" within 10 seconds -# And I select account "kapua-sys" -# And I get the KuraMock devices after 5 seconds -# And Bundles are requested -# And A bundle named "org.eclipse.kura.linux.bluetooth" with id 77 and version "1.0.300" is present and "ACTIVE" -# And Packages are requested and 1 package is received -# When I search for events from device "device0" in account "kapua-sys" I find 3 events within 30 seconds -# And The type of the last event is "DEPLOY" -# And I create a job with the name "TestJob" -# And I add targets to job -# And I search for the job targets in database -# And I count 2 -# And I search for step definition with the name -# | Bundle Stop | -# | Package Uninstall | -# And I prepare a JobStepCreator with the name "TestStep1" and properties -# | name | type | value | -# | bundleId | java.lang.String | 77 | -# | packageUninstallRequest | org.eclipse.kapua.service.device.management.packages.model.uninstall.DevicePackageUninstallRequest | org.eclipse.kura.example.beacon1.0.300true10000 | -# | timeout | java.lang.Long | 10000 | -# And I create multiple new JobSteps from the existing creators -# Then No exception was thrown -# And I count the JobSteps and I find 2 JobStep within 30 seconds -# And I start a job -# And I wait for 10 milliseconds for processes to settle down -# And I stop the job -# And I search for the last job target in the database -# And I confirm the step index is 0 and status is "PROCESS_AWAITING" -# And I start a job -# And I confirm job target has step index 1 and status "PROCESS_OK" within 31 seconds -# When I query for the execution items for the current job and I count 2 or more finished within 30 seconds -# When Bundles are requested -# And A bundle named "org.eclipse.kura.linux.bluetooth" with id 77 and version "1.0.300" is present and "RESOLVED" -# And Packages are requested and 0 packages are received -# Then KuraMock is disconnected -# And I logout -# -# Scenario: Stop job with multiple targets and Command Execution and Package Install steps -# Create a new job and set a connected KuraMock devices as the job targets. -# Add Command Execution and Package Install steps to the created job. Start the job. -# Before job is finished, stop the job. When job is stopped, the executed target's -# step index should be different than 0 and the status PROCESS_AWAITING. Start the job again. -# If job is finished step index should be 0, and job target status PROCESS_OK. -# -# Given I login as user with name "kapua-sys" and password "kapua-password" -# And I add 2 devices to Kura Mock -# And Devices are connected within 10 seconds -# And I wait 1 second -# And Devices status is "CONNECTED" within 10 seconds -# And I select account "kapua-sys" -# And I get the KuraMock devices after 5 seconds -# And Command "pwd" is executed -# And Packages are requested and 1 package is received -# When I search for events from device "device0" in account "kapua-sys" I find 3 events within 30 seconds -# And The type of the last event is "DEPLOY" -# And I create a job with the name "TestJob" -# And I add targets to job -# And I search for the job targets in database -# And I count 2 -# And I search for step definition with the name -# | Command Execution | -# | Package Download / Install | -# And I prepare a JobStepCreator with the name "TestStep1" and properties -# | name | type | value | -# | commandInput | org.eclipse.kapua.service.device.management.command.DeviceCommandInput | pwd30000false | -# | packageDownloadRequest | org.eclipse.kapua.service.device.management.packages.model.download.DevicePackageDownloadRequest | http://download.eclipse.org/kura/releases/3.2.0/org.eclipse.kura.example.publisher_1.0.300.dpExample Publisher1.0.300true | -# | timeout | java.lang.Long | 10000 | -# And I create multiple new JobSteps from the existing creators -# Then No exception was thrown -# And I count the JobSteps and I find 2 JobStep within 30 seconds -# And I start a job -# And I wait for 10 milliseconds for processes to settle down -# And I stop the job -# And I search for the last job target in the database -# And I confirm the step index is 0 and status is "PROCESS_AWAITING" -# And I start a job -# And I confirm job target has step index 1 and status "PROCESS_OK" within 31 seconds -# When I query for the execution items for the current job and I count 2 or more finished within 30 seconds -# When Packages are requested and 2 packages are received -# Then KuraMock is disconnected -# And I logout -# -# Scenario: Stop job with multiple targets and Configuration Put and Package Uninstall steps -# Create a new job and set a connected KuraMock devices as the job targets. -# Add Configuration Put and Package Uninstall steps to the created job. Start the job. -# Before job is finished, stop the job. When job is stopped, the executed target's -# step index should be different than 0 and the status PROCESS_AWAITING. Start the job again. -# If job is finished step index should be 0, and job target status PROCESS_OK. -# -# Given I login as user with name "kapua-sys" and password "kapua-password" -# And I add 2 devices to Kura Mock -# And Devices are connected within 10 seconds -# And I wait 1 second -# And Devices status is "CONNECTED" within 10 seconds -# And I select account "kapua-sys" -# And I get the KuraMock devices after 5 seconds -# And Configuration is requested -# Then A Configuration named "org.eclipse.kura.clock.ClockService" has property "clock.ntp.retry.interval" with value "5" -# And Packages are requested and 1 packages is received -# When I search for events from device "device0" in account "kapua-sys" I find 3 events within 30 seconds -# And The type of the last event is "DEPLOY" -# And I create a job with the name "TestJob" -# And I add targets to job -# And I search for the job targets in database -# And I count 2 -# And I search for step definition with the name -# | Configuration Put | -# | Package Uninstall | -# And I prepare a JobStepCreator with the name "TestStep1" and properties -# | name | type | value | -# | configuration | org.eclipse.kapua.service.device.management.configuration.DeviceConfiguration | org.eclipse.kura.clock.ClockService>0.pool.ntp.orgjava-ntp12303600truetrue1000010 | -# | packageUninstallRequest | org.eclipse.kapua.service.device.management.packages.model.uninstall.DevicePackageUninstallRequest | org.eclipse.kura.example.beacon1.0.300true10000 | -# | timeout | java.lang.Long | 10000 | -# And I create multiple new JobSteps from the existing creators -# Then No exception was thrown -# And I count the JobSteps and I find 2 JobStep within 30 seconds -# And I start a job -# And I wait for 10 milliseconds for processes to settle down -# And I stop the job -# And I search for the last job target in the database -# And I confirm the step index is 0 and status is "PROCESS_AWAITING" -# And I start a job -# And I confirm job target has step index 1 and status "PROCESS_OK" within 31 seconds -# When I query for the execution items for the current job and I count 2 or more finished within 30 seconds -# And Configuration is requested -# Then A Configuration named "org.eclipse.kura.clock.ClockService" has property "clock.ntp.retry.interval" with value "10" -# And Packages are requested and 0 packages are received -# Then KuraMock is disconnected -# And I logout -# -# Scenario: Stop job with multiple targets and Asset Write and Package Install steps and one target -# Create a new job and set a connected KuraMock device as the job target. -# Add two Asset Write and Package Install steps to the created job. Start the job. -# Before job is finished, stop the job. When job is stopped, the executed target's -# step index should be different than 1 and the status PROCESS_AWAITING. Start the job again. -# If job is finished step index should be 1, and job target status PROCESS_OK. -# -# Given I login as user with name "kapua-sys" and password "kapua-password" -# And I add 2 devices to Kura Mock -# And Devices are connected within 10 seconds -# And I wait 1 second -# And Devices status is "CONNECTED" within 10 seconds -# And I select account "kapua-sys" -# And I get the KuraMock devices after 5 seconds -# When Device assets are requested -# Then Asset with name "asset1" and channel with name "channel1" and value 123 are received -# And Packages are requested and 1 package is received -# When I search for events from device "device0" in account "kapua-sys" I find 3 events within 30 seconds -# And The type of the last event is "DEPLOY" -# And I create a job with the name "TestJob" -# And I add targets to job -# And I search for the job targets in database -# And I count 2 -# And I search for step definition with the name -# | Asset Write | -# | Package Download / Install | -# And I prepare a JobStepCreator with the name "TestStep1" and properties -# | name | type | value | -# | assets | org.eclipse.kapua.service.device.management.asset.DeviceAssets | asset1java.lang.Integer1233channel1 | -# | packageDownloadRequest | org.eclipse.kapua.service.device.management.packages.model.download.DevicePackageDownloadRequest | http://download.eclipse.org/kura/releases/3.2.0/org.eclipse.kura.example.publisher_1.0.300.dpExample Publisher1.0.300true | -# | timeout | java.lang.Long | 10000 | -# And I create multiple new JobSteps from the existing creators -# Then No exception was thrown -# And I count the JobSteps and I find 2 JobStep within 30 seconds -# And I start a job -# And I wait for 10 milliseconds for processes to settle down -# And I stop the job -# And I search for the last job target in the database -# And I confirm the step index is different than 1 and status is "PROCESS_AWAITING" -# And I start a job -# And I confirm job target has step index 1 and status "PROCESS_OK" within 31 seconds -# When I query for the execution items for the current job and I count 2 or more finished within 30 seconds -# When Device assets are requested -# Then Asset with name "asset1" and channel with name "channel1" and value 1233 are received -# And Packages are requested and 2 packages are received -# Then KuraMock is disconnected -# And I logout - - @teardown - Scenario: Tear down test resources - Given Stop Docker environment - And Clean Locator Instance diff --git a/qa/integration/src/test/resources/features/jobScheduling/TriggerServiceI9n.feature b/qa/integration/src/test/resources/features/jobScheduling/TriggerServiceI9n.feature index 826e80e5099..c6287f9a3f7 100644 --- a/qa/integration/src/test/resources/features/jobScheduling/TriggerServiceI9n.feature +++ b/qa/integration/src/test/resources/features/jobScheduling/TriggerServiceI9n.feature @@ -11,7 +11,7 @@ # Eurotech - initial API and implementation ############################################################################### @env_docker_base -@job +@jobsIntegration Feature: Trigger service tests diff --git a/service/job/test/src/test/resources/features/JobService.feature b/service/job/test/src/test/resources/features/JobService.feature index ba0d03a8d68..db2f4ee27d4 100644 --- a/service/job/test/src/test/resources/features/JobService.feature +++ b/service/job/test/src/test/resources/features/JobService.feature @@ -10,7 +10,7 @@ # Contributors: # Eurotech - initial API and implementation ############################################################################### -@jobs +@job @jobService @env_none diff --git a/service/job/test/src/test/resources/features/JobStepDefinitionService.feature b/service/job/test/src/test/resources/features/JobStepDefinitionService.feature index f689773cb82..72f1c034e00 100644 --- a/service/job/test/src/test/resources/features/JobStepDefinitionService.feature +++ b/service/job/test/src/test/resources/features/JobStepDefinitionService.feature @@ -10,7 +10,7 @@ # Contributors: # Eurotech - initial API and implementation ############################################################################### -@jobs +@job @jobStepDefinition @env_none diff --git a/service/job/test/src/test/resources/features/JobStepService.feature b/service/job/test/src/test/resources/features/JobStepService.feature index cac6289d9b1..770c338bdd5 100644 --- a/service/job/test/src/test/resources/features/JobStepService.feature +++ b/service/job/test/src/test/resources/features/JobStepService.feature @@ -10,7 +10,7 @@ # Contributors: # Eurotech - initial API and implementation ############################################################################### -@jobs +@job @jobStepService @env_none From eb0c3e4295a0152dd0679e344bfb4256693740a7 Mon Sep 17 00:00:00 2001 From: Alberto Codutti Date: Mon, 23 Dec 2024 18:17:24 +0100 Subject: [PATCH 9/9] :recycle: [Test] Improved setup time of tests Signed-off-by: Alberto Codutti --- .../qa/integration/steps/DockerSteps.java | 231 ++++++++++++++---- 1 file changed, 182 insertions(+), 49 deletions(-) diff --git a/qa/integration-steps/src/main/java/org/eclipse/kapua/qa/integration/steps/DockerSteps.java b/qa/integration-steps/src/main/java/org/eclipse/kapua/qa/integration/steps/DockerSteps.java index ae6079dfebf..206e203a350 100644 --- a/qa/integration-steps/src/main/java/org/eclipse/kapua/qa/integration/steps/DockerSteps.java +++ b/qa/integration-steps/src/main/java/org/eclipse/kapua/qa/integration/steps/DockerSteps.java @@ -58,6 +58,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.concurrent.TimeUnit; @Singleton public class DockerSteps { @@ -79,8 +80,9 @@ public class DockerSteps { private static final long WAIT_FOR_DB = 10000; private static final long WAIT_FOR_ES = 10000; private static final long WAIT_FOR_EVENTS_BROKER = 10000; - private static final long WAIT_FOR_JOB_ENGINE = 30000; - private static final long WAIT_FOR_BROKER = 60000; + private static final long WAIT_FOR_JOB_ENGINE = 20000; + private static final long WAIT_FOR_REST_API = 30000; + private static final long WAIT_FOR_BROKER = 30000; private static final int HTTP_COMMUNICATION_TIMEOUT = 3000; private static final int LIFECYCLE_HEALTH_CHECK_PORT = 8090; @@ -249,55 +251,58 @@ public void startDockerEnvironmentWithResources(List dockerContainers) t createNetwork(); + // Start them for (String dockerContainer : dockerContainers) { switch (dockerContainer) { case "db": { startDBContainer(BasicSteps.DB_CONTAINER_NAME); - synchronized (this) { - this.wait(WAIT_FOR_DB); - } + + // This is the only container that we need to wait to start before starting others + waitDBContainer(BasicSteps.DB_CONTAINER_NAME); } break; case "es": { startESContainer(BasicSteps.ES_CONTAINER_NAME); - synchronized (this) { - this.wait(WAIT_FOR_ES); - } + waitEsContainer(BasicSteps.ES_CONTAINER_NAME); } break; case "events-broker": { startEventBrokerContainer(BasicSteps.EVENTS_BROKER_CONTAINER_NAME); - synchronized (this) { - this.wait(WAIT_FOR_EVENTS_BROKER); - } + waitEventBrokerContainer(BasicSteps.EVENTS_BROKER_CONTAINER_NAME); } break; case "job-engine": { startJobEngineContainer(BasicSteps.JOB_ENGINE_CONTAINER_NAME); - synchronized (this) { - this.wait(WAIT_FOR_JOB_ENGINE); - } + waitJobEngineContainer(BasicSteps.JOB_ENGINE_CONTAINER_NAME); } break; case "message-broker": { startMessageBrokerContainer(BasicSteps.MESSAGE_BROKER_CONTAINER_NAME); - synchronized (this) { - this.wait(WAIT_FOR_BROKER); - } + waitMessageBrokerContainer(BasicSteps.MESSAGE_BROKER_CONTAINER_NAME); } break; case "broker-auth-service": { startAuthServiceContainer(BasicSteps.AUTH_SERVICE_CONTAINER_NAME); - - long timeout = System.currentTimeMillis(); - while (System.currentTimeMillis() - timeout < 30000) { - isServiceReady(AUTH_SERVICE_CHECK_WEB_APP); - Thread.sleep(500); - } } break; case "consumer-lifecycle": { startLifecycleConsumerContainer(BasicSteps.LIFECYCLE_CONSUMER_CONTAINER_NAME); + } break; + default: + throw new UnsupportedOperationException("Unknown container resource: " + dockerContainer); + } + } - long timeout = System.currentTimeMillis(); - while (System.currentTimeMillis() - timeout < 30000) { - isServiceReady(LIFECYCLE_CHECK_WEB_APP); - Thread.sleep(500); - } + // Wait for them to be ready + for (String dockerContainer : dockerContainers) { + switch (dockerContainer) { + case "db": + case "es": + case "events-broker": + case "job-engine": + case "message-broker": { + // Nothing to do. Those containers are delay-based. + // Waiting to refactor them + } break; + case "broker-auth-service": { + waitAuthServiceContainer(BasicSteps.AUTH_SERVICE_CONTAINER_NAME); + } break; + case "consumer-lifecycle": { + waitLifecycleConsumerContainer(BasicSteps.LIFECYCLE_CONSUMER_CONTAINER_NAME); } break; default: throw new UnsupportedOperationException("Unknown container resource: " + dockerContainer); @@ -597,17 +602,16 @@ public void startDBContainer(String name) throws DockerException, InterruptedExc logger.info("DB container started: {}", containerId); } - @And("Start API container with name {string}") - public void startAPIContainer(String name, String tokenTTL, String refreshTokenTTL, int corsEndpointRefreshInterval) throws DockerException, InterruptedException { - logger.info("Starting API container..."); - ContainerConfig dbConfig = getApiContainerConfig(tokenTTL, refreshTokenTTL, corsEndpointRefreshInterval); - ContainerCreation dbContainerCreation = DockerUtil.getDockerClient().createContainer(dbConfig, name); - String containerId = dbContainerCreation.id(); - - DockerUtil.getDockerClient().startContainer(containerId); - DockerUtil.getDockerClient().connectToNetwork(containerId, networkId); - containerMap.put("api", containerId); - logger.info("API container started: {}", containerId); + /** + * Waits for the DB Docker container to be ready + * @param name The DB Docker container name + * @throws Exception + * @since 2.1.0 + */ + private void waitDBContainer(String name) throws Exception{ + synchronized (this) { + this.wait(WAIT_FOR_DB); + } } @And("Start ES container with name {string}") @@ -623,6 +627,19 @@ public void startESContainer(String name) throws DockerException, InterruptedExc logger.info("ES container started: {}", containerId); } + /** + * Waits for the Elasticsearch Docker container to be ready + * + * @param name The Elasticsearch Docker container name + * @throws Exception + * @since 2.1.0 + */ + private void waitEsContainer(String name) throws Exception{ + synchronized (this) { + this.wait(WAIT_FOR_ES); + } + } + @And("Start EventBroker container with name {string}") public void startEventBrokerContainer(String name) throws DockerException, InterruptedException { logger.info("Starting EventBroker container..."); @@ -636,6 +653,19 @@ public void startEventBrokerContainer(String name) throws DockerException, Inter logger.info("EventBroker container started: {}", containerId); } + /** + * Waits for the Event Broker Docker container to be ready + * + * @param name The Event Broker Docker container name + * @throws Exception + * @since 2.1.0 + */ + private void waitEventBrokerContainer(String name) throws Exception{ + synchronized (this) { + this.wait(WAIT_FOR_EVENTS_BROKER); + } + } + @And("Start JobEngine container with name {string}") public void startJobEngineContainer(String name) throws DockerException, InterruptedException { logger.info("Starting Job Engine container {}...", name); @@ -649,6 +679,45 @@ public void startJobEngineContainer(String name) throws DockerException, Interru logger.info("Job Engine {} container started: {}", name, containerId); } + /** + * Waits for the Job Engine Docker container to be ready + * + * @param name The Job Engine Docker container name + * @throws Exception + * @since 2.1.0 + */ + private void waitJobEngineContainer(String name) throws Exception{ + synchronized (this) { + this.wait(WAIT_FOR_JOB_ENGINE); + } + } + + @And("Start API container with name {string}") + public void startAPIContainer(String name, String tokenTTL, String refreshTokenTTL, int corsEndpointRefreshInterval) throws DockerException, InterruptedException { + logger.info("Starting API container..."); + ContainerConfig dbConfig = getApiContainerConfig(tokenTTL, refreshTokenTTL, corsEndpointRefreshInterval); + ContainerCreation dbContainerCreation = DockerUtil.getDockerClient().createContainer(dbConfig, name); + String containerId = dbContainerCreation.id(); + + DockerUtil.getDockerClient().startContainer(containerId); + DockerUtil.getDockerClient().connectToNetwork(containerId, networkId); + containerMap.put("api", containerId); + logger.info("API container started: {}", containerId); + } + + /** + * Waits for the REST API Docker container to be ready + * + * @param name The REST API Docker container name + * @throws Exception + * @since 2.1.0 + */ + private void waitRestApiContainer(String name) throws Exception{ + synchronized (this) { + this.wait(WAIT_FOR_REST_API); + } + } + @And("Start MessageBroker container with name {string}") public void startMessageBrokerContainer(String name) throws DockerException, InterruptedException { logger.info("Starting Message Broker container {}...", name); @@ -662,16 +731,46 @@ public void startMessageBrokerContainer(String name) throws DockerException, Int logger.info("Message Broker {} container started: {}", name, containerId); } - @And("Start TelemetryConsumer container with name {string}") - public void startTelemetryConsumerContainer(String name) throws DockerException, InterruptedException { - logger.info("Starting Telemetry Consumer container {}...", name); - ContainerCreation mbContainerCreation = DockerUtil.getDockerClient().createContainer(getTelemetryConsumerConfig(8080, 8091, 8001, 8002), name); + /** + * Waits for the Message Broker Docker container to be ready + * + * @param name The Message Broker Docker container name + * @throws Exception + * @since 2.1.0 + */ + private void waitMessageBrokerContainer(String name) throws Exception{ + synchronized (this) { + this.wait(WAIT_FOR_BROKER); + } + } + + @And("Start Auth service container with name {string}") + public void startAuthServiceContainer(String name) throws DockerException, InterruptedException { + logger.info("Starting Auth service container {}...", name); + ContainerCreation mbContainerCreation = DockerUtil.getDockerClient().createContainer(getAuthServiceConfig(8080, 8092, 8001, 8003), name); String containerId = mbContainerCreation.id(); DockerUtil.getDockerClient().startContainer(containerId); DockerUtil.getDockerClient().connectToNetwork(containerId, networkId); containerMap.put(name, containerId); - logger.info("Telemetry Consumer {} container started: {}", name, containerId); + logger.info("Lifecycle Consumer {} container started: {}", name, containerId); + } + + /** + * Waits for the Auth Service Docker container to be ready + * + * @param name The Auth Service container name + * @throws Exception + * @since 2.1.0 + */ + private void waitAuthServiceContainer(String name) throws Exception{ + long timeout = System.currentTimeMillis(); + while (System.currentTimeMillis() - timeout < 30000) { + if (isServiceReady(AUTH_SERVICE_CHECK_WEB_APP)) { + break; + } + TimeUnit.MILLISECONDS.sleep(500); + } } @And("Start LifecycleConsumer container with name {string}") @@ -686,16 +785,50 @@ public void startLifecycleConsumerContainer(String name) throws DockerException, logger.info("Lifecycle Consumer {} container started: {}", name, containerId); } - @And("Start Auth service container with name {string}") - public void startAuthServiceContainer(String name) throws DockerException, InterruptedException { - logger.info("Starting Auth service container {}...", name); - ContainerCreation mbContainerCreation = DockerUtil.getDockerClient().createContainer(getAuthServiceConfig(8080, 8092, 8001, 8003), name); + /** + * Waits for the Lifecycle Consumer Docker container to be ready + * + * @param name The Lifecycle Consumer container name + * @throws Exception + * @since 2.1.0 + */ + private void waitLifecycleConsumerContainer(String name) throws Exception{ + long timeout = System.currentTimeMillis(); + while (System.currentTimeMillis() - timeout < 30000) { + if (isServiceReady(LIFECYCLE_CHECK_WEB_APP)){ + break; + } + TimeUnit.MILLISECONDS.sleep(500); + } + } + + @And("Start TelemetryConsumer container with name {string}") + public void startTelemetryConsumerContainer(String name) throws DockerException, InterruptedException { + logger.info("Starting Telemetry Consumer container {}...", name); + ContainerCreation mbContainerCreation = DockerUtil.getDockerClient().createContainer(getTelemetryConsumerConfig(8080, 8091, 8001, 8002), name); String containerId = mbContainerCreation.id(); DockerUtil.getDockerClient().startContainer(containerId); DockerUtil.getDockerClient().connectToNetwork(containerId, networkId); containerMap.put(name, containerId); - logger.info("Lifecycle Consumer {} container started: {}", name, containerId); + logger.info("Telemetry Consumer {} container started: {}", name, containerId); + } + + /** + * Waits for the Telemetry Consumer Docker container to be ready + * + * @param name The Telemetry Consumer container name + * @throws Exception + * @since 2.1.0 + */ + private void waitTelemetryConsumerContainer(String name) throws Exception{ + long timeout = System.currentTimeMillis(); + while (System.currentTimeMillis() - timeout < 30000) { + if (isServiceReady(TELEMETRY_CHECK_WEB_APP)) { + break; + } + TimeUnit.MILLISECONDS.sleep(500); + } } @Then("Stop container with name {string}")