Remove allure (phase2) (#2483)

Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
This commit is contained in:
Avgustin Marinov
2025-06-20 15:51:06 +03:00
committed by GitHub
parent 39593fc6b6
commit cb7f1107fe
406 changed files with 6993 additions and 5863 deletions

1
.gitignore vendored
View File

@@ -5,7 +5,6 @@ tmp
.classpath
target
!hawkbit-rest/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/json/model/target
.allure
.vscode
.springbeans
.metadata

View File

@@ -42,15 +42,13 @@ So we kindly ask contributors:
### Test documentation
Please document the test cases that you contribute by means of [Allure](https://docs.qameta.io/allure/) annotations and
proper test method naming.
All test classes are documented with [Allure's](https://docs.qameta.io/allure/#_behaviours_mapping) **@Feature** and *
*@Story** annotations in the following format:
You could document the test cases using the following format:
```java
@Feature("TEST_TYPE - HAWKBIT_COMPONENT")
@Story("Test class description")
/**
* Feature: TEST_TYPE - HAWKBIT_COMPONENT<br/>
* Story: Test class description
*/
```
Test types are:
@@ -69,14 +67,6 @@ Examples for hawkBit components:
* Repository
* Security
```java
@Feature("Component Tests - Management API")
@Story("Distribution Set Type Resource")
```
In addition all test method's name describes in **camel case** what the test is all about and has in addition a long
description in Allures **@Description** annotation.
## Legal considerations for your contribution
Before your contribution can be accepted by the project team contributors must

View File

@@ -11,27 +11,28 @@ package org.eclipse.hawkbit.artifact.repository.urlhandler;
import static org.assertj.core.api.Assertions.assertThat;
import io.qameta.allure.Description;
import io.qameta.allure.Feature;
import io.qameta.allure.Story;
import org.junit.jupiter.api.Test;
@Feature("Unit Tests - Artifact URL Handler")
@Story("Base62 Utility tests")
/**
* Feature: Unit Tests - Artifact URL Handler<br/>
* Story: Base62 Utility tests
*/
class Base62UtilTest {
@Test
@Description("Convert Base10 numbers to Base62 ASCII strings.")
void fromBase10() {
/**
* Convert Base10 numbers to Base62 ASCII strings.
*/
@Test void fromBase10() {
assertThat(Base62Util.fromBase10(0L)).isEqualTo("0");
assertThat(Base62Util.fromBase10(11L)).isEqualTo("B");
assertThat(Base62Util.fromBase10(36L)).isEqualTo("a");
assertThat(Base62Util.fromBase10(999L)).isEqualTo("G7");
}
@Test
@Description("Convert Base62 ASCII strings to Base10 numbers.")
void toBase10() {
/**
* Convert Base62 ASCII strings to Base10 numbers.
*/
@Test void toBase10() {
assertThat(Base62Util.toBase10("0")).isZero();
assertThat(Base62Util.toBase10("B")).isEqualTo(11);
assertThat(Base62Util.toBase10("a")).isEqualTo(36L);

View File

@@ -15,9 +15,6 @@ import java.net.URI;
import java.net.URISyntaxException;
import java.util.List;
import io.qameta.allure.Description;
import io.qameta.allure.Feature;
import io.qameta.allure.Story;
import org.eclipse.hawkbit.artifact.repository.urlhandler.ArtifactUrlHandlerProperties.UrlProtocol;
import org.eclipse.hawkbit.artifact.repository.urlhandler.URLPlaceholder.SoftwareData;
import org.junit.jupiter.api.BeforeEach;
@@ -27,9 +24,10 @@ import org.mockito.junit.jupiter.MockitoExtension;
/**
* Tests for creating urls to download artifacts.
* <p/>
* Feature: Unit Tests - Artifact URL Handler<br/>
* Story: Test to generate the artifact download URL
*/
@Feature("Unit Tests - Artifact URL Handler")
@Story("Test to generate the artifact download URL")
@ExtendWith(MockitoExtension.class)
class PropertyBasedArtifactUrlHandlerTest {
@@ -61,9 +59,10 @@ class PropertyBasedArtifactUrlHandlerTest {
urlHandlerUnderTest = new PropertyBasedArtifactUrlHandler(properties, "");
}
@Test
@Description("Tests the generation of http download url.")
void urlGenerationWithDefaultConfiguration() {
/**
* Tests the generation of http download url.
*/
@Test void urlGenerationWithDefaultConfiguration() {
properties.getProtocols().put("download-http", new UrlProtocol());
final List<ArtifactUrl> ddiUrls = urlHandlerUnderTest.getUrls(placeHolder, ApiType.DDI);
@@ -75,9 +74,10 @@ class PropertyBasedArtifactUrlHandlerTest {
.isEqualTo(urlHandlerUnderTest.getUrls(placeHolder, ApiType.DMF));
}
@Test
@Description("Tests the generation of custom download url with a CoAP example that supports DMF only.")
void urlGenerationWithCustomConfiguration() {
/**
* Tests the generation of custom download url with a CoAP example that supports DMF only.
*/
@Test void urlGenerationWithCustomConfiguration() {
final UrlProtocol proto = new UrlProtocol();
proto.setIp("127.0.0.1");
proto.setPort(5683);
@@ -94,9 +94,10 @@ class PropertyBasedArtifactUrlHandlerTest {
"coap://127.0.0.1:5683/fw/" + TENANT + "/" + CONTROLLER_ID + "/sha1/" + SHA1HASH));
}
@Test
@Description("Tests the generation of custom download url using Base62 references with a CoAP example that supports DMF only.")
void urlGenerationWithCustomShortConfiguration() {
/**
* Tests the generation of custom download url using Base62 references with a CoAP example that supports DMF only.
*/
@Test void urlGenerationWithCustomShortConfiguration() {
final UrlProtocol proto = new UrlProtocol();
proto.setIp("127.0.0.1");
proto.setPort(5683);
@@ -113,9 +114,10 @@ class PropertyBasedArtifactUrlHandlerTest {
TEST_PROTO + "://127.0.0.1:5683/fws/" + TENANT + "/" + TARGET_ID_BASE62 + "/" + ARTIFACT_ID_BASE62));
}
@Test
@Description("Verifies that the full qualified host of the statically defined hostname is replaced with the host of the request.")
void urlGenerationWithHostFromRequest() throws URISyntaxException {
/**
* Verifies that the full qualified host of the statically defined hostname is replaced with the host of the request.
*/
@Test void urlGenerationWithHostFromRequest() throws URISyntaxException {
final String testHost = "ddi.host.com";
final UrlProtocol proto = new UrlProtocol();
@@ -133,9 +135,10 @@ class PropertyBasedArtifactUrlHandlerTest {
TEST_PROTO + "://" + testHost + ":5683/fws/" + TENANT + "/" + TARGET_ID_BASE62 + "/" + ARTIFACT_ID_BASE62));
}
@Test
@Description("Verifies that the protocol of the statically defined hostname is replaced with the protocol of the request.")
void urlGenerationWithProtocolFromRequest() throws URISyntaxException {
/**
* Verifies that the protocol of the statically defined hostname is replaced with the protocol of the request.
*/
@Test void urlGenerationWithProtocolFromRequest() throws URISyntaxException {
final String testHost = "ddi.host.com";
final UrlProtocol proto = new UrlProtocol();
@@ -148,9 +151,10 @@ class PropertyBasedArtifactUrlHandlerTest {
"https://localhost:8080/fws/" + TENANT + "/" + TARGET_ID_BASE62 + "/" + ARTIFACT_ID_BASE62));
}
@Test
@Description("Verifies that the port of the statically defined hostname is replaced with the port of the request.")
void urlGenerationWithPortFromRequest() throws URISyntaxException {
/**
* Verifies that the port of the statically defined hostname is replaced with the port of the request.
*/
@Test void urlGenerationWithPortFromRequest() throws URISyntaxException {
final UrlProtocol proto = new UrlProtocol();
proto.setRef("{protocol}://{hostname}:{portRequest}/{tenant}/controller/v1/{controllerId}/softwaremodules/{softwareModuleId}/artifacts/{artifactFileName}");
@@ -169,9 +173,10 @@ class PropertyBasedArtifactUrlHandlerTest {
CONTROLLER_ID + "/softwaremodules/" + SOFTWARE_MODULE_ID + "/artifacts/" + FILENAME_ENCODE));
}
@Test
@Description("Verifies that if default protocol port in request is used then url is returned without port")
void urlGenerationWithPortFromRequestForHttps() throws URISyntaxException {
/**
* Verifies that if default protocol port in request is used then url is returned without port
*/
@Test void urlGenerationWithPortFromRequestForHttps() throws URISyntaxException {
final String protocol = "https";
final UrlProtocol proto = new UrlProtocol();
proto.setRef("{protocolRequest}://{hostnameRequest}:{portRequest}/{tenant}/controller/v1/{controllerId}/softwaremodules/{softwareModuleId}/artifacts/{artifactFileName}");
@@ -187,9 +192,10 @@ class PropertyBasedArtifactUrlHandlerTest {
}
@Test
@Description("Verifies that the domain of the statically defined hostname is replaced with the domain of the request.")
void urlGenerationWithDomainFromRequest() throws URISyntaxException {
/**
* Verifies that the domain of the statically defined hostname is replaced with the domain of the request.
*/
@Test void urlGenerationWithDomainFromRequest() throws URISyntaxException {
final UrlProtocol proto = new UrlProtocol();
proto.setHostname("host.bumlux.net");
proto.setRef("{protocol}://{domainRequest}/{tenant}/controller/v1/{controllerId}/softwaremodules/{softwareModuleId}/artifacts/{artifactFileName}");

View File

@@ -11,13 +11,12 @@ package org.eclipse.hawkbit.artifact.repository.urlhandler;
import static org.assertj.core.api.Assertions.assertThat;
import io.qameta.allure.Description;
import io.qameta.allure.Feature;
import io.qameta.allure.Story;
import org.junit.jupiter.api.Test;
@Feature("Unit Tests - Artifact URL Handler")
@Story("URL placeholder tests")
/**
* Feature: Unit Tests - Artifact URL Handler<br/>
* Story: URL placeholder tests
*/
class URLPlaceholderTest {
private final URLPlaceholder.SoftwareData softwareData;
@@ -28,9 +27,10 @@ class URLPlaceholderTest {
this.placeholder = new URLPlaceholder("SuperCorp", 123L, "Super-1", 1L, softwareData);
}
@Test
@Description("Same object should be equal")
// Exception squid:S5785 - JUnit assertTrue/assertFalse should be simplified to the corresponding dedicated assertion
/**
* Same object should be equal
*/
@Test // Exception squid:S5785 - JUnit assertTrue/assertFalse should be simplified to the corresponding dedicated assertion
// Need to test the equals method and need to bypass magic logic in utility classes
@SuppressWarnings({ "squid:S5838" })
void sameObjectShouldBeEqual() {
@@ -38,9 +38,10 @@ class URLPlaceholderTest {
assertThat(placeholder.equals(placeholder)).isTrue();
}
@Test
@Description("Different object should not be equal")
@SuppressWarnings({ "squid:S5838" })
/**
* Different object should not be equal
*/
@Test @SuppressWarnings({ "squid:S5838" })
void differentObjectShouldNotBeEqual() {
final URLPlaceholder.SoftwareData softwareData2 = new URLPlaceholder.SoftwareData(2L, "file.txt", 123L, "someHash123");
final URLPlaceholder placeholder2 = new URLPlaceholder("SuperCorp", 123L, "Super-2", 2L, softwareData2);
@@ -53,18 +54,20 @@ class URLPlaceholderTest {
assertThat(placeholder.equals(placeholderWithOtherSoftwareData)).isFalse();
}
@Test
@Description("Different objects with same properties should be equal")
void differentObjectsWithSamePropertiesShouldBeEqual() {
/**
* Different objects with same properties should be equal
*/
@Test void differentObjectsWithSamePropertiesShouldBeEqual() {
final URLPlaceholder placeholderWithSameProperties = new URLPlaceholder(placeholder.getTenant(), placeholder.getTenantId(),
placeholder.getControllerId(), placeholder.getTargetId(), softwareData);
assertThat(placeholder).isEqualTo(placeholderWithSameProperties);
assertThat(placeholderWithSameProperties).isEqualTo(placeholder);
}
@Test
@Description("Should not equal null")
// Exception squid:S5785 - JUnit assertTrue/assertFalse should be simplified to
/**
* Should not equal null
*/
@Test // Exception squid:S5785 - JUnit assertTrue/assertFalse should be simplified to
// the corresponding dedicated assertion
// Need to test the equals method and need to bypass magic logic in utility
// classes
@@ -74,9 +77,10 @@ class URLPlaceholderTest {
assertThat(softwareData.equals(null)).isFalse();
}
@Test
@Description("HashCode should not change")
void hashCodeShouldNotChange() {
/**
* HashCode should not change
*/
@Test void hashCodeShouldNotChange() {
final URLPlaceholder placeholderWithSameProperties = new URLPlaceholder(placeholder.getTenant(), placeholder.getTenantId(),
placeholder.getControllerId(), placeholder.getTargetId(), softwareData);
assertThat(placeholder).hasSameHashCodeAs(placeholder).hasSameHashCodeAs(placeholderWithSameProperties);

View File

@@ -16,9 +16,6 @@ import java.io.File;
import java.io.IOException;
import java.util.Random;
import io.qameta.allure.Description;
import io.qameta.allure.Feature;
import io.qameta.allure.Story;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;
@@ -29,8 +26,10 @@ import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
@Slf4j
@Feature("Unit Tests - Artifact File System Repository")
@Story("Test storing artifact binaries in the file-system")
/**
* Feature: Unit Tests - Artifact File System Repository<br/>
* Story: Test storing artifact binaries in the file-system
*/
class ArtifactFilesystemRepositoryTest {
private static final String TENANT = "test_tenant";
@@ -57,9 +56,10 @@ class ArtifactFilesystemRepositoryTest {
}
}
@Test
@Description("Verifies that an artifact can be successfully stored in the file-system repository")
void storeSuccessfully() throws IOException {
/**
* Verifies that an artifact can be successfully stored in the file-system repository
*/
@Test void storeSuccessfully() throws IOException {
final byte[] fileContent = randomBytes();
final AbstractDbArtifact artifact = storeRandomArtifact(fileContent);
@@ -68,36 +68,40 @@ class ArtifactFilesystemRepositoryTest {
assertThat(readContent).isEqualTo(fileContent);
}
@Test
@Description("Verifies that an artifact can be successfully stored in the file-system repository")
void getStoredArtifactBasedOnSHA1Hash() throws IOException {
/**
* Verifies that an artifact can be successfully stored in the file-system repository
*/
@Test void getStoredArtifactBasedOnSHA1Hash() throws IOException {
final byte[] fileContent = randomBytes();
final AbstractDbArtifact artifact = storeRandomArtifact(fileContent);
assertThat(artifactFilesystemRepository.getArtifactBySha1(TENANT, artifact.getHashes().getSha1())).isNotNull();
}
@Test
@Description("Verifies that an artifact can be deleted in the file-system repository")
void deleteStoredArtifactBySHA1Hash() throws IOException {
/**
* Verifies that an artifact can be deleted in the file-system repository
*/
@Test void deleteStoredArtifactBySHA1Hash() throws IOException {
final AbstractDbArtifact artifact = storeRandomArtifact(randomBytes());
artifactFilesystemRepository.deleteBySha1(TENANT, artifact.getHashes().getSha1());
assertThat(artifactFilesystemRepository.getArtifactBySha1(TENANT, artifact.getHashes().getSha1())).isNull();
}
@Test
@Description("Verifies that all artifacts of a tenant can be deleted in the file-system repository")
void deleteStoredArtifactOfTenant() throws IOException {
/**
* Verifies that all artifacts of a tenant can be deleted in the file-system repository
*/
@Test void deleteStoredArtifactOfTenant() throws IOException {
final AbstractDbArtifact artifact = storeRandomArtifact(randomBytes());
artifactFilesystemRepository.deleteByTenant(TENANT);
assertThat(artifactFilesystemRepository.getArtifactBySha1(TENANT, artifact.getHashes().getSha1())).isNull();
}
@Test
@Description("Verifies that an artifact which does not exists is deleted quietly in the file-system repository")
void deleteArtifactWhichDoesNotExistsBySHA1HashWithoutException() throws IOException {
/**
* Verifies that an artifact which does not exists is deleted quietly in the file-system repository
*/
@Test void deleteArtifactWhichDoesNotExistsBySHA1HashWithoutException() throws IOException {
try {
artifactFilesystemRepository.deleteBySha1(TENANT, "sha1HashWhichDoesNotExists");
} catch (final Exception e) {

View File

@@ -16,20 +16,20 @@ import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import io.qameta.allure.Description;
import io.qameta.allure.Feature;
import io.qameta.allure.Story;
import org.apache.commons.io.IOUtils;
import org.eclipse.hawkbit.artifact.repository.model.DbArtifactHash;
import org.junit.jupiter.api.Test;
@Feature("Unit Tests - Artifact File System Repository")
@Story("Test storing artifact binaries in the file-system")
/**
* Feature: Unit Tests - Artifact File System Repository<br/>
* Story: Test storing artifact binaries in the file-system
*/
class ArtifactFilesystemTest {
@Test
@Description("Verifies that an exception is thrown on opening an InputStream when file does not exists")
void getInputStreamOfNonExistingFileThrowsException() {
/**
* Verifies that an exception is thrown on opening an InputStream when file does not exists
*/
@Test void getInputStreamOfNonExistingFileThrowsException() {
final File file = new File("fileWhichTotalDoesNotExists");
final ArtifactFilesystem underTest = new ArtifactFilesystem(
file, "fileWhichTotalDoesNotExists",
@@ -39,9 +39,10 @@ class ArtifactFilesystemTest {
.hasCauseInstanceOf(FileNotFoundException.class);
}
@Test
@Description("Verifies that an InputStream can be opened if file exists")
void getInputStreamOfExistingFile() throws IOException {
/**
* Verifies that an InputStream can be opened if file exists
*/
@Test void getInputStreamOfExistingFile() throws IOException {
final ArtifactFilesystem underTest = new ArtifactFilesystem(
AbstractArtifactRepository.createTempFile(false), ArtifactFilesystemTest.class.getSimpleName(),
new DbArtifactHash("1", "2", "3"), 0L, null);

View File

@@ -1 +0,0 @@
{"uuid":"06b4b435-29d7-4dd0-bcb6-b2ed361c31e2","name":"FileNameFieldsTest","children":["d701f914-7aff-400e-8230-a00f1339827c"],"befores":[],"afters":[],"start":1750415118826,"stop":1750415119036}

View File

@@ -1 +0,0 @@
{"uuid":"1e4882c6-e0fe-4cc1-ab20-30344dfd7f6c","name":"FileNameFieldsTest","children":["597ffb13-728c-4020-9afd-e776432afb0b"],"befores":[],"afters":[],"start":1750414146349,"stop":1750414146558}

View File

@@ -1 +0,0 @@
{"uuid":"1eb43d00-6013-4be4-8227-85e47d019d3c","name":"repositoryManagementMethodsArePreAuthorizedAnnotated()","children":["43d8b58c-e102-4ac5-9971-edfe8accda95"],"befores":[],"afters":[],"start":1750415256630,"stop":1750415256926}

View File

@@ -1 +0,0 @@
{"uuid":"1f78aaf3-6314-4839-8931-32fd25ee40a2","historyId":"fa14928b1c8c4668de3f864412a0b0ca","testCaseId":"[engine:junit-jupiter]/[class:org.eclipse.hawkbit.repository.FileNameFieldsTest]/[method:repositoryManagementMethodsArePreAuthorizedAnnotated()]","testCaseName":"repositoryManagementMethodsArePreAuthorizedAnnotated()","fullName":"org.eclipse.hawkbit.repository.FileNameFieldsTest.repositoryManagementMethodsArePreAuthorizedAnnotated","labels":[{"name":"junit.platform.uniqueid","value":"[engine:junit-jupiter]/[class:org.eclipse.hawkbit.repository.FileNameFieldsTest]/[method:repositoryManagementMethodsArePreAuthorizedAnnotated()]"},{"name":"host","value":"SF3-C-000FP"},{"name":"thread","value":"26175@SF3-C-000FP.main(1)"},{"name":"framework","value":"junit-platform"},{"name":"language","value":"java"},{"name":"package","value":"org.eclipse.hawkbit.repository.FileNameFieldsTest"},{"name":"testClass","value":"org.eclipse.hawkbit.repository.FileNameFieldsTest"},{"name":"testMethod","value":"repositoryManagementMethodsArePreAuthorizedAnnotated"},{"name":"suite","value":"org.eclipse.hawkbit.repository.FileNameFieldsTest"}],"links":[],"name":"repositoryManagementMethodsArePreAuthorizedAnnotated()","status":"passed","stage":"finished","description":"Verifies that fields classes are correctly implemented","steps":[],"attachments":[],"parameters":[],"start":1750414575060,"stop":1750414575211}

View File

@@ -1 +0,0 @@
{"uuid":"20e2a037-9c51-49d4-87a2-83439f64c3f5","name":"repositoryManagementMethodsArePreAuthorizedAnnotated()","children":["913eecd1-1800-4cd4-9c59-5094f1221293"],"befores":[],"afters":[],"start":1750414016526,"stop":1750414016717}

View File

@@ -1 +0,0 @@
{"uuid":"236f34e7-42a3-4022-a827-d28eee4739bd","name":"FileNameFieldsTest","children":["bdfb9b69-24d2-4eff-ba3c-1ef30b0519fd"],"befores":[],"afters":[],"start":1750414723330,"stop":1750414723507}

View File

@@ -1 +0,0 @@
{"uuid":"259e6e51-7aaf-4ae2-8eb4-0ccc2876d81f","name":"repositoryManagementMethodsArePreAuthorizedAnnotated()","children":["e82046fe-fd36-4dc0-981e-95e743b8d086"],"befores":[],"afters":[],"start":1750414349120,"stop":1750414349298}

View File

@@ -1 +0,0 @@
{"uuid":"26b493b3-066c-4930-a6ab-ffebee1f01c0","name":"repositoryManagementMethodsArePreAuthorizedAnnotated()","children":["3b629131-9a32-4374-b928-137aca4f2f30"],"befores":[],"afters":[],"start":1750414971559,"stop":1750414971740}

View File

@@ -1 +0,0 @@
{"uuid":"299732f9-e387-41ee-9f65-b7071c39dcc3","name":"FileNameFieldsTest","children":["1f78aaf3-6314-4839-8931-32fd25ee40a2"],"befores":[],"afters":[],"start":1750414575036,"stop":1750414575236}

View File

@@ -1 +0,0 @@
{"uuid":"3393d874-79c5-4b30-8098-6be0f22b98b8","name":"repositoryManagementMethodsArePreAuthorizedAnnotated()","children":["c7d19de8-5368-401c-9297-8c6c7bbf830e"],"befores":[],"afters":[],"start":1750415195491,"stop":1750415195674}

View File

@@ -1 +0,0 @@
{"uuid":"34038e21-ccba-4596-92af-8c1856ccc1e2","name":"FileNameFieldsTest","children":["5c548055-7762-4fcb-9795-5aaafe5329e2"],"befores":[],"afters":[],"start":1750414415618,"stop":1750414415801}

View File

@@ -1 +0,0 @@
{"uuid":"369f3516-266b-46ac-a730-c152c6afcf7a","name":"repositoryManagementMethodsArePreAuthorizedAnnotated()","children":["b3d07773-b904-4e05-9b16-bdd986547be7"],"befores":[],"afters":[],"start":1750415892802,"stop":1750415893121}

View File

@@ -1 +0,0 @@
{"uuid":"39f0b93a-754c-4948-8b59-056528a83d1c","name":"FileNameFieldsTest","children":["e82046fe-fd36-4dc0-981e-95e743b8d086"],"befores":[],"afters":[],"start":1750414349111,"stop":1750414349303}

View File

@@ -1 +0,0 @@
{"uuid":"3b629131-9a32-4374-b928-137aca4f2f30","historyId":"fa14928b1c8c4668de3f864412a0b0ca","testCaseId":"[engine:junit-jupiter]/[class:org.eclipse.hawkbit.repository.FileNameFieldsTest]/[method:repositoryManagementMethodsArePreAuthorizedAnnotated()]","testCaseName":"repositoryManagementMethodsArePreAuthorizedAnnotated()","fullName":"org.eclipse.hawkbit.repository.FileNameFieldsTest.repositoryManagementMethodsArePreAuthorizedAnnotated","labels":[{"name":"junit.platform.uniqueid","value":"[engine:junit-jupiter]/[class:org.eclipse.hawkbit.repository.FileNameFieldsTest]/[method:repositoryManagementMethodsArePreAuthorizedAnnotated()]"},{"name":"host","value":"SF3-C-000FP"},{"name":"thread","value":"27866@SF3-C-000FP.main(1)"},{"name":"framework","value":"junit-platform"},{"name":"language","value":"java"},{"name":"package","value":"org.eclipse.hawkbit.repository.FileNameFieldsTest"},{"name":"testClass","value":"org.eclipse.hawkbit.repository.FileNameFieldsTest"},{"name":"testMethod","value":"repositoryManagementMethodsArePreAuthorizedAnnotated"},{"name":"suite","value":"org.eclipse.hawkbit.repository.FileNameFieldsTest"}],"links":[],"name":"repositoryManagementMethodsArePreAuthorizedAnnotated()","status":"passed","stage":"finished","description":"Verifies that fields classes are correctly implemented","steps":[],"attachments":[],"parameters":[],"start":1750414971573,"stop":1750414971721}

View File

@@ -1 +0,0 @@
{"uuid":"3eb09005-eb9f-4349-916e-70229f574807","name":"FileNameFieldsTest","children":["3b629131-9a32-4374-b928-137aca4f2f30"],"befores":[],"afters":[],"start":1750414971551,"stop":1750414971746}

View File

@@ -1 +0,0 @@
{"uuid":"40fbbc60-c9f9-426f-8fc5-597b8d1eccbf","name":"FileNameFieldsTest","children":["43d8b58c-e102-4ac5-9971-edfe8accda95"],"befores":[],"afters":[],"start":1750415256621,"stop":1750415256932}

View File

@@ -1 +0,0 @@
{"uuid":"43d8b58c-e102-4ac5-9971-edfe8accda95","historyId":"fa14928b1c8c4668de3f864412a0b0ca","testCaseId":"[engine:junit-jupiter]/[class:org.eclipse.hawkbit.repository.FileNameFieldsTest]/[method:repositoryManagementMethodsArePreAuthorizedAnnotated()]","testCaseName":"repositoryManagementMethodsArePreAuthorizedAnnotated()","fullName":"org.eclipse.hawkbit.repository.FileNameFieldsTest.repositoryManagementMethodsArePreAuthorizedAnnotated","labels":[{"name":"junit.platform.uniqueid","value":"[engine:junit-jupiter]/[class:org.eclipse.hawkbit.repository.FileNameFieldsTest]/[method:repositoryManagementMethodsArePreAuthorizedAnnotated()]"},{"name":"host","value":"SF3-C-000FP"},{"name":"thread","value":"29124@SF3-C-000FP.main(1)"},{"name":"framework","value":"junit-platform"},{"name":"language","value":"java"},{"name":"package","value":"org.eclipse.hawkbit.repository.FileNameFieldsTest"},{"name":"testClass","value":"org.eclipse.hawkbit.repository.FileNameFieldsTest"},{"name":"testMethod","value":"repositoryManagementMethodsArePreAuthorizedAnnotated"},{"name":"suite","value":"org.eclipse.hawkbit.repository.FileNameFieldsTest"}],"links":[],"name":"repositoryManagementMethodsArePreAuthorizedAnnotated()","status":"passed","stage":"finished","description":"Verifies that fields classes are correctly implemented","steps":[],"attachments":[],"parameters":[],"start":1750415256641,"stop":1750415256888}

View File

@@ -1 +0,0 @@
{"uuid":"4b168869-3277-4726-ad64-e84bd2218c37","name":"FileNameFieldsTest","children":["81317a48-2ebf-44ec-a6ee-7e6d7024e1a2"],"befores":[],"afters":[],"start":1750414464506,"stop":1750414464697}

View File

@@ -1 +0,0 @@
{"uuid":"4d398a49-8f1e-4038-9342-a6270abf50f5","name":"repositoryManagementMethodsArePreAuthorizedAnnotated()","children":["5c548055-7762-4fcb-9795-5aaafe5329e2"],"befores":[],"afters":[],"start":1750414415626,"stop":1750414415795}

View File

@@ -1 +0,0 @@
{"uuid":"597ffb13-728c-4020-9afd-e776432afb0b","historyId":"fa14928b1c8c4668de3f864412a0b0ca","testCaseId":"[engine:junit-jupiter]/[class:org.eclipse.hawkbit.repository.FileNameFieldsTest]/[method:repositoryManagementMethodsArePreAuthorizedAnnotated()]","testCaseName":"repositoryManagementMethodsArePreAuthorizedAnnotated()","fullName":"org.eclipse.hawkbit.repository.FileNameFieldsTest.repositoryManagementMethodsArePreAuthorizedAnnotated","labels":[{"name":"junit.platform.uniqueid","value":"[engine:junit-jupiter]/[class:org.eclipse.hawkbit.repository.FileNameFieldsTest]/[method:repositoryManagementMethodsArePreAuthorizedAnnotated()]"},{"name":"host","value":"SF3-C-000FP"},{"name":"thread","value":"24408@SF3-C-000FP.main(1)"},{"name":"framework","value":"junit-platform"},{"name":"language","value":"java"},{"name":"package","value":"org.eclipse.hawkbit.repository.FileNameFieldsTest"},{"name":"testClass","value":"org.eclipse.hawkbit.repository.FileNameFieldsTest"},{"name":"testMethod","value":"repositoryManagementMethodsArePreAuthorizedAnnotated"},{"name":"suite","value":"org.eclipse.hawkbit.repository.FileNameFieldsTest"}],"links":[],"name":"repositoryManagementMethodsArePreAuthorizedAnnotated()","status":"passed","stage":"finished","description":"Verifies that fields classes are correctly implemented","steps":[],"attachments":[],"parameters":[],"start":1750414146373,"stop":1750414146533}

View File

@@ -1 +0,0 @@
{"uuid":"5b69aea3-f8ca-4017-8db8-f93cec3bab1a","name":"FileNameFieldsTest","children":["c7d19de8-5368-401c-9297-8c6c7bbf830e"],"befores":[],"afters":[],"start":1750415195482,"stop":1750415195679}

View File

@@ -1 +0,0 @@
{"uuid":"5c548055-7762-4fcb-9795-5aaafe5329e2","historyId":"fa14928b1c8c4668de3f864412a0b0ca","testCaseId":"[engine:junit-jupiter]/[class:org.eclipse.hawkbit.repository.FileNameFieldsTest]/[method:repositoryManagementMethodsArePreAuthorizedAnnotated()]","testCaseName":"repositoryManagementMethodsArePreAuthorizedAnnotated()","fullName":"org.eclipse.hawkbit.repository.FileNameFieldsTest.repositoryManagementMethodsArePreAuthorizedAnnotated","labels":[{"name":"junit.platform.uniqueid","value":"[engine:junit-jupiter]/[class:org.eclipse.hawkbit.repository.FileNameFieldsTest]/[method:repositoryManagementMethodsArePreAuthorizedAnnotated()]"},{"name":"host","value":"SF3-C-000FP"},{"name":"thread","value":"25467@SF3-C-000FP.main(1)"},{"name":"framework","value":"junit-platform"},{"name":"language","value":"java"},{"name":"package","value":"org.eclipse.hawkbit.repository.FileNameFieldsTest"},{"name":"testClass","value":"org.eclipse.hawkbit.repository.FileNameFieldsTest"},{"name":"testMethod","value":"repositoryManagementMethodsArePreAuthorizedAnnotated"},{"name":"suite","value":"org.eclipse.hawkbit.repository.FileNameFieldsTest"}],"links":[],"name":"repositoryManagementMethodsArePreAuthorizedAnnotated()","status":"passed","stage":"finished","description":"Verifies that fields classes are correctly implemented","steps":[],"attachments":[],"parameters":[],"start":1750414415639,"stop":1750414415776}

View File

@@ -1 +0,0 @@
{"uuid":"68e6b06c-dfd1-48bf-b383-f83cffa9411e","name":"repositoryManagementMethodsArePreAuthorizedAnnotated()","children":["81317a48-2ebf-44ec-a6ee-7e6d7024e1a2"],"befores":[],"afters":[],"start":1750414464515,"stop":1750414464691}

View File

@@ -1 +0,0 @@
{"uuid":"74aad84d-bfdd-4c01-aa36-f68b1c09a2fd","name":"repositoryManagementMethodsArePreAuthorizedAnnotated()","children":["1f78aaf3-6314-4839-8931-32fd25ee40a2"],"befores":[],"afters":[],"start":1750414575045,"stop":1750414575231}

View File

@@ -1 +0,0 @@
{"uuid":"81317a48-2ebf-44ec-a6ee-7e6d7024e1a2","historyId":"fa14928b1c8c4668de3f864412a0b0ca","testCaseId":"[engine:junit-jupiter]/[class:org.eclipse.hawkbit.repository.FileNameFieldsTest]/[method:repositoryManagementMethodsArePreAuthorizedAnnotated()]","testCaseName":"repositoryManagementMethodsArePreAuthorizedAnnotated()","fullName":"org.eclipse.hawkbit.repository.FileNameFieldsTest.repositoryManagementMethodsArePreAuthorizedAnnotated","labels":[{"name":"junit.platform.uniqueid","value":"[engine:junit-jupiter]/[class:org.eclipse.hawkbit.repository.FileNameFieldsTest]/[method:repositoryManagementMethodsArePreAuthorizedAnnotated()]"},{"name":"host","value":"SF3-C-000FP"},{"name":"thread","value":"25725@SF3-C-000FP.main(1)"},{"name":"framework","value":"junit-platform"},{"name":"language","value":"java"},{"name":"package","value":"org.eclipse.hawkbit.repository.FileNameFieldsTest"},{"name":"testClass","value":"org.eclipse.hawkbit.repository.FileNameFieldsTest"},{"name":"testMethod","value":"repositoryManagementMethodsArePreAuthorizedAnnotated"},{"name":"suite","value":"org.eclipse.hawkbit.repository.FileNameFieldsTest"}],"links":[],"name":"repositoryManagementMethodsArePreAuthorizedAnnotated()","status":"passed","stage":"finished","description":"Verifies that fields classes are correctly implemented","steps":[],"attachments":[],"parameters":[],"start":1750414464529,"stop":1750414464672}

View File

@@ -1 +0,0 @@
{"uuid":"85b10456-f9c4-476e-940e-1a4d6ae96684","name":"repositoryManagementMethodsArePreAuthorizedAnnotated()","children":["597ffb13-728c-4020-9afd-e776432afb0b"],"befores":[],"afters":[],"start":1750414146356,"stop":1750414146552}

View File

@@ -1 +0,0 @@
{"uuid":"8ca7e456-37f2-4cae-a692-ccdda74fb1d1","name":"repositoryManagementMethodsArePreAuthorizedAnnotated()","children":["bdfb9b69-24d2-4eff-ba3c-1ef30b0519fd"],"befores":[],"afters":[],"start":1750414723338,"stop":1750414723502}

View File

@@ -1 +0,0 @@
{"uuid":"913eecd1-1800-4cd4-9c59-5094f1221293","historyId":"fa14928b1c8c4668de3f864412a0b0ca","testCaseId":"[engine:junit-jupiter]/[class:org.eclipse.hawkbit.repository.FileNameFieldsTest]/[method:repositoryManagementMethodsArePreAuthorizedAnnotated()]","testCaseName":"repositoryManagementMethodsArePreAuthorizedAnnotated()","fullName":"org.eclipse.hawkbit.repository.FileNameFieldsTest.repositoryManagementMethodsArePreAuthorizedAnnotated","labels":[{"name":"junit.platform.uniqueid","value":"[engine:junit-jupiter]/[class:org.eclipse.hawkbit.repository.FileNameFieldsTest]/[method:repositoryManagementMethodsArePreAuthorizedAnnotated()]"},{"name":"host","value":"SF3-C-000FP"},{"name":"thread","value":"23930@SF3-C-000FP.main(1)"},{"name":"framework","value":"junit-platform"},{"name":"language","value":"java"},{"name":"package","value":"org.eclipse.hawkbit.repository.FileNameFieldsTest"},{"name":"testClass","value":"org.eclipse.hawkbit.repository.FileNameFieldsTest"},{"name":"testMethod","value":"repositoryManagementMethodsArePreAuthorizedAnnotated"},{"name":"suite","value":"org.eclipse.hawkbit.repository.FileNameFieldsTest"}],"links":[],"name":"repositoryManagementMethodsArePreAuthorizedAnnotated()","status":"passed","stage":"finished","description":"Verifies that fields classes are correctly implemented","steps":[],"attachments":[],"parameters":[],"start":1750414016543,"stop":1750414016696}

View File

@@ -1 +0,0 @@
{"uuid":"92653284-976b-412e-a112-7e96c3901dee","name":"repositoryManagementMethodsArePreAuthorizedAnnotated()","children":["9829198c-640d-4164-9557-cad7ac0832da"],"befores":[],"afters":[],"start":1750415144356,"stop":1750415144551}

View File

@@ -1 +0,0 @@
{"uuid":"93fedcb9-ba6d-4b94-bb29-0e219c3f8604","name":"FileNameFieldsTest","children":["f8b39d47-6a59-4f21-a52c-7c190cb1dfab"],"befores":[],"afters":[],"start":1750414804626,"stop":1750414804826}

View File

@@ -1 +0,0 @@
{"uuid":"9829198c-640d-4164-9557-cad7ac0832da","historyId":"fa14928b1c8c4668de3f864412a0b0ca","testCaseId":"[engine:junit-jupiter]/[class:org.eclipse.hawkbit.repository.FileNameFieldsTest]/[method:repositoryManagementMethodsArePreAuthorizedAnnotated()]","testCaseName":"repositoryManagementMethodsArePreAuthorizedAnnotated()","fullName":"org.eclipse.hawkbit.repository.FileNameFieldsTest.repositoryManagementMethodsArePreAuthorizedAnnotated","labels":[{"name":"junit.platform.uniqueid","value":"[engine:junit-jupiter]/[class:org.eclipse.hawkbit.repository.FileNameFieldsTest]/[method:repositoryManagementMethodsArePreAuthorizedAnnotated()]"},{"name":"host","value":"SF3-C-000FP"},{"name":"thread","value":"28593@SF3-C-000FP.main(1)"},{"name":"framework","value":"junit-platform"},{"name":"language","value":"java"},{"name":"package","value":"org.eclipse.hawkbit.repository.FileNameFieldsTest"},{"name":"testClass","value":"org.eclipse.hawkbit.repository.FileNameFieldsTest"},{"name":"testMethod","value":"repositoryManagementMethodsArePreAuthorizedAnnotated"},{"name":"suite","value":"org.eclipse.hawkbit.repository.FileNameFieldsTest"}],"links":[],"name":"repositoryManagementMethodsArePreAuthorizedAnnotated()","status":"passed","stage":"finished","description":"Verifies that fields classes are correctly implemented","steps":[],"attachments":[],"parameters":[],"start":1750415144374,"stop":1750415144530}

View File

@@ -1 +0,0 @@
{"uuid":"b3d07773-b904-4e05-9b16-bdd986547be7","historyId":"fa14928b1c8c4668de3f864412a0b0ca","testCaseId":"[engine:junit-jupiter]/[class:org.eclipse.hawkbit.repository.FileNameFieldsTest]/[method:repositoryManagementMethodsArePreAuthorizedAnnotated()]","testCaseName":"repositoryManagementMethodsArePreAuthorizedAnnotated()","fullName":"org.eclipse.hawkbit.repository.FileNameFieldsTest.repositoryManagementMethodsArePreAuthorizedAnnotated","labels":[{"name":"junit.platform.uniqueid","value":"[engine:junit-jupiter]/[class:org.eclipse.hawkbit.repository.FileNameFieldsTest]/[method:repositoryManagementMethodsArePreAuthorizedAnnotated()]"},{"name":"host","value":"SF3-C-000FP"},{"name":"thread","value":"31615@SF3-C-000FP.main(1)"},{"name":"framework","value":"junit-platform"},{"name":"language","value":"java"},{"name":"package","value":"org.eclipse.hawkbit.repository.FileNameFieldsTest"},{"name":"testClass","value":"org.eclipse.hawkbit.repository.FileNameFieldsTest"},{"name":"testMethod","value":"repositoryManagementMethodsArePreAuthorizedAnnotated"},{"name":"suite","value":"org.eclipse.hawkbit.repository.FileNameFieldsTest"}],"links":[],"name":"repositoryManagementMethodsArePreAuthorizedAnnotated()","status":"passed","stage":"finished","description":"Verifies that fields classes are correctly implemented","steps":[],"attachments":[],"parameters":[],"start":1750415892813,"stop":1750415893086}

View File

@@ -1 +0,0 @@
{"uuid":"bbcef88f-a5d4-44a4-bbb0-71bbf92f66f5","name":"FileNameFieldsTest","children":["9829198c-640d-4164-9557-cad7ac0832da"],"befores":[],"afters":[],"start":1750415144348,"stop":1750415144557}

View File

@@ -1 +0,0 @@
{"uuid":"bd35f9eb-0abf-4693-a4ab-89a4ef475c03","name":"FileNameFieldsTest","children":["913eecd1-1800-4cd4-9c59-5094f1221293"],"befores":[],"afters":[],"start":1750414016518,"stop":1750414016723}

View File

@@ -1 +0,0 @@
{"uuid":"bdfb9b69-24d2-4eff-ba3c-1ef30b0519fd","historyId":"fa14928b1c8c4668de3f864412a0b0ca","testCaseId":"[engine:junit-jupiter]/[class:org.eclipse.hawkbit.repository.FileNameFieldsTest]/[method:repositoryManagementMethodsArePreAuthorizedAnnotated()]","testCaseName":"repositoryManagementMethodsArePreAuthorizedAnnotated()","fullName":"org.eclipse.hawkbit.repository.FileNameFieldsTest.repositoryManagementMethodsArePreAuthorizedAnnotated","labels":[{"name":"junit.platform.uniqueid","value":"[engine:junit-jupiter]/[class:org.eclipse.hawkbit.repository.FileNameFieldsTest]/[method:repositoryManagementMethodsArePreAuthorizedAnnotated()]"},{"name":"host","value":"SF3-C-000FP"},{"name":"thread","value":"26751@SF3-C-000FP.main(1)"},{"name":"framework","value":"junit-platform"},{"name":"language","value":"java"},{"name":"package","value":"org.eclipse.hawkbit.repository.FileNameFieldsTest"},{"name":"testClass","value":"org.eclipse.hawkbit.repository.FileNameFieldsTest"},{"name":"testMethod","value":"repositoryManagementMethodsArePreAuthorizedAnnotated"},{"name":"suite","value":"org.eclipse.hawkbit.repository.FileNameFieldsTest"}],"links":[],"name":"repositoryManagementMethodsArePreAuthorizedAnnotated()","status":"passed","stage":"finished","description":"Verifies that fields classes are correctly implemented","steps":[],"attachments":[],"parameters":[],"start":1750414723352,"stop":1750414723483}

View File

@@ -1 +0,0 @@
{"uuid":"c54916fe-169c-435f-9751-0ff0c0c3ede7","name":"FileNameFieldsTest","children":["b3d07773-b904-4e05-9b16-bdd986547be7"],"befores":[],"afters":[],"start":1750415892794,"stop":1750415893127}

View File

@@ -1 +0,0 @@
{"uuid":"c7d19de8-5368-401c-9297-8c6c7bbf830e","historyId":"fa14928b1c8c4668de3f864412a0b0ca","testCaseId":"[engine:junit-jupiter]/[class:org.eclipse.hawkbit.repository.FileNameFieldsTest]/[method:repositoryManagementMethodsArePreAuthorizedAnnotated()]","testCaseName":"repositoryManagementMethodsArePreAuthorizedAnnotated()","fullName":"org.eclipse.hawkbit.repository.FileNameFieldsTest.repositoryManagementMethodsArePreAuthorizedAnnotated","labels":[{"name":"junit.platform.uniqueid","value":"[engine:junit-jupiter]/[class:org.eclipse.hawkbit.repository.FileNameFieldsTest]/[method:repositoryManagementMethodsArePreAuthorizedAnnotated()]"},{"name":"host","value":"SF3-C-000FP"},{"name":"thread","value":"28828@SF3-C-000FP.main(1)"},{"name":"framework","value":"junit-platform"},{"name":"language","value":"java"},{"name":"package","value":"org.eclipse.hawkbit.repository.FileNameFieldsTest"},{"name":"testClass","value":"org.eclipse.hawkbit.repository.FileNameFieldsTest"},{"name":"testMethod","value":"repositoryManagementMethodsArePreAuthorizedAnnotated"},{"name":"suite","value":"org.eclipse.hawkbit.repository.FileNameFieldsTest"}],"links":[],"name":"repositoryManagementMethodsArePreAuthorizedAnnotated()","status":"passed","stage":"finished","description":"Verifies that fields classes are correctly implemented","steps":[],"attachments":[],"parameters":[],"start":1750415195507,"stop":1750415195655}

View File

@@ -1 +0,0 @@
{"uuid":"cabd9766-d959-4d7d-bb53-541eea388c17","name":"repositoryManagementMethodsArePreAuthorizedAnnotated()","children":["e6bd41bd-a706-441a-ada6-e8d141013858"],"befores":[],"afters":[],"start":1750414269854,"stop":1750414270063}

View File

@@ -1 +0,0 @@
{"uuid":"d701f914-7aff-400e-8230-a00f1339827c","historyId":"fa14928b1c8c4668de3f864412a0b0ca","testCaseId":"[engine:junit-jupiter]/[class:org.eclipse.hawkbit.repository.FileNameFieldsTest]/[method:repositoryManagementMethodsArePreAuthorizedAnnotated()]","testCaseName":"repositoryManagementMethodsArePreAuthorizedAnnotated()","fullName":"org.eclipse.hawkbit.repository.FileNameFieldsTest.repositoryManagementMethodsArePreAuthorizedAnnotated","labels":[{"name":"junit.platform.uniqueid","value":"[engine:junit-jupiter]/[class:org.eclipse.hawkbit.repository.FileNameFieldsTest]/[method:repositoryManagementMethodsArePreAuthorizedAnnotated()]"},{"name":"host","value":"SF3-C-000FP"},{"name":"thread","value":"28442@SF3-C-000FP.main(1)"},{"name":"framework","value":"junit-platform"},{"name":"language","value":"java"},{"name":"package","value":"org.eclipse.hawkbit.repository.FileNameFieldsTest"},{"name":"testClass","value":"org.eclipse.hawkbit.repository.FileNameFieldsTest"},{"name":"testMethod","value":"repositoryManagementMethodsArePreAuthorizedAnnotated"},{"name":"suite","value":"org.eclipse.hawkbit.repository.FileNameFieldsTest"}],"links":[],"name":"repositoryManagementMethodsArePreAuthorizedAnnotated()","status":"passed","stage":"finished","description":"Verifies that fields classes are correctly implemented","steps":[],"attachments":[],"parameters":[],"start":1750415118850,"stop":1750415119008}

View File

@@ -1 +0,0 @@
{"uuid":"e0062d7c-0b58-485e-a615-1caa49d50682","name":"FileNameFieldsTest","children":["e6bd41bd-a706-441a-ada6-e8d141013858"],"befores":[],"afters":[],"start":1750414269846,"stop":1750414270068}

View File

@@ -1 +0,0 @@
{"uuid":"e6bd41bd-a706-441a-ada6-e8d141013858","historyId":"fa14928b1c8c4668de3f864412a0b0ca","testCaseId":"[engine:junit-jupiter]/[class:org.eclipse.hawkbit.repository.FileNameFieldsTest]/[method:repositoryManagementMethodsArePreAuthorizedAnnotated()]","testCaseName":"repositoryManagementMethodsArePreAuthorizedAnnotated()","fullName":"org.eclipse.hawkbit.repository.FileNameFieldsTest.repositoryManagementMethodsArePreAuthorizedAnnotated","labels":[{"name":"junit.platform.uniqueid","value":"[engine:junit-jupiter]/[class:org.eclipse.hawkbit.repository.FileNameFieldsTest]/[method:repositoryManagementMethodsArePreAuthorizedAnnotated()]"},{"name":"host","value":"SF3-C-000FP"},{"name":"thread","value":"24854@SF3-C-000FP.main(1)"},{"name":"framework","value":"junit-platform"},{"name":"language","value":"java"},{"name":"package","value":"org.eclipse.hawkbit.repository.FileNameFieldsTest"},{"name":"testClass","value":"org.eclipse.hawkbit.repository.FileNameFieldsTest"},{"name":"testMethod","value":"repositoryManagementMethodsArePreAuthorizedAnnotated"},{"name":"suite","value":"org.eclipse.hawkbit.repository.FileNameFieldsTest"}],"links":[],"name":"repositoryManagementMethodsArePreAuthorizedAnnotated()","status":"passed","stage":"finished","description":"Verifies that fields classes are correctly implemented","steps":[],"attachments":[],"parameters":[],"start":1750414269868,"stop":1750414270043}

View File

@@ -1 +0,0 @@
{"uuid":"e82046fe-fd36-4dc0-981e-95e743b8d086","historyId":"fa14928b1c8c4668de3f864412a0b0ca","testCaseId":"[engine:junit-jupiter]/[class:org.eclipse.hawkbit.repository.FileNameFieldsTest]/[method:repositoryManagementMethodsArePreAuthorizedAnnotated()]","testCaseName":"repositoryManagementMethodsArePreAuthorizedAnnotated()","fullName":"org.eclipse.hawkbit.repository.FileNameFieldsTest.repositoryManagementMethodsArePreAuthorizedAnnotated","labels":[{"name":"junit.platform.uniqueid","value":"[engine:junit-jupiter]/[class:org.eclipse.hawkbit.repository.FileNameFieldsTest]/[method:repositoryManagementMethodsArePreAuthorizedAnnotated()]"},{"name":"host","value":"SF3-C-000FP"},{"name":"thread","value":"25177@SF3-C-000FP.main(1)"},{"name":"framework","value":"junit-platform"},{"name":"language","value":"java"},{"name":"package","value":"org.eclipse.hawkbit.repository.FileNameFieldsTest"},{"name":"testClass","value":"org.eclipse.hawkbit.repository.FileNameFieldsTest"},{"name":"testMethod","value":"repositoryManagementMethodsArePreAuthorizedAnnotated"},{"name":"suite","value":"org.eclipse.hawkbit.repository.FileNameFieldsTest"}],"links":[],"name":"repositoryManagementMethodsArePreAuthorizedAnnotated()","status":"passed","stage":"finished","description":"Verifies that fields classes are correctly implemented","steps":[],"attachments":[],"parameters":[],"start":1750414349135,"stop":1750414349278}

View File

@@ -1 +0,0 @@
{"uuid":"ef752c83-c849-43f8-88f6-98fec388c199","name":"repositoryManagementMethodsArePreAuthorizedAnnotated()","children":["f8b39d47-6a59-4f21-a52c-7c190cb1dfab"],"befores":[],"afters":[],"start":1750414804633,"stop":1750414804821}

View File

@@ -1 +0,0 @@
{"uuid":"f8b39d47-6a59-4f21-a52c-7c190cb1dfab","historyId":"fa14928b1c8c4668de3f864412a0b0ca","testCaseId":"[engine:junit-jupiter]/[class:org.eclipse.hawkbit.repository.FileNameFieldsTest]/[method:repositoryManagementMethodsArePreAuthorizedAnnotated()]","testCaseName":"repositoryManagementMethodsArePreAuthorizedAnnotated()","fullName":"org.eclipse.hawkbit.repository.FileNameFieldsTest.repositoryManagementMethodsArePreAuthorizedAnnotated","labels":[{"name":"junit.platform.uniqueid","value":"[engine:junit-jupiter]/[class:org.eclipse.hawkbit.repository.FileNameFieldsTest]/[method:repositoryManagementMethodsArePreAuthorizedAnnotated()]"},{"name":"host","value":"SF3-C-000FP"},{"name":"thread","value":"27237@SF3-C-000FP.main(1)"},{"name":"framework","value":"junit-platform"},{"name":"language","value":"java"},{"name":"package","value":"org.eclipse.hawkbit.repository.FileNameFieldsTest"},{"name":"testClass","value":"org.eclipse.hawkbit.repository.FileNameFieldsTest"},{"name":"testMethod","value":"repositoryManagementMethodsArePreAuthorizedAnnotated"},{"name":"suite","value":"org.eclipse.hawkbit.repository.FileNameFieldsTest"}],"links":[],"name":"repositoryManagementMethodsArePreAuthorizedAnnotated()","status":"passed","stage":"finished","description":"Verifies that fields classes are correctly implemented","steps":[],"attachments":[],"parameters":[],"start":1750414804649,"stop":1750414804801}

View File

@@ -1 +0,0 @@
{"uuid":"fe17f3a0-aa11-4f29-97a0-423d009e546d","name":"repositoryManagementMethodsArePreAuthorizedAnnotated()","children":["d701f914-7aff-400e-8230-a00f1339827c"],"befores":[],"afters":[],"start":1750415118833,"stop":1750415119030}

View File

@@ -16,14 +16,14 @@ import java.util.List;
import io.github.classgraph.ClassGraph;
import io.github.classgraph.ClassInfo;
import io.github.classgraph.ScanResult;
import io.qameta.allure.Description;
import org.junit.jupiter.api.Test;
class FileNameFieldsTest {
@Test
@Description("Verifies that fields classes are correctly implemented")
@SuppressWarnings("unchecked")
/**
* Verifies that fields classes are correctly implemented
*/
@Test @SuppressWarnings("unchecked")
void repositoryManagementMethodsArePreAuthorizedAnnotated() {
final String packageName = getClass().getPackage().getName();
try (final ScanResult scanResult = new ClassGraph().acceptPackages(packageName).scan()) {

View File

@@ -19,23 +19,22 @@ import java.util.Collections;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.exc.MismatchedInputException;
import io.qameta.allure.Description;
import io.qameta.allure.Feature;
import io.qameta.allure.Story;
import org.junit.jupiter.api.Test;
/**
* Test serialization of DDI api model 'DdiActionFeedback'
* <p/>
* Feature: Unit Tests - Direct Device Integration API<br/>
* Story: Serialization of DDI api Models
*/
@Feature("Unit Tests - Direct Device Integration API")
@Story("Serialization of DDI api Models")
class DdiActionFeedbackTest {
private final ObjectMapper mapper = new ObjectMapper();
@Test
@Description("Verify the correct serialization and deserialization of the model with minimal payload")
void shouldSerializeAndDeserializeObjectWithoutOptionalValues() throws IOException {
/**
* Verify the correct serialization and deserialization of the model with minimal payload
*/
@Test void shouldSerializeAndDeserializeObjectWithoutOptionalValues() throws IOException {
// Setup
final DdiStatus ddiStatus = new DdiStatus(DdiStatus.ExecutionStatus.CLOSED, null, null, Collections.emptyList());
final DdiActionFeedback ddiActionFeedback = new DdiActionFeedback(ddiStatus);
@@ -48,9 +47,10 @@ class DdiActionFeedbackTest {
assertThat(deserializedDdiActionFeedback.getStatus()).hasToString(ddiStatus.toString());
}
@Test
@Description("Verify the correct serialization and deserialization of the model with all values provided")
void shouldSerializeAndDeserializeObjectWithOptionalValues() throws IOException {
/**
* Verify the correct serialization and deserialization of the model with all values provided
*/
@Test void shouldSerializeAndDeserializeObjectWithOptionalValues() throws IOException {
// Setup
final Long timestamp = System.currentTimeMillis();
final DdiResult ddiResult = new DdiResult(DdiResult.FinalResult.SUCCESS, new DdiProgress(10, 10));
@@ -65,9 +65,10 @@ class DdiActionFeedbackTest {
assertThat(deserializedDdiActionFeedback.getStatus()).hasToString(ddiStatus.toString());
}
@Test
@Description("Verify that deserialization fails for known properties with a wrong datatype")
void shouldFailForObjectWithWrongDataTypes() {
/**
* Verify that deserialization fails for known properties with a wrong datatype
*/
@Test void shouldFailForObjectWithWrongDataTypes() {
// Setup
final String serializedDdiActionFeedback = """
{
@@ -83,9 +84,10 @@ class DdiActionFeedbackTest {
() -> mapper.readValue(serializedDdiActionFeedback, DdiActionFeedback.class));
}
@Test
@Description("Verify that deserialization works if optional fields are not parsed")
void shouldConvertItWithoutOptionalFieldTimestamp() throws JsonProcessingException {
/**
* Verify that deserialization works if optional fields are not parsed
*/
@Test void shouldConvertItWithoutOptionalFieldTimestamp() throws JsonProcessingException {
// Setup
final String serializedDdiActionFeedback = """
{

View File

@@ -19,23 +19,22 @@ import java.util.List;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.exc.MismatchedInputException;
import io.qameta.allure.Description;
import io.qameta.allure.Feature;
import io.qameta.allure.Story;
import org.junit.jupiter.api.Test;
/**
* Test serializability of DDI api model 'DdiActionHistory'
* <p/>
* Feature: Unit Tests - Direct Device Integration API<br/>
* Story: Serializability of DDI api Models
*/
@Feature("Unit Tests - Direct Device Integration API")
@Story("Serializability of DDI api Models")
class DdiActionHistoryTest {
private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
@Test
@Description("Verify the correct serialization and deserialization of the model")
void shouldSerializeAndDeserializeObject() throws IOException {
/**
* Verify the correct serialization and deserialization of the model
*/
@Test void shouldSerializeAndDeserializeObject() throws IOException {
// Setup
final String actionStatus = "TestAction";
final List<String> messages = Arrays.asList("Action status message 1", "Action status message 2");
@@ -48,9 +47,10 @@ class DdiActionHistoryTest {
assertThat(deserializedDdiActionHistory.toString()).contains(actionStatus, messages.get(0), messages.get(1));
}
@Test
@Description("Verify the correct deserialization of a model with a additional unknown property")
void shouldDeserializeObjectWithUnknownProperty() throws IOException {
/**
* Verify the correct deserialization of a model with a additional unknown property
*/
@Test void shouldDeserializeObjectWithUnknownProperty() throws IOException {
// Setup
final String serializedDdiActionHistory = """
{
@@ -64,9 +64,10 @@ class DdiActionHistoryTest {
assertThat(ddiActionHistory.toString()).contains("SomeAction", "Some message");
}
@Test
@Description("Verify that deserialization fails for known properties with a wrong datatype")
void shouldFailForObjectWithWrongDataTypes() {
/**
* Verify that deserialization fails for known properties with a wrong datatype
*/
@Test void shouldFailForObjectWithWrongDataTypes() {
// Setup
final String serializedDdiActionFeedback = """
{

View File

@@ -17,23 +17,22 @@ import java.io.IOException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.exc.MismatchedInputException;
import io.qameta.allure.Description;
import io.qameta.allure.Feature;
import io.qameta.allure.Story;
import org.junit.jupiter.api.Test;
/**
* Test serializability of DDI api model 'DdiArtifactHash'
* <p/>
* Feature: Unit Tests - Direct Device Integration API<br/>
* Story: Serializability of DDI api Models
*/
@Feature("Unit Tests - Direct Device Integration API")
@Story("Serializability of DDI api Models")
class DdiArtifactHashTest {
private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
@Test
@Description("Verify the correct serialization and deserialization of the model")
void shouldSerializeAndDeserializeObject() throws IOException {
/**
* Verify the correct serialization and deserialization of the model
*/
@Test void shouldSerializeAndDeserializeObject() throws IOException {
// Setup
final String sha1Hash = "11111";
final String md5Hash = "22222";
@@ -49,9 +48,10 @@ class DdiArtifactHashTest {
assertThat(deserializedDdiArtifact.getSha256()).isEqualTo(sha256Hash);
}
@Test
@Description("Verify the correct deserialization of a model with a additional unknown property")
void shouldDeserializeObjectWithUnknownProperty() throws IOException {
/**
* Verify the correct deserialization of a model with a additional unknown property
*/
@Test void shouldDeserializeObjectWithUnknownProperty() throws IOException {
// Setup
final String serializedDdiArtifact = "{\"sha1\": \"123\", \"md5\": \"456\", \"sha256\": \"789\", \"unknownProperty\": \"test\"}";
@@ -62,9 +62,10 @@ class DdiArtifactHashTest {
assertThat(ddiArtifact.getSha256()).isEqualTo("789");
}
@Test
@Description("Verify that deserialization fails for known properties with a wrong datatype")
void shouldFailForObjectWithWrongDataTypes() {
/**
* Verify that deserialization fails for known properties with a wrong datatype
*/
@Test void shouldFailForObjectWithWrongDataTypes() {
// Setup
final String serializedDdiArtifact = "{\"sha1\": [123], \"md5\": 456, \"sha256\": \"789\"";

View File

@@ -17,23 +17,22 @@ import java.io.IOException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.exc.MismatchedInputException;
import io.qameta.allure.Description;
import io.qameta.allure.Feature;
import io.qameta.allure.Story;
import org.junit.jupiter.api.Test;
/**
* Test serializability of DDI api model 'DdiArtifact'
* <p/>
* Feature: Unit Tests - Direct Device Integration API<br/>
* Story: Serializability of DDI api Models
*/
@Feature("Unit Tests - Direct Device Integration API")
@Story("Serializability of DDI api Models")
class DdiArtifactTest {
private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
@Test
@Description("Verify the correct serialization and deserialization of the model")
void shouldSerializeAndDeserializeObject() throws IOException {
/**
* Verify the correct serialization and deserialization of the model
*/
@Test void shouldSerializeAndDeserializeObject() throws IOException {
// Setup
final String filename = "testfile.txt";
final DdiArtifactHash hashes = new DdiArtifactHash("123", "456", "789");
@@ -52,9 +51,10 @@ class DdiArtifactTest {
assertThat(deserializedDdiArtifact.getHashes().getSha256()).isEqualTo(hashes.getSha256());
}
@Test
@Description("Verify the correct deserialization of a model with a additional unknown property")
void shouldDeserializeObjectWithUnknownProperty() throws IOException {
/**
* Verify the correct deserialization of a model with a additional unknown property
*/
@Test void shouldDeserializeObjectWithUnknownProperty() throws IOException {
// Setup
final String serializedDdiArtifact = "{\"filename\":\"test.file\",\"hashes\":{\"sha1\":\"123\",\"md5\":\"456\",\"sha256\":\"789\"},\"size\":111,\"links\":[],\"unknownProperty\": \"test\"}";
@@ -67,9 +67,10 @@ class DdiArtifactTest {
assertThat(ddiArtifact.getHashes().getSha256()).isEqualTo("789");
}
@Test
@Description("Verify that deserialization fails for known properties with a wrong datatype")
void shouldFailForObjectWithWrongDataTypes() {
/**
* Verify that deserialization fails for known properties with a wrong datatype
*/
@Test void shouldFailForObjectWithWrongDataTypes() {
// Setup
final String serializedDdiArtifact = "{\"filename\": [\"test.file\"],\"hashes\":{\"sha1\":\"123\",\"md5\":\"456\",\"sha256\":\"789\"},\"size\":111,\"links\":[]}";

View File

@@ -17,23 +17,22 @@ import java.io.IOException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.exc.MismatchedInputException;
import io.qameta.allure.Description;
import io.qameta.allure.Feature;
import io.qameta.allure.Story;
import org.junit.jupiter.api.Test;
/**
* Test serializability of DDI api model 'DdiCancelActionToStop'
* <p/>
* Feature: Unit Tests - Direct Device Integration API<br/>
* Story: Serializability of DDI api Models
*/
@Feature("Unit Tests - Direct Device Integration API")
@Story("Serializability of DDI api Models")
class DdiCancelActionToStopTest {
private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
@Test
@Description("Verify the correct serialization and deserialization of the model")
void shouldSerializeAndDeserializeObject() throws IOException {
/**
* Verify the correct serialization and deserialization of the model
*/
@Test void shouldSerializeAndDeserializeObject() throws IOException {
// Setup
final String stopId = "1234";
final DdiCancelActionToStop ddiCancelActionToStop = new DdiCancelActionToStop(stopId);
@@ -46,9 +45,10 @@ class DdiCancelActionToStopTest {
assertThat(deserializedDdiCancelActionToStop.getStopId()).isEqualTo(stopId);
}
@Test
@Description("Verify the correct deserialization of a model with a additional unknown property")
void shouldDeserializeObjectWithUnknownProperty() throws IOException {
/**
* Verify the correct deserialization of a model with a additional unknown property
*/
@Test void shouldDeserializeObjectWithUnknownProperty() throws IOException {
// Setup
final String serializedDdiCancelActionToStop = "{\"stopId\":\"12345\",\"unknownProperty\":\"test\"}";
@@ -58,9 +58,10 @@ class DdiCancelActionToStopTest {
assertThat(ddiCancelActionToStop.getStopId()).contains("12345");
}
@Test
@Description("Verify that deserialization fails for known properties with a wrong datatype")
void shouldFailForObjectWithWrongDataTypes() {
/**
* Verify that deserialization fails for known properties with a wrong datatype
*/
@Test void shouldFailForObjectWithWrongDataTypes() {
// Setup
final String serializedDdiCancelActionToStop = "{\"stopId\": [\"12345\"]}";

View File

@@ -17,23 +17,22 @@ import java.io.IOException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.exc.MismatchedInputException;
import io.qameta.allure.Description;
import io.qameta.allure.Feature;
import io.qameta.allure.Story;
import org.junit.jupiter.api.Test;
/**
* Test serializability of DDI api model 'DdiArtifact'
* <p/>
* Feature: Unit Tests - Direct Device Integration API<br/>
* Story: Serializability of DDI api Models
*/
@Feature("Unit Tests - Direct Device Integration API")
@Story("Serializability of DDI api Models")
class DdiCancelTest {
private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
@Test
@Description("Verify the correct serialization and deserialization of the model")
void shouldSerializeAndDeserializeObject() throws IOException {
/**
* Verify the correct serialization and deserialization of the model
*/
@Test void shouldSerializeAndDeserializeObject() throws IOException {
// Setup
final String ddiCancelId = "1234";
final DdiCancelActionToStop ddiCancelActionToStop = new DdiCancelActionToStop("1234");
@@ -47,9 +46,10 @@ class DdiCancelTest {
assertThat(deserializedDdiCancel.getCancelAction().getStopId()).isEqualTo(ddiCancelActionToStop.getStopId());
}
@Test
@Description("Verify the correct deserialization of a model with a additional unknown property")
void shouldDeserializeObjectWithUnknownProperty() throws IOException {
/**
* Verify the correct deserialization of a model with a additional unknown property
*/
@Test void shouldDeserializeObjectWithUnknownProperty() throws IOException {
// Setup
final String serializedDdiCancel = "{\"id\":\"1234\",\"cancelAction\":{\"stopId\":\"1234\"}, \"unknownProperty\": \"test\"}";
@@ -59,9 +59,10 @@ class DdiCancelTest {
assertThat(ddiCancel.getCancelAction().getStopId()).matches("1234");
}
@Test
@Description("Verify that deserialization fails for known properties with a wrong datatype")
void shouldFailForObjectWithWrongDataTypes() {
/**
* Verify that deserialization fails for known properties with a wrong datatype
*/
@Test void shouldFailForObjectWithWrongDataTypes() {
// Setup
final String serializedDdiCancel = "{\"id\":[\"1234\"],\"cancelAction\":{\"stopId\":\"1234\"}}";

View File

@@ -19,23 +19,22 @@ import java.util.List;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.exc.MismatchedInputException;
import io.qameta.allure.Description;
import io.qameta.allure.Feature;
import io.qameta.allure.Story;
import org.junit.jupiter.api.Test;
/**
* Test serializability of DDI api model 'DdiChunk'
* <p/>
* Feature: Unit Tests - Direct Device Integration API<br/>
* Story: Serializability of DDI api Models
*/
@Feature("Unit Tests - Direct Device Integration API")
@Story("Serializability of DDI api Models")
class DdiChunkTest {
private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
@Test
@Description("Verify the correct serialization and deserialization of the model")
void shouldSerializeAndDeserializeObject() throws IOException {
/**
* Verify the correct serialization and deserialization of the model
*/
@Test void shouldSerializeAndDeserializeObject() throws IOException {
// Setup
final String part = "1234";
final String version = "1.0";
@@ -53,9 +52,10 @@ class DdiChunkTest {
assertThat(deserializedDdiChunk.getArtifacts()).isEmpty();
}
@Test
@Description("Verify the correct deserialization of a model with a additional unknown property")
void shouldDeserializeObjectWithUnknownProperty() throws IOException {
/**
* Verify the correct deserialization of a model with a additional unknown property
*/
@Test void shouldDeserializeObjectWithUnknownProperty() throws IOException {
// Setup
final String serializedDdiChunk = "{\"part\":\"1234\",\"version\":\"1.0\",\"name\":\"Dummy-Artifact\",\"artifacts\":[],\"unknownProperty\":\"test\"}";
@@ -67,9 +67,10 @@ class DdiChunkTest {
assertThat(ddiChunk.getArtifacts()).isEmpty();
}
@Test
@Description("Verify that deserialization fails for known properties with a wrong datatype")
void shouldFailForObjectWithWrongDataTypes() {
/**
* Verify that deserialization fails for known properties with a wrong datatype
*/
@Test void shouldFailForObjectWithWrongDataTypes() {
// Setup
final String serializedDdiChunk = "{\"part\":[\"1234\"],\"version\":\"1.0\",\"name\":\"Dummy-Artifact\",\"artifacts\":[]}";

View File

@@ -19,23 +19,22 @@ import java.util.Map;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.exc.MismatchedInputException;
import io.qameta.allure.Description;
import io.qameta.allure.Feature;
import io.qameta.allure.Story;
import org.junit.jupiter.api.Test;
/**
* Test serializability of DDI api model 'DdiConfigData'
* <p/>
* Feature: Unit Tests - Direct Device Integration API<br/>
* Story: Serializability of DDI api Models
*/
@Feature("Unit Tests - Direct Device Integration API")
@Story("Serializability of DDI api Models")
class DdiConfigDataTest {
private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
@Test
@Description("Verify the correct serialization and deserialization of the model")
void shouldSerializeAndDeserializeObject() throws IOException {
/**
* Verify the correct serialization and deserialization of the model
*/
@Test void shouldSerializeAndDeserializeObject() throws IOException {
// Setup
final Map<String, String> data = new HashMap<>();
data.put("test", "data");
@@ -48,9 +47,10 @@ class DdiConfigDataTest {
assertThat(deserializedDdiConfigData.getMode()).isEqualTo(DdiUpdateMode.REPLACE);
}
@Test
@Description("Verify the correct deserialization of a model with an additional unknown property")
void shouldDeserializeObjectWithUnknownProperty() throws IOException {
/**
* Verify the correct deserialization of a model with an additional unknown property
*/
@Test void shouldDeserializeObjectWithUnknownProperty() throws IOException {
// Setup
final String serializedDdiConfigData = "{\"data\":{\"test\":\"data\"},\"mode\":\"replace\",\"unknownProperty\":\"test\"}";
@@ -59,9 +59,10 @@ class DdiConfigDataTest {
assertThat(ddiConfigData.getMode()).isEqualTo(DdiUpdateMode.REPLACE);
}
@Test
@Description("Verify that deserialization fails for known properties with a wrong datatype")
void shouldFailForObjectWithWrongDataTypes() {
/**
* Verify that deserialization fails for known properties with a wrong datatype
*/
@Test void shouldFailForObjectWithWrongDataTypes() {
// Setup
final String serializedDdiConfigData = "{\"data\":{\"test\":\"data\"},\"mode\":[\"replace\"],\"unknownProperty\":\"test\"}";
@@ -70,9 +71,10 @@ class DdiConfigDataTest {
.isThrownBy(() -> OBJECT_MAPPER.readValue(serializedDdiConfigData, DdiConfigData.class));
}
@Test
@Description("Verify the correct deserialization of a model with removed unused status property")
void shouldDeserializeObjectWithStatusProperty() throws IOException {
/**
* Verify the correct deserialization of a model with removed unused status property
*/
@Test void shouldDeserializeObjectWithStatusProperty() throws IOException {
// We formerly falsely required a 'status' property object when using the
// configData endpoint. It was removed as a requirement from code and
// documentation, as it was unused. This test ensures we still behave correctly

View File

@@ -17,23 +17,22 @@ import java.io.IOException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.exc.MismatchedInputException;
import io.qameta.allure.Description;
import io.qameta.allure.Feature;
import io.qameta.allure.Story;
import org.junit.jupiter.api.Test;
/**
* Test serializability of DDI api model 'DdiConfig'
* <p/>
* Feature: Unit Tests - Direct Device Integration API<br/>
* Story: Serializability of DDI api Models
*/
@Feature("Unit Tests - Direct Device Integration API")
@Story("Serializability of DDI api Models")
class DdiConfigTest {
private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
@Test
@Description("Verify the correct serialization and deserialization of the model")
void shouldSerializeAndDeserializeObject() throws IOException {
/**
* Verify the correct serialization and deserialization of the model
*/
@Test void shouldSerializeAndDeserializeObject() throws IOException {
// Setup
final DdiPolling ddiPolling = new DdiPolling("10");
final DdiConfig ddiConfig = new DdiConfig(ddiPolling);
@@ -45,9 +44,10 @@ class DdiConfigTest {
assertThat(deserializedDdiConfig.getPolling().getSleep()).isEqualTo("10");
}
@Test
@Description("Verify the correct deserialization of a model with a additional unknown property")
void shouldDeserializeObjectWithUnknownProperty() throws IOException {
/**
* Verify the correct deserialization of a model with a additional unknown property
*/
@Test void shouldDeserializeObjectWithUnknownProperty() throws IOException {
// Setup
final String serializedDdiConfig = "{\"polling\":{\"sleep\":\"123\"},\"unknownProperty\":\"test\"}";
@@ -56,9 +56,10 @@ class DdiConfigTest {
assertThat(ddiConfig.getPolling().getSleep()).isEqualTo("123");
}
@Test
@Description("Verify that deserialization fails for known properties with a wrong datatype")
void shouldFailForObjectWithWrongDataTypes() {
/**
* Verify that deserialization fails for known properties with a wrong datatype
*/
@Test void shouldFailForObjectWithWrongDataTypes() {
// Setup
final String serializedDdiConfig = "{\"polling\":{\"sleep\":[\"10\"]}}";

View File

@@ -22,23 +22,22 @@ import java.util.List;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.exc.MismatchedInputException;
import io.qameta.allure.Description;
import io.qameta.allure.Feature;
import io.qameta.allure.Story;
import org.junit.jupiter.api.Test;
/**
* Test serializability of DDI api model 'DdiConfirmationBase'
* <p/>
* Feature: Unit Tests - Direct Device Integration API<br/>
* Story: CHeck JSON serialization of DDI api confirmation models
*/
@Feature("Unit Tests - Direct Device Integration API")
@Story("CHeck JSON serialization of DDI api confirmation models")
class DdiConfirmationBaseTest {
private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
@Test
@Description("Verify the correct serialization and deserialization of the model")
void shouldSerializeAndDeserializeObject() throws IOException {
/**
* Verify the correct serialization and deserialization of the model
*/
@Test void shouldSerializeAndDeserializeObject() throws IOException {
// Setup
final String id = "1234";
final DdiDeployment ddiDeployment = new DdiDeployment(FORCED, ATTEMPT, Collections.emptyList(), AVAILABLE);
@@ -63,9 +62,10 @@ class DdiConfirmationBaseTest {
.hasToString(ddiActionHistory.toString());
}
@Test
@Description("Verify the correct deserialization of a model with a additional unknown property")
void shouldDeserializeObjectWithUnknownProperty() throws IOException {
/**
* Verify the correct deserialization of a model with a additional unknown property
*/
@Test void shouldDeserializeObjectWithUnknownProperty() throws IOException {
// Setup
final String serializedDdiConfirmationBase = "{" +
"\"id\":\"1234\",\"confirmation\":{\"download\":\"forced\"," +
@@ -84,9 +84,10 @@ class DdiConfirmationBaseTest {
.isEqualTo(AVAILABLE.getStatus());
}
@Test
@Description("Verify that deserialization fails for known properties with a wrong datatype")
void shouldFailForObjectWithWrongDataTypes() {
/**
* Verify that deserialization fails for known properties with a wrong datatype
*/
@Test void shouldFailForObjectWithWrongDataTypes() {
// Setup
final String serializedDdiConfirmationBase = "{" +
"\"id\":[\"1234\"],\"confirmation\":{\"download\":\"forced\"," +

View File

@@ -17,23 +17,22 @@ import java.io.IOException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.exc.MismatchedInputException;
import io.qameta.allure.Description;
import io.qameta.allure.Feature;
import io.qameta.allure.Story;
import org.junit.jupiter.api.Test;
/**
* Test serializability of DDI api model 'DdiControllerBase'
* <p/>
* Feature: Unit Tests - Direct Device Integration API<br/>
* Story: Serializability of DDI api Models
*/
@Feature("Unit Tests - Direct Device Integration API")
@Story("Serializability of DDI api Models")
class DdiControllerBaseTest {
private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
@Test
@Description("Verify the correct serialization and deserialization of the model")
void shouldSerializeAndDeserializeObject() throws IOException {
/**
* Verify the correct serialization and deserialization of the model
*/
@Test void shouldSerializeAndDeserializeObject() throws IOException {
// Setup
final DdiPolling ddiPolling = new DdiPolling("10");
final DdiConfig ddiConfig = new DdiConfig(ddiPolling);
@@ -46,9 +45,10 @@ class DdiControllerBaseTest {
assertThat(deserializedDdiControllerBase.getConfig().getPolling().getSleep()).isEqualTo(ddiPolling.getSleep());
}
@Test
@Description("Verify the correct deserialization of a model with a additional unknown property")
void shouldDeserializeObjectWithUnknownProperty() throws IOException {
/**
* Verify the correct deserialization of a model with a additional unknown property
*/
@Test void shouldDeserializeObjectWithUnknownProperty() throws IOException {
// Setup
final String serializedDdiControllerBase = "{\"config\":{\"polling\":{\"sleep\":\"123\"}},\"links\":[],\"unknownProperty\":\"test\"}";
@@ -57,9 +57,10 @@ class DdiControllerBaseTest {
assertThat(ddiControllerBase.getConfig().getPolling().getSleep()).isEqualTo("123");
}
@Test
@Description("Verify that deserialization fails for known properties with a wrong datatype")
void shouldFailForObjectWithWrongDataTypes() {
/**
* Verify that deserialization fails for known properties with a wrong datatype
*/
@Test void shouldFailForObjectWithWrongDataTypes() {
// Setup
final String serializedDdiControllerBase = "{\"config\":{\"polling\":{\"sleep\":[\"123\"]}},\"links\":[],\"unknownProperty\":\"test\"}";

View File

@@ -22,23 +22,22 @@ import java.util.List;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.exc.MismatchedInputException;
import io.qameta.allure.Description;
import io.qameta.allure.Feature;
import io.qameta.allure.Story;
import org.junit.jupiter.api.Test;
/**
* Test serializability of DDI api model 'DdiDeploymentBase'
* <p/>
* Feature: Unit Tests - Direct Device Integration API<br/>
* Story: Serializability of DDI api Models
*/
@Feature("Unit Tests - Direct Device Integration API")
@Story("Serializability of DDI api Models")
class DdiDeploymentBaseTest {
private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
@Test
@Description("Verify the correct serialization and deserialization of the model")
void shouldSerializeAndDeserializeObject() throws IOException {
/**
* Verify the correct serialization and deserialization of the model
*/
@Test void shouldSerializeAndDeserializeObject() throws IOException {
// Setup
final String id = "1234";
final DdiDeployment ddiDeployment = new DdiDeployment(FORCED, ATTEMPT, Collections.emptyList(), AVAILABLE);
@@ -57,9 +56,10 @@ class DdiDeploymentBaseTest {
assertThat(deserializedDdiDeploymentBase.getActionHistory()).hasToString(ddiActionHistory.toString());
}
@Test
@Description("Verify the correct deserialization of a model with a additional unknown property")
void shouldDeserializeObjectWithUnknownProperty() throws IOException {
/**
* Verify the correct deserialization of a model with a additional unknown property
*/
@Test void shouldDeserializeObjectWithUnknownProperty() throws IOException {
// Setup
final String serializedDdiDeploymentBase = "{\"id\":\"1234\",\"deployment\":{\"download\":\"forced\"," +
"\"update\":\"attempt\",\"maintenanceWindow\":\"available\",\"chunks\":[]}," +
@@ -73,9 +73,10 @@ class DdiDeploymentBaseTest {
assertThat(ddiDeploymentBase.getDeployment().getMaintenanceWindow().getStatus()).isEqualTo(AVAILABLE.getStatus());
}
@Test
@Description("Verify that deserialization fails for known properties with a wrong datatype")
void shouldFailForObjectWithWrongDataTypes() {
/**
* Verify that deserialization fails for known properties with a wrong datatype
*/
@Test void shouldFailForObjectWithWrongDataTypes() {
// Setup
final String serializedDdiDeploymentBase = "{\"id\":[\"1234\"],\"deployment\":{\"download\":\"forced\"," +
"\"update\":\"attempt\",\"maintenanceWindow\":\"available\",\"chunks\":[]}," +

View File

@@ -21,23 +21,22 @@ import java.util.Collections;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.exc.MismatchedInputException;
import io.qameta.allure.Description;
import io.qameta.allure.Feature;
import io.qameta.allure.Story;
import org.junit.jupiter.api.Test;
/**
* Test serializability of DDI api model 'DdiDeployment'
* <p/>
* Feature: Unit Tests - Direct Device Integration API<br/>
* Story: Serializability of DDI api Models
*/
@Feature("Unit Tests - Direct Device Integration API")
@Story("Serializability of DDI api Models")
class DdiDeploymentTest {
private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
@Test
@Description("Verify the correct serialization and deserialization of the model")
void shouldSerializeAndDeserializeObject() throws IOException {
/**
* Verify the correct serialization and deserialization of the model
*/
@Test void shouldSerializeAndDeserializeObject() throws IOException {
// Setup
final DdiDeployment ddiDeployment = new DdiDeployment(FORCED, ATTEMPT, Collections.emptyList(), AVAILABLE);
@@ -51,9 +50,10 @@ class DdiDeploymentTest {
assertThat(deserializedDdiDeployment.getMaintenanceWindow().getStatus()).isEqualTo(ddiDeployment.getMaintenanceWindow().getStatus());
}
@Test
@Description("Verify the correct deserialization of a model with a additional unknown property")
void shouldDeserializeObjectWithUnknownProperty() throws IOException {
/**
* Verify the correct deserialization of a model with a additional unknown property
*/
@Test void shouldDeserializeObjectWithUnknownProperty() throws IOException {
// Setup
final String serializedDdiDeployment = "{\"download\":\"forced\",\"update\":\"attempt\", " +
"\"maintenanceWindow\":\"available\",\"chunks\":[],\"unknownProperty\":\"test\"}";
@@ -65,9 +65,10 @@ class DdiDeploymentTest {
assertThat(ddiDeployment.getMaintenanceWindow().getStatus()).isEqualTo(AVAILABLE.getStatus());
}
@Test
@Description("Verify that deserialization fails for known properties with a wrong datatype")
void shouldFailForObjectWithWrongDataTypes() {
/**
* Verify that deserialization fails for known properties with a wrong datatype
*/
@Test void shouldFailForObjectWithWrongDataTypes() {
// Setup
final String serializedDdiDeployment = "{\"download\":[\"forced\"],\"update\":\"attempt\", " +
"\"maintenanceWindow\":\"available\",\"chunks\":[]}";

View File

@@ -17,23 +17,22 @@ import java.io.IOException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.exc.MismatchedInputException;
import io.qameta.allure.Description;
import io.qameta.allure.Feature;
import io.qameta.allure.Story;
import org.junit.jupiter.api.Test;
/**
* Test serializability of DDI api model 'DdiMetadata'
* <p/>
* Feature: Unit Tests - Direct Device Integration API<br/>
* Story: Serializability of DDI api Models
*/
@Feature("Unit Tests - Direct Device Integration API")
@Story("Serializability of DDI api Models")
class DdiMetadataTest {
private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
@Test
@Description("Verify the correct serialization and deserialization of the model")
void shouldSerializeAndDeserializeObject() throws IOException {
/**
* Verify the correct serialization and deserialization of the model
*/
@Test void shouldSerializeAndDeserializeObject() throws IOException {
// Setup
final String key = "testKey";
final String value = "testValue";
@@ -47,9 +46,10 @@ class DdiMetadataTest {
assertThat(deserializedDdiMetadata.getValue()).isEqualTo(ddiMetadata.getValue());
}
@Test
@Description("Verify the correct deserialization of a model with a additional unknown property")
void shouldDeserializeObjectWithUnknownProperty() throws IOException {
/**
* Verify the correct deserialization of a model with a additional unknown property
*/
@Test void shouldDeserializeObjectWithUnknownProperty() throws IOException {
// Setup
final String serializedDdiMetadata = "{\"key\":\"testKey\",\"value\":\"testValue\",\"unknownProperty\":\"test\"}";
@@ -59,9 +59,10 @@ class DdiMetadataTest {
assertThat(ddiMetadata.getValue()).isEqualTo("testValue");
}
@Test
@Description("Verify that deserialization fails for known properties with a wrong datatype")
void shouldFailForObjectWithWrongDataTypes() {
/**
* Verify that deserialization fails for known properties with a wrong datatype
*/
@Test void shouldFailForObjectWithWrongDataTypes() {
// Setup
final String serializedDdiMetadata = "{\"key\":[\"testKey\"],\"value\":\"testValue\"}";

View File

@@ -17,23 +17,22 @@ import java.io.IOException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.exc.MismatchedInputException;
import io.qameta.allure.Description;
import io.qameta.allure.Feature;
import io.qameta.allure.Story;
import org.junit.jupiter.api.Test;
/**
* Test serializability of DDI api model 'DdiPolling'
* <p/>
* Feature: Unit Tests - Direct Device Integration API<br/>
* Story: Serializability of DDI api Models
*/
@Feature("Unit Tests - Direct Device Integration API")
@Story("Serializability of DDI api Models")
class DdiPollingTest {
private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
@Test
@Description("Verify the correct serialization and deserialization of the model")
void shouldSerializeAndDeserializeObject() throws IOException {
/**
* Verify the correct serialization and deserialization of the model
*/
@Test void shouldSerializeAndDeserializeObject() throws IOException {
// Setup
final DdiPolling ddiPolling = new DdiPolling("10");
@@ -44,9 +43,10 @@ class DdiPollingTest {
assertThat(deserializedDdiPolling.getSleep()).isEqualTo(ddiPolling.getSleep());
}
@Test
@Description("Verify the correct deserialization of a model with a additional unknown property")
void shouldDeserializeObjectWithUnknownProperty() throws IOException {
/**
* Verify the correct deserialization of a model with a additional unknown property
*/
@Test void shouldDeserializeObjectWithUnknownProperty() throws IOException {
// Setup
final String serializedDdiPolling = "{\"sleep\":\"10\",\"unknownProperty\":\"test\"}";
@@ -55,9 +55,10 @@ class DdiPollingTest {
assertThat(ddiPolling.getSleep()).isEqualTo("10");
}
@Test
@Description("Verify that deserialization fails for known properties with a wrong datatype")
void shouldFailForObjectWithWrongDataTypes() {
/**
* Verify that deserialization fails for known properties with a wrong datatype
*/
@Test void shouldFailForObjectWithWrongDataTypes() {
// Setup
final String serializedDdiPolling = "{\"sleep\":[\"10\"]}";

View File

@@ -17,23 +17,22 @@ import java.io.IOException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.exc.MismatchedInputException;
import io.qameta.allure.Description;
import io.qameta.allure.Feature;
import io.qameta.allure.Story;
import org.junit.jupiter.api.Test;
/**
* Test serializability of DDI api model 'DdiProgress'
* <p/>
* Feature: Unit Tests - Direct Device Integration API<br/>
* Story: Serializability of DDI api Models
*/
@Feature("Unit Tests - Direct Device Integration API")
@Story("Serializability of DDI api Models")
class DdiProgressTest {
private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
@Test
@Description("Verify the correct serialization and deserialization of the model")
void shouldSerializeAndDeserializeObject() throws IOException {
/**
* Verify the correct serialization and deserialization of the model
*/
@Test void shouldSerializeAndDeserializeObject() throws IOException {
// Setup
final DdiProgress ddiProgress = new DdiProgress(30, 100);
@@ -45,9 +44,10 @@ class DdiProgressTest {
assertThat(deserializedDdiProgress.getOf()).isEqualTo(ddiProgress.getOf());
}
@Test
@Description("Verify the correct deserialization of a model with a additional unknown property")
void shouldDeserializeObjectWithUnknownProperty() throws IOException {
/**
* Verify the correct deserialization of a model with a additional unknown property
*/
@Test void shouldDeserializeObjectWithUnknownProperty() throws IOException {
// Setup
final String serializedDdiProgress = "{\"cnt\":30,\"of\":100,\"unknownProperty\":\"test\"}";
@@ -57,9 +57,10 @@ class DdiProgressTest {
assertThat(ddiProgress.getOf()).isEqualTo(100);
}
@Test
@Description("Verify that deserialization fails for known properties with a wrong datatype")
void shouldFailForObjectWithWrongDataTypes() {
/**
* Verify that deserialization fails for known properties with a wrong datatype
*/
@Test void shouldFailForObjectWithWrongDataTypes() {
// Setup
final String serializedDdiProgress = "{\"cnt\":[30],\"of\":100}";

View File

@@ -18,23 +18,22 @@ import java.io.IOException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.exc.MismatchedInputException;
import io.qameta.allure.Description;
import io.qameta.allure.Feature;
import io.qameta.allure.Story;
import org.junit.jupiter.api.Test;
/**
* Test serializability of DDI api model 'DdiResult'
* <p/>
* Feature: Unit Tests - Direct Device Integration API<br/>
* Story: Serializability of DDI api Models
*/
@Feature("Unit Tests - Direct Device Integration API")
@Story("Serializability of DDI api Models")
class DdiResultTest {
private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
@Test
@Description("Verify the correct serialization and deserialization of the model")
void shouldSerializeAndDeserializeObject() throws IOException {
/**
* Verify the correct serialization and deserialization of the model
*/
@Test void shouldSerializeAndDeserializeObject() throws IOException {
// Setup
final DdiProgress ddiProgress = new DdiProgress(30, 100);
final DdiResult ddiResult = new DdiResult(NONE, ddiProgress);
@@ -48,9 +47,10 @@ class DdiResultTest {
assertThat(deserializedDdiResult.getProgress().getOf()).isEqualTo(ddiProgress.getOf());
}
@Test
@Description("Verify the correct deserialization of a model with a additional unknown property")
void shouldDeserializeObjectWithUnknownProperty() throws IOException {
/**
* Verify the correct deserialization of a model with a additional unknown property
*/
@Test void shouldDeserializeObjectWithUnknownProperty() throws IOException {
// Setup
final String serializedDdiResult = "{\"finished\":\"none\",\"progress\":{\"cnt\":30,\"of\":100},\"unknownProperty\":\"test\"}";
@@ -61,9 +61,10 @@ class DdiResultTest {
assertThat(ddiResult.getProgress().getOf()).isEqualTo(100);
}
@Test
@Description("Verify that deserialization fails for known properties with a wrong datatype")
void shouldFailForObjectWithWrongDataTypes() {
/**
* Verify that deserialization fails for known properties with a wrong datatype
*/
@Test void shouldFailForObjectWithWrongDataTypes() {
// Setup
final String serializedDdiResult = "{\"finished\":[\"none\"],\"progress\":{\"cnt\":30,\"of\":100}}";

View File

@@ -21,9 +21,6 @@ import java.util.stream.Stream;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.exc.MismatchedInputException;
import io.qameta.allure.Description;
import io.qameta.allure.Feature;
import io.qameta.allure.Story;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.Arguments;
@@ -31,16 +28,19 @@ import org.junit.jupiter.params.provider.MethodSource;
/**
* Test serializability of DDI api model 'DdiStatus'
* <p/>
* Feature: Unit Tests - Direct Device Integration API<br/>
* Story: Serializability of DDI api Models
*/
@Feature("Unit Tests - Direct Device Integration API")
@Story("Serializability of DDI api Models")
class DdiStatusTest {
private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
/**
* Verify the correct serialization and deserialization of the model
*/
@ParameterizedTest
@MethodSource("ddiStatusPossibilities")
@Description("Verify the correct serialization and deserialization of the model")
void shouldSerializeAndDeserializeObject(final DdiResult ddiResult, final DdiStatus ddiStatus) throws IOException {
// Test
final String serializedDdiStatus = OBJECT_MAPPER.writeValueAsString(ddiStatus);
@@ -54,9 +54,10 @@ class DdiStatusTest {
assertThat(deserializedDdiStatus.getDetails()).isEqualTo(ddiStatus.getDetails());
}
@Test
@Description("Verify the correct deserialization of a model with a additional unknown property")
void shouldDeserializeObjectWithUnknownProperty() throws IOException {
/**
* Verify the correct deserialization of a model with a additional unknown property
*/
@Test void shouldDeserializeObjectWithUnknownProperty() throws IOException {
// Setup
final String serializedDdiStatus = "{\"execution\":\"proceeding\",\"result\":{\"finished\":\"none\"," +
"\"progress\":{\"cnt\":30,\"of\":100}},\"details\":[],\"unknownProperty\":\"test\"}";
@@ -70,9 +71,10 @@ class DdiStatusTest {
assertThat(ddiStatus.getResult().getProgress().getOf()).isEqualTo(100);
}
@Test
@Description("Verify the correct deserialization of a model with a provided code (optional)")
void shouldDeserializeObjectWithOptionalCode() throws IOException {
/**
* Verify the correct deserialization of a model with a provided code (optional)
*/
@Test void shouldDeserializeObjectWithOptionalCode() throws IOException {
// Setup
final String serializedDdiStatus = "{\"execution\":\"proceeding\",\"result\":{\"finished\":\"none\"," +
"\"progress\":{\"cnt\":30,\"of\":100}},\"code\": 12,\"details\":[]}";
@@ -86,9 +88,10 @@ class DdiStatusTest {
assertThat(ddiStatus.getResult().getProgress().getOf()).isEqualTo(100);
}
@Test
@Description("Verify that deserialization fails for known properties with a wrong datatype")
void shouldFailForObjectWithWrongDataTypes() {
/**
* Verify that deserialization fails for known properties with a wrong datatype
*/
@Test void shouldFailForObjectWithWrongDataTypes() {
// Setup
final String serializedDdiStatus = "{\"execution\":[\"proceeding\"],\"result\":{\"finished\":\"none\"," +
"\"progress\":{\"cnt\":30,\"of\":100}},\"details\":[]}";

View File

@@ -18,21 +18,20 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import io.github.classgraph.ClassGraph;
import io.github.classgraph.ClassInfo;
import io.github.classgraph.ScanResult;
import io.qameta.allure.Description;
import io.qameta.allure.Feature;
import io.qameta.allure.Story;
import org.junit.jupiter.api.Test;
/**
* Check DDI api model classes for '@JsonIgnoreProperties' annotation
* <p/>
* Feature: Unit Tests - Direct Device Integration API<br/>
* Story: Serialization of DDI api Models
*/
@Feature("Unit Tests - Direct Device Integration API")
@Story("Serialization of DDI api Models")
class JsonIgnorePropertiesAnnotationTest {
@Test
@Description("This test verifies that all model classes within the 'org.eclipse.hawkbit.ddi.json.model' package are annotated with '@JsonIgnoreProperties(ignoreUnknown = true)'")
void shouldCheckAnnotationsForAllModelClasses() {
/**
* This test verifies that all model classes within the 'org.eclipse.hawkbit.ddi.json.model' package are annotated with '@JsonIgnoreProperties(ignoreUnknown = true)'
*/
@Test void shouldCheckAnnotationsForAllModelClasses() {
final String packageName = getClass().getPackage().getName();
try (final ScanResult scanResult = new ClassGraph().acceptPackages(packageName).scan()) {
final List<? extends Class<?>> matchingClasses = scanResult.getAllClasses()

View File

@@ -30,9 +30,6 @@ import java.util.List;
import java.util.Locale;
import java.util.TimeZone;
import io.qameta.allure.Description;
import io.qameta.allure.Feature;
import io.qameta.allure.Story;
import org.eclipse.hawkbit.ddi.rest.resource.DdiArtifactDownloadTest.DownloadTestConfiguration;
import org.eclipse.hawkbit.repository.event.remote.DownloadProgressEvent;
import org.eclipse.hawkbit.repository.model.Artifact;
@@ -53,9 +50,10 @@ import org.springframework.test.web.servlet.MvcResult;
/**
* Test artifact downloads from the controller.
* <p/>
* Feature: Component Tests - Direct Device Integration API<br/>
* Story: Artifact Download Resource
*/
@Feature("Component Tests - Direct Device Integration API")
@Story("Artifact Download Resource")
@SpringBootTest(classes = { DownloadTestConfiguration.class })
class DdiArtifactDownloadTest extends AbstractDDiApiIntegrationTest {
@@ -69,9 +67,10 @@ class DdiArtifactDownloadTest extends AbstractDDiApiIntegrationTest {
dateFormat.setTimeZone(TimeZone.getTimeZone("GMT"));
}
@Test
@Description("Tests non allowed requests on the artifact ressource, e.g. invalid URI, wrong if-match, wrong command.")
void invalidRequestsOnArtifactResource() throws Exception {
/**
* Tests non allowed requests on the artifact ressource, e.g. invalid URI, wrong if-match, wrong command.
*/
@Test void invalidRequestsOnArtifactResource() throws Exception {
// create target
final Target target = testdataFactory.createTarget();
final List<Target> targets = Collections.singletonList(target);
@@ -157,9 +156,11 @@ class DdiArtifactDownloadTest extends AbstractDDiApiIntegrationTest {
.andExpect(status().isMethodNotAllowed());
}
/**
* Tests valid downloads through the artifact resource by identifying the artifact not by ID but file name.
*/
@Test
@WithUser(principal = "4712", authorities = "ROLE_CONTROLLER", allSpPermissions = true)
@Description("Tests valid downloads through the artifact resource by identifying the artifact not by ID but file name.")
void downloadArtifactThroughFileName() throws Exception {
downloadProgress = 1;
shippedBytes = 0;
@@ -203,9 +204,10 @@ class DdiArtifactDownloadTest extends AbstractDDiApiIntegrationTest {
assertThat(shippedBytes).isEqualTo(artifactSize);
}
@Test
@Description("Tests valid MD5SUm file downloads through the artifact resource by identifying the artifact by ID.")
void downloadMd5sumThroughControllerApi() throws Exception {
/**
* Tests valid MD5SUm file downloads through the artifact resource by identifying the artifact by ID.
*/
@Test void downloadMd5sumThroughControllerApi() throws Exception {
// create target
final Target target = testdataFactory.createTarget();
@@ -233,9 +235,11 @@ class DdiArtifactDownloadTest extends AbstractDDiApiIntegrationTest {
.isEqualTo((artifact.getMd5Hash() + " " + artifact.getFilename()).getBytes(StandardCharsets.US_ASCII));
}
/**
* Test various HTTP range requests for artifact download, e.g. chunk download or download resume.
*/
@Test
@WithUser(principal = TestdataFactory.DEFAULT_CONTROLLER_ID, authorities = "ROLE_CONTROLLER", allSpPermissions = true)
@Description("Test various HTTP range requests for artifact download, e.g. chunk download or download resume.")
void rangeDownloadArtifact() throws Exception {
// create target
final Target target = testdataFactory.createTarget();

View File

@@ -25,9 +25,6 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import io.qameta.allure.Description;
import io.qameta.allure.Feature;
import io.qameta.allure.Story;
import org.eclipse.hawkbit.ddi.json.model.DdiResult;
import org.eclipse.hawkbit.ddi.json.model.DdiStatus;
import org.eclipse.hawkbit.ddi.rest.api.DdiRestConstants;
@@ -46,17 +43,19 @@ import org.springframework.integration.json.JsonPathUtils;
/**
* Test cancel action from the controller.
* <p/>
* Feature: Component Tests - Direct Device Integration API<br/>
* Story: Cancel Action Resource
*/
@Feature("Component Tests - Direct Device Integration API")
@Story("Cancel Action Resource")
class DdiCancelActionTest extends AbstractDDiApiIntegrationTest {
@Autowired
ActionStatusRepository actionStatusRepository;
@Test
@Description("Tests that the cancel action resource can be used with CBOR.")
void cancelActionCbor() throws Exception {
/**
* Tests that the cancel action resource can be used with CBOR.
*/
@Test void cancelActionCbor() throws Exception {
final DistributionSet ds = testdataFactory.createDistributionSet("");
testdataFactory.createTarget();
final Long actionId = getFirstAssignedActionId(
@@ -87,9 +86,10 @@ class DdiCancelActionTest extends AbstractDDiApiIntegrationTest {
.andExpect(status().isOk());
}
@Test
@Description("Test of the controller can continue a started update even after a cancel command if it so desires.")
void rootRsCancelActionButContinueAnyway() throws Exception {
/**
* Test of the controller can continue a started update even after a cancel command if it so desires.
*/
@Test void rootRsCancelActionButContinueAnyway() throws Exception {
// prepare test data
final DistributionSet ds = testdataFactory.createDistributionSet("");
final Target savedTarget = testdataFactory.createTarget();
@@ -147,9 +147,10 @@ class DdiCancelActionTest extends AbstractDDiApiIntegrationTest {
}
@Test
@Description("Test for cancel operation of a update action.")
void rootRsCancelAction() throws Exception {
/**
* Test for cancel operation of a update action.
*/
@Test void rootRsCancelAction() throws Exception {
final DistributionSet ds = testdataFactory.createDistributionSet("");
final Target savedTarget = testdataFactory.createTarget();
@@ -228,9 +229,10 @@ class DdiCancelActionTest extends AbstractDDiApiIntegrationTest {
}
@Test
@Description("Tests various bad requests and if the server handles them as expected.")
void badCancelAction() throws Exception {
/**
* Tests various bad requests and if the server handles them as expected.
*/
@Test void badCancelAction() throws Exception {
// not allowed methods
mvc.perform(post("/{tenant}/controller/v1/" + TestdataFactory.DEFAULT_CONTROLLER_ID + "/cancelAction/1",
@@ -264,9 +266,10 @@ class DdiCancelActionTest extends AbstractDDiApiIntegrationTest {
}
@Test
@Description("Tests the feedback channel of the cancel operation.")
void rootRsCancelActionFeedback() throws Exception {
/**
* Tests the feedback channel of the cancel operation.
*/
@Test void rootRsCancelActionFeedback() throws Exception {
final DistributionSet ds = testdataFactory.createDistributionSet("");
@@ -344,9 +347,10 @@ class DdiCancelActionTest extends AbstractDDiApiIntegrationTest {
assertThat(deploymentManagement.findActiveActionsByTarget(savedTarget.getControllerId(), PAGE)).isEmpty();
}
@Test
@Description("Tests the feeback chanel of for multiple open cancel operations on the same target.")
void multipleCancelActionFeedback() throws Exception {
/**
* Tests the feeback chanel of for multiple open cancel operations on the same target.
*/
@Test void multipleCancelActionFeedback() throws Exception {
final DistributionSet ds = testdataFactory.createDistributionSet("", true);
final DistributionSet ds2 = testdataFactory.createDistributionSet("2", true);
final DistributionSet ds3 = testdataFactory.createDistributionSet("3", true);
@@ -475,9 +479,10 @@ class DdiCancelActionTest extends AbstractDDiApiIntegrationTest {
assertThat(deploymentManagement.countActionsByTarget(savedTarget.getControllerId())).isEqualTo(3);
}
@Test
@Description("Tests the feeback channel closing for too many feedbacks, i.e. denial of service prevention.")
void tooMuchCancelActionFeedback() throws Exception {
/**
* Tests the feeback channel closing for too many feedbacks, i.e. denial of service prevention.
*/
@Test void tooMuchCancelActionFeedback() throws Exception {
testdataFactory.createTarget();
final DistributionSet ds = testdataFactory.createDistributionSet("");
@@ -503,9 +508,10 @@ class DdiCancelActionTest extends AbstractDDiApiIntegrationTest {
.andExpect(status().isForbidden());
}
@Test
@Description("test the correct rejection of various invalid feedback requests")
void badCancelActionFeedback() throws Exception {
/**
* test the correct rejection of various invalid feedback requests
*/
@Test void badCancelActionFeedback() throws Exception {
final Action cancelAction = createCancelAction(TestdataFactory.DEFAULT_CONTROLLER_ID);
createCancelAction("4715");

View File

@@ -28,10 +28,6 @@ import java.util.HashMap;
import java.util.Map;
import java.util.NoSuchElementException;
import io.qameta.allure.Description;
import io.qameta.allure.Feature;
import io.qameta.allure.Step;
import io.qameta.allure.Story;
import org.eclipse.hawkbit.ddi.rest.api.DdiRestConstants;
import org.eclipse.hawkbit.exception.SpServerError;
import org.eclipse.hawkbit.repository.exception.AssignmentQuotaExceededException;
@@ -48,8 +44,10 @@ import org.springframework.test.context.ActiveProfiles;
* Test config data from the controller.
*/
@ActiveProfiles({ "im", "test" })
@Feature("Component Tests - Direct Device Integration API")
@Story("Config Data Resource")
/**
* Feature: Component Tests - Direct Device Integration API<br/>
* Story: Config Data Resource
*/
class DdiConfigDataTest extends AbstractDDiApiIntegrationTest {
private static final String TARGET1_ID = "4717";
@@ -57,9 +55,10 @@ class DdiConfigDataTest extends AbstractDDiApiIntegrationTest {
private static final String TARGET2_ID = "4718";
private static final String TARGET2_CONFIG_DATA_PATH = "/{tenant}/controller/v1/" + TARGET2_ID + "/configData";
@Test
@Description("Verify that config data can be uploaded as CBOR")
void putConfigDataAsCbor() throws Exception {
/**
* Verify that config data can be uploaded as CBOR
*/
@Test void putConfigDataAsCbor() throws Exception {
testdataFactory.createTarget(TARGET1_ID);
final Map<String, String> attributes = new HashMap<>();
@@ -73,9 +72,11 @@ class DdiConfigDataTest extends AbstractDDiApiIntegrationTest {
assertThat(targetManagement.getControllerAttributes(TARGET1_ID)).isEqualTo(attributes);
}
@Test
@Description("We verify that the config data (i.e. device attributes like serial number, hardware revision etc.) " +
"are requested only once from the device.")
/**
* We verify that the config data (i.e. device attributes like serial number, hardware revision etc.) are requested only once from the device.")
*/
@SuppressWarnings("squid:S2925")
void requestConfigDataIfEmpty() throws Exception {
final Target savedTarget = testdataFactory.createTarget("4712");
@@ -111,9 +112,11 @@ class DdiConfigDataTest extends AbstractDDiApiIntegrationTest {
.andExpect(jsonPath("$._links.configData.href").doesNotExist());
}
/**
* We verify that the config data (i.e. device attributes like serial number, hardware revision etc.)
* can be uploaded correctly by the controller.
*/
@Test
@Description("We verify that the config data (i.e. device attributes like serial number, hardware revision etc.) " +
"can be uploaded correctly by the controller.")
void putConfigData() throws Exception {
testdataFactory.createTarget(TARGET1_ID);
@@ -136,10 +139,11 @@ class DdiConfigDataTest extends AbstractDDiApiIntegrationTest {
assertThat(targetManagement.getControllerAttributes(TARGET1_ID)).isEqualTo(attributes);
}
/**
* We verify that the config data (i.e. device attributes like serial number, hardware revision etc.)
* upload quota is enforced to protect the server from malicious attempts.""")
*/
@Test
@Description("""
We verify that the config data (i.e. device attributes like serial number, hardware revision etc.)
upload quota is enforced to protect the server from malicious attempts.""")
void putTooMuchConfigData() throws Exception {
testdataFactory.createTarget(TARGET1_ID);
@@ -161,9 +165,11 @@ class DdiConfigDataTest extends AbstractDDiApiIntegrationTest {
.andExpect(jsonPath("$.errorCode", equalTo(SpServerError.SP_QUOTA_EXCEEDED.getKey())));
}
/**
* We verify that the config data (i.e. device attributes like serial number, hardware revision etc.)
* resource behaves as expected in case of invalid request attempts.
*/
@Test
@Description("We verify that the config data (i.e. device attributes like serial number, hardware revision etc.) "
+ "resource behaves as expected in case of invalid request attempts.")
void badConfigData() throws Exception {
testdataFactory.createTarget("4712");
@@ -200,18 +206,20 @@ class DdiConfigDataTest extends AbstractDDiApiIntegrationTest {
.andExpect(status().isBadRequest());
}
@Test
@Description("Verifies that invalid config data attributes are handled correctly.")
void putConfigDataWithInvalidAttributes() throws Exception {
/**
* Verifies that invalid config data attributes are handled correctly.
*/
@Test void putConfigDataWithInvalidAttributes() throws Exception {
// create a target
testdataFactory.createTarget(TARGET2_ID);
putAndVerifyConfigDataWithKeyTooLong();
putAndVerifyConfigDataWithValueTooLong();
}
@Test
@Description("Verify that config data (device attributes) can be updated by the controller using different update modes (merge, replace, remove).")
void putConfigDataWithDifferentUpdateModes() throws Exception {
/**
* Verify that config data (device attributes) can be updated by the controller using different update modes (merge, replace, remove).
*/
@Test void putConfigDataWithDifferentUpdateModes() throws Exception {
// create a target
testdataFactory.createTarget(TARGET1_ID);
@@ -231,7 +239,6 @@ class DdiConfigDataTest extends AbstractDDiApiIntegrationTest {
putConfigDataWithInvalidUpdateMode();
}
@Step
private void putAndVerifyConfigDataWithKeyTooLong() throws Exception {
final Map<String, String> attributes = Collections.singletonMap(ATTRIBUTE_KEY_TOO_LONG, ATTRIBUTE_VALUE_VALID);
mvc.perform(put(DdiConfigDataTest.TARGET2_CONFIG_DATA_PATH, tenantAware.getCurrentTenant())
@@ -241,7 +248,6 @@ class DdiConfigDataTest extends AbstractDDiApiIntegrationTest {
.andExpect(jsonPath("$.errorCode", equalTo(SpServerError.SP_TARGET_ATTRIBUTES_INVALID.getKey())));
}
@Step
private void putAndVerifyConfigDataWithValueTooLong() throws Exception {
final Map<String, String> attributes = Collections.singletonMap(ATTRIBUTE_KEY_VALID, ATTRIBUTE_VALUE_TOO_LONG);
mvc.perform(put(DdiConfigDataTest.TARGET2_CONFIG_DATA_PATH, tenantAware.getCurrentTenant())
@@ -251,7 +257,6 @@ class DdiConfigDataTest extends AbstractDDiApiIntegrationTest {
.andExpect(jsonPath("$.errorCode", equalTo(SpServerError.SP_TARGET_ATTRIBUTES_INVALID.getKey())));
}
@Step
private void putConfigDataWithInvalidUpdateMode() throws Exception {
// create some attriutes
final Map<String, String> attributes = Map.of(
@@ -266,7 +271,6 @@ class DdiConfigDataTest extends AbstractDDiApiIntegrationTest {
.andExpect(status().isBadRequest());
}
@Step
private void putConfigDataWithUpdateModeRemove() throws Exception {
// get the current attributes
final int previousSize = targetManagement.getControllerAttributes(DdiConfigDataTest.TARGET1_ID).size();
@@ -290,7 +294,6 @@ class DdiConfigDataTest extends AbstractDDiApiIntegrationTest {
}
@Step
private void putConfigDataWithUpdateModeMerge() throws Exception {
// get the current attributes
final Map<String, String> attributes = new HashMap<>(targetManagement.getControllerAttributes(DdiConfigDataTest.TARGET1_ID));
@@ -313,7 +316,6 @@ class DdiConfigDataTest extends AbstractDDiApiIntegrationTest {
attributes.keySet().forEach(assertThat(updatedAttributes)::containsKey);
}
@Step
private void putConfigDataWithUpdateModeReplace() throws Exception {
// get the current attributes
final Map<String, String> attributes = new HashMap<>(targetManagement.getControllerAttributes(DdiConfigDataTest.TARGET1_ID));
@@ -337,7 +339,6 @@ class DdiConfigDataTest extends AbstractDDiApiIntegrationTest {
attributes.entrySet().forEach(assertThat(updatedAttributes)::doesNotContain);
}
@Step
private void putConfigDataWithoutUpdateMode() throws Exception {
// create some attributes
final Map<String, String> attributes = Map.of(

View File

@@ -23,10 +23,6 @@ import java.util.Collections;
import java.util.List;
import java.util.stream.Stream;
import io.qameta.allure.Description;
import io.qameta.allure.Feature;
import io.qameta.allure.Step;
import io.qameta.allure.Story;
import org.eclipse.hawkbit.ddi.json.model.DdiActivateAutoConfirmation;
import org.eclipse.hawkbit.ddi.json.model.DdiConfirmationFeedback;
import org.eclipse.hawkbit.ddi.rest.api.DdiRestConstants;
@@ -63,16 +59,18 @@ import org.springframework.test.web.servlet.ResultActions;
/**
* Test confirmation base from the controller.
* <p/>
* Feature: Component Tests - Direct Device Integration API<br/>
* Story: Confirmation Action Resource
*/
@Feature("Component Tests - Direct Device Integration API")
@Story("Confirmation Action Resource")
class DdiConfirmationBaseTest extends AbstractDDiApiIntegrationTest {
private static final String DEFAULT_CONTROLLER_ID = "4747";
@Test
@Description("Forced deployment to a controller. Checks if the confirmation resource response payload for a given deployment is as expected.")
void verifyConfirmationReferencesInControllerBase(@Autowired ActionStatusRepository actionStatusRepository) throws Exception {
/**
* Forced deployment to a controller. Checks if the confirmation resource response payload for a given deployment is as expected.
*/
@Test void verifyConfirmationReferencesInControllerBase(@Autowired ActionStatusRepository actionStatusRepository) throws Exception {
enableConfirmationFlow();
// Prepare test data
final DistributionSet ds = testdataFactory.createDistributionSet("", true);
@@ -134,9 +132,10 @@ class DdiConfirmationBaseTest extends AbstractDDiApiIntegrationTest {
.allMatch(status -> status.getStatus() == Action.Status.WAIT_FOR_CONFIRMATION);
}
@Test
@Description("Ensure that the deployment resource is available as CBOR")
void confirmationResourceCbor() throws Exception {
/**
* Ensure that the deployment resource is available as CBOR
*/
@Test void confirmationResourceCbor() throws Exception {
enableConfirmationFlow();
final Target target = testdataFactory.createTarget();
final DistributionSet distributionSet = testdataFactory.createDistributionSet("");
@@ -158,9 +157,10 @@ class DdiConfirmationBaseTest extends AbstractDDiApiIntegrationTest {
String.valueOf(softwareModuleId));
}
@Test
@Description("Ensure that the confirmation endpoint is not available.")
void confirmationEndpointNotExposed() throws Exception {
/**
* Ensure that the confirmation endpoint is not available.
*/
@Test void confirmationEndpointNotExposed() throws Exception {
final DistributionSet ds = testdataFactory.createDistributionSet("");
Target savedTarget = testdataFactory.createTarget("988");
savedTarget = getFirstAssignedTarget(assignDistributionSet(ds.getId(), savedTarget.getControllerId()));
@@ -179,9 +179,10 @@ class DdiConfirmationBaseTest extends AbstractDDiApiIntegrationTest {
.andExpect(status().isNotFound());
}
@Test
@Description("Ensure that the deploymentBase endpoint is not available for action ins WFC state.")
void deploymentEndpointNotAccessibleForActionsWFC() throws Exception {
/**
* Ensure that the deploymentBase endpoint is not available for action ins WFC state.
*/
@Test void deploymentEndpointNotAccessibleForActionsWFC() throws Exception {
enableConfirmationFlow();
final DistributionSet ds = testdataFactory.createDistributionSet("");
@@ -208,9 +209,10 @@ class DdiConfirmationBaseTest extends AbstractDDiApiIntegrationTest {
.andExpect(status().isNotFound());
}
@Test
@Description("Ensure that the confirmation endpoints are still available after deactivating the confirmation flow.")
void verifyConfirmationBaseEndpointsArePresentAfterDisablingConfirmationFlow() throws Exception {
/**
* Ensure that the confirmation endpoints are still available after deactivating the confirmation flow.
*/
@Test void verifyConfirmationBaseEndpointsArePresentAfterDisablingConfirmationFlow() throws Exception {
enableConfirmationFlow();
final DistributionSet ds = testdataFactory.createDistributionSet("");
@@ -244,9 +246,10 @@ class DdiConfirmationBaseTest extends AbstractDDiApiIntegrationTest {
verifyActionInDeploymentBaseState(controllerId, savedAction.getId());
}
@Test
@Description("Controller sends a confirmed action state.")
@ExpectEvents({
/**
* Controller sends a confirmed action state.
*/
@Test @ExpectEvents({
@Expect(type = TargetCreatedEvent.class, count = 1),
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3),
@@ -279,9 +282,10 @@ class DdiConfirmationBaseTest extends AbstractDDiApiIntegrationTest {
verifyActionInDeploymentBaseState(controllerId, savedAction.getId());
}
@Test
@Description("Confirmation base provides right values if auto-confirm not active.")
void getConfirmationBaseProvidesAutoConfirmStatusNotActive() throws Exception {
/**
* Confirmation base provides right values if auto-confirm not active.
*/
@Test void getConfirmationBaseProvidesAutoConfirmStatusNotActive() throws Exception {
enableConfirmationFlow();
final String controllerId = testdataFactory.createTarget("989").getControllerId();
@@ -305,9 +309,11 @@ class DdiConfirmationBaseTest extends AbstractDDiApiIntegrationTest {
.andExpect(jsonPath("$._links.deactivateAutoConfirm").doesNotExist());
}
/**
* Confirmation base provides right values if auto-confirm is active.
*/
@ParameterizedTest
@MethodSource("possibleActiveStates")
@Description("Confirmation base provides right values if auto-confirm is active.")
void getConfirmationBaseProvidesAutoConfirmStatusActive(final String initiator, final String remark) throws Exception {
final String controllerId = testdataFactory.createTarget("988").getControllerId();
@@ -331,9 +337,11 @@ class DdiConfirmationBaseTest extends AbstractDDiApiIntegrationTest {
.andExpect(jsonPath("$._links.activateAutoConfirm").doesNotExist());
}
/**
* Verify auto-confirm activation is handled correctly.
*/
@ParameterizedTest
@MethodSource("possibleActiveStates")
@Description("Verify auto-confirm activation is handled correctly.")
void activateAutoConfirmation(final String initiator, final String remark) throws Exception {
final String controllerId = testdataFactory.createTarget("988").getControllerId();
@@ -351,9 +359,10 @@ class DdiConfirmationBaseTest extends AbstractDDiApiIntegrationTest {
});
}
@Test
@Description("Verify auto-confirm deactivation is handled correctly.")
void deactivateAutoConfirmation() throws Exception {
/**
* Verify auto-confirm deactivation is handled correctly.
*/
@Test void deactivateAutoConfirmation() throws Exception {
final String controllerId = testdataFactory.createTarget("988").getControllerId();
confirmationManagement.activateAutoConfirmation(controllerId, null, null);
@@ -365,9 +374,10 @@ class DdiConfirmationBaseTest extends AbstractDDiApiIntegrationTest {
assertThat(confirmationManagement.getStatus(controllerId)).isEmpty();
}
@Test
@Description("Controller sends a denied action state.")
@ExpectEvents({
/**
* Controller sends a denied action state.
*/
@Test @ExpectEvents({
@Expect(type = TargetCreatedEvent.class, count = 1),
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3),
@@ -410,9 +420,10 @@ class DdiConfirmationBaseTest extends AbstractDDiApiIntegrationTest {
.andExpect(status().isNotFound());
}
@Test
@Description("Test to verify that only a specific count of messages are returned based on the input actionHistory for getControllerDeploymentActionFeedback endpoint.")
@ExpectEvents({
/**
* Test to verify that only a specific count of messages are returned based on the input actionHistory for getControllerDeploymentActionFeedback endpoint.
*/
@Test @ExpectEvents({
@Expect(type = TargetCreatedEvent.class, count = 1),
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3),
@@ -464,7 +475,6 @@ class DdiConfirmationBaseTest extends AbstractDDiApiIntegrationTest {
Arguments.of(null, null));
}
@Step
private void verifyActionInDeploymentBaseState(final String controllerId, final long actionId) throws Exception {
final String expectedDeploymentBaseLink = String.format(
"/%s/controller/v1/%s/deploymentBase/%d",
@@ -482,7 +492,6 @@ class DdiConfirmationBaseTest extends AbstractDDiApiIntegrationTest {
.andExpect(status().isOk());
}
@Step
private void verifyActionInConfirmationBaseState(final String controllerId, final long actionId) throws Exception {
mvc.perform(get(CONTROLLER_BASE, tenantAware.getCurrentTenant(), controllerId).accept(MediaType.APPLICATION_JSON))
.andDo(MockMvcResultPrinter.print())

View File

@@ -26,9 +26,6 @@ import java.util.Optional;
import java.util.concurrent.TimeUnit;
import com.jayway.jsonpath.JsonPath;
import io.qameta.allure.Description;
import io.qameta.allure.Feature;
import io.qameta.allure.Story;
import org.assertj.core.api.Condition;
import org.eclipse.hawkbit.ddi.json.model.DdiResult;
import org.eclipse.hawkbit.ddi.json.model.DdiStatus;
@@ -70,9 +67,10 @@ import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
/**
* Test deployment base from the controller.
* <p/>
* Feature: Component Tests - Direct Device Integration API<br/>
* Story: Deployment Action Resource
*/
@Feature("Component Tests - Direct Device Integration API")
@Story("Deployment Action Resource")
class DdiDeploymentBaseTest extends AbstractDDiApiIntegrationTest {
private static final String DEFAULT_CONTROLLER_ID = "4712";
@@ -82,9 +80,10 @@ class DdiDeploymentBaseTest extends AbstractDDiApiIntegrationTest {
@Autowired
private ActionStatusRepository actionStatusRepository;
@Test
@Description("Ensure that the deployment resource is available as CBOR")
void deploymentResourceCbor() throws Exception {
/**
* Ensure that the deployment resource is available as CBOR
*/
@Test void deploymentResourceCbor() throws Exception {
final Target target = testdataFactory.createTarget();
final DistributionSet distributionSet = testdataFactory.createDistributionSet("");
@@ -109,17 +108,19 @@ class DdiDeploymentBaseTest extends AbstractDDiApiIntegrationTest {
status().isOk());
}
@Test
@Description("Ensures that artifacts are not found, when software module does not exists.")
void artifactsNotFound() throws Exception {
/**
* Ensures that artifacts are not found, when software module does not exists.
*/
@Test void artifactsNotFound() throws Exception {
final Target target = testdataFactory.createTarget();
performGet(SOFTWARE_MODULE_ARTIFACTS, MediaType.APPLICATION_JSON, status().isNotFound(), tenantAware.getCurrentTenant(),
target.getControllerId(), "1");
}
@Test
@Description("Ensures that artifacts are found, when software module exists.")
void artifactsExists() throws Exception {
/**
* Ensures that artifacts are found, when software module exists.
*/
@Test void artifactsExists() throws Exception {
final Target target = testdataFactory.createTarget();
final DistributionSet distributionSet = testdataFactory.createDistributionSet("");
@@ -136,9 +137,10 @@ class DdiDeploymentBaseTest extends AbstractDDiApiIntegrationTest {
.andExpect(jsonPath("$.[?(@.filename=='filename2')]", hasSize(1)));
}
@Test
@Description("Forced deployment to a controller. Checks if the resource response payload for a given deployment is as expected.")
void deploymentForceAction() throws Exception {
/**
* Forced deployment to a controller. Checks if the resource response payload for a given deployment is as expected.
*/
@Test void deploymentForceAction() throws Exception {
// Prepare test data
final DistributionSet ds = testdataFactory.createDistributionSet("", true);
final DistributionSet ds2 = testdataFactory.createDistributionSet("2", true);
@@ -193,9 +195,10 @@ class DdiDeploymentBaseTest extends AbstractDDiApiIntegrationTest {
assertThat(actionStatusMessage.getStatus()).isEqualTo(Status.RETRIEVED);
}
@Test
@Description("Checks that the deploymentBase URL changes when the action is switched from soft to forced in TIMEFORCED case.")
void changeEtagIfActionSwitchesFromSoftToForced() throws Exception {
/**
* Checks that the deploymentBase URL changes when the action is switched from soft to forced in TIMEFORCED case.
*/
@Test void changeEtagIfActionSwitchesFromSoftToForced() throws Exception {
// Prepare test data
final Target target = testdataFactory.createTarget(DEFAULT_CONTROLLER_ID);
final DistributionSet ds = testdataFactory.createDistributionSet("", true);
@@ -229,9 +232,10 @@ class DdiDeploymentBaseTest extends AbstractDDiApiIntegrationTest {
.toString()).isNotEqualTo(urlBeforeSwitch);
}
@Test
@Description("Attempt/soft deployment to a controller. Checks if the resource response payload for a given deployment is as expected.")
void deploymentAttemptAction() throws Exception {
/**
* Attempt/soft deployment to a controller. Checks if the resource response payload for a given deployment is as expected.
*/
@Test void deploymentAttemptAction() throws Exception {
// Prepare test data
final DistributionSet ds = testdataFactory.createDistributionSet("", true);
final DistributionSet ds2 = testdataFactory.createDistributionSet("2", true);
@@ -292,9 +296,10 @@ class DdiDeploymentBaseTest extends AbstractDDiApiIntegrationTest {
assertThat(actionStatusMessage.getStatus()).isEqualTo(Status.RETRIEVED);
}
@Test
@Description("Attempt/soft deployment to a controller including automated switch to hard. Checks if the resource response payload for a given deployment is as expected.")
void deploymentAutoForceAction() throws Exception {
/**
* Attempt/soft deployment to a controller including automated switch to hard. Checks if the resource response payload for a given deployment is as expected.
*/
@Test void deploymentAutoForceAction() throws Exception {
// Prepare test data
final DistributionSet ds = testdataFactory.createDistributionSet("", true);
final DistributionSet ds2 = testdataFactory.createDistributionSet("2", true);
@@ -350,9 +355,10 @@ class DdiDeploymentBaseTest extends AbstractDDiApiIntegrationTest {
assertThat(actionStatusMessage.getStatus()).isEqualTo(Status.RETRIEVED);
}
@Test
@Description("Test download-only (forced + skip) deployment to a controller. Checks if the resource response payload for a given deployment is as expected.")
void deploymentDownloadOnlyAction() throws Exception {
/**
* Test download-only (forced + skip) deployment to a controller. Checks if the resource response payload for a given deployment is as expected.
*/
@Test void deploymentDownloadOnlyAction() throws Exception {
// Prepare test data
final DistributionSet ds = testdataFactory.createDistributionSet("", true);
final DistributionSet ds2 = testdataFactory.createDistributionSet("2", true);
@@ -411,9 +417,10 @@ class DdiDeploymentBaseTest extends AbstractDDiApiIntegrationTest {
assertThat(actionStatusMessage.getStatus()).isEqualTo(Status.RETRIEVED);
}
@Test
@Description("Test various invalid access attempts to the deployment resource und the expected behaviour of the server.")
void badDeploymentAction() throws Exception {
/**
* Test various invalid access attempts to the deployment resource und the expected behaviour of the server.
*/
@Test void badDeploymentAction() throws Exception {
final Target target = testdataFactory.createTarget(DEFAULT_CONTROLLER_ID);
// not allowed methods
@@ -455,9 +462,11 @@ class DdiDeploymentBaseTest extends AbstractDDiApiIntegrationTest {
.andExpect(status().isNotAcceptable());
}
/**
* The server protects itself against to many feedback upload attempts. The test verifies that
* it is not possible to exceed the configured maximum number of feedback uploads.
*/
@Test
@Description("The server protects itself against to many feedback upload attempts. The test verifies that " +
"it is not possible to exceed the configured maximum number of feedback uploads.")
void tooMuchDeploymentActionFeedback() throws Exception {
final Target target = testdataFactory.createTarget(DEFAULT_CONTROLLER_ID);
final DistributionSet ds = testdataFactory.createDistributionSet("");
@@ -474,9 +483,11 @@ class DdiDeploymentBaseTest extends AbstractDDiApiIntegrationTest {
postDeploymentFeedback(DEFAULT_CONTROLLER_ID, action.getId(), feedback, status().isForbidden());
}
/**
* The server protects itself against too large feedback bodies. The test verifies that
* it is not possible to exceed the configured maximum number of feedback details.
*/
@Test
@Description("The server protects itself against too large feedback bodies. The test verifies that " +
"it is not possible to exceed the configured maximum number of feedback details.")
void tooMuchDeploymentActionMessagesInFeedback() throws Exception {
final Target target = testdataFactory.createTarget(DEFAULT_CONTROLLER_ID);
final DistributionSet ds = testdataFactory.createDistributionSet("");
@@ -493,9 +504,10 @@ class DdiDeploymentBaseTest extends AbstractDDiApiIntegrationTest {
postDeploymentFeedback(DEFAULT_CONTROLLER_ID, action.getId(), feedback, status().isForbidden());
}
@Test
@Description("Multiple uploads of deployment status feedback to the server.")
void multipleDeploymentActionFeedback() throws Exception {
/**
* Multiple uploads of deployment status feedback to the server.
*/
@Test void multipleDeploymentActionFeedback() throws Exception {
testdataFactory.createTarget(DEFAULT_CONTROLLER_ID);
testdataFactory.createTarget("4713");
testdataFactory.createTarget("4714");
@@ -533,9 +545,10 @@ class DdiDeploymentBaseTest extends AbstractDDiApiIntegrationTest {
assertStatusMessagesCount(6);
}
@Test
@Description("Verifies that an update action is correctly set to error if the controller provides error feedback.")
void rootRsSingleDeploymentActionWithErrorFeedback() throws Exception {
/**
* Verifies that an update action is correctly set to error if the controller provides error feedback.
*/
@Test void rootRsSingleDeploymentActionWithErrorFeedback() throws Exception {
DistributionSet ds = testdataFactory.createDistributionSet("");
final Target savedTarget = testdataFactory.createTarget(DEFAULT_CONTROLLER_ID);
@@ -569,9 +582,10 @@ class DdiDeploymentBaseTest extends AbstractDDiApiIntegrationTest {
.haveAtLeast(1, new ActionStatusCondition(Status.FINISHED));
}
@Test
@Description("Verifies that the controller can provided as much feedback entries as necessary as long as it is in the configured limits.")
void rootRsSingleDeploymentActionFeedback() throws Exception {
/**
* Verifies that the controller can provided as much feedback entries as necessary as long as it is in the configured limits.
*/
@Test void rootRsSingleDeploymentActionFeedback() throws Exception {
final DistributionSet ds = testdataFactory.createDistributionSet("");
final Long actionId = getFirstAssignedActionId(
assignDistributionSet(ds,
@@ -609,9 +623,10 @@ class DdiDeploymentBaseTest extends AbstractDDiApiIntegrationTest {
assertThat(targetManagement.findByAssignedDistributionSet(ds.getId(), PAGE)).hasSize(1);
}
@Test
@Description("Various forbidden request attempts on the feedback resource. Ensures correct answering behaviour as expected to these kind of errors.")
void badDeploymentActionFeedback() throws Exception {
/**
* Various forbidden request attempts on the feedback resource. Ensures correct answering behaviour as expected to these kind of errors.
*/
@Test void badDeploymentActionFeedback() throws Exception {
final DistributionSet savedSet = testdataFactory.createDistributionSet("");
final DistributionSet savedSet2 = testdataFactory.createDistributionSet("1");
@@ -647,9 +662,10 @@ class DdiDeploymentBaseTest extends AbstractDDiApiIntegrationTest {
.andExpect(status().isMethodNotAllowed());
}
@Test
@Description("Ensures that an invalid id in feedback body returns a bad request.")
@ExpectEvents({
/**
* Ensures that an invalid id in feedback body returns a bad request.
*/
@Test @ExpectEvents({
@Expect(type = TargetCreatedEvent.class, count = 1),
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3),
@@ -668,9 +684,10 @@ class DdiDeploymentBaseTest extends AbstractDDiApiIntegrationTest {
postDeploymentFeedback("1080", action.getId(), invalidFeedback, status().isBadRequest());
}
@Test
@Description("Ensures that a missing feedback result in feedback body returns a bad request.")
@ExpectEvents({
/**
* Ensures that a missing feedback result in feedback body returns a bad request.
*/
@Test @ExpectEvents({
@Expect(type = TargetCreatedEvent.class, count = 1),
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3),
@@ -693,9 +710,10 @@ class DdiDeploymentBaseTest extends AbstractDDiApiIntegrationTest {
.andExpect(jsonPath("$.exceptionClass", equalTo(MessageNotReadableException.class.getName())));
}
@Test
@Description("Ensures that a missing finished result in feedback body returns a bad request.")
@ExpectEvents({
/**
* Ensures that a missing finished result in feedback body returns a bad request.
*/
@Test @ExpectEvents({
@Expect(type = TargetCreatedEvent.class, count = 1),
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3),

View File

@@ -27,9 +27,6 @@ import java.util.Collections;
import java.util.List;
import java.util.stream.Stream;
import io.qameta.allure.Description;
import io.qameta.allure.Feature;
import io.qameta.allure.Story;
import org.eclipse.hawkbit.ddi.json.model.DdiResult;
import org.eclipse.hawkbit.ddi.json.model.DdiStatus;
import org.eclipse.hawkbit.ddi.rest.api.DdiRestConstants;
@@ -66,9 +63,10 @@ import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
/**
* Test installed base from the controller.
* <p/>
* Feature: Component Tests - Direct Device Integration API<br/>
* Story: Installed Base Resource
*/
@Feature("Component Tests - Direct Device Integration API")
@Story("Installed Base Resource")
class DdiInstalledBaseTest extends AbstractDDiApiIntegrationTest {
@Autowired
@@ -76,9 +74,10 @@ class DdiInstalledBaseTest extends AbstractDDiApiIntegrationTest {
private static final int ARTIFACT_SIZE = 5 * 1024;
private static final String CONTROLLER_ID = "4715";
@Test
@Description("Ensure that the installed base resource is available as CBOR")
void installedBaseResourceCbor() throws Exception {
/**
* Ensure that the installed base resource is available as CBOR
*/
@Test void installedBaseResourceCbor() throws Exception {
final Target target = testdataFactory.createTarget();
final DistributionSet ds = testdataFactory.createDistributionSet("");
@@ -98,9 +97,10 @@ class DdiInstalledBaseTest extends AbstractDDiApiIntegrationTest {
String.valueOf(softwareModuleId));
}
@Test
@Description("Ensure that assigned version is self assigned version")
void installedVersion() throws Exception {
/**
* Ensure that assigned version is self assigned version
*/
@Test void installedVersion() throws Exception {
final Target target = createTargetAndAssertNoActiveActions();
final DistributionSet ds = testdataFactory.createDistributionSet("");
@@ -113,9 +113,10 @@ class DdiInstalledBaseTest extends AbstractDDiApiIntegrationTest {
putInstalledBase(target.getControllerId(), getJsonInstalledBase(ds.getName(), ds.getVersion()), status().isOk());
}
@Test
@Description("Ensure that installedVersion is version self assigned")
void installedVersionNotExist() throws Exception {
/**
* Ensure that installedVersion is version self assigned
*/
@Test void installedVersionNotExist() throws Exception {
final Target target = createTargetAndAssertNoActiveActions();
final String dsName = "unknown";
final String dsVersion = "1.0.0";
@@ -126,9 +127,10 @@ class DdiInstalledBaseTest extends AbstractDDiApiIntegrationTest {
assertThat(deploymentManagement.getAssignedDistributionSet(target.getControllerId()).isEmpty()).isTrue();
}
@Test
@Description("Test several deployments to a controller. Checks that action is represented as installedBase after installation.")
void deploymentSeveralActionsInInstalledBase() throws Exception {
/**
* Test several deployments to a controller. Checks that action is represented as installedBase after installation.
*/
@Test void deploymentSeveralActionsInInstalledBase() throws Exception {
// Prepare test data
final Target target = createTargetAndAssertNoActiveActions();
@@ -194,9 +196,10 @@ class DdiInstalledBaseTest extends AbstractDDiApiIntegrationTest {
actionId1, ds1.findFirstModuleByType(osType).get().getId(), Action.ActionType.SOFT);
}
@Test
@Description("Test several deployments of same ds to a controller. Checks that cancelled action in history is not linked as installedBase.")
void deploymentActionsOfSameDsWithCancelledActionInHistory() throws Exception {
/**
* Test several deployments of same ds to a controller. Checks that cancelled action in history is not linked as installedBase.
*/
@Test void deploymentActionsOfSameDsWithCancelledActionInHistory() throws Exception {
// Prepare test data
final Target target = createTargetAndAssertNoActiveActions();
@@ -250,9 +253,10 @@ class DdiInstalledBaseTest extends AbstractDDiApiIntegrationTest {
.andExpect(status().isNotFound());
}
@Test
@Description("Test several deployments of same ds to a controller. Checks that latest cancelled action does not override actual installed ds.")
void deploymentActionsOfSameDsWithCancelledAction() throws Exception {
/**
* Test several deployments of same ds to a controller. Checks that latest cancelled action does not override actual installed ds.
*/
@Test void deploymentActionsOfSameDsWithCancelledAction() throws Exception {
// Prepare test data
final Target target = createTargetAndAssertNoActiveActions();
@@ -307,9 +311,10 @@ class DdiInstalledBaseTest extends AbstractDDiApiIntegrationTest {
.andExpect(status().isNotFound());
}
@Test
@Description("Test several deployments of same ds to a controller. Checks that latest running action does not override actual installed ds.")
void deploymentActionsOfSameDsWithRunningAction() throws Exception {
/**
* Test several deployments of same ds to a controller. Checks that latest running action does not override actual installed ds.
*/
@Test void deploymentActionsOfSameDsWithRunningAction() throws Exception {
// Prepare test data
final Target target = createTargetAndAssertNoActiveActions();
@@ -360,9 +365,10 @@ class DdiInstalledBaseTest extends AbstractDDiApiIntegrationTest {
.andExpect(status().isNotFound());
}
@Test
@Description("Test open deployment to a controller. Checks that installedBase returns 404 for a pending action.")
void installedBaseReturns404ForPendingAction() throws Exception {
/**
* Test open deployment to a controller. Checks that installedBase returns 404 for a pending action.
*/
@Test void installedBaseReturns404ForPendingAction() throws Exception {
// Prepare test data
final Target target = createTargetAndAssertNoActiveActions();
final DistributionSet ds = testdataFactory.createDistributionSet("");
@@ -383,9 +389,10 @@ class DdiInstalledBaseTest extends AbstractDDiApiIntegrationTest {
.andExpect(status().isNotFound());
}
@Test
@Description("Ensures that artifacts are found, after the action was already closed.")
void artifactsOfInstalledActionExist() throws Exception {
/**
* Ensures that artifacts are found, after the action was already closed.
*/
@Test void artifactsOfInstalledActionExist() throws Exception {
final Target target = createTargetAndAssertNoActiveActions();
final DistributionSet ds = testdataFactory.createDistributionSet("");
@@ -404,9 +411,11 @@ class DdiInstalledBaseTest extends AbstractDDiApiIntegrationTest {
.andExpect(jsonPath("$.[?(@.filename=='filename2')]", hasSize(1)));
}
/**
* Test forced deployment to a controller. Checks that action is represented as installedBase after installation.
*/
@ParameterizedTest
@MethodSource("org.eclipse.hawkbit.ddi.rest.resource.DdiInstalledBaseTest#actionTypeForDeployment")
@Description("Test forced deployment to a controller. Checks that action is represented as installedBase after installation.")
@ExpectEvents({
@Expect(type = TargetCreatedEvent.class, count = 1),
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
@@ -458,9 +467,10 @@ class DdiInstalledBaseTest extends AbstractDDiApiIntegrationTest {
assertThat(actionStatusMessage.getStatus()).isEqualTo(Action.Status.FINISHED);
}
@Test
@Description("Test download-only deployment to a controller. Checks that download-only is not represented as installedBase.")
@ExpectEvents({
/**
* Test download-only deployment to a controller. Checks that download-only is not represented as installedBase.
*/
@Test @ExpectEvents({
@Expect(type = TargetCreatedEvent.class, count = 1),
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3),
@@ -498,9 +508,11 @@ class DdiInstalledBaseTest extends AbstractDDiApiIntegrationTest {
.andExpect(jsonPath("$._links.installedBase.href").doesNotExist());
}
/**
* Test a failed deployment to a controller. Checks that closed action is not represented as installedBase.
*/
@ParameterizedTest
@MethodSource("org.eclipse.hawkbit.ddi.rest.resource.DdiInstalledBaseTest#actionTypeForDeployment")
@Description("Test a failed deployment to a controller. Checks that closed action is not represented as installedBase.")
void deploymentActionFailedNotInInstalledBase(final Action.ActionType actionType) throws Exception {
// Prepare test data
final Target target = testdataFactory.createTarget();
@@ -532,9 +544,10 @@ class DdiInstalledBaseTest extends AbstractDDiApiIntegrationTest {
.andExpect(jsonPath("$._links.installedBase.href").doesNotExist());
}
@Test
@Description("Test to verify that only a specific count of messages are returned based on the input actionHistory for getControllerInstalledAction endpoint.")
void testActionHistoryCount() throws Exception {
/**
* Test to verify that only a specific count of messages are returned based on the input actionHistory for getControllerInstalledAction endpoint.
*/
@Test void testActionHistoryCount() throws Exception {
final DistributionSet ds = testdataFactory.createDistributionSet("");
Target savedTarget = testdataFactory.createTarget("911");
savedTarget = getFirstAssignedTarget(assignDistributionSet(ds.getId(), savedTarget.getControllerId()));
@@ -583,9 +596,10 @@ class DdiInstalledBaseTest extends AbstractDDiApiIntegrationTest {
.andExpect(jsonPath("$.actionHistory.messages", hasItem(containsString("Installation scheduled"))));
}
@Test
@Description("Test various invalid access attempts to the installed resource und the expected behaviour of the server.")
void badInstalledAction() throws Exception {
/**
* Test various invalid access attempts to the installed resource und the expected behaviour of the server.
*/
@Test void badInstalledAction() throws Exception {
final Target target = testdataFactory.createTarget(CONTROLLER_ID);
// not allowed methods

View File

@@ -31,10 +31,6 @@ import java.util.Collections;
import java.util.Map;
import java.util.UUID;
import io.qameta.allure.Description;
import io.qameta.allure.Feature;
import io.qameta.allure.Step;
import io.qameta.allure.Story;
import org.eclipse.hawkbit.ddi.json.model.DdiResult;
import org.eclipse.hawkbit.ddi.json.model.DdiStatus;
import org.eclipse.hawkbit.ddi.rest.api.DdiRestConstants;
@@ -73,9 +69,10 @@ import org.springframework.test.web.servlet.ResultActions;
/**
* Test the root controller resources.
* <p/>
* Feature: Component Tests - Direct Device Integration API<br/>
* Story: Root Poll Resource
*/
@Feature("Component Tests - Direct Device Integration API")
@Story("Root Poll Resource")
class DdiRootControllerTest extends AbstractDDiApiIntegrationTest {
private static final String TARGET_COMPLETED_INSTALLATION_MSG = "Target completed installation.";
@@ -85,18 +82,20 @@ class DdiRootControllerTest extends AbstractDDiApiIntegrationTest {
@Autowired
private HawkbitSecurityProperties securityProperties;
@Test
@Description("Ensure that the root poll resource is available as CBOR")
void rootPollResourceCbor() throws Exception {
/**
* Ensure that the root poll resource is available as CBOR
*/
@Test void rootPollResourceCbor() throws Exception {
mvc.perform(get(CONTROLLER_BASE, tenantAware.getCurrentTenant(), 4711).accept(DdiRestConstants.MEDIA_TYPE_CBOR))
.andDo(MockMvcResultPrinter.print())
.andExpect(content().contentType(DdiRestConstants.MEDIA_TYPE_CBOR))
.andExpect(status().isOk());
}
@Test
@Description("Ensures that the API returns JSON when no Accept header is specified by the client.")
void apiReturnsJSONByDefault() throws Exception {
/**
* Ensures that the API returns JSON when no Accept header is specified by the client.
*/
@Test void apiReturnsJSONByDefault() throws Exception {
final MvcResult result = mvc.perform(get(CONTROLLER_BASE, tenantAware.getCurrentTenant(), 4711))
.andDo(MockMvcResultPrinter.print())
.andExpect(status().isOk())
@@ -107,9 +106,10 @@ class DdiRootControllerTest extends AbstractDDiApiIntegrationTest {
assertThat(result.getRequest().getHeader("Accept")).isNull();
}
@Test
@Description("Ensures that target poll request does not change audit data on the entity.")
@WithUser(principal = "knownPrincipal", authorities = { SpPermission.READ_TARGET, SpPermission.UPDATE_TARGET, SpPermission.CREATE_TARGET })
/**
* Ensures that target poll request does not change audit data on the entity.
*/
@Test @WithUser(principal = "knownPrincipal", authorities = { SpPermission.READ_TARGET, SpPermission.UPDATE_TARGET, SpPermission.CREATE_TARGET })
@ExpectEvents({
@Expect(type = TargetCreatedEvent.class, count = 1),
@Expect(type = TargetUpdatedEvent.class, count = 1),
@@ -139,18 +139,20 @@ class DdiRootControllerTest extends AbstractDDiApiIntegrationTest {
assertThat(targetVerify.getLastModifiedAt()).isEqualTo(findTargetByControllerID.getLastModifiedAt());
}
@Test
@Description("Ensures that server returns a not found response in case of empty controller ID.")
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class, count = 0) })
/**
* Ensures that server returns a not found response in case of empty controller ID.
*/
@Test @ExpectEvents({ @Expect(type = TargetCreatedEvent.class, count = 0) })
void rootRsWithoutId() throws Exception {
mvc.perform(get("/controller/v1/"))
.andDo(MockMvcResultPrinter.print())
.andExpect(status().isNotFound());
}
@Test
@Description("Ensures that the system creates a new target in plug and play manner, i.e. target is authenticated but does not exist yet.")
@ExpectEvents({
/**
* Ensures that the system creates a new target in plug and play manner, i.e. target is authenticated but does not exist yet.
*/
@Test @ExpectEvents({
@Expect(type = TargetCreatedEvent.class, count = 1),
@Expect(type = TargetPollEvent.class, count = 1) })
void rootRsPlugAndPlay() throws Exception {
@@ -183,9 +185,10 @@ class DdiRootControllerTest extends AbstractDDiApiIntegrationTest {
.andExpect(status().isMethodNotAllowed());
}
@Test
@Description("Ensures that tenant specific polling time, which is saved in the db, is delivered to the controller.")
@WithUser(principal = "knownpricipal", allSpPermissions = false)
/**
* Ensures that tenant specific polling time, which is saved in the db, is delivered to the controller.
*/
@Test @WithUser(principal = "knownpricipal", allSpPermissions = false)
@ExpectEvents({
@Expect(type = TargetCreatedEvent.class, count = 1),
@Expect(type = TargetPollEvent.class, count = 1),
@@ -207,9 +210,10 @@ class DdiRootControllerTest extends AbstractDDiApiIntegrationTest {
});
}
@Test
@Description("Ensures that etag check results in not modified response if provided etag by client is identical to entity in repository.")
@ExpectEvents({
/**
* Ensures that etag check results in not modified response if provided etag by client is identical to entity in repository.
*/
@Test @ExpectEvents({
@Expect(type = TargetCreatedEvent.class, count = 1),
@Expect(type = TargetPollEvent.class, count = 6),
@Expect(type = TargetAssignDistributionSetEvent.class, count = 2),
@@ -304,9 +308,11 @@ class DdiRootControllerTest extends AbstractDDiApiIntegrationTest {
}
/**
* Ensures that the target state machine of a precomissioned target switches from
* UNKNOWN to REGISTERED when the target polls for the first time.
*/
@Test
@Description("Ensures that the target state machine of a precomissioned target switches from "
+ "UNKNOWN to REGISTERED when the target polls for the first time.")
@ExpectEvents({
@Expect(type = TargetCreatedEvent.class, count = 1),
@Expect(type = TargetUpdatedEvent.class, count = 1),
@@ -333,9 +339,10 @@ class DdiRootControllerTest extends AbstractDDiApiIntegrationTest {
.isEqualTo(TargetUpdateStatus.REGISTERED);
}
@Test
@Description("Ensures that the source IP address of the polling target is correctly stored in repository")
@ExpectEvents({
/**
* Ensures that the source IP address of the polling target is correctly stored in repository
*/
@Test @ExpectEvents({
@Expect(type = TargetCreatedEvent.class, count = 1),
@Expect(type = TargetPollEvent.class, count = 1) })
void rootRsPlugAndPlayIpAddress() throws Exception {
@@ -361,9 +368,10 @@ class DdiRootControllerTest extends AbstractDDiApiIntegrationTest {
assertThat(target.getLastModifiedAt()).isGreaterThanOrEqualTo(create);
}
@Test
@Description("Ensures that the source IP address of the polling target is not stored in repository if disabled")
@ExpectEvents({
/**
* Ensures that the source IP address of the polling target is not stored in repository if disabled
*/
@Test @ExpectEvents({
@Expect(type = TargetCreatedEvent.class, count = 1),
@Expect(type = TargetPollEvent.class, count = 1) })
void rootRsIpAddressNotStoredIfDisabled() throws Exception {
@@ -382,9 +390,10 @@ class DdiRootControllerTest extends AbstractDDiApiIntegrationTest {
securityProperties.getClients().setTrackRemoteIp(true);
}
@Test
@Description("Controller trys to finish an update process after it has been finished by an error action status.")
@ExpectEvents({
/**
* Controller trys to finish an update process after it has been finished by an error action status.
*/
@Test @ExpectEvents({
@Expect(type = TargetCreatedEvent.class, count = 1),
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3),
@@ -413,9 +422,10 @@ class DdiRootControllerTest extends AbstractDDiApiIntegrationTest {
.andExpect(status().isGone());
}
@Test
@Description("Controller sends attribute update request after device successfully closed software update.")
@ExpectEvents({
/**
* Controller sends attribute update request after device successfully closed software update.
*/
@Test @ExpectEvents({
@Expect(type = TargetCreatedEvent.class, count = 1),
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3),
@@ -443,9 +453,10 @@ class DdiRootControllerTest extends AbstractDDiApiIntegrationTest {
assertAttributesUpdateRequestedAfterSuccessfulDeployment(savedTarget, ds);
}
@Test
@Description("Test to verify that only a specific count of messages are returned based on the input actionHistory for getControllerDeploymentActionFeedback endpoint.")
@ExpectEvents({
/**
* Test to verify that only a specific count of messages are returned based on the input actionHistory for getControllerDeploymentActionFeedback endpoint.
*/
@Test @ExpectEvents({
@Expect(type = TargetCreatedEvent.class, count = 1),
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3),
@@ -487,9 +498,10 @@ class DdiRootControllerTest extends AbstractDDiApiIntegrationTest {
not(hasItem(containsString(TARGET_SCHEDULED_INSTALLATION_MSG)))));
}
@Test
@Description("Test to verify that a zero input value of actionHistory results in no action history appended for getControllerDeploymentActionFeedback endpoint.")
@ExpectEvents({
/**
* Test to verify that a zero input value of actionHistory results in no action history appended for getControllerDeploymentActionFeedback endpoint.
*/
@Test @ExpectEvents({
@Expect(type = TargetCreatedEvent.class, count = 1),
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3),
@@ -531,9 +543,10 @@ class DdiRootControllerTest extends AbstractDDiApiIntegrationTest {
.andExpect(jsonPath("$.actionHistory.messages").doesNotExist());
}
@Test
@Description("Test to verify that entire action history is returned if the input value for actionHistory is -1, for getControllerDeploymentActionFeedback endpoint.")
@ExpectEvents({
/**
* Test to verify that entire action history is returned if the input value for actionHistory is -1, for getControllerDeploymentActionFeedback endpoint.
*/
@Test @ExpectEvents({
@Expect(type = TargetCreatedEvent.class, count = 1),
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3),
@@ -575,9 +588,10 @@ class DdiRootControllerTest extends AbstractDDiApiIntegrationTest {
hasItem(containsString(TARGET_COMPLETED_INSTALLATION_MSG))));
}
@Test
@Description("Test the polling time based on different maintenance window start and end time.")
void sleepTimeResponseForDifferentMaintenanceWindowParameters() throws Exception {
/**
* Test the polling time based on different maintenance window start and end time.
*/
@Test void sleepTimeResponseForDifferentMaintenanceWindowParameters() throws Exception {
final DistributionSet ds = testdataFactory.createDistributionSet("");
SecurityContextSwitch.runAs(SecurityContextSwitch.withUser("tenantadmin", TENANT_CONFIGURATION),
@@ -625,9 +639,10 @@ class DdiRootControllerTest extends AbstractDDiApiIntegrationTest {
.andExpect(jsonPath("$.config.polling.sleep", equalTo("00:05:00")));
}
@Test
@Description("Test download and update values before maintenance window start time.")
void downloadAndUpdateStatusBeforeMaintenanceWindowStartTime() throws Exception {
/**
* Test download and update values before maintenance window start time.
*/
@Test void downloadAndUpdateStatusBeforeMaintenanceWindowStartTime() throws Exception {
Target savedTarget = testdataFactory.createTarget("1911");
final DistributionSet ds = testdataFactory.createDistributionSet("");
savedTarget = getFirstAssignedTarget(assignDistributionSetWithMaintenanceWindow(ds.getId(),
@@ -647,9 +662,10 @@ class DdiRootControllerTest extends AbstractDDiApiIntegrationTest {
.andExpect(jsonPath("$.deployment.maintenanceWindow", equalTo("unavailable")));
}
@Test
@Description("Test download and update values after maintenance window start time.")
void downloadAndUpdateStatusDuringMaintenanceWindow() throws Exception {
/**
* Test download and update values after maintenance window start time.
*/
@Test void downloadAndUpdateStatusDuringMaintenanceWindow() throws Exception {
Target savedTarget = testdataFactory.createTarget("1911");
final DistributionSet ds = testdataFactory.createDistributionSet("");
savedTarget = getFirstAssignedTarget(assignDistributionSetWithMaintenanceWindow(ds.getId(),
@@ -669,9 +685,10 @@ class DdiRootControllerTest extends AbstractDDiApiIntegrationTest {
.andExpect(jsonPath("$.deployment.maintenanceWindow", equalTo("available")));
}
@Test
@Description("Assign multiple DS in multi-assignment mode. The earliest active Action is exposed to the controller.")
void earliestActionIsExposedToControllerInMultiAssignMode() throws Exception {
/**
* Assign multiple DS in multi-assignment mode. The earliest active Action is exposed to the controller.
*/
@Test void earliestActionIsExposedToControllerInMultiAssignMode() throws Exception {
enableMultiAssignments();
final Target target = testdataFactory.createTarget();
final DistributionSet ds1 = testdataFactory.createDistributionSet(UUID.randomUUID().toString());
@@ -684,15 +701,15 @@ class DdiRootControllerTest extends AbstractDDiApiIntegrationTest {
assertDeploymentActionIsExposedToTarget(target.getControllerId(), action2Id);
}
@Test
@Description("The system should not create a new target because of a too long controller id.")
void rootRsWithInvalidControllerId() throws Exception {
/**
* The system should not create a new target because of a too long controller id.
*/
@Test void rootRsWithInvalidControllerId() throws Exception {
final String invalidControllerId = randomString(Target.CONTROLLER_ID_MAX_SIZE + 1);
mvc.perform(get(CONTROLLER_BASE, tenantAware.getCurrentTenant(), invalidControllerId))
.andExpect(status().isBadRequest());
}
@Step
private void assertAttributesUpdateNotRequestedAfterFailedDeployment(Target target, final DistributionSet ds) throws Exception {
target = getFirstAssignedTarget(assignDistributionSet(ds.getId(), target.getControllerId()));
final Action action = deploymentManagement.findActiveActionsByTarget(target.getControllerId(), PAGE).getContent().get(0);
@@ -701,7 +718,6 @@ class DdiRootControllerTest extends AbstractDDiApiIntegrationTest {
assertThatAttributesUpdateIsNotRequested(target.getControllerId());
}
@Step
private void assertAttributesUpdateRequestedAfterSuccessfulDeployment(Target target, final DistributionSet ds) throws Exception {
target = getFirstAssignedTarget(assignDistributionSet(ds.getId(), target.getControllerId()));
final Action action = deploymentManagement.findActiveActionsByTarget(target.getControllerId(), PAGE).getContent().get(0);

View File

@@ -17,9 +17,6 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
import java.util.Collections;
import java.util.List;
import io.qameta.allure.Description;
import io.qameta.allure.Feature;
import io.qameta.allure.Story;
import org.eclipse.hawkbit.repository.model.Action;
import org.eclipse.hawkbit.repository.model.DistributionSet;
import org.eclipse.hawkbit.repository.model.Target;
@@ -37,8 +34,10 @@ import org.springframework.web.context.WebApplicationContext;
* Test potential DOS attack scenarios and check if the filter prevents them.
*/
@ActiveProfiles({ "test" })
@Feature("Component Tests - REST Security")
@Story("Denial of Service protection filter")
/**
* Feature: Component Tests - REST Security<br/>
* Story: Denial of Service protection filter
*/
class DosFilterTest extends AbstractDDiApiIntegrationTest {
private static final String X_FORWARDED_FOR = HawkbitSecurityProperties.Clients.X_FORWARDED_FOR;
@@ -49,17 +48,19 @@ class DosFilterTest extends AbstractDDiApiIntegrationTest {
new DosFilter(null, 10, 10, "127\\.0\\.0\\.1|\\[0:0:0:0:0:0:0:1\\]", "(^192\\.168\\.)", "X-Forwarded-For"));
}
@Test
@Description("Ensures that clients that are on the blacklist are forbidden")
void blackListedClientIsForbidden() throws Exception {
/**
* Ensures that clients that are on the blacklist are forbidden
*/
@Test void blackListedClientIsForbidden() throws Exception {
mvc.perform(get("/{tenant}/controller/v1/4711", tenantAware.getCurrentTenant())
.header(X_FORWARDED_FOR, "192.168.0.4 , 10.0.0.1 "))
.andExpect(status().isForbidden());
}
@Test
@Description("Ensures that a READ DoS attempt is blocked ")
void getFloodingAttackThatIsPrevented() throws Exception {
/**
* Ensures that a READ DoS attempt is blocked
*/
@Test void getFloodingAttackThatIsPrevented() throws Exception {
int requests = 0;
MvcResult result;
do {
@@ -76,9 +77,10 @@ class DosFilterTest extends AbstractDDiApiIntegrationTest {
assertThat(requests).isGreaterThanOrEqualTo(10);
}
@Test
@Description("Ensures that an assumed READ DoS attempt is not blocked as the client (with IPv4 address) is on a whitelist")
void unacceptableGetLoadButOnWhitelistIPv4() throws Exception {
/**
* Ensures that an assumed READ DoS attempt is not blocked as the client (with IPv4 address) is on a whitelist
*/
@Test void unacceptableGetLoadButOnWhitelistIPv4() throws Exception {
for (int i = 0; i < 100; i++) {
mvc.perform(get("/{tenant}/controller/v1/4711", tenantAware.getCurrentTenant())
.header(X_FORWARDED_FOR, "127.0.0.1"))
@@ -86,9 +88,10 @@ class DosFilterTest extends AbstractDDiApiIntegrationTest {
}
}
@Test
@Description("Ensures that an assumed READ DoS attempt is not blocked as the client (with IPv6 address) is on a whitelist")
void unacceptableGetLoadButOnWhitelistIPv6() throws Exception {
/**
* Ensures that an assumed READ DoS attempt is not blocked as the client (with IPv6 address) is on a whitelist
*/
@Test void unacceptableGetLoadButOnWhitelistIPv6() throws Exception {
for (int i = 0; i < 100; i++) {
mvc.perform(get("/{tenant}/controller/v1/4711", tenantAware.getCurrentTenant())
.header(X_FORWARDED_FOR, "0:0:0:0:0:0:0:1"))
@@ -96,9 +99,10 @@ class DosFilterTest extends AbstractDDiApiIntegrationTest {
}
}
@Test
@Description("Ensures that a relatively high number of READ requests is allowed if it is below the DoS detection threshold")
// No idea how to get rid of the Thread.sleep here
/**
* Ensures that a relatively high number of READ requests is allowed if it is below the DoS detection threshold
*/
@Test // No idea how to get rid of the Thread.sleep here
@SuppressWarnings("squid:S2925")
void acceptableGetLoad() throws Exception {
for (int x = 0; x < 3; x++) {
@@ -112,9 +116,10 @@ class DosFilterTest extends AbstractDDiApiIntegrationTest {
}
}
@Test
@Description("Ensures that a WRITE DoS attempt is blocked ")
void putPostFloddingAttackThatisPrevented() throws Exception {
/**
* Ensures that a WRITE DoS attempt is blocked
*/
@Test void putPostFloddingAttackThatisPrevented() throws Exception {
final Long actionId = prepareDeploymentBase();
final String feedback = getJsonProceedingDeploymentActionFeedback();
@@ -135,9 +140,10 @@ class DosFilterTest extends AbstractDDiApiIntegrationTest {
assertThat(requests).isGreaterThanOrEqualTo(10);
}
@Test
@Description("Ensures that a relatively high number of WRITE requests is allowed if it is below the DoS detection threshold")
// No idea how to get rid of the Thread.sleep here
/**
* Ensures that a relatively high number of WRITE requests is allowed if it is below the DoS detection threshold
*/
@Test // No idea how to get rid of the Thread.sleep here
@SuppressWarnings("squid:S2925")
void acceptablePutPostLoad() throws Exception {
final Long actionId = prepareDeploymentBase();

View File

@@ -12,9 +12,6 @@ package org.eclipse.hawkbit.security.controller;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.when;
import io.qameta.allure.Description;
import io.qameta.allure.Feature;
import io.qameta.allure.Story;
import org.eclipse.hawkbit.repository.TenantConfigurationManagement;
import org.eclipse.hawkbit.repository.model.TenantConfigurationValue;
import org.eclipse.hawkbit.security.SecurityContextSerializer;
@@ -28,8 +25,10 @@ import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.Mock;
import org.mockito.junit.jupiter.MockitoExtension;
@Feature("Unit Tests - Security")
@Story("Gateway token authentication")
/**
* Feature: Unit Tests - Security<br/>
* Story: Gateway token authentication
*/
@ExtendWith(MockitoExtension.class)
class GatewayTokenAuthenticatorTest {
@@ -61,9 +60,10 @@ class GatewayTokenAuthenticatorTest {
new SystemSecurityContext(tenantAware));
}
@Test
@Description("Tests successful authentication with gateway token")
void testWithGwToken() {
/**
* Tests successful authentication with gateway token
*/
@Test void testWithGwToken() {
final ControllerSecurityToken securityToken = prepareSecurityToken(GATEWAY_TOKEN);
when(tenantConfigurationManagementMock.getConfigurationValue(
TenantConfigurationKey.AUTHENTICATION_MODE_GATEWAY_SECURITY_TOKEN_KEY, String.class))
@@ -77,9 +77,10 @@ class GatewayTokenAuthenticatorTest {
.hasFieldOrPropertyWithValue("principal", CONTROLLER_ID);
}
@Test
@Description("Tests that if gateway token doesn't match, the authentication fails")
void testWithBadGwToken() {
/**
* Tests that if gateway token doesn't match, the authentication fails
*/
@Test void testWithBadGwToken() {
final ControllerSecurityToken securityToken = prepareSecurityToken(UNKNOWN_TOKEN);
when(tenantConfigurationManagementMock.getConfigurationValue(
TenantConfigurationKey.AUTHENTICATION_MODE_GATEWAY_SECURITY_TOKEN_KEY, String.class))
@@ -91,15 +92,17 @@ class GatewayTokenAuthenticatorTest {
assertThat(authenticator.authenticate(securityToken)).isNull();
}
@Test
@Description("Tests that if gateway token miss, the authentication fails")
void testWithoutGwToken() {
/**
* Tests that if gateway token miss, the authentication fails
*/
@Test void testWithoutGwToken() {
assertThat(authenticator.authenticate(new ControllerSecurityToken("DEFAULT", CONTROLLER_ID))).isNull();
}
@Test
@Description("Tests that if disabled, the authentication fails")
void testWithGwTokenButDisabled() {
/**
* Tests that if disabled, the authentication fails
*/
@Test void testWithGwTokenButDisabled() {
final ControllerSecurityToken securityToken = prepareSecurityToken(GATEWAY_TOKEN);
when(tenantConfigurationManagementMock.getConfigurationValue(
TenantConfigurationKey.AUTHENTICATION_MODE_GATEWAY_SECURITY_TOKEN_ENABLED, Boolean.class))

View File

@@ -12,9 +12,6 @@ package org.eclipse.hawkbit.security.controller;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.when;
import io.qameta.allure.Description;
import io.qameta.allure.Feature;
import io.qameta.allure.Story;
import org.eclipse.hawkbit.repository.TenantConfigurationManagement;
import org.eclipse.hawkbit.repository.model.TenantConfigurationValue;
import org.eclipse.hawkbit.security.SecurityContextSerializer;
@@ -28,8 +25,10 @@ import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.Mock;
import org.mockito.junit.jupiter.MockitoExtension;
@Feature("Unit Tests - Security")
@Story("Security header authenticator")
/**
* Feature: Unit Tests - Security<br/>
* Story: Security header authenticator
*/
@ExtendWith(MockitoExtension.class)
class SecurityHeaderAuthenticatorTest {
@@ -72,9 +71,10 @@ class SecurityHeaderAuthenticatorTest {
);
}
@Test
@Description("Tests successful authentication with multiple a single hashes")
void testWithSingleKnownHash() {
/**
* Tests successful authentication with multiple a single hashes
*/
@Test void testWithSingleKnownHash() {
final ControllerSecurityToken securityToken = prepareSecurityToken(SINGLE_HASH);
when(tenantConfigurationManagementMock.getConfigurationValue(
TenantConfigurationKey.AUTHENTICATION_MODE_HEADER_AUTHORITY_NAME, String.class))
@@ -88,9 +88,10 @@ class SecurityHeaderAuthenticatorTest {
.hasFieldOrPropertyWithValue("principal", CA_COMMON_NAME_VALUE);
}
@Test
@Description("Tests successful authentication with multiple hashes")
void testWithMultipleKnownHashes() {
/**
* Tests successful authentication with multiple hashes
*/
@Test void testWithMultipleKnownHashes() {
when(tenantConfigurationManagementMock.getConfigurationValue(
TenantConfigurationKey.AUTHENTICATION_MODE_HEADER_AUTHORITY_NAME, String.class))
.thenReturn(CONFIG_VALUE_MULTI_HASH);
@@ -109,9 +110,10 @@ class SecurityHeaderAuthenticatorTest {
.hasFieldOrPropertyWithValue("principal", CA_COMMON_NAME_VALUE);
}
@Test
@Description("Tests that if the hash is unknown, the authentication fails")
void testWithUnknownHash() {
/**
* Tests that if the hash is unknown, the authentication fails
*/
@Test void testWithUnknownHash() {
final ControllerSecurityToken securityToken = prepareSecurityToken(UNKNOWN_HASH);
when(tenantConfigurationManagementMock.getConfigurationValue(
TenantConfigurationKey.AUTHENTICATION_MODE_HEADER_AUTHORITY_NAME, String.class))
@@ -123,9 +125,10 @@ class SecurityHeaderAuthenticatorTest {
assertThat(authenticator.authenticate(securityToken)).isNull();
}
@Test
@Description("Tests that if CN doesn't match the CN in the security token, the authentication fails")
void testWithNonMatchingCN() {
/**
* Tests that if CN doesn't match the CN in the security token, the authentication fails
*/
@Test void testWithNonMatchingCN() {
final ControllerSecurityToken securityToken = new ControllerSecurityToken("DEFAULT", "otherControllerID");
securityToken.putHeader(CA_COMMON_NAME, CA_COMMON_NAME_VALUE);
securityToken.putHeader(X_SSL_ISSUER_HASH_1, SINGLE_HASH);
@@ -133,15 +136,17 @@ class SecurityHeaderAuthenticatorTest {
assertThat(authenticator.authenticate(securityToken)).isNull();
}
@Test
@Description("Tests that if the hash miss, the authentication fails")
void testWithoutHash() {
/**
* Tests that if the hash miss, the authentication fails
*/
@Test void testWithoutHash() {
assertThat(authenticator.authenticate(new ControllerSecurityToken("DEFAULT", CA_COMMON_NAME_VALUE))).isNull();
}
@Test
@Description("Tests that if disabled, the authentication fails")
void testWithSingleKnownHashButDisabled() {
/**
* Tests that if disabled, the authentication fails
*/
@Test void testWithSingleKnownHashButDisabled() {
final ControllerSecurityToken securityToken = prepareSecurityToken(SINGLE_HASH);
when(tenantConfigurationManagementMock.getConfigurationValue(
TenantConfigurationKey.AUTHENTICATION_MODE_HEADER_ENABLED, Boolean.class))

View File

@@ -14,9 +14,6 @@ import static org.mockito.Mockito.when;
import java.util.Optional;
import io.qameta.allure.Description;
import io.qameta.allure.Feature;
import io.qameta.allure.Story;
import org.eclipse.hawkbit.repository.ControllerManagement;
import org.eclipse.hawkbit.repository.TenantConfigurationManagement;
import org.eclipse.hawkbit.repository.model.Target;
@@ -33,8 +30,10 @@ import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.junit.jupiter.MockitoExtension;
@Feature("Unit Tests - Security")
@Story("Gateway token authentication")
/**
* Feature: Unit Tests - Security<br/>
* Story: Gateway token authentication
*/
@ExtendWith(MockitoExtension.class)
class SecurityTokenAuthenticatorTest {
@@ -66,9 +65,10 @@ class SecurityTokenAuthenticatorTest {
new SystemSecurityContext(tenantAware), controllerManagementMock);
}
@Test
@Description("Tests successful authentication with gateway token")
void testWithSecToken() {
/**
* Tests successful authentication with gateway token
*/
@Test void testWithSecToken() {
final ControllerSecurityToken securityToken = prepareSecurityToken(SECURITY_TOKEN);
when(tenantConfigurationManagementMock.getConfigurationValue(
TenantConfigurationKey.AUTHENTICATION_MODE_TARGET_SECURITY_TOKEN_ENABLED, Boolean.class))
@@ -84,9 +84,10 @@ class SecurityTokenAuthenticatorTest {
.hasFieldOrPropertyWithValue("principal", CONTROLLER_ID);
}
@Test
@Description("Tests that if gateway token doesn't match, the authentication fails")
void testWithBadSecToken() {
/**
* Tests that if gateway token doesn't match, the authentication fails
*/
@Test void testWithBadSecToken() {
final ControllerSecurityToken securityToken = prepareSecurityToken(UNKNOWN_TOKEN);
when(tenantConfigurationManagementMock.getConfigurationValue(
TenantConfigurationKey.AUTHENTICATION_MODE_TARGET_SECURITY_TOKEN_ENABLED, Boolean.class))
@@ -95,15 +96,17 @@ class SecurityTokenAuthenticatorTest {
assertThat(authenticator.authenticate(securityToken)).isNull();
}
@Test
@Description("Tests that if gateway token miss, the authentication fails")
void testWithoutSecToken() {
/**
* Tests that if gateway token miss, the authentication fails
*/
@Test void testWithoutSecToken() {
assertThat(authenticator.authenticate(new ControllerSecurityToken("DEFAULT", CONTROLLER_ID))).isNull();
}
@Test
@Description("Tests that if disabled, the authentication fails")
void testWithSecTokenButDisabled() {
/**
* Tests that if disabled, the authentication fails
*/
@Test void testWithSecTokenButDisabled() {
final ControllerSecurityToken securityToken = prepareSecurityToken(SECURITY_TOKEN);
when(tenantConfigurationManagementMock.getConfigurationValue(
TenantConfigurationKey.AUTHENTICATION_MODE_TARGET_SECURITY_TOKEN_ENABLED, Boolean.class))

View File

@@ -12,9 +12,6 @@ package org.eclipse.hawkbit.app.ddi;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
import io.qameta.allure.Description;
import io.qameta.allure.Feature;
import io.qameta.allure.Story;
import org.junit.jupiter.api.Test;
import org.springframework.http.HttpHeaders;
import org.springframework.test.context.TestPropertySource;
@@ -23,27 +20,32 @@ import org.springframework.test.context.TestPropertySource;
"spring.flyway.enabled=true", // if hibernate is used there could be db inconsistencies when executing tests with and without flyway
"hawkbit.server.security.allowedHostNames=localhost",
"hawkbit.server.security.httpFirewallIgnoredPaths=/index.html" })
@Feature("Integration Test - Security")
@Story("Allowed Host Names")
/**
* Feature: Integration Test - Security<br/>
* Story: Allowed Host Names
*/
class AllowedHostNamesTest extends AbstractSecurityTest {
@Test
@Description("Tests whether a RequestRejectedException is thrown when not allowed host is used")
void allowedHostNameWithNotAllowedHost() throws Exception {
/**
* Tests whether a RequestRejectedException is thrown when not allowed host is used
*/
@Test void allowedHostNameWithNotAllowedHost() throws Exception {
mvc.perform(get("/").header(HttpHeaders.HOST, "www.google.com"))
.andExpect(status().isBadRequest());
}
@Test
@Description("Tests whether request is redirected when allowed host is used")
void allowedHostNameWithAllowedHost() throws Exception {
/**
* Tests whether request is redirected when allowed host is used
*/
@Test void allowedHostNameWithAllowedHost() throws Exception {
mvc.perform(get("/").header(HttpHeaders.HOST, "localhost"))
.andExpect(status().is3xxRedirection());
}
@Test
@Description("Tests whether request without allowed host name and with ignored path end up with a client error")
void notAllowedHostnameWithIgnoredPath() throws Exception {
/**
* Tests whether request without allowed host name and with ignored path end up with a client error
*/
@Test void notAllowedHostnameWithIgnoredPath() throws Exception {
mvc.perform(get("/index.html").header(HttpHeaders.HOST, "www.google.com"))
.andExpect(status().is4xxClientError());
}

View File

@@ -12,31 +12,32 @@ package org.eclipse.hawkbit.app.ddi;
import static org.assertj.core.api.Assertions.assertThat;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import io.qameta.allure.Description;
import io.qameta.allure.Feature;
import io.qameta.allure.Story;
import org.eclipse.hawkbit.im.authentication.SpPermission;
import org.eclipse.hawkbit.repository.test.util.WithUser;
import org.junit.jupiter.api.Test;
import org.springframework.http.HttpStatus;
import org.springframework.test.context.TestPropertySource;
@Feature("Integration Test - Security")
@Story("PreAuthorized enabled")
/**
* Feature: Integration Test - Security<br/>
* Story: PreAuthorized enabled
*/
@TestPropertySource(properties = { "spring.flyway.enabled=true" })
class PreAuthorizeEnabledTest extends AbstractSecurityTest {
@Test
@Description("Tests whether request fail if a role is forbidden for the user")
@WithUser(authorities = { SpPermission.READ_TARGET }, autoCreateTenant = false)
/**
* Tests whether request fail if a role is forbidden for the user
*/
@Test @WithUser(authorities = { SpPermission.READ_TARGET }, autoCreateTenant = false)
void failIfNoRole() throws Exception {
mvc.perform(get("/DEFAULT/controller/v1/controllerId"))
.andExpect(result -> assertThat(result.getResponse().getStatus()).isEqualTo(HttpStatus.FORBIDDEN.value()));
}
@Test
@Description("Tests whether request succeed if a role is granted for the user")
@WithUser(authorities = { SpPermission.SpringEvalExpressions.CONTROLLER_ROLE }, autoCreateTenant = false)
/**
* Tests whether request succeed if a role is granted for the user
*/
@Test @WithUser(authorities = { SpPermission.SpringEvalExpressions.CONTROLLER_ROLE }, autoCreateTenant = false)
void successIfHasRole() throws Exception {
mvc.perform(get("/DEFAULT/controller/v1/controllerId"))
.andExpect(result -> assertThat(result.getResponse().getStatus()).isEqualTo(HttpStatus.OK.value()));

View File

@@ -23,9 +23,6 @@ import java.util.List;
import java.util.Optional;
import java.util.UUID;
import io.qameta.allure.Description;
import io.qameta.allure.Feature;
import io.qameta.allure.Story;
import org.eclipse.hawkbit.artifact.repository.ArtifactFilesystem;
import org.eclipse.hawkbit.artifact.repository.model.AbstractDbArtifact;
import org.eclipse.hawkbit.artifact.repository.model.DbArtifactHash;
@@ -65,8 +62,10 @@ import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ActiveProfiles;
@ActiveProfiles({ "test" })
@Feature("Component Tests - Device Management Federation API")
@Story("AmqpMessage Dispatcher Service Test")
/**
* Feature: Component Tests - Device Management Federation API<br/>
* Story: AmqpMessage Dispatcher Service Test
*/
@SpringBootTest(classes = { RepositoryApplicationConfiguration.class }, webEnvironment = SpringBootTest.WebEnvironment.NONE)
class AmqpMessageDispatcherServiceTest extends AbstractIntegrationTest {
@@ -116,9 +115,10 @@ class AmqpMessageDispatcherServiceTest extends AbstractIntegrationTest {
return argumentCaptor.getValue();
}
@Test
@Description("Verifies that download and install event with 3 software modules and no artifacts works")
void testSendDownloadRequestWithSoftwareModulesAndNoArtifacts() {
/**
* Verifies that download and install event with 3 software modules and no artifacts works
*/
@Test void testSendDownloadRequestWithSoftwareModulesAndNoArtifacts() {
final DistributionSet createDistributionSet = testdataFactory
.createDistributionSet(UUID.randomUUID().toString());
testdataFactory.addSoftwareModuleMetadata(createDistributionSet);
@@ -155,9 +155,10 @@ class AmqpMessageDispatcherServiceTest extends AbstractIntegrationTest {
}
}
@Test
@Description("Verifies that download and install event with software modules and artifacts works")
void testSendDownloadRequest() {
/**
* Verifies that download and install event with software modules and artifacts works
*/
@Test void testSendDownloadRequest() {
DistributionSet dsA = testdataFactory.createDistributionSet(UUID.randomUUID().toString());
SoftwareModule module = dsA.getModules().iterator().next();
final List<AbstractDbArtifact> receivedList = new ArrayList<>();
@@ -206,9 +207,10 @@ class AmqpMessageDispatcherServiceTest extends AbstractIntegrationTest {
}
}
@Test
@Description("Verifies that sending update controller attributes event works.")
void sendUpdateAttributesRequest() {
/**
* Verifies that sending update controller attributes event works.
*/
@Test void sendUpdateAttributesRequest() {
final String amqpUri = "amqp://anyhost";
final TargetAttributesRequestedEvent targetAttributesRequestedEvent = new TargetAttributesRequestedEvent(TENANT,
1L, CONTROLLER_ID, amqpUri, Target.class, serviceMatcher.getBusId());
@@ -219,9 +221,10 @@ class AmqpMessageDispatcherServiceTest extends AbstractIntegrationTest {
assertUpdateAttributesMessage(sendMessage);
}
@Test
@Description("Verifies that send cancel event works")
void testSendCancelRequest() {
/**
* Verifies that send cancel event works
*/
@Test void testSendCancelRequest() {
final Action action = mock(Action.class);
when(action.getId()).thenReturn(1L);
when(action.getTenant()).thenReturn(TENANT);
@@ -235,9 +238,10 @@ class AmqpMessageDispatcherServiceTest extends AbstractIntegrationTest {
}
@Test
@Description("Verifies that sending a delete message when receiving a delete event works.")
void sendDeleteRequest() {
/**
* Verifies that sending a delete message when receiving a delete event works.
*/
@Test void sendDeleteRequest() {
// setup
final String amqpUri = "amqp://anyhost";
@@ -252,9 +256,10 @@ class AmqpMessageDispatcherServiceTest extends AbstractIntegrationTest {
assertDeleteMessage(sendMessage);
}
@Test
@Description("Verifies that a delete message is not send if the address is not an amqp address.")
void sendDeleteRequestWithNoAmqpAddress() {
/**
* Verifies that a delete message is not send if the address is not an amqp address.
*/
@Test void sendDeleteRequestWithNoAmqpAddress() {
// setup
final String noAmqpUri = "http://anyhost";
@@ -268,9 +273,10 @@ class AmqpMessageDispatcherServiceTest extends AbstractIntegrationTest {
Mockito.verifyNoInteractions(senderService);
}
@Test
@Description("Verifies that a delete message is not send if the address is null.")
void sendDeleteRequestWithNullAddress() {
/**
* Verifies that a delete message is not send if the address is null.
*/
@Test void sendDeleteRequestWithNullAddress() {
// setup
final String noAmqpUri = null;

View File

@@ -26,10 +26,6 @@ import java.net.URI;
import java.util.Map;
import java.util.Optional;
import io.qameta.allure.Description;
import io.qameta.allure.Feature;
import io.qameta.allure.Step;
import io.qameta.allure.Story;
import org.eclipse.hawkbit.dmf.amqp.api.EventTopic;
import org.eclipse.hawkbit.dmf.amqp.api.MessageHeaderKey;
import org.eclipse.hawkbit.dmf.amqp.api.MessageType;
@@ -76,8 +72,10 @@ import org.springframework.amqp.support.converter.MessageConversionException;
import org.springframework.amqp.support.converter.MessageConverter;
@ExtendWith(MockitoExtension.class)
@Feature("Component Tests - Device Management Federation API")
@Story("AmqpMessage Handler Service Test")
/**
* Feature: Component Tests - Device Management Federation API<br/>
* Story: AmqpMessage Handler Service Test
*/
class AmqpMessageHandlerServiceTest {
private static final String FAIL_MESSAGE_AMQP_REJECT_REASON = AmqpRejectAndDontRequeueException.class
@@ -144,9 +142,10 @@ class AmqpMessageHandlerServiceTest {
confirmationManagementMock);
}
@Test
@Description("Tests not allowed content-type in message")
void wrongContentType() {
/**
* Tests not allowed content-type in message
*/
@Test void wrongContentType() {
final MessageProperties messageProperties = new MessageProperties();
messageProperties.setContentType("xml");
final Message message = new Message(new byte[0], messageProperties);
@@ -157,9 +156,10 @@ class AmqpMessageHandlerServiceTest {
VIRTUAL_HOST));
}
@Test
@Description("Tests the creation of a target/thing by calling the same method that incoming RabbitMQ messages would access.")
void createThing() {
/**
* Tests the creation of a target/thing by calling the same method that incoming RabbitMQ messages would access.
*/
@Test void createThing() {
final String knownThingId = "1";
processThingCreatedMessage(knownThingId, null);
@@ -168,9 +168,10 @@ class AmqpMessageHandlerServiceTest {
assertReplyToCapturedField("MyTest");
}
@Test
@Description("Tests the creation of a target/thing with specified name by calling the same method that incoming RabbitMQ messages would access.")
void createThingWithName() {
/**
* Tests the creation of a target/thing with specified name by calling the same method that incoming RabbitMQ messages would access.
*/
@Test void createThingWithName() {
final String knownThingId = "2";
final String knownThingName = "NonDefaultTargetName";
@@ -183,9 +184,10 @@ class AmqpMessageHandlerServiceTest {
assertThingNameCapturedField(knownThingName);
}
@Test
@Description("Tests the creation of a target/thing with specified type name by calling the same method that incoming RabbitMQ messages would access.")
void createThingWithType() {
/**
* Tests the creation of a target/thing with specified type name by calling the same method that incoming RabbitMQ messages would access.
*/
@Test void createThingWithType() {
final String knownThingId = "2";
final String knownThingTypeName = "TargetTypeName";
@@ -198,9 +200,10 @@ class AmqpMessageHandlerServiceTest {
assertThingTypeCapturedField(knownThingTypeName);
}
@Test
@Description("Tests not allowed body in message")
void createThingWithWrongBody() {
/**
* Tests not allowed body in message
*/
@Test void createThingWithWrongBody() {
final Message message = createMessage("Not allowed Body".getBytes(), getThingCreatedMessageProperties("3"));
final String type = MessageType.THING_CREATED.name();
assertThatExceptionOfType(MessageConversionException.class)
@@ -208,9 +211,10 @@ class AmqpMessageHandlerServiceTest {
.isThrownBy(() -> amqpMessageHandlerService.onMessage(message, type, TENANT, VIRTUAL_HOST));
}
@Test
@Description("Tests the creation of a target/thing with specified attributes by calling the same method that incoming RabbitMQ messages would access.")
void createThingWithAttributes() {
/**
* Tests the creation of a target/thing with specified attributes by calling the same method that incoming RabbitMQ messages would access.
*/
@Test void createThingWithAttributes() {
final String knownThingId = "4";
final DmfAttributeUpdate attributeUpdate = dmfAttributeUpdate();
@@ -224,9 +228,10 @@ class AmqpMessageHandlerServiceTest {
assertThingAttributesCapturedField(attributeUpdate.getAttributes());
}
@Test
@Description("Tests the creation of a target/thing with specified name and attributes by calling the same method that incoming RabbitMQ messages would access.")
void createThingWithNameAndAttributes() {
/**
* Tests the creation of a target/thing with specified name and attributes by calling the same method that incoming RabbitMQ messages would access.
*/
@Test void createThingWithNameAndAttributes() {
final String knownThingId = "5";
final String knownThingName = "NonDefaultTargetName";
@@ -242,9 +247,10 @@ class AmqpMessageHandlerServiceTest {
assertThingAttributesModeCapturedField(UpdateMode.REPLACE);
}
@Test
@Description("Tests the target attribute update by calling the same method that incoming RabbitMQ messages would access.")
void updateAttributes() {
/**
* Tests the target attribute update by calling the same method that incoming RabbitMQ messages would access.
*/
@Test void updateAttributes() {
final String knownThingId = "1";
final MessageProperties messageProperties = createMessageProperties(MessageType.EVENT);
messageProperties.setHeader(MessageHeaderKey.THING_ID, knownThingId);
@@ -262,9 +268,10 @@ class AmqpMessageHandlerServiceTest {
assertThingAttributesCapturedField(attributeUpdate.getAttributes());
}
@Test
@Description("Verifies that the update mode is retrieved from the UPDATE_ATTRIBUTES message and passed to the controller management.")
void attributeUpdateModes() {
/**
* Verifies that the update mode is retrieved from the UPDATE_ATTRIBUTES message and passed to the controller management.
*/
@Test void attributeUpdateModes() {
final String knownThingId = "1";
final MessageProperties messageProperties = createMessageProperties(MessageType.EVENT);
messageProperties.setHeader(MessageHeaderKey.THING_ID, knownThingId);
@@ -312,9 +319,10 @@ class AmqpMessageHandlerServiceTest {
Map.of("testKey1", "testValue1", "testKey2", "testValue2"), mode);
}
@Test
@Description("Tests the creation of a thing without a 'reply to' header in message.")
void createThingWithoutReplyTo() {
/**
* Tests the creation of a thing without a 'reply to' header in message.
*/
@Test void createThingWithoutReplyTo() {
final MessageProperties messageProperties = createMessageProperties(MessageType.THING_CREATED, null);
messageProperties.setHeader(MessageHeaderKey.THING_ID, "1");
final Message message = createMessage("", messageProperties);
@@ -324,9 +332,10 @@ class AmqpMessageHandlerServiceTest {
.isThrownBy(() -> amqpMessageHandlerService.onMessage(message, type, TENANT, VIRTUAL_HOST));
}
@Test
@Description("Tests the creation of a target/thing without a thingID by calling the same method that incoming RabbitMQ messages would access.")
void createThingWithoutID() {
/**
* Tests the creation of a target/thing without a thingID by calling the same method that incoming RabbitMQ messages would access.
*/
@Test void createThingWithoutID() {
final MessageProperties messageProperties = createMessageProperties(MessageType.THING_CREATED);
final Message message = createMessage(new byte[0], messageProperties);
final String type = MessageType.THING_CREATED.name();
@@ -335,9 +344,10 @@ class AmqpMessageHandlerServiceTest {
.isThrownBy(() -> amqpMessageHandlerService.onMessage(message, type, TENANT, VIRTUAL_HOST));
}
@Test
@Description("Tests the call of the same method that incoming RabbitMQ messages would access with an unknown message type.")
void unknownMessageType() {
/**
* Tests the call of the same method that incoming RabbitMQ messages would access with an unknown message type.
*/
@Test void unknownMessageType() {
final String type = "bumlux";
final MessageProperties messageProperties = createMessageProperties(MessageType.THING_CREATED);
messageProperties.setHeader(MessageHeaderKey.THING_ID, "");
@@ -348,9 +358,10 @@ class AmqpMessageHandlerServiceTest {
.isThrownBy(() -> amqpMessageHandlerService.onMessage(message, type, TENANT, VIRTUAL_HOST));
}
@Test
@Description("Tests a invalid message without event topic")
void invalidEventTopic() {
/**
* Tests a invalid message without event topic
*/
@Test void invalidEventTopic() {
final MessageProperties messageProperties = createMessageProperties(MessageType.EVENT);
final Message message = new Message(new byte[0], messageProperties);
@@ -370,9 +381,10 @@ class AmqpMessageHandlerServiceTest {
.isThrownBy(() -> amqpMessageHandlerService.onMessage(message, type, TENANT, VIRTUAL_HOST));
}
@Test
@Description("Tests the update of an action of a target without a exist action id")
void updateActionStatusWithoutActionId() {
/**
* Tests the update of an action of a target without a exist action id
*/
@Test void updateActionStatusWithoutActionId() {
when(controllerManagementMock.findActionWithDetails(anyLong())).thenReturn(Optional.empty());
final MessageProperties messageProperties = createMessageProperties(MessageType.EVENT);
messageProperties.setHeader(MessageHeaderKey.TOPIC, EventTopic.UPDATE_ACTION_STATUS.name());
@@ -384,9 +396,10 @@ class AmqpMessageHandlerServiceTest {
.isThrownBy(() -> amqpMessageHandlerService.onMessage(message, type, TENANT, VIRTUAL_HOST));
}
@Test
@Description("Tests the update of an action of a target without a exist action id")
void updateActionStatusWithoutExistActionId() {
/**
* Tests the update of an action of a target without a exist action id
*/
@Test void updateActionStatusWithoutExistActionId() {
final MessageProperties messageProperties = createMessageProperties(MessageType.EVENT);
messageProperties.setHeader(MessageHeaderKey.TOPIC, EventTopic.UPDATE_ACTION_STATUS.name());
when(controllerManagementMock.findActionWithDetails(anyLong())).thenReturn(Optional.empty());
@@ -400,9 +413,10 @@ class AmqpMessageHandlerServiceTest {
VIRTUAL_HOST));
}
@Test
@Description("Tests that messages which cause quota violations are not re-added to message queue so they would block other communication.")
void quotaExceeded() {
/**
* Tests that messages which cause quota violations are not re-added to message queue so they would block other communication.
*/
@Test void quotaExceeded() {
final MessageProperties messageProperties = createMessageProperties(MessageType.EVENT);
messageProperties.setHeader(MessageHeaderKey.TOPIC, EventTopic.UPDATE_ACTION_STATUS.name());
@@ -425,9 +439,10 @@ class AmqpMessageHandlerServiceTest {
.isThrownBy(() -> amqpMessageHandlerService.onMessage(message, type, TENANT, VIRTUAL_HOST));
}
@Test
@Description("Test next update is provided on finished action")
void lookupNextUpdateActionAfterFinished() throws IllegalAccessException {
/**
* Test next update is provided on finished action
*/
@Test void lookupNextUpdateActionAfterFinished() throws IllegalAccessException {
// Mock
final Action action = createActionWithTarget(22L);
@@ -462,9 +477,10 @@ class AmqpMessageHandlerServiceTest {
assertThat(actionProperties.getId()).as("event has wrong action id").isEqualTo(22L);
}
@Test
@Description("Test feedback code is persisted in messages when provided with DmfActionUpdateStatus")
void feedBackCodeIsPersistedInMessages() throws IllegalAccessException {
/**
* Test feedback code is persisted in messages when provided with DmfActionUpdateStatus
*/
@Test void feedBackCodeIsPersistedInMessages() throws IllegalAccessException {
// Mock
final Action action = createActionWithTarget(22L);
when(controllerManagementMock.findActionWithDetails(anyLong())).thenReturn(Optional.of(action));
@@ -496,9 +512,10 @@ class AmqpMessageHandlerServiceTest {
.contains("Device reported status code: 12");
}
@Test
@Description("Tests the deletion of a target/thing, requested by the target itself.")
void deleteThing() {
/**
* Tests the deletion of a target/thing, requested by the target itself.
*/
@Test void deleteThing() {
// prepare valid message
final String knownThingId = "1";
final MessageProperties messageProperties = createMessageProperties(MessageType.THING_REMOVED);
@@ -512,9 +529,10 @@ class AmqpMessageHandlerServiceTest {
verify(controllerManagementMock).deleteExistingTarget(knownThingId);
}
@Test
@Description("Tests the deletion of a target/thing with missing thingId")
void deleteThingWithoutThingId() {
/**
* Tests the deletion of a target/thing with missing thingId
*/
@Test void deleteThingWithoutThingId() {
// prepare invalid message
final MessageProperties messageProperties = createMessageProperties(MessageType.THING_REMOVED);
final Message message = createMessage(new byte[0], messageProperties);
@@ -525,9 +543,10 @@ class AmqpMessageHandlerServiceTest {
.isThrownBy(() -> amqpMessageHandlerService.onMessage(message, type, TENANT, VIRTUAL_HOST));
}
@Test
@Description("Tests activating auto-confirmation on a target.")
void setAutoConfirmationStateActive() {
/**
* Tests activating auto-confirmation on a target.
*/
@Test void setAutoConfirmationStateActive() {
final String knownThingId = "1";
final String initiator = "iAmTheInitiator";
final String remark = "remarkForTesting";
@@ -551,9 +570,10 @@ class AmqpMessageHandlerServiceTest {
assertRemarkCapturedField(remark);
}
@Test
@Description("Tests deactivating auto-confirmation on a target.")
void setAutoConfirmationStateDeactivated() {
/**
* Tests deactivating auto-confirmation on a target.
*/
@Test void setAutoConfirmationStateDeactivated() {
final String knownThingId = "1";
final MessageProperties messageProperties = createMessageProperties(MessageType.EVENT);
@@ -571,7 +591,6 @@ class AmqpMessageHandlerServiceTest {
assertThingIdCapturedField(knownThingId);
}
@Step
private void processThingCreatedMessage(final String thingId, final DmfCreateThing payload) {
final MessageProperties messageProperties = getThingCreatedMessageProperties(thingId);
final Message message = createMessage(payload != null ? payload : new byte[0], messageProperties);
@@ -594,42 +613,34 @@ class AmqpMessageHandlerServiceTest {
amqpMessageHandlerService.onMessage(message, MessageType.THING_CREATED.name(), TENANT, VIRTUAL_HOST);
}
@Step
private void assertThingIdCapturedField(final String thingId) {
assertThat(targetIdCaptor.getValue()).as("Thing id is wrong").isEqualTo(thingId);
}
@Step
private void assertReplyToCapturedField(final String replyTo) {
assertThat(uriCaptor.getValue()).as("Uri is not right").hasToString("amqp://" + VIRTUAL_HOST + "/" + replyTo);
}
@Step
private void assertInitiatorCapturedField(final String initiator) {
assertThat(initiatorCaptor.getValue()).as("Initiator is wrong").isEqualTo(initiator);
}
@Step
private void assertRemarkCapturedField(final String remark) {
assertThat(remarkCaptor.getValue()).as("Remark is wrong").isEqualTo(remark);
}
@Step
private void assertThingNameCapturedField(final String thingName) {
assertThat(targetNameCaptor.getValue()).as("Thing name is wrong").isEqualTo(thingName);
}
@Step
private void assertThingTypeCapturedField(final String thingType) {
assertThat(targetTypeNameCaptor.getValue()).as("Thing type is wrong").isEqualTo(thingType);
}
@Step
private void assertThingAttributesCapturedField(final Map<String, String> attributes) {
assertThat(attributesCaptor.getValue()).as("Attributes is not right").isEqualTo(attributes);
}
@Step
private void assertThingAttributesModeCapturedField(final UpdateMode attributesUpdateMode) {
assertThat(modeCaptor.getValue()).as("Attributes update mode is not right").isEqualTo(attributesUpdateMode);
}

View File

@@ -15,9 +15,6 @@ import static org.mockito.Mockito.when;
import java.util.List;
import io.qameta.allure.Description;
import io.qameta.allure.Feature;
import io.qameta.allure.Story;
import org.eclipse.hawkbit.dmf.json.model.DmfActionStatus;
import org.eclipse.hawkbit.dmf.json.model.DmfActionUpdateStatus;
import org.eclipse.hawkbit.repository.event.remote.entity.TargetCreatedEvent;
@@ -35,8 +32,10 @@ import org.springframework.amqp.support.converter.Jackson2JsonMessageConverter;
import org.springframework.amqp.support.converter.MessageConversionException;
@ExtendWith(MockitoExtension.class)
@Feature("Component Tests - Device Management Federation API")
@Story("Base Amqp Service Test")
/**
* Feature: Component Tests - Device Management Federation API<br/>
* Story: Base Amqp Service Test
*/
class BaseAmqpServiceTest {
@Mock
@@ -49,9 +48,10 @@ class BaseAmqpServiceTest {
baseAmqpService = new BaseAmqpService(rabbitTemplate);
}
@Test
@Description("Verify that the message conversion works")
void convertMessageTest() {
/**
* Verify that the message conversion works
*/
@Test void convertMessageTest() {
final DmfActionUpdateStatus actionUpdateStatus = createActionStatus();
when(rabbitTemplate.getMessageConverter()).thenReturn(new Jackson2JsonMessageConverter());
@@ -60,18 +60,20 @@ class BaseAmqpServiceTest {
assertThat(convertedActionUpdateStatus).usingRecursiveComparison().isEqualTo(actionUpdateStatus);
}
@Test
@Description("Tests invalid null message content")
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class, count = 0) })
/**
* Tests invalid null message content
*/
@Test @ExpectEvents({ @Expect(type = TargetCreatedEvent.class, count = 0) })
void convertMessageWithNullContent() {
assertThatExceptionOfType(IllegalArgumentException.class)
.as("Expected IllegalArgumentException for invalid (null) JSON")
.isThrownBy(() -> createMessage(null));
}
@Test
@Description("Tests invalid empty message content")
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class, count = 0) })
/**
* Tests invalid empty message content
*/
@Test @ExpectEvents({ @Expect(type = TargetCreatedEvent.class, count = 0) })
void updateActionStatusWithEmptyContent() {
final Message message = createMessage("".getBytes());
assertThatExceptionOfType(MessageConversionException.class)
@@ -79,9 +81,10 @@ class BaseAmqpServiceTest {
.isThrownBy(() -> baseAmqpService.convertMessage(message, DmfActionUpdateStatus.class));
}
@Test
@Description("Tests invalid json message content")
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class, count = 0) })
/**
* Tests invalid json message content
*/
@Test @ExpectEvents({ @Expect(type = TargetCreatedEvent.class, count = 0) })
void updateActionStatusWithInvalidJsonContent() {
final Message message = createMessage("Invalid Json".getBytes());
when(rabbitTemplate.getMessageConverter()).thenReturn(new Jackson2JsonMessageConverter());

View File

@@ -13,45 +13,48 @@ import static org.assertj.core.api.Assertions.assertThat;
import java.util.List;
import io.qameta.allure.Description;
import io.qameta.allure.Feature;
import io.qameta.allure.Story;
import org.junit.jupiter.api.Test;
import org.springframework.amqp.rabbit.listener.FatalExceptionStrategy;
import org.springframework.amqp.support.converter.MessageConversionException;
@Feature("Unit Tests - Requeue Exception Strategy")
@Story("Requeue Exception Strategy")
/**
* Feature: Unit Tests - Requeue Exception Strategy<br/>
* Story: Requeue Exception Strategy
*/
class RequestExceptionStrategyTest {
private final FatalExceptionStrategy requeueExceptionStrategy = new RequeueExceptionStrategy(
List.of(new RequeueExceptionStrategy.TypeBasedFatalExceptionStrategy(
IllegalArgumentException.class, IndexOutOfBoundsException.class)), null);
@Test
@Description("Verifies that default handler is used if no handlers are defined for the specific exception.")
void verifyDefaultFatal() {
/**
* Verifies that default handler is used if no handlers are defined for the specific exception.
*/
@Test void verifyDefaultFatal() {
assertThat(requeueExceptionStrategy.isFatal(new MessageConversionException("t"))).as("Non Fatal error").isTrue();
assertThat(requeueExceptionStrategy.isFatal(new Throwable(new MessageConversionException("t")))).as("Non Fatal error").isTrue();
}
@Test
@Description("Verifies additional fatal exception types are fatal.")
void verifyAdditionalFatal() {
/**
* Verifies additional fatal exception types are fatal.
*/
@Test void verifyAdditionalFatal() {
assertThat(requeueExceptionStrategy.isFatal(new IllegalArgumentException())).isTrue();
assertThat(requeueExceptionStrategy.isFatal(new IndexOutOfBoundsException())).isTrue();
}
@Test
@Description("Verifies additional fatal exception types are fatal.")
void verifyAdditionalWrappedFatal() {
/**
* Verifies additional fatal exception types are fatal.
*/
@Test void verifyAdditionalWrappedFatal() {
assertThat(requeueExceptionStrategy.isFatal(new Throwable(new IllegalArgumentException()))).isTrue();
assertThat(requeueExceptionStrategy.isFatal(new Throwable(new IndexOutOfBoundsException()))).isTrue();
}
@Test
@Description("Verifies that default handler is used if no handlers are defined for the specific exception.")
void verifyNonFatal() {
/**
* Verifies that default handler is used if no handlers are defined for the specific exception.
*/
@Test void verifyNonFatal() {
assertThat(requeueExceptionStrategy.isFatal(new NullPointerException())).isFalse();
assertThat(requeueExceptionStrategy.isFatal(new Throwable(new NullPointerException()))).isFalse();
}

View File

@@ -22,7 +22,6 @@ import java.util.UUID;
import java.util.concurrent.Callable;
import com.cronutils.utils.StringUtils;
import io.qameta.allure.Step;
import org.assertj.core.api.HamcrestCondition;
import org.eclipse.hawkbit.amqp.DmfApiConfiguration;
import org.eclipse.hawkbit.dmf.amqp.api.AmqpSettings;
@@ -254,7 +253,6 @@ abstract class AbstractAmqpServiceIntegrationTest extends AbstractAmqpIntegratio
return replyMessage;
}
@Step
protected void registerAndAssertTargetWithExistingTenant(final String controllerId) {
registerAndAssertTargetWithExistingTenant(controllerId, 1);
}
@@ -372,7 +370,6 @@ abstract class AbstractAmqpServiceIntegrationTest extends AbstractAmqpIntegratio
}
@Step
protected void assertUpdateAttributes(final String controllerId, final Map<String, String> attributes) {
waitUntilIsPresent(() -> controllerManagement.getByControllerId(controllerId));
@@ -393,7 +390,6 @@ abstract class AbstractAmqpServiceIntegrationTest extends AbstractAmqpIntegratio
return AmqpSettings.DMF_EXCHANGE;
}
@Step
protected DistributionSet createTargetAndDistributionSetAndAssign(final String controllerId, final Action.ActionType actionType) {
registerAndAssertTargetWithExistingTenant(controllerId);

View File

@@ -30,9 +30,6 @@ import java.util.UUID;
import java.util.concurrent.Callable;
import java.util.stream.Collectors;
import io.qameta.allure.Description;
import io.qameta.allure.Feature;
import io.qameta.allure.Story;
import org.eclipse.hawkbit.dmf.amqp.api.EventTopic;
import org.eclipse.hawkbit.dmf.amqp.api.MessageHeaderKey;
import org.eclipse.hawkbit.dmf.json.model.DmfActionRequest;
@@ -83,15 +80,18 @@ import org.junit.jupiter.params.provider.EnumSource;
import org.mockito.Mockito;
import org.springframework.amqp.core.Message;
@Feature("Component Tests - Device Management Federation API")
@Story("Amqp Message Dispatcher Service")
/**
* Feature: Component Tests - Device Management Federation API<br/>
* Story: Amqp Message Dispatcher Service
*/
class AmqpMessageDispatcherServiceIntegrationTest extends AbstractAmqpServiceIntegrationTest {
private static final String TARGET_PREFIX = "Dmf_disp_";
@Test
@Description("Verify that a distribution assignment send a download and install message.")
@ExpectEvents({
/**
* Verify that a distribution assignment send a download and install message.
*/
@Test @ExpectEvents({
@Expect(type = TargetCreatedEvent.class, count = 1),
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
@Expect(type = ActionCreatedEvent.class, count = 1),
@@ -109,9 +109,10 @@ class AmqpMessageDispatcherServiceIntegrationTest extends AbstractAmqpServiceInt
assertDownloadAndInstallMessage(getDistributionSet().getModules(), controllerId);
}
@Test
@Description("Verify that a distribution assignment sends a download message with window configured but before maintenance window start time.")
@ExpectEvents({
/**
* Verify that a distribution assignment sends a download message with window configured but before maintenance window start time.
*/
@Test @ExpectEvents({
@Expect(type = TargetCreatedEvent.class, count = 1),
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
@Expect(type = ActionCreatedEvent.class, count = 1),
@@ -134,9 +135,10 @@ class AmqpMessageDispatcherServiceIntegrationTest extends AbstractAmqpServiceInt
assertDownloadMessage(distributionSet.getModules(), controllerId);
}
@Test
@Description("Verify that a distribution assignment sends a download and install message with window configured and during maintenance window start time.")
@ExpectEvents({
/**
* Verify that a distribution assignment sends a download and install message with window configured and during maintenance window start time.
*/
@Test @ExpectEvents({
@Expect(type = TargetCreatedEvent.class, count = 1),
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
@Expect(type = ActionCreatedEvent.class, count = 1),
@@ -159,9 +161,10 @@ class AmqpMessageDispatcherServiceIntegrationTest extends AbstractAmqpServiceInt
assertDownloadAndInstallMessage(distributionSet.getModules(), controllerId);
}
@Test
@Description("Verify that a distribution assignment multiple times send cancel and assign events with right softwaremodules")
@ExpectEvents({
/**
* Verify that a distribution assignment multiple times send cancel and assign events with right softwaremodules
*/
@Test @ExpectEvents({
@Expect(type = TargetCreatedEvent.class, count = 1),
@Expect(type = TargetAssignDistributionSetEvent.class, count = 2),
@Expect(type = CancelTargetAssignmentEvent.class, count = 1),
@@ -205,9 +208,10 @@ class AmqpMessageDispatcherServiceIntegrationTest extends AbstractAmqpServiceInt
assertDownloadAndInstallMessage(distributionSet2.getModules(), controllerId);
}
@Test
@Description("If multi assignment is enabled multi-action messages are sent.")
@ExpectEvents({
/**
* If multi assignment is enabled multi-action messages are sent.
*/
@Test @ExpectEvents({
@Expect(type = TargetCreatedEvent.class, count = 1),
@Expect(type = MultiActionAssignEvent.class, count = 2),
@Expect(type = TargetAssignDistributionSetEvent.class, count = 0),
@@ -237,9 +241,10 @@ class AmqpMessageDispatcherServiceIntegrationTest extends AbstractAmqpServiceInt
assertLatestMultiActionMessage(controllerId, Arrays.asList(action1Install, action2Install));
}
@Test
@Description("Verify payload of multi action messages.")
void assertMultiActionMessagePayloads() {
/**
* Verify payload of multi action messages.
*/
@Test void assertMultiActionMessagePayloads() {
final int expectedWeightIfNotSet = 1000;
final int weight1 = 600;
final String controllerId = UUID.randomUUID().toString();
@@ -286,9 +291,10 @@ class AmqpMessageDispatcherServiceIntegrationTest extends AbstractAmqpServiceInt
controllerId);
}
@Test
@Description("Handle cancelation process of an action in multi assignment mode.")
@ExpectEvents({
/**
* Handle cancelation process of an action in multi assignment mode.
*/
@Test @ExpectEvents({
@Expect(type = TargetCreatedEvent.class, count = 1),
@Expect(type = TargetUpdatedEvent.class, count = 2),
@Expect(type = TargetPollEvent.class, count = 1),
@@ -325,9 +331,10 @@ class AmqpMessageDispatcherServiceIntegrationTest extends AbstractAmqpServiceInt
assertLatestMultiActionMessage(controllerId, Collections.singletonList(action2Install));
}
@Test
@Description("Handle finishing an action in multi assignment mode.")
@ExpectEvents({
/**
* Handle finishing an action in multi assignment mode.
*/
@Test @ExpectEvents({
@Expect(type = TargetCreatedEvent.class, count = 1),
@Expect(type = MultiActionAssignEvent.class, count = 2),
@Expect(type = TargetAttributesRequestedEvent.class, count = 1),
@@ -358,9 +365,10 @@ class AmqpMessageDispatcherServiceIntegrationTest extends AbstractAmqpServiceInt
assertLatestMultiActionMessage(controllerId, Collections.singletonList(action2Install));
}
@Test
@Description("If multi assignment is enabled assigning a DS multiple times creates a new action every time.")
@ExpectEvents({
/**
* If multi assignment is enabled assigning a DS multiple times creates a new action every time.
*/
@Test @ExpectEvents({
@Expect(type = TargetCreatedEvent.class, count = 1),
@Expect(type = MultiActionAssignEvent.class, count = 2),
@Expect(type = TargetAssignDistributionSetEvent.class, count = 0),
@@ -390,9 +398,10 @@ class AmqpMessageDispatcherServiceIntegrationTest extends AbstractAmqpServiceInt
assertLatestMultiActionMessage(controllerId, Arrays.asList(action1Install, action2Install));
}
@Test
@Description("If multi assignment is enabled multiple rollouts with the same DS lead to multiple actions.")
@ExpectEvents({
/**
* If multi assignment is enabled multiple rollouts with the same DS lead to multiple actions.
*/
@Test @ExpectEvents({
@Expect(type = TargetCreatedEvent.class, count = 1),
@Expect(type = MultiActionAssignEvent.class, count = 2),
@Expect(type = TargetAssignDistributionSetEvent.class, count = 0),
@@ -428,9 +437,10 @@ class AmqpMessageDispatcherServiceIntegrationTest extends AbstractAmqpServiceInt
assertLatestMultiActionMessageContainsInstallMessages(controllerId, Arrays.asList(smIds, smIds));
}
@Test
@Description("If multi assignment is enabled finishing one rollout does not affect other rollouts of the target.")
@ExpectEvents({
/**
* If multi assignment is enabled finishing one rollout does not affect other rollouts of the target.
*/
@Test @ExpectEvents({
@Expect(type = TargetCreatedEvent.class, count = 1),
@Expect(type = MultiActionAssignEvent.class, count = 3),
@Expect(type = ActionCreatedEvent.class, count = 3),
@@ -479,9 +489,10 @@ class AmqpMessageDispatcherServiceIntegrationTest extends AbstractAmqpServiceInt
assertLatestMultiActionMessageContainsInstallMessages(controllerId, Collections.singletonList(smIds1));
}
@Test
@Description("Verify that a cancel assignment send a cancel message.")
@ExpectEvents({
/**
* Verify that a cancel assignment send a cancel message.
*/
@Test @ExpectEvents({
@Expect(type = TargetCreatedEvent.class, count = 1),
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
@Expect(type = CancelTargetAssignmentEvent.class, count = 1),
@@ -503,9 +514,10 @@ class AmqpMessageDispatcherServiceIntegrationTest extends AbstractAmqpServiceInt
assertCancelActionMessage(actionId, controllerId);
}
@Test
@Description("Verify that when a target is deleted a target delete message is send.")
@ExpectEvents({
/**
* Verify that when a target is deleted a target delete message is send.
*/
@Test @ExpectEvents({
@Expect(type = TargetCreatedEvent.class, count = 1),
@Expect(type = TargetPollEvent.class, count = 1),
@Expect(type = TargetDeletedEvent.class, count = 1) })
@@ -517,9 +529,10 @@ class AmqpMessageDispatcherServiceIntegrationTest extends AbstractAmqpServiceInt
assertDeleteMessage(controllerId);
}
@Test
@Description("Verify that attribute update is requested after device successfully closed software update.")
@ExpectEvents({
/**
* Verify that attribute update is requested after device successfully closed software update.
*/
@Test @ExpectEvents({
@Expect(type = TargetCreatedEvent.class, count = 1),
@Expect(type = TargetAssignDistributionSetEvent.class, count = 2),
@Expect(type = ActionUpdatedEvent.class, count = 2),
@@ -546,9 +559,10 @@ class AmqpMessageDispatcherServiceIntegrationTest extends AbstractAmqpServiceInt
assertRequestAttributesUpdateMessage(controllerId);
}
@Test
@Description("Tests the download_only assignment: asserts correct dmf Message topic, and assigned DS")
@ExpectEvents({
/**
* Tests the download_only assignment: asserts correct dmf Message topic, and assigned DS
*/
@Test @ExpectEvents({
@Expect(type = TargetCreatedEvent.class, count = 1),
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
@Expect(type = ActionCreatedEvent.class, count = 1),
@@ -580,15 +594,17 @@ class AmqpMessageDispatcherServiceIntegrationTest extends AbstractAmqpServiceInt
assertThat(assignedDistributionSet.getId()).isEqualTo(distributionSet.getId());
}
@Test
@Description("Verify payload of batch assignment download and install message.")
void assertBatchAssignmentsDownloadAndInstall() {
/**
* Verify payload of batch assignment download and install message.
*/
@Test void assertBatchAssignmentsDownloadAndInstall() {
assertBatchAssignmentsMessagePayload(BATCH_DOWNLOAD_AND_INSTALL);
}
@Test
@Description("Verify payload of batch assignments download only message.")
void assertBatchAssignmentsDownloadOnly() {
/**
* Verify payload of batch assignments download only message.
*/
@Test void assertBatchAssignmentsDownloadOnly() {
assertBatchAssignmentsMessagePayload(BATCH_DOWNLOAD);
}
@@ -616,9 +632,10 @@ class AmqpMessageDispatcherServiceIntegrationTest extends AbstractAmqpServiceInt
assertThat(replyToListener.getLatestEventMessage(eventTopic)).isNull();
}
@Test
@Description("Verify that batch and multi-assignments can't be activated at the same time.")
void assertBatchAndMultiAssignmentsNotCompatible() {
/**
* Verify that batch and multi-assignments can't be activated at the same time.
*/
@Test void assertBatchAndMultiAssignmentsNotCompatible() {
enableBatchAssignments();
assertThatExceptionOfType(TenantConfigurationValueChangeNotAllowedException.class)
.isThrownBy(() -> enableMultiAssignments());
@@ -629,9 +646,11 @@ class AmqpMessageDispatcherServiceIntegrationTest extends AbstractAmqpServiceInt
.isThrownBy(() -> enableBatchAssignments());
}
/**
* Verify payload of batch assignments.
*/
@ParameterizedTest
@EnumSource(names = { "BATCH_DOWNLOAD_AND_INSTALL", "BATCH_DOWNLOAD" })
@Description("Verify payload of batch assignments.")
@ExpectEvents({
@Expect(type = TargetCreatedEvent.class, count = 3),
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
@@ -672,9 +691,10 @@ class AmqpMessageDispatcherServiceIntegrationTest extends AbstractAmqpServiceInt
assertDmfBatchDownloadAndUpdateRequest(batchRequest, ds.getModules(), targets);
}
@Test
@Description("Verify that a distribution assignment send a confirm message.")
@ExpectEvents({
/**
* Verify that a distribution assignment send a confirm message.
*/
@Test @ExpectEvents({
@Expect(type = TargetCreatedEvent.class, count = 1),
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
@Expect(type = ActionCreatedEvent.class, count = 1),

View File

@@ -27,10 +27,6 @@ import java.util.UUID;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ObjectNode;
import io.qameta.allure.Description;
import io.qameta.allure.Feature;
import io.qameta.allure.Step;
import io.qameta.allure.Story;
import org.eclipse.hawkbit.amqp.AmqpMessageHandlerService;
import org.eclipse.hawkbit.amqp.AmqpProperties;
import org.eclipse.hawkbit.dmf.amqp.api.EventTopic;
@@ -78,8 +74,10 @@ import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.core.RabbitAdmin;
import org.springframework.beans.factory.annotation.Autowired;
@Feature("Component Tests - Device Management Federation API")
@Story("Amqp Message Handler Service")
/**
* Feature: Component Tests - Device Management Federation API<br/>
* Story: Amqp Message Handler Service
*/
class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServiceIntegrationTest {
static final String DMF_REGISTER_TEST_CONTROLLER_ID = "Dmf_hand_registerTargets_1";
@@ -93,9 +91,10 @@ class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServiceIntegr
@Autowired
private AmqpMessageHandlerService amqpMessageHandlerService;
@Test
@Description("Tests DMF PING request and expected response.")
void pingDmfInterface() {
/**
* Tests DMF PING request and expected response.
*/
@Test void pingDmfInterface() {
final Message pingMessage = createPingMessage(CORRELATION_ID, TENANT_EXIST);
getDmfClient().send(pingMessage);
@@ -104,9 +103,10 @@ class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServiceIntegr
Mockito.verifyNoInteractions(getDeadletterListener());
}
@Test
@Description("Tests register target")
@ExpectEvents({
/**
* Tests register target
*/
@Test @ExpectEvents({
@Expect(type = TargetCreatedEvent.class, count = 2),
@Expect(type = TargetPollEvent.class, count = 3) })
void registerTargets() {
@@ -120,9 +120,10 @@ class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServiceIntegr
Mockito.verifyNoInteractions(getDeadletterListener());
}
@Test
@Description("Tests register target with name")
@ExpectEvents({
/**
* Tests register target with name
*/
@Test @ExpectEvents({
@Expect(type = TargetCreatedEvent.class, count = 1),
@Expect(type = TargetUpdatedEvent.class, count = 1),
@Expect(type = TargetPollEvent.class, count = 2) })
@@ -138,9 +139,10 @@ class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServiceIntegr
Mockito.verifyNoInteractions(getDeadletterListener());
}
@Test
@Description("Tests register target with attributes")
@ExpectEvents({
/**
* Tests register target with attributes
*/
@Test @ExpectEvents({
@Expect(type = TargetCreatedEvent.class, count = 1),
@Expect(type = TargetUpdatedEvent.class, count = 2),
@Expect(type = TargetPollEvent.class, count = 2) })
@@ -159,9 +161,10 @@ class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServiceIntegr
Mockito.verifyNoInteractions(getDeadletterListener());
}
@Test
@Description("Tests register target with name and attributes")
@ExpectEvents({
/**
* Tests register target with name and attributes
*/
@Test @ExpectEvents({
@Expect(type = TargetCreatedEvent.class, count = 1),
@Expect(type = TargetUpdatedEvent.class, count = 3),
@Expect(type = TargetPollEvent.class, count = 2) })
@@ -183,9 +186,11 @@ class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServiceIntegr
}
@ParameterizedTest
/**
* Tests register invalid target with empty controller id.
*/
@ValueSource(strings = { "", "Invalid Invalid" })
@NullSource
@Description("Tests register invalid target with empty controller id.")
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class) })
void shouldNotRegisterTargetsWithInvalidControllerIds(String controllerId) {
createAndSendThingCreated(controllerId);
@@ -193,18 +198,20 @@ class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServiceIntegr
verifyOneDeadLetterMessage();
}
@Test
@Description("Tests register invalid target with too long controller id")
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class) })
/**
* Tests register invalid target with too long controller id
*/
@Test @ExpectEvents({ @Expect(type = TargetCreatedEvent.class) })
void registerInvalidTargetWithTooLongControllerId() {
createAndSendThingCreated(randomString(Target.CONTROLLER_ID_MAX_SIZE + 1));
assertAllTargetsCount(0);
verifyOneDeadLetterMessage();
}
@Test
@Description("Tests null reply to property in message header. This message should forwarded to the deadletter queue")
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class) })
/**
* Tests null reply to property in message header. This message should forwarded to the deadletter queue
*/
@Test @ExpectEvents({ @Expect(type = TargetCreatedEvent.class) })
void missingReplyToProperty() {
final String controllerId = TARGET_PREFIX + "missingReplyToProperty";
final Message createTargetMessage = createTargetMessage(controllerId, TENANT_EXIST);
@@ -215,9 +222,10 @@ class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServiceIntegr
assertAllTargetsCount(0);
}
@Test
@Description("Tests missing reply to property in message header. This message should forwarded to the deadletter queue")
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class) })
/**
* Tests missing reply to property in message header. This message should forwarded to the deadletter queue
*/
@Test @ExpectEvents({ @Expect(type = TargetCreatedEvent.class) })
void emptyReplyToProperty() {
final String controllerId = TARGET_PREFIX + "emptyReplyToProperty";
final Message createTargetMessage = createTargetMessage(controllerId, TENANT_EXIST);
@@ -228,9 +236,10 @@ class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServiceIntegr
assertAllTargetsCount(0);
}
@Test
@Description("Tests missing thing id property in message. This message should forwarded to the deadletter queue")
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class) })
/**
* Tests missing thing id property in message. This message should forwarded to the deadletter queue
*/
@Test @ExpectEvents({ @Expect(type = TargetCreatedEvent.class) })
void missingThingIdProperty() {
final Message createTargetMessage = createTargetMessage(null, TENANT_EXIST);
createTargetMessage.getMessageProperties().getHeaders().remove(MessageHeaderKey.THING_ID);
@@ -240,9 +249,10 @@ class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServiceIntegr
assertAllTargetsCount(0);
}
@Test
@Description("Tests null thing id property in message. This message should forwarded to the deadletter queue")
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class) })
/**
* Tests null thing id property in message. This message should forwarded to the deadletter queue
*/
@Test @ExpectEvents({ @Expect(type = TargetCreatedEvent.class) })
void nullThingIdProperty() {
final Message createTargetMessage = createTargetMessage(null, TENANT_EXIST);
getDmfClient().send(createTargetMessage);
@@ -251,9 +261,10 @@ class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServiceIntegr
assertAllTargetsCount(0);
}
@Test
@Description("Tests missing tenant message header. This message should forwarded to the deadletter queue")
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class) })
/**
* Tests missing tenant message header. This message should forwarded to the deadletter queue
*/
@Test @ExpectEvents({ @Expect(type = TargetCreatedEvent.class) })
void missingTenantHeader() {
final String controllerId = TARGET_PREFIX + "missingTenantHeader";
final Message createTargetMessage = createTargetMessage(controllerId, TENANT_EXIST);
@@ -264,9 +275,10 @@ class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServiceIntegr
assertAllTargetsCount(0);
}
@Test
@Description("Tests null tenant message header. This message should forwarded to the deadletter queue")
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class) })
/**
* Tests null tenant message header. This message should forwarded to the deadletter queue
*/
@Test @ExpectEvents({ @Expect(type = TargetCreatedEvent.class) })
void nullTenantHeader() {
final String controllerId = TARGET_PREFIX + "nullTenantHeader";
final Message createTargetMessage = createTargetMessage(controllerId, null);
@@ -276,9 +288,10 @@ class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServiceIntegr
assertAllTargetsCount(0);
}
@Test
@Description("Tests empty tenant message header. This message should forwarded to the deadletter queue")
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class) })
/**
* Tests empty tenant message header. This message should forwarded to the deadletter queue
*/
@Test @ExpectEvents({ @Expect(type = TargetCreatedEvent.class) })
void emptyTenantHeader() {
final String controllerId = TARGET_PREFIX + "emptyTenantHeader";
final Message createTargetMessage = createTargetMessage(controllerId, "");
@@ -288,9 +301,10 @@ class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServiceIntegr
assertAllTargetsCount(0);
}
@Test
@Description("Tests missing type message header. This message should forwarded to the deadletter queue")
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class) })
/**
* Tests missing type message header. This message should forwarded to the deadletter queue
*/
@Test @ExpectEvents({ @Expect(type = TargetCreatedEvent.class) })
void missingTypeHeader() {
final Message createTargetMessage = createTargetMessage(null, TENANT_EXIST);
createTargetMessage.getMessageProperties().getHeaders().remove(MessageHeaderKey.TYPE);
@@ -301,9 +315,11 @@ class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServiceIntegr
}
@ParameterizedTest
/**
* Tests null type message header. This message should forwarded to the deadletter queue
*/
@ValueSource(strings = { "", "NotExist" })
@NullSource
@Description("Tests null type message header. This message should forwarded to the deadletter queue")
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class) })
void shouldNotCreateTargetsWithInvalidTypeInHeader(String type) {
final Message createTargetMessage = createTargetMessage(null, TENANT_EXIST);
@@ -315,9 +331,11 @@ class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServiceIntegr
}
@ParameterizedTest
/**
* Tests null topic message header. This message should forwarded to the deadletter queue
*/
@ValueSource(strings = { "", "NotExist" })
@NullSource
@Description("Tests null topic message header. This message should forwarded to the deadletter queue")
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class) })
void shouldNotSendMessagesWithInvalidTopic(String topic) {
final Message eventMessage = createUpdateActionEventMessage("");
@@ -327,9 +345,10 @@ class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServiceIntegr
verifyOneDeadLetterMessage();
}
@Test
@Description("Tests missing topic message header. This message should forwarded to the deadletter queue")
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class) })
/**
* Tests missing topic message header. This message should forwarded to the deadletter queue
*/
@Test @ExpectEvents({ @Expect(type = TargetCreatedEvent.class) })
void missingTopicHeader() {
final Message eventMessage = createUpdateActionEventMessage("");
eventMessage.getMessageProperties().getHeaders().remove(MessageHeaderKey.TOPIC);
@@ -339,9 +358,11 @@ class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServiceIntegr
}
@ParameterizedTest
/**
* Tests invalid null message content. This message should forwarded to the deadletter queue
*/
@ValueSource(strings = { "", "Invalid Content" })
@NullSource
@Description("Tests invalid null message content. This message should forwarded to the deadletter queue")
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class) })
void shouldMoveUpdateActionStatusWithInvalidPayloadIntoDeadLetter(String payload) {
final Message eventMessage = createUpdateActionEventMessage(payload);
@@ -349,9 +370,10 @@ class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServiceIntegr
verifyOneDeadLetterMessage();
}
@Test
@Description("Tests invalid topic message header. This message should forwarded to the deadletter queue")
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class) })
/**
* Tests invalid topic message header. This message should forwarded to the deadletter queue
*/
@Test @ExpectEvents({ @Expect(type = TargetCreatedEvent.class) })
void updateActionStatusWithInvalidActionId() {
final DmfActionUpdateStatus actionUpdateStatus = new DmfActionUpdateStatus(1L, DmfActionStatus.RUNNING);
final Message eventMessage = createUpdateActionEventMessage(actionUpdateStatus);
@@ -359,9 +381,10 @@ class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServiceIntegr
verifyOneDeadLetterMessage();
}
@Test
@Description("Tests register target and send finished message")
@ExpectEvents({
/**
* Tests register target and send finished message
*/
@Test @ExpectEvents({
@Expect(type = TargetCreatedEvent.class, count = 1),
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
@Expect(type = ActionUpdatedEvent.class, count = 1),
@@ -378,9 +401,10 @@ class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServiceIntegr
registerTargetAndSendAndAssertUpdateActionStatus(DmfActionStatus.FINISHED, Status.FINISHED, controllerId);
}
@Test
@Description("Register a target and send a update action status (running). Verify if the updated action status is correct.")
@ExpectEvents({
/**
* Register a target and send a update action status (running). Verify if the updated action status is correct.
*/
@Test @ExpectEvents({
@Expect(type = TargetCreatedEvent.class, count = 1),
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
@Expect(type = ActionUpdatedEvent.class),
@@ -396,9 +420,10 @@ class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServiceIntegr
registerTargetAndSendAndAssertUpdateActionStatus(DmfActionStatus.RUNNING, Status.RUNNING, controllerId);
}
@Test
@Description("Register a target and send an update action status (downloaded). Verify if the updated action status is correct.")
@ExpectEvents({
/**
* Register a target and send an update action status (downloaded). Verify if the updated action status is correct.
*/
@Test @ExpectEvents({
@Expect(type = TargetCreatedEvent.class, count = 1),
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
@Expect(type = ActionUpdatedEvent.class),
@@ -414,9 +439,10 @@ class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServiceIntegr
registerTargetAndSendAndAssertUpdateActionStatus(DmfActionStatus.DOWNLOADED, Status.DOWNLOADED, controllerId);
}
@Test
@Description("Register a target and send a update action status (download). Verify if the updated action status is correct.")
@ExpectEvents({
/**
* Register a target and send a update action status (download). Verify if the updated action status is correct.
*/
@Test @ExpectEvents({
@Expect(type = TargetCreatedEvent.class, count = 1),
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
@Expect(type = ActionCreatedEvent.class, count = 1),
@@ -431,9 +457,10 @@ class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServiceIntegr
registerTargetAndSendAndAssertUpdateActionStatus(DmfActionStatus.DOWNLOAD, Status.DOWNLOAD, controllerId);
}
@Test
@Description("Register a target and send a update action status (error). Verify if the updated action status is correct.")
@ExpectEvents({
/**
* Register a target and send a update action status (error). Verify if the updated action status is correct.
*/
@Test @ExpectEvents({
@Expect(type = TargetCreatedEvent.class, count = 1),
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
@Expect(type = ActionUpdatedEvent.class, count = 1),
@@ -449,9 +476,10 @@ class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServiceIntegr
registerTargetAndSendAndAssertUpdateActionStatus(DmfActionStatus.ERROR, Status.ERROR, controllerId);
}
@Test
@Description("Register a target and send a update action status (warning). Verify if the updated action status is correct.")
@ExpectEvents({
/**
* Register a target and send a update action status (warning). Verify if the updated action status is correct.
*/
@Test @ExpectEvents({
@Expect(type = TargetCreatedEvent.class, count = 1),
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
@Expect(type = ActionCreatedEvent.class, count = 1),
@@ -466,9 +494,10 @@ class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServiceIntegr
registerTargetAndSendAndAssertUpdateActionStatus(DmfActionStatus.WARNING, Status.WARNING, controllerId);
}
@Test
@Description("Register a target and send a update action status (retrieved). Verify if the updated action status is correct.")
@ExpectEvents({
/**
* Register a target and send a update action status (retrieved). Verify if the updated action status is correct.
*/
@Test @ExpectEvents({
@Expect(type = TargetCreatedEvent.class, count = 1),
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
@Expect(type = ActionCreatedEvent.class, count = 1),
@@ -483,9 +512,10 @@ class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServiceIntegr
registerTargetAndSendAndAssertUpdateActionStatus(DmfActionStatus.RETRIEVED, Status.RETRIEVED, controllerId);
}
@Test
@Description("Register a target and send a invalid update action status (cancel). This message should forwarded to the deadletter queue")
@ExpectEvents({
/**
* Register a target and send a invalid update action status (cancel). This message should forwarded to the deadletter queue
*/
@Test @ExpectEvents({
@Expect(type = TargetCreatedEvent.class, count = 1),
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
@Expect(type = ActionCreatedEvent.class, count = 1),
@@ -501,9 +531,10 @@ class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServiceIntegr
verifyOneDeadLetterMessage();
}
@Test
@Description("Verify receiving a download and install message if a deployment is done before the target has polled the first time.")
@ExpectEvents({
/**
* Verify receiving a download and install message if a deployment is done before the target has polled the first time.
*/
@Test @ExpectEvents({
@Expect(type = TargetCreatedEvent.class, count = 1),
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
@Expect(type = ActionCreatedEvent.class, count = 1),
@@ -530,9 +561,10 @@ class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServiceIntegr
Mockito.verifyNoInteractions(getDeadletterListener());
}
@Test
@Description("Verify receiving a download message if a deployment is done with window configured but before maintenance window start time.")
@ExpectEvents({
/**
* Verify receiving a download message if a deployment is done with window configured but before maintenance window start time.
*/
@Test @ExpectEvents({
@Expect(type = TargetCreatedEvent.class, count = 1),
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
@Expect(type = ActionCreatedEvent.class, count = 1),
@@ -560,9 +592,10 @@ class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServiceIntegr
Mockito.verifyNoInteractions(getDeadletterListener());
}
@Test
@Description("Verify receiving a download_and_install message if a deployment is done with window configured and during maintenance window start time.")
@ExpectEvents({
/**
* Verify receiving a download_and_install message if a deployment is done with window configured and during maintenance window start time.
*/
@Test @ExpectEvents({
@Expect(type = TargetCreatedEvent.class, count = 1),
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
@Expect(type = ActionCreatedEvent.class, count = 1),
@@ -590,9 +623,10 @@ class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServiceIntegr
Mockito.verifyNoInteractions(getDeadletterListener());
}
@Test
@Description("Verify receiving a cancel update message if a deployment is canceled before the target has polled the first time.")
@ExpectEvents({
/**
* Verify receiving a cancel update message if a deployment is canceled before the target has polled the first time.
*/
@Test @ExpectEvents({
@Expect(type = TargetCreatedEvent.class, count = 1),
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
@Expect(type = ActionCreatedEvent.class, count = 1),
@@ -622,9 +656,10 @@ class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServiceIntegr
Mockito.verifyNoInteractions(getDeadletterListener());
}
@Test
@Description("Register a target and send a invalid update action status (canceled). The current status (pending) is not a canceling state. This message should forwarded to the deadletter queue")
@ExpectEvents({
/**
* Register a target and send a invalid update action status (canceled). The current status (pending) is not a canceling state. This message should forwarded to the deadletter queue
*/
@Test @ExpectEvents({
@Expect(type = TargetCreatedEvent.class, count = 1),
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
@Expect(type = ActionUpdatedEvent.class, count = 1),
@@ -646,9 +681,10 @@ class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServiceIntegr
verifyOneDeadLetterMessage();
}
@Test
@Description("Register a target and send a invalid update action status (cancel_rejected). This message should forwarded to the deadletter queue")
@ExpectEvents({
/**
* Register a target and send a invalid update action status (cancel_rejected). This message should forwarded to the deadletter queue
*/
@Test @ExpectEvents({
@Expect(type = TargetCreatedEvent.class, count = 1),
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
@Expect(type = ActionCreatedEvent.class, count = 1),
@@ -664,9 +700,10 @@ class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServiceIntegr
verifyOneDeadLetterMessage();
}
@Test
@Description("Register a target and send a valid update action status (cancel_rejected). Verify if the updated action status is correct.")
@ExpectEvents({
/**
* Register a target and send a valid update action status (cancel_rejected). Verify if the updated action status is correct.
*/
@Test @ExpectEvents({
@Expect(type = TargetCreatedEvent.class, count = 1),
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
@Expect(type = CancelTargetAssignmentEvent.class, count = 1),
@@ -692,9 +729,10 @@ class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServiceIntegr
}
@Test
@Description("Verify that sending an update controller attribute message to an existing target works. Verify that different update modes (merge, replace, remove) can be used.")
@ExpectEvents({
/**
* Verify that sending an update controller attribute message to an existing target works. Verify that different update modes (merge, replace, remove) can be used.
*/
@Test @ExpectEvents({
@Expect(type = TargetCreatedEvent.class, count = 1),
@Expect(type = TargetUpdatedEvent.class, count = 4),
@Expect(type = TargetPollEvent.class, count = 1) })
@@ -718,9 +756,10 @@ class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServiceIntegr
}
@Test
@Description("Verify that sending an update controller attribute message with no thingid header to an existing target does not work.")
@ExpectEvents({
/**
* Verify that sending an update controller attribute message with no thingid header to an existing target does not work.
*/
@Test @ExpectEvents({
@Expect(type = TargetCreatedEvent.class, count = 1),
@Expect(type = TargetUpdatedEvent.class),
@Expect(type = TargetPollEvent.class, count = 1) })
@@ -744,9 +783,10 @@ class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServiceIntegr
assertUpdateAttributes(controllerId, controllerAttributeEmpty.getAttributes());
}
@Test
@Description("Verify that sending an update controller attribute message with invalid body to an existing target does not work.")
@ExpectEvents({
/**
* Verify that sending an update controller attribute message with invalid body to an existing target does not work.
*/
@Test @ExpectEvents({
@Expect(type = TargetCreatedEvent.class, count = 1),
@Expect(type = TargetUpdatedEvent.class),
@Expect(type = TargetPollEvent.class, count = 1) })
@@ -762,9 +802,10 @@ class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServiceIntegr
verifyOneDeadLetterMessage();
}
@Test
@Description("Verifies that sending an UPDATE_ATTRIBUTES message with invalid attributes is handled correctly.")
void updateAttributesWithInvalidValues() {
/**
* Verifies that sending an UPDATE_ATTRIBUTES message with invalid attributes is handled correctly.
*/
@Test void updateAttributesWithInvalidValues() {
registerAndAssertTargetWithExistingTenant(UPDATE_ATTR_TEST_CONTROLLER_ID);
sendUpdateAttributesMessageWithGivenAttributes(TargetTestData.ATTRIBUTE_KEY_TOO_LONG, TargetTestData.ATTRIBUTE_VALUE_VALID);
@@ -774,9 +815,10 @@ class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServiceIntegr
verifyNumberOfDeadLetterMessages(3);
}
@Test
@Description("Tests the download_only assignment: tests the handling of a target reporting DOWNLOADED")
@ExpectEvents({
/**
* Tests the download_only assignment: tests the handling of a target reporting DOWNLOADED
*/
@Test @ExpectEvents({
@Expect(type = TargetCreatedEvent.class, count = 1),
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
@Expect(type = ActionUpdatedEvent.class, count = 1),
@@ -808,9 +850,10 @@ class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServiceIntegr
verifyAssignedDsAndInstalledDs(distributionSet.getId(), null);
}
@Test
@Description("Tests the download_only assignment: tests the handling of a target reporting FINISHED")
@ExpectEvents({
/**
* Tests the download_only assignment: tests the handling of a target reporting FINISHED
*/
@Test @ExpectEvents({
@Expect(type = TargetCreatedEvent.class, count = 1),
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
@Expect(type = ActionUpdatedEvent.class, count = 2),
@@ -850,9 +893,10 @@ class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServiceIntegr
verifyAssignedDsAndInstalledDs(distributionSet.getId(), distributionSet.getId());
}
@Test
@Description("Messages that result into certain exceptions being raised should not be requeued. This message should forwarded to the deadletter queue")
@ExpectEvents({
/**
* Messages that result into certain exceptions being raised should not be requeued. This message should forwarded to the deadletter queue
*/
@Test @ExpectEvents({
@Expect(type = TargetCreatedEvent.class) })
void ignoredExceptionTypesShouldNotBeRequeued() {
final ControllerManagement mockedControllerManagement = Mockito.mock(ControllerManagement.class);
@@ -875,9 +919,10 @@ class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServiceIntegr
}
}
@Test
@Description("Register a target and send a update action status (confirmed). Verify if the updated action status is correct.")
@ExpectEvents({
/**
* Register a target and send a update action status (confirmed). Verify if the updated action status is correct.
*/
@Test @ExpectEvents({
@Expect(type = TargetCreatedEvent.class, count = 1),
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
@Expect(type = ActionUpdatedEvent.class, count = 1),
@@ -903,9 +948,10 @@ class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServiceIntegr
assertDownloadAndInstallMessage(assignmentResult.getDistributionSet().getModules(), controllerId);
}
@Test
@Description("Verify the DMF confirmed feedback can be provided if confirmation flow is disabled")
@ExpectEvents({
/**
* Verify the DMF confirmed feedback can be provided if confirmation flow is disabled
*/
@Test @ExpectEvents({
@Expect(type = TargetCreatedEvent.class, count = 1),
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
@Expect(type = ActionUpdatedEvent.class, count = 1),
@@ -937,9 +983,10 @@ class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServiceIntegr
assertDownloadAndInstallMessage(assignmentResult.getDistributionSet().getModules(), controllerId);
}
@Test
@Description("Verify the DMF confirmed feedback can be provided if confirmation flow is disabled")
@ExpectEvents({
/**
* Verify the DMF confirmed feedback can be provided if confirmation flow is disabled
*/
@Test @ExpectEvents({
@Expect(type = TargetCreatedEvent.class, count = 1),
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
@Expect(type = ActionUpdatedEvent.class, count = 0),
@@ -967,9 +1014,10 @@ class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServiceIntegr
assertActionStatusList(actionId, 2, Status.WAIT_FOR_CONFIRMATION);
}
@Test
@Description("Verify the DMF download and install message is send directly if auto-confirmation is active")
@ExpectEvents({
/**
* Verify the DMF download and install message is send directly if auto-confirmation is active
*/
@Test @ExpectEvents({
@Expect(type = TargetCreatedEvent.class, count = 1),
@Expect(type = TargetUpdatedEvent.class, count = 2),
@Expect(type = TargetPollEvent.class, count = 1),
@@ -1001,9 +1049,10 @@ class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServiceIntegr
assertDownloadAndInstallMessage(assignmentResult.getDistributionSet().getModules(), controllerId);
}
@Test
@Description("Register a target and send a update action status (denied). Verify if the updated action status is correct.")
@ExpectEvents({
/**
* Register a target and send a update action status (denied). Verify if the updated action status is correct.
*/
@Test @ExpectEvents({
@Expect(type = TargetCreatedEvent.class, count = 1),
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
@Expect(type = ActionUpdatedEvent.class),
@@ -1032,7 +1081,6 @@ class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServiceIntegr
return node.get("actionId").asText();
}
@Step
private void updateAttributesWithUpdateModeRemove() {
// assemble the expected attributes
@@ -1053,7 +1101,6 @@ class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServiceIntegr
assertUpdateAttributes(DMF_ATTR_TEST_CONTROLLER_ID, expectedAttributes);
}
@Step
private void updateAttributesWithUpdateModeMerge() {
// get the current attributes
final Map<String, String> attributes = new HashMap<>(
@@ -1074,7 +1121,6 @@ class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServiceIntegr
assertUpdateAttributes(DMF_ATTR_TEST_CONTROLLER_ID, expectedAttributes);
}
@Step
private void updateAttributesWithUpdateModeReplace() {
// send an update message with update mode REPLACE
final Map<String, String> expectedAttributes = new HashMap<>();
@@ -1089,7 +1135,6 @@ class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServiceIntegr
assertUpdateAttributes(DMF_ATTR_TEST_CONTROLLER_ID, expectedAttributes);
}
@Step
private void updateAttributesWithoutUpdateMode() {
// send an update message which does not specify an update mode
final Map<String, String> expectedAttributes = new HashMap<>();
@@ -1103,7 +1148,6 @@ class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServiceIntegr
assertUpdateAttributes(DMF_ATTR_TEST_CONTROLLER_ID, expectedAttributes);
}
@Step
private void verifyAssignedDsAndInstalledDs(final Long assignedDsId, final Long installedDsId) {
final Optional<Target> target = controllerManagement.getByControllerId(DMF_REGISTER_TEST_CONTROLLER_ID);
assertThat(target).isPresent();

View File

@@ -13,13 +13,13 @@ import static org.assertj.core.api.Assertions.assertThat;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import io.qameta.allure.Feature;
import io.qameta.allure.Story;
import org.eclipse.hawkbit.mgmt.json.model.target.MgmtTarget;
import org.junit.jupiter.api.Test;
@Feature("Unit Tests - Management API")
@Story("Serialization")
/**
* Feature: Unit Tests - Management API<br/>
* Story: Serialization
*/
class AuditFieldSerializationTest {
@Test

View File

@@ -15,25 +15,26 @@ import static org.assertj.core.api.Assertions.assertThatThrownBy;
import java.util.ArrayList;
import java.util.List;
import io.qameta.allure.Description;
import io.qameta.allure.Feature;
import io.qameta.allure.Story;
import org.junit.jupiter.api.Test;
@Feature("Unit Tests - Management API")
@Story("Paged List Handling")
/**
* Feature: Unit Tests - Management API<br/>
* Story: Paged List Handling
*/
class PagedListTest {
@Test
@Description("Ensures that a null payload entity throws an exception.")
void createListWithNullContentThrowsException() {
/**
* Ensures that a null payload entity throws an exception.
*/
@Test void createListWithNullContentThrowsException() {
assertThatThrownBy(() -> new PagedList<>(null, 0))
.isInstanceOf(NullPointerException.class);
}
@Test
@Description("Create list with payload and verify content.")
void createListWithContent() {
/**
* Create list with payload and verify content.
*/
@Test void createListWithContent() {
final long knownTotal = 2;
final List<String> knownContentList = new ArrayList<>();
knownContentList.add("content1");
@@ -42,9 +43,10 @@ class PagedListTest {
assertListSize(knownTotal, knownContentList);
}
@Test
@Description("Create list with payload and verify size values.")
void createListWithSmallerTotalThanContentSizeIsOk() {
/**
* Create list with payload and verify size values.
*/
@Test void createListWithSmallerTotalThanContentSizeIsOk() {
final long knownTotal = 0;
final List<String> knownContentList = new ArrayList<>();
knownContentList.add("content1");

View File

@@ -17,21 +17,23 @@ import java.util.List;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import io.qameta.allure.Story;
import org.junit.jupiter.api.Test;
import org.springframework.context.annotation.Description;
@Story("Retrieve all open action ids")
@Description("Tests for the MgmtTargetAssignmentResponseBody")
/**
* Feature: Tests for the MgmtTargetAssignmentResponseBody<br/>
* Story: Retrieve all open action ids
*/
class MgmtTargetAssignmentResponseBodyTest {
private static final List<Long> ASSIGNED_ACTIONS = Arrays.asList(4L, 5L, 6L);
private static final int ALREADY_ASSIGNED_COUNT = 3;
private static final String CONTROLLER_ID = "target";
@Test
@Description("Tests that the ActionIds are serialized correctly in MgmtTargetAssignmentResponseBody")
void testActionIdsSerialization() throws IOException {
/**
* Tests that the ActionIds are serialized correctly in MgmtTargetAssignmentResponseBody
*/
@Test void testActionIdsSerialization() throws IOException {
final MgmtTargetAssignmentResponseBody responseBody = generateResponseBody();
final ObjectMapper objectMapper = new ObjectMapper();
final String responseBodyAsString = objectMapper.writeValueAsString(responseBody);

View File

@@ -26,10 +26,6 @@ import java.util.Iterator;
import java.util.List;
import java.util.concurrent.TimeUnit;
import io.qameta.allure.Description;
import io.qameta.allure.Feature;
import io.qameta.allure.Step;
import io.qameta.allure.Story;
import org.awaitility.Awaitility;
import org.eclipse.hawkbit.mgmt.rest.api.MgmtActionRestApi;
import org.eclipse.hawkbit.mgmt.rest.api.MgmtRepresentationMode;
@@ -46,9 +42,10 @@ import org.springframework.test.web.servlet.ResultActions;
/**
* Integration test for the {@link MgmtActionRestApi}.
* <p/>
* Feature: Component Tests - Management API<br/>
* Story: Action Resource
*/
@Feature("Component Tests - Management API")
@Story("Action Resource")
class MgmtActionResourceTest extends AbstractManagementApiIntegrationTest {
private static final String JSON_PATH_ROOT = "$";
@@ -64,21 +61,24 @@ class MgmtActionResourceTest extends AbstractManagementApiIntegrationTest {
private static final String JSON_PATH_ACTION_ID = JSON_PATH_ROOT + JSON_PATH_FIELD_ID;
@Test
@Description("Handles the GET request of retrieving a specific action.")
public void getAction() throws Exception {
/**
* Handles the GET request of retrieving a specific action.
*/
@Test public void getAction() throws Exception {
getAction(false);
}
@Test
@Description("Handles the GET request of retrieving a specific action with external reference.")
public void getActionExtRef() throws Exception {
/**
* Handles the GET request of retrieving a specific action with external reference.
*/
@Test public void getActionExtRef() throws Exception {
getAction(true);
}
@Test
@Description("Verifies that actions can be filtered based on action status.")
void filterActionsByStatus() throws Exception {
/**
* Verifies that actions can be filtered based on action status.
*/
@Test void filterActionsByStatus() throws Exception {
// prepare test
final DistributionSet dsA = testdataFactory.createDistributionSet("");
@@ -113,9 +113,10 @@ class MgmtActionResourceTest extends AbstractManagementApiIntegrationTest {
}
@Test
@Description("Verifies that actions can be filtered based on the detailed action status.")
void filterActionsByDetailStatus() throws Exception {
/**
* Verifies that actions can be filtered based on the detailed action status.
*/
@Test void filterActionsByDetailStatus() throws Exception {
// prepare test
final DistributionSet dsA = testdataFactory.createDistributionSet("");
assignDistributionSet(dsA, Collections.singletonList(testdataFactory.createTarget("knownTargetId")));
@@ -150,9 +151,10 @@ class MgmtActionResourceTest extends AbstractManagementApiIntegrationTest {
.andExpect(jsonPath("content[0].status", equalTo("pending")));
}
@Test
@Description("Verifies that actions can be filtered based on extRef.")
void filterActionsByExternalRef() throws Exception {
/**
* Verifies that actions can be filtered based on extRef.
*/
@Test void filterActionsByExternalRef() throws Exception {
// prepare test
final String knownTargetId = "targetId";
final List<Action> actions = generateTargetWithTwoUpdatesWithOneOverride(knownTargetId);
@@ -193,9 +195,10 @@ class MgmtActionResourceTest extends AbstractManagementApiIntegrationTest {
.andExpect(jsonPath("size", equalTo(0)));
}
@Test
@Description("Verifies that actions can be filtered based on the action status code that was reported last.")
void filterActionsByLastStatusCode() throws Exception {
/**
* Verifies that actions can be filtered based on the action status code that was reported last.
*/
@Test void filterActionsByLastStatusCode() throws Exception {
// assign a distribution set to three targets
final DistributionSet dsA = testdataFactory.createDistributionSet("");
final DistributionSetAssignmentResult assignmentResult = assignDistributionSet(dsA,
@@ -228,9 +231,10 @@ class MgmtActionResourceTest extends AbstractManagementApiIntegrationTest {
.andExpect(jsonPath("size", equalTo(0)));
}
@Test
@Description("Verifies that actions can be filtered based on distribution set fields.")
void filterActionsByDistributionSet() throws Exception {
/**
* Verifies that actions can be filtered based on distribution set fields.
*/
@Test void filterActionsByDistributionSet() throws Exception {
// prepare test
final DistributionSet ds = testdataFactory.createDistributionSet("");
assignDistributionSet(ds, Collections.singletonList(testdataFactory.createTarget("knownTargetId")));
@@ -273,9 +277,10 @@ class MgmtActionResourceTest extends AbstractManagementApiIntegrationTest {
.andExpect(jsonPath("size", equalTo(1)));
}
@Test
@Description("Verifies that actions can be filtered based on rollout fields.")
void filterActionsByRollout() throws Exception {
/**
* Verifies that actions can be filtered based on rollout fields.
*/
@Test void filterActionsByRollout() throws Exception {
// prepare test
final DistributionSet ds = testdataFactory.createDistributionSet();
final Target target0 = testdataFactory.createTarget("t0");
@@ -314,9 +319,10 @@ class MgmtActionResourceTest extends AbstractManagementApiIntegrationTest {
"content.[0]._links.distributionset.name", equalTo(ds.getName() + ":" + ds.getVersion())));
}
@Test
@Description("Verifies that actions can be filtered based on target fields.")
void filterActionsByTargetProperties() throws Exception {
/**
* Verifies that actions can be filtered based on target fields.
*/
@Test void filterActionsByTargetProperties() throws Exception {
// prepare test
final Target target = testdataFactory.createTarget("knownTargetId", "knownTargetName", "http://0.0.0.0");
final DistributionSet ds = testdataFactory.createDistributionSet("");
@@ -328,21 +334,24 @@ class MgmtActionResourceTest extends AbstractManagementApiIntegrationTest {
verifyResultsByTargetPropertyFilter(target, ds, "target.address==http://0.0.0.0");
}
@Test
@Description("Verifies that all available actions are returned if the complete collection is requested.")
void getActions() throws Exception {
/**
* Verifies that all available actions are returned if the complete collection is requested.
*/
@Test void getActions() throws Exception {
getActions(false);
}
@Test
@Description("Verifies that all available actions (whit ext refs) are returned if the complete collection is requested.")
void getActionsExtRef() throws Exception {
/**
* Verifies that all available actions (whit ext refs) are returned if the complete collection is requested.
*/
@Test void getActionsExtRef() throws Exception {
getActions(true);
}
@Test
@Description("Verifies that a full representation of all actions is returned if the collection is requested for representation mode 'full'.")
void getActionsFullRepresentation() throws Exception {
/**
* Verifies that a full representation of all actions is returned if the collection is requested for representation mode 'full'.
*/
@Test void getActionsFullRepresentation() throws Exception {
final String knownTargetId = "targetId";
final List<Action> actions = generateTargetWithTwoUpdatesWithOneOverride(knownTargetId);
@@ -382,9 +391,10 @@ class MgmtActionResourceTest extends AbstractManagementApiIntegrationTest {
.andExpect(jsonPath(JSON_PATH_PAGED_LIST_CONTENT, hasSize(2)));
}
@Test
@Description("Verifies that the get request for actions returns an empty collection if no assignments have been done yet.")
void getActionsWithEmptyResult() throws Exception {
/**
* Verifies that the get request for actions returns an empty collection if no assignments have been done yet.
*/
@Test void getActionsWithEmptyResult() throws Exception {
mvc.perform(get(MgmtRestConstants.ACTION_V1_REQUEST_MAPPING))
.andDo(MockMvcResultPrinter.print())
.andExpect(status().isOk())
@@ -393,9 +403,10 @@ class MgmtActionResourceTest extends AbstractManagementApiIntegrationTest {
.andExpect(jsonPath("total", equalTo(0)));
}
@Test
@Description("Verifies paging is respected as expected.")
void getMultipleActionsWithPagingLimitRequestParameter() throws Exception {
/**
* Verifies paging is respected as expected.
*/
@Test void getMultipleActionsWithPagingLimitRequestParameter() throws Exception {
final String knownTargetId = "targetId";
final List<Action> actions = generateTargetWithTwoUpdatesWithOneOverride(knownTargetId);
@@ -444,9 +455,10 @@ class MgmtActionResourceTest extends AbstractManagementApiIntegrationTest {
.andExpect(jsonPath(JSON_PATH_PAGED_LIST_CONTENT, hasSize(1)));
}
@Test
@Description("Verifies that the actions resource is read-only.")
void invalidRequestsOnActionResource() throws Exception {
/**
* Verifies that the actions resource is read-only.
*/
@Test void invalidRequestsOnActionResource() throws Exception {
final String knownTargetId = "targetId";
generateTargetWithTwoUpdatesWithOneOverride(knownTargetId);
@@ -463,9 +475,10 @@ class MgmtActionResourceTest extends AbstractManagementApiIntegrationTest {
.andExpect(status().isMethodNotAllowed());
}
@Test
@Description("Verifies that the correct action is returned")
void shouldRetrieveCorrectActionById() throws Exception {
/**
* Verifies that the correct action is returned
*/
@Test void shouldRetrieveCorrectActionById() throws Exception {
final String knownTargetId = "targetId";
final List<Action> actions = generateTargetWithTwoUpdatesWithOneOverride(knownTargetId);
@@ -477,9 +490,10 @@ class MgmtActionResourceTest extends AbstractManagementApiIntegrationTest {
.andExpect(jsonPath(JSON_PATH_ACTION_ID, equalTo(actionId.intValue())));
}
@Test
@Description("Verifies that NOT_FOUND is returned when there is no such action.")
void requestActionThatDoesNotExistsLeadsToNotFound() throws Exception {
/**
* Verifies that NOT_FOUND is returned when there is no such action.
*/
@Test void requestActionThatDoesNotExistsLeadsToNotFound() throws Exception {
mvc.perform(get(MgmtRestConstants.ACTION_V1_REQUEST_MAPPING + "/" + 101))
.andDo(MockMvcResultPrinter.print())
.andExpect(status().isNotFound());
@@ -499,7 +513,6 @@ class MgmtActionResourceTest extends AbstractManagementApiIntegrationTest {
+ action.getDistributionSet().getId();
}
@Step
private void verifyResultsByTargetPropertyFilter(final Target target, final DistributionSet ds, final String rsqlTargetFilter)
throws Exception {
// pending status one result

View File

@@ -19,9 +19,6 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
import java.util.Base64;
import io.qameta.allure.Description;
import io.qameta.allure.Feature;
import io.qameta.allure.Story;
import org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants;
import org.eclipse.hawkbit.repository.jpa.RepositoryApplicationConfiguration;
import org.eclipse.hawkbit.repository.test.TestConfiguration;
@@ -74,8 +71,10 @@ import org.springframework.web.context.WebApplicationContext;
@ContextConfiguration(classes = { MgmtApiConfiguration.class, RestConfiguration.class,
RepositoryApplicationConfiguration.class, TestConfiguration.class })
@Import(TestChannelBinderConfiguration.class)
@Feature("Component Tests - Management API")
@Story("Basic auth Userinfo Resource")
/**
* Feature: Component Tests - Management API<br/>
* Story: Basic auth Userinfo Resource
*/
class MgmtBasicAuthResourceTest {
@Autowired
@@ -85,9 +84,10 @@ class MgmtBasicAuthResourceTest {
private static final String DEFAULT_TENANT = "DEFAULT";
private static final String TEST_USER = "testUser";
@Test
@Description("Test of userinfo api with basic auth validation")
@WithUser(principal = TEST_USER, authorities = {"READ", "WRITE", "DELETE"})
/**
* Test of userinfo api with basic auth validation
*/
@Test @WithUser(principal = TEST_USER, authorities = {"READ", "WRITE", "DELETE"})
void validateBasicAuthWithUserDetails() throws Exception {
withSecurityMock().perform(get(MgmtRestConstants.AUTH_V1_REQUEST_MAPPING))
.andDo(MockMvcResultPrinter.print())
@@ -100,9 +100,10 @@ class MgmtBasicAuthResourceTest {
.andExpect(jsonPath("$.permissions", hasItems("READ", "WRITE", "DELETE")));
}
@Test
@Description("Test of userinfo api with invalid basic auth fails")
void validateBasicAuthFailsWithInvalidCredentials() throws Exception {
/**
* Test of userinfo api with invalid basic auth fails
*/
@Test void validateBasicAuthFailsWithInvalidCredentials() throws Exception {
defaultMock.perform(get(MgmtRestConstants.AUTH_V1_REQUEST_MAPPING)
.header(HttpHeaders.AUTHORIZATION, getBasicAuth("wrongUser", "wrongSecret")))
.andDo(MockMvcResultPrinter.print())

View File

@@ -18,9 +18,6 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
import java.util.Collections;
import io.qameta.allure.Description;
import io.qameta.allure.Feature;
import io.qameta.allure.Story;
import org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants;
import org.eclipse.hawkbit.repository.model.DistributionSet;
import org.eclipse.hawkbit.rest.util.JsonBuilder;
@@ -41,8 +38,10 @@ import org.springframework.test.web.servlet.MvcResult;
*/
@SpringBootTest(properties = { "server.servlet.encoding.charset=UTF-8", "server.servlet.encoding.force=true" })
@Import(HttpEncodingAutoConfiguration.class)
@Feature("Component Tests - Management API")
@Story("Response Content-Type")
/**
* Feature: Component Tests - Management API<br/>
* Story: Response Content-Type
*/
@SuppressWarnings("java:S1874") // TODO for compatibility, to be checked if we really want to do that
public class MgmtContentTypeTest extends AbstractManagementApiIntegrationTest {
@@ -54,9 +53,10 @@ public class MgmtContentTypeTest extends AbstractManagementApiIntegrationTest {
ds = testdataFactory.generateDistributionSet(dsName);
}
@Test
@Description("The response of a POST request shall contain charset=utf-8")
public void postDistributionSet_ContentTypeJsonUtf8_woAccept() throws Exception {
/**
* The response of a POST request shall contain charset=utf-8
*/
@Test public void postDistributionSet_ContentTypeJsonUtf8_woAccept() throws Exception {
final MvcResult result = mvc.perform(
post(MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING).content(JsonBuilder.distributionSets(
Collections.singletonList(ds)))
@@ -69,9 +69,10 @@ public class MgmtContentTypeTest extends AbstractManagementApiIntegrationTest {
assertEquals(MediaTypes.HAL_JSON_VALUE + ";charset=UTF-8", getResponseHeaderContentType(result));
}
@Test
@Description("The response of a POST request shall contain charset=utf-8")
public void postDistributionSet_ContentTypeJsonUtf8_wAcceptJson() throws Exception {
/**
* The response of a POST request shall contain charset=utf-8
*/
@Test public void postDistributionSet_ContentTypeJsonUtf8_wAcceptJson() throws Exception {
final MvcResult result = mvc.perform(
post(MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING).content(JsonBuilder.distributionSets(
Collections.singletonList(ds)))
@@ -84,9 +85,10 @@ public class MgmtContentTypeTest extends AbstractManagementApiIntegrationTest {
assertEquals(MediaType.APPLICATION_JSON_UTF8_VALUE, getResponseHeaderContentType(result));
}
@Test
@Description("The response of a POST request shall contain charset=utf-8")
public void postDistributionSet_ContentTypeJsonUtf8_wAcceptJsonUtf8() throws Exception {
/**
* The response of a POST request shall contain charset=utf-8
*/
@Test public void postDistributionSet_ContentTypeJsonUtf8_wAcceptJsonUtf8() throws Exception {
final MvcResult result = mvc.perform(
post(MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING).content(JsonBuilder.distributionSets(
Collections.singletonList(ds)))
@@ -99,9 +101,10 @@ public class MgmtContentTypeTest extends AbstractManagementApiIntegrationTest {
assertEquals(MediaType.APPLICATION_JSON_UTF8_VALUE, getResponseHeaderContentType(result));
}
@Test
@Description("The response of a POST request shall contain charset=utf-8")
public void postDistributionSet_ContentTypeJsonUtf8_wAcceptHalJson() throws Exception {
/**
* The response of a POST request shall contain charset=utf-8
*/
@Test public void postDistributionSet_ContentTypeJsonUtf8_wAcceptHalJson() throws Exception {
final MvcResult result = mvc.perform(
post(MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING).content(JsonBuilder.distributionSets(
Collections.singletonList(ds)))
@@ -114,9 +117,10 @@ public class MgmtContentTypeTest extends AbstractManagementApiIntegrationTest {
assertEquals(MediaTypes.HAL_JSON_VALUE + ";charset=UTF-8", getResponseHeaderContentType(result));
}
@Test
@Description("The response of a POST request shall contain charset=utf-8")
public void postDistributionSet_ContentTypeJson_woAccept() throws Exception {
/**
* The response of a POST request shall contain charset=utf-8
*/
@Test public void postDistributionSet_ContentTypeJson_woAccept() throws Exception {
final MvcResult result = mvc.perform(
post(MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING).content(JsonBuilder.distributionSets(
Collections.singletonList(ds)))
@@ -129,9 +133,10 @@ public class MgmtContentTypeTest extends AbstractManagementApiIntegrationTest {
assertEquals(MediaTypes.HAL_JSON_VALUE + ";charset=UTF-8", getResponseHeaderContentType(result));
}
@Test
@Description("The response of a POST request shall contain charset=utf-8")
public void postDistributionSet_ContentTypeJson_wAcceptJson() throws Exception {
/**
* The response of a POST request shall contain charset=utf-8
*/
@Test public void postDistributionSet_ContentTypeJson_wAcceptJson() throws Exception {
final MvcResult result = mvc.perform(
post(MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING).content(JsonBuilder.distributionSets(
Collections.singletonList(ds)))
@@ -144,9 +149,10 @@ public class MgmtContentTypeTest extends AbstractManagementApiIntegrationTest {
assertEquals(MediaType.APPLICATION_JSON_UTF8_VALUE, getResponseHeaderContentType(result));
}
@Test
@Description("The response of a POST request shall contain charset=utf-8")
public void postDistributionSet_ContentTypeJson_wAcceptJsonUtf8() throws Exception {
/**
* The response of a POST request shall contain charset=utf-8
*/
@Test public void postDistributionSet_ContentTypeJson_wAcceptJsonUtf8() throws Exception {
final MvcResult result = mvc.perform(post(MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING)
.content(JsonBuilder.distributionSets(Collections.singletonList(ds))).contentType(MediaType.APPLICATION_JSON)
.accept(MediaType.APPLICATION_JSON_UTF8))
@@ -158,9 +164,10 @@ public class MgmtContentTypeTest extends AbstractManagementApiIntegrationTest {
assertEquals(MediaType.APPLICATION_JSON_UTF8_VALUE, getResponseHeaderContentType(result));
}
@Test
@Description("The response of a POST request shall contain charset=utf-8")
public void postDistributionSet_ContentTypeJson_wAcceptHalJson() throws Exception {
/**
* The response of a POST request shall contain charset=utf-8
*/
@Test public void postDistributionSet_ContentTypeJson_wAcceptHalJson() throws Exception {
final MvcResult result = mvc.perform(post(MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING)
.content(JsonBuilder.distributionSets(Collections.singletonList(ds))).contentType(MediaType.APPLICATION_JSON)
.accept(MediaTypes.HAL_JSON))
@@ -172,9 +179,10 @@ public class MgmtContentTypeTest extends AbstractManagementApiIntegrationTest {
assertEquals(MediaTypes.HAL_JSON_VALUE + ";charset=UTF-8", getResponseHeaderContentType(result));
}
@Test
@Description("The response of a GET request shall contain charset=utf-8")
public void getDistributionSet_woAccept() throws Exception {
/**
* The response of a GET request shall contain charset=utf-8
*/
@Test public void getDistributionSet_woAccept() throws Exception {
final MvcResult result = mvc.perform(get(MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING))
.andDo(MockMvcResultPrinter.print())
.andExpect(status().isOk())
@@ -183,9 +191,10 @@ public class MgmtContentTypeTest extends AbstractManagementApiIntegrationTest {
assertEquals(MediaTypes.HAL_JSON_VALUE + ";charset=UTF-8", getResponseHeaderContentType(result));
}
@Test
@Description("The response of a GET request shall contain charset=utf-8")
public void getDistributionSet_wAcceptJson() throws Exception {
/**
* The response of a GET request shall contain charset=utf-8
*/
@Test public void getDistributionSet_wAcceptJson() throws Exception {
final MvcResult result = mvc.perform(get(MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING).accept(MediaType.APPLICATION_JSON))
.andDo(MockMvcResultPrinter.print())
.andExpect(status().isOk())
@@ -194,9 +203,10 @@ public class MgmtContentTypeTest extends AbstractManagementApiIntegrationTest {
assertEquals(MediaType.APPLICATION_JSON_UTF8_VALUE, getResponseHeaderContentType(result));
}
@Test
@Description("The response of a GET request shall contain charset=utf-8")
public void getDistributionSet_wAcceptJsonUtf8() throws Exception {
/**
* The response of a GET request shall contain charset=utf-8
*/
@Test public void getDistributionSet_wAcceptJsonUtf8() throws Exception {
final MvcResult result = mvc.perform(get(MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING).accept(MediaType.APPLICATION_JSON_UTF8))
.andDo(MockMvcResultPrinter.print())
.andExpect(status().isOk())
@@ -205,9 +215,10 @@ public class MgmtContentTypeTest extends AbstractManagementApiIntegrationTest {
assertEquals(MediaType.APPLICATION_JSON_UTF8_VALUE, getResponseHeaderContentType(result));
}
@Test
@Description("The response of a GET request shall contain charset=utf-8")
public void getDistributionSet_wAcceptHalJson() throws Exception {
/**
* The response of a GET request shall contain charset=utf-8
*/
@Test public void getDistributionSet_wAcceptHalJson() throws Exception {
final MvcResult result = mvc.perform(get(MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING).accept(MediaTypes.HAL_JSON))
.andDo(MockMvcResultPrinter.print())
.andExpect(status().isOk())

View File

@@ -37,10 +37,6 @@ import java.util.stream.IntStream;
import java.util.stream.Stream;
import com.jayway.jsonpath.JsonPath;
import io.qameta.allure.Description;
import io.qameta.allure.Feature;
import io.qameta.allure.Step;
import io.qameta.allure.Story;
import org.eclipse.hawkbit.exception.SpServerError;
import org.eclipse.hawkbit.mgmt.json.model.distributionset.MgmtActionType;
import org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants;
@@ -79,16 +75,19 @@ import org.springframework.http.MediaType;
import org.springframework.test.web.servlet.MvcResult;
import org.springframework.util.Assert;
@Feature("Component Tests - Management API")
@Story("Distribution Set Resource")
/**
* Feature: Component Tests - Management API<br/>
* Story: Distribution Set Resource
*/
class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTest {
@Autowired
ActionRepository actionRepository;
@Test
@Description("This test verifies the call of all Software Modules that are assigned to a Distribution Set through the RESTful API.")
void getSoftwareModules() throws Exception {
/**
* This test verifies the call of all Software Modules that are assigned to a Distribution Set through the RESTful API.
*/
@Test void getSoftwareModules() throws Exception {
// Create DistributionSet with three software modules
final DistributionSet set = testdataFactory.createDistributionSet("SMTest");
mvc.perform(get(MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/" + set.getId() + "/assignedSM"))
@@ -97,9 +96,10 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
.andExpect(jsonPath("$.size", equalTo(set.getModules().size())));
}
@Test
@Description("Handles the GET request of retrieving assigned software modules of a single distribution set within SP with given page size and offset including sorting by version descending and filter down to all sets which name starts with 'one'.")
void getSoftwareModulesWithParameters() throws Exception {
/**
* Handles the GET request of retrieving assigned software modules of a single distribution set within SP with given page size and offset including sorting by version descending and filter down to all sets which name starts with 'one'.
*/
@Test void getSoftwareModulesWithParameters() throws Exception {
final DistributionSet set = testdataFactory.createUpdatedDistributionSet();
// post assignment
@@ -111,9 +111,10 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
.andExpect(content().contentType(MediaType.APPLICATION_JSON));
}
@Test
@Description("This test verifies the deletion of a assigned Software Module of a Distribution Set can not be achieved when that Distribution Set has been assigned or installed to a target.")
void deleteFailureWhenDistributionSetInUse() throws Exception {
/**
* This test verifies the deletion of a assigned Software Module of a Distribution Set can not be achieved when that Distribution Set has been assigned or installed to a target.
*/
@Test void deleteFailureWhenDistributionSetInUse() throws Exception {
// create DisSet
final DistributionSet disSet = testdataFactory.createDistributionSetWithNoSoftwareModules("Eris", "560a");
final List<Long> smIDs = new ArrayList<>();
@@ -155,9 +156,10 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
.andExpect(jsonPath("$.errorCode", equalTo(SpServerError.SP_REPO_ENTITY_READ_ONLY.getKey())));
}
@Test
@Description("This test verifies that the assignment of a Software Module to a Distribution Set can not be achieved when that Distribution Set has been assigned or installed to a target.")
void assignmentFailureWhenAssigningToUsedDistributionSet() throws Exception {
/**
* This test verifies that the assignment of a Software Module to a Distribution Set can not be achieved when that Distribution Set has been assigned or installed to a target.
*/
@Test void assignmentFailureWhenAssigningToUsedDistributionSet() throws Exception {
// create DisSet
final DistributionSet disSet = testdataFactory.createDistributionSetWithNoSoftwareModules("Mars", "686,980");
final List<Long> smIDs = new ArrayList<>();
@@ -198,9 +200,10 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
.andExpect(jsonPath("$.errorCode", equalTo(SpServerError.SP_REPO_ENTITY_READ_ONLY.getKey())));
}
@Test
@Description("This test verifies the assignment of Software Modules to a Distribution Set through the RESTful API.")
void assignSoftwareModuleToDistributionSet() throws Exception {
/**
* This test verifies the assignment of Software Modules to a Distribution Set through the RESTful API.
*/
@Test void assignSoftwareModuleToDistributionSet() throws Exception {
// create DisSet
final DistributionSet disSet = testdataFactory.createDistributionSetWithNoSoftwareModules("Jupiter", "398,88");
// Test if size is 0
@@ -269,9 +272,10 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
}
@Test
@Description("This test verifies the removal of Software Modules of a Distribution Set through the RESTful API.")
void unassignSoftwareModuleFromDistributionSet() throws Exception {
/**
* This test verifies the removal of Software Modules of a Distribution Set through the RESTful API.
*/
@Test void unassignSoftwareModuleFromDistributionSet() throws Exception {
// Create DistributionSet with three software modules
final DistributionSet set = testdataFactory.createDistributionSet("Venus");
int amountOfSM = set.getModules().size();
@@ -292,9 +296,10 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
}
}
@Test
@Description("Ensures that multi target assignment through API is reflected by the repository.")
void assignMultipleTargetsToDistributionSet() throws Exception {
/**
* Ensures that multi target assignment through API is reflected by the repository.
*/
@Test void assignMultipleTargetsToDistributionSet() throws Exception {
final DistributionSet createdDs = testdataFactory.createDistributionSet();
// prepare targets
@@ -315,9 +320,10 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
.as("Five targets in repository have DS assigned").hasSize(5);
}
@Test
@Description("Ensures that targets can be assigned even if the specified controller IDs are in different case (e.g. 'TARGET1' instead of 'target1'.")
void assignTargetsToDistributionSetIgnoreCase() throws Exception {
/**
* Ensures that targets can be assigned even if the specified controller IDs are in different case (e.g. 'TARGET1' instead of 'target1'.
*/
@Test void assignTargetsToDistributionSetIgnoreCase() throws Exception {
final DistributionSet createdDs = testdataFactory.createDistributionSet();
// prepare targets
@@ -338,9 +344,10 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
// we just need to make sure that no error 500 is returned
}
@Test
@Description("Trying to create a DS from already marked as deleted type - should get as response 400 Bad Request")
void createDsFromAlreadyMarkedAsDeletedType() throws Exception {
/**
* Trying to create a DS from already marked as deleted type - should get as response 400 Bad Request
*/
@Test void createDsFromAlreadyMarkedAsDeletedType() throws Exception {
final SoftwareModule softwareModule = testdataFactory.createSoftwareModule("exampleKey");
final DistributionSetType type = testdataFactory.findOrCreateDistributionSetType(
"testKey", "testType", Collections.singletonList(softwareModule.getType()),
@@ -378,9 +385,10 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
assertTrue(exceptionInfo.getMessage().contains("Distribution Set Type already deleted"));
}
@Test
@Description("Ensures that multi target assignment is protected by our getMaxTargetDistributionSetAssignmentsPerManualAssignment quota.")
void assignMultipleTargetsToDistributionSetUntilQuotaIsExceeded() throws Exception {
/**
* Ensures that multi target assignment is protected by our getMaxTargetDistributionSetAssignmentsPerManualAssignment quota.
*/
@Test void assignMultipleTargetsToDistributionSetUntilQuotaIsExceeded() throws Exception {
final int maxActions = quotaManagement.getMaxTargetDistributionSetAssignmentsPerManualAssignment();
final List<Target> targets = testdataFactory.createTargets(maxActions + 1);
final DistributionSet ds = testdataFactory.createDistributionSet();
@@ -401,9 +409,10 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
assertThat(targetManagement.findByAssignedDistributionSet(ds.getId(), PAGE).getContent()).isEmpty();
}
@Test
@Description("Ensures that the 'max actions per target' quota is enforced if the distribution set assignment of a target is changed permanently")
void changeDistributionSetAssignmentForTargetUntilQuotaIsExceeded() throws Exception {
/**
* Ensures that the 'max actions per target' quota is enforced if the distribution set assignment of a target is changed permanently
*/
@Test void changeDistributionSetAssignmentForTargetUntilQuotaIsExceeded() throws Exception {
// create one target
final Target testTarget = testdataFactory.createTarget("trg1");
@@ -427,9 +436,10 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
.andExpect(status().isForbidden());
}
@Test
@Description("Ensures that offline reported multi target assignment through API is reflected by the repository.")
void offlineAssignmentOfMultipleTargetsToDistributionSet() throws Exception {
/**
* Ensures that offline reported multi target assignment through API is reflected by the repository.
*/
@Test void offlineAssignmentOfMultipleTargetsToDistributionSet() throws Exception {
final DistributionSet createdDs = testdataFactory.createDistributionSet();
final List<Target> targets = testdataFactory.createTargets(5);
final JSONArray list = new JSONArray();
@@ -457,9 +467,10 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
assertThat(targetManagement.findByInstalledDistributionSet(createdDs.getId(), PAGE).getContent()).hasSize(4);
}
@Test
@Description("Assigns multiple targets to distribution set with only maintenance schedule.")
void assignMultipleTargetsToDistributionSetWithMaintenanceWindowStartOnly() throws Exception {
/**
* Assigns multiple targets to distribution set with only maintenance schedule.
*/
@Test void assignMultipleTargetsToDistributionSetWithMaintenanceWindowStartOnly() throws Exception {
// prepare distribution set
final DistributionSet createdDs = testdataFactory.createDistributionSet();
// prepare targets
@@ -474,9 +485,10 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
.andExpect(status().isBadRequest());
}
@Test
@Description("Assigns multiple targets to distribution set with only maintenance window duration.")
void assignMultipleTargetsToDistributionSetWithMaintenanceWindowEndOnly() throws Exception {
/**
* Assigns multiple targets to distribution set with only maintenance window duration.
*/
@Test void assignMultipleTargetsToDistributionSetWithMaintenanceWindowEndOnly() throws Exception {
// prepare distribution set
final DistributionSet createdDs = testdataFactory.createDistributionSet();
// prepare targets
@@ -491,9 +503,10 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
.andExpect(status().isBadRequest());
}
@Test
@Description("Assigns multiple targets to distribution set with valid maintenance window.")
void assignMultipleTargetsToDistributionSetWithValidMaintenanceWindow() throws Exception {
/**
* Assigns multiple targets to distribution set with valid maintenance window.
*/
@Test void assignMultipleTargetsToDistributionSetWithValidMaintenanceWindow() throws Exception {
// prepare distribution set
final DistributionSet createdDs = testdataFactory.createDistributionSet();
// prepare targets
@@ -509,9 +522,10 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
.andExpect(status().isOk());
}
@Test
@Description("Assigns multiple targets to distribution set with last maintenance window scheduled before current time.")
void assignMultipleTargetsToDistributionSetWithMaintenanceWindowEndTimeBeforeStartTime() throws Exception {
/**
* Assigns multiple targets to distribution set with last maintenance window scheduled before current time.
*/
@Test void assignMultipleTargetsToDistributionSetWithMaintenanceWindowEndTimeBeforeStartTime() throws Exception {
// prepare distribution set
final DistributionSet createdDs = testdataFactory.createDistributionSet();
// prepare targets
@@ -527,9 +541,10 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
.andExpect(status().isBadRequest());
}
@Test
@Description("Assigns multiple targets to distribution set with and without maintenance window.")
void assignMultipleTargetsToDistributionSetWithAndWithoutMaintenanceWindow() throws Exception {
/**
* Assigns multiple targets to distribution set with and without maintenance window.
*/
@Test void assignMultipleTargetsToDistributionSetWithAndWithoutMaintenanceWindow() throws Exception {
// prepare distribution set
final DistributionSet createdDs = testdataFactory.createDistributionSet();
// prepare targets
@@ -554,9 +569,10 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
.andExpect(status().isOk());
}
@Test
@Description("Assigning distribution set to the list of targets with a non-existing one leads to successful assignment of valid targets, while not found targets are silently ignored.")
void assignNotExistingTargetToDistributionSet() throws Exception {
/**
* Assigning distribution set to the list of targets with a non-existing one leads to successful assignment of valid targets, while not found targets are silently ignored.
*/
@Test void assignNotExistingTargetToDistributionSet() throws Exception {
final DistributionSet createdDs = testdataFactory.createDistributionSet();
final String[] knownTargetIds = new String[] { "1", "2", "3" };
@@ -574,9 +590,10 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
.andExpect(jsonPath("$.total", equalTo(3)));
}
@Test
@Description("Ensures that assigned targets of DS are returned as reflected by the repository.")
void getAssignedTargetsOfDistributionSet() throws Exception {
/**
* Ensures that assigned targets of DS are returned as reflected by the repository.
*/
@Test void getAssignedTargetsOfDistributionSet() throws Exception {
// prepare distribution set
final String knownTargetId = "knownTargetId1";
final DistributionSet createdDs = testdataFactory.createDistributionSet();
@@ -589,9 +606,10 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
.andExpect(jsonPath("$.content[0].controllerId", equalTo(knownTargetId)));
}
@Test
@Description("Handles the GET request for retrieving assigned targets of a single distribution set with a defined page size and offset, sorted by name in descending order and filtered down to all targets which controllerID starts with 'target'.")
void getAssignedTargetsOfDistributionSetWithParameters() throws Exception {
/**
* Handles the GET request for retrieving assigned targets of a single distribution set with a defined page size and offset, sorted by name in descending order and filtered down to all targets which controllerID starts with 'target'.
*/
@Test void getAssignedTargetsOfDistributionSetWithParameters() throws Exception {
final DistributionSet set = testdataFactory.createUpdatedDistributionSet();
assignDistributionSet(set, testdataFactory.createTargets(5, "targetMisc", "Test targets for query"))
@@ -606,9 +624,10 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
}
@Test
@Description("Ensures that assigned targets of DS are returned as persisted in the repository.")
void getAssignedTargetsOfDistributionSetIsEmpty() throws Exception {
/**
* Ensures that assigned targets of DS are returned as persisted in the repository.
*/
@Test void getAssignedTargetsOfDistributionSetIsEmpty() throws Exception {
final DistributionSet createdDs = testdataFactory.createDistributionSet();
mvc.perform(get(
MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/" + createdDs.getId() + "/assignedTargets"))
@@ -617,9 +636,10 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
.andExpect(jsonPath("$.total", equalTo(0)));
}
@Test
@Description("Ensures that installed targets of DS are returned as persisted in the repository.")
void getInstalledTargetsOfDistributionSet() throws Exception {
/**
* Ensures that installed targets of DS are returned as persisted in the repository.
*/
@Test void getInstalledTargetsOfDistributionSet() throws Exception {
// prepare distribution set
final String knownTargetId = "knownTargetId1";
final DistributionSet createdDs = testdataFactory.createDistributionSet();
@@ -640,9 +660,10 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
.andExpect(jsonPath("$.content[0].controllerId", equalTo(knownTargetId)));
}
@Test
@Description("Handles the GET request for retrieving installed targets of a single distribution set with a defined page size and offset, sortet by name in descending order and filtered down to all targets which controllerID starts with 'target'.")
void getInstalledTargetsOfDistributionSetWithParameters() throws Exception {
/**
* Handles the GET request for retrieving installed targets of a single distribution set with a defined page size and offset, sortet by name in descending order and filtered down to all targets which controllerID starts with 'target'.
*/
@Test void getInstalledTargetsOfDistributionSetWithParameters() throws Exception {
final DistributionSet set = testdataFactory.createUpdatedDistributionSet();
final List<Target> targets = assignDistributionSet(set,
@@ -658,9 +679,10 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
.andExpect(content().contentType(MediaType.APPLICATION_JSON));
}
@Test
@Description("Ensures that target filters with auto assign DS are returned as persisted in the repository.")
void getAutoAssignTargetFiltersOfDistributionSet() throws Exception {
/**
* Ensures that target filters with auto assign DS are returned as persisted in the repository.
*/
@Test void getAutoAssignTargetFiltersOfDistributionSet() throws Exception {
// prepare distribution set
final String knownFilterName = "a";
final DistributionSet createdDs = testdataFactory.createDistributionSet();
@@ -679,9 +701,10 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
.andExpect(jsonPath("$.content[0].name", equalTo(knownFilterName)));
}
@Test
@Description("Handles the GET request for retrieving assigned target filter queries of a single distribution set with a defined page size and offset, sorted by name in descending order and filtered down to all targets with a name that ends with '1'.")
void ggetAutoAssignTargetFiltersOfDistributionSetWithParameters() throws Exception {
/**
* Handles the GET request for retrieving assigned target filter queries of a single distribution set with a defined page size and offset, sorted by name in descending order and filtered down to all targets with a name that ends with '1'.
*/
@Test void ggetAutoAssignTargetFiltersOfDistributionSetWithParameters() throws Exception {
final DistributionSet set = testdataFactory.createUpdatedDistributionSet();
targetFilterQueryManagement.create(entityFactory.targetFilterQuery().create().name("filter1").query("name==a")
.autoAssignDistributionSet(set));
@@ -695,9 +718,10 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
}
@Test
@Description("Ensures that an error is returned when the query is invalid.")
void getAutoAssignTargetFiltersOfDSWithInvalidFilter() throws Exception {
/**
* Ensures that an error is returned when the query is invalid.
*/
@Test void getAutoAssignTargetFiltersOfDSWithInvalidFilter() throws Exception {
// prepare distribution set
final DistributionSet createdDs = testdataFactory.createDistributionSet();
final String invalidQuery = "unknownField=le=42";
@@ -707,9 +731,10 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
.andExpect(status().isBadRequest());
}
@Test
@Description("Ensures that target filters with auto assign DS are returned according to the query.")
void getMultipleAutoAssignTargetFiltersOfDistributionSet() throws Exception {
/**
* Ensures that target filters with auto assign DS are returned according to the query.
*/
@Test void getMultipleAutoAssignTargetFiltersOfDistributionSet() throws Exception {
final String filterNamePrefix = "filter-";
final DistributionSet createdDs = testdataFactory.createDistributionSet();
final String query = "name==" + filterNamePrefix + "*";
@@ -724,9 +749,10 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
.andExpect(jsonPath("$.content[1].name", equalTo(filterNamePrefix + "2")));
}
@Test
@Description("Ensures that no target filters are returned according to the non matching query.")
void getEmptyAutoAssignTargetFiltersOfDistributionSet() throws Exception {
/**
* Ensures that no target filters are returned according to the non matching query.
*/
@Test void getEmptyAutoAssignTargetFiltersOfDistributionSet() throws Exception {
final String filterNamePrefix = "filter-";
final DistributionSet createdDs = testdataFactory.createDistributionSet();
final String query = "name==doesNotExist";
@@ -739,9 +765,10 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
.andExpect(jsonPath("$.size", equalTo(0)));
}
@Test
@Description("Ensures that DS in repository are listed with proper paging properties.")
void getDistributionSetsWithoutAdditionalRequestParameters() throws Exception {
/**
* Ensures that DS in repository are listed with proper paging properties.
*/
@Test void getDistributionSetsWithoutAdditionalRequestParameters() throws Exception {
final int sets = 5;
createDistributionSetsAlphabetical(sets);
mvc.perform(get(MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING))
@@ -752,9 +779,10 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
.andExpect(jsonPath(MgmtTargetResourceTest.JSON_PATH_PAGED_LIST_CONTENT, hasSize(sets)));
}
@Test
@Description("Ensures that DS in repository are listed with proper paging results with paging limit parameter.")
void getDistributionSetsWithPagingLimitRequestParameter() throws Exception {
/**
* Ensures that DS in repository are listed with proper paging results with paging limit parameter.
*/
@Test void getDistributionSetsWithPagingLimitRequestParameter() throws Exception {
final int sets = 5;
final int limitSize = 1;
createDistributionSetsAlphabetical(sets);
@@ -767,9 +795,10 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
.andExpect(jsonPath(MgmtTargetResourceTest.JSON_PATH_PAGED_LIST_CONTENT, hasSize(limitSize)));
}
@Test
@Description("Ensures that DS in repository are listed with proper paging results with paging limit and offset parameter.")
void getDistributionSetsWithPagingLimitAndOffsetRequestParameter() throws Exception {
/**
* Ensures that DS in repository are listed with proper paging results with paging limit and offset parameter.
*/
@Test void getDistributionSetsWithPagingLimitAndOffsetRequestParameter() throws Exception {
final int sets = 5;
final int offsetParam = 2;
final int expectedSize = sets - offsetParam;
@@ -784,9 +813,11 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
.andExpect(jsonPath(MgmtTargetResourceTest.JSON_PATH_PAGED_LIST_CONTENT, hasSize(expectedSize)));
}
/**
* Ensures that multiple DS requested are listed with expected payload.
*/
@Test
@WithUser(principal = "uploadTester", allSpPermissions = true)
@Description("Ensures that multiple DS requested are listed with expected payload.")
void getDistributionSets() throws Exception {
// prepare test data
assertThat(distributionSetManagement.findByCompleted(true, PAGE)).isEmpty();
@@ -826,9 +857,11 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
contains(getOsModule(set).intValue())));
}
/**
* Ensures that single DS requested by ID is listed with expected payload.
*/
@Test
@WithUser(principal = "uploadTester", allSpPermissions = true)
@Description("Ensures that single DS requested by ID is listed with expected payload.")
void getDistributionSet() throws Exception {
final DistributionSet set = testdataFactory.createUpdatedDistributionSet();
@@ -860,9 +893,11 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
}
/**
* Ensures that multipe DS posted to API are created in the repository.
*/
@Test
@WithUser(principal = "uploadTester", allSpPermissions = true)
@Description("Ensures that multipe DS posted to API are created in the repository.")
void createDistributionSets() throws Exception {
assertThat(distributionSetManagement.findByCompleted(true, PAGE)).isEmpty();
final SoftwareModule ah = testdataFactory.createSoftwareModule(TestdataFactory.SM_TYPE_APP);
@@ -917,9 +952,10 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
assertThat(three.getCreatedAt()).isGreaterThanOrEqualTo(current);
}
@Test
@Description("Ensures that DS deletion request to API is reflected by the repository.")
void deleteUnassignedistributionSet() throws Exception {
/**
* Ensures that DS deletion request to API is reflected by the repository.
*/
@Test void deleteUnassignedistributionSet() throws Exception {
// prepare test data
assertThat(distributionSetManagement.findByCompleted(true, PAGE)).isEmpty();
@@ -937,17 +973,19 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
assertThat(distributionSetManagement.count()).isZero();
}
@Test
@Description("Ensures that DS deletion request to API on an entity that does not exist results in NOT_FOUND.")
void deleteDistributionSetThatDoesNotExistLeadsToNotFound() throws Exception {
/**
* Ensures that DS deletion request to API on an entity that does not exist results in NOT_FOUND.
*/
@Test void deleteDistributionSetThatDoesNotExistLeadsToNotFound() throws Exception {
mvc.perform(delete("/rest/v1/distributionsets/1234"))
.andDo(MockMvcResultPrinter.print())
.andExpect(status().isNotFound());
}
@Test
@Description("Ensures that assigned DS deletion request to API is reflected by the repository by means of deleted flag set.")
void deleteAssignedDistributionSet() throws Exception {
/**
* Ensures that assigned DS deletion request to API is reflected by the repository by means of deleted flag set.
*/
@Test void deleteAssignedDistributionSet() throws Exception {
// prepare test data
assertThat(distributionSetManagement.findByCompleted(true, PAGE)).isEmpty();
@@ -975,9 +1013,10 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
assertThat(distributionSetManagement.findByCompleted(true, PAGE)).isEmpty();
}
@Test
@Description("Ensures that DS property update request to API is reflected by the repository.")
void updateDistributionSet() throws Exception {
/**
* Ensures that DS property update request to API is reflected by the repository.
*/
@Test void updateDistributionSet() throws Exception {
// prepare test data
assertThat(distributionSetManagement.findByCompleted(true, PAGE)).isEmpty();
@@ -1004,9 +1043,10 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
assertThat(setupdated.isDeleted()).isFalse();
}
@Test
@Description("Ensures that DS property update on requiredMigrationStep fails if DS is assigned to a target.")
void updateRequiredMigrationStepFailsIfDistributionSetisInUse() throws Exception {
/**
* Ensures that DS property update on requiredMigrationStep fails if DS is assigned to a target.
*/
@Test void updateRequiredMigrationStepFailsIfDistributionSetisInUse() throws Exception {
// prepare test data
assertThat(distributionSetManagement.findByCompleted(true, PAGE)).isEmpty();
@@ -1029,9 +1069,10 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
assertThat(setupdated.getName()).isEqualTo(set.getName());
}
@Test
@Description("Ensures that the server reacts properly to invalid requests (URI, Media Type, Methods) with correct reponses.")
void invalidRequestsOnDistributionSetsResource() throws Exception {
/**
* Ensures that the server reacts properly to invalid requests (URI, Media Type, Methods) with correct reponses.
*/
@Test void invalidRequestsOnDistributionSetsResource() throws Exception {
final DistributionSet set = testdataFactory.createDistributionSet("one");
final List<DistributionSet> sets = new ArrayList<>();
@@ -1090,9 +1131,10 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
}
@Test
@Description("Ensures that the metadata creation through API is reflected by the repository.")
void createMetadata() throws Exception {
/**
* Ensures that the metadata creation through API is reflected by the repository.
*/
@Test void createMetadata() throws Exception {
final DistributionSet testDS = testdataFactory.createDistributionSet("one");
final String knownKey1 = "known.key.1.1";
@@ -1132,9 +1174,10 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
assertThat(distributionSetManagement.getMetadata(testDS.getId())).hasSize(metaData1.length());
}
@Test
@Description("Ensures that a metadata update through API is reflected by the repository.")
void updateMetadata() throws Exception {
/**
* Ensures that a metadata update through API is reflected by the repository.
*/
@Test void updateMetadata() throws Exception {
// prepare and create metadata for update
final String knownKey = "knownKey";
final String knownValue = "knownValue";
@@ -1153,9 +1196,10 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
assertThat(distributionSetManagement.getMetadata(testDS.getId()).get(knownKey)).isEqualTo(updateValue);
}
@Test
@Description("Ensures that a metadata entry deletion through API is reflected by the repository.")
void deleteMetadata() throws Exception {
/**
* Ensures that a metadata entry deletion through API is reflected by the repository.
*/
@Test void deleteMetadata() throws Exception {
// prepare and create metadata for deletion
final String knownKey = "knownKey";
final String knownValue = "knownValue";
@@ -1175,9 +1219,10 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
assertThat(distributionSetManagement.getMetadata(testDS.getId()).get(knownKey)).isNull();
}
@Test
@Description("Ensures that DS metadata deletion request to API on an entity that does not exist results in NOT_FOUND.")
void deleteMetadataThatDoesNotExistLeadsToNotFound() throws Exception {
/**
* Ensures that DS metadata deletion request to API on an entity that does not exist results in NOT_FOUND.
*/
@Test void deleteMetadataThatDoesNotExistLeadsToNotFound() throws Exception {
// prepare and create metadata for deletion
final String knownKey = "knownKey";
final String knownValue = "knownValue";
@@ -1195,9 +1240,10 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
assertThat(distributionSetManagement.getMetadata(testDS.getId()).get(knownKey)).isNotNull();
}
@Test
@Description("Ensures that a metadata entry selection through API reflects the repository content.")
void getMetadataKey() throws Exception {
/**
* Ensures that a metadata entry selection through API reflects the repository content.
*/
@Test void getMetadataKey() throws Exception {
// prepare and create metadata
final String knownKey = "knownKey";
final String knownValue = "knownValue";
@@ -1211,9 +1257,10 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
.andExpect(jsonPath("value", equalTo(knownValue)));
}
@Test
@Description("Get a paged list of meta data for a distribution set with standard page size.")
void getMetadata() throws Exception {
/**
* Get a paged list of meta data for a distribution set with standard page size.
*/
@Test void getMetadata() throws Exception {
final int totalMetadata = 4;
final String knownKeyPrefix = "knownKey";
final String knownValuePrefix = "knownValue";
@@ -1228,9 +1275,10 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
.andExpect(content().contentType(MediaTypes.HAL_JSON));
}
@Test
@Description("Ensures that a DS search with query parameters returns the expected result.")
void searchDistributionSetRsql() throws Exception {
/**
* Ensures that a DS search with query parameters returns the expected result.
*/
@Test void searchDistributionSetRsql() throws Exception {
final String dsSuffix = "test";
final int amount = 10;
testdataFactory.createDistributionSets(dsSuffix, amount);
@@ -1249,9 +1297,10 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
}
@Test
@Description("Ensures that a DS search with complete==true parameter returns only DS that are actually completely filled with mandatory modules.")
void filterDistributionSetComplete() throws Exception {
/**
* Ensures that a DS search with complete==true parameter returns only DS that are actually completely filled with mandatory modules.
*/
@Test void filterDistributionSetComplete() throws Exception {
final int amount = 10;
testdataFactory.createDistributionSets(amount);
distributionSetManagement
@@ -1266,9 +1315,10 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
.andExpect(jsonPath("total", equalTo(10)));
}
@Test
@Description("Ensures that a DS assigned target search with controllerId==1 parameter returns only the target with the given ID.")
void searchDistributionSetAssignedTargetsRsql() throws Exception {
/**
* Ensures that a DS assigned target search with controllerId==1 parameter returns only the target with the given ID.
*/
@Test void searchDistributionSetAssignedTargetsRsql() throws Exception {
// prepare distribution set
final Set<DistributionSet> createDistributionSetsAlphabetical = createDistributionSetsAlphabetical(1);
final DistributionSet createdDs = createDistributionSetsAlphabetical.iterator().next();
@@ -1291,9 +1341,10 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
.andExpect(jsonPath("content[0].controllerId", equalTo("1")));
}
/**
* Ensures that multi target assignment through API is reflected by the repository in the case of DOWNLOAD_ONLY.
*/
@Test
@Description("Ensures that multi target assignment through API is reflected by the repository in the case of "
+ "DOWNLOAD_ONLY.")
void assignMultipleTargetsToDistributionSetAsDownloadOnly() throws Exception {
final DistributionSet createdDs = testdataFactory.createDistributionSet();
@@ -1314,9 +1365,11 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
.as("Five targets in repository have DS assigned").hasSize(5);
}
/**
* Ensures that confirmation option is considered in assignment request.
*/
@ParameterizedTest
@MethodSource("confirmationOptions")
@Description("Ensures that confirmation option is considered in assignment request.")
void assignTargetsToDistributionSetWithConfirmationOptions(final boolean confirmationFlowActive,
final Boolean confirmationRequired) throws Exception {
final DistributionSet createdDs = testdataFactory.createDistributionSet();
@@ -1349,9 +1402,10 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
});
}
@Test
@Description("A request for assigning a target multiple times results in a Bad Request when multiassignment is disabled.")
void multiAssignmentRequestNotAllowedIfDisabled() throws Exception {
/**
* A request for assigning a target multiple times results in a Bad Request when multiassignment is disabled.
*/
@Test void multiAssignmentRequestNotAllowedIfDisabled() throws Exception {
final String targetId = testdataFactory.createTarget().getControllerId();
final Long dsId = testdataFactory.createDistributionSet().getId();
@@ -1365,9 +1419,10 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
.andExpect(status().isBadRequest());
}
@Test
@Description("Identical assignments in a single request are removed when multiassignment is disabled.")
void identicalAssignmentInRequestAreRemovedIfMultiassignmentsDisabled() throws Exception {
/**
* Identical assignments in a single request are removed when multiassignment is disabled.
*/
@Test void identicalAssignmentInRequestAreRemovedIfMultiassignmentsDisabled() throws Exception {
final String targetId = testdataFactory.createTarget().getControllerId();
final Long dsId = testdataFactory.createDistributionSet().getId();
@@ -1382,9 +1437,10 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
.andExpect(jsonPath("total", equalTo(1)));
}
@Test
@Description("Assigning targets multiple times to a DS in one request works in multiassignment mode.")
void multiAssignment() throws Exception {
/**
* Assigning targets multiple times to a DS in one request works in multiassignment mode.
*/
@Test void multiAssignment() throws Exception {
final List<String> targetIds = testdataFactory.createTargets(2).stream().map(Target::getControllerId)
.toList();
final Long dsId = testdataFactory.createDistributionSet().getId();
@@ -1403,9 +1459,10 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
.andExpect(jsonPath("total", equalTo(body.length())));
}
@Test
@Description("An assignment request containing a weight is only accepted when weight is valide and multi assignment is on.")
void weightValidation() throws Exception {
/**
* An assignment request containing a weight is only accepted when weight is valide and multi assignment is on.
*/
@Test void weightValidation() throws Exception {
final String targetId = testdataFactory.createTarget().getControllerId();
final Long dsId = testdataFactory.createDistributionSet().getId();
final int weight = 78;
@@ -1434,9 +1491,10 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
assertThat(actions.get(0).getWeight()).get().isEqualTo(weight);
}
@Test
@Description("Request to get the count of all Rollouts by status for specific Distribution set")
void statisticsForRolloutsCountByStatus() throws Exception {
/**
* Request to get the count of all Rollouts by status for specific Distribution set
*/
@Test void statisticsForRolloutsCountByStatus() throws Exception {
testdataFactory.createTargets("targets", 4);
DistributionSet ds1 = testdataFactory.createDistributionSet("DS1");
DistributionSet ds2 = testdataFactory.createDistributionSet("DS2");
@@ -1467,9 +1525,10 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
.andExpect(jsonPath("totalAutoAssignments").doesNotExist());
}
@Test
@Description("Request to get the count of all Actions by status for specific Distribution set")
void statisticsForActionsCountByStatus() throws Exception {
/**
* Request to get the count of all Actions by status for specific Distribution set
*/
@Test void statisticsForActionsCountByStatus() throws Exception {
testdataFactory.createTargets("targets", 4);
DistributionSet ds1 = testdataFactory.createDistributionSet("DS1");
@@ -1498,9 +1557,10 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
.andExpect(jsonPath("totalAutoAssignments").doesNotExist());
}
@Test
@Description("Request to get the count of all Auto Assignments for specific Distribution set")
void statisticsForAutoAssignmentsCount() throws Exception {
/**
* Request to get the count of all Auto Assignments for specific Distribution set
*/
@Test void statisticsForAutoAssignmentsCount() throws Exception {
testdataFactory.createTargets("targets", 4);
DistributionSet ds1 = testdataFactory.createDistributionSet("DS1");
DistributionSet ds2 = testdataFactory.createDistributionSet("DS2");
@@ -1530,9 +1590,10 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
.andExpect(jsonPath("totalAutoAssignments").doesNotExist());
}
@Test
@Description("Request to get full Statistics for specific Distribution set")
void statisticsForDistributionSet() throws Exception {
/**
* Request to get full Statistics for specific Distribution set
*/
@Test void statisticsForDistributionSet() throws Exception {
testdataFactory.createTargets("targets", 4);
testdataFactory.createTargets("autoAssignments", 4);
DistributionSet ds1 = testdataFactory.createDistributionSet("DS1");
@@ -1566,9 +1627,10 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
.andExpect(jsonPath("totalAutoAssignments").doesNotExist());
}
@Test
@Description("Verify invalidation of distribution sets that removes distribution sets from auto assignments, stops rollouts and cancels assignments")
void invalidateDistributionSet() throws Exception {
/**
* Verify invalidation of distribution sets that removes distribution sets from auto assignments, stops rollouts and cancels assignments
*/
@Test void invalidateDistributionSet() throws Exception {
final DistributionSet distributionSet = testdataFactory.createDistributionSet();
final List<Target> targets = testdataFactory.createTargets(5, "invalidateDistributionSet");
assignDistributionSet(distributionSet, targets);
@@ -1600,9 +1662,10 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
}
}
@Test
@Description("Tests the lock. It is verified that the distribution set can be marked as locked through update operation.")
void lockDistributionSet() throws Exception {
/**
* Tests the lock. It is verified that the distribution set can be marked as locked through update operation.
*/
@Test void lockDistributionSet() throws Exception {
// prepare test data
assertThat(distributionSetManagement.findByCompleted(true, PAGE)).isEmpty();
@@ -1622,9 +1685,10 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
assertThat(updatedSet.isLocked()).isTrue();
}
@Test
@Description("Tests the unlock.")
void unlockDistributionSet() throws Exception {
/**
* Tests the unlock.
*/
@Test void unlockDistributionSet() throws Exception {
// prepare test data
assertThat(distributionSetManagement.findByCompleted(true, PAGE)).isEmpty();
@@ -1699,7 +1763,6 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
.create(entityFactory.targetFilterQuery().create().name(filterNamePrefix + "c").query("name==y"));
}
@Step
private MvcResult executeMgmtTargetPost(final DistributionSet one, final DistributionSet two,
final DistributionSet three) throws Exception {
return mvc

View File

@@ -27,9 +27,6 @@ import java.util.List;
import java.util.Map;
import java.util.Random;
import io.qameta.allure.Description;
import io.qameta.allure.Feature;
import io.qameta.allure.Story;
import org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants;
import org.eclipse.hawkbit.mgmt.rest.resource.util.ResourceUtility;
import org.eclipse.hawkbit.repository.event.remote.DistributionSetTagDeletedEvent;
@@ -51,16 +48,19 @@ import org.junit.jupiter.api.Test;
import org.springframework.http.MediaType;
import org.springframework.test.web.servlet.ResultActions;
@Feature("Component Tests - Management API")
@Story("Distribution Set Tag Resource")
/**
* Feature: Component Tests - Management API<br/>
* Story: Distribution Set Tag Resource
*/
class MgmtDistributionSetTagResourceTest extends AbstractManagementApiIntegrationTest {
private static final String DISTRIBUTIONSETTAGS_ROOT = "http://localhost" + MgmtRestConstants.DISTRIBUTIONSET_TAG_V1_REQUEST_MAPPING + "/";
private static final Random RND = new Random();
@Test
@Description("Verifies that a paged result list of DS tags reflects the content on the repository side.")
@ExpectEvents({ @Expect(type = DistributionSetTagCreatedEvent.class, count = 2) })
/**
* Verifies that a paged result list of DS tags reflects the content on the repository side.
*/
@Test @ExpectEvents({ @Expect(type = DistributionSetTagCreatedEvent.class, count = 2) })
void getDistributionSetTags() throws Exception {
final List<DistributionSetTag> tags = testdataFactory.createDistributionSetTags(2);
final DistributionSetTag assigned = tags.get(0);
@@ -79,18 +79,20 @@ class MgmtDistributionSetTagResourceTest extends AbstractManagementApiIntegratio
.andExpect(jsonPath(MgmtTargetResourceTest.JSON_PATH_PAGED_LIST_CONTENT, hasSize(2)));
}
@Test
@Description("Handles the GET request of retrieving all distribution set tags based by parameter")
void getDistributionSetTagsWithParameters() throws Exception {
/**
* Handles the GET request of retrieving all distribution set tags based by parameter
*/
@Test void getDistributionSetTagsWithParameters() throws Exception {
testdataFactory.createDistributionSetTags(2);
mvc.perform(get(MgmtRestConstants.DISTRIBUTIONSET_TAG_V1_REQUEST_MAPPING + "?limit=10&sort=name:ASC&offset=0&q=name==DsTag"))
.andDo(MockMvcResultPrinter.print())
.andExpect(status().isOk());
}
@Test
@Description("Verifies that a paged result list of DS tags reflects the content on the repository side when filtered by distribution set id.")
void getDistributionSetTagsByDistributionSetId() throws Exception {
/**
* Verifies that a paged result list of DS tags reflects the content on the repository side when filtered by distribution set id.
*/
@Test void getDistributionSetTagsByDistributionSetId() throws Exception {
final List<DistributionSetTag> tags = testdataFactory.createDistributionSetTags(2);
final DistributionSetTag tag1 = tags.get(0);
final DistributionSetTag tag2 = tags.get(1);
@@ -127,9 +129,10 @@ class MgmtDistributionSetTagResourceTest extends AbstractManagementApiIntegratio
.andExpect(jsonPath(MgmtTargetResourceTest.JSON_PATH_PAGED_LIST_CONTENT, hasSize(1)));
}
@Test
@Description("Verifies that a paged result list of DS tags reflects the content on the repository side when filtered by distribution set id field AND tag field.")
void getDistributionSetTagsByDistributionSetIdAndTagDescription() throws Exception {
/**
* Verifies that a paged result list of DS tags reflects the content on the repository side when filtered by distribution set id field AND tag field.
*/
@Test void getDistributionSetTagsByDistributionSetIdAndTagDescription() throws Exception {
final List<DistributionSetTag> tags = testdataFactory.createDistributionSetTags(2);
final DistributionSetTag tag1 = tags.get(0);
final DistributionSetTag tag2 = tags.get(1);
@@ -155,9 +158,10 @@ class MgmtDistributionSetTagResourceTest extends AbstractManagementApiIntegratio
.andExpect(jsonPath(MgmtTargetResourceTest.JSON_PATH_PAGED_LIST_CONTENT, hasSize(1)));
}
@Test
@Description("Verifies that a single result of a DS tag reflects the content on the repository side.")
@ExpectEvents({ @Expect(type = DistributionSetTagCreatedEvent.class, count = 2) })
/**
* Verifies that a single result of a DS tag reflects the content on the repository side.
*/
@Test @ExpectEvents({ @Expect(type = DistributionSetTagCreatedEvent.class, count = 2) })
void getDistributionSetTag() throws Exception {
final List<DistributionSetTag> tags = testdataFactory.createDistributionSetTags(2);
final DistributionSetTag assigned = tags.get(0);
@@ -173,9 +177,10 @@ class MgmtDistributionSetTagResourceTest extends AbstractManagementApiIntegratio
equalTo(DISTRIBUTIONSETTAGS_ROOT + assigned.getId() + "/assigned?offset=0&limit=50")));
}
@Test
@Description("Verifies that created DS tags are stored in the repository as send to the API.")
@ExpectEvents({ @Expect(type = DistributionSetTagCreatedEvent.class, count = 2) })
/**
* Verifies that created DS tags are stored in the repository as send to the API.
*/
@Test @ExpectEvents({ @Expect(type = DistributionSetTagCreatedEvent.class, count = 2) })
void createDistributionSetTags() throws Exception {
final Tag tagOne = entityFactory.tag().create().colour("testcol1").description("its a test1").name("thetest1")
.build();
@@ -203,9 +208,10 @@ class MgmtDistributionSetTagResourceTest extends AbstractManagementApiIntegratio
.andExpect(applyTagMatcherOnArrayResult(createdTwo));
}
@Test
@Description("Verifies that an updated DS tag is stored in the repository as send to the API.")
@ExpectEvents({
/**
* Verifies that an updated DS tag is stored in the repository as send to the API.
*/
@Test @ExpectEvents({
@Expect(type = DistributionSetTagCreatedEvent.class, count = 1),
@Expect(type = DistributionSetTagUpdatedEvent.class, count = 1) })
void updateDistributionSetTag() throws Exception {
@@ -232,9 +238,10 @@ class MgmtDistributionSetTagResourceTest extends AbstractManagementApiIntegratio
.andExpect(applyTagMatcherOnArrayResult(updated));
}
@Test
@Description("Verifies that the delete call is reflected by the repository.")
@ExpectEvents({
/**
* Verifies that the delete call is reflected by the repository.
*/
@Test @ExpectEvents({
@Expect(type = DistributionSetTagCreatedEvent.class, count = 1),
@Expect(type = DistributionSetTagDeletedEvent.class, count = 1) })
void deleteDistributionSetTag() throws Exception {
@@ -248,9 +255,10 @@ class MgmtDistributionSetTagResourceTest extends AbstractManagementApiIntegratio
assertThat(distributionSetTagManagement.get(original.getId())).isNotPresent();
}
@Test
@Description("Ensures that assigned DS to tag in repository are listed with proper paging results.")
@ExpectEvents({
/**
* Ensures that assigned DS to tag in repository are listed with proper paging results.
*/
@Test @ExpectEvents({
@Expect(type = DistributionSetTagCreatedEvent.class, count = 1),
@Expect(type = DistributionSetCreatedEvent.class, count = 5),
@Expect(type = DistributionSetUpdatedEvent.class, count = 5) })
@@ -268,9 +276,10 @@ class MgmtDistributionSetTagResourceTest extends AbstractManagementApiIntegratio
.andExpect(jsonPath(MgmtTargetResourceTest.JSON_PATH_PAGED_LIST_CONTENT, hasSize(setsAssigned)));
}
@Test
@Description("Ensures that assigned DS to tag in repository are listed with proper paging results with paging limit parameter.")
@ExpectEvents({
/**
* Ensures that assigned DS to tag in repository are listed with proper paging results with paging limit parameter.
*/
@Test @ExpectEvents({
@Expect(type = DistributionSetTagCreatedEvent.class, count = 1),
@Expect(type = DistributionSetCreatedEvent.class, count = 5),
@Expect(type = DistributionSetUpdatedEvent.class, count = 5) })
@@ -290,9 +299,10 @@ class MgmtDistributionSetTagResourceTest extends AbstractManagementApiIntegratio
.andExpect(jsonPath(MgmtTargetResourceTest.JSON_PATH_PAGED_LIST_CONTENT, hasSize(limitSize)));
}
@Test
@Description("Ensures that assigned DS to tag in repository are listed with proper paging results with paging limit and offset parameter.")
@ExpectEvents({
/**
* Ensures that assigned DS to tag in repository are listed with proper paging results with paging limit and offset parameter.
*/
@Test @ExpectEvents({
@Expect(type = DistributionSetTagCreatedEvent.class, count = 1),
@Expect(type = DistributionSetCreatedEvent.class, count = 5),
@Expect(type = DistributionSetUpdatedEvent.class, count = 5) })
@@ -315,9 +325,10 @@ class MgmtDistributionSetTagResourceTest extends AbstractManagementApiIntegratio
.andExpect(jsonPath(MgmtTargetResourceTest.JSON_PATH_PAGED_LIST_CONTENT, hasSize(expectedSize)));
}
@Test
@Description("Verifies that tag assignments done through tag API command are correctly stored in the repository.")
@ExpectEvents({
/**
* Verifies that tag assignments done through tag API command are correctly stored in the repository.
*/
@Test @ExpectEvents({
@Expect(type = DistributionSetTagCreatedEvent.class, count = 1),
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
@Expect(type = DistributionSetUpdatedEvent.class, count = 1) })
@@ -334,9 +345,10 @@ class MgmtDistributionSetTagResourceTest extends AbstractManagementApiIntegratio
assertThat(updated.stream().map(DistributionSet::getId).toList()).containsOnly(set.getId());
}
@Test
@Description("Verifies that tag assignments done through tag API command are correctly stored in the repository.")
@ExpectEvents({
/**
* Verifies that tag assignments done through tag API command are correctly stored in the repository.
*/
@Test @ExpectEvents({
@Expect(type = DistributionSetTagCreatedEvent.class, count = 1),
@Expect(type = DistributionSetCreatedEvent.class, count = 2),
@Expect(type = DistributionSetUpdatedEvent.class, count = 2) })
@@ -355,9 +367,10 @@ class MgmtDistributionSetTagResourceTest extends AbstractManagementApiIntegratio
.containsAll(sets.stream().map(DistributionSet::getId).toList());
}
@Test
@Description("Verifies that tag unassignments done through tag API command are correctly stored in the repository.")
@ExpectEvents({
/**
* Verifies that tag unassignments done through tag API command are correctly stored in the repository.
*/
@Test @ExpectEvents({
@Expect(type = DistributionSetTagCreatedEvent.class, count = 1),
@Expect(type = DistributionSetCreatedEvent.class, count = 2),
@Expect(type = DistributionSetUpdatedEvent.class, count = 3) })
@@ -380,9 +393,10 @@ class MgmtDistributionSetTagResourceTest extends AbstractManagementApiIntegratio
.containsOnly(assigned.getId());
}
@Test
@Description("Verifies that tag unassignments done through tag API command are correctly stored in the repository.")
@ExpectEvents({
/**
* Verifies that tag unassignments done through tag API command are correctly stored in the repository.
*/
@Test @ExpectEvents({
@Expect(type = DistributionSetTagCreatedEvent.class, count = 1),
@Expect(type = DistributionSetCreatedEvent.class, count = 3),
@Expect(type = DistributionSetUpdatedEvent.class, count = 5) })
@@ -406,9 +420,10 @@ class MgmtDistributionSetTagResourceTest extends AbstractManagementApiIntegratio
.containsOnly(assigned.getId());
}
@Test
@Description("Verifies that tag assignments (multi targets) done through tag API command are correctly stored in the repository.")
@ExpectEvents({
/**
* Verifies that tag assignments (multi targets) done through tag API command are correctly stored in the repository.
*/
@Test @ExpectEvents({
@Expect(type = DistributionSetTagCreatedEvent.class, count = 1),
@Expect(type = DistributionSetCreatedEvent.class, count = 2) })
void assignDistributionSetsNotFound() throws Exception {

Some files were not shown because too many files have changed in this diff Show More