From 2523285464f8d1280f086aa41ed16b462442f7a1 Mon Sep 17 00:00:00 2001 From: Alberto Codutti Date: Fri, 20 Dec 2024 16:09:39 +0100 Subject: [PATCH 01/18] :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 6e39a399a1e6df80fe5049f3d341d303b38b3fb1 Mon Sep 17 00:00:00 2001 From: Alberto Codutti Date: Fri, 20 Dec 2024 16:17:04 +0100 Subject: [PATCH 02/18] :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 23e55f5e967ee5a97870dce6b021b656332a490f Mon Sep 17 00:00:00 2001 From: Alberto Codutti Date: Fri, 20 Dec 2024 16:24:44 +0100 Subject: [PATCH 03/18] :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 1f8e60b614a8d0a01f67d1e42dc831d82d94ca0b Mon Sep 17 00:00:00 2001 From: Alberto Codutti Date: Fri, 20 Dec 2024 16:32:08 +0100 Subject: [PATCH 04/18] :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 3bb84f8beff723676029ea71559c9f34f8bec8bc Mon Sep 17 00:00:00 2001 From: Alberto Codutti Date: Fri, 20 Dec 2024 18:10:51 +0100 Subject: [PATCH 05/18] :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 f5378fb05aa170a6fbcc27e77f3420c353d4b691 Mon Sep 17 00:00:00 2001 From: Alberto Codutti Date: Fri, 20 Dec 2024 18:13:20 +0100 Subject: [PATCH 06/18] :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 156ca794ac4752439720eac71c8979bf9d7186de Mon Sep 17 00:00:00 2001 From: Alberto Codutti Date: Mon, 23 Dec 2024 13:08:11 +0100 Subject: [PATCH 07/18] :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 50823aa9d733f846dfa63cac6946f9c21008a662 Mon Sep 17 00:00:00 2001 From: Alberto Codutti Date: Mon, 23 Dec 2024 16:40:31 +0100 Subject: [PATCH 08/18] :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..670bdb0e063 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-jobEngine-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 a043dec58fcf59455107a582083f6d93abe3c5f2 Mon Sep 17 00:00:00 2001 From: Alberto Codutti Date: Mon, 23 Dec 2024 18:17:24 +0100 Subject: [PATCH 09/18] :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}") From 76a7de13045c32820fa6d3b9f7b4683fb320dfe7 Mon Sep 17 00:00:00 2001 From: Alberto Codutti Date: Fri, 17 Jan 2025 12:12:51 +0100 Subject: [PATCH 10/18] :bug: [Test] Fixed broken test Signed-off-by: Alberto Codutti --- .../resources/features/jobScheduling/TriggerServiceI9n.feature | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qa/integration/src/test/resources/features/jobScheduling/TriggerServiceI9n.feature b/qa/integration/src/test/resources/features/jobScheduling/TriggerServiceI9n.feature index c6287f9a3f7..cb07c8a5605 100644 --- a/qa/integration/src/test/resources/features/jobScheduling/TriggerServiceI9n.feature +++ b/qa/integration/src/test/resources/features/jobScheduling/TriggerServiceI9n.feature @@ -566,7 +566,7 @@ Feature: Trigger service tests And A regular trigger creator with the name "schedule0" is created And The trigger is set to start today at "10:00" Then I set cron expression to "1" - And I expect the exception "KapuaException" with the text "An internal error occurred: Error during Persistence Operation" + And I expect the exception "KapuaIllegalArgumentException" with the text "An illegal value was provided for the argument cronExpression" And I create a new trigger from the existing creator with previously defined date properties And An exception was thrown And I logout From 4bd1141d2c9944eb275d9725bcf12cd42f4befd7 Mon Sep 17 00:00:00 2001 From: Alberto Codutti Date: Mon, 20 Jan 2025 11:47:48 +0100 Subject: [PATCH 11/18] :recycle: [Test] Improved wait times and cleanup of code Signed-off-by: Alberto Codutti --- .../qa/integration/steps/DockerSteps.java | 42 ++++++------------- 1 file changed, 12 insertions(+), 30 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 206e203a350..26e4c0fd71a 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 @@ -77,9 +77,9 @@ public class DockerSteps { private static final List DEFAULT_BASE_DEPLOYMENT_CONTAINERS_NAME; private static final int WAIT_COUNT = 120; //total wait time = 240 secs (120 * 2000ms) private static final long WAIT_STEP = 2000; - 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_DB = 5000; + private static final long WAIT_FOR_ES = 5000; + private static final long WAIT_FOR_EVENTS_BROKER = 5000; 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; @@ -210,9 +210,7 @@ public void startFullDockerEnvironment() throws Exception { startBaseDockerEnvironmentInternal(); try { startMessageBrokerContainer(BasicSteps.MESSAGE_BROKER_CONTAINER_NAME); - synchronized (this) { - this.wait(WAIT_FOR_BROKER); - } + waitMessageBrokerContainer(BasicSteps.MESSAGE_BROKER_CONTAINER_NAME); startAuthServiceContainer(BasicSteps.AUTH_SERVICE_CONTAINER_NAME); startLifecycleConsumerContainer(BasicSteps.LIFECYCLE_CONSUMER_CONTAINER_NAME); @@ -360,24 +358,16 @@ private void startBaseDockerEnvironmentInternal() throws Exception { createNetwork(); startDBContainer(BasicSteps.DB_CONTAINER_NAME); - synchronized (this) { - this.wait(WAIT_FOR_DB); - } + waitDBContainer(BasicSteps.DB_CONTAINER_NAME); startESContainer(BasicSteps.ES_CONTAINER_NAME); - synchronized (this) { - this.wait(WAIT_FOR_ES); - } + waitEsContainer(BasicSteps.ES_CONTAINER_NAME); startEventBrokerContainer(BasicSteps.EVENTS_BROKER_CONTAINER_NAME); - synchronized (this) { - this.wait(WAIT_FOR_EVENTS_BROKER); - } + waitEventBrokerContainer(BasicSteps.EVENTS_BROKER_CONTAINER_NAME); startJobEngineContainer(BasicSteps.JOB_ENGINE_CONTAINER_NAME); - synchronized (this) { - this.wait(WAIT_FOR_JOB_ENGINE); - } + waitJobEngineContainer(BasicSteps.JOB_ENGINE_CONTAINER_NAME); } catch (Exception e) { logger.error("Error while starting base docker environment: {}", e.getMessage(), e); @@ -394,24 +384,16 @@ public void startApiDockerEnvironment(String tokenTTL, String refreshTokenTTL, i createNetwork(); startDBContainer(BasicSteps.DB_CONTAINER_NAME); - synchronized (this) { - this.wait(WAIT_FOR_DB); - } + waitDBContainer(BasicSteps.DB_CONTAINER_NAME); startEventBrokerContainer(BasicSteps.EVENTS_BROKER_CONTAINER_NAME); - synchronized (this) { - this.wait(WAIT_FOR_EVENTS_BROKER); - } + waitEventBrokerContainer(BasicSteps.EVENTS_BROKER_CONTAINER_NAME); startJobEngineContainer(BasicSteps.JOB_ENGINE_CONTAINER_NAME); - synchronized (this) { - this.wait(WAIT_FOR_JOB_ENGINE); - } + waitJobEngineContainer(BasicSteps.JOB_ENGINE_CONTAINER_NAME); startAPIContainer(BasicSteps.API_CONTAINER_NAME, tokenTTL, refreshTokenTTL, corsEndpointRefreshInterval); - synchronized (this) { - this.wait(WAIT_FOR_JOB_ENGINE); - } + waitRestApiContainer(BasicSteps.JOB_ENGINE_CONTAINER_NAME); } catch (Exception e) { logger.error("Error while starting base docker environment: {}", e.getMessage(), e); From bd9abbde32721cb1519f3fd41180f7f742d2d237 Mon Sep 17 00:00:00 2001 From: Alberto Codutti Date: Mon, 20 Jan 2025 14:41:31 +0100 Subject: [PATCH 12/18] :recycle: [Test] Improved Job Engine container readiness check Signed-off-by: Alberto Codutti --- .../qa/integration/steps/DockerSteps.java | 74 +++++++++++++---- .../steps/utils/TestReadinessConnection.java | 82 +++++++++++++++++++ 2 files changed, 138 insertions(+), 18 deletions(-) create mode 100644 qa/integration-steps/src/main/java/org/eclipse/kapua/qa/integration/steps/utils/TestReadinessConnection.java 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 26e4c0fd71a..5af71714943 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 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2019, 2024 Eurotech and/or its affiliates and others + * Copyright (c) 2019, 2025 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 @@ -40,6 +40,7 @@ import org.eclipse.kapua.qa.common.BasicSteps; import org.eclipse.kapua.qa.common.DBHelper; import org.eclipse.kapua.qa.common.StepData; +import org.eclipse.kapua.qa.integration.steps.utils.TestReadinessConnection; import org.eclipse.paho.client.mqttv3.MqttException; import org.junit.Assert; import org.slf4j.Logger; @@ -79,12 +80,18 @@ public class DockerSteps { private static final long WAIT_STEP = 2000; private static final long WAIT_FOR_DB = 5000; private static final long WAIT_FOR_ES = 5000; - private static final long WAIT_FOR_EVENTS_BROKER = 5000; - private static final long WAIT_FOR_JOB_ENGINE = 20000; + private static final long WAIT_FOR_EVENTS_BROKER = 10000; 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 JOB_ENGINE_PORT_INTERNAL = 8080; + private static final int JOB_ENGINE_PORT_EXTERNAL = 8080; + // private static final String JOB_ENGINE_ADDRESS_INTERNAL = "http://job-engine:" + JOB_ENGINE_PORT_INTERNAL; Not used? + private static final String JOB_ENGINE_ADDRESS_EXTERNAL = "http://localhost:" + JOB_ENGINE_PORT_EXTERNAL; + private static final long JOB_ENGINE_READY_CHECK_INTERVAL = 1000; + private static final long JOB_ENGINE_READY_MAX_WAIT = 60000; + private static final int LIFECYCLE_HEALTH_CHECK_PORT = 8090; private static final int TElEMETRY_HEALTH_CHECK_PORT = 8091; private static final int AUTH_SERVICE_HEALTH_CHECK_PORT = 8092; @@ -669,9 +676,38 @@ public void startJobEngineContainer(String name) throws DockerException, Interru * @since 2.1.0 */ private void waitJobEngineContainer(String name) throws Exception{ - synchronized (this) { - this.wait(WAIT_FOR_JOB_ENGINE); + + long now = System.currentTimeMillis(); + while (now + JOB_ENGINE_READY_MAX_WAIT > System.currentTimeMillis()) { + if (isJobEngineContainerReady(name)) { + logger.info("Job Engine ready in: ~{}ms", System.currentTimeMillis() - now); + return; + } + + logger.info("Job Engine not ready yet... Retrying in {}ms", JOB_ENGINE_READY_CHECK_INTERVAL); + TimeUnit.MILLISECONDS.sleep(JOB_ENGINE_READY_CHECK_INTERVAL); + } + + Assert.fail("Job Engine not ready within: " + JOB_ENGINE_READY_MAX_WAIT + "ms"); + } + + /** + * Checks if the Job Engine Docker container is ready + * + * @param name The Job Engine Docker container name + * @return {@code true} if is ready, {@code false} otherwise + * @throws Exception + * @since 2.1.0 + */ + private boolean isJobEngineContainerReady(String name) throws Exception { + try (TestReadinessConnection testReadinessConnection = new TestReadinessConnection(JOB_ENGINE_ADDRESS_EXTERNAL)){ + return testReadinessConnection.isReady(); + } + catch (Exception e) { + // Ignoring... } + + return false; } @And("Start API container with name {string}") @@ -1151,14 +1187,13 @@ private ContainerConfig getEventBrokerContainerConfig() { * @return Container configuration for job engine instance. */ private ContainerConfig getJobEngineContainerConfig() { - final int jobEnginePort = 8080; - final Map> portBindings = new HashMap<>(); - addHostPort(ALL_IP, portBindings, jobEnginePort, jobEnginePort); - final HostConfig hostConfig = HostConfig.builder().portBindings(portBindings).build(); + Map> portBindings = new HashMap<>(); + addHostPort(ALL_IP, portBindings, JOB_ENGINE_PORT_INTERNAL, JOB_ENGINE_PORT_EXTERNAL); + HostConfig hostConfig = HostConfig.builder().portBindings(portBindings).build(); return ContainerConfig.builder() .hostConfig(hostConfig) - .exposedPorts(String.valueOf(jobEnginePort)) + .exposedPorts(String.valueOf(JOB_ENGINE_PORT_INTERNAL)) .env( "CRYPTO_SECRET_KEY=kapuaTestsKey!!!" ) @@ -1167,16 +1202,19 @@ private ContainerConfig getJobEngineContainerConfig() { } /** - * Add docker port to host port mapping. + * Add Docker port to host port mappings. * - * @param host ip address of host - * @param portBindings list ob bindings that gets updated - * @param port docker port - * @param hostPort port on host + * @param host IP address of host + * @param portBindings {@link List} ob bindings that gets updated + * @param port Docker container port + * @param hostPort Port exposed on host + * + * @since 2.0.0 */ - private void addHostPort(String host, Map> portBindings, - int port, int hostPort) { - + private void addHostPort(String host, + Map> portBindings, + int port, + int hostPort) { List hostPorts = new ArrayList<>(); hostPorts.add(PortBinding.of(host, hostPort)); portBindings.put(String.valueOf(port), hostPorts); diff --git a/qa/integration-steps/src/main/java/org/eclipse/kapua/qa/integration/steps/utils/TestReadinessConnection.java b/qa/integration-steps/src/main/java/org/eclipse/kapua/qa/integration/steps/utils/TestReadinessConnection.java new file mode 100644 index 00000000000..81388bd4dd9 --- /dev/null +++ b/qa/integration-steps/src/main/java/org/eclipse/kapua/qa/integration/steps/utils/TestReadinessConnection.java @@ -0,0 +1,82 @@ +/******************************************************************************* + * Copyright (c) 2025, 2025 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 + *******************************************************************************/ +package org.eclipse.kapua.qa.integration.steps.utils; + +import java.io.IOException; +import java.net.HttpURLConnection; +import java.net.URL; + +/** + * Wrapper for {@link HttpURLConnection} that implements {@link AutoCloseable} + * + * @since 2.1.0 + */ +public class TestReadinessConnection implements AutoCloseable { + + private final HttpURLConnection testReadinessConnection; + private final int readyResponseCode; + + /** + * Constructor. + * + * @param testUrl The HTTP URL to check for readiness + * @throws Exception + * @since 2.1.0 + */ + public TestReadinessConnection(String testUrl) throws Exception { + this(testUrl, 200); + } + + + /** + * Constructor. + * + * @param testUrl The HTTP URL to check for readiness + * @param readyResponseCode Which HTTP response code consider valid for readiness + * @throws Exception + * @since 2.1.0 + */ + public TestReadinessConnection(String testUrl, int readyResponseCode) throws IOException { + URL testReadinessURL = new URL(testUrl); + + testReadinessConnection = (HttpURLConnection) testReadinessURL.openConnection(); + testReadinessConnection.setConnectTimeout(5000); + testReadinessConnection.setReadTimeout(5000); + testReadinessConnection.setRequestMethod("GET"); + + this.readyResponseCode = readyResponseCode; + } + + /** + * Checks that the HTTP returns the expected HTTP response code. + * + * @return {@code true} if expected code is returned, {@code false} otherwise + * @throws IOException + * @since 2.1.0 + */ + public boolean isReady() throws IOException { + return testReadinessConnection.getResponseCode() == readyResponseCode; + } + + /** + * Invokes {@link HttpURLConnection#disconnect()} + * + * @since 2.1.0 + */ + @Override + public void close() { + if (testReadinessConnection != null) { + testReadinessConnection.disconnect(); + } + } +} From 1ed1fe6eb57de3b6b3a529e258ee9ba495ff735b Mon Sep 17 00:00:00 2001 From: Alberto Codutti Date: Mon, 20 Jan 2025 15:23:44 +0100 Subject: [PATCH 13/18] :recycle: [Test] Improved Job running checks while testing Signed-off-by: Alberto Codutti --- .../service/job/steps/JobEngineSteps.java | 24 +++++++++++++++---- 1 file changed, 19 insertions(+), 5 deletions(-) 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 267b6aed576..9bca2aade32 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 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2021, 2024 Eurotech and/or its affiliates and others + * Copyright (c) 2021, 2025 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 @@ -27,6 +27,8 @@ import org.eclipse.kapua.qa.common.StepData; import org.eclipse.kapua.service.job.Job; import org.junit.Assert; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import javax.inject.Inject; import java.util.concurrent.TimeUnit; @@ -34,6 +36,8 @@ @Singleton public class JobEngineSteps extends JobServiceTestBase { + private static final Logger LOG = LoggerFactory.getLogger(JobEngineSteps.class); + private JobEngineService jobEngineService; private JobEngineFactory jobEngineFactory; @@ -83,8 +87,13 @@ public void waitJobInContextToStart(int waitSeconds) throws Exception { long now = System.currentTimeMillis(); while ((System.currentTimeMillis() - now) < (waitSeconds * 1000L)) { - if (jobEngineService.isRunning(job.getScopeId(), job.getId())) { - return; + try { + if (jobEngineService.isRunning(job.getScopeId(), job.getId())) { + return; + } + } + catch (Exception e){ + LOG.warn("Error while checking running status for Job {}. Ignoring... Error: {}", job.getName(), e.getMessage()); } // Check frequently! @@ -136,8 +145,13 @@ public void waitJobByNameUpTo(String jobName, int waitSeconds) throws Exception private void waitJobUpTo(Job job, int waitSeconds) throws Exception { long now = System.currentTimeMillis(); while ((System.currentTimeMillis() - now) < (waitSeconds * 1000L)) { - if (!jobEngineService.isRunning(job.getScopeId(), job.getId())) { - return; + try { + if (!jobEngineService.isRunning(job.getScopeId(), job.getId())) { + return; + } + } + catch (Exception e){ + LOG.warn("Error while checking running status for Job {}. Ignoring... Error: {}", job.getName(), e.getMessage()); } TimeUnit.MILLISECONDS.sleep(100); From 4fc4af5ddac3cf5bf9c01bb5f2856a477bff8b25 Mon Sep 17 00:00:00 2001 From: Alberto Codutti Date: Mon, 20 Jan 2025 18:21:07 +0100 Subject: [PATCH 14/18] :recycle: [Test] Improved Message Broker container readiness check Signed-off-by: Alberto Codutti --- .../qa/integration/steps/DockerSteps.java | 107 +++++++++++++++--- 1 file changed, 91 insertions(+), 16 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 5af71714943..b2c76678ff1 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 @@ -41,7 +41,11 @@ import org.eclipse.kapua.qa.common.DBHelper; import org.eclipse.kapua.qa.common.StepData; import org.eclipse.kapua.qa.integration.steps.utils.TestReadinessConnection; +import org.eclipse.paho.client.mqttv3.MqttClient; +import org.eclipse.paho.client.mqttv3.MqttConnectOptions; import org.eclipse.paho.client.mqttv3.MqttException; +import org.eclipse.paho.client.mqttv3.MqttSecurityException; +import org.eclipse.paho.client.mqttv3.persist.MemoryPersistence; import org.junit.Assert; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -82,16 +86,28 @@ public class DockerSteps { private static final long WAIT_FOR_ES = 5000; private static final long WAIT_FOR_EVENTS_BROKER = 10000; 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 JOB_ENGINE_PORT_INTERNAL = 8080; private static final int JOB_ENGINE_PORT_EXTERNAL = 8080; - // private static final String JOB_ENGINE_ADDRESS_INTERNAL = "http://job-engine:" + JOB_ENGINE_PORT_INTERNAL; Not used? private static final String JOB_ENGINE_ADDRESS_EXTERNAL = "http://localhost:" + JOB_ENGINE_PORT_EXTERNAL; private static final long JOB_ENGINE_READY_CHECK_INTERVAL = 1000; private static final long JOB_ENGINE_READY_MAX_WAIT = 60000; + private static final int MESSAGE_BROKER_PORT_MQTT_CONTAINER = 1883; + private static final int MESSAGE_BROKER_PORT_MQTT_HOST = 1883; + private static final int MESSAGE_BROKER_PORT_INTERNAL_CONTAINER = 1893; + private static final int MESSAGE_BROKER_PORT_INTERNAL_HOST = 1893; + private static final int MESSAGE_BROKER_PORT_MQTTS_CONTAINER = 8883; + private static final int MESSAGE_BROKER_PORT_MQTTS_HOST = 8883; + private static final int MESSAGE_BROKER_PORT_WS_CONTAINER = 8161; + private static final int MESSAGE_BROKER_PORT_WS_HOST = 8161; + private static final int MESSAGE_BROKER_PORT_DEBUG_CONTAINER = 5005; + private static final int MESSAGE_BROKER_PORT_DEBUG_HOST = 5005; + private static final String MESSAGE_BROKER_ADDRESS_EXTERNAL = "tcp://localhost:" + MESSAGE_BROKER_PORT_MQTT_HOST; + private static final long MESSAGE_BROKER_READY_CHECK_INTERVAL = 1000; + private static final long MESSAGE_BROKER_READY_MAX_WAIT = 60000; + private static final int LIFECYCLE_HEALTH_CHECK_PORT = 8090; private static final int TElEMETRY_HEALTH_CHECK_PORT = 8091; private static final int AUTH_SERVICE_HEALTH_CHECK_PORT = 8092; @@ -629,7 +645,7 @@ private void waitEsContainer(String name) throws Exception{ } } - @And("Start EventBroker container with name {string}") + @And("Start Event Broker container with name {string}") public void startEventBrokerContainer(String name) throws DockerException, InterruptedException { logger.info("Starting EventBroker container..."); ContainerConfig ebConfig = getEventBrokerContainerConfig(); @@ -655,7 +671,7 @@ private void waitEventBrokerContainer(String name) throws Exception{ } } - @And("Start JobEngine container with name {string}") + @And("Start Job Engine container with name {string}") public void startJobEngineContainer(String name) throws DockerException, InterruptedException { logger.info("Starting Job Engine container {}...", name); ContainerConfig mbConfig = getJobEngineContainerConfig(); @@ -676,7 +692,6 @@ public void startJobEngineContainer(String name) throws DockerException, Interru * @since 2.1.0 */ private void waitJobEngineContainer(String name) throws Exception{ - long now = System.currentTimeMillis(); while (now + JOB_ENGINE_READY_MAX_WAIT > System.currentTimeMillis()) { if (isJobEngineContainerReady(name)) { @@ -736,10 +751,22 @@ private void waitRestApiContainer(String name) throws Exception{ } } - @And("Start MessageBroker container with name {string}") + @And("Start Message Broker container with name {string}") public void startMessageBrokerContainer(String name) throws DockerException, InterruptedException { logger.info("Starting Message Broker container {}...", name); - ContainerConfig mbConfig = getBrokerContainerConfig("message-broker", 1883, 1883, 1893, 1893, 8883, 8883, 8161, 8161, 5005, 5005, "kapua/" + BROKER_IMAGE + ":" + KAPUA_VERSION); + ContainerConfig mbConfig = getBrokerContainerConfig( + name, + MESSAGE_BROKER_PORT_MQTT_CONTAINER, + MESSAGE_BROKER_PORT_MQTT_HOST, + MESSAGE_BROKER_PORT_INTERNAL_CONTAINER, + MESSAGE_BROKER_PORT_INTERNAL_HOST, + MESSAGE_BROKER_PORT_MQTTS_CONTAINER, + MESSAGE_BROKER_PORT_MQTTS_HOST, + MESSAGE_BROKER_PORT_WS_CONTAINER, + MESSAGE_BROKER_PORT_WS_HOST, + MESSAGE_BROKER_PORT_DEBUG_CONTAINER, + MESSAGE_BROKER_PORT_DEBUG_HOST, + "kapua/" + BROKER_IMAGE + ":" + KAPUA_VERSION); ContainerCreation mbContainerCreation = DockerUtil.getDockerClient().createContainer(mbConfig, name); String containerId = mbContainerCreation.id(); @@ -757,9 +784,54 @@ public void startMessageBrokerContainer(String name) throws DockerException, Int * @since 2.1.0 */ private void waitMessageBrokerContainer(String name) throws Exception{ - synchronized (this) { - this.wait(WAIT_FOR_BROKER); + long now = System.currentTimeMillis(); + while (now + MESSAGE_BROKER_READY_MAX_WAIT > System.currentTimeMillis()) { + if (isMessageBrokerContainerReady(name)) { + logger.info("Message Broker ready in: ~{}ms", System.currentTimeMillis() - now); + return; + } + + logger.info("Message Broker not ready yet... Retrying in {}ms", MESSAGE_BROKER_READY_CHECK_INTERVAL); + TimeUnit.MILLISECONDS.sleep(MESSAGE_BROKER_READY_CHECK_INTERVAL); } + + Assert.fail("Message Broker not ready within: " + MESSAGE_BROKER_READY_MAX_WAIT + "ms"); + } + + /** + * Checks if the Message Broker Docker container is ready + * + * @param name The Message Broker Docker container name + * @return {@code true} if is ready, {@code false} otherwise + * @since 2.1.0 + */ + private boolean isMessageBrokerContainerReady(String name) { + try (MqttClient testReadinessClient = new MqttClient(MESSAGE_BROKER_ADDRESS_EXTERNAL, "test-readiness", new MemoryPersistence())){ + + // These username and password do not match any entry. + // We need just to receive the "Not authorized to connect" from the broker on connection attempt + MqttConnectOptions clientOpts = new MqttConnectOptions(); + clientOpts.setUserName("test-readiness-user"); // This user do + clientOpts.setPassword("test-readiness-password".toCharArray()); + clientOpts.setConnectionTimeout(1); + + try { + testReadinessClient.connect(clientOpts); + } + catch (MqttSecurityException mse) { + // When the Message Broker is ready will accept connection attempts. + // Since we are not providing valid username and password we are interested on + // receiving a MqttSecurityException with the following message. + if ("Not authorized to connect".equals(mse.getMessage())) { + return true; + } + } + } + catch (Exception e) { + // Ignoring... + } + + return false; } @And("Start Auth service container with name {string}") @@ -951,9 +1023,7 @@ private void printContainerLog(String name) { /** * Creation of docker container configuration for broker. * - * @param brokerAddr * @param brokerIp - * @param clusterName * @param mqttPort mqtt port on docker * @param mqttHostPort mqtt port on docker host * @param mqttsPort mqtts port on docker @@ -967,11 +1037,16 @@ private void printContainerLog(String name) { * @return Container configuration for specific boroker instance */ private ContainerConfig getBrokerContainerConfig(String brokerIp, - int mqttPort, int mqttHostPort, - int mqttInternalPort, int mqttInternalHostPort, - int mqttsPort, int mqttsHostPort, - int webPort, int webHostPort, - int debugPort, int debugHostPort, + int mqttPort, + int mqttHostPort, + int mqttInternalPort, + int mqttInternalHostPort, + int mqttsPort, + int mqttsHostPort, + int webPort, + int webHostPort, + int debugPort, + int debugHostPort, String dockerImage) { final Map> portBindings = new HashMap<>(); From 41531406e4f15cf9c087e35ee12524d8ceb11204 Mon Sep 17 00:00:00 2001 From: Alberto Codutti Date: Mon, 20 Jan 2025 18:22:42 +0100 Subject: [PATCH 15/18] :recycle: [Test] Aligned parameter naming Signed-off-by: Alberto Codutti --- .../kapua/qa/integration/steps/DockerSteps.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 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 b2c76678ff1..8e6c0a35f86 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 @@ -88,9 +88,9 @@ public class DockerSteps { private static final long WAIT_FOR_REST_API = 30000; private static final int HTTP_COMMUNICATION_TIMEOUT = 3000; - private static final int JOB_ENGINE_PORT_INTERNAL = 8080; - private static final int JOB_ENGINE_PORT_EXTERNAL = 8080; - private static final String JOB_ENGINE_ADDRESS_EXTERNAL = "http://localhost:" + JOB_ENGINE_PORT_EXTERNAL; + private static final int JOB_ENGINE_PORT_CONTAINER = 8080; + private static final int JOB_ENGINE_PORT_HOST = 8080; + private static final String JOB_ENGINE_ADDRESS_EXTERNAL = "http://localhost:" + JOB_ENGINE_PORT_HOST; private static final long JOB_ENGINE_READY_CHECK_INTERVAL = 1000; private static final long JOB_ENGINE_READY_MAX_WAIT = 60000; @@ -1263,12 +1263,12 @@ private ContainerConfig getEventBrokerContainerConfig() { */ private ContainerConfig getJobEngineContainerConfig() { Map> portBindings = new HashMap<>(); - addHostPort(ALL_IP, portBindings, JOB_ENGINE_PORT_INTERNAL, JOB_ENGINE_PORT_EXTERNAL); + addHostPort(ALL_IP, portBindings, JOB_ENGINE_PORT_CONTAINER, JOB_ENGINE_PORT_HOST); HostConfig hostConfig = HostConfig.builder().portBindings(portBindings).build(); return ContainerConfig.builder() .hostConfig(hostConfig) - .exposedPorts(String.valueOf(JOB_ENGINE_PORT_INTERNAL)) + .exposedPorts(String.valueOf(JOB_ENGINE_PORT_CONTAINER)) .env( "CRYPTO_SECRET_KEY=kapuaTestsKey!!!" ) From fd667ac0a8e3624e306f821ac70f1dd8c1f6d4af Mon Sep 17 00:00:00 2001 From: Alberto Codutti Date: Tue, 21 Jan 2025 09:45:35 +0100 Subject: [PATCH 16/18] :recycle: [Test] Improvements on readyness checks of resources Signed-off-by: Alberto Codutti --- .../qa/integration/steps/DockerSteps.java | 33 ++----- ....java => TestReadinessHttpConnection.java} | 26 +++--- .../TestReadinessMqttBrokerConnection.java | 86 +++++++++++++++++++ 3 files changed, 105 insertions(+), 40 deletions(-) rename qa/integration-steps/src/main/java/org/eclipse/kapua/qa/integration/steps/utils/{TestReadinessConnection.java => TestReadinessHttpConnection.java} (80%) create mode 100644 qa/integration-steps/src/main/java/org/eclipse/kapua/qa/integration/steps/utils/TestReadinessMqttBrokerConnection.java 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 8e6c0a35f86..e3347a20d92 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 @@ -40,12 +40,9 @@ import org.eclipse.kapua.qa.common.BasicSteps; import org.eclipse.kapua.qa.common.DBHelper; import org.eclipse.kapua.qa.common.StepData; -import org.eclipse.kapua.qa.integration.steps.utils.TestReadinessConnection; -import org.eclipse.paho.client.mqttv3.MqttClient; -import org.eclipse.paho.client.mqttv3.MqttConnectOptions; +import org.eclipse.kapua.qa.integration.steps.utils.TestReadinessHttpConnection; +import org.eclipse.kapua.qa.integration.steps.utils.TestReadinessMqttBrokerConnection; import org.eclipse.paho.client.mqttv3.MqttException; -import org.eclipse.paho.client.mqttv3.MqttSecurityException; -import org.eclipse.paho.client.mqttv3.persist.MemoryPersistence; import org.junit.Assert; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -715,8 +712,8 @@ private void waitJobEngineContainer(String name) throws Exception{ * @since 2.1.0 */ private boolean isJobEngineContainerReady(String name) throws Exception { - try (TestReadinessConnection testReadinessConnection = new TestReadinessConnection(JOB_ENGINE_ADDRESS_EXTERNAL)){ - return testReadinessConnection.isReady(); + try (TestReadinessHttpConnection testReadinessHttpConnection = new TestReadinessHttpConnection(JOB_ENGINE_ADDRESS_EXTERNAL)){ + return testReadinessHttpConnection.isReady(); } catch (Exception e) { // Ignoring... @@ -806,26 +803,8 @@ private void waitMessageBrokerContainer(String name) throws Exception{ * @since 2.1.0 */ private boolean isMessageBrokerContainerReady(String name) { - try (MqttClient testReadinessClient = new MqttClient(MESSAGE_BROKER_ADDRESS_EXTERNAL, "test-readiness", new MemoryPersistence())){ - - // These username and password do not match any entry. - // We need just to receive the "Not authorized to connect" from the broker on connection attempt - MqttConnectOptions clientOpts = new MqttConnectOptions(); - clientOpts.setUserName("test-readiness-user"); // This user do - clientOpts.setPassword("test-readiness-password".toCharArray()); - clientOpts.setConnectionTimeout(1); - - try { - testReadinessClient.connect(clientOpts); - } - catch (MqttSecurityException mse) { - // When the Message Broker is ready will accept connection attempts. - // Since we are not providing valid username and password we are interested on - // receiving a MqttSecurityException with the following message. - if ("Not authorized to connect".equals(mse.getMessage())) { - return true; - } - } + try (TestReadinessMqttBrokerConnection testReadinessConnection = new TestReadinessMqttBrokerConnection(MESSAGE_BROKER_ADDRESS_EXTERNAL)){ + return testReadinessConnection.isReady(); } catch (Exception e) { // Ignoring... diff --git a/qa/integration-steps/src/main/java/org/eclipse/kapua/qa/integration/steps/utils/TestReadinessConnection.java b/qa/integration-steps/src/main/java/org/eclipse/kapua/qa/integration/steps/utils/TestReadinessHttpConnection.java similarity index 80% rename from qa/integration-steps/src/main/java/org/eclipse/kapua/qa/integration/steps/utils/TestReadinessConnection.java rename to qa/integration-steps/src/main/java/org/eclipse/kapua/qa/integration/steps/utils/TestReadinessHttpConnection.java index 81388bd4dd9..9cf05473db8 100644 --- a/qa/integration-steps/src/main/java/org/eclipse/kapua/qa/integration/steps/utils/TestReadinessConnection.java +++ b/qa/integration-steps/src/main/java/org/eclipse/kapua/qa/integration/steps/utils/TestReadinessHttpConnection.java @@ -21,9 +21,10 @@ * * @since 2.1.0 */ -public class TestReadinessConnection implements AutoCloseable { +public class TestReadinessHttpConnection implements AutoCloseable { - private final HttpURLConnection testReadinessConnection; + private final URL testReadinessURL; + private HttpURLConnection testReadinessConnection; private final int readyResponseCode; /** @@ -33,7 +34,7 @@ public class TestReadinessConnection implements AutoCloseable { * @throws Exception * @since 2.1.0 */ - public TestReadinessConnection(String testUrl) throws Exception { + public TestReadinessHttpConnection(String testUrl) throws Exception { this(testUrl, 200); } @@ -43,17 +44,11 @@ public TestReadinessConnection(String testUrl) throws Exception { * * @param testUrl The HTTP URL to check for readiness * @param readyResponseCode Which HTTP response code consider valid for readiness - * @throws Exception + * @throws IOException * @since 2.1.0 */ - public TestReadinessConnection(String testUrl, int readyResponseCode) throws IOException { - URL testReadinessURL = new URL(testUrl); - - testReadinessConnection = (HttpURLConnection) testReadinessURL.openConnection(); - testReadinessConnection.setConnectTimeout(5000); - testReadinessConnection.setReadTimeout(5000); - testReadinessConnection.setRequestMethod("GET"); - + public TestReadinessHttpConnection(String testUrl, int readyResponseCode) throws IOException { + this.testReadinessURL = new URL(testUrl); this.readyResponseCode = readyResponseCode; } @@ -65,11 +60,16 @@ public TestReadinessConnection(String testUrl, int readyResponseCode) throws IOE * @since 2.1.0 */ public boolean isReady() throws IOException { + testReadinessConnection = (HttpURLConnection) testReadinessURL.openConnection(); + testReadinessConnection.setConnectTimeout(5000); + testReadinessConnection.setReadTimeout(5000); + testReadinessConnection.setRequestMethod("GET"); + return testReadinessConnection.getResponseCode() == readyResponseCode; } /** - * Invokes {@link HttpURLConnection#disconnect()} + * Invokes {@link HttpURLConnection#disconnect()} to clean up resources. * * @since 2.1.0 */ diff --git a/qa/integration-steps/src/main/java/org/eclipse/kapua/qa/integration/steps/utils/TestReadinessMqttBrokerConnection.java b/qa/integration-steps/src/main/java/org/eclipse/kapua/qa/integration/steps/utils/TestReadinessMqttBrokerConnection.java new file mode 100644 index 00000000000..2004272beeb --- /dev/null +++ b/qa/integration-steps/src/main/java/org/eclipse/kapua/qa/integration/steps/utils/TestReadinessMqttBrokerConnection.java @@ -0,0 +1,86 @@ +/******************************************************************************* + * Copyright (c) 2025, 2025 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 + *******************************************************************************/ +package org.eclipse.kapua.qa.integration.steps.utils; + +import org.eclipse.paho.client.mqttv3.MqttClient; +import org.eclipse.paho.client.mqttv3.MqttConnectOptions; +import org.eclipse.paho.client.mqttv3.MqttException; +import org.eclipse.paho.client.mqttv3.MqttSecurityException; +import org.eclipse.paho.client.mqttv3.persist.MemoryPersistence; + +import java.net.HttpURLConnection; + +/** + * Wrapper for {@link HttpURLConnection} that implements {@link AutoCloseable} + * + * @since 2.1.0 + */ +public class TestReadinessMqttBrokerConnection implements AutoCloseable { + + private final String testReadinessAddress; + private MqttClient testReadinessClient; + + /** + * Constructor. + * + * @param testReadinessAddress The mqtt address to check for readiness + * @since 2.1.0 + */ + public TestReadinessMqttBrokerConnection(String testReadinessAddress) { + this.testReadinessAddress = testReadinessAddress; + } + + /** + * Checks that the HTTP returns the expected HTTP response code. + * + * @return {@code true} if expected code is returned, {@code false} otherwise + * @throws MqttException + * @since 2.1.0 + */ + public boolean isReady() throws MqttException { + testReadinessClient = new MqttClient(testReadinessAddress, "test-readiness", new MemoryPersistence()); + + // These username and password do not match any entry. + // We need just to receive the "Not authorized to connect" from the broker on connection attempt + MqttConnectOptions clientOpts = new MqttConnectOptions(); + clientOpts.setUserName("test-readiness-user"); // This user do + clientOpts.setPassword("test-readiness-password".toCharArray()); + clientOpts.setConnectionTimeout(1); + + try { + testReadinessClient.connect(clientOpts); + } + catch (MqttSecurityException mse) { + // When the Message Broker is ready will accept connection attempts. + // Since we are not providing valid username and password we are interested on + // receiving a MqttSecurityException with the following message. + if ("Not authorized to connect".equals(mse.getMessage())) { + return true; + } + } + + return false; + } + + /** + * Invokes {@link HttpURLConnection#disconnect()} to clean up resources. + * + * @since 2.1.0 + */ + @Override + public void close() throws MqttException { + if (testReadinessClient != null) { + testReadinessClient.close(); + } + } +} From 4e05b8e85a59e48eecccb7574592ed62ce397d62 Mon Sep 17 00:00:00 2001 From: Alberto Codutti Date: Tue, 21 Jan 2025 11:18:34 +0100 Subject: [PATCH 17/18] :recycle: [Test] Cleanup Signed-off-by: Alberto Codutti --- .../kapua/qa/integration/steps/DockerSteps.java | 5 ++++- .../steps/utils/TestReadinessHttpConnection.java | 2 +- .../steps/utils/TestReadinessMqttBrokerConnection.java | 10 ++++------ 3 files changed, 9 insertions(+), 8 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 e3347a20d92..02ed2367c94 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 @@ -257,6 +257,9 @@ public void startFullDockerEnvironment() throws Exception { /** * Starts Docker container requested. * + * TODO: Add missing Telemetry mapping + * TODO: Move to start multiple resources and check readiness of components in parallel + * * @param dockerContainers The Docker containers to start * @throws Exception * @since 2.1.0 @@ -313,7 +316,7 @@ public void startDockerEnvironmentWithResources(List dockerContainers) t case "events-broker": case "job-engine": case "message-broker": { - // Nothing to do. Those containers are delay-based. + // Nothing to do. // Waiting to refactor them } break; case "broker-auth-service": { diff --git a/qa/integration-steps/src/main/java/org/eclipse/kapua/qa/integration/steps/utils/TestReadinessHttpConnection.java b/qa/integration-steps/src/main/java/org/eclipse/kapua/qa/integration/steps/utils/TestReadinessHttpConnection.java index 9cf05473db8..74d6b91d8eb 100644 --- a/qa/integration-steps/src/main/java/org/eclipse/kapua/qa/integration/steps/utils/TestReadinessHttpConnection.java +++ b/qa/integration-steps/src/main/java/org/eclipse/kapua/qa/integration/steps/utils/TestReadinessHttpConnection.java @@ -17,7 +17,7 @@ import java.net.URL; /** - * Wrapper for {@link HttpURLConnection} that implements {@link AutoCloseable} + * Test readiness for HTTP-based components utility. * * @since 2.1.0 */ diff --git a/qa/integration-steps/src/main/java/org/eclipse/kapua/qa/integration/steps/utils/TestReadinessMqttBrokerConnection.java b/qa/integration-steps/src/main/java/org/eclipse/kapua/qa/integration/steps/utils/TestReadinessMqttBrokerConnection.java index 2004272beeb..037b4d725ed 100644 --- a/qa/integration-steps/src/main/java/org/eclipse/kapua/qa/integration/steps/utils/TestReadinessMqttBrokerConnection.java +++ b/qa/integration-steps/src/main/java/org/eclipse/kapua/qa/integration/steps/utils/TestReadinessMqttBrokerConnection.java @@ -18,10 +18,8 @@ import org.eclipse.paho.client.mqttv3.MqttSecurityException; import org.eclipse.paho.client.mqttv3.persist.MemoryPersistence; -import java.net.HttpURLConnection; - /** - * Wrapper for {@link HttpURLConnection} that implements {@link AutoCloseable} + * Test readiness for Message Broker utility. * * @since 2.1.0 */ @@ -41,9 +39,9 @@ public TestReadinessMqttBrokerConnection(String testReadinessAddress) { } /** - * Checks that the HTTP returns the expected HTTP response code. + * Checks that the MQTT returns an authentication error. * - * @return {@code true} if expected code is returned, {@code false} otherwise + * @return {@code true} if expected error is returned, {@code false} otherwise * @throws MqttException * @since 2.1.0 */ @@ -73,7 +71,7 @@ public boolean isReady() throws MqttException { } /** - * Invokes {@link HttpURLConnection#disconnect()} to clean up resources. + * Invokes {@link MqttClient#close()} to clean up resources. * * @since 2.1.0 */ From 7af39213913fce693aee83e7fc6ec7132358a66c Mon Sep 17 00:00:00 2001 From: Alberto Codutti Date: Tue, 21 Jan 2025 15:10:16 +0100 Subject: [PATCH 18/18] :recycle: [Test] Added autoreconnect of Kura Device Signed-off-by: Alberto Codutti --- .../eclipse/kapua/service/device/registry/steps/KuraDevice.java | 2 ++ 1 file changed, 2 insertions(+) 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 65076a8f0d3..d33e84f37c9 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 @@ -249,10 +249,12 @@ public void mqttClientConnect() { MqttConnectOptions clientOpts = new MqttConnectOptions(); clientOpts.setUserName(CLIENT_USER); clientOpts.setPassword(CLIENT_PASSWORD.toCharArray()); + clientOpts.setAutomaticReconnect(true); MqttConnectOptions serverOpts = new MqttConnectOptions(); serverOpts.setUserName(SERVER_USER); serverOpts.setPassword(SERVER_PASSWORD.toCharArray()); + serverOpts.setAutomaticReconnect(true); try { mqttClient.connect(clientOpts);