Fix new line after @Test (#2486)

Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
This commit is contained in:
Avgustin Marinov
2025-06-20 17:42:55 +03:00
committed by GitHub
parent cb7f1107fe
commit ef25aa59f0
152 changed files with 2948 additions and 1474 deletions

View File

@@ -22,7 +22,8 @@ class Base62UtilTest {
/**
* Convert Base10 numbers to Base62 ASCII strings.
*/
@Test void fromBase10() {
@Test
void fromBase10() {
assertThat(Base62Util.fromBase10(0L)).isEqualTo("0");
assertThat(Base62Util.fromBase10(11L)).isEqualTo("B");
assertThat(Base62Util.fromBase10(36L)).isEqualTo("a");
@@ -32,7 +33,8 @@ class Base62UtilTest {
/**
* Convert Base62 ASCII strings to Base10 numbers.
*/
@Test void toBase10() {
@Test
void toBase10() {
assertThat(Base62Util.toBase10("0")).isZero();
assertThat(Base62Util.toBase10("B")).isEqualTo(11);
assertThat(Base62Util.toBase10("a")).isEqualTo(36L);

View File

@@ -62,7 +62,8 @@ class PropertyBasedArtifactUrlHandlerTest {
/**
* Tests the generation of http download url.
*/
@Test void urlGenerationWithDefaultConfiguration() {
@Test
void urlGenerationWithDefaultConfiguration() {
properties.getProtocols().put("download-http", new UrlProtocol());
final List<ArtifactUrl> ddiUrls = urlHandlerUnderTest.getUrls(placeHolder, ApiType.DDI);
@@ -77,7 +78,8 @@ class PropertyBasedArtifactUrlHandlerTest {
/**
* Tests the generation of custom download url with a CoAP example that supports DMF only.
*/
@Test void urlGenerationWithCustomConfiguration() {
@Test
void urlGenerationWithCustomConfiguration() {
final UrlProtocol proto = new UrlProtocol();
proto.setIp("127.0.0.1");
proto.setPort(5683);
@@ -97,7 +99,8 @@ class PropertyBasedArtifactUrlHandlerTest {
/**
* Tests the generation of custom download url using Base62 references with a CoAP example that supports DMF only.
*/
@Test void urlGenerationWithCustomShortConfiguration() {
@Test
void urlGenerationWithCustomShortConfiguration() {
final UrlProtocol proto = new UrlProtocol();
proto.setIp("127.0.0.1");
proto.setPort(5683);
@@ -117,7 +120,8 @@ class PropertyBasedArtifactUrlHandlerTest {
/**
* Verifies that the full qualified host of the statically defined hostname is replaced with the host of the request.
*/
@Test void urlGenerationWithHostFromRequest() throws URISyntaxException {
@Test
void urlGenerationWithHostFromRequest() throws URISyntaxException {
final String testHost = "ddi.host.com";
final UrlProtocol proto = new UrlProtocol();
@@ -138,7 +142,8 @@ class PropertyBasedArtifactUrlHandlerTest {
/**
* Verifies that the protocol of the statically defined hostname is replaced with the protocol of the request.
*/
@Test void urlGenerationWithProtocolFromRequest() throws URISyntaxException {
@Test
void urlGenerationWithProtocolFromRequest() throws URISyntaxException {
final String testHost = "ddi.host.com";
final UrlProtocol proto = new UrlProtocol();
@@ -154,7 +159,8 @@ class PropertyBasedArtifactUrlHandlerTest {
/**
* Verifies that the port of the statically defined hostname is replaced with the port of the request.
*/
@Test void urlGenerationWithPortFromRequest() throws URISyntaxException {
@Test
void urlGenerationWithPortFromRequest() throws URISyntaxException {
final UrlProtocol proto = new UrlProtocol();
proto.setRef("{protocol}://{hostname}:{portRequest}/{tenant}/controller/v1/{controllerId}/softwaremodules/{softwareModuleId}/artifacts/{artifactFileName}");
@@ -176,7 +182,8 @@ class PropertyBasedArtifactUrlHandlerTest {
/**
* Verifies that if default protocol port in request is used then url is returned without port
*/
@Test void urlGenerationWithPortFromRequestForHttps() throws URISyntaxException {
@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}");
@@ -195,7 +202,8 @@ class PropertyBasedArtifactUrlHandlerTest {
/**
* Verifies that the domain of the statically defined hostname is replaced with the domain of the request.
*/
@Test void urlGenerationWithDomainFromRequest() throws URISyntaxException {
@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

@@ -30,7 +30,8 @@ class URLPlaceholderTest {
/**
* Same object should be equal
*/
@Test // Exception squid:S5785 - JUnit assertTrue/assertFalse should be simplified to the corresponding dedicated assertion
@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() {
@@ -41,7 +42,8 @@ class URLPlaceholderTest {
/**
* Different object should not be equal
*/
@Test @SuppressWarnings({ "squid:S5838" })
@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);
@@ -57,7 +59,8 @@ class URLPlaceholderTest {
/**
* Different objects with same properties should be equal
*/
@Test void differentObjectsWithSamePropertiesShouldBeEqual() {
@Test
void differentObjectsWithSamePropertiesShouldBeEqual() {
final URLPlaceholder placeholderWithSameProperties = new URLPlaceholder(placeholder.getTenant(), placeholder.getTenantId(),
placeholder.getControllerId(), placeholder.getTargetId(), softwareData);
assertThat(placeholder).isEqualTo(placeholderWithSameProperties);
@@ -67,7 +70,8 @@ class URLPlaceholderTest {
/**
* Should not equal null
*/
@Test // Exception squid:S5785 - JUnit assertTrue/assertFalse should be simplified to
@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
@@ -80,7 +84,8 @@ class URLPlaceholderTest {
/**
* HashCode should not change
*/
@Test void hashCodeShouldNotChange() {
@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

@@ -59,7 +59,8 @@ class ArtifactFilesystemRepositoryTest {
/**
* Verifies that an artifact can be successfully stored in the file-system repository
*/
@Test void storeSuccessfully() throws IOException {
@Test
void storeSuccessfully() throws IOException {
final byte[] fileContent = randomBytes();
final AbstractDbArtifact artifact = storeRandomArtifact(fileContent);
@@ -71,7 +72,8 @@ class ArtifactFilesystemRepositoryTest {
/**
* Verifies that an artifact can be successfully stored in the file-system repository
*/
@Test void getStoredArtifactBasedOnSHA1Hash() throws IOException {
@Test
void getStoredArtifactBasedOnSHA1Hash() throws IOException {
final byte[] fileContent = randomBytes();
final AbstractDbArtifact artifact = storeRandomArtifact(fileContent);
@@ -81,7 +83,8 @@ class ArtifactFilesystemRepositoryTest {
/**
* Verifies that an artifact can be deleted in the file-system repository
*/
@Test void deleteStoredArtifactBySHA1Hash() throws IOException {
@Test
void deleteStoredArtifactBySHA1Hash() throws IOException {
final AbstractDbArtifact artifact = storeRandomArtifact(randomBytes());
artifactFilesystemRepository.deleteBySha1(TENANT, artifact.getHashes().getSha1());
@@ -91,7 +94,8 @@ class ArtifactFilesystemRepositoryTest {
/**
* Verifies that all artifacts of a tenant can be deleted in the file-system repository
*/
@Test void deleteStoredArtifactOfTenant() throws IOException {
@Test
void deleteStoredArtifactOfTenant() throws IOException {
final AbstractDbArtifact artifact = storeRandomArtifact(randomBytes());
artifactFilesystemRepository.deleteByTenant(TENANT);
@@ -101,7 +105,8 @@ class ArtifactFilesystemRepositoryTest {
/**
* Verifies that an artifact which does not exists is deleted quietly in the file-system repository
*/
@Test void deleteArtifactWhichDoesNotExistsBySHA1HashWithoutException() throws IOException {
@Test
void deleteArtifactWhichDoesNotExistsBySHA1HashWithoutException() throws IOException {
try {
artifactFilesystemRepository.deleteBySha1(TENANT, "sha1HashWhichDoesNotExists");
} catch (final Exception e) {

View File

@@ -29,7 +29,8 @@ class ArtifactFilesystemTest {
/**
* Verifies that an exception is thrown on opening an InputStream when file does not exists
*/
@Test void getInputStreamOfNonExistingFileThrowsException() {
@Test
void getInputStreamOfNonExistingFileThrowsException() {
final File file = new File("fileWhichTotalDoesNotExists");
final ArtifactFilesystem underTest = new ArtifactFilesystem(
file, "fileWhichTotalDoesNotExists",
@@ -42,7 +43,8 @@ class ArtifactFilesystemTest {
/**
* Verifies that an InputStream can be opened if file exists
*/
@Test void getInputStreamOfExistingFile() throws IOException {
@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

@@ -23,7 +23,8 @@ class FileNameFieldsTest {
/**
* Verifies that fields classes are correctly implemented
*/
@Test @SuppressWarnings("unchecked")
@Test
@SuppressWarnings("unchecked")
void repositoryManagementMethodsArePreAuthorizedAnnotated() {
final String packageName = getClass().getPackage().getName();
try (final ScanResult scanResult = new ClassGraph().acceptPackages(packageName).scan()) {

View File

@@ -34,7 +34,8 @@ class DdiActionFeedbackTest {
/**
* Verify the correct serialization and deserialization of the model with minimal payload
*/
@Test void shouldSerializeAndDeserializeObjectWithoutOptionalValues() throws IOException {
@Test
void shouldSerializeAndDeserializeObjectWithoutOptionalValues() throws IOException {
// Setup
final DdiStatus ddiStatus = new DdiStatus(DdiStatus.ExecutionStatus.CLOSED, null, null, Collections.emptyList());
final DdiActionFeedback ddiActionFeedback = new DdiActionFeedback(ddiStatus);
@@ -50,7 +51,8 @@ class DdiActionFeedbackTest {
/**
* Verify the correct serialization and deserialization of the model with all values provided
*/
@Test void shouldSerializeAndDeserializeObjectWithOptionalValues() throws IOException {
@Test
void shouldSerializeAndDeserializeObjectWithOptionalValues() throws IOException {
// Setup
final Long timestamp = System.currentTimeMillis();
final DdiResult ddiResult = new DdiResult(DdiResult.FinalResult.SUCCESS, new DdiProgress(10, 10));
@@ -68,7 +70,8 @@ class DdiActionFeedbackTest {
/**
* Verify that deserialization fails for known properties with a wrong datatype
*/
@Test void shouldFailForObjectWithWrongDataTypes() {
@Test
void shouldFailForObjectWithWrongDataTypes() {
// Setup
final String serializedDdiActionFeedback = """
{
@@ -87,7 +90,8 @@ class DdiActionFeedbackTest {
/**
* Verify that deserialization works if optional fields are not parsed
*/
@Test void shouldConvertItWithoutOptionalFieldTimestamp() throws JsonProcessingException {
@Test
void shouldConvertItWithoutOptionalFieldTimestamp() throws JsonProcessingException {
// Setup
final String serializedDdiActionFeedback = """
{

View File

@@ -34,7 +34,8 @@ class DdiActionHistoryTest {
/**
* Verify the correct serialization and deserialization of the model
*/
@Test void shouldSerializeAndDeserializeObject() throws IOException {
@Test
void shouldSerializeAndDeserializeObject() throws IOException {
// Setup
final String actionStatus = "TestAction";
final List<String> messages = Arrays.asList("Action status message 1", "Action status message 2");
@@ -50,7 +51,8 @@ class DdiActionHistoryTest {
/**
* Verify the correct deserialization of a model with a additional unknown property
*/
@Test void shouldDeserializeObjectWithUnknownProperty() throws IOException {
@Test
void shouldDeserializeObjectWithUnknownProperty() throws IOException {
// Setup
final String serializedDdiActionHistory = """
{
@@ -67,7 +69,8 @@ class DdiActionHistoryTest {
/**
* Verify that deserialization fails for known properties with a wrong datatype
*/
@Test void shouldFailForObjectWithWrongDataTypes() {
@Test
void shouldFailForObjectWithWrongDataTypes() {
// Setup
final String serializedDdiActionFeedback = """
{

View File

@@ -32,7 +32,8 @@ class DdiArtifactHashTest {
/**
* Verify the correct serialization and deserialization of the model
*/
@Test void shouldSerializeAndDeserializeObject() throws IOException {
@Test
void shouldSerializeAndDeserializeObject() throws IOException {
// Setup
final String sha1Hash = "11111";
final String md5Hash = "22222";
@@ -51,7 +52,8 @@ class DdiArtifactHashTest {
/**
* Verify the correct deserialization of a model with a additional unknown property
*/
@Test void shouldDeserializeObjectWithUnknownProperty() throws IOException {
@Test
void shouldDeserializeObjectWithUnknownProperty() throws IOException {
// Setup
final String serializedDdiArtifact = "{\"sha1\": \"123\", \"md5\": \"456\", \"sha256\": \"789\", \"unknownProperty\": \"test\"}";
@@ -65,7 +67,8 @@ class DdiArtifactHashTest {
/**
* Verify that deserialization fails for known properties with a wrong datatype
*/
@Test void shouldFailForObjectWithWrongDataTypes() {
@Test
void shouldFailForObjectWithWrongDataTypes() {
// Setup
final String serializedDdiArtifact = "{\"sha1\": [123], \"md5\": 456, \"sha256\": \"789\"";

View File

@@ -32,7 +32,8 @@ class DdiArtifactTest {
/**
* Verify the correct serialization and deserialization of the model
*/
@Test void shouldSerializeAndDeserializeObject() throws IOException {
@Test
void shouldSerializeAndDeserializeObject() throws IOException {
// Setup
final String filename = "testfile.txt";
final DdiArtifactHash hashes = new DdiArtifactHash("123", "456", "789");
@@ -54,7 +55,8 @@ class DdiArtifactTest {
/**
* Verify the correct deserialization of a model with a additional unknown property
*/
@Test void shouldDeserializeObjectWithUnknownProperty() throws IOException {
@Test
void shouldDeserializeObjectWithUnknownProperty() throws IOException {
// Setup
final String serializedDdiArtifact = "{\"filename\":\"test.file\",\"hashes\":{\"sha1\":\"123\",\"md5\":\"456\",\"sha256\":\"789\"},\"size\":111,\"links\":[],\"unknownProperty\": \"test\"}";
@@ -70,7 +72,8 @@ class DdiArtifactTest {
/**
* Verify that deserialization fails for known properties with a wrong datatype
*/
@Test void shouldFailForObjectWithWrongDataTypes() {
@Test
void shouldFailForObjectWithWrongDataTypes() {
// Setup
final String serializedDdiArtifact = "{\"filename\": [\"test.file\"],\"hashes\":{\"sha1\":\"123\",\"md5\":\"456\",\"sha256\":\"789\"},\"size\":111,\"links\":[]}";

View File

@@ -32,7 +32,8 @@ class DdiCancelActionToStopTest {
/**
* Verify the correct serialization and deserialization of the model
*/
@Test void shouldSerializeAndDeserializeObject() throws IOException {
@Test
void shouldSerializeAndDeserializeObject() throws IOException {
// Setup
final String stopId = "1234";
final DdiCancelActionToStop ddiCancelActionToStop = new DdiCancelActionToStop(stopId);
@@ -48,7 +49,8 @@ class DdiCancelActionToStopTest {
/**
* Verify the correct deserialization of a model with a additional unknown property
*/
@Test void shouldDeserializeObjectWithUnknownProperty() throws IOException {
@Test
void shouldDeserializeObjectWithUnknownProperty() throws IOException {
// Setup
final String serializedDdiCancelActionToStop = "{\"stopId\":\"12345\",\"unknownProperty\":\"test\"}";
@@ -61,7 +63,8 @@ class DdiCancelActionToStopTest {
/**
* Verify that deserialization fails for known properties with a wrong datatype
*/
@Test void shouldFailForObjectWithWrongDataTypes() {
@Test
void shouldFailForObjectWithWrongDataTypes() {
// Setup
final String serializedDdiCancelActionToStop = "{\"stopId\": [\"12345\"]}";

View File

@@ -32,7 +32,8 @@ class DdiCancelTest {
/**
* Verify the correct serialization and deserialization of the model
*/
@Test void shouldSerializeAndDeserializeObject() throws IOException {
@Test
void shouldSerializeAndDeserializeObject() throws IOException {
// Setup
final String ddiCancelId = "1234";
final DdiCancelActionToStop ddiCancelActionToStop = new DdiCancelActionToStop("1234");
@@ -49,7 +50,8 @@ class DdiCancelTest {
/**
* Verify the correct deserialization of a model with a additional unknown property
*/
@Test void shouldDeserializeObjectWithUnknownProperty() throws IOException {
@Test
void shouldDeserializeObjectWithUnknownProperty() throws IOException {
// Setup
final String serializedDdiCancel = "{\"id\":\"1234\",\"cancelAction\":{\"stopId\":\"1234\"}, \"unknownProperty\": \"test\"}";
@@ -62,7 +64,8 @@ class DdiCancelTest {
/**
* Verify that deserialization fails for known properties with a wrong datatype
*/
@Test void shouldFailForObjectWithWrongDataTypes() {
@Test
void shouldFailForObjectWithWrongDataTypes() {
// Setup
final String serializedDdiCancel = "{\"id\":[\"1234\"],\"cancelAction\":{\"stopId\":\"1234\"}}";

View File

@@ -34,7 +34,8 @@ class DdiChunkTest {
/**
* Verify the correct serialization and deserialization of the model
*/
@Test void shouldSerializeAndDeserializeObject() throws IOException {
@Test
void shouldSerializeAndDeserializeObject() throws IOException {
// Setup
final String part = "1234";
final String version = "1.0";
@@ -55,7 +56,8 @@ class DdiChunkTest {
/**
* Verify the correct deserialization of a model with a additional unknown property
*/
@Test void shouldDeserializeObjectWithUnknownProperty() throws IOException {
@Test
void shouldDeserializeObjectWithUnknownProperty() throws IOException {
// Setup
final String serializedDdiChunk = "{\"part\":\"1234\",\"version\":\"1.0\",\"name\":\"Dummy-Artifact\",\"artifacts\":[],\"unknownProperty\":\"test\"}";
@@ -70,7 +72,8 @@ class DdiChunkTest {
/**
* Verify that deserialization fails for known properties with a wrong datatype
*/
@Test void shouldFailForObjectWithWrongDataTypes() {
@Test
void shouldFailForObjectWithWrongDataTypes() {
// Setup
final String serializedDdiChunk = "{\"part\":[\"1234\"],\"version\":\"1.0\",\"name\":\"Dummy-Artifact\",\"artifacts\":[]}";

View File

@@ -34,7 +34,8 @@ class DdiConfigDataTest {
/**
* Verify the correct serialization and deserialization of the model
*/
@Test void shouldSerializeAndDeserializeObject() throws IOException {
@Test
void shouldSerializeAndDeserializeObject() throws IOException {
// Setup
final Map<String, String> data = new HashMap<>();
data.put("test", "data");
@@ -50,7 +51,8 @@ class DdiConfigDataTest {
/**
* Verify the correct deserialization of a model with an additional unknown property
*/
@Test void shouldDeserializeObjectWithUnknownProperty() throws IOException {
@Test
void shouldDeserializeObjectWithUnknownProperty() throws IOException {
// Setup
final String serializedDdiConfigData = "{\"data\":{\"test\":\"data\"},\"mode\":\"replace\",\"unknownProperty\":\"test\"}";
@@ -62,7 +64,8 @@ class DdiConfigDataTest {
/**
* Verify that deserialization fails for known properties with a wrong datatype
*/
@Test void shouldFailForObjectWithWrongDataTypes() {
@Test
void shouldFailForObjectWithWrongDataTypes() {
// Setup
final String serializedDdiConfigData = "{\"data\":{\"test\":\"data\"},\"mode\":[\"replace\"],\"unknownProperty\":\"test\"}";
@@ -74,7 +77,8 @@ class DdiConfigDataTest {
/**
* Verify the correct deserialization of a model with removed unused status property
*/
@Test void shouldDeserializeObjectWithStatusProperty() throws IOException {
@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

@@ -32,7 +32,8 @@ class DdiConfigTest {
/**
* Verify the correct serialization and deserialization of the model
*/
@Test void shouldSerializeAndDeserializeObject() throws IOException {
@Test
void shouldSerializeAndDeserializeObject() throws IOException {
// Setup
final DdiPolling ddiPolling = new DdiPolling("10");
final DdiConfig ddiConfig = new DdiConfig(ddiPolling);
@@ -47,7 +48,8 @@ class DdiConfigTest {
/**
* Verify the correct deserialization of a model with a additional unknown property
*/
@Test void shouldDeserializeObjectWithUnknownProperty() throws IOException {
@Test
void shouldDeserializeObjectWithUnknownProperty() throws IOException {
// Setup
final String serializedDdiConfig = "{\"polling\":{\"sleep\":\"123\"},\"unknownProperty\":\"test\"}";
@@ -59,7 +61,8 @@ class DdiConfigTest {
/**
* Verify that deserialization fails for known properties with a wrong datatype
*/
@Test void shouldFailForObjectWithWrongDataTypes() {
@Test
void shouldFailForObjectWithWrongDataTypes() {
// Setup
final String serializedDdiConfig = "{\"polling\":{\"sleep\":[\"10\"]}}";

View File

@@ -37,7 +37,8 @@ class DdiConfirmationBaseTest {
/**
* Verify the correct serialization and deserialization of the model
*/
@Test void shouldSerializeAndDeserializeObject() throws IOException {
@Test
void shouldSerializeAndDeserializeObject() throws IOException {
// Setup
final String id = "1234";
final DdiDeployment ddiDeployment = new DdiDeployment(FORCED, ATTEMPT, Collections.emptyList(), AVAILABLE);
@@ -65,7 +66,8 @@ class DdiConfirmationBaseTest {
/**
* Verify the correct deserialization of a model with a additional unknown property
*/
@Test void shouldDeserializeObjectWithUnknownProperty() throws IOException {
@Test
void shouldDeserializeObjectWithUnknownProperty() throws IOException {
// Setup
final String serializedDdiConfirmationBase = "{" +
"\"id\":\"1234\",\"confirmation\":{\"download\":\"forced\"," +
@@ -87,7 +89,8 @@ class DdiConfirmationBaseTest {
/**
* Verify that deserialization fails for known properties with a wrong datatype
*/
@Test void shouldFailForObjectWithWrongDataTypes() {
@Test
void shouldFailForObjectWithWrongDataTypes() {
// Setup
final String serializedDdiConfirmationBase = "{" +
"\"id\":[\"1234\"],\"confirmation\":{\"download\":\"forced\"," +

View File

@@ -32,7 +32,8 @@ class DdiControllerBaseTest {
/**
* Verify the correct serialization and deserialization of the model
*/
@Test void shouldSerializeAndDeserializeObject() throws IOException {
@Test
void shouldSerializeAndDeserializeObject() throws IOException {
// Setup
final DdiPolling ddiPolling = new DdiPolling("10");
final DdiConfig ddiConfig = new DdiConfig(ddiPolling);
@@ -48,7 +49,8 @@ class DdiControllerBaseTest {
/**
* Verify the correct deserialization of a model with a additional unknown property
*/
@Test void shouldDeserializeObjectWithUnknownProperty() throws IOException {
@Test
void shouldDeserializeObjectWithUnknownProperty() throws IOException {
// Setup
final String serializedDdiControllerBase = "{\"config\":{\"polling\":{\"sleep\":\"123\"}},\"links\":[],\"unknownProperty\":\"test\"}";
@@ -60,7 +62,8 @@ class DdiControllerBaseTest {
/**
* Verify that deserialization fails for known properties with a wrong datatype
*/
@Test void shouldFailForObjectWithWrongDataTypes() {
@Test
void shouldFailForObjectWithWrongDataTypes() {
// Setup
final String serializedDdiControllerBase = "{\"config\":{\"polling\":{\"sleep\":[\"123\"]}},\"links\":[],\"unknownProperty\":\"test\"}";

View File

@@ -37,7 +37,8 @@ class DdiDeploymentBaseTest {
/**
* Verify the correct serialization and deserialization of the model
*/
@Test void shouldSerializeAndDeserializeObject() throws IOException {
@Test
void shouldSerializeAndDeserializeObject() throws IOException {
// Setup
final String id = "1234";
final DdiDeployment ddiDeployment = new DdiDeployment(FORCED, ATTEMPT, Collections.emptyList(), AVAILABLE);
@@ -59,7 +60,8 @@ class DdiDeploymentBaseTest {
/**
* Verify the correct deserialization of a model with a additional unknown property
*/
@Test void shouldDeserializeObjectWithUnknownProperty() throws IOException {
@Test
void shouldDeserializeObjectWithUnknownProperty() throws IOException {
// Setup
final String serializedDdiDeploymentBase = "{\"id\":\"1234\",\"deployment\":{\"download\":\"forced\"," +
"\"update\":\"attempt\",\"maintenanceWindow\":\"available\",\"chunks\":[]}," +
@@ -76,7 +78,8 @@ class DdiDeploymentBaseTest {
/**
* Verify that deserialization fails for known properties with a wrong datatype
*/
@Test void shouldFailForObjectWithWrongDataTypes() {
@Test
void shouldFailForObjectWithWrongDataTypes() {
// Setup
final String serializedDdiDeploymentBase = "{\"id\":[\"1234\"],\"deployment\":{\"download\":\"forced\"," +
"\"update\":\"attempt\",\"maintenanceWindow\":\"available\",\"chunks\":[]}," +

View File

@@ -36,7 +36,8 @@ class DdiDeploymentTest {
/**
* Verify the correct serialization and deserialization of the model
*/
@Test void shouldSerializeAndDeserializeObject() throws IOException {
@Test
void shouldSerializeAndDeserializeObject() throws IOException {
// Setup
final DdiDeployment ddiDeployment = new DdiDeployment(FORCED, ATTEMPT, Collections.emptyList(), AVAILABLE);
@@ -53,7 +54,8 @@ class DdiDeploymentTest {
/**
* Verify the correct deserialization of a model with a additional unknown property
*/
@Test void shouldDeserializeObjectWithUnknownProperty() throws IOException {
@Test
void shouldDeserializeObjectWithUnknownProperty() throws IOException {
// Setup
final String serializedDdiDeployment = "{\"download\":\"forced\",\"update\":\"attempt\", " +
"\"maintenanceWindow\":\"available\",\"chunks\":[],\"unknownProperty\":\"test\"}";
@@ -68,7 +70,8 @@ class DdiDeploymentTest {
/**
* Verify that deserialization fails for known properties with a wrong datatype
*/
@Test void shouldFailForObjectWithWrongDataTypes() {
@Test
void shouldFailForObjectWithWrongDataTypes() {
// Setup
final String serializedDdiDeployment = "{\"download\":[\"forced\"],\"update\":\"attempt\", " +
"\"maintenanceWindow\":\"available\",\"chunks\":[]}";

View File

@@ -32,7 +32,8 @@ class DdiMetadataTest {
/**
* Verify the correct serialization and deserialization of the model
*/
@Test void shouldSerializeAndDeserializeObject() throws IOException {
@Test
void shouldSerializeAndDeserializeObject() throws IOException {
// Setup
final String key = "testKey";
final String value = "testValue";
@@ -49,7 +50,8 @@ class DdiMetadataTest {
/**
* Verify the correct deserialization of a model with a additional unknown property
*/
@Test void shouldDeserializeObjectWithUnknownProperty() throws IOException {
@Test
void shouldDeserializeObjectWithUnknownProperty() throws IOException {
// Setup
final String serializedDdiMetadata = "{\"key\":\"testKey\",\"value\":\"testValue\",\"unknownProperty\":\"test\"}";
@@ -62,7 +64,8 @@ class DdiMetadataTest {
/**
* Verify that deserialization fails for known properties with a wrong datatype
*/
@Test void shouldFailForObjectWithWrongDataTypes() {
@Test
void shouldFailForObjectWithWrongDataTypes() {
// Setup
final String serializedDdiMetadata = "{\"key\":[\"testKey\"],\"value\":\"testValue\"}";

View File

@@ -32,7 +32,8 @@ class DdiPollingTest {
/**
* Verify the correct serialization and deserialization of the model
*/
@Test void shouldSerializeAndDeserializeObject() throws IOException {
@Test
void shouldSerializeAndDeserializeObject() throws IOException {
// Setup
final DdiPolling ddiPolling = new DdiPolling("10");
@@ -46,7 +47,8 @@ class DdiPollingTest {
/**
* Verify the correct deserialization of a model with a additional unknown property
*/
@Test void shouldDeserializeObjectWithUnknownProperty() throws IOException {
@Test
void shouldDeserializeObjectWithUnknownProperty() throws IOException {
// Setup
final String serializedDdiPolling = "{\"sleep\":\"10\",\"unknownProperty\":\"test\"}";
@@ -58,7 +60,8 @@ class DdiPollingTest {
/**
* Verify that deserialization fails for known properties with a wrong datatype
*/
@Test void shouldFailForObjectWithWrongDataTypes() {
@Test
void shouldFailForObjectWithWrongDataTypes() {
// Setup
final String serializedDdiPolling = "{\"sleep\":[\"10\"]}";

View File

@@ -32,7 +32,8 @@ class DdiProgressTest {
/**
* Verify the correct serialization and deserialization of the model
*/
@Test void shouldSerializeAndDeserializeObject() throws IOException {
@Test
void shouldSerializeAndDeserializeObject() throws IOException {
// Setup
final DdiProgress ddiProgress = new DdiProgress(30, 100);
@@ -47,7 +48,8 @@ class DdiProgressTest {
/**
* Verify the correct deserialization of a model with a additional unknown property
*/
@Test void shouldDeserializeObjectWithUnknownProperty() throws IOException {
@Test
void shouldDeserializeObjectWithUnknownProperty() throws IOException {
// Setup
final String serializedDdiProgress = "{\"cnt\":30,\"of\":100,\"unknownProperty\":\"test\"}";
@@ -60,7 +62,8 @@ class DdiProgressTest {
/**
* Verify that deserialization fails for known properties with a wrong datatype
*/
@Test void shouldFailForObjectWithWrongDataTypes() {
@Test
void shouldFailForObjectWithWrongDataTypes() {
// Setup
final String serializedDdiProgress = "{\"cnt\":[30],\"of\":100}";

View File

@@ -33,7 +33,8 @@ class DdiResultTest {
/**
* Verify the correct serialization and deserialization of the model
*/
@Test void shouldSerializeAndDeserializeObject() throws IOException {
@Test
void shouldSerializeAndDeserializeObject() throws IOException {
// Setup
final DdiProgress ddiProgress = new DdiProgress(30, 100);
final DdiResult ddiResult = new DdiResult(NONE, ddiProgress);
@@ -50,7 +51,8 @@ class DdiResultTest {
/**
* Verify the correct deserialization of a model with a additional unknown property
*/
@Test void shouldDeserializeObjectWithUnknownProperty() throws IOException {
@Test
void shouldDeserializeObjectWithUnknownProperty() throws IOException {
// Setup
final String serializedDdiResult = "{\"finished\":\"none\",\"progress\":{\"cnt\":30,\"of\":100},\"unknownProperty\":\"test\"}";
@@ -64,7 +66,8 @@ class DdiResultTest {
/**
* Verify that deserialization fails for known properties with a wrong datatype
*/
@Test void shouldFailForObjectWithWrongDataTypes() {
@Test
void shouldFailForObjectWithWrongDataTypes() {
// Setup
final String serializedDdiResult = "{\"finished\":[\"none\"],\"progress\":{\"cnt\":30,\"of\":100}}";

View File

@@ -57,7 +57,8 @@ class DdiStatusTest {
/**
* Verify the correct deserialization of a model with a additional unknown property
*/
@Test void shouldDeserializeObjectWithUnknownProperty() throws IOException {
@Test
void shouldDeserializeObjectWithUnknownProperty() throws IOException {
// Setup
final String serializedDdiStatus = "{\"execution\":\"proceeding\",\"result\":{\"finished\":\"none\"," +
"\"progress\":{\"cnt\":30,\"of\":100}},\"details\":[],\"unknownProperty\":\"test\"}";
@@ -74,7 +75,8 @@ class DdiStatusTest {
/**
* Verify the correct deserialization of a model with a provided code (optional)
*/
@Test void shouldDeserializeObjectWithOptionalCode() throws IOException {
@Test
void shouldDeserializeObjectWithOptionalCode() throws IOException {
// Setup
final String serializedDdiStatus = "{\"execution\":\"proceeding\",\"result\":{\"finished\":\"none\"," +
"\"progress\":{\"cnt\":30,\"of\":100}},\"code\": 12,\"details\":[]}";
@@ -91,7 +93,8 @@ class DdiStatusTest {
/**
* Verify that deserialization fails for known properties with a wrong datatype
*/
@Test void shouldFailForObjectWithWrongDataTypes() {
@Test
void shouldFailForObjectWithWrongDataTypes() {
// Setup
final String serializedDdiStatus = "{\"execution\":[\"proceeding\"],\"result\":{\"finished\":\"none\"," +
"\"progress\":{\"cnt\":30,\"of\":100}},\"details\":[]}";

View File

@@ -31,7 +31,8 @@ class JsonIgnorePropertiesAnnotationTest {
/**
* 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() {
@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

@@ -70,7 +70,8 @@ class DdiArtifactDownloadTest extends AbstractDDiApiIntegrationTest {
/**
* Tests non allowed requests on the artifact ressource, e.g. invalid URI, wrong if-match, wrong command.
*/
@Test void invalidRequestsOnArtifactResource() throws Exception {
@Test
void invalidRequestsOnArtifactResource() throws Exception {
// create target
final Target target = testdataFactory.createTarget();
final List<Target> targets = Collections.singletonList(target);
@@ -207,7 +208,8 @@ class DdiArtifactDownloadTest extends AbstractDDiApiIntegrationTest {
/**
* Tests valid MD5SUm file downloads through the artifact resource by identifying the artifact by ID.
*/
@Test void downloadMd5sumThroughControllerApi() throws Exception {
@Test
void downloadMd5sumThroughControllerApi() throws Exception {
// create target
final Target target = testdataFactory.createTarget();

View File

@@ -55,7 +55,8 @@ class DdiCancelActionTest extends AbstractDDiApiIntegrationTest {
/**
* Tests that the cancel action resource can be used with CBOR.
*/
@Test void cancelActionCbor() throws Exception {
@Test
void cancelActionCbor() throws Exception {
final DistributionSet ds = testdataFactory.createDistributionSet("");
testdataFactory.createTarget();
final Long actionId = getFirstAssignedActionId(
@@ -89,7 +90,8 @@ class DdiCancelActionTest extends AbstractDDiApiIntegrationTest {
/**
* Test of the controller can continue a started update even after a cancel command if it so desires.
*/
@Test void rootRsCancelActionButContinueAnyway() throws Exception {
@Test
void rootRsCancelActionButContinueAnyway() throws Exception {
// prepare test data
final DistributionSet ds = testdataFactory.createDistributionSet("");
final Target savedTarget = testdataFactory.createTarget();
@@ -150,7 +152,8 @@ class DdiCancelActionTest extends AbstractDDiApiIntegrationTest {
/**
* Test for cancel operation of a update action.
*/
@Test void rootRsCancelAction() throws Exception {
@Test
void rootRsCancelAction() throws Exception {
final DistributionSet ds = testdataFactory.createDistributionSet("");
final Target savedTarget = testdataFactory.createTarget();
@@ -232,7 +235,8 @@ class DdiCancelActionTest extends AbstractDDiApiIntegrationTest {
/**
* Tests various bad requests and if the server handles them as expected.
*/
@Test void badCancelAction() throws Exception {
@Test
void badCancelAction() throws Exception {
// not allowed methods
mvc.perform(post("/{tenant}/controller/v1/" + TestdataFactory.DEFAULT_CONTROLLER_ID + "/cancelAction/1",
@@ -269,7 +273,8 @@ class DdiCancelActionTest extends AbstractDDiApiIntegrationTest {
/**
* Tests the feedback channel of the cancel operation.
*/
@Test void rootRsCancelActionFeedback() throws Exception {
@Test
void rootRsCancelActionFeedback() throws Exception {
final DistributionSet ds = testdataFactory.createDistributionSet("");
@@ -350,7 +355,8 @@ class DdiCancelActionTest extends AbstractDDiApiIntegrationTest {
/**
* Tests the feeback chanel of for multiple open cancel operations on the same target.
*/
@Test void multipleCancelActionFeedback() throws Exception {
@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);
@@ -482,7 +488,8 @@ class DdiCancelActionTest extends AbstractDDiApiIntegrationTest {
/**
* Tests the feeback channel closing for too many feedbacks, i.e. denial of service prevention.
*/
@Test void tooMuchCancelActionFeedback() throws Exception {
@Test
void tooMuchCancelActionFeedback() throws Exception {
testdataFactory.createTarget();
final DistributionSet ds = testdataFactory.createDistributionSet("");
@@ -511,7 +518,8 @@ class DdiCancelActionTest extends AbstractDDiApiIntegrationTest {
/**
* test the correct rejection of various invalid feedback requests
*/
@Test void badCancelActionFeedback() throws Exception {
@Test
void badCancelActionFeedback() throws Exception {
final Action cancelAction = createCancelAction(TestdataFactory.DEFAULT_CONTROLLER_ID);
createCancelAction("4715");

View File

@@ -58,7 +58,8 @@ class DdiConfigDataTest extends AbstractDDiApiIntegrationTest {
/**
* Verify that config data can be uploaded as CBOR
*/
@Test void putConfigDataAsCbor() throws Exception {
@Test
void putConfigDataAsCbor() throws Exception {
testdataFactory.createTarget(TARGET1_ID);
final Map<String, String> attributes = new HashMap<>();
@@ -209,7 +210,8 @@ class DdiConfigDataTest extends AbstractDDiApiIntegrationTest {
/**
* Verifies that invalid config data attributes are handled correctly.
*/
@Test void putConfigDataWithInvalidAttributes() throws Exception {
@Test
void putConfigDataWithInvalidAttributes() throws Exception {
// create a target
testdataFactory.createTarget(TARGET2_ID);
putAndVerifyConfigDataWithKeyTooLong();
@@ -219,7 +221,8 @@ class DdiConfigDataTest extends AbstractDDiApiIntegrationTest {
/**
* Verify that config data (device attributes) can be updated by the controller using different update modes (merge, replace, remove).
*/
@Test void putConfigDataWithDifferentUpdateModes() throws Exception {
@Test
void putConfigDataWithDifferentUpdateModes() throws Exception {
// create a target
testdataFactory.createTarget(TARGET1_ID);

View File

@@ -70,7 +70,8 @@ class DdiConfirmationBaseTest extends AbstractDDiApiIntegrationTest {
/**
* 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 {
@Test
void verifyConfirmationReferencesInControllerBase(@Autowired ActionStatusRepository actionStatusRepository) throws Exception {
enableConfirmationFlow();
// Prepare test data
final DistributionSet ds = testdataFactory.createDistributionSet("", true);
@@ -135,7 +136,8 @@ class DdiConfirmationBaseTest extends AbstractDDiApiIntegrationTest {
/**
* Ensure that the deployment resource is available as CBOR
*/
@Test void confirmationResourceCbor() throws Exception {
@Test
void confirmationResourceCbor() throws Exception {
enableConfirmationFlow();
final Target target = testdataFactory.createTarget();
final DistributionSet distributionSet = testdataFactory.createDistributionSet("");
@@ -160,7 +162,8 @@ class DdiConfirmationBaseTest extends AbstractDDiApiIntegrationTest {
/**
* Ensure that the confirmation endpoint is not available.
*/
@Test void confirmationEndpointNotExposed() throws Exception {
@Test
void confirmationEndpointNotExposed() throws Exception {
final DistributionSet ds = testdataFactory.createDistributionSet("");
Target savedTarget = testdataFactory.createTarget("988");
savedTarget = getFirstAssignedTarget(assignDistributionSet(ds.getId(), savedTarget.getControllerId()));
@@ -182,7 +185,8 @@ class DdiConfirmationBaseTest extends AbstractDDiApiIntegrationTest {
/**
* Ensure that the deploymentBase endpoint is not available for action ins WFC state.
*/
@Test void deploymentEndpointNotAccessibleForActionsWFC() throws Exception {
@Test
void deploymentEndpointNotAccessibleForActionsWFC() throws Exception {
enableConfirmationFlow();
final DistributionSet ds = testdataFactory.createDistributionSet("");
@@ -212,7 +216,8 @@ class DdiConfirmationBaseTest extends AbstractDDiApiIntegrationTest {
/**
* Ensure that the confirmation endpoints are still available after deactivating the confirmation flow.
*/
@Test void verifyConfirmationBaseEndpointsArePresentAfterDisablingConfirmationFlow() throws Exception {
@Test
void verifyConfirmationBaseEndpointsArePresentAfterDisablingConfirmationFlow() throws Exception {
enableConfirmationFlow();
final DistributionSet ds = testdataFactory.createDistributionSet("");
@@ -249,7 +254,8 @@ class DdiConfirmationBaseTest extends AbstractDDiApiIntegrationTest {
/**
* Controller sends a confirmed action state.
*/
@Test @ExpectEvents({
@Test
@ExpectEvents({
@Expect(type = TargetCreatedEvent.class, count = 1),
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3),
@@ -285,7 +291,8 @@ class DdiConfirmationBaseTest extends AbstractDDiApiIntegrationTest {
/**
* Confirmation base provides right values if auto-confirm not active.
*/
@Test void getConfirmationBaseProvidesAutoConfirmStatusNotActive() throws Exception {
@Test
void getConfirmationBaseProvidesAutoConfirmStatusNotActive() throws Exception {
enableConfirmationFlow();
final String controllerId = testdataFactory.createTarget("989").getControllerId();
@@ -362,7 +369,8 @@ class DdiConfirmationBaseTest extends AbstractDDiApiIntegrationTest {
/**
* Verify auto-confirm deactivation is handled correctly.
*/
@Test void deactivateAutoConfirmation() throws Exception {
@Test
void deactivateAutoConfirmation() throws Exception {
final String controllerId = testdataFactory.createTarget("988").getControllerId();
confirmationManagement.activateAutoConfirmation(controllerId, null, null);
@@ -377,7 +385,8 @@ class DdiConfirmationBaseTest extends AbstractDDiApiIntegrationTest {
/**
* Controller sends a denied action state.
*/
@Test @ExpectEvents({
@Test
@ExpectEvents({
@Expect(type = TargetCreatedEvent.class, count = 1),
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3),
@@ -423,7 +432,8 @@ class DdiConfirmationBaseTest extends AbstractDDiApiIntegrationTest {
/**
* Test to verify that only a specific count of messages are returned based on the input actionHistory for getControllerDeploymentActionFeedback endpoint.
*/
@Test @ExpectEvents({
@Test
@ExpectEvents({
@Expect(type = TargetCreatedEvent.class, count = 1),
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3),

View File

@@ -83,7 +83,8 @@ class DdiDeploymentBaseTest extends AbstractDDiApiIntegrationTest {
/**
* Ensure that the deployment resource is available as CBOR
*/
@Test void deploymentResourceCbor() throws Exception {
@Test
void deploymentResourceCbor() throws Exception {
final Target target = testdataFactory.createTarget();
final DistributionSet distributionSet = testdataFactory.createDistributionSet("");
@@ -111,7 +112,8 @@ class DdiDeploymentBaseTest extends AbstractDDiApiIntegrationTest {
/**
* Ensures that artifacts are not found, when software module does not exists.
*/
@Test void artifactsNotFound() throws Exception {
@Test
void artifactsNotFound() throws Exception {
final Target target = testdataFactory.createTarget();
performGet(SOFTWARE_MODULE_ARTIFACTS, MediaType.APPLICATION_JSON, status().isNotFound(), tenantAware.getCurrentTenant(),
target.getControllerId(), "1");
@@ -120,7 +122,8 @@ class DdiDeploymentBaseTest extends AbstractDDiApiIntegrationTest {
/**
* Ensures that artifacts are found, when software module exists.
*/
@Test void artifactsExists() throws Exception {
@Test
void artifactsExists() throws Exception {
final Target target = testdataFactory.createTarget();
final DistributionSet distributionSet = testdataFactory.createDistributionSet("");
@@ -140,7 +143,8 @@ class DdiDeploymentBaseTest extends AbstractDDiApiIntegrationTest {
/**
* Forced deployment to a controller. Checks if the resource response payload for a given deployment is as expected.
*/
@Test void deploymentForceAction() throws Exception {
@Test
void deploymentForceAction() throws Exception {
// Prepare test data
final DistributionSet ds = testdataFactory.createDistributionSet("", true);
final DistributionSet ds2 = testdataFactory.createDistributionSet("2", true);
@@ -198,7 +202,8 @@ class DdiDeploymentBaseTest extends AbstractDDiApiIntegrationTest {
/**
* Checks that the deploymentBase URL changes when the action is switched from soft to forced in TIMEFORCED case.
*/
@Test void changeEtagIfActionSwitchesFromSoftToForced() throws Exception {
@Test
void changeEtagIfActionSwitchesFromSoftToForced() throws Exception {
// Prepare test data
final Target target = testdataFactory.createTarget(DEFAULT_CONTROLLER_ID);
final DistributionSet ds = testdataFactory.createDistributionSet("", true);
@@ -235,7 +240,8 @@ class DdiDeploymentBaseTest extends AbstractDDiApiIntegrationTest {
/**
* Attempt/soft deployment to a controller. Checks if the resource response payload for a given deployment is as expected.
*/
@Test void deploymentAttemptAction() throws Exception {
@Test
void deploymentAttemptAction() throws Exception {
// Prepare test data
final DistributionSet ds = testdataFactory.createDistributionSet("", true);
final DistributionSet ds2 = testdataFactory.createDistributionSet("2", true);
@@ -299,7 +305,8 @@ class DdiDeploymentBaseTest extends AbstractDDiApiIntegrationTest {
/**
* 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 {
@Test
void deploymentAutoForceAction() throws Exception {
// Prepare test data
final DistributionSet ds = testdataFactory.createDistributionSet("", true);
final DistributionSet ds2 = testdataFactory.createDistributionSet("2", true);
@@ -358,7 +365,8 @@ class DdiDeploymentBaseTest extends AbstractDDiApiIntegrationTest {
/**
* 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 {
@Test
void deploymentDownloadOnlyAction() throws Exception {
// Prepare test data
final DistributionSet ds = testdataFactory.createDistributionSet("", true);
final DistributionSet ds2 = testdataFactory.createDistributionSet("2", true);
@@ -420,7 +428,8 @@ class DdiDeploymentBaseTest extends AbstractDDiApiIntegrationTest {
/**
* Test various invalid access attempts to the deployment resource und the expected behaviour of the server.
*/
@Test void badDeploymentAction() throws Exception {
@Test
void badDeploymentAction() throws Exception {
final Target target = testdataFactory.createTarget(DEFAULT_CONTROLLER_ID);
// not allowed methods
@@ -507,7 +516,8 @@ class DdiDeploymentBaseTest extends AbstractDDiApiIntegrationTest {
/**
* Multiple uploads of deployment status feedback to the server.
*/
@Test void multipleDeploymentActionFeedback() throws Exception {
@Test
void multipleDeploymentActionFeedback() throws Exception {
testdataFactory.createTarget(DEFAULT_CONTROLLER_ID);
testdataFactory.createTarget("4713");
testdataFactory.createTarget("4714");
@@ -548,7 +558,8 @@ class DdiDeploymentBaseTest extends AbstractDDiApiIntegrationTest {
/**
* Verifies that an update action is correctly set to error if the controller provides error feedback.
*/
@Test void rootRsSingleDeploymentActionWithErrorFeedback() throws Exception {
@Test
void rootRsSingleDeploymentActionWithErrorFeedback() throws Exception {
DistributionSet ds = testdataFactory.createDistributionSet("");
final Target savedTarget = testdataFactory.createTarget(DEFAULT_CONTROLLER_ID);
@@ -585,7 +596,8 @@ class DdiDeploymentBaseTest extends AbstractDDiApiIntegrationTest {
/**
* 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 {
@Test
void rootRsSingleDeploymentActionFeedback() throws Exception {
final DistributionSet ds = testdataFactory.createDistributionSet("");
final Long actionId = getFirstAssignedActionId(
assignDistributionSet(ds,
@@ -626,7 +638,8 @@ class DdiDeploymentBaseTest extends AbstractDDiApiIntegrationTest {
/**
* Various forbidden request attempts on the feedback resource. Ensures correct answering behaviour as expected to these kind of errors.
*/
@Test void badDeploymentActionFeedback() throws Exception {
@Test
void badDeploymentActionFeedback() throws Exception {
final DistributionSet savedSet = testdataFactory.createDistributionSet("");
final DistributionSet savedSet2 = testdataFactory.createDistributionSet("1");
@@ -665,7 +678,8 @@ class DdiDeploymentBaseTest extends AbstractDDiApiIntegrationTest {
/**
* Ensures that an invalid id in feedback body returns a bad request.
*/
@Test @ExpectEvents({
@Test
@ExpectEvents({
@Expect(type = TargetCreatedEvent.class, count = 1),
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3),
@@ -687,7 +701,8 @@ class DdiDeploymentBaseTest extends AbstractDDiApiIntegrationTest {
/**
* Ensures that a missing feedback result in feedback body returns a bad request.
*/
@Test @ExpectEvents({
@Test
@ExpectEvents({
@Expect(type = TargetCreatedEvent.class, count = 1),
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3),
@@ -713,7 +728,8 @@ class DdiDeploymentBaseTest extends AbstractDDiApiIntegrationTest {
/**
* Ensures that a missing finished result in feedback body returns a bad request.
*/
@Test @ExpectEvents({
@Test
@ExpectEvents({
@Expect(type = TargetCreatedEvent.class, count = 1),
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3),

View File

@@ -77,7 +77,8 @@ class DdiInstalledBaseTest extends AbstractDDiApiIntegrationTest {
/**
* Ensure that the installed base resource is available as CBOR
*/
@Test void installedBaseResourceCbor() throws Exception {
@Test
void installedBaseResourceCbor() throws Exception {
final Target target = testdataFactory.createTarget();
final DistributionSet ds = testdataFactory.createDistributionSet("");
@@ -100,7 +101,8 @@ class DdiInstalledBaseTest extends AbstractDDiApiIntegrationTest {
/**
* Ensure that assigned version is self assigned version
*/
@Test void installedVersion() throws Exception {
@Test
void installedVersion() throws Exception {
final Target target = createTargetAndAssertNoActiveActions();
final DistributionSet ds = testdataFactory.createDistributionSet("");
@@ -116,7 +118,8 @@ class DdiInstalledBaseTest extends AbstractDDiApiIntegrationTest {
/**
* Ensure that installedVersion is version self assigned
*/
@Test void installedVersionNotExist() throws Exception {
@Test
void installedVersionNotExist() throws Exception {
final Target target = createTargetAndAssertNoActiveActions();
final String dsName = "unknown";
final String dsVersion = "1.0.0";
@@ -130,7 +133,8 @@ class DdiInstalledBaseTest extends AbstractDDiApiIntegrationTest {
/**
* Test several deployments to a controller. Checks that action is represented as installedBase after installation.
*/
@Test void deploymentSeveralActionsInInstalledBase() throws Exception {
@Test
void deploymentSeveralActionsInInstalledBase() throws Exception {
// Prepare test data
final Target target = createTargetAndAssertNoActiveActions();
@@ -199,7 +203,8 @@ class DdiInstalledBaseTest extends AbstractDDiApiIntegrationTest {
/**
* 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 {
@Test
void deploymentActionsOfSameDsWithCancelledActionInHistory() throws Exception {
// Prepare test data
final Target target = createTargetAndAssertNoActiveActions();
@@ -256,7 +261,8 @@ class DdiInstalledBaseTest extends AbstractDDiApiIntegrationTest {
/**
* 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 {
@Test
void deploymentActionsOfSameDsWithCancelledAction() throws Exception {
// Prepare test data
final Target target = createTargetAndAssertNoActiveActions();
@@ -314,7 +320,8 @@ class DdiInstalledBaseTest extends AbstractDDiApiIntegrationTest {
/**
* 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 {
@Test
void deploymentActionsOfSameDsWithRunningAction() throws Exception {
// Prepare test data
final Target target = createTargetAndAssertNoActiveActions();
@@ -368,7 +375,8 @@ class DdiInstalledBaseTest extends AbstractDDiApiIntegrationTest {
/**
* Test open deployment to a controller. Checks that installedBase returns 404 for a pending action.
*/
@Test void installedBaseReturns404ForPendingAction() throws Exception {
@Test
void installedBaseReturns404ForPendingAction() throws Exception {
// Prepare test data
final Target target = createTargetAndAssertNoActiveActions();
final DistributionSet ds = testdataFactory.createDistributionSet("");
@@ -392,7 +400,8 @@ class DdiInstalledBaseTest extends AbstractDDiApiIntegrationTest {
/**
* Ensures that artifacts are found, after the action was already closed.
*/
@Test void artifactsOfInstalledActionExist() throws Exception {
@Test
void artifactsOfInstalledActionExist() throws Exception {
final Target target = createTargetAndAssertNoActiveActions();
final DistributionSet ds = testdataFactory.createDistributionSet("");
@@ -470,7 +479,8 @@ class DdiInstalledBaseTest extends AbstractDDiApiIntegrationTest {
/**
* Test download-only deployment to a controller. Checks that download-only is not represented as installedBase.
*/
@Test @ExpectEvents({
@Test
@ExpectEvents({
@Expect(type = TargetCreatedEvent.class, count = 1),
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3),
@@ -547,7 +557,8 @@ class DdiInstalledBaseTest extends AbstractDDiApiIntegrationTest {
/**
* 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 {
@Test
void testActionHistoryCount() throws Exception {
final DistributionSet ds = testdataFactory.createDistributionSet("");
Target savedTarget = testdataFactory.createTarget("911");
savedTarget = getFirstAssignedTarget(assignDistributionSet(ds.getId(), savedTarget.getControllerId()));
@@ -599,7 +610,8 @@ class DdiInstalledBaseTest extends AbstractDDiApiIntegrationTest {
/**
* Test various invalid access attempts to the installed resource und the expected behaviour of the server.
*/
@Test void badInstalledAction() throws Exception {
@Test
void badInstalledAction() throws Exception {
final Target target = testdataFactory.createTarget(CONTROLLER_ID);
// not allowed methods

View File

@@ -85,7 +85,8 @@ class DdiRootControllerTest extends AbstractDDiApiIntegrationTest {
/**
* Ensure that the root poll resource is available as CBOR
*/
@Test void rootPollResourceCbor() throws Exception {
@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))
@@ -95,7 +96,8 @@ class DdiRootControllerTest extends AbstractDDiApiIntegrationTest {
/**
* Ensures that the API returns JSON when no Accept header is specified by the client.
*/
@Test void apiReturnsJSONByDefault() throws Exception {
@Test
void apiReturnsJSONByDefault() throws Exception {
final MvcResult result = mvc.perform(get(CONTROLLER_BASE, tenantAware.getCurrentTenant(), 4711))
.andDo(MockMvcResultPrinter.print())
.andExpect(status().isOk())
@@ -109,7 +111,8 @@ class DdiRootControllerTest extends AbstractDDiApiIntegrationTest {
/**
* 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 })
@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),
@@ -142,7 +145,8 @@ class DdiRootControllerTest extends AbstractDDiApiIntegrationTest {
/**
* Ensures that server returns a not found response in case of empty controller ID.
*/
@Test @ExpectEvents({ @Expect(type = TargetCreatedEvent.class, count = 0) })
@Test
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class, count = 0) })
void rootRsWithoutId() throws Exception {
mvc.perform(get("/controller/v1/"))
.andDo(MockMvcResultPrinter.print())
@@ -152,7 +156,8 @@ class DdiRootControllerTest extends AbstractDDiApiIntegrationTest {
/**
* 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({
@Test
@ExpectEvents({
@Expect(type = TargetCreatedEvent.class, count = 1),
@Expect(type = TargetPollEvent.class, count = 1) })
void rootRsPlugAndPlay() throws Exception {
@@ -188,7 +193,8 @@ class DdiRootControllerTest extends AbstractDDiApiIntegrationTest {
/**
* Ensures that tenant specific polling time, which is saved in the db, is delivered to the controller.
*/
@Test @WithUser(principal = "knownpricipal", allSpPermissions = false)
@Test
@WithUser(principal = "knownpricipal", allSpPermissions = false)
@ExpectEvents({
@Expect(type = TargetCreatedEvent.class, count = 1),
@Expect(type = TargetPollEvent.class, count = 1),
@@ -213,7 +219,8 @@ class DdiRootControllerTest extends AbstractDDiApiIntegrationTest {
/**
* Ensures that etag check results in not modified response if provided etag by client is identical to entity in repository.
*/
@Test @ExpectEvents({
@Test
@ExpectEvents({
@Expect(type = TargetCreatedEvent.class, count = 1),
@Expect(type = TargetPollEvent.class, count = 6),
@Expect(type = TargetAssignDistributionSetEvent.class, count = 2),
@@ -342,7 +349,8 @@ class DdiRootControllerTest extends AbstractDDiApiIntegrationTest {
/**
* Ensures that the source IP address of the polling target is correctly stored in repository
*/
@Test @ExpectEvents({
@Test
@ExpectEvents({
@Expect(type = TargetCreatedEvent.class, count = 1),
@Expect(type = TargetPollEvent.class, count = 1) })
void rootRsPlugAndPlayIpAddress() throws Exception {
@@ -371,7 +379,8 @@ class DdiRootControllerTest extends AbstractDDiApiIntegrationTest {
/**
* Ensures that the source IP address of the polling target is not stored in repository if disabled
*/
@Test @ExpectEvents({
@Test
@ExpectEvents({
@Expect(type = TargetCreatedEvent.class, count = 1),
@Expect(type = TargetPollEvent.class, count = 1) })
void rootRsIpAddressNotStoredIfDisabled() throws Exception {
@@ -393,7 +402,8 @@ class DdiRootControllerTest extends AbstractDDiApiIntegrationTest {
/**
* Controller trys to finish an update process after it has been finished by an error action status.
*/
@Test @ExpectEvents({
@Test
@ExpectEvents({
@Expect(type = TargetCreatedEvent.class, count = 1),
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3),
@@ -425,7 +435,8 @@ class DdiRootControllerTest extends AbstractDDiApiIntegrationTest {
/**
* Controller sends attribute update request after device successfully closed software update.
*/
@Test @ExpectEvents({
@Test
@ExpectEvents({
@Expect(type = TargetCreatedEvent.class, count = 1),
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3),
@@ -456,7 +467,8 @@ class DdiRootControllerTest extends AbstractDDiApiIntegrationTest {
/**
* Test to verify that only a specific count of messages are returned based on the input actionHistory for getControllerDeploymentActionFeedback endpoint.
*/
@Test @ExpectEvents({
@Test
@ExpectEvents({
@Expect(type = TargetCreatedEvent.class, count = 1),
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3),
@@ -501,7 +513,8 @@ class DdiRootControllerTest extends AbstractDDiApiIntegrationTest {
/**
* Test to verify that a zero input value of actionHistory results in no action history appended for getControllerDeploymentActionFeedback endpoint.
*/
@Test @ExpectEvents({
@Test
@ExpectEvents({
@Expect(type = TargetCreatedEvent.class, count = 1),
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3),
@@ -546,7 +559,8 @@ class DdiRootControllerTest extends AbstractDDiApiIntegrationTest {
/**
* Test to verify that entire action history is returned if the input value for actionHistory is -1, for getControllerDeploymentActionFeedback endpoint.
*/
@Test @ExpectEvents({
@Test
@ExpectEvents({
@Expect(type = TargetCreatedEvent.class, count = 1),
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3),
@@ -591,7 +605,8 @@ class DdiRootControllerTest extends AbstractDDiApiIntegrationTest {
/**
* Test the polling time based on different maintenance window start and end time.
*/
@Test void sleepTimeResponseForDifferentMaintenanceWindowParameters() throws Exception {
@Test
void sleepTimeResponseForDifferentMaintenanceWindowParameters() throws Exception {
final DistributionSet ds = testdataFactory.createDistributionSet("");
SecurityContextSwitch.runAs(SecurityContextSwitch.withUser("tenantadmin", TENANT_CONFIGURATION),
@@ -642,7 +657,8 @@ class DdiRootControllerTest extends AbstractDDiApiIntegrationTest {
/**
* Test download and update values before maintenance window start time.
*/
@Test void downloadAndUpdateStatusBeforeMaintenanceWindowStartTime() throws Exception {
@Test
void downloadAndUpdateStatusBeforeMaintenanceWindowStartTime() throws Exception {
Target savedTarget = testdataFactory.createTarget("1911");
final DistributionSet ds = testdataFactory.createDistributionSet("");
savedTarget = getFirstAssignedTarget(assignDistributionSetWithMaintenanceWindow(ds.getId(),
@@ -665,7 +681,8 @@ class DdiRootControllerTest extends AbstractDDiApiIntegrationTest {
/**
* Test download and update values after maintenance window start time.
*/
@Test void downloadAndUpdateStatusDuringMaintenanceWindow() throws Exception {
@Test
void downloadAndUpdateStatusDuringMaintenanceWindow() throws Exception {
Target savedTarget = testdataFactory.createTarget("1911");
final DistributionSet ds = testdataFactory.createDistributionSet("");
savedTarget = getFirstAssignedTarget(assignDistributionSetWithMaintenanceWindow(ds.getId(),
@@ -688,7 +705,8 @@ class DdiRootControllerTest extends AbstractDDiApiIntegrationTest {
/**
* Assign multiple DS in multi-assignment mode. The earliest active Action is exposed to the controller.
*/
@Test void earliestActionIsExposedToControllerInMultiAssignMode() throws Exception {
@Test
void earliestActionIsExposedToControllerInMultiAssignMode() throws Exception {
enableMultiAssignments();
final Target target = testdataFactory.createTarget();
final DistributionSet ds1 = testdataFactory.createDistributionSet(UUID.randomUUID().toString());
@@ -704,7 +722,8 @@ class DdiRootControllerTest extends AbstractDDiApiIntegrationTest {
/**
* The system should not create a new target because of a too long controller id.
*/
@Test void rootRsWithInvalidControllerId() throws Exception {
@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());

View File

@@ -51,7 +51,8 @@ class DosFilterTest extends AbstractDDiApiIntegrationTest {
/**
* Ensures that clients that are on the blacklist are forbidden
*/
@Test void blackListedClientIsForbidden() throws Exception {
@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());
@@ -60,7 +61,8 @@ class DosFilterTest extends AbstractDDiApiIntegrationTest {
/**
* Ensures that a READ DoS attempt is blocked
*/
@Test void getFloodingAttackThatIsPrevented() throws Exception {
@Test
void getFloodingAttackThatIsPrevented() throws Exception {
int requests = 0;
MvcResult result;
do {
@@ -80,7 +82,8 @@ class DosFilterTest extends AbstractDDiApiIntegrationTest {
/**
* 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 {
@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"))
@@ -91,7 +94,8 @@ class DosFilterTest extends AbstractDDiApiIntegrationTest {
/**
* 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 {
@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"))
@@ -102,7 +106,8 @@ class DosFilterTest extends AbstractDDiApiIntegrationTest {
/**
* 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
@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++) {
@@ -119,7 +124,8 @@ class DosFilterTest extends AbstractDDiApiIntegrationTest {
/**
* Ensures that a WRITE DoS attempt is blocked
*/
@Test void putPostFloddingAttackThatisPrevented() throws Exception {
@Test
void putPostFloddingAttackThatisPrevented() throws Exception {
final Long actionId = prepareDeploymentBase();
final String feedback = getJsonProceedingDeploymentActionFeedback();
@@ -143,7 +149,8 @@ class DosFilterTest extends AbstractDDiApiIntegrationTest {
/**
* 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
@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

@@ -63,7 +63,8 @@ class GatewayTokenAuthenticatorTest {
/**
* Tests successful authentication with gateway token
*/
@Test void testWithGwToken() {
@Test
void testWithGwToken() {
final ControllerSecurityToken securityToken = prepareSecurityToken(GATEWAY_TOKEN);
when(tenantConfigurationManagementMock.getConfigurationValue(
TenantConfigurationKey.AUTHENTICATION_MODE_GATEWAY_SECURITY_TOKEN_KEY, String.class))
@@ -80,7 +81,8 @@ class GatewayTokenAuthenticatorTest {
/**
* Tests that if gateway token doesn't match, the authentication fails
*/
@Test void testWithBadGwToken() {
@Test
void testWithBadGwToken() {
final ControllerSecurityToken securityToken = prepareSecurityToken(UNKNOWN_TOKEN);
when(tenantConfigurationManagementMock.getConfigurationValue(
TenantConfigurationKey.AUTHENTICATION_MODE_GATEWAY_SECURITY_TOKEN_KEY, String.class))
@@ -95,14 +97,16 @@ class GatewayTokenAuthenticatorTest {
/**
* Tests that if gateway token miss, the authentication fails
*/
@Test void testWithoutGwToken() {
@Test
void testWithoutGwToken() {
assertThat(authenticator.authenticate(new ControllerSecurityToken("DEFAULT", CONTROLLER_ID))).isNull();
}
/**
* Tests that if disabled, the authentication fails
*/
@Test void testWithGwTokenButDisabled() {
@Test
void testWithGwTokenButDisabled() {
final ControllerSecurityToken securityToken = prepareSecurityToken(GATEWAY_TOKEN);
when(tenantConfigurationManagementMock.getConfigurationValue(
TenantConfigurationKey.AUTHENTICATION_MODE_GATEWAY_SECURITY_TOKEN_ENABLED, Boolean.class))

View File

@@ -74,7 +74,8 @@ class SecurityHeaderAuthenticatorTest {
/**
* Tests successful authentication with multiple a single hashes
*/
@Test void testWithSingleKnownHash() {
@Test
void testWithSingleKnownHash() {
final ControllerSecurityToken securityToken = prepareSecurityToken(SINGLE_HASH);
when(tenantConfigurationManagementMock.getConfigurationValue(
TenantConfigurationKey.AUTHENTICATION_MODE_HEADER_AUTHORITY_NAME, String.class))
@@ -91,7 +92,8 @@ class SecurityHeaderAuthenticatorTest {
/**
* Tests successful authentication with multiple hashes
*/
@Test void testWithMultipleKnownHashes() {
@Test
void testWithMultipleKnownHashes() {
when(tenantConfigurationManagementMock.getConfigurationValue(
TenantConfigurationKey.AUTHENTICATION_MODE_HEADER_AUTHORITY_NAME, String.class))
.thenReturn(CONFIG_VALUE_MULTI_HASH);
@@ -113,7 +115,8 @@ class SecurityHeaderAuthenticatorTest {
/**
* Tests that if the hash is unknown, the authentication fails
*/
@Test void testWithUnknownHash() {
@Test
void testWithUnknownHash() {
final ControllerSecurityToken securityToken = prepareSecurityToken(UNKNOWN_HASH);
when(tenantConfigurationManagementMock.getConfigurationValue(
TenantConfigurationKey.AUTHENTICATION_MODE_HEADER_AUTHORITY_NAME, String.class))
@@ -128,7 +131,8 @@ class SecurityHeaderAuthenticatorTest {
/**
* Tests that if CN doesn't match the CN in the security token, the authentication fails
*/
@Test void testWithNonMatchingCN() {
@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);
@@ -139,14 +143,16 @@ class SecurityHeaderAuthenticatorTest {
/**
* Tests that if the hash miss, the authentication fails
*/
@Test void testWithoutHash() {
@Test
void testWithoutHash() {
assertThat(authenticator.authenticate(new ControllerSecurityToken("DEFAULT", CA_COMMON_NAME_VALUE))).isNull();
}
/**
* Tests that if disabled, the authentication fails
*/
@Test void testWithSingleKnownHashButDisabled() {
@Test
void testWithSingleKnownHashButDisabled() {
final ControllerSecurityToken securityToken = prepareSecurityToken(SINGLE_HASH);
when(tenantConfigurationManagementMock.getConfigurationValue(
TenantConfigurationKey.AUTHENTICATION_MODE_HEADER_ENABLED, Boolean.class))

View File

@@ -68,7 +68,8 @@ class SecurityTokenAuthenticatorTest {
/**
* Tests successful authentication with gateway token
*/
@Test void testWithSecToken() {
@Test
void testWithSecToken() {
final ControllerSecurityToken securityToken = prepareSecurityToken(SECURITY_TOKEN);
when(tenantConfigurationManagementMock.getConfigurationValue(
TenantConfigurationKey.AUTHENTICATION_MODE_TARGET_SECURITY_TOKEN_ENABLED, Boolean.class))
@@ -87,7 +88,8 @@ class SecurityTokenAuthenticatorTest {
/**
* Tests that if gateway token doesn't match, the authentication fails
*/
@Test void testWithBadSecToken() {
@Test
void testWithBadSecToken() {
final ControllerSecurityToken securityToken = prepareSecurityToken(UNKNOWN_TOKEN);
when(tenantConfigurationManagementMock.getConfigurationValue(
TenantConfigurationKey.AUTHENTICATION_MODE_TARGET_SECURITY_TOKEN_ENABLED, Boolean.class))
@@ -99,14 +101,16 @@ class SecurityTokenAuthenticatorTest {
/**
* Tests that if gateway token miss, the authentication fails
*/
@Test void testWithoutSecToken() {
@Test
void testWithoutSecToken() {
assertThat(authenticator.authenticate(new ControllerSecurityToken("DEFAULT", CONTROLLER_ID))).isNull();
}
/**
* Tests that if disabled, the authentication fails
*/
@Test void testWithSecTokenButDisabled() {
@Test
void testWithSecTokenButDisabled() {
final ControllerSecurityToken securityToken = prepareSecurityToken(SECURITY_TOKEN);
when(tenantConfigurationManagementMock.getConfigurationValue(
TenantConfigurationKey.AUTHENTICATION_MODE_TARGET_SECURITY_TOKEN_ENABLED, Boolean.class))

View File

@@ -29,7 +29,8 @@ class AllowedHostNamesTest extends AbstractSecurityTest {
/**
* Tests whether a RequestRejectedException is thrown when not allowed host is used
*/
@Test void allowedHostNameWithNotAllowedHost() throws Exception {
@Test
void allowedHostNameWithNotAllowedHost() throws Exception {
mvc.perform(get("/").header(HttpHeaders.HOST, "www.google.com"))
.andExpect(status().isBadRequest());
}
@@ -37,7 +38,8 @@ class AllowedHostNamesTest extends AbstractSecurityTest {
/**
* Tests whether request is redirected when allowed host is used
*/
@Test void allowedHostNameWithAllowedHost() throws Exception {
@Test
void allowedHostNameWithAllowedHost() throws Exception {
mvc.perform(get("/").header(HttpHeaders.HOST, "localhost"))
.andExpect(status().is3xxRedirection());
}
@@ -45,7 +47,8 @@ class AllowedHostNamesTest extends AbstractSecurityTest {
/**
* Tests whether request without allowed host name and with ignored path end up with a client error
*/
@Test void notAllowedHostnameWithIgnoredPath() throws Exception {
@Test
void notAllowedHostnameWithIgnoredPath() throws Exception {
mvc.perform(get("/index.html").header(HttpHeaders.HOST, "www.google.com"))
.andExpect(status().is4xxClientError());
}

View File

@@ -28,7 +28,8 @@ class PreAuthorizeEnabledTest extends AbstractSecurityTest {
/**
* Tests whether request fail if a role is forbidden for the user
*/
@Test @WithUser(authorities = { SpPermission.READ_TARGET }, autoCreateTenant = false)
@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()));
@@ -37,7 +38,8 @@ class PreAuthorizeEnabledTest extends AbstractSecurityTest {
/**
* Tests whether request succeed if a role is granted for the user
*/
@Test @WithUser(authorities = { SpPermission.SpringEvalExpressions.CONTROLLER_ROLE }, autoCreateTenant = false)
@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

@@ -118,7 +118,8 @@ class AmqpMessageDispatcherServiceTest extends AbstractIntegrationTest {
/**
* Verifies that download and install event with 3 software modules and no artifacts works
*/
@Test void testSendDownloadRequestWithSoftwareModulesAndNoArtifacts() {
@Test
void testSendDownloadRequestWithSoftwareModulesAndNoArtifacts() {
final DistributionSet createDistributionSet = testdataFactory
.createDistributionSet(UUID.randomUUID().toString());
testdataFactory.addSoftwareModuleMetadata(createDistributionSet);
@@ -158,7 +159,8 @@ class AmqpMessageDispatcherServiceTest extends AbstractIntegrationTest {
/**
* Verifies that download and install event with software modules and artifacts works
*/
@Test void testSendDownloadRequest() {
@Test
void testSendDownloadRequest() {
DistributionSet dsA = testdataFactory.createDistributionSet(UUID.randomUUID().toString());
SoftwareModule module = dsA.getModules().iterator().next();
final List<AbstractDbArtifact> receivedList = new ArrayList<>();
@@ -210,7 +212,8 @@ class AmqpMessageDispatcherServiceTest extends AbstractIntegrationTest {
/**
* Verifies that sending update controller attributes event works.
*/
@Test void sendUpdateAttributesRequest() {
@Test
void sendUpdateAttributesRequest() {
final String amqpUri = "amqp://anyhost";
final TargetAttributesRequestedEvent targetAttributesRequestedEvent = new TargetAttributesRequestedEvent(TENANT,
1L, CONTROLLER_ID, amqpUri, Target.class, serviceMatcher.getBusId());
@@ -224,7 +227,8 @@ class AmqpMessageDispatcherServiceTest extends AbstractIntegrationTest {
/**
* Verifies that send cancel event works
*/
@Test void testSendCancelRequest() {
@Test
void testSendCancelRequest() {
final Action action = mock(Action.class);
when(action.getId()).thenReturn(1L);
when(action.getTenant()).thenReturn(TENANT);
@@ -241,7 +245,8 @@ class AmqpMessageDispatcherServiceTest extends AbstractIntegrationTest {
/**
* Verifies that sending a delete message when receiving a delete event works.
*/
@Test void sendDeleteRequest() {
@Test
void sendDeleteRequest() {
// setup
final String amqpUri = "amqp://anyhost";
@@ -259,7 +264,8 @@ class AmqpMessageDispatcherServiceTest extends AbstractIntegrationTest {
/**
* Verifies that a delete message is not send if the address is not an amqp address.
*/
@Test void sendDeleteRequestWithNoAmqpAddress() {
@Test
void sendDeleteRequestWithNoAmqpAddress() {
// setup
final String noAmqpUri = "http://anyhost";
@@ -276,7 +282,8 @@ class AmqpMessageDispatcherServiceTest extends AbstractIntegrationTest {
/**
* Verifies that a delete message is not send if the address is null.
*/
@Test void sendDeleteRequestWithNullAddress() {
@Test
void sendDeleteRequestWithNullAddress() {
// setup
final String noAmqpUri = null;

View File

@@ -145,7 +145,8 @@ class AmqpMessageHandlerServiceTest {
/**
* Tests not allowed content-type in message
*/
@Test void wrongContentType() {
@Test
void wrongContentType() {
final MessageProperties messageProperties = new MessageProperties();
messageProperties.setContentType("xml");
final Message message = new Message(new byte[0], messageProperties);
@@ -159,7 +160,8 @@ class AmqpMessageHandlerServiceTest {
/**
* Tests the creation of a target/thing by calling the same method that incoming RabbitMQ messages would access.
*/
@Test void createThing() {
@Test
void createThing() {
final String knownThingId = "1";
processThingCreatedMessage(knownThingId, null);
@@ -171,7 +173,8 @@ class AmqpMessageHandlerServiceTest {
/**
* Tests the creation of a target/thing with specified name by calling the same method that incoming RabbitMQ messages would access.
*/
@Test void createThingWithName() {
@Test
void createThingWithName() {
final String knownThingId = "2";
final String knownThingName = "NonDefaultTargetName";
@@ -187,7 +190,8 @@ class AmqpMessageHandlerServiceTest {
/**
* 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() {
@Test
void createThingWithType() {
final String knownThingId = "2";
final String knownThingTypeName = "TargetTypeName";
@@ -203,7 +207,8 @@ class AmqpMessageHandlerServiceTest {
/**
* Tests not allowed body in message
*/
@Test void createThingWithWrongBody() {
@Test
void createThingWithWrongBody() {
final Message message = createMessage("Not allowed Body".getBytes(), getThingCreatedMessageProperties("3"));
final String type = MessageType.THING_CREATED.name();
assertThatExceptionOfType(MessageConversionException.class)
@@ -214,7 +219,8 @@ class AmqpMessageHandlerServiceTest {
/**
* Tests the creation of a target/thing with specified attributes by calling the same method that incoming RabbitMQ messages would access.
*/
@Test void createThingWithAttributes() {
@Test
void createThingWithAttributes() {
final String knownThingId = "4";
final DmfAttributeUpdate attributeUpdate = dmfAttributeUpdate();
@@ -231,7 +237,8 @@ class AmqpMessageHandlerServiceTest {
/**
* 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() {
@Test
void createThingWithNameAndAttributes() {
final String knownThingId = "5";
final String knownThingName = "NonDefaultTargetName";
@@ -250,7 +257,8 @@ class AmqpMessageHandlerServiceTest {
/**
* Tests the target attribute update by calling the same method that incoming RabbitMQ messages would access.
*/
@Test void updateAttributes() {
@Test
void updateAttributes() {
final String knownThingId = "1";
final MessageProperties messageProperties = createMessageProperties(MessageType.EVENT);
messageProperties.setHeader(MessageHeaderKey.THING_ID, knownThingId);
@@ -271,7 +279,8 @@ class AmqpMessageHandlerServiceTest {
/**
* Verifies that the update mode is retrieved from the UPDATE_ATTRIBUTES message and passed to the controller management.
*/
@Test void attributeUpdateModes() {
@Test
void attributeUpdateModes() {
final String knownThingId = "1";
final MessageProperties messageProperties = createMessageProperties(MessageType.EVENT);
messageProperties.setHeader(MessageHeaderKey.THING_ID, knownThingId);
@@ -322,7 +331,8 @@ class AmqpMessageHandlerServiceTest {
/**
* Tests the creation of a thing without a 'reply to' header in message.
*/
@Test void createThingWithoutReplyTo() {
@Test
void createThingWithoutReplyTo() {
final MessageProperties messageProperties = createMessageProperties(MessageType.THING_CREATED, null);
messageProperties.setHeader(MessageHeaderKey.THING_ID, "1");
final Message message = createMessage("", messageProperties);
@@ -335,7 +345,8 @@ class AmqpMessageHandlerServiceTest {
/**
* Tests the creation of a target/thing without a thingID by calling the same method that incoming RabbitMQ messages would access.
*/
@Test void createThingWithoutID() {
@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();
@@ -347,7 +358,8 @@ class AmqpMessageHandlerServiceTest {
/**
* Tests the call of the same method that incoming RabbitMQ messages would access with an unknown message type.
*/
@Test void unknownMessageType() {
@Test
void unknownMessageType() {
final String type = "bumlux";
final MessageProperties messageProperties = createMessageProperties(MessageType.THING_CREATED);
messageProperties.setHeader(MessageHeaderKey.THING_ID, "");
@@ -361,7 +373,8 @@ class AmqpMessageHandlerServiceTest {
/**
* Tests a invalid message without event topic
*/
@Test void invalidEventTopic() {
@Test
void invalidEventTopic() {
final MessageProperties messageProperties = createMessageProperties(MessageType.EVENT);
final Message message = new Message(new byte[0], messageProperties);
@@ -384,7 +397,8 @@ class AmqpMessageHandlerServiceTest {
/**
* Tests the update of an action of a target without a exist action id
*/
@Test void updateActionStatusWithoutActionId() {
@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());
@@ -399,7 +413,8 @@ class AmqpMessageHandlerServiceTest {
/**
* Tests the update of an action of a target without a exist action id
*/
@Test void updateActionStatusWithoutExistActionId() {
@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());
@@ -416,7 +431,8 @@ class AmqpMessageHandlerServiceTest {
/**
* Tests that messages which cause quota violations are not re-added to message queue so they would block other communication.
*/
@Test void quotaExceeded() {
@Test
void quotaExceeded() {
final MessageProperties messageProperties = createMessageProperties(MessageType.EVENT);
messageProperties.setHeader(MessageHeaderKey.TOPIC, EventTopic.UPDATE_ACTION_STATUS.name());
@@ -442,7 +458,8 @@ class AmqpMessageHandlerServiceTest {
/**
* Test next update is provided on finished action
*/
@Test void lookupNextUpdateActionAfterFinished() throws IllegalAccessException {
@Test
void lookupNextUpdateActionAfterFinished() throws IllegalAccessException {
// Mock
final Action action = createActionWithTarget(22L);
@@ -480,7 +497,8 @@ class AmqpMessageHandlerServiceTest {
/**
* Test feedback code is persisted in messages when provided with DmfActionUpdateStatus
*/
@Test void feedBackCodeIsPersistedInMessages() throws IllegalAccessException {
@Test
void feedBackCodeIsPersistedInMessages() throws IllegalAccessException {
// Mock
final Action action = createActionWithTarget(22L);
when(controllerManagementMock.findActionWithDetails(anyLong())).thenReturn(Optional.of(action));
@@ -515,7 +533,8 @@ class AmqpMessageHandlerServiceTest {
/**
* Tests the deletion of a target/thing, requested by the target itself.
*/
@Test void deleteThing() {
@Test
void deleteThing() {
// prepare valid message
final String knownThingId = "1";
final MessageProperties messageProperties = createMessageProperties(MessageType.THING_REMOVED);
@@ -532,7 +551,8 @@ class AmqpMessageHandlerServiceTest {
/**
* Tests the deletion of a target/thing with missing thingId
*/
@Test void deleteThingWithoutThingId() {
@Test
void deleteThingWithoutThingId() {
// prepare invalid message
final MessageProperties messageProperties = createMessageProperties(MessageType.THING_REMOVED);
final Message message = createMessage(new byte[0], messageProperties);
@@ -546,7 +566,8 @@ class AmqpMessageHandlerServiceTest {
/**
* Tests activating auto-confirmation on a target.
*/
@Test void setAutoConfirmationStateActive() {
@Test
void setAutoConfirmationStateActive() {
final String knownThingId = "1";
final String initiator = "iAmTheInitiator";
final String remark = "remarkForTesting";
@@ -573,7 +594,8 @@ class AmqpMessageHandlerServiceTest {
/**
* Tests deactivating auto-confirmation on a target.
*/
@Test void setAutoConfirmationStateDeactivated() {
@Test
void setAutoConfirmationStateDeactivated() {
final String knownThingId = "1";
final MessageProperties messageProperties = createMessageProperties(MessageType.EVENT);

View File

@@ -51,7 +51,8 @@ class BaseAmqpServiceTest {
/**
* Verify that the message conversion works
*/
@Test void convertMessageTest() {
@Test
void convertMessageTest() {
final DmfActionUpdateStatus actionUpdateStatus = createActionStatus();
when(rabbitTemplate.getMessageConverter()).thenReturn(new Jackson2JsonMessageConverter());
@@ -63,7 +64,8 @@ class BaseAmqpServiceTest {
/**
* Tests invalid null message content
*/
@Test @ExpectEvents({ @Expect(type = TargetCreatedEvent.class, count = 0) })
@Test
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class, count = 0) })
void convertMessageWithNullContent() {
assertThatExceptionOfType(IllegalArgumentException.class)
.as("Expected IllegalArgumentException for invalid (null) JSON")
@@ -73,7 +75,8 @@ class BaseAmqpServiceTest {
/**
* Tests invalid empty message content
*/
@Test @ExpectEvents({ @Expect(type = TargetCreatedEvent.class, count = 0) })
@Test
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class, count = 0) })
void updateActionStatusWithEmptyContent() {
final Message message = createMessage("".getBytes());
assertThatExceptionOfType(MessageConversionException.class)
@@ -84,7 +87,8 @@ class BaseAmqpServiceTest {
/**
* Tests invalid json message content
*/
@Test @ExpectEvents({ @Expect(type = TargetCreatedEvent.class, count = 0) })
@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

@@ -30,7 +30,8 @@ class RequestExceptionStrategyTest {
/**
* Verifies that default handler is used if no handlers are defined for the specific exception.
*/
@Test void verifyDefaultFatal() {
@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();
}
@@ -38,7 +39,8 @@ class RequestExceptionStrategyTest {
/**
* Verifies additional fatal exception types are fatal.
*/
@Test void verifyAdditionalFatal() {
@Test
void verifyAdditionalFatal() {
assertThat(requeueExceptionStrategy.isFatal(new IllegalArgumentException())).isTrue();
assertThat(requeueExceptionStrategy.isFatal(new IndexOutOfBoundsException())).isTrue();
}
@@ -46,7 +48,8 @@ class RequestExceptionStrategyTest {
/**
* Verifies additional fatal exception types are fatal.
*/
@Test void verifyAdditionalWrappedFatal() {
@Test
void verifyAdditionalWrappedFatal() {
assertThat(requeueExceptionStrategy.isFatal(new Throwable(new IllegalArgumentException()))).isTrue();
assertThat(requeueExceptionStrategy.isFatal(new Throwable(new IndexOutOfBoundsException()))).isTrue();
}
@@ -54,7 +57,8 @@ class RequestExceptionStrategyTest {
/**
* Verifies that default handler is used if no handlers are defined for the specific exception.
*/
@Test void verifyNonFatal() {
@Test
void verifyNonFatal() {
assertThat(requeueExceptionStrategy.isFatal(new NullPointerException())).isFalse();
assertThat(requeueExceptionStrategy.isFatal(new Throwable(new NullPointerException()))).isFalse();
}

View File

@@ -91,7 +91,8 @@ class AmqpMessageDispatcherServiceIntegrationTest extends AbstractAmqpServiceInt
/**
* Verify that a distribution assignment send a download and install message.
*/
@Test @ExpectEvents({
@Test
@ExpectEvents({
@Expect(type = TargetCreatedEvent.class, count = 1),
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
@Expect(type = ActionCreatedEvent.class, count = 1),
@@ -112,7 +113,8 @@ class AmqpMessageDispatcherServiceIntegrationTest extends AbstractAmqpServiceInt
/**
* Verify that a distribution assignment sends a download message with window configured but before maintenance window start time.
*/
@Test @ExpectEvents({
@Test
@ExpectEvents({
@Expect(type = TargetCreatedEvent.class, count = 1),
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
@Expect(type = ActionCreatedEvent.class, count = 1),
@@ -138,7 +140,8 @@ class AmqpMessageDispatcherServiceIntegrationTest extends AbstractAmqpServiceInt
/**
* Verify that a distribution assignment sends a download and install message with window configured and during maintenance window start time.
*/
@Test @ExpectEvents({
@Test
@ExpectEvents({
@Expect(type = TargetCreatedEvent.class, count = 1),
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
@Expect(type = ActionCreatedEvent.class, count = 1),
@@ -164,7 +167,8 @@ class AmqpMessageDispatcherServiceIntegrationTest extends AbstractAmqpServiceInt
/**
* Verify that a distribution assignment multiple times send cancel and assign events with right softwaremodules
*/
@Test @ExpectEvents({
@Test
@ExpectEvents({
@Expect(type = TargetCreatedEvent.class, count = 1),
@Expect(type = TargetAssignDistributionSetEvent.class, count = 2),
@Expect(type = CancelTargetAssignmentEvent.class, count = 1),
@@ -211,7 +215,8 @@ class AmqpMessageDispatcherServiceIntegrationTest extends AbstractAmqpServiceInt
/**
* If multi assignment is enabled multi-action messages are sent.
*/
@Test @ExpectEvents({
@Test
@ExpectEvents({
@Expect(type = TargetCreatedEvent.class, count = 1),
@Expect(type = MultiActionAssignEvent.class, count = 2),
@Expect(type = TargetAssignDistributionSetEvent.class, count = 0),
@@ -244,7 +249,8 @@ class AmqpMessageDispatcherServiceIntegrationTest extends AbstractAmqpServiceInt
/**
* Verify payload of multi action messages.
*/
@Test void assertMultiActionMessagePayloads() {
@Test
void assertMultiActionMessagePayloads() {
final int expectedWeightIfNotSet = 1000;
final int weight1 = 600;
final String controllerId = UUID.randomUUID().toString();
@@ -294,7 +300,8 @@ class AmqpMessageDispatcherServiceIntegrationTest extends AbstractAmqpServiceInt
/**
* Handle cancelation process of an action in multi assignment mode.
*/
@Test @ExpectEvents({
@Test
@ExpectEvents({
@Expect(type = TargetCreatedEvent.class, count = 1),
@Expect(type = TargetUpdatedEvent.class, count = 2),
@Expect(type = TargetPollEvent.class, count = 1),
@@ -334,7 +341,8 @@ class AmqpMessageDispatcherServiceIntegrationTest extends AbstractAmqpServiceInt
/**
* Handle finishing an action in multi assignment mode.
*/
@Test @ExpectEvents({
@Test
@ExpectEvents({
@Expect(type = TargetCreatedEvent.class, count = 1),
@Expect(type = MultiActionAssignEvent.class, count = 2),
@Expect(type = TargetAttributesRequestedEvent.class, count = 1),
@@ -368,7 +376,8 @@ class AmqpMessageDispatcherServiceIntegrationTest extends AbstractAmqpServiceInt
/**
* If multi assignment is enabled assigning a DS multiple times creates a new action every time.
*/
@Test @ExpectEvents({
@Test
@ExpectEvents({
@Expect(type = TargetCreatedEvent.class, count = 1),
@Expect(type = MultiActionAssignEvent.class, count = 2),
@Expect(type = TargetAssignDistributionSetEvent.class, count = 0),
@@ -401,7 +410,8 @@ class AmqpMessageDispatcherServiceIntegrationTest extends AbstractAmqpServiceInt
/**
* If multi assignment is enabled multiple rollouts with the same DS lead to multiple actions.
*/
@Test @ExpectEvents({
@Test
@ExpectEvents({
@Expect(type = TargetCreatedEvent.class, count = 1),
@Expect(type = MultiActionAssignEvent.class, count = 2),
@Expect(type = TargetAssignDistributionSetEvent.class, count = 0),
@@ -440,7 +450,8 @@ class AmqpMessageDispatcherServiceIntegrationTest extends AbstractAmqpServiceInt
/**
* If multi assignment is enabled finishing one rollout does not affect other rollouts of the target.
*/
@Test @ExpectEvents({
@Test
@ExpectEvents({
@Expect(type = TargetCreatedEvent.class, count = 1),
@Expect(type = MultiActionAssignEvent.class, count = 3),
@Expect(type = ActionCreatedEvent.class, count = 3),
@@ -492,7 +503,8 @@ class AmqpMessageDispatcherServiceIntegrationTest extends AbstractAmqpServiceInt
/**
* Verify that a cancel assignment send a cancel message.
*/
@Test @ExpectEvents({
@Test
@ExpectEvents({
@Expect(type = TargetCreatedEvent.class, count = 1),
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
@Expect(type = CancelTargetAssignmentEvent.class, count = 1),
@@ -517,7 +529,8 @@ class AmqpMessageDispatcherServiceIntegrationTest extends AbstractAmqpServiceInt
/**
* Verify that when a target is deleted a target delete message is send.
*/
@Test @ExpectEvents({
@Test
@ExpectEvents({
@Expect(type = TargetCreatedEvent.class, count = 1),
@Expect(type = TargetPollEvent.class, count = 1),
@Expect(type = TargetDeletedEvent.class, count = 1) })
@@ -532,7 +545,8 @@ class AmqpMessageDispatcherServiceIntegrationTest extends AbstractAmqpServiceInt
/**
* Verify that attribute update is requested after device successfully closed software update.
*/
@Test @ExpectEvents({
@Test
@ExpectEvents({
@Expect(type = TargetCreatedEvent.class, count = 1),
@Expect(type = TargetAssignDistributionSetEvent.class, count = 2),
@Expect(type = ActionUpdatedEvent.class, count = 2),
@@ -562,7 +576,8 @@ class AmqpMessageDispatcherServiceIntegrationTest extends AbstractAmqpServiceInt
/**
* Tests the download_only assignment: asserts correct dmf Message topic, and assigned DS
*/
@Test @ExpectEvents({
@Test
@ExpectEvents({
@Expect(type = TargetCreatedEvent.class, count = 1),
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
@Expect(type = ActionCreatedEvent.class, count = 1),
@@ -597,14 +612,16 @@ class AmqpMessageDispatcherServiceIntegrationTest extends AbstractAmqpServiceInt
/**
* Verify payload of batch assignment download and install message.
*/
@Test void assertBatchAssignmentsDownloadAndInstall() {
@Test
void assertBatchAssignmentsDownloadAndInstall() {
assertBatchAssignmentsMessagePayload(BATCH_DOWNLOAD_AND_INSTALL);
}
/**
* Verify payload of batch assignments download only message.
*/
@Test void assertBatchAssignmentsDownloadOnly() {
@Test
void assertBatchAssignmentsDownloadOnly() {
assertBatchAssignmentsMessagePayload(BATCH_DOWNLOAD);
}
@@ -635,7 +652,8 @@ class AmqpMessageDispatcherServiceIntegrationTest extends AbstractAmqpServiceInt
/**
* Verify that batch and multi-assignments can't be activated at the same time.
*/
@Test void assertBatchAndMultiAssignmentsNotCompatible() {
@Test
void assertBatchAndMultiAssignmentsNotCompatible() {
enableBatchAssignments();
assertThatExceptionOfType(TenantConfigurationValueChangeNotAllowedException.class)
.isThrownBy(() -> enableMultiAssignments());
@@ -694,7 +712,8 @@ class AmqpMessageDispatcherServiceIntegrationTest extends AbstractAmqpServiceInt
/**
* Verify that a distribution assignment send a confirm message.
*/
@Test @ExpectEvents({
@Test
@ExpectEvents({
@Expect(type = TargetCreatedEvent.class, count = 1),
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
@Expect(type = ActionCreatedEvent.class, count = 1),

View File

@@ -94,7 +94,8 @@ class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServiceIntegr
/**
* Tests DMF PING request and expected response.
*/
@Test void pingDmfInterface() {
@Test
void pingDmfInterface() {
final Message pingMessage = createPingMessage(CORRELATION_ID, TENANT_EXIST);
getDmfClient().send(pingMessage);
@@ -106,7 +107,8 @@ class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServiceIntegr
/**
* Tests register target
*/
@Test @ExpectEvents({
@Test
@ExpectEvents({
@Expect(type = TargetCreatedEvent.class, count = 2),
@Expect(type = TargetPollEvent.class, count = 3) })
void registerTargets() {
@@ -123,7 +125,8 @@ class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServiceIntegr
/**
* Tests register target with name
*/
@Test @ExpectEvents({
@Test
@ExpectEvents({
@Expect(type = TargetCreatedEvent.class, count = 1),
@Expect(type = TargetUpdatedEvent.class, count = 1),
@Expect(type = TargetPollEvent.class, count = 2) })
@@ -142,7 +145,8 @@ class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServiceIntegr
/**
* Tests register target with attributes
*/
@Test @ExpectEvents({
@Test
@ExpectEvents({
@Expect(type = TargetCreatedEvent.class, count = 1),
@Expect(type = TargetUpdatedEvent.class, count = 2),
@Expect(type = TargetPollEvent.class, count = 2) })
@@ -164,7 +168,8 @@ class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServiceIntegr
/**
* Tests register target with name and attributes
*/
@Test @ExpectEvents({
@Test
@ExpectEvents({
@Expect(type = TargetCreatedEvent.class, count = 1),
@Expect(type = TargetUpdatedEvent.class, count = 3),
@Expect(type = TargetPollEvent.class, count = 2) })
@@ -201,7 +206,8 @@ class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServiceIntegr
/**
* Tests register invalid target with too long controller id
*/
@Test @ExpectEvents({ @Expect(type = TargetCreatedEvent.class) })
@Test
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class) })
void registerInvalidTargetWithTooLongControllerId() {
createAndSendThingCreated(randomString(Target.CONTROLLER_ID_MAX_SIZE + 1));
assertAllTargetsCount(0);
@@ -211,7 +217,8 @@ class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServiceIntegr
/**
* Tests null reply to property in message header. This message should forwarded to the deadletter queue
*/
@Test @ExpectEvents({ @Expect(type = TargetCreatedEvent.class) })
@Test
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class) })
void missingReplyToProperty() {
final String controllerId = TARGET_PREFIX + "missingReplyToProperty";
final Message createTargetMessage = createTargetMessage(controllerId, TENANT_EXIST);
@@ -225,7 +232,8 @@ class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServiceIntegr
/**
* Tests missing reply to property in message header. This message should forwarded to the deadletter queue
*/
@Test @ExpectEvents({ @Expect(type = TargetCreatedEvent.class) })
@Test
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class) })
void emptyReplyToProperty() {
final String controllerId = TARGET_PREFIX + "emptyReplyToProperty";
final Message createTargetMessage = createTargetMessage(controllerId, TENANT_EXIST);
@@ -239,7 +247,8 @@ class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServiceIntegr
/**
* Tests missing thing id property in message. This message should forwarded to the deadletter queue
*/
@Test @ExpectEvents({ @Expect(type = TargetCreatedEvent.class) })
@Test
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class) })
void missingThingIdProperty() {
final Message createTargetMessage = createTargetMessage(null, TENANT_EXIST);
createTargetMessage.getMessageProperties().getHeaders().remove(MessageHeaderKey.THING_ID);
@@ -252,7 +261,8 @@ class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServiceIntegr
/**
* Tests null thing id property in message. This message should forwarded to the deadletter queue
*/
@Test @ExpectEvents({ @Expect(type = TargetCreatedEvent.class) })
@Test
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class) })
void nullThingIdProperty() {
final Message createTargetMessage = createTargetMessage(null, TENANT_EXIST);
getDmfClient().send(createTargetMessage);
@@ -264,7 +274,8 @@ class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServiceIntegr
/**
* Tests missing tenant message header. This message should forwarded to the deadletter queue
*/
@Test @ExpectEvents({ @Expect(type = TargetCreatedEvent.class) })
@Test
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class) })
void missingTenantHeader() {
final String controllerId = TARGET_PREFIX + "missingTenantHeader";
final Message createTargetMessage = createTargetMessage(controllerId, TENANT_EXIST);
@@ -278,7 +289,8 @@ class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServiceIntegr
/**
* Tests null tenant message header. This message should forwarded to the deadletter queue
*/
@Test @ExpectEvents({ @Expect(type = TargetCreatedEvent.class) })
@Test
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class) })
void nullTenantHeader() {
final String controllerId = TARGET_PREFIX + "nullTenantHeader";
final Message createTargetMessage = createTargetMessage(controllerId, null);
@@ -291,7 +303,8 @@ class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServiceIntegr
/**
* Tests empty tenant message header. This message should forwarded to the deadletter queue
*/
@Test @ExpectEvents({ @Expect(type = TargetCreatedEvent.class) })
@Test
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class) })
void emptyTenantHeader() {
final String controllerId = TARGET_PREFIX + "emptyTenantHeader";
final Message createTargetMessage = createTargetMessage(controllerId, "");
@@ -304,7 +317,8 @@ class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServiceIntegr
/**
* Tests missing type message header. This message should forwarded to the deadletter queue
*/
@Test @ExpectEvents({ @Expect(type = TargetCreatedEvent.class) })
@Test
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class) })
void missingTypeHeader() {
final Message createTargetMessage = createTargetMessage(null, TENANT_EXIST);
createTargetMessage.getMessageProperties().getHeaders().remove(MessageHeaderKey.TYPE);
@@ -348,7 +362,8 @@ class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServiceIntegr
/**
* Tests missing topic message header. This message should forwarded to the deadletter queue
*/
@Test @ExpectEvents({ @Expect(type = TargetCreatedEvent.class) })
@Test
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class) })
void missingTopicHeader() {
final Message eventMessage = createUpdateActionEventMessage("");
eventMessage.getMessageProperties().getHeaders().remove(MessageHeaderKey.TOPIC);
@@ -373,7 +388,8 @@ class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServiceIntegr
/**
* Tests invalid topic message header. This message should forwarded to the deadletter queue
*/
@Test @ExpectEvents({ @Expect(type = TargetCreatedEvent.class) })
@Test
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class) })
void updateActionStatusWithInvalidActionId() {
final DmfActionUpdateStatus actionUpdateStatus = new DmfActionUpdateStatus(1L, DmfActionStatus.RUNNING);
final Message eventMessage = createUpdateActionEventMessage(actionUpdateStatus);
@@ -384,7 +400,8 @@ class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServiceIntegr
/**
* Tests register target and send finished message
*/
@Test @ExpectEvents({
@Test
@ExpectEvents({
@Expect(type = TargetCreatedEvent.class, count = 1),
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
@Expect(type = ActionUpdatedEvent.class, count = 1),
@@ -404,7 +421,8 @@ class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServiceIntegr
/**
* Register a target and send a update action status (running). Verify if the updated action status is correct.
*/
@Test @ExpectEvents({
@Test
@ExpectEvents({
@Expect(type = TargetCreatedEvent.class, count = 1),
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
@Expect(type = ActionUpdatedEvent.class),
@@ -423,7 +441,8 @@ class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServiceIntegr
/**
* Register a target and send an update action status (downloaded). Verify if the updated action status is correct.
*/
@Test @ExpectEvents({
@Test
@ExpectEvents({
@Expect(type = TargetCreatedEvent.class, count = 1),
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
@Expect(type = ActionUpdatedEvent.class),
@@ -442,7 +461,8 @@ class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServiceIntegr
/**
* Register a target and send a update action status (download). Verify if the updated action status is correct.
*/
@Test @ExpectEvents({
@Test
@ExpectEvents({
@Expect(type = TargetCreatedEvent.class, count = 1),
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
@Expect(type = ActionCreatedEvent.class, count = 1),
@@ -460,7 +480,8 @@ class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServiceIntegr
/**
* Register a target and send a update action status (error). Verify if the updated action status is correct.
*/
@Test @ExpectEvents({
@Test
@ExpectEvents({
@Expect(type = TargetCreatedEvent.class, count = 1),
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
@Expect(type = ActionUpdatedEvent.class, count = 1),
@@ -479,7 +500,8 @@ class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServiceIntegr
/**
* Register a target and send a update action status (warning). Verify if the updated action status is correct.
*/
@Test @ExpectEvents({
@Test
@ExpectEvents({
@Expect(type = TargetCreatedEvent.class, count = 1),
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
@Expect(type = ActionCreatedEvent.class, count = 1),
@@ -497,7 +519,8 @@ class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServiceIntegr
/**
* Register a target and send a update action status (retrieved). Verify if the updated action status is correct.
*/
@Test @ExpectEvents({
@Test
@ExpectEvents({
@Expect(type = TargetCreatedEvent.class, count = 1),
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
@Expect(type = ActionCreatedEvent.class, count = 1),
@@ -515,7 +538,8 @@ class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServiceIntegr
/**
* Register a target and send a invalid update action status (cancel). This message should forwarded to the deadletter queue
*/
@Test @ExpectEvents({
@Test
@ExpectEvents({
@Expect(type = TargetCreatedEvent.class, count = 1),
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
@Expect(type = ActionCreatedEvent.class, count = 1),
@@ -534,7 +558,8 @@ class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServiceIntegr
/**
* Verify receiving a download and install message if a deployment is done before the target has polled the first time.
*/
@Test @ExpectEvents({
@Test
@ExpectEvents({
@Expect(type = TargetCreatedEvent.class, count = 1),
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
@Expect(type = ActionCreatedEvent.class, count = 1),
@@ -564,7 +589,8 @@ class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServiceIntegr
/**
* Verify receiving a download message if a deployment is done with window configured but before maintenance window start time.
*/
@Test @ExpectEvents({
@Test
@ExpectEvents({
@Expect(type = TargetCreatedEvent.class, count = 1),
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
@Expect(type = ActionCreatedEvent.class, count = 1),
@@ -595,7 +621,8 @@ class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServiceIntegr
/**
* Verify receiving a download_and_install message if a deployment is done with window configured and during maintenance window start time.
*/
@Test @ExpectEvents({
@Test
@ExpectEvents({
@Expect(type = TargetCreatedEvent.class, count = 1),
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
@Expect(type = ActionCreatedEvent.class, count = 1),
@@ -626,7 +653,8 @@ class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServiceIntegr
/**
* Verify receiving a cancel update message if a deployment is canceled before the target has polled the first time.
*/
@Test @ExpectEvents({
@Test
@ExpectEvents({
@Expect(type = TargetCreatedEvent.class, count = 1),
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
@Expect(type = ActionCreatedEvent.class, count = 1),
@@ -659,7 +687,8 @@ class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServiceIntegr
/**
* 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({
@Test
@ExpectEvents({
@Expect(type = TargetCreatedEvent.class, count = 1),
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
@Expect(type = ActionUpdatedEvent.class, count = 1),
@@ -684,7 +713,8 @@ class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServiceIntegr
/**
* Register a target and send a invalid update action status (cancel_rejected). This message should forwarded to the deadletter queue
*/
@Test @ExpectEvents({
@Test
@ExpectEvents({
@Expect(type = TargetCreatedEvent.class, count = 1),
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
@Expect(type = ActionCreatedEvent.class, count = 1),
@@ -703,7 +733,8 @@ class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServiceIntegr
/**
* Register a target and send a valid update action status (cancel_rejected). Verify if the updated action status is correct.
*/
@Test @ExpectEvents({
@Test
@ExpectEvents({
@Expect(type = TargetCreatedEvent.class, count = 1),
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
@Expect(type = CancelTargetAssignmentEvent.class, count = 1),
@@ -732,7 +763,8 @@ class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServiceIntegr
/**
* 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({
@Test
@ExpectEvents({
@Expect(type = TargetCreatedEvent.class, count = 1),
@Expect(type = TargetUpdatedEvent.class, count = 4),
@Expect(type = TargetPollEvent.class, count = 1) })
@@ -759,7 +791,8 @@ class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServiceIntegr
/**
* Verify that sending an update controller attribute message with no thingid header to an existing target does not work.
*/
@Test @ExpectEvents({
@Test
@ExpectEvents({
@Expect(type = TargetCreatedEvent.class, count = 1),
@Expect(type = TargetUpdatedEvent.class),
@Expect(type = TargetPollEvent.class, count = 1) })
@@ -786,7 +819,8 @@ class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServiceIntegr
/**
* Verify that sending an update controller attribute message with invalid body to an existing target does not work.
*/
@Test @ExpectEvents({
@Test
@ExpectEvents({
@Expect(type = TargetCreatedEvent.class, count = 1),
@Expect(type = TargetUpdatedEvent.class),
@Expect(type = TargetPollEvent.class, count = 1) })
@@ -805,7 +839,8 @@ class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServiceIntegr
/**
* Verifies that sending an UPDATE_ATTRIBUTES message with invalid attributes is handled correctly.
*/
@Test void updateAttributesWithInvalidValues() {
@Test
void updateAttributesWithInvalidValues() {
registerAndAssertTargetWithExistingTenant(UPDATE_ATTR_TEST_CONTROLLER_ID);
sendUpdateAttributesMessageWithGivenAttributes(TargetTestData.ATTRIBUTE_KEY_TOO_LONG, TargetTestData.ATTRIBUTE_VALUE_VALID);
@@ -818,7 +853,8 @@ class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServiceIntegr
/**
* Tests the download_only assignment: tests the handling of a target reporting DOWNLOADED
*/
@Test @ExpectEvents({
@Test
@ExpectEvents({
@Expect(type = TargetCreatedEvent.class, count = 1),
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
@Expect(type = ActionUpdatedEvent.class, count = 1),
@@ -853,7 +889,8 @@ class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServiceIntegr
/**
* Tests the download_only assignment: tests the handling of a target reporting FINISHED
*/
@Test @ExpectEvents({
@Test
@ExpectEvents({
@Expect(type = TargetCreatedEvent.class, count = 1),
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
@Expect(type = ActionUpdatedEvent.class, count = 2),
@@ -896,7 +933,8 @@ class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServiceIntegr
/**
* Messages that result into certain exceptions being raised should not be requeued. This message should forwarded to the deadletter queue
*/
@Test @ExpectEvents({
@Test
@ExpectEvents({
@Expect(type = TargetCreatedEvent.class) })
void ignoredExceptionTypesShouldNotBeRequeued() {
final ControllerManagement mockedControllerManagement = Mockito.mock(ControllerManagement.class);
@@ -922,7 +960,8 @@ class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServiceIntegr
/**
* Register a target and send a update action status (confirmed). Verify if the updated action status is correct.
*/
@Test @ExpectEvents({
@Test
@ExpectEvents({
@Expect(type = TargetCreatedEvent.class, count = 1),
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
@Expect(type = ActionUpdatedEvent.class, count = 1),
@@ -951,7 +990,8 @@ class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServiceIntegr
/**
* Verify the DMF confirmed feedback can be provided if confirmation flow is disabled
*/
@Test @ExpectEvents({
@Test
@ExpectEvents({
@Expect(type = TargetCreatedEvent.class, count = 1),
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
@Expect(type = ActionUpdatedEvent.class, count = 1),
@@ -986,7 +1026,8 @@ class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServiceIntegr
/**
* Verify the DMF confirmed feedback can be provided if confirmation flow is disabled
*/
@Test @ExpectEvents({
@Test
@ExpectEvents({
@Expect(type = TargetCreatedEvent.class, count = 1),
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
@Expect(type = ActionUpdatedEvent.class, count = 0),
@@ -1017,7 +1058,8 @@ class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServiceIntegr
/**
* Verify the DMF download and install message is send directly if auto-confirmation is active
*/
@Test @ExpectEvents({
@Test
@ExpectEvents({
@Expect(type = TargetCreatedEvent.class, count = 1),
@Expect(type = TargetUpdatedEvent.class, count = 2),
@Expect(type = TargetPollEvent.class, count = 1),
@@ -1052,7 +1094,8 @@ class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServiceIntegr
/**
* Register a target and send a update action status (denied). Verify if the updated action status is correct.
*/
@Test @ExpectEvents({
@Test
@ExpectEvents({
@Expect(type = TargetCreatedEvent.class, count = 1),
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
@Expect(type = ActionUpdatedEvent.class),

View File

@@ -26,7 +26,8 @@ class PagedListTest {
/**
* Ensures that a null payload entity throws an exception.
*/
@Test void createListWithNullContentThrowsException() {
@Test
void createListWithNullContentThrowsException() {
assertThatThrownBy(() -> new PagedList<>(null, 0))
.isInstanceOf(NullPointerException.class);
}
@@ -34,7 +35,8 @@ class PagedListTest {
/**
* Create list with payload and verify content.
*/
@Test void createListWithContent() {
@Test
void createListWithContent() {
final long knownTotal = 2;
final List<String> knownContentList = new ArrayList<>();
knownContentList.add("content1");
@@ -46,7 +48,8 @@ class PagedListTest {
/**
* Create list with payload and verify size values.
*/
@Test void createListWithSmallerTotalThanContentSizeIsOk() {
@Test
void createListWithSmallerTotalThanContentSizeIsOk() {
final long knownTotal = 0;
final List<String> knownContentList = new ArrayList<>();
knownContentList.add("content1");

View File

@@ -33,7 +33,8 @@ class MgmtTargetAssignmentResponseBodyTest {
/**
* Tests that the ActionIds are serialized correctly in MgmtTargetAssignmentResponseBody
*/
@Test void testActionIdsSerialization() throws IOException {
@Test
void testActionIdsSerialization() throws IOException {
final MgmtTargetAssignmentResponseBody responseBody = generateResponseBody();
final ObjectMapper objectMapper = new ObjectMapper();
final String responseBodyAsString = objectMapper.writeValueAsString(responseBody);

View File

@@ -64,21 +64,24 @@ class MgmtActionResourceTest extends AbstractManagementApiIntegrationTest {
/**
* Handles the GET request of retrieving a specific action.
*/
@Test public void getAction() throws Exception {
@Test
void getAction() throws Exception {
getAction(false);
}
/**
* Handles the GET request of retrieving a specific action with external reference.
*/
@Test public void getActionExtRef() throws Exception {
@Test
void getActionExtRef() throws Exception {
getAction(true);
}
/**
* Verifies that actions can be filtered based on action status.
*/
@Test void filterActionsByStatus() throws Exception {
@Test
void filterActionsByStatus() throws Exception {
// prepare test
final DistributionSet dsA = testdataFactory.createDistributionSet("");
@@ -116,7 +119,8 @@ class MgmtActionResourceTest extends AbstractManagementApiIntegrationTest {
/**
* Verifies that actions can be filtered based on the detailed action status.
*/
@Test void filterActionsByDetailStatus() throws Exception {
@Test
void filterActionsByDetailStatus() throws Exception {
// prepare test
final DistributionSet dsA = testdataFactory.createDistributionSet("");
assignDistributionSet(dsA, Collections.singletonList(testdataFactory.createTarget("knownTargetId")));
@@ -154,7 +158,8 @@ class MgmtActionResourceTest extends AbstractManagementApiIntegrationTest {
/**
* Verifies that actions can be filtered based on extRef.
*/
@Test void filterActionsByExternalRef() throws Exception {
@Test
void filterActionsByExternalRef() throws Exception {
// prepare test
final String knownTargetId = "targetId";
final List<Action> actions = generateTargetWithTwoUpdatesWithOneOverride(knownTargetId);
@@ -198,7 +203,8 @@ class MgmtActionResourceTest extends AbstractManagementApiIntegrationTest {
/**
* Verifies that actions can be filtered based on the action status code that was reported last.
*/
@Test void filterActionsByLastStatusCode() throws Exception {
@Test
void filterActionsByLastStatusCode() throws Exception {
// assign a distribution set to three targets
final DistributionSet dsA = testdataFactory.createDistributionSet("");
final DistributionSetAssignmentResult assignmentResult = assignDistributionSet(dsA,
@@ -234,7 +240,8 @@ class MgmtActionResourceTest extends AbstractManagementApiIntegrationTest {
/**
* Verifies that actions can be filtered based on distribution set fields.
*/
@Test void filterActionsByDistributionSet() throws Exception {
@Test
void filterActionsByDistributionSet() throws Exception {
// prepare test
final DistributionSet ds = testdataFactory.createDistributionSet("");
assignDistributionSet(ds, Collections.singletonList(testdataFactory.createTarget("knownTargetId")));
@@ -280,7 +287,8 @@ class MgmtActionResourceTest extends AbstractManagementApiIntegrationTest {
/**
* Verifies that actions can be filtered based on rollout fields.
*/
@Test void filterActionsByRollout() throws Exception {
@Test
void filterActionsByRollout() throws Exception {
// prepare test
final DistributionSet ds = testdataFactory.createDistributionSet();
final Target target0 = testdataFactory.createTarget("t0");
@@ -322,7 +330,8 @@ class MgmtActionResourceTest extends AbstractManagementApiIntegrationTest {
/**
* Verifies that actions can be filtered based on target fields.
*/
@Test void filterActionsByTargetProperties() throws Exception {
@Test
void filterActionsByTargetProperties() throws Exception {
// prepare test
final Target target = testdataFactory.createTarget("knownTargetId", "knownTargetName", "http://0.0.0.0");
final DistributionSet ds = testdataFactory.createDistributionSet("");
@@ -337,21 +346,24 @@ class MgmtActionResourceTest extends AbstractManagementApiIntegrationTest {
/**
* Verifies that all available actions are returned if the complete collection is requested.
*/
@Test void getActions() throws Exception {
@Test
void getActions() throws Exception {
getActions(false);
}
/**
* Verifies that all available actions (whit ext refs) are returned if the complete collection is requested.
*/
@Test void getActionsExtRef() throws Exception {
@Test
void getActionsExtRef() throws Exception {
getActions(true);
}
/**
* Verifies that a full representation of all actions is returned if the collection is requested for representation mode 'full'.
*/
@Test void getActionsFullRepresentation() throws Exception {
@Test
void getActionsFullRepresentation() throws Exception {
final String knownTargetId = "targetId";
final List<Action> actions = generateTargetWithTwoUpdatesWithOneOverride(knownTargetId);
@@ -394,7 +406,8 @@ class MgmtActionResourceTest extends AbstractManagementApiIntegrationTest {
/**
* Verifies that the get request for actions returns an empty collection if no assignments have been done yet.
*/
@Test void getActionsWithEmptyResult() throws Exception {
@Test
void getActionsWithEmptyResult() throws Exception {
mvc.perform(get(MgmtRestConstants.ACTION_V1_REQUEST_MAPPING))
.andDo(MockMvcResultPrinter.print())
.andExpect(status().isOk())
@@ -406,7 +419,8 @@ class MgmtActionResourceTest extends AbstractManagementApiIntegrationTest {
/**
* Verifies paging is respected as expected.
*/
@Test void getMultipleActionsWithPagingLimitRequestParameter() throws Exception {
@Test
void getMultipleActionsWithPagingLimitRequestParameter() throws Exception {
final String knownTargetId = "targetId";
final List<Action> actions = generateTargetWithTwoUpdatesWithOneOverride(knownTargetId);
@@ -458,7 +472,8 @@ class MgmtActionResourceTest extends AbstractManagementApiIntegrationTest {
/**
* Verifies that the actions resource is read-only.
*/
@Test void invalidRequestsOnActionResource() throws Exception {
@Test
void invalidRequestsOnActionResource() throws Exception {
final String knownTargetId = "targetId";
generateTargetWithTwoUpdatesWithOneOverride(knownTargetId);
@@ -478,7 +493,8 @@ class MgmtActionResourceTest extends AbstractManagementApiIntegrationTest {
/**
* Verifies that the correct action is returned
*/
@Test void shouldRetrieveCorrectActionById() throws Exception {
@Test
void shouldRetrieveCorrectActionById() throws Exception {
final String knownTargetId = "targetId";
final List<Action> actions = generateTargetWithTwoUpdatesWithOneOverride(knownTargetId);
@@ -493,7 +509,8 @@ class MgmtActionResourceTest extends AbstractManagementApiIntegrationTest {
/**
* Verifies that NOT_FOUND is returned when there is no such action.
*/
@Test void requestActionThatDoesNotExistsLeadsToNotFound() throws Exception {
@Test
void requestActionThatDoesNotExistsLeadsToNotFound() throws Exception {
mvc.perform(get(MgmtRestConstants.ACTION_V1_REQUEST_MAPPING + "/" + 101))
.andDo(MockMvcResultPrinter.print())
.andExpect(status().isNotFound());

View File

@@ -87,7 +87,8 @@ class MgmtBasicAuthResourceTest {
/**
* Test of userinfo api with basic auth validation
*/
@Test @WithUser(principal = TEST_USER, authorities = {"READ", "WRITE", "DELETE"})
@Test
@WithUser(principal = TEST_USER, authorities = {"READ", "WRITE", "DELETE"})
void validateBasicAuthWithUserDetails() throws Exception {
withSecurityMock().perform(get(MgmtRestConstants.AUTH_V1_REQUEST_MAPPING))
.andDo(MockMvcResultPrinter.print())
@@ -103,7 +104,8 @@ class MgmtBasicAuthResourceTest {
/**
* Test of userinfo api with invalid basic auth fails
*/
@Test void validateBasicAuthFailsWithInvalidCredentials() throws Exception {
@Test
void validateBasicAuthFailsWithInvalidCredentials() throws Exception {
defaultMock.perform(get(MgmtRestConstants.AUTH_V1_REQUEST_MAPPING)
.header(HttpHeaders.AUTHORIZATION, getBasicAuth("wrongUser", "wrongSecret")))
.andDo(MockMvcResultPrinter.print())

View File

@@ -56,7 +56,8 @@ public class MgmtContentTypeTest extends AbstractManagementApiIntegrationTest {
/**
* The response of a POST request shall contain charset=utf-8
*/
@Test public void postDistributionSet_ContentTypeJsonUtf8_woAccept() throws Exception {
@Test
void postDistributionSet_ContentTypeJsonUtf8_woAccept() throws Exception {
final MvcResult result = mvc.perform(
post(MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING).content(JsonBuilder.distributionSets(
Collections.singletonList(ds)))
@@ -72,7 +73,8 @@ public class MgmtContentTypeTest extends AbstractManagementApiIntegrationTest {
/**
* The response of a POST request shall contain charset=utf-8
*/
@Test public void postDistributionSet_ContentTypeJsonUtf8_wAcceptJson() throws Exception {
@Test
void postDistributionSet_ContentTypeJsonUtf8_wAcceptJson() throws Exception {
final MvcResult result = mvc.perform(
post(MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING).content(JsonBuilder.distributionSets(
Collections.singletonList(ds)))
@@ -88,7 +90,8 @@ public class MgmtContentTypeTest extends AbstractManagementApiIntegrationTest {
/**
* The response of a POST request shall contain charset=utf-8
*/
@Test public void postDistributionSet_ContentTypeJsonUtf8_wAcceptJsonUtf8() throws Exception {
@Test
void postDistributionSet_ContentTypeJsonUtf8_wAcceptJsonUtf8() throws Exception {
final MvcResult result = mvc.perform(
post(MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING).content(JsonBuilder.distributionSets(
Collections.singletonList(ds)))
@@ -104,7 +107,8 @@ public class MgmtContentTypeTest extends AbstractManagementApiIntegrationTest {
/**
* The response of a POST request shall contain charset=utf-8
*/
@Test public void postDistributionSet_ContentTypeJsonUtf8_wAcceptHalJson() throws Exception {
@Test
void postDistributionSet_ContentTypeJsonUtf8_wAcceptHalJson() throws Exception {
final MvcResult result = mvc.perform(
post(MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING).content(JsonBuilder.distributionSets(
Collections.singletonList(ds)))
@@ -120,7 +124,8 @@ public class MgmtContentTypeTest extends AbstractManagementApiIntegrationTest {
/**
* The response of a POST request shall contain charset=utf-8
*/
@Test public void postDistributionSet_ContentTypeJson_woAccept() throws Exception {
@Test
void postDistributionSet_ContentTypeJson_woAccept() throws Exception {
final MvcResult result = mvc.perform(
post(MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING).content(JsonBuilder.distributionSets(
Collections.singletonList(ds)))
@@ -136,7 +141,8 @@ public class MgmtContentTypeTest extends AbstractManagementApiIntegrationTest {
/**
* The response of a POST request shall contain charset=utf-8
*/
@Test public void postDistributionSet_ContentTypeJson_wAcceptJson() throws Exception {
@Test
void postDistributionSet_ContentTypeJson_wAcceptJson() throws Exception {
final MvcResult result = mvc.perform(
post(MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING).content(JsonBuilder.distributionSets(
Collections.singletonList(ds)))
@@ -152,7 +158,8 @@ public class MgmtContentTypeTest extends AbstractManagementApiIntegrationTest {
/**
* The response of a POST request shall contain charset=utf-8
*/
@Test public void postDistributionSet_ContentTypeJson_wAcceptJsonUtf8() throws Exception {
@Test
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))
@@ -167,7 +174,8 @@ public class MgmtContentTypeTest extends AbstractManagementApiIntegrationTest {
/**
* The response of a POST request shall contain charset=utf-8
*/
@Test public void postDistributionSet_ContentTypeJson_wAcceptHalJson() throws Exception {
@Test
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))
@@ -182,7 +190,8 @@ public class MgmtContentTypeTest extends AbstractManagementApiIntegrationTest {
/**
* The response of a GET request shall contain charset=utf-8
*/
@Test public void getDistributionSet_woAccept() throws Exception {
@Test
void getDistributionSet_woAccept() throws Exception {
final MvcResult result = mvc.perform(get(MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING))
.andDo(MockMvcResultPrinter.print())
.andExpect(status().isOk())
@@ -194,7 +203,8 @@ public class MgmtContentTypeTest extends AbstractManagementApiIntegrationTest {
/**
* The response of a GET request shall contain charset=utf-8
*/
@Test public void getDistributionSet_wAcceptJson() throws Exception {
@Test
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())
@@ -206,7 +216,8 @@ public class MgmtContentTypeTest extends AbstractManagementApiIntegrationTest {
/**
* The response of a GET request shall contain charset=utf-8
*/
@Test public void getDistributionSet_wAcceptJsonUtf8() throws Exception {
@Test
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())
@@ -218,7 +229,8 @@ public class MgmtContentTypeTest extends AbstractManagementApiIntegrationTest {
/**
* The response of a GET request shall contain charset=utf-8
*/
@Test public void getDistributionSet_wAcceptHalJson() throws Exception {
@Test
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

@@ -87,7 +87,8 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
/**
* 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 {
@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"))
@@ -99,7 +100,8 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
/**
* 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 {
@Test
void getSoftwareModulesWithParameters() throws Exception {
final DistributionSet set = testdataFactory.createUpdatedDistributionSet();
// post assignment
@@ -114,7 +116,8 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
/**
* 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 {
@Test
void deleteFailureWhenDistributionSetInUse() throws Exception {
// create DisSet
final DistributionSet disSet = testdataFactory.createDistributionSetWithNoSoftwareModules("Eris", "560a");
final List<Long> smIDs = new ArrayList<>();
@@ -159,7 +162,8 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
/**
* 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 {
@Test
void assignmentFailureWhenAssigningToUsedDistributionSet() throws Exception {
// create DisSet
final DistributionSet disSet = testdataFactory.createDistributionSetWithNoSoftwareModules("Mars", "686,980");
final List<Long> smIDs = new ArrayList<>();
@@ -203,7 +207,8 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
/**
* This test verifies the assignment of Software Modules to a Distribution Set through the RESTful API.
*/
@Test void assignSoftwareModuleToDistributionSet() throws Exception {
@Test
void assignSoftwareModuleToDistributionSet() throws Exception {
// create DisSet
final DistributionSet disSet = testdataFactory.createDistributionSetWithNoSoftwareModules("Jupiter", "398,88");
// Test if size is 0
@@ -275,7 +280,8 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
/**
* This test verifies the removal of Software Modules of a Distribution Set through the RESTful API.
*/
@Test void unassignSoftwareModuleFromDistributionSet() throws Exception {
@Test
void unassignSoftwareModuleFromDistributionSet() throws Exception {
// Create DistributionSet with three software modules
final DistributionSet set = testdataFactory.createDistributionSet("Venus");
int amountOfSM = set.getModules().size();
@@ -299,7 +305,8 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
/**
* Ensures that multi target assignment through API is reflected by the repository.
*/
@Test void assignMultipleTargetsToDistributionSet() throws Exception {
@Test
void assignMultipleTargetsToDistributionSet() throws Exception {
final DistributionSet createdDs = testdataFactory.createDistributionSet();
// prepare targets
@@ -323,7 +330,8 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
/**
* 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 {
@Test
void assignTargetsToDistributionSetIgnoreCase() throws Exception {
final DistributionSet createdDs = testdataFactory.createDistributionSet();
// prepare targets
@@ -347,7 +355,8 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
/**
* Trying to create a DS from already marked as deleted type - should get as response 400 Bad Request
*/
@Test void createDsFromAlreadyMarkedAsDeletedType() throws Exception {
@Test
void createDsFromAlreadyMarkedAsDeletedType() throws Exception {
final SoftwareModule softwareModule = testdataFactory.createSoftwareModule("exampleKey");
final DistributionSetType type = testdataFactory.findOrCreateDistributionSetType(
"testKey", "testType", Collections.singletonList(softwareModule.getType()),
@@ -388,7 +397,8 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
/**
* Ensures that multi target assignment is protected by our getMaxTargetDistributionSetAssignmentsPerManualAssignment quota.
*/
@Test void assignMultipleTargetsToDistributionSetUntilQuotaIsExceeded() throws Exception {
@Test
void assignMultipleTargetsToDistributionSetUntilQuotaIsExceeded() throws Exception {
final int maxActions = quotaManagement.getMaxTargetDistributionSetAssignmentsPerManualAssignment();
final List<Target> targets = testdataFactory.createTargets(maxActions + 1);
final DistributionSet ds = testdataFactory.createDistributionSet();
@@ -412,7 +422,8 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
/**
* 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 {
@Test
void changeDistributionSetAssignmentForTargetUntilQuotaIsExceeded() throws Exception {
// create one target
final Target testTarget = testdataFactory.createTarget("trg1");
@@ -439,7 +450,8 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
/**
* Ensures that offline reported multi target assignment through API is reflected by the repository.
*/
@Test void offlineAssignmentOfMultipleTargetsToDistributionSet() throws Exception {
@Test
void offlineAssignmentOfMultipleTargetsToDistributionSet() throws Exception {
final DistributionSet createdDs = testdataFactory.createDistributionSet();
final List<Target> targets = testdataFactory.createTargets(5);
final JSONArray list = new JSONArray();
@@ -470,7 +482,8 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
/**
* Assigns multiple targets to distribution set with only maintenance schedule.
*/
@Test void assignMultipleTargetsToDistributionSetWithMaintenanceWindowStartOnly() throws Exception {
@Test
void assignMultipleTargetsToDistributionSetWithMaintenanceWindowStartOnly() throws Exception {
// prepare distribution set
final DistributionSet createdDs = testdataFactory.createDistributionSet();
// prepare targets
@@ -488,7 +501,8 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
/**
* Assigns multiple targets to distribution set with only maintenance window duration.
*/
@Test void assignMultipleTargetsToDistributionSetWithMaintenanceWindowEndOnly() throws Exception {
@Test
void assignMultipleTargetsToDistributionSetWithMaintenanceWindowEndOnly() throws Exception {
// prepare distribution set
final DistributionSet createdDs = testdataFactory.createDistributionSet();
// prepare targets
@@ -506,7 +520,8 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
/**
* Assigns multiple targets to distribution set with valid maintenance window.
*/
@Test void assignMultipleTargetsToDistributionSetWithValidMaintenanceWindow() throws Exception {
@Test
void assignMultipleTargetsToDistributionSetWithValidMaintenanceWindow() throws Exception {
// prepare distribution set
final DistributionSet createdDs = testdataFactory.createDistributionSet();
// prepare targets
@@ -525,7 +540,8 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
/**
* Assigns multiple targets to distribution set with last maintenance window scheduled before current time.
*/
@Test void assignMultipleTargetsToDistributionSetWithMaintenanceWindowEndTimeBeforeStartTime() throws Exception {
@Test
void assignMultipleTargetsToDistributionSetWithMaintenanceWindowEndTimeBeforeStartTime() throws Exception {
// prepare distribution set
final DistributionSet createdDs = testdataFactory.createDistributionSet();
// prepare targets
@@ -544,7 +560,8 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
/**
* Assigns multiple targets to distribution set with and without maintenance window.
*/
@Test void assignMultipleTargetsToDistributionSetWithAndWithoutMaintenanceWindow() throws Exception {
@Test
void assignMultipleTargetsToDistributionSetWithAndWithoutMaintenanceWindow() throws Exception {
// prepare distribution set
final DistributionSet createdDs = testdataFactory.createDistributionSet();
// prepare targets
@@ -572,7 +589,8 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
/**
* 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 {
@Test
void assignNotExistingTargetToDistributionSet() throws Exception {
final DistributionSet createdDs = testdataFactory.createDistributionSet();
final String[] knownTargetIds = new String[] { "1", "2", "3" };
@@ -593,7 +611,8 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
/**
* Ensures that assigned targets of DS are returned as reflected by the repository.
*/
@Test void getAssignedTargetsOfDistributionSet() throws Exception {
@Test
void getAssignedTargetsOfDistributionSet() throws Exception {
// prepare distribution set
final String knownTargetId = "knownTargetId1";
final DistributionSet createdDs = testdataFactory.createDistributionSet();
@@ -609,7 +628,8 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
/**
* 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 {
@Test
void getAssignedTargetsOfDistributionSetWithParameters() throws Exception {
final DistributionSet set = testdataFactory.createUpdatedDistributionSet();
assignDistributionSet(set, testdataFactory.createTargets(5, "targetMisc", "Test targets for query"))
@@ -627,7 +647,8 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
/**
* Ensures that assigned targets of DS are returned as persisted in the repository.
*/
@Test void getAssignedTargetsOfDistributionSetIsEmpty() throws Exception {
@Test
void getAssignedTargetsOfDistributionSetIsEmpty() throws Exception {
final DistributionSet createdDs = testdataFactory.createDistributionSet();
mvc.perform(get(
MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/" + createdDs.getId() + "/assignedTargets"))
@@ -639,7 +660,8 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
/**
* Ensures that installed targets of DS are returned as persisted in the repository.
*/
@Test void getInstalledTargetsOfDistributionSet() throws Exception {
@Test
void getInstalledTargetsOfDistributionSet() throws Exception {
// prepare distribution set
final String knownTargetId = "knownTargetId1";
final DistributionSet createdDs = testdataFactory.createDistributionSet();
@@ -663,7 +685,8 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
/**
* 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 {
@Test
void getInstalledTargetsOfDistributionSetWithParameters() throws Exception {
final DistributionSet set = testdataFactory.createUpdatedDistributionSet();
final List<Target> targets = assignDistributionSet(set,
@@ -682,7 +705,8 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
/**
* Ensures that target filters with auto assign DS are returned as persisted in the repository.
*/
@Test void getAutoAssignTargetFiltersOfDistributionSet() throws Exception {
@Test
void getAutoAssignTargetFiltersOfDistributionSet() throws Exception {
// prepare distribution set
final String knownFilterName = "a";
final DistributionSet createdDs = testdataFactory.createDistributionSet();
@@ -704,7 +728,8 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
/**
* 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 {
@Test
void ggetAutoAssignTargetFiltersOfDistributionSetWithParameters() throws Exception {
final DistributionSet set = testdataFactory.createUpdatedDistributionSet();
targetFilterQueryManagement.create(entityFactory.targetFilterQuery().create().name("filter1").query("name==a")
.autoAssignDistributionSet(set));
@@ -721,7 +746,8 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
/**
* Ensures that an error is returned when the query is invalid.
*/
@Test void getAutoAssignTargetFiltersOfDSWithInvalidFilter() throws Exception {
@Test
void getAutoAssignTargetFiltersOfDSWithInvalidFilter() throws Exception {
// prepare distribution set
final DistributionSet createdDs = testdataFactory.createDistributionSet();
final String invalidQuery = "unknownField=le=42";
@@ -734,7 +760,8 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
/**
* Ensures that target filters with auto assign DS are returned according to the query.
*/
@Test void getMultipleAutoAssignTargetFiltersOfDistributionSet() throws Exception {
@Test
void getMultipleAutoAssignTargetFiltersOfDistributionSet() throws Exception {
final String filterNamePrefix = "filter-";
final DistributionSet createdDs = testdataFactory.createDistributionSet();
final String query = "name==" + filterNamePrefix + "*";
@@ -752,7 +779,8 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
/**
* Ensures that no target filters are returned according to the non matching query.
*/
@Test void getEmptyAutoAssignTargetFiltersOfDistributionSet() throws Exception {
@Test
void getEmptyAutoAssignTargetFiltersOfDistributionSet() throws Exception {
final String filterNamePrefix = "filter-";
final DistributionSet createdDs = testdataFactory.createDistributionSet();
final String query = "name==doesNotExist";
@@ -768,7 +796,8 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
/**
* Ensures that DS in repository are listed with proper paging properties.
*/
@Test void getDistributionSetsWithoutAdditionalRequestParameters() throws Exception {
@Test
void getDistributionSetsWithoutAdditionalRequestParameters() throws Exception {
final int sets = 5;
createDistributionSetsAlphabetical(sets);
mvc.perform(get(MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING))
@@ -782,7 +811,8 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
/**
* Ensures that DS in repository are listed with proper paging results with paging limit parameter.
*/
@Test void getDistributionSetsWithPagingLimitRequestParameter() throws Exception {
@Test
void getDistributionSetsWithPagingLimitRequestParameter() throws Exception {
final int sets = 5;
final int limitSize = 1;
createDistributionSetsAlphabetical(sets);
@@ -798,7 +828,8 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
/**
* Ensures that DS in repository are listed with proper paging results with paging limit and offset parameter.
*/
@Test void getDistributionSetsWithPagingLimitAndOffsetRequestParameter() throws Exception {
@Test
void getDistributionSetsWithPagingLimitAndOffsetRequestParameter() throws Exception {
final int sets = 5;
final int offsetParam = 2;
final int expectedSize = sets - offsetParam;
@@ -955,7 +986,8 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
/**
* Ensures that DS deletion request to API is reflected by the repository.
*/
@Test void deleteUnassignedistributionSet() throws Exception {
@Test
void deleteUnassignedistributionSet() throws Exception {
// prepare test data
assertThat(distributionSetManagement.findByCompleted(true, PAGE)).isEmpty();
@@ -976,7 +1008,8 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
/**
* Ensures that DS deletion request to API on an entity that does not exist results in NOT_FOUND.
*/
@Test void deleteDistributionSetThatDoesNotExistLeadsToNotFound() throws Exception {
@Test
void deleteDistributionSetThatDoesNotExistLeadsToNotFound() throws Exception {
mvc.perform(delete("/rest/v1/distributionsets/1234"))
.andDo(MockMvcResultPrinter.print())
.andExpect(status().isNotFound());
@@ -985,7 +1018,8 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
/**
* Ensures that assigned DS deletion request to API is reflected by the repository by means of deleted flag set.
*/
@Test void deleteAssignedDistributionSet() throws Exception {
@Test
void deleteAssignedDistributionSet() throws Exception {
// prepare test data
assertThat(distributionSetManagement.findByCompleted(true, PAGE)).isEmpty();
@@ -1016,7 +1050,8 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
/**
* Ensures that DS property update request to API is reflected by the repository.
*/
@Test void updateDistributionSet() throws Exception {
@Test
void updateDistributionSet() throws Exception {
// prepare test data
assertThat(distributionSetManagement.findByCompleted(true, PAGE)).isEmpty();
@@ -1046,7 +1081,8 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
/**
* Ensures that DS property update on requiredMigrationStep fails if DS is assigned to a target.
*/
@Test void updateRequiredMigrationStepFailsIfDistributionSetisInUse() throws Exception {
@Test
void updateRequiredMigrationStepFailsIfDistributionSetisInUse() throws Exception {
// prepare test data
assertThat(distributionSetManagement.findByCompleted(true, PAGE)).isEmpty();
@@ -1072,7 +1108,8 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
/**
* Ensures that the server reacts properly to invalid requests (URI, Media Type, Methods) with correct reponses.
*/
@Test void invalidRequestsOnDistributionSetsResource() throws Exception {
@Test
void invalidRequestsOnDistributionSetsResource() throws Exception {
final DistributionSet set = testdataFactory.createDistributionSet("one");
final List<DistributionSet> sets = new ArrayList<>();
@@ -1134,7 +1171,8 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
/**
* Ensures that the metadata creation through API is reflected by the repository.
*/
@Test void createMetadata() throws Exception {
@Test
void createMetadata() throws Exception {
final DistributionSet testDS = testdataFactory.createDistributionSet("one");
final String knownKey1 = "known.key.1.1";
@@ -1177,7 +1215,8 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
/**
* Ensures that a metadata update through API is reflected by the repository.
*/
@Test void updateMetadata() throws Exception {
@Test
void updateMetadata() throws Exception {
// prepare and create metadata for update
final String knownKey = "knownKey";
final String knownValue = "knownValue";
@@ -1199,7 +1238,8 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
/**
* Ensures that a metadata entry deletion through API is reflected by the repository.
*/
@Test void deleteMetadata() throws Exception {
@Test
void deleteMetadata() throws Exception {
// prepare and create metadata for deletion
final String knownKey = "knownKey";
final String knownValue = "knownValue";
@@ -1222,7 +1262,8 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
/**
* Ensures that DS metadata deletion request to API on an entity that does not exist results in NOT_FOUND.
*/
@Test void deleteMetadataThatDoesNotExistLeadsToNotFound() throws Exception {
@Test
void deleteMetadataThatDoesNotExistLeadsToNotFound() throws Exception {
// prepare and create metadata for deletion
final String knownKey = "knownKey";
final String knownValue = "knownValue";
@@ -1243,7 +1284,8 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
/**
* Ensures that a metadata entry selection through API reflects the repository content.
*/
@Test void getMetadataKey() throws Exception {
@Test
void getMetadataKey() throws Exception {
// prepare and create metadata
final String knownKey = "knownKey";
final String knownValue = "knownValue";
@@ -1260,7 +1302,8 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
/**
* Get a paged list of meta data for a distribution set with standard page size.
*/
@Test void getMetadata() throws Exception {
@Test
void getMetadata() throws Exception {
final int totalMetadata = 4;
final String knownKeyPrefix = "knownKey";
final String knownValuePrefix = "knownValue";
@@ -1278,7 +1321,8 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
/**
* Ensures that a DS search with query parameters returns the expected result.
*/
@Test void searchDistributionSetRsql() throws Exception {
@Test
void searchDistributionSetRsql() throws Exception {
final String dsSuffix = "test";
final int amount = 10;
testdataFactory.createDistributionSets(dsSuffix, amount);
@@ -1300,7 +1344,8 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
/**
* 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 {
@Test
void filterDistributionSetComplete() throws Exception {
final int amount = 10;
testdataFactory.createDistributionSets(amount);
distributionSetManagement
@@ -1318,7 +1363,8 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
/**
* Ensures that a DS assigned target search with controllerId==1 parameter returns only the target with the given ID.
*/
@Test void searchDistributionSetAssignedTargetsRsql() throws Exception {
@Test
void searchDistributionSetAssignedTargetsRsql() throws Exception {
// prepare distribution set
final Set<DistributionSet> createDistributionSetsAlphabetical = createDistributionSetsAlphabetical(1);
final DistributionSet createdDs = createDistributionSetsAlphabetical.iterator().next();
@@ -1405,7 +1451,8 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
/**
* A request for assigning a target multiple times results in a Bad Request when multiassignment is disabled.
*/
@Test void multiAssignmentRequestNotAllowedIfDisabled() throws Exception {
@Test
void multiAssignmentRequestNotAllowedIfDisabled() throws Exception {
final String targetId = testdataFactory.createTarget().getControllerId();
final Long dsId = testdataFactory.createDistributionSet().getId();
@@ -1422,7 +1469,8 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
/**
* Identical assignments in a single request are removed when multiassignment is disabled.
*/
@Test void identicalAssignmentInRequestAreRemovedIfMultiassignmentsDisabled() throws Exception {
@Test
void identicalAssignmentInRequestAreRemovedIfMultiassignmentsDisabled() throws Exception {
final String targetId = testdataFactory.createTarget().getControllerId();
final Long dsId = testdataFactory.createDistributionSet().getId();
@@ -1440,7 +1488,8 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
/**
* Assigning targets multiple times to a DS in one request works in multiassignment mode.
*/
@Test void multiAssignment() throws Exception {
@Test
void multiAssignment() throws Exception {
final List<String> targetIds = testdataFactory.createTargets(2).stream().map(Target::getControllerId)
.toList();
final Long dsId = testdataFactory.createDistributionSet().getId();
@@ -1462,7 +1511,8 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
/**
* An assignment request containing a weight is only accepted when weight is valide and multi assignment is on.
*/
@Test void weightValidation() throws Exception {
@Test
void weightValidation() throws Exception {
final String targetId = testdataFactory.createTarget().getControllerId();
final Long dsId = testdataFactory.createDistributionSet().getId();
final int weight = 78;
@@ -1494,7 +1544,8 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
/**
* Request to get the count of all Rollouts by status for specific Distribution set
*/
@Test void statisticsForRolloutsCountByStatus() throws Exception {
@Test
void statisticsForRolloutsCountByStatus() throws Exception {
testdataFactory.createTargets("targets", 4);
DistributionSet ds1 = testdataFactory.createDistributionSet("DS1");
DistributionSet ds2 = testdataFactory.createDistributionSet("DS2");
@@ -1528,7 +1579,8 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
/**
* Request to get the count of all Actions by status for specific Distribution set
*/
@Test void statisticsForActionsCountByStatus() throws Exception {
@Test
void statisticsForActionsCountByStatus() throws Exception {
testdataFactory.createTargets("targets", 4);
DistributionSet ds1 = testdataFactory.createDistributionSet("DS1");
@@ -1560,7 +1612,8 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
/**
* Request to get the count of all Auto Assignments for specific Distribution set
*/
@Test void statisticsForAutoAssignmentsCount() throws Exception {
@Test
void statisticsForAutoAssignmentsCount() throws Exception {
testdataFactory.createTargets("targets", 4);
DistributionSet ds1 = testdataFactory.createDistributionSet("DS1");
DistributionSet ds2 = testdataFactory.createDistributionSet("DS2");
@@ -1593,7 +1646,8 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
/**
* Request to get full Statistics for specific Distribution set
*/
@Test void statisticsForDistributionSet() throws Exception {
@Test
void statisticsForDistributionSet() throws Exception {
testdataFactory.createTargets("targets", 4);
testdataFactory.createTargets("autoAssignments", 4);
DistributionSet ds1 = testdataFactory.createDistributionSet("DS1");
@@ -1630,7 +1684,8 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
/**
* Verify invalidation of distribution sets that removes distribution sets from auto assignments, stops rollouts and cancels assignments
*/
@Test void invalidateDistributionSet() throws Exception {
@Test
void invalidateDistributionSet() throws Exception {
final DistributionSet distributionSet = testdataFactory.createDistributionSet();
final List<Target> targets = testdataFactory.createTargets(5, "invalidateDistributionSet");
assignDistributionSet(distributionSet, targets);
@@ -1665,7 +1720,8 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
/**
* Tests the lock. It is verified that the distribution set can be marked as locked through update operation.
*/
@Test void lockDistributionSet() throws Exception {
@Test
void lockDistributionSet() throws Exception {
// prepare test data
assertThat(distributionSetManagement.findByCompleted(true, PAGE)).isEmpty();
@@ -1688,7 +1744,8 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
/**
* Tests the unlock.
*/
@Test void unlockDistributionSet() throws Exception {
@Test
void unlockDistributionSet() throws Exception {
// prepare test data
assertThat(distributionSetManagement.findByCompleted(true, PAGE)).isEmpty();

View File

@@ -60,7 +60,8 @@ class MgmtDistributionSetTagResourceTest extends AbstractManagementApiIntegratio
/**
* Verifies that a paged result list of DS tags reflects the content on the repository side.
*/
@Test @ExpectEvents({ @Expect(type = DistributionSetTagCreatedEvent.class, count = 2) })
@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);
@@ -82,7 +83,8 @@ class MgmtDistributionSetTagResourceTest extends AbstractManagementApiIntegratio
/**
* Handles the GET request of retrieving all distribution set tags based by parameter
*/
@Test void getDistributionSetTagsWithParameters() throws Exception {
@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())
@@ -92,7 +94,8 @@ class MgmtDistributionSetTagResourceTest extends AbstractManagementApiIntegratio
/**
* 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 {
@Test
void getDistributionSetTagsByDistributionSetId() throws Exception {
final List<DistributionSetTag> tags = testdataFactory.createDistributionSetTags(2);
final DistributionSetTag tag1 = tags.get(0);
final DistributionSetTag tag2 = tags.get(1);
@@ -132,7 +135,8 @@ class MgmtDistributionSetTagResourceTest extends AbstractManagementApiIntegratio
/**
* 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 {
@Test
void getDistributionSetTagsByDistributionSetIdAndTagDescription() throws Exception {
final List<DistributionSetTag> tags = testdataFactory.createDistributionSetTags(2);
final DistributionSetTag tag1 = tags.get(0);
final DistributionSetTag tag2 = tags.get(1);
@@ -161,7 +165,8 @@ class MgmtDistributionSetTagResourceTest extends AbstractManagementApiIntegratio
/**
* Verifies that a single result of a DS tag reflects the content on the repository side.
*/
@Test @ExpectEvents({ @Expect(type = DistributionSetTagCreatedEvent.class, count = 2) })
@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);
@@ -180,7 +185,8 @@ class MgmtDistributionSetTagResourceTest extends AbstractManagementApiIntegratio
/**
* Verifies that created DS tags are stored in the repository as send to the API.
*/
@Test @ExpectEvents({ @Expect(type = DistributionSetTagCreatedEvent.class, count = 2) })
@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();
@@ -211,7 +217,8 @@ class MgmtDistributionSetTagResourceTest extends AbstractManagementApiIntegratio
/**
* Verifies that an updated DS tag is stored in the repository as send to the API.
*/
@Test @ExpectEvents({
@Test
@ExpectEvents({
@Expect(type = DistributionSetTagCreatedEvent.class, count = 1),
@Expect(type = DistributionSetTagUpdatedEvent.class, count = 1) })
void updateDistributionSetTag() throws Exception {
@@ -241,7 +248,8 @@ class MgmtDistributionSetTagResourceTest extends AbstractManagementApiIntegratio
/**
* Verifies that the delete call is reflected by the repository.
*/
@Test @ExpectEvents({
@Test
@ExpectEvents({
@Expect(type = DistributionSetTagCreatedEvent.class, count = 1),
@Expect(type = DistributionSetTagDeletedEvent.class, count = 1) })
void deleteDistributionSetTag() throws Exception {
@@ -258,7 +266,8 @@ class MgmtDistributionSetTagResourceTest extends AbstractManagementApiIntegratio
/**
* Ensures that assigned DS to tag in repository are listed with proper paging results.
*/
@Test @ExpectEvents({
@Test
@ExpectEvents({
@Expect(type = DistributionSetTagCreatedEvent.class, count = 1),
@Expect(type = DistributionSetCreatedEvent.class, count = 5),
@Expect(type = DistributionSetUpdatedEvent.class, count = 5) })
@@ -279,7 +288,8 @@ class MgmtDistributionSetTagResourceTest extends AbstractManagementApiIntegratio
/**
* Ensures that assigned DS to tag in repository are listed with proper paging results with paging limit parameter.
*/
@Test @ExpectEvents({
@Test
@ExpectEvents({
@Expect(type = DistributionSetTagCreatedEvent.class, count = 1),
@Expect(type = DistributionSetCreatedEvent.class, count = 5),
@Expect(type = DistributionSetUpdatedEvent.class, count = 5) })
@@ -302,7 +312,8 @@ class MgmtDistributionSetTagResourceTest extends AbstractManagementApiIntegratio
/**
* Ensures that assigned DS to tag in repository are listed with proper paging results with paging limit and offset parameter.
*/
@Test @ExpectEvents({
@Test
@ExpectEvents({
@Expect(type = DistributionSetTagCreatedEvent.class, count = 1),
@Expect(type = DistributionSetCreatedEvent.class, count = 5),
@Expect(type = DistributionSetUpdatedEvent.class, count = 5) })
@@ -328,7 +339,8 @@ class MgmtDistributionSetTagResourceTest extends AbstractManagementApiIntegratio
/**
* Verifies that tag assignments done through tag API command are correctly stored in the repository.
*/
@Test @ExpectEvents({
@Test
@ExpectEvents({
@Expect(type = DistributionSetTagCreatedEvent.class, count = 1),
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
@Expect(type = DistributionSetUpdatedEvent.class, count = 1) })
@@ -348,7 +360,8 @@ class MgmtDistributionSetTagResourceTest extends AbstractManagementApiIntegratio
/**
* Verifies that tag assignments done through tag API command are correctly stored in the repository.
*/
@Test @ExpectEvents({
@Test
@ExpectEvents({
@Expect(type = DistributionSetTagCreatedEvent.class, count = 1),
@Expect(type = DistributionSetCreatedEvent.class, count = 2),
@Expect(type = DistributionSetUpdatedEvent.class, count = 2) })
@@ -370,7 +383,8 @@ class MgmtDistributionSetTagResourceTest extends AbstractManagementApiIntegratio
/**
* Verifies that tag unassignments done through tag API command are correctly stored in the repository.
*/
@Test @ExpectEvents({
@Test
@ExpectEvents({
@Expect(type = DistributionSetTagCreatedEvent.class, count = 1),
@Expect(type = DistributionSetCreatedEvent.class, count = 2),
@Expect(type = DistributionSetUpdatedEvent.class, count = 3) })
@@ -396,7 +410,8 @@ class MgmtDistributionSetTagResourceTest extends AbstractManagementApiIntegratio
/**
* Verifies that tag unassignments done through tag API command are correctly stored in the repository.
*/
@Test @ExpectEvents({
@Test
@ExpectEvents({
@Expect(type = DistributionSetTagCreatedEvent.class, count = 1),
@Expect(type = DistributionSetCreatedEvent.class, count = 3),
@Expect(type = DistributionSetUpdatedEvent.class, count = 5) })
@@ -423,7 +438,8 @@ class MgmtDistributionSetTagResourceTest extends AbstractManagementApiIntegratio
/**
* Verifies that tag assignments (multi targets) done through tag API command are correctly stored in the repository.
*/
@Test @ExpectEvents({
@Test
@ExpectEvents({
@Expect(type = DistributionSetTagCreatedEvent.class, count = 1),
@Expect(type = DistributionSetCreatedEvent.class, count = 2) })
void assignDistributionSetsNotFound() throws Exception {

View File

@@ -406,7 +406,8 @@ class MgmtDistributionSetTypeResourceTest extends AbstractManagementApiIntegrati
/**
* Handles the GET request of retrieving all distribution set types within SP based on parameter.
*/
@Test void getDistributionSetTypesWithParameter() throws Exception {
@Test
void getDistributionSetTypesWithParameter() throws Exception {
mvc.perform(get(MgmtRestConstants.DISTRIBUTIONSETTYPE_V1_REQUEST_MAPPING
+ "?limit=10&sort=name:ASC&offset=0&q=name==a"))
.andDo(MockMvcResultPrinter.print())
@@ -434,7 +435,8 @@ class MgmtDistributionSetTypeResourceTest extends AbstractManagementApiIntegrati
/**
* Ensures that DS type deletion request to API on an entity that does not exist results in NOT_FOUND.
*/
@Test void deleteDistributionSetTypeThatDoesNotExistLeadsToNotFound() throws Exception {
@Test
void deleteDistributionSetTypeThatDoesNotExistLeadsToNotFound() throws Exception {
mvc.perform(delete("/rest/v1/distributionsettypes/1234"))
.andDo(MockMvcResultPrinter.print())
.andExpect(status().isNotFound());
@@ -476,7 +478,8 @@ class MgmtDistributionSetTypeResourceTest extends AbstractManagementApiIntegrati
/**
* Checks the correct behaviour of /rest/v1/distributionsettypes/{ID} PUT requests.
*/
@Test void updateDistributionSetTypeColourDescriptionAndNameUntouched() throws Exception {
@Test
void updateDistributionSetTypeColourDescriptionAndNameUntouched() throws Exception {
final DistributionSetType testType = distributionSetTypeManagement.create(entityFactory.distributionSetType()
.create().key("test123").name("TestName123").description("Desc123").colour("col"));
@@ -498,7 +501,8 @@ class MgmtDistributionSetTypeResourceTest extends AbstractManagementApiIntegrati
/**
* Handles the PUT request for a single distribution set type within SP.
*/
@Test void updateDistributionSetTypeDescriptionAndColor() throws Exception {
@Test
void updateDistributionSetTypeDescriptionAndColor() throws Exception {
final DistributionSetType testType = distributionSetTypeManagement.update(entityFactory.distributionSetType()
.update(testdataFactory.createDistributionSet().getType().getId()).description("Desc1234"));
final String body = new JSONObject()
@@ -515,7 +519,8 @@ class MgmtDistributionSetTypeResourceTest extends AbstractManagementApiIntegrati
/**
* Tests the update of the deletion flag. It is verfied that the distribution set type can't be marked as deleted through update operation.
*/
@Test void updateDistributionSetTypeDeletedFlag() throws Exception {
@Test
void updateDistributionSetTypeDeletedFlag() throws Exception {
final DistributionSetType testType = distributionSetTypeManagement
.create(entityFactory.distributionSetType().create().key("test123").name("TestName123").colour("col"));
@@ -532,7 +537,8 @@ class MgmtDistributionSetTypeResourceTest extends AbstractManagementApiIntegrati
/**
* Checks the correct behaviour of /rest/v1/distributionsettypes GET requests with paging.
*/
@Test void getDistributionSetTypesWithoutAddtionalRequestParameters() throws Exception {
@Test
void getDistributionSetTypesWithoutAddtionalRequestParameters() throws Exception {
// 4 types overall (3 hawkbit tenant default, 1 test default
final int types = 4;
@@ -547,7 +553,8 @@ class MgmtDistributionSetTypeResourceTest extends AbstractManagementApiIntegrati
/**
* Checks the correct behaviour of /rest/v1/distributionsettypes GET requests with paging.
*/
@Test void getDistributionSetTypesWithPagingLimitRequestParameter() throws Exception {
@Test
void getDistributionSetTypesWithPagingLimitRequestParameter() throws Exception {
final int types = DEFAULT_DS_TYPES;
final int limitSize = 1;
@@ -563,7 +570,8 @@ class MgmtDistributionSetTypeResourceTest extends AbstractManagementApiIntegrati
/**
* Checks the correct behaviour of /rest/v1/distributionsettypes GET requests with paging.
*/
@Test void getDistributionSetTypesWithPagingLimitAndOffsetRequestParameter() throws Exception {
@Test
void getDistributionSetTypesWithPagingLimitAndOffsetRequestParameter() throws Exception {
final int types = DEFAULT_DS_TYPES;
final int offsetParam = 2;
final int expectedSize = types - offsetParam;
@@ -580,7 +588,8 @@ class MgmtDistributionSetTypeResourceTest extends AbstractManagementApiIntegrati
/**
* Ensures that the server is behaving as expected on invalid requests (wrong media type, wrong ID etc.).
*/
@Test void invalidRequestsOnDistributionSetTypesResource() throws Exception {
@Test
void invalidRequestsOnDistributionSetTypesResource() throws Exception {
final SoftwareModuleType testSmType = softwareModuleTypeManagement
.create(entityFactory.softwareModuleType().create().key("test123").name("TestName123"));
@@ -694,7 +703,8 @@ class MgmtDistributionSetTypeResourceTest extends AbstractManagementApiIntegrati
/**
* Search erquest of software module types.
*/
@Test void searchDistributionSetTypeRsql() throws Exception {
@Test
void searchDistributionSetTypeRsql() throws Exception {
distributionSetTypeManagement
.create(entityFactory.distributionSetType().create().key("test123").name("TestName123"));
distributionSetTypeManagement

View File

@@ -94,7 +94,8 @@ class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTest {
/**
* Handles the GET request of retrieving a single rollout.
*/
@Test public void getRollout() throws Exception {
@Test
void getRollout() throws Exception {
enableMultiAssignments();
approvalStrategy.setApprovalNeeded(true);
try {
@@ -130,7 +131,8 @@ class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTest {
/**
* Handles the GET request of retrieving a all targets of a specific deploy group of a rollout.
*/
@Test public void getRolloutDeployGroupTargetsWithParameters() throws Exception {
@Test
void getRolloutDeployGroupTargetsWithParameters() throws Exception {
testdataFactory.createTargets(4, "rollout", "description");
final DistributionSet dsA = testdataFactory.createDistributionSet("");
final Rollout rollout = createRollout("rollout1", 2, dsA.getId(), "controllerId==rollout*");
@@ -149,7 +151,8 @@ class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTest {
/**
* Handles the POST request of approving a rollout.
*/
@Test public void approveRollout() throws Exception {
@Test
void approveRollout() throws Exception {
approvalStrategy.setApprovalNeeded(true);
try {
testdataFactory.createTargets(4, "rollout", "description");
@@ -186,7 +189,8 @@ class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTest {
/**
* Check if approvalDecidedBy and approvalRemark are present when rollout is approved
*/
@Test public void validateIfApprovalFieldsArePresentAfterApproval() throws Exception {
@Test
void validateIfApprovalFieldsArePresentAfterApproval() throws Exception {
approvalStrategy.setApprovalNeeded(true);
approvalStrategy.setApproveDecidedBy("testUser");
final int amountTargets = 2;
@@ -218,7 +222,8 @@ class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTest {
/**
* Retry rollout test scenario
*/
@Test public void retryRolloutTest() throws Exception {
@Test
void retryRolloutTest() throws Exception {
final DistributionSet dsA = testdataFactory.createDistributionSet("");
final List<Target> successTargets = testdataFactory.createTargets("retryRolloutTargetSuccess-", 6);
@@ -288,7 +293,8 @@ class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTest {
/**
* Retrying a running rollout should not be allowed.
*/
@Test public void retryNotFinishedRolloutShouldNotBeAllowed() throws Exception {
@Test
void retryNotFinishedRolloutShouldNotBeAllowed() throws Exception {
final DistributionSet dsA = testdataFactory.createDistributionSet("");
testdataFactory.createTargets("retryRolloutTarget-", 10);
postRollout("rolloutToBeRetried", 1, dsA.getId(), "id==retryRolloutTarget*", 10, Action.ActionType.FORCED);
@@ -307,7 +313,8 @@ class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTest {
/**
* Retrying a non-existing rollout should lead to NOT FOUND.
*/
@Test public void retryNonExistingRolloutShouldLeadToNotFound() throws Exception {
@Test
void retryNonExistingRolloutShouldLeadToNotFound() throws Exception {
mvc.perform(post("/rest/v1/rollouts/{rolloutId}/retry", 6782623))
.andDo(MockMvcResultPrinter.print())
.andExpect(status().isNotFound());
@@ -316,7 +323,8 @@ class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTest {
/**
* Testing that creating rollout with wrong body returns bad request
*/
@Test void createRolloutWithInvalidBodyReturnsBadRequest() throws Exception {
@Test
void createRolloutWithInvalidBodyReturnsBadRequest() throws Exception {
mvc.perform(post("/rest/v1/rollouts").content("invalid body").contentType(MediaType.APPLICATION_JSON)
.accept(MediaType.APPLICATION_JSON))
.andDo(MockMvcResultPrinter.print())
@@ -327,7 +335,8 @@ class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTest {
/**
* Testing that creating rollout with insufficient permission returns forbidden
*/
@Test @WithUser(allSpPermissions = true, removeFromAllPermission = "CREATE_ROLLOUT")
@Test
@WithUser(allSpPermissions = true, removeFromAllPermission = "CREATE_ROLLOUT")
void createRolloutWithInsufficientPermissionReturnsForbidden() throws Exception {
final DistributionSet dsA = testdataFactory.createDistributionSet("");
mvc.perform(post("/rest/v1/rollouts")
@@ -341,7 +350,8 @@ class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTest {
/**
* Testing that creating rollout with not existing distribution set returns not found
*/
@Test void createRolloutWithNotExistingDistributionSetReturnsNotFound() throws Exception {
@Test
void createRolloutWithNotExistingDistributionSetReturnsNotFound() throws Exception {
mvc.perform(post("/rest/v1/rollouts").content(JsonBuilder.rollout("name", "desc", 10, 1234, "name==test", null))
.contentType(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON))
.andDo(MockMvcResultPrinter.print())
@@ -352,7 +362,8 @@ class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTest {
/**
* Testing that creating rollout with not valid formed target filter query returns bad request
*/
@Test void createRolloutWithNotWellFormedFilterReturnsBadRequest() throws Exception {
@Test
void createRolloutWithNotWellFormedFilterReturnsBadRequest() throws Exception {
final DistributionSet dsA = testdataFactory.createDistributionSet("");
mvc.perform(post("/rest/v1/rollouts")
.content(JsonBuilder.rollout("name", "desc", 5, dsA.getId(), "name=test", null))
@@ -366,7 +377,8 @@ class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTest {
/**
* Ensures that the repository refuses to create rollout without a defined target filter set.
*/
@Test void missingTargetFilterQueryInRollout() throws Exception {
@Test
void missingTargetFilterQueryInRollout() throws Exception {
final String targetFilterQuery = null;
@@ -384,7 +396,8 @@ class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTest {
/**
* Testing that rollout can be created
*/
@Test void createRollout() throws Exception {
@Test
void createRollout() throws Exception {
testdataFactory.createTargets(20, "target", "rollout");
final DistributionSet dsA = testdataFactory.createDistributionSet("");
@@ -394,7 +407,8 @@ class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTest {
/**
* Verifies that rollout cannot be created if too many rollout groups are specified.
*/
@Test void createRolloutWithTooManyRolloutGroups() throws Exception {
@Test
void createRolloutWithTooManyRolloutGroups() throws Exception {
final int maxGroups = quotaManagement.getMaxRolloutGroupsPerRollout();
testdataFactory.createTargets(20, "target", "rollout");
@@ -414,7 +428,8 @@ class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTest {
/**
* Verifies that rollout cannot be created if the 'max targets per rollout group' quota would be violated for one of the groups.
*/
@Test void createRolloutFailsIfRolloutGroupQuotaIsViolated() throws Exception {
@Test
void createRolloutFailsIfRolloutGroupQuotaIsViolated() throws Exception {
final int maxTargets = quotaManagement.getMaxTargetsPerRolloutGroup();
testdataFactory.createTargets(maxTargets + 1, "target", "rollout");
@@ -434,7 +449,8 @@ class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTest {
/**
* Testing that rollout can be created with groups
*/
@Test void createRolloutWithGroupDefinitions() throws Exception {
@Test
void createRolloutWithGroupDefinitions() throws Exception {
final DistributionSet dsA = testdataFactory.createDistributionSet("ro");
final int amountTargets = 10;
@@ -464,7 +480,8 @@ class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTest {
/**
* Testing dynamic rollouts with default dynamic group definition
*/
@Test void createDynamicRolloutWithDefaultDynamicGroupDefinition() throws Exception {
@Test
void createDynamicRolloutWithDefaultDynamicGroupDefinition() throws Exception {
final DistributionSet dsA = testdataFactory.createDistributionSet("ro");
final int amountTargets = 10;
@@ -548,7 +565,8 @@ class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTest {
/**
* Testing that no rollout with groups that have illegal percentages can be created
*/
@Test void createRolloutWithTooLowPercentage() throws Exception {
@Test
void createRolloutWithTooLowPercentage() throws Exception {
final DistributionSet dsA = testdataFactory.createDistributionSet("ro2");
final int amountTargets = 10;
@@ -575,7 +593,8 @@ class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTest {
/**
* Testing that no rollout with groups that have illegal percentages can be created
*/
@Test void createRolloutWithTooHighPercentage() throws Exception {
@Test
void createRolloutWithTooHighPercentage() throws Exception {
final DistributionSet dsA = testdataFactory.createDistributionSet("ro2");
final int amountTargets = 10;
@@ -602,7 +621,8 @@ class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTest {
/**
* Testing that rollout can be updated
*/
@Test void updateRollout() throws Exception {
@Test
void updateRollout() throws Exception {
testdataFactory.createTargets(4, "rollout", "description");
final DistributionSet dsA = testdataFactory.createDistributionSet("");
// create a running rollout for the created targets
@@ -629,7 +649,8 @@ class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTest {
/**
* Testing the empty list is returned if no rollout exists
*/
@Test void noRolloutReturnsEmptyList() throws Exception {
@Test
void noRolloutReturnsEmptyList() throws Exception {
mvc.perform(get("/rest/v1/rollouts").accept(MediaType.APPLICATION_JSON))
.andDo(MockMvcResultPrinter.print())
.andExpect(status().isOk())
@@ -641,7 +662,8 @@ class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTest {
/**
* Retrieves single rollout from management API including extra data that is delivered only for single rollout access.
*/
@Test void retrieveSingleRollout() throws Exception {
@Test
void retrieveSingleRollout() throws Exception {
testdataFactory.createTargets(20, "rollout", "rollout");
final DistributionSet dsA = testdataFactory.createDistributionSet("");
@@ -661,7 +683,8 @@ class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTest {
/**
* Retrieves the list of rollouts with representation mode 'full'.
*/
@Test void retrieveRolloutListFullRepresentation() throws Exception {
@Test
void retrieveRolloutListFullRepresentation() throws Exception {
testdataFactory.createTargets(20, "rollout", "rollout");
final DistributionSet dsA = testdataFactory.createDistributionSet("");
@@ -704,7 +727,8 @@ class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTest {
/**
* Retrieves the list of rollouts with representation mode 'full'.
*/
@Test void retrieveRolloutListFullRepresentationWithFilter() throws Exception {
@Test
void retrieveRolloutListFullRepresentationWithFilter() throws Exception {
testdataFactory.createTargets(20, "rollout", "rollout");
final DistributionSet dsA = testdataFactory.createDistributionSet("");
@@ -804,7 +828,8 @@ class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTest {
/**
* Confirmation required flag will be read from the Rollout, if specified.
*/
@Test void verifyRolloutGroupWillUseRolloutPropertyFirst() throws Exception {
@Test
void verifyRolloutGroupWillUseRolloutPropertyFirst() throws Exception {
enableConfirmationFlow();
final DistributionSet dsA = testdataFactory.createDistributionSet("ro");
@@ -848,7 +873,8 @@ class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTest {
/**
* Confirmation required flag will be read from the tenant config (confirmation flow state), if never specified.
*/
@Test void verifyRolloutGroupWillUseConfigIfNotProvidedWithRollout() throws Exception {
@Test
void verifyRolloutGroupWillUseConfigIfNotProvidedWithRollout() throws Exception {
enableConfirmationFlow();
final DistributionSet dsA = testdataFactory.createDistributionSet("ro");
@@ -892,7 +918,8 @@ class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTest {
/**
* Testing that rollout paged list contains rollouts
*/
@Test void rolloutPagedListContainsAllRollouts() throws Exception {
@Test
void rolloutPagedListContainsAllRollouts() throws Exception {
final DistributionSet dsA = testdataFactory.createDistributionSet("");
testdataFactory.createTargets(20, "target", "rollout");
@@ -955,7 +982,8 @@ class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTest {
/**
* Testing representation mode of rollout paged list
*/
@Test void rolloutPagedListRepresentationMode() throws Exception {
@Test
void rolloutPagedListRepresentationMode() throws Exception {
final DistributionSet dsA = testdataFactory.createDistributionSet("");
testdataFactory.createTargets(20, "target", "rollout");
@@ -974,7 +1002,8 @@ class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTest {
/**
* Testing that rollout paged list is limited by the query param limit
*/
@Test void rolloutPagedListIsLimitedToQueryParam() throws Exception {
@Test
void rolloutPagedListIsLimitedToQueryParam() throws Exception {
final DistributionSet dsA = testdataFactory.createDistributionSet("");
testdataFactory.createTargets(20, "target", "rollout");
@@ -1043,7 +1072,8 @@ class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTest {
/**
* The relation between deploy group and rollout should be validated.
*/
@Test void deployGroupsShouldValidateRelationWithRollout() throws Exception {
@Test
void deployGroupsShouldValidateRelationWithRollout() throws Exception {
// setup
final int amountTargets = 8;
testdataFactory.createTargets(amountTargets, "rollout", "rollout");
@@ -1073,7 +1103,8 @@ class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTest {
/**
* Testing that starting the rollout switches the state to starting and then to running
*/
@Test void startingRolloutSwitchesIntoRunningState() throws Exception {
@Test
void startingRolloutSwitchesIntoRunningState() throws Exception {
// setup
final int amountTargets = 20;
testdataFactory.createTargets(amountTargets, "rollout", "rollout");
@@ -1110,7 +1141,8 @@ class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTest {
/**
* Testing that pausing the rollout switches the state to paused
*/
@Test void pausingRolloutSwitchesIntoPausedState() throws Exception {
@Test
void pausingRolloutSwitchesIntoPausedState() throws Exception {
// setup
final int amountTargets = 20;
testdataFactory.createTargets(amountTargets, "rollout", "rollout");
@@ -1144,7 +1176,8 @@ class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTest {
/**
* Testing that resuming the rollout switches the state to running
*/
@Test void resumingRolloutSwitchesIntoRunningState() throws Exception {
@Test
void resumingRolloutSwitchesIntoRunningState() throws Exception {
// setup
final int amountTargets = 20;
testdataFactory.createTargets(amountTargets, "rollout", "rollout");
@@ -1183,7 +1216,8 @@ class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTest {
/**
* Testing that an already started rollout cannot be started again and returns bad request
*/
@Test void startingAlreadyStartedRolloutReturnsBadRequest() throws Exception {
@Test
void startingAlreadyStartedRolloutReturnsBadRequest() throws Exception {
// setup
final int amountTargets = 20;
testdataFactory.createTargets(amountTargets, "rollout", "rollout");
@@ -1210,7 +1244,8 @@ class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTest {
/**
* Testing that resuming a rollout which is not started leads to bad request
*/
@Test void resumingNotStartedRolloutReturnsBadRequest() throws Exception {
@Test
void resumingNotStartedRolloutReturnsBadRequest() throws Exception {
// setup
final int amountTargets = 20;
testdataFactory.createTargets(amountTargets, "rollout", "rollout");
@@ -1229,7 +1264,8 @@ class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTest {
/**
* Testing that starting rollout the first rollout group is in running state
*/
@Test void startingRolloutFirstRolloutGroupIsInRunningState() throws Exception {
@Test
void startingRolloutFirstRolloutGroupIsInRunningState() throws Exception {
// setup
final int amountTargets = 10;
testdataFactory.createTargets(amountTargets, "rollout", "rollout");
@@ -1296,7 +1332,8 @@ class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTest {
/**
* Testing that the targets of rollout group can be retrieved
*/
@Test void retrieveTargetsFromRolloutGroup() throws Exception {
@Test
void retrieveTargetsFromRolloutGroup() throws Exception {
// setup
final int amountTargets = 10;
testdataFactory.createTargets(amountTargets, "rollout", "rollout");
@@ -1322,7 +1359,8 @@ class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTest {
/**
* Testing that the targets of rollout group can be retrieved with rsql query param
*/
@Test void retrieveTargetsFromRolloutGroupWithQuery() throws Exception {
@Test
void retrieveTargetsFromRolloutGroupWithQuery() throws Exception {
// setup
final int amountTargets = 10;
testdataFactory.createTargets(amountTargets, "rollout", "rollout");
@@ -1351,7 +1389,8 @@ class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTest {
/**
* Testing that the targets of rollout group can be retrieved after the rollout has been started
*/
@Test void retrieveTargetsFromRolloutGroupAfterRolloutIsStarted() throws Exception {
@Test
void retrieveTargetsFromRolloutGroupAfterRolloutIsStarted() throws Exception {
// setup
final int amountTargets = 10;
testdataFactory.createTargets(amountTargets, "rollout", "rollout");
@@ -1382,7 +1421,8 @@ class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTest {
/**
* Start the rollout in async mode
*/
@Test void startingRolloutSwitchesIntoRunningStateAsync() throws Exception {
@Test
void startingRolloutSwitchesIntoRunningStateAsync() throws Exception {
final int amountTargets = 50;
testdataFactory.createTargets(amountTargets, "rollout", "rollout");
@@ -1406,7 +1446,8 @@ class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTest {
/**
* Deletion of a rollout
*/
@Test void deleteRollout() throws Exception {
@Test
void deleteRollout() throws Exception {
final int amountTargets = 10;
testdataFactory.createTargets(amountTargets, "rolloutDelete", "rolloutDelete");
final DistributionSet dsA = testdataFactory.createDistributionSet("");
@@ -1424,7 +1465,8 @@ class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTest {
/**
* Soft deletion of a rollout: soft deletion appears when already running rollout is being deleted
*/
@Test void deleteRunningRollout() throws Exception {
@Test
void deleteRunningRollout() throws Exception {
final Rollout rollout = testdataFactory.createSoftDeletedRollout("softDeletedRollout");
mvc.perform(get("/rest/v1/rollouts/{rolloutid}", rollout.getId()))
@@ -1438,7 +1480,8 @@ class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTest {
/**
* Testing that rollout paged list with rsql parameter
*/
@Test void getRolloutWithRSQLParam() throws Exception {
@Test
void getRolloutWithRSQLParam() throws Exception {
final int amountTargetsRollout1 = 25;
final int amountTargetsRollout2 = 25;
@@ -1485,7 +1528,8 @@ class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTest {
/**
* Testing that rolloutgroup paged list with rsql parameter
*/
@Test void retrieveRolloutGroupsForSpecificRolloutWithRSQLParam() throws Exception {
@Test
void retrieveRolloutGroupsForSpecificRolloutWithRSQLParam() throws Exception {
// setup
final int amountTargets = 20;
testdataFactory.createTargets(amountTargets, "rollout", "rollout");
@@ -1529,7 +1573,8 @@ class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTest {
/**
* Testing that the list of rollout groups can be requested with representation mode 'full'.
*/
@Test void retrieveRolloutGroupsFullRepresentation() throws Exception {
@Test
void retrieveRolloutGroupsFullRepresentation() throws Exception {
testdataFactory.createTargets(20, "rollout", "rollout");
final DistributionSet dsA = testdataFactory.createDistributionSet("");
@@ -1568,7 +1613,8 @@ class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTest {
/**
* Verifies that a DOWNLOAD_ONLY rollout is possible
*/
@Test void createDownloadOnlyRollout() throws Exception {
@Test
void createDownloadOnlyRollout() throws Exception {
testdataFactory.createTargets(20, "target", "rollout");
final DistributionSet dsA = testdataFactory.createDistributionSet("");
@@ -1578,7 +1624,8 @@ class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTest {
/**
* A rollout create request containing a weight is always accepted when weight is valid.
*/
@Test void weightValidation() throws Exception {
@Test
void weightValidation() throws Exception {
testdataFactory.createTargets(4, "rollout", "description");
final Long dsId = testdataFactory.createDistributionSet().getId();
final int weight = 66;
@@ -1614,7 +1661,8 @@ class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTest {
/**
* Trigger next rollout group
*/
@Test void triggeringNextGroupRollout() throws Exception {
@Test
void triggeringNextGroupRollout() throws Exception {
// setup
final int amountTargets = 20;
testdataFactory.createTargets(amountTargets, "rollout", "rollout");
@@ -1637,7 +1685,8 @@ class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTest {
/**
* Trigger next rollout group if rollout is in wrong state
*/
@Test void triggeringNextGroupRolloutWrongState() throws Exception {
@Test
void triggeringNextGroupRolloutWrongState() throws Exception {
final int amountTargets = 3;
final List<Target> targets = testdataFactory.createTargets(amountTargets, "rollout");
final DistributionSet dsA = testdataFactory.createDistributionSet("");

View File

@@ -100,7 +100,8 @@ class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegrationTes
/**
* Trying to create a SM from already marked as deleted type - should get as response 400 Bad Request
*/
@Test public void createSMFromAlreadyMarkedAsDeletedType() throws Exception {
@Test
void createSMFromAlreadyMarkedAsDeletedType() throws Exception {
final String SM_TYPE = "someSmType";
final SoftwareModule sm = testdataFactory.createSoftwareModule(SM_TYPE);
testdataFactory.findOrCreateDistributionSetType(
@@ -138,7 +139,8 @@ class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegrationTes
/**
* Handles the GET request of retrieving all meta data of artifacts assigned to a software module (in full representation mode including a download URL by the artifact provider).
*/
@Test public void getArtifactsWithParameters() throws Exception {
@Test
void getArtifactsWithParameters() throws Exception {
final SoftwareModule sm = testdataFactory.createSoftwareModuleOs();
final byte[] random = randomBytes(5);
@@ -156,7 +158,8 @@ class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegrationTes
/**
* Get a paged list of meta data for a software module.
*/
@Test public void getMetadata() throws Exception {
@Test
void getMetadata() throws Exception {
final int totalMetadata = 4;
final String knownKeyPrefix = "knownKey";
final String knownValuePrefix = "knownValue";
@@ -177,7 +180,8 @@ class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegrationTes
/**
* Get a paged list of meta data for a software module with defined page size and sorting by name descending and key starting with 'known'.
*/
@Test public void getMetadataWithParameters() throws Exception {
@Test
void getMetadataWithParameters() throws Exception {
final int totalMetadata = 4;
final String knownKeyPrefix = "knownKey";
final String knownValuePrefix = "knownValue";
@@ -199,7 +203,8 @@ class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegrationTes
/**
* Get a single meta data value for a meta data key.
*/
@Test public void getMetadataValue() throws Exception {
@Test
void getMetadataValue() throws Exception {
// prepare and create metadata
final String knownKey = "knownKey";
@@ -217,7 +222,8 @@ class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegrationTes
/**
* Tests the update of software module metadata. It is verfied that only the selected fields for the update are really updated and the modification values are filled (i.e. updated by and at).
*/
@Test @WithUser(principal = "smUpdateTester", allSpPermissions = true)
@Test
@WithUser(principal = "smUpdateTester", allSpPermissions = true)
void updateSoftwareModuleOnlyDescriptionAndVendorNameUntouched() throws Exception {
final String knownSWName = "name1";
final String knownSWVersion = "version1";
@@ -272,7 +278,8 @@ class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegrationTes
/**
* Tests the update of the deletion flag. It is verified that the software module can't be marked as deleted through update operation.
*/
@Test @WithUser(principal = "smUpdateTester", allSpPermissions = true)
@Test
@WithUser(principal = "smUpdateTester", allSpPermissions = true)
void updateSoftwareModuleDeletedFlag() throws Exception {
final String knownSWName = "name1";
final String knownSWVersion = "version1";
@@ -309,7 +316,8 @@ class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegrationTes
/**
* Tests the lock. It is verified that the software module can be marked as locked through update operation.
*/
@Test @WithUser(principal = "smUpdateTester", allSpPermissions = true)
@Test
@WithUser(principal = "smUpdateTester", allSpPermissions = true)
void lockSoftwareModule() throws Exception {
final SoftwareModule sm = softwareModuleManagement.create(
entityFactory.softwareModule().create().type(osType).name("name1").version("version1"));
@@ -342,7 +350,8 @@ class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegrationTes
/**
* Tests the unlock.
*/
@Test @WithUser(principal = "smUpdateTester", allSpPermissions = true)
@Test
@WithUser(principal = "smUpdateTester", allSpPermissions = true)
void unlockSoftwareModule() throws Exception {
final SoftwareModule sm = softwareModuleManagement.create(
entityFactory.softwareModule().create().type(osType).name("name1").version("version1"));
@@ -378,7 +387,8 @@ class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegrationTes
/**
* Tests the upload of an artifact binary. The upload is executed and the content checked in the repository for completeness.
*/
@Test void uploadArtifact() throws Exception {
@Test
void uploadArtifact() throws Exception {
final SoftwareModule sm = testdataFactory.createSoftwareModuleOs();
// create test file
@@ -420,7 +430,8 @@ class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegrationTes
/**
* Verifies that artifacts which exceed the configured maximum size cannot be uploaded.
*/
@Test void uploadArtifactFailsIfTooLarge() throws Exception {
@Test
void uploadArtifactFailsIfTooLarge() throws Exception {
final SoftwareModule sm = testdataFactory.createSoftwareModule("quota", "quota", false);
final long maxSize = quotaManagement.getMaxArtifactSize();
@@ -441,7 +452,8 @@ class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegrationTes
/**
* Verifies that artifact with invalid filename cannot be uploaded to prevent cross site scripting.
*/
@Test void uploadArtifactFailsIfFilenameInvalide() throws Exception {
@Test
void uploadArtifactFailsIfFilenameInvalide() throws Exception {
final SoftwareModule sm = testdataFactory.createSoftwareModule("quota", "quota", false);
final String illegalFilename = "<img src=ernw onerror=alert(1)>.xml";
@@ -458,7 +470,8 @@ class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegrationTes
/**
* Verifies that the system does not accept empty artifact uploads. Expected response: BAD REQUEST
*/
@Test void emptyUploadArtifact() throws Exception {
@Test
void emptyUploadArtifact() throws Exception {
assertThat(softwareModuleManagement.findAll(PAGE)).isEmpty();
assertThat(artifactManagement.count()).isZero();
@@ -475,7 +488,8 @@ class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegrationTes
/**
* Verifies that the system does not accept identical artifacts uploads for the same software module. Expected response: CONFLICT
*/
@Test void duplicateUploadArtifact() throws Exception {
@Test
void duplicateUploadArtifact() throws Exception {
final SoftwareModule sm = testdataFactory.createSoftwareModuleOs();
final byte[] random = randomBytes(5 * 1024);
@@ -503,7 +517,8 @@ class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegrationTes
/**
* verifies that option to upload artifacts with a custom defined by metadata, i.e. not the file name of the binary itself.
*/
@Test void uploadArtifactWithCustomName() throws Exception {
@Test
void uploadArtifactWithCustomName() throws Exception {
final SoftwareModule sm = testdataFactory.createSoftwareModuleOs();
assertThat(artifactManagement.count()).isZero();
@@ -531,7 +546,8 @@ class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegrationTes
/**
* Verifies that the system refuses upload of an artifact where the provided hash sums do not match. Expected result: BAD REQUEST
*/
@Test void uploadArtifactWithHashCheck() throws Exception {
@Test
void uploadArtifactWithHashCheck() throws Exception {
final SoftwareModule sm = testdataFactory.createSoftwareModuleOs();
assertThat(artifactManagement.count()).isZero();
@@ -594,7 +610,8 @@ class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegrationTes
/**
* Verifies that only a limited number of artifacts can be uploaded for one software module.
*/
@Test void uploadArtifactsUntilQuotaExceeded() throws Exception {
@Test
void uploadArtifactsUntilQuotaExceeded() throws Exception {
final SoftwareModule sm = testdataFactory.createSoftwareModuleOs();
final long maxArtifacts = quotaManagement.getMaxArtifactsPerSoftwareModule();
@@ -637,7 +654,8 @@ class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegrationTes
/**
* Verifies that artifacts can only be added as long as the artifact storage quota is not exceeded.
*/
@Test void uploadArtifactsUntilStorageQuotaExceeded() throws Exception {
@Test
void uploadArtifactsUntilStorageQuotaExceeded() throws Exception {
final long storageLimit = quotaManagement.getMaxArtifactStorage();
@@ -686,7 +704,8 @@ class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegrationTes
/**
* Tests binary download of an artifact including verfication that the downloaded binary is consistent and that the etag header is as expected identical to the SHA1 hash of the file.
*/
@Test void downloadArtifact() throws Exception {
@Test
void downloadArtifact() throws Exception {
final SoftwareModule sm = testdataFactory.createSoftwareModuleOs();
final int artifactSize = 5 * 1024;
@@ -707,7 +726,8 @@ class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegrationTes
/**
* Verifies the listing of one defined artifact assigned to a given software module. That includes the artifact metadata and download links.
*/
@Test void getArtifact() throws Exception {
@Test
void getArtifact() throws Exception {
// prepare data for test
final SoftwareModule sm = testdataFactory.createSoftwareModuleOs();
@@ -777,7 +797,8 @@ class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegrationTes
/**
* Verifies the listing of an artifact that belongs to a soft deleted software module.
*/
@Test void getArtifactSoftDeleted() throws Exception {
@Test
void getArtifactSoftDeleted() throws Exception {
// prepare data for test
final SoftwareModule sm = testdataFactory.createSoftwareModuleOs("softDeleted");
final Artifact artifact = testdataFactory.createArtifacts(sm.getId()).get(0);
@@ -805,7 +826,8 @@ class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegrationTes
/**
* Verifies the listing of all artifacts assigned to a software module. That includes the artifact metadata.
*/
@Test void getArtifacts() throws Exception {
@Test
void getArtifacts() throws Exception {
final SoftwareModule sm = testdataFactory.createSoftwareModuleOs();
final int artifactSize = 5 * 1024;
@@ -891,7 +913,8 @@ class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegrationTes
/**
* Verifies that the system refuses unsupported request types and answers as defined to them, e.g. NOT FOUND on a non existing resource. Or a HTTP POST for updating a resource results in METHOD NOT ALLOWED etc.
*/
@Test void invalidRequestsOnArtifactResource() throws Exception {
@Test
void invalidRequestsOnArtifactResource() throws Exception {
final int artifactSize = 5 * 1024;
final byte[] random = randomBytes(artifactSize);
@@ -948,7 +971,8 @@ class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegrationTes
/**
* Tests the deletion of an artifact including verification that the artifact is actually erased in the repository and removed from the software module.
*/
@Test void deleteArtifact() throws Exception {
@Test
void deleteArtifact() throws Exception {
// Create 1 SM
final SoftwareModule sm = testdataFactory.createSoftwareModuleOs();
@@ -983,7 +1007,8 @@ class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegrationTes
/**
* Verifies that the system refuses unsupported request types and answers as defined to them, e.g. NOT FOUND on a non existing resource. Or a HTTP POST for updating a resource results in METHOD NOT ALLOWED etc.
*/
@Test void invalidRequestsOnSoftwareModulesResource() throws Exception {
@Test
void invalidRequestsOnSoftwareModulesResource() throws Exception {
final SoftwareModule sm = testdataFactory.createSoftwareModuleOs();
final List<SoftwareModule> modules = Collections.singletonList(sm);
@@ -1050,7 +1075,8 @@ class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegrationTes
/**
* Test of modules retrieval without any parameters. Will return all modules in the system as defined by standard page size.
*/
@Test void getSoftwareModulesWithoutAdditionalRequestParameters() throws Exception {
@Test
void getSoftwareModulesWithoutAdditionalRequestParameters() throws Exception {
final int modules = 5;
createSoftwareModulesAlphabetical(modules);
mvc.perform(get(MgmtRestConstants.SOFTWAREMODULE_V1_REQUEST_MAPPING))
@@ -1064,7 +1090,8 @@ class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegrationTes
/**
* Test of modules retrieval with paging limit parameter. Will return all modules in the system as defined by given page size.
*/
@Test void detSoftwareModulesWithPagingLimitRequestParameter() throws Exception {
@Test
void detSoftwareModulesWithPagingLimitRequestParameter() throws Exception {
final int modules = 5;
final int limitSize = 1;
createSoftwareModulesAlphabetical(modules);
@@ -1080,7 +1107,8 @@ class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegrationTes
/**
* Test of modules retrieval with paging limit offset parameters. Will return all modules in the system as defined by given page size starting from given offset.
*/
@Test void getSoftwareModulesWithPagingLimitAndOffsetRequestParameter() throws Exception {
@Test
void getSoftwareModulesWithPagingLimitAndOffsetRequestParameter() throws Exception {
final int modules = 5;
final int offsetParam = 2;
final int expectedSize = modules - offsetParam;
@@ -1135,7 +1163,8 @@ class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegrationTes
/**
* Test the various filter parameters, e.g. filter by name or type of the module.
*/
@Test void getSoftwareModulesWithFilterParameters() throws Exception {
@Test
void getSoftwareModulesWithFilterParameters() throws Exception {
final SoftwareModule os1 = testdataFactory.createSoftwareModuleOs("1");
final SoftwareModule app1 = testdataFactory.createSoftwareModuleApp("1");
testdataFactory.createSoftwareModuleOs("2");
@@ -1201,7 +1230,8 @@ class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegrationTes
/**
* Verifies that the system answers as defined in case of a wrong filter parameter syntax. Expected result: BAD REQUEST with error description.
*/
@Test void getSoftwareModulesWithSyntaxErrorFilterParameter() throws Exception {
@Test
void getSoftwareModulesWithSyntaxErrorFilterParameter() throws Exception {
mvc.perform(get("/rest/v1/softwaremodules?q=wrongFIQLSyntax").accept(MediaType.APPLICATION_JSON))
.andDo(MockMvcResultPrinter.print())
.andExpect(status().isBadRequest())
@@ -1211,7 +1241,8 @@ class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegrationTes
/**
* Verifies that the system answers as defined in case of a non existing field used in filter. Expected result: BAD REQUEST with error description.
*/
@Test void getSoftwareModulesWithUnknownFieldErrorFilterParameter() throws Exception {
@Test
void getSoftwareModulesWithUnknownFieldErrorFilterParameter() throws Exception {
mvc.perform(get("/rest/v1/softwaremodules?q=wrongField==abc").accept(MediaType.APPLICATION_JSON))
.andDo(MockMvcResultPrinter.print())
.andExpect(status().isBadRequest())
@@ -1326,7 +1357,8 @@ class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegrationTes
/**
* Verifies successfull deletion of software modules that are not in use, i.e. assigned to a DS.
*/
@Test void deleteUnassignedSoftwareModule() throws Exception {
@Test
void deleteUnassignedSoftwareModule() throws Exception {
final SoftwareModule sm = testdataFactory.createSoftwareModuleOs();
@@ -1351,7 +1383,8 @@ class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegrationTes
/**
* Verifies successfull deletion of a software module that is in use, i.e. assigned to a DS which should result in movinf the module to the archive.
*/
@Test void deleteAssignedSoftwareModule() throws Exception {
@Test
void deleteAssignedSoftwareModule() throws Exception {
final DistributionSet ds1 = testdataFactory.createDistributionSet("a");
final int artifactSize = 5 * 1024;
@@ -1386,7 +1419,8 @@ class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegrationTes
/**
* Verifies the successful creation of metadata and the enforcement of the meta data quota.
*/
@Test void createMetadata() throws Exception {
@Test
void createMetadata() throws Exception {
final String knownKey1 = "knownKey1";
final String knownValue1 = "knownValue1";
final String knownKey2 = "knownKey2";
@@ -1429,7 +1463,8 @@ class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegrationTes
/**
* Verifies the successful update of metadata based on given key.
*/
@Test void updateMetadataKey() throws Exception {
@Test
void updateMetadataKey() throws Exception {
// prepare and create metadata for update
final String knownKey = "knownKey";
final String knownValue = "knownValue";
@@ -1456,7 +1491,8 @@ class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegrationTes
/**
* Verifies the successful deletion of metadata entry.
*/
@Test void deleteMetadata() throws Exception {
@Test
void deleteMetadata() throws Exception {
// prepare and create metadata for deletion
final String knownKey = "knownKey";
final String knownValue = "knownValue";
@@ -1476,7 +1512,8 @@ class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegrationTes
/**
* Ensures that module metadata deletion request to API on an entity that does not exist results in NOT_FOUND.
*/
@Test void deleteModuleMetadataThatDoesNotExistLeadsToNotFound() throws Exception {
@Test
void deleteModuleMetadataThatDoesNotExistLeadsToNotFound() throws Exception {
// prepare and create metadata for deletion
final String knownKey = "knownKey";
final String knownValue = "knownValue";
@@ -1499,7 +1536,8 @@ class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegrationTes
/**
* Ensures that module deletion request to API on an entity that does not exist results in NOT_FOUND.
*/
@Test void deleteSoftwareModuleThatDoesNotExistLeadsToNotFound() throws Exception {
@Test
void deleteSoftwareModuleThatDoesNotExistLeadsToNotFound() throws Exception {
mvc.perform(delete("/rest/v1/softwaremodules/1234"))
.andDo(MockMvcResultPrinter.print())
.andExpect(status().isNotFound());

View File

@@ -274,7 +274,8 @@ public class MgmtSoftwareModuleTypeResourceTest extends AbstractManagementApiInt
/**
* Ensures that module type deletion request to API on an entity that does not exist results in NOT_FOUND.
*/
@Test public void deleteSoftwareModuleTypeThatDoesNotExistLeadsToNotFound() throws Exception {
@Test
void deleteSoftwareModuleTypeThatDoesNotExistLeadsToNotFound() throws Exception {
mvc.perform(delete("/rest/v1/softwaremoduletypes/1234"))
.andDo(MockMvcResultPrinter.print())
.andExpect(status().isNotFound());
@@ -312,7 +313,8 @@ public class MgmtSoftwareModuleTypeResourceTest extends AbstractManagementApiInt
/**
* Checks the correct behaviour of /rest/v1/softwaremoduletypes/{ID} PUT requests.
*/
@Test public void updateSoftwareModuleTypeColourDescriptionAndNameUntouched() throws Exception {
@Test
void updateSoftwareModuleTypeColourDescriptionAndNameUntouched() throws Exception {
final SoftwareModuleType testType = createTestType();
final String body = new JSONObject().put("id", testType.getId()).put("description", "foobardesc")
@@ -333,7 +335,8 @@ public class MgmtSoftwareModuleTypeResourceTest extends AbstractManagementApiInt
/**
* Tests the update of the deletion flag. It is verfied that the software module type can't be marked as deleted through update operation.
*/
@Test public void updateSoftwareModuleTypeDeletedFlag() throws Exception {
@Test
void updateSoftwareModuleTypeDeletedFlag() throws Exception {
SoftwareModuleType testType = createTestType();
final String body = new JSONObject().put("id", testType.getId()).put("deleted", true).toString();
@@ -354,7 +357,8 @@ public class MgmtSoftwareModuleTypeResourceTest extends AbstractManagementApiInt
/**
* Checks the correct behaviour of /rest/v1/softwaremoduletypes GET requests with paging.
*/
@Test public void getSoftwareModuleTypesWithoutAddtionalRequestParameters() throws Exception {
@Test
void getSoftwareModuleTypesWithoutAddtionalRequestParameters() throws Exception {
final int types = 3;
mvc.perform(get(MgmtRestConstants.SOFTWAREMODULETYPE_V1_REQUEST_MAPPING))
.andDo(MockMvcResultPrinter.print())
@@ -367,7 +371,8 @@ public class MgmtSoftwareModuleTypeResourceTest extends AbstractManagementApiInt
/**
* Checks the correct behaviour of /rest/v1/softwaremoduletypes GET requests with paging.
*/
@Test public void getSoftwareModuleTypesWithPagingLimitRequestParameter() throws Exception {
@Test
void getSoftwareModuleTypesWithPagingLimitRequestParameter() throws Exception {
final int types = 3;
final int limitSize = 1;
mvc.perform(get(MgmtRestConstants.SOFTWAREMODULETYPE_V1_REQUEST_MAPPING)
@@ -382,7 +387,8 @@ public class MgmtSoftwareModuleTypeResourceTest extends AbstractManagementApiInt
/**
* Checks the correct behaviour of /rest/v1/softwaremoduletypes GET requests with paging.
*/
@Test public void getSoftwareModuleTypesWithPagingLimitAndOffsetRequestParameter() throws Exception {
@Test
void getSoftwareModuleTypesWithPagingLimitAndOffsetRequestParameter() throws Exception {
final int types = 3;
final int offsetParam = 2;
final int expectedSize = types - offsetParam;
@@ -399,7 +405,8 @@ public class MgmtSoftwareModuleTypeResourceTest extends AbstractManagementApiInt
/**
* Ensures that the server is behaving as expected on invalid requests (wrong media type, wrong ID etc.).
*/
@Test public void invalidRequestsOnSoftwaremoduleTypesResource() throws Exception {
@Test
void invalidRequestsOnSoftwaremoduleTypesResource() throws Exception {
final SoftwareModuleType testType = createTestType();
final List<SoftwareModuleType> types = Collections.singletonList(testType);
@@ -460,7 +467,8 @@ public class MgmtSoftwareModuleTypeResourceTest extends AbstractManagementApiInt
/**
* Search erquest of software module types.
*/
@Test public void searchSoftwareModuleTypeRsql() throws Exception {
@Test
void searchSoftwareModuleTypeRsql() throws Exception {
softwareModuleTypeManagement.create(entityFactory.softwareModuleType().create().key("test123")
.name("TestName123").description("Desc123").maxAssignments(5));
softwareModuleTypeManagement.create(entityFactory.softwareModuleType().create().key("test1234")

View File

@@ -94,7 +94,8 @@ public class MgmtTargetFilterQueryResourceTest extends AbstractManagementApiInte
/**
* Handles the GET request of retrieving all target filter queries within SP.
*/
@Test public void getTargetFilterQueries() throws Exception {
@Test
void getTargetFilterQueries() throws Exception {
final String filterName = "filter_01";
createSingleTargetFilterQuery(filterName, "name==test_01");
mvc.perform(get(MgmtRestConstants.TARGET_FILTER_V1_REQUEST_MAPPING))
@@ -105,7 +106,8 @@ public class MgmtTargetFilterQueryResourceTest extends AbstractManagementApiInte
/**
* Handles the GET request of retrieving all target filter queries within SP based by parameter. Required Permission: READ_TARGET.
*/
@Test public void getTargetFilterQueriesWithParameters() throws Exception {
@Test
void getTargetFilterQueriesWithParameters() throws Exception {
mvc.perform(get(MgmtRestConstants.TARGET_FILTER_V1_REQUEST_MAPPING + "?limit=10&sort=name:ASC&offset=0&q=name==*1"))
.andExpect(status().isOk())
.andDo(MockMvcResultPrinter.print());
@@ -114,7 +116,8 @@ public class MgmtTargetFilterQueryResourceTest extends AbstractManagementApiInte
/**
* Handles the POST request of creating a new target filter query within SP.
*/
@Test public void createTargetFilterQuery() throws Exception {
@Test
void createTargetFilterQuery() throws Exception {
final String name = "test_02";
final String filterQuery = "name==test_02";
final String body = new JSONObject()
@@ -130,7 +133,8 @@ public class MgmtTargetFilterQueryResourceTest extends AbstractManagementApiInte
/**
* Ensures that deletion is executed if permitted.
*/
@Test public void deleteTargetFilterQueryReturnsOK() throws Exception {
@Test
void deleteTargetFilterQueryReturnsOK() throws Exception {
final String filterName = "filter_01";
final TargetFilterQuery filterQuery = createSingleTargetFilterQuery(filterName, "name==test_01");
@@ -143,7 +147,8 @@ public class MgmtTargetFilterQueryResourceTest extends AbstractManagementApiInte
/**
* Ensures that deletion is refused with not found if target does not exist.
*/
@Test public void deleteTargetWhichDoesNotExistsLeadsToEntityNotFound() throws Exception {
@Test
void deleteTargetWhichDoesNotExistsLeadsToEntityNotFound() throws Exception {
final String notExistingId = "4395";
mvc.perform(delete(MgmtRestConstants.TARGET_FILTER_V1_REQUEST_MAPPING + "/" + notExistingId))
@@ -153,7 +158,8 @@ public class MgmtTargetFilterQueryResourceTest extends AbstractManagementApiInte
/**
* Ensures that update is refused with not found if target does not exist.
*/
@Test public void updateTargetWhichDoesNotExistsLeadsToEntityNotFound() throws Exception {
@Test
void updateTargetWhichDoesNotExistsLeadsToEntityNotFound() throws Exception {
final String notExistingId = "4395";
mvc.perform(put(MgmtRestConstants.TARGET_FILTER_V1_REQUEST_MAPPING + "/" + notExistingId).content("{}")
.contentType(MediaType.APPLICATION_JSON))
@@ -164,7 +170,8 @@ public class MgmtTargetFilterQueryResourceTest extends AbstractManagementApiInte
/**
* Ensures that update request is reflected by repository.
*/
@Test public void updateTargetFilterQueryQuery() throws Exception {
@Test
void updateTargetFilterQueryQuery() throws Exception {
final String filterName = "filter_02";
final String filterQuery = "name==test_02";
final String filterQuery2 = "name==test_02_changed";
@@ -190,7 +197,8 @@ public class MgmtTargetFilterQueryResourceTest extends AbstractManagementApiInte
/**
* Ensures that update request is reflected by repository.
*/
@Test public void updateTargetFilterQueryName() throws Exception {
@Test
void updateTargetFilterQueryName() throws Exception {
final String filterName = "filter_03";
final String filterName2 = "filter_03_changed";
final String filterQuery = "name==test_03";
@@ -217,7 +225,8 @@ public class MgmtTargetFilterQueryResourceTest extends AbstractManagementApiInte
/**
* Ensures that request returns list of filters in defined format.
*/
@Test public void getTargetFilterQueryWithoutAdditionalRequestParameters() throws Exception {
@Test
void getTargetFilterQueryWithoutAdditionalRequestParameters() throws Exception {
final int knownTargetAmount = 3;
final String idA = "a";
final String idB = "b";
@@ -248,7 +257,8 @@ public class MgmtTargetFilterQueryResourceTest extends AbstractManagementApiInte
/**
* Ensures that request returns list of filters in defined format in size reduced by given limit parameter.
*/
@Test public void getTargetWithPagingLimitRequestParameter() throws Exception {
@Test
void getTargetWithPagingLimitRequestParameter() throws Exception {
final int limitSize = 1;
final int knownTargetAmount = 3;
final String idA = "a";
@@ -317,7 +327,8 @@ public class MgmtTargetFilterQueryResourceTest extends AbstractManagementApiInte
/**
* Ensures that request returns list of filters in defined format in size reduced by given limit and offset parameter.
*/
@Test public void getTargetWithPagingLimitAndOffsetRequestParameter() throws Exception {
@Test
void getTargetWithPagingLimitAndOffsetRequestParameter() throws Exception {
final int knownTargetAmount = 5;
final int offsetParam = 2;
final int expectedSize = knownTargetAmount - offsetParam;
@@ -354,7 +365,8 @@ public class MgmtTargetFilterQueryResourceTest extends AbstractManagementApiInte
/**
* Ensures that a single target filter query can be retrieved via its id.
*/
@Test public void getSingleTarget() throws Exception {
@Test
void getSingleTarget() throws Exception {
// create first a target which can be retrieved by rest interface
final String knownQuery = "name==test01";
final String knownName = "someName";
@@ -375,7 +387,8 @@ public class MgmtTargetFilterQueryResourceTest extends AbstractManagementApiInte
/**
* Ensures that the retrieval of a non-existing target filter query results in a HTTP Not found error (404).
*/
@Test public void getSingleTargetNoExistsResponseNotFound() throws Exception {
@Test
void getSingleTargetNoExistsResponseNotFound() throws Exception {
final String targetIdNotExists = "546546";
// test
@@ -393,7 +406,8 @@ public class MgmtTargetFilterQueryResourceTest extends AbstractManagementApiInte
/**
* Ensures that the creation of a target filter query based on an invalid request payload results in a HTTP Bad Request error (400).
*/
@Test public void createTargetFilterQueryWithBadPayloadBadRequest() throws Exception {
@Test
void createTargetFilterQueryWithBadPayloadBadRequest() throws Exception {
final String notJson = "abc";
final MvcResult mvcResult = mvc
@@ -415,7 +429,8 @@ public class MgmtTargetFilterQueryResourceTest extends AbstractManagementApiInte
/**
* Ensures that the creation of a target filter query based on an invalid RSQL query results in a HTTP Bad Request error (400).
*/
@Test public void createTargetFilterWithInvalidQuery() throws Exception {
@Test
void createTargetFilterWithInvalidQuery() throws Exception {
final String invalidQuery = "name=abc";
final String body = new JSONObject().put("query", invalidQuery).put("name", "invalidFilter").toString();
@@ -524,7 +539,8 @@ public class MgmtTargetFilterQueryResourceTest extends AbstractManagementApiInte
/**
* Handles the GET request of retrieving a the auto assign distribution set of a target filter query within SP.
*/
@Test public void getAssignDS() throws Exception {
@Test
void getAssignDS() throws Exception {
final TargetFilterQuery filterQuery = createSingleTargetFilterQuery("filter_01", "name==test_01");
final DistributionSet ds = testdataFactory.createDistributionSet("ds");
targetFilterQueryManagement
@@ -540,7 +556,8 @@ public class MgmtTargetFilterQueryResourceTest extends AbstractManagementApiInte
/**
* Handles the POST request of setting a distribution set for auto assignment within SP.
*/
@Test public void createAutoAssignDS() throws Exception {
@Test
void createAutoAssignDS() throws Exception {
enableMultiAssignments();
enableConfirmationFlow();
@@ -560,7 +577,8 @@ public class MgmtTargetFilterQueryResourceTest extends AbstractManagementApiInte
/**
* Handles the DELETE request of deleting the auto assign distribution set from a target filter query within SP.
*/
@Test public void deleteAutoAssignDS() throws Exception {
@Test
void deleteAutoAssignDS() throws Exception {
final String filterName = "filter_01";
final TargetFilterQuery filterQuery = createSingleTargetFilterQuery(filterName, "name==test_01");
mvc
@@ -574,7 +592,8 @@ public class MgmtTargetFilterQueryResourceTest extends AbstractManagementApiInte
/**
* Ensures that the deletion of auto-assignment distribution set works as intended, deleting the auto-assignment action type as well
*/
@Test public void deleteAutoAssignDistributionSetOfTargetFilterQuery() throws Exception {
@Test
void deleteAutoAssignDistributionSetOfTargetFilterQuery() throws Exception {
final String knownQuery = "name==test06";
final String knownName = "filter06";
final String dsName = "testDS";
@@ -610,7 +629,8 @@ public class MgmtTargetFilterQueryResourceTest extends AbstractManagementApiInte
/**
* An auto assignment containing a weight is only accepted when weight is valide and multi assignment is on.
*/
@Test public void weightValidation() throws Exception {
@Test
void weightValidation() throws Exception {
final Long filterId = createSingleTargetFilterQuery("filter1", "name==*").getId();
final Long dsId = testdataFactory.createDistributionSet().getId();

View File

@@ -148,7 +148,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
/**
* Ensures that when targetType value of -1 is provided the target type is unassigned from the target.
*/
@Test void updateTargetAndUnassignTargetType() throws Exception {
@Test
void updateTargetAndUnassignTargetType() throws Exception {
final String knownControllerId = "123";
final String knownNewAddress = "amqp://test123/foobar";
final String knownNameNotModify = "controllerName";
@@ -186,7 +187,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
/**
* Ensures that when targetType value of -1 is provided the target type is unassigned from the target when updating multiple fields in target object.
*/
@Test void updateTargetNameAndUnassignTargetType() throws Exception {
@Test
void updateTargetNameAndUnassignTargetType() throws Exception {
final String knownControllerId = "123";
final String knownNewAddress = "amqp://test123/foobar";
final String knownNameNotModify = "controllerName";
@@ -227,7 +229,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
/**
* Handles the GET request of retrieving all targets within SP..
*/
@Test void getTargets() throws Exception {
@Test
void getTargets() throws Exception {
enableConfirmationFlow();
mvc.perform(get(MgmtRestConstants.TARGET_V1_REQUEST_MAPPING))
.andExpect(status().isOk())
@@ -237,7 +240,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
/**
* Handles the GET request of retrieving all targets within SP based by parameter.
*/
@Test void getTargetsWithParameters() throws Exception {
@Test
void getTargetsWithParameters() throws Exception {
mvc.perform(get(MgmtRestConstants.TARGET_V1_REQUEST_MAPPING + "?limit=10&sort=name:ASC&offset=0&q=name==a"))
.andExpect(status().isOk())
.andDo(MockMvcResultPrinter.print());
@@ -246,7 +250,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
/**
* Handles the POST request to activate auto-confirm on a target. Payload can be provided to specify more details about the operation.
*/
@Test void postActivateAutoConfirm() throws Exception {
@Test
void postActivateAutoConfirm() throws Exception {
final Target testTarget = testdataFactory.createTarget("targetId");
final MgmtTargetAutoConfirmUpdate body = new MgmtTargetAutoConfirmUpdate("custom_initiator_value",
@@ -262,7 +267,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
/**
* Handles the POST request to deactivate auto-confirm on a target.
*/
@Test void postDeactivateAutoConfirm() throws Exception {
@Test
void postDeactivateAutoConfirm() throws Exception {
final Target testTarget = testdataFactory.createTarget("targetId");
confirmationManagement.activateAutoConfirmation(testTarget.getControllerId(), null, null);
@@ -275,7 +281,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
/**
* Test confirmation of single Action with confirm status. Check that Action goes into Running status with appropriate messages and status code
*/
@Test void updateActionConfirmationWithConfirm() throws Exception {
@Test
void updateActionConfirmationWithConfirm() throws Exception {
final int expectedStatusCode = 210;
final String expectedStatusMessage1 = "some-custom-message1";
final String expectedStatusMessage2 = "some-custom-message2";
@@ -287,7 +294,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
/**
* Test confirmation of single Action with deny status. Check that Action stays in WAIT_FOR_CONFIRMATION status with appropriate messages and status code
*/
@Test void updateActionConfirmationWithDeny() throws Exception {
@Test
void updateActionConfirmationWithDeny() throws Exception {
final int expectedStatusCode = 410;
final String expectedStatusMessage1 = "some-error-custom-message1";
final String expectedStatusMessage2 = "some-error-custom-message2";
@@ -299,7 +307,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
/**
* Test confirmation of single Action with wrong ControllerId - e.g. the given Action is not assigned to the given Target - confirmation call must fail.
*/
@Test void updateActionConfirmationFailsIfActionNotAssignedToTarget() throws Exception {
@Test
void updateActionConfirmationFailsIfActionNotAssignedToTarget() throws Exception {
final int payloadCallCode = 200;
final String payloadCallMessage1 = "random1";
final String payloadCallMessage2 = "random2";
@@ -373,7 +382,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
/**
* Ensures that actions list is in expected order.
*/
@Test void getActionStatusReturnsCorrectType() throws Exception {
@Test
void getActionStatusReturnsCorrectType() throws Exception {
final int limitSize = 2;
final String knownTargetId = "targetId";
final List<Action> actions = generateTargetWithTwoUpdatesWithOneOverride(knownTargetId);
@@ -405,7 +415,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
/**
* Ensures that security token is not returned if user does not have READ_TARGET_SEC_TOKEN permission.
*/
@Test @WithUser(allSpPermissions = false, authorities = { SpPermission.READ_TARGET, SpPermission.CREATE_TARGET })
@Test
@WithUser(allSpPermissions = false, authorities = { SpPermission.READ_TARGET, SpPermission.CREATE_TARGET })
void securityTokenIsNotInResponseIfMissingPermission() throws Exception {
final String knownControllerId = "knownControllerId";
@@ -419,7 +430,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
/**
* Ensures that security token is returned if user does have READ_TARGET_SEC_TOKEN permission.
*/
@Test @WithUser(allSpPermissions = false, authorities = { SpPermission.READ_TARGET, SpPermission.CREATE_TARGET,
@Test
@WithUser(allSpPermissions = false, authorities = { SpPermission.READ_TARGET, SpPermission.CREATE_TARGET,
SpPermission.READ_TARGET_SEC_TOKEN })
void securityTokenIsInResponseWithCorrectPermission() throws Exception {
@@ -434,7 +446,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
/**
* Ensures that that IP address is in result as stored in the repository.
*/
@Test void addressAndIpAddressInTargetResult() throws Exception {
@Test
void addressAndIpAddressInTargetResult() throws Exception {
// prepare targets with IP
final String knownControllerId1 = "0815";
final String knownControllerId2 = "4711";
@@ -461,7 +474,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
/**
* Ensures that actions history is returned as defined by filter status==pending,status==finished.
*/
@Test void searchActionsRsql() throws Exception {
@Test
void searchActionsRsql() throws Exception {
// prepare test
final DistributionSet dsA = testdataFactory.createDistributionSet("");
@@ -503,7 +517,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
/**
* Ensures that a deletion of an active action results in cancellation triggered.
*/
@Test void cancelActionOK() throws Exception {
@Test
void cancelActionOK() throws Exception {
// prepare test
final Target tA = createTargetAndStartAction();
@@ -531,7 +546,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
/**
* Ensures that method not allowed is returned if cancellation is triggered on already canceled action.
*/
@Test void cancelAndCancelActionIsNotAllowed() throws Exception {
@Test
void cancelAndCancelActionIsNotAllowed() throws Exception {
// prepare test
final Target tA = createTargetAndStartAction();
@@ -554,7 +570,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
/**
* Force Quit an Action, which is already canceled. Expected Result is an HTTP response code 204.
*/
@Test void forceQuitAnCanceledActionReturnsOk() throws Exception {
@Test
void forceQuitAnCanceledActionReturnsOk() throws Exception {
final Target tA = createTargetAndStartAction();
@@ -578,7 +595,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
/**
* Force Quit an Action, which is not canceled. Expected Result is an HTTP response code 405.
*/
@Test void forceQuitAnNotCanceledActionReturnsMethodNotAllowed() throws Exception {
@Test
void forceQuitAnNotCanceledActionReturnsMethodNotAllowed() throws Exception {
final Target tA = createTargetAndStartAction();
@@ -594,7 +612,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
/**
* Ensures that deletion is executed if permitted.
*/
@Test void deleteTargetReturnsOK() throws Exception {
@Test
void deleteTargetReturnsOK() throws Exception {
final String knownControllerId = "knownControllerIdDelete";
testdataFactory.createTarget(knownControllerId);
@@ -607,7 +626,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
/**
* Ensures that deletion is refused with not found if target does not exist.
*/
@Test void deleteTargetWhichDoesNotExistsLeadsToNotFound() throws Exception {
@Test
void deleteTargetWhichDoesNotExistsLeadsToNotFound() throws Exception {
final String knownControllerId = "knownControllerIdDelete";
mvc.perform(delete(MgmtRestConstants.TARGET_V1_REQUEST_MAPPING + "/" + knownControllerId))
@@ -617,7 +637,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
/**
* Ensures that update is refused with not found if target does not exist.
*/
@Test void updateTargetWhichDoesNotExistsLeadsToNotFound() throws Exception {
@Test
void updateTargetWhichDoesNotExistsLeadsToNotFound() throws Exception {
final String knownControllerId = "knownControllerIdUpdate";
mvc.perform(put(MgmtRestConstants.TARGET_V1_REQUEST_MAPPING + "/" + knownControllerId).content("{}")
.contentType(MediaType.APPLICATION_JSON))
@@ -628,7 +649,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
/**
* Ensures that target update request is reflected by repository.
*/
@Test void updateTargetDescription() throws Exception {
@Test
void updateTargetDescription() throws Exception {
final String knownControllerId = "123";
final String knownNewDescription = "a new desc updated over rest";
final String knownNameNotModify = "nameNotModify";
@@ -654,7 +676,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
/**
* Ensures that target update request fails is updated value fails against a constraint.
*/
@Test void updateTargetDescriptionFailsIfInvalidLength() throws Exception {
@Test
void updateTargetDescriptionFailsIfInvalidLength() throws Exception {
final String knownControllerId = "123";
final String knownNewDescription = randomString(513);
final String knownNameNotModify = "nameNotModify";
@@ -676,7 +699,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
/**
* Ensures that target update request is reflected by repository.
*/
@Test void updateTargetSecurityToken() throws Exception {
@Test
void updateTargetSecurityToken() throws Exception {
final String knownControllerId = "123";
final String knownNewToken = "6567576565";
final String knownNameNotModify = "nameNotModify";
@@ -702,7 +726,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
/**
* Ensures that target update request is reflected by repository.
*/
@Test void updateTargetAddress() throws Exception {
@Test
void updateTargetAddress() throws Exception {
final String knownControllerId = "123";
final String knownNewAddress = "amqp://test123/foobar";
final String knownNameNotModify = "nameNotModify";
@@ -728,7 +753,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
/**
* Ensures that target query returns list of targets in defined format.
*/
@Test void getTargetWithoutAdditionalRequestParameters() throws Exception {
@Test
void getTargetWithoutAdditionalRequestParameters() throws Exception {
final int knownTargetAmount = 3;
final String idA = "a";
final String idB = "b";
@@ -773,7 +799,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
/**
* Ensures that target query returns list of targets in defined format in size reduced by given limit parameter.
*/
@Test void getTargetWithPagingLimitRequestParameter() throws Exception {
@Test
void getTargetWithPagingLimitRequestParameter() throws Exception {
final int knownTargetAmount = 3;
final int limitSize = 1;
createTargetsAlphabetical(knownTargetAmount);
@@ -800,7 +827,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
/**
* Ensures that target query returns list of targets in defined format in size reduced by given limit and offset parameter.
*/
@Test void getTargetWithPagingLimitAndOffsetRequestParameter() throws Exception {
@Test
void getTargetWithPagingLimitAndOffsetRequestParameter() throws Exception {
final int knownTargetAmount = 5;
final int offsetParam = 2;
final int expectedSize = knownTargetAmount - offsetParam;
@@ -847,7 +875,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
/**
* Ensures that the get request for a target works.
*/
@Test void getSingleTarget() throws Exception {
@Test
void getSingleTarget() throws Exception {
// create first a target which can be retrieved by rest interface
final String knownControllerId = "1";
final String knownName = "someName";
@@ -873,7 +902,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
/**
* Ensures that target get request returns a not found if the target does not exits.
*/
@Test void getSingleTargetNoExistsResponseNotFound() throws Exception {
@Test
void getSingleTargetNoExistsResponseNotFound() throws Exception {
final String targetIdNotExists = "bubu";
@@ -892,7 +922,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
/**
* Ensures that get request for asigned distribution sets returns no count if no distribution set has been assigned.
*/
@Test void getAssignedDistributionSetOfTargetIsEmpty() throws Exception {
@Test
void getAssignedDistributionSetOfTargetIsEmpty() throws Exception {
// create first a target which can be retrieved by rest interface
final String knownControllerId = "1";
final String knownName = "someName";
@@ -908,7 +939,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
/**
* Ensures that the get request for asigned distribution sets works.
*/
@Test void getAssignedDistributionSetOfTarget() throws Exception {
@Test
void getAssignedDistributionSetOfTarget() throws Exception {
// create first a target which can be retrieved by rest interface
final String knownControllerId = "1";
final String knownName = "someName";
@@ -967,7 +999,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
/**
* Ensures that get request for installed distribution sets returns no count if no distribution set has been installed.
*/
@Test void getInstalledDistributionSetOfTargetIsEmpty() throws Exception {
@Test
void getInstalledDistributionSetOfTargetIsEmpty() throws Exception {
// create first a target which can be retrieved by rest interface
final String knownControllerId = "1";
final String knownName = "someName";
@@ -981,7 +1014,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
/**
* Ensures that a target creation with empty name and a controllerId that exceeds the name length limitation is successful and the name gets truncated.
*/
@Test void createTargetWithEmptyNameAndLongControllerId() throws Exception {
@Test
void createTargetWithEmptyNameAndLongControllerId() throws Exception {
final String randomString = randomString(JpaTarget.CONTROLLER_ID_MAX_SIZE);
final Target target = entityFactory.target().create().controllerId(randomString).build();
@@ -1003,7 +1037,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
/**
* Ensures that post request for creating a target with no payload returns a bad request.
*/
@Test void createTargetWithoutPayloadBadRequest() throws Exception {
@Test
void createTargetWithoutPayloadBadRequest() throws Exception {
final MvcResult mvcResult = mvc
.perform(post(MgmtRestConstants.TARGET_V1_REQUEST_MAPPING).contentType(MediaType.APPLICATION_JSON))
@@ -1023,7 +1058,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
/**
* Ensures that post request for creating a target with invalid payload returns a bad request.
*/
@Test void createTargetWithBadPayloadBadRequest() throws Exception {
@Test
void createTargetWithBadPayloadBadRequest() throws Exception {
final String notJson = "abc";
final MvcResult mvcResult = mvc
@@ -1045,7 +1081,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
/**
* Verifies that a mandatory properties of new targets are validated as not null.
*/
@Test void createTargetWithMissingMandatoryPropertyBadRequest() throws Exception {
@Test
void createTargetWithMissingMandatoryPropertyBadRequest() throws Exception {
final MvcResult mvcResult = mvc
.perform(post(MgmtRestConstants.TARGET_V1_REQUEST_MAPPING).content("[{\"name\":\"id1\"}]")
.contentType(MediaType.APPLICATION_JSON))
@@ -1065,7 +1102,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
/**
* Verifies that a properties of new targets are validated as in allowed size range.
*/
@Test void createTargetWithInvalidPropertyBadRequest() throws Exception {
@Test
void createTargetWithInvalidPropertyBadRequest() throws Exception {
final Target test1 = entityFactory.target().create().controllerId("id1")
.name(randomString(NamedEntity.NAME_MAX_SIZE + 1)).build();
@@ -1089,7 +1127,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
/**
* Ensures that a post request for creating multiple targets works.
*/
@Test void createTargetsListReturnsSuccessful() throws Exception {
@Test
void createTargetsListReturnsSuccessful() throws Exception {
final Target test1 = entityFactory.target().create().controllerId("id1").name("testname1")
.securityToken("token").address("amqp://test123/foobar").description("testid1").build();
final Target test2 = entityFactory.target().create().controllerId("id2").name("testname2")
@@ -1143,7 +1182,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
/**
* Ensures that a post request for creating one target within a list works.
*/
@Test void createTargetsSingleEntryListReturnsSuccessful() throws Exception {
@Test
void createTargetsSingleEntryListReturnsSuccessful() throws Exception {
final String knownName = "someName";
final String knownControllerId = "controllerId1";
final String knownDescription = "someDescription";
@@ -1165,7 +1205,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
/**
* Ensures that a post request for creating the same target again leads to a conflict response.
*/
@Test void createTargetsSingleEntryListDoubleReturnConflict() throws Exception {
@Test
void createTargetsSingleEntryListDoubleReturnConflict() throws Exception {
final String knownName = "someName";
final String knownControllerId = "controllerId1";
final String knownDescription = "someDescription";
@@ -1198,7 +1239,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
/**
* Ensures that the get request for action of a target returns no actions if nothing has happened.
*/
@Test void getActionWithEmptyResult() throws Exception {
@Test
void getActionWithEmptyResult() throws Exception {
final String knownTargetId = "targetId";
testdataFactory.createTarget(knownTargetId);
@@ -1214,7 +1256,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
/**
* Ensures that the expected response is returned for update action.
*/
@Test void getUpdateAction() throws Exception {
@Test
void getUpdateAction() throws Exception {
final String knownTargetId = "targetId";
final List<Action> actions = generateTargetWithTwoUpdatesWithOneOverride(knownTargetId);
@@ -1238,7 +1281,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
/**
* Ensures that the expected response is returned for update action with maintenance window.
*/
@Test void getUpdateActionWithMaintenanceWindow() throws Exception {
@Test
void getUpdateActionWithMaintenanceWindow() throws Exception {
final String knownTargetId = "targetId";
final String schedule = getTestSchedule(10);
final String duration = getTestDuration(10);
@@ -1270,7 +1314,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
/**
* Ensures that the expected response is returned when update action was cancelled.
*/
@Test void getCancelAction() throws Exception {
@Test
void getCancelAction() throws Exception {
final String knownTargetId = "targetId";
final List<Action> actions = generateTargetWithTwoUpdatesWithOneOverride(knownTargetId);
@@ -1294,7 +1339,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
/**
* Ensures that the expected response is returned when update action with maintenance window was cancelled.
*/
@Test void getCancelActionWithMaintenanceWindow() throws Exception {
@Test
void getCancelActionWithMaintenanceWindow() throws Exception {
final String knownTargetId = "targetId";
final String schedule = getTestSchedule(10);
final String duration = getTestDuration(10);
@@ -1326,21 +1372,24 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
/**
* Ensures that the expected response of getting actions of a target is returned.
*/
@Test void getActions() throws Exception {
@Test
void getActions() throws Exception {
getActions(false);
}
/**
* Ensures that the expected response of getting actions (with ext refs) of a target is returned.
*/
@Test void getActionsExtRef() throws Exception {
@Test
void getActionsExtRef() throws Exception {
getActions(true);
}
/**
* Ensures that the expected response of getting actions with maintenance window of a target is returned.
*/
@Test void getActionsWithMaintenanceWindow() throws Exception {
@Test
void getActionsWithMaintenanceWindow() throws Exception {
final String knownTargetId = "targetId";
final String schedule = getTestSchedule(10);
final String duration = getTestDuration(10);
@@ -1380,7 +1429,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
/**
* Verifies that the API returns the status list with expected content.
*/
@Test void getActionsStatus() throws Exception {
@Test
void getActionsStatus() throws Exception {
final String knownTargetId = "targetId";
final Action action = generateTargetWithTwoUpdatesWithOneOverride(knownTargetId).get(0);
// retrieve list in default descending order for actionstaus entries
@@ -1410,7 +1460,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
/**
* Verifies that the API returns the status list with expected content sorted by reportedAt field.
*/
@Test void getActionsStatusSortedByReportedAt() throws Exception {
@Test
void getActionsStatusSortedByReportedAt() throws Exception {
final String knownTargetId = "targetId";
final Action action = generateTargetWithTwoUpdatesWithOneOverride(knownTargetId).get(0);
final List<ActionStatus> actionStatus = deploymentManagement.findActionStatusByAction(action.getId(), PAGE)
@@ -1459,7 +1510,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
/**
* Verifies that the API returns the status list with expected content split into two pages.
*/
@Test void getActionsStatusWithPagingLimitRequestParameter() throws Exception {
@Test
void getActionsStatusWithPagingLimitRequestParameter() throws Exception {
final String knownTargetId = "targetId";
final Action action = generateTargetWithTwoUpdatesWithOneOverride(knownTargetId).get(0);
@@ -1502,7 +1554,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
/**
* Verifies getting multiple actions with the paging request parameter.
*/
@Test void getActionsWithPagingLimitRequestParameter() throws Exception {
@Test
void getActionsWithPagingLimitRequestParameter() throws Exception {
final String knownTargetId = "targetId";
final List<Action> actions = generateTargetWithTwoUpdatesWithOneOverride(knownTargetId);
@@ -1544,7 +1597,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
/**
* Verifies that an action is switched from soft to forced if requested by management API
*/
@Test void updateAction() throws Exception {
@Test
void updateAction() throws Exception {
final Target target = testdataFactory.createTarget();
final DistributionSet set = testdataFactory.createDistributionSet();
final Long actionId = getFirstAssignedActionId(
@@ -1652,7 +1706,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
/**
* Verifies that a DOWNLOAD_ONLY DS to target assignment is properly handled
*/
@Test void assignDownloadOnlyDistributionSetToTarget() throws Exception {
@Test
void assignDownloadOnlyDistributionSetToTarget() throws Exception {
final Target target = testdataFactory.createTarget();
final DistributionSet set = testdataFactory.createDistributionSet("one");
@@ -1736,7 +1791,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
/**
* Assigns distribution set to target with only maintenance schedule.
*/
@Test void assignDistributionSetToTargetWithMaintenanceWindowStartTimeOnly() throws Exception {
@Test
void assignDistributionSetToTargetWithMaintenanceWindowStartTimeOnly() throws Exception {
final Target target = testdataFactory.createTarget("fsdfsd");
final DistributionSet set = testdataFactory.createDistributionSet("one");
@@ -1753,7 +1809,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
/**
* Assigns distribution set to target with only maintenance window duration.
*/
@Test void assignDistributionSetToTargetWithMaintenanceWindowEndTimeOnly() throws Exception {
@Test
void assignDistributionSetToTargetWithMaintenanceWindowEndTimeOnly() throws Exception {
final Target target = testdataFactory.createTarget("fsdfsd");
final DistributionSet set = testdataFactory.createDistributionSet("one");
@@ -1770,7 +1827,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
/**
* Assigns distribution set to target with valid maintenance window.
*/
@Test void assignDistributionSetToTargetWithValidMaintenanceWindow() throws Exception {
@Test
void assignDistributionSetToTargetWithValidMaintenanceWindow() throws Exception {
final Target target = testdataFactory.createTarget("fsdfsd");
final DistributionSet set = testdataFactory.createDistributionSet("one");
@@ -1789,7 +1847,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
/**
* Assigns distribution set to target with maintenance window next execution start (should be ignored, calculated automaticaly based on schedule, duration and timezone)
*/
@Test void assignDistributionSetToTargetWithMaintenanceWindowNextExecutionStart() throws Exception {
@Test
void assignDistributionSetToTargetWithMaintenanceWindowNextExecutionStart() throws Exception {
final Target target = testdataFactory.createTarget("fsdfsd");
final DistributionSet set = testdataFactory.createDistributionSet("one");
@@ -1815,7 +1874,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
/**
* Assigns distribution set to target with last maintenance window scheduled before current time.
*/
@Test void assignDistributionSetToTargetWithMaintenanceWindowEndTimeBeforeStartTime() throws Exception {
@Test
void assignDistributionSetToTargetWithMaintenanceWindowEndTimeBeforeStartTime() throws Exception {
final Target target = testdataFactory.createTarget("fsdfsd");
final DistributionSet set = testdataFactory.createDistributionSet("one");
@@ -1974,7 +2034,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
/**
* Request update of Controller Attributes.
*/
@Test void triggerControllerAttributesUpdate() throws Exception {
@Test
void triggerControllerAttributesUpdate() throws Exception {
// create target with attributes
final String knownTargetId = "targetIdNeedsUpdate";
final Map<String, String> knownControllerAttrs = new HashMap<>();
@@ -2038,7 +2099,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
/**
* Ensures that the metadata creation through API is reflected by the repository.
*/
@Test void createMetadata() throws Exception {
@Test
void createMetadata() throws Exception {
final String knownControllerId = "targetIdWithMetadata";
testdataFactory.createTarget(knownControllerId);
@@ -2082,7 +2144,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
/**
* Ensures that a metadata update through API is reflected by the repository.
*/
@Test void updateMetadata() throws Exception {
@Test
void updateMetadata() throws Exception {
final String knownControllerId = "targetIdWithMetadata";
final String updateValue = "valueForUpdate";
@@ -2103,7 +2166,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
/**
* Ensures that a metadata entry deletion through API is reflected by the repository.
*/
@Test void deleteMetadata() throws Exception {
@Test
void deleteMetadata() throws Exception {
final String knownControllerId = "targetIdWithMetadata";
setupTargetWithMetadata(knownControllerId, KNOWN_KEY, KNOWN_VALUE);
@@ -2123,7 +2187,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
/**
* Ensures that target metadata deletion request to API on an entity that does not exist results in NOT_FOUND.
*/
@Test void deleteMetadataThatDoesNotExistLeadsToNotFound() throws Exception {
@Test
void deleteMetadataThatDoesNotExistLeadsToNotFound() throws Exception {
final String knownControllerId = "targetIdWithMetadata";
setupTargetWithMetadata(knownControllerId, KNOWN_KEY, KNOWN_VALUE);
@@ -2142,7 +2207,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
/**
* Ensures that a metadata entry selection through API reflects the repository content.
*/
@Test void getMetadataKey() throws Exception {
@Test
void getMetadataKey() throws Exception {
final String knownControllerId = "targetIdWithMetadata";
setupTargetWithMetadata(knownControllerId, KNOWN_KEY, KNOWN_VALUE);
@@ -2157,7 +2223,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
/**
* Ensures that a metadata entry paged list selection through API reflectes the repository content.
*/
@Test void getMetadata() throws Exception {
@Test
void getMetadata() throws Exception {
final String knownControllerId = "targetIdWithMetadata";
final int totalMetadata = 10;
@@ -2194,7 +2261,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
/**
* A request for assigning multiple DS to a target results in a Bad Request when multiassignment in disabled.
*/
@Test void multiAssignmentRequestNotAllowedIfDisabled() throws Exception {
@Test
void multiAssignmentRequestNotAllowedIfDisabled() throws Exception {
final String targetId = testdataFactory.createTarget().getControllerId();
final List<Long> dsIds = testdataFactory.createDistributionSets(2).stream().map(DistributionSet::getId)
.toList();
@@ -2211,7 +2279,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
/**
* Passing an array in assignment request is allowed if multiassignment is disabled and array size in 1.
*/
@Test void multiAssignmentRequestAllowedIfDisabledButHasSizeOne() throws Exception {
@Test
void multiAssignmentRequestAllowedIfDisabledButHasSizeOne() throws Exception {
final String targetId = testdataFactory.createTarget().getControllerId();
final Long dsId = testdataFactory.createDistributionSet().getId();
@@ -2225,7 +2294,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
/**
* Identical assignments in a single request are removed when multiassignment in disabled.
*/
@Test void identicalAssignmentInRequestAreRemovedIfMultiassignmentsDisabled() throws Exception {
@Test
void identicalAssignmentInRequestAreRemovedIfMultiassignmentsDisabled() throws Exception {
final String targetId = testdataFactory.createTarget().getControllerId();
final Long dsId = testdataFactory.createDistributionSet().getId();
@@ -2242,7 +2312,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
/**
* Assign multiple DSs to a target in one request with multiassignments enabled.
*/
@Test void multiAssignment() throws Exception {
@Test
void multiAssignment() throws Exception {
final String targetId = testdataFactory.createTarget().getControllerId();
final List<Long> dsIds = testdataFactory.createDistributionSets(2).stream().map(DistributionSet::getId)
.toList();
@@ -2261,7 +2332,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
/**
* An assignment request containing a weight is only accepted when weight is valid and multi assignment is on.
*/
@Test void weightValidation() throws Exception {
@Test
void weightValidation() throws Exception {
final String targetId = testdataFactory.createTarget().getControllerId();
final Long dsId = testdataFactory.createDistributionSet().getId();
final int weight = 98;
@@ -2288,7 +2360,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
/**
* An assignment request containing a valid weight when multi assignment is off.
*/
@Test void weightWithSingleAssignment() throws Exception {
@Test
void weightWithSingleAssignment() throws Exception {
final String targetId = testdataFactory.createTarget().getControllerId();
final Long dsId = testdataFactory.createDistributionSet().getId();
@@ -2303,7 +2376,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
/**
* An assignment request containing a valid weight when multi assignment is on.
*/
@Test void weightWithMultiAssignment() throws Exception {
@Test
void weightWithMultiAssignment() throws Exception {
final String targetId = testdataFactory.createTarget().getControllerId();
final Long dsId = testdataFactory.createDistributionSet().getId();
final int weight = 98;
@@ -2324,7 +2398,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
/**
* Get weight of action
*/
@Test void getActionWeight() throws Exception {
@Test
void getActionWeight() throws Exception {
final String targetId = testdataFactory.createTarget().getControllerId();
final Long dsId = testdataFactory.createDistributionSet().getId();
final int customWeightHigh = 800;
@@ -2346,7 +2421,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
/**
* An action provides information of the rollout it was created for (if any).
*/
@Test void getActionWithRolloutInfo() throws Exception {
@Test
void getActionWithRolloutInfo() throws Exception {
// setup
final int amountTargets = 10;
@@ -2384,7 +2460,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
/**
* Ensures that a post request for creating targets with target type works.
*/
@Test void createTargetsWithTargetType() throws Exception {
@Test
void createTargetsWithTargetType() throws Exception {
final TargetType type1 = testdataFactory.createTargetType("typeWithDs",
Collections.singletonList(standardDsType));
final TargetType type2 = testdataFactory.createTargetType("typeWithOutDs",
@@ -2454,7 +2531,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
/**
* Ensures that a post request for creating target with target type works.
*/
@Test void createTargetWithExistingTargetType() throws Exception {
@Test
void createTargetWithExistingTargetType() throws Exception {
// create target type
final List<TargetType> targetTypes = testdataFactory.createTargetTypes("targettype", 1);
assertThat(targetTypes).hasSize(1);
@@ -2478,7 +2556,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
/**
* Ensures that a put request for updating targets with target type works.
*/
@Test void updateTargetTypeInTarget() throws Exception {
@Test
void updateTargetTypeInTarget() throws Exception {
// create target type
final List<TargetType> targetTypes = testdataFactory.createTargetTypes("targettype", 2);
assertThat(targetTypes).hasSize(2);
@@ -2502,7 +2581,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
/**
* Ensures that a post request for creating targets with unknown target type fails.
*/
@Test void addingNonExistingTargetTypeInTargetShouldFail() throws Exception {
@Test
void addingNonExistingTargetTypeInTargetShouldFail() throws Exception {
final long unknownTargetTypeId = 999;
final String errorMsg = String.format("TargetType with given identifier {%s} does not exist.",
unknownTargetTypeId);
@@ -2525,7 +2605,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
/**
* Ensures that a post request for assign target type to target works.
*/
@Test void assignTargetTypeToTarget() throws Exception {
@Test
void assignTargetTypeToTarget() throws Exception {
// create target type
final TargetType targetType = testdataFactory.findOrCreateTargetType("targettype");
assertThat(targetType).isNotNull();
@@ -2548,7 +2629,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
/**
* Ensures that a post request for assign a invalid target type to target fails.
*/
@Test void assignInvalidTargetTypeToTargetFails() throws Exception {
@Test
void assignInvalidTargetTypeToTargetFails() throws Exception {
// Invalid target type ID
final long invalidTargetTypeId = 999;
@@ -2582,7 +2664,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
/**
* Ensures that a delete request for unassign target type from target works.
*/
@Test void unassignTargetTypeFromTarget() throws Exception {
@Test
void unassignTargetTypeFromTarget() throws Exception {
// create target type
final List<TargetType> targetTypes = testdataFactory.createTargetTypes("targettype", 1);
assertThat(targetTypes).hasSize(1);
@@ -2745,7 +2828,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
/**
* Verifies that the status code that was reported in the last action status update is correctly exposed via the action.
*/
@Test void lastActionStatusCode() throws Exception {
@Test
void lastActionStatusCode() throws Exception {
// prepare test
final DistributionSet dsA = testdataFactory.createDistributionSet("");

View File

@@ -62,7 +62,8 @@ public class MgmtTargetTagResourceTest extends AbstractManagementApiIntegrationT
/**
* Verifies that a paged result list of target tags reflects the content on the repository side.
*/
@Test @ExpectEvents({ @Expect(type = TargetTagCreatedEvent.class, count = 2) })
@Test
@ExpectEvents({ @Expect(type = TargetTagCreatedEvent.class, count = 2) })
public void getTargetTags() throws Exception {
final List<TargetTag> tags = testdataFactory.createTargetTags(2, "");
final TargetTag assigned = tags.get(0);
@@ -85,7 +86,8 @@ public class MgmtTargetTagResourceTest extends AbstractManagementApiIntegrationT
/**
* Handles the GET request of retrieving all targets tags within SP based by parameter
*/
@Test public void getTargetTagsWithParameters() throws Exception {
@Test
void getTargetTagsWithParameters() throws Exception {
testdataFactory.createTargetTags(2, "");
mvc.perform(get(MgmtRestConstants.TARGET_TAG_V1_REQUEST_MAPPING + "?limit=10&sort=name:ASC&offset=0&q=name==targetTag"))
.andExpect(status().isOk())
@@ -95,7 +97,8 @@ public class MgmtTargetTagResourceTest extends AbstractManagementApiIntegrationT
/**
* Verifies that a page result when listing tags reflects on the content in the repository when filtered by 2 fields - one tag field and one target field
*/
@Test public void getTargetTagsFilteredByColor() throws Exception {
@Test
void getTargetTagsFilteredByColor() throws Exception {
final String controllerId1 = "controllerTestId1";
final String controllerId2 = "controllerTestId2";
testdataFactory.createTarget(controllerId1);
@@ -126,7 +129,8 @@ public class MgmtTargetTagResourceTest extends AbstractManagementApiIntegrationT
/**
* Verifies that a single result of a target tag reflects the content on the repository side.
*/
@Test @ExpectEvents({ @Expect(type = TargetTagCreatedEvent.class, count = 2) })
@Test
@ExpectEvents({ @Expect(type = TargetTagCreatedEvent.class, count = 2) })
public void getTargetTag() throws Exception {
final List<TargetTag> tags = testdataFactory.createTargetTags(2, "");
final TargetTag assigned = tags.get(0);
@@ -146,7 +150,8 @@ public class MgmtTargetTagResourceTest extends AbstractManagementApiIntegrationT
/**
* Verifies that created target tags are stored in the repository as send to the API.
*/
@Test @ExpectEvents({ @Expect(type = TargetTagCreatedEvent.class, count = 2) })
@Test
@ExpectEvents({ @Expect(type = TargetTagCreatedEvent.class, count = 2) })
public void createTargetTags() throws Exception {
final Tag tagOne = entityFactory.tag().create().colour("testcol1").description("its a test1").name("thetest1")
.build();
@@ -177,7 +182,8 @@ public class MgmtTargetTagResourceTest extends AbstractManagementApiIntegrationT
/**
* Verifies that an updated target tag is stored in the repository as send to the API.
*/
@Test @ExpectEvents({
@Test
@ExpectEvents({
@Expect(type = TargetTagCreatedEvent.class, count = 1),
@Expect(type = TargetTagUpdatedEvent.class, count = 1) })
public void updateTargetTag() throws Exception {
@@ -207,7 +213,8 @@ public class MgmtTargetTagResourceTest extends AbstractManagementApiIntegrationT
/**
* Verifies that the delete call is reflected by the repository.
*/
@Test @ExpectEvents({
@Test
@ExpectEvents({
@Expect(type = TargetTagCreatedEvent.class, count = 1),
@Expect(type = TargetTagDeletedEvent.class, count = 1) })
public void deleteTargetTag() throws Exception {
@@ -224,7 +231,8 @@ public class MgmtTargetTagResourceTest extends AbstractManagementApiIntegrationT
/**
* Ensures that assigned targets to tag in repository are listed with proper paging results.
*/
@Test @ExpectEvents({
@Test
@ExpectEvents({
@Expect(type = TargetTagCreatedEvent.class, count = 1),
@Expect(type = TargetCreatedEvent.class, count = 5),
@Expect(type = TargetUpdatedEvent.class, count = 5) })
@@ -245,7 +253,8 @@ public class MgmtTargetTagResourceTest extends AbstractManagementApiIntegrationT
/**
* Ensures that assigned DS to tag in repository are listed with proper paging results with paging limit parameter.
*/
@Test @ExpectEvents({
@Test
@ExpectEvents({
@Expect(type = TargetTagCreatedEvent.class, count = 1),
@Expect(type = TargetCreatedEvent.class, count = 5),
@Expect(type = TargetUpdatedEvent.class, count = 5) })
@@ -268,7 +277,8 @@ public class MgmtTargetTagResourceTest extends AbstractManagementApiIntegrationT
/**
* Ensures that assigned targets to tag in repository are listed with proper paging results with paging limit and offset parameter.
*/
@Test @ExpectEvents({
@Test
@ExpectEvents({
@Expect(type = TargetTagCreatedEvent.class, count = 1),
@Expect(type = TargetCreatedEvent.class, count = 5),
@Expect(type = TargetUpdatedEvent.class, count = 5) })
@@ -294,7 +304,8 @@ public class MgmtTargetTagResourceTest extends AbstractManagementApiIntegrationT
/**
* Verifies that tag assignments done through tag API command are correctly stored in the repository.
*/
@Test @ExpectEvents({
@Test
@ExpectEvents({
@Expect(type = TargetTagCreatedEvent.class, count = 1),
@Expect(type = TargetCreatedEvent.class, count = 1),
@Expect(type = TargetUpdatedEvent.class, count = 1) })
@@ -314,7 +325,8 @@ public class MgmtTargetTagResourceTest extends AbstractManagementApiIntegrationT
/**
* Verifies that tag assignments (multi targets) done through tag API command are correctly stored in the repository.
*/
@Test @ExpectEvents({
@Test
@ExpectEvents({
@Expect(type = TargetTagCreatedEvent.class, count = 1),
@Expect(type = TargetCreatedEvent.class, count = 2),
@Expect(type = TargetUpdatedEvent.class, count = 2) })
@@ -338,7 +350,8 @@ public class MgmtTargetTagResourceTest extends AbstractManagementApiIntegrationT
/**
* Verifies that tag assignments (multi targets) done through tag API command are correctly stored in the repository.
*/
@Test @ExpectEvents({
@Test
@ExpectEvents({
@Expect(type = TargetTagCreatedEvent.class, count = 1),
@Expect(type = TargetCreatedEvent.class, count = 2) })
public void assignTargetsNotFound() throws Exception {
@@ -378,7 +391,8 @@ public class MgmtTargetTagResourceTest extends AbstractManagementApiIntegrationT
/**
* Verifies that tag assignments (multi targets) done through tag API command are correctly stored in the repository.
*/
@Test @ExpectEvents({
@Test
@ExpectEvents({
@Expect(type = TargetTagCreatedEvent.class, count = 1),
@Expect(type = TargetCreatedEvent.class, count = 2),
@Expect(type = TargetUpdatedEvent.class, count = 2) })
@@ -421,7 +435,8 @@ public class MgmtTargetTagResourceTest extends AbstractManagementApiIntegrationT
/**
* Verifies that tag assignments (multi targets) done through tag API command are correctly stored in the repository.
*/
@Test @ExpectEvents({
@Test
@ExpectEvents({
@Expect(type = TargetTagCreatedEvent.class, count = 1),
@Expect(type = TargetCreatedEvent.class, count = 2),
@Expect(type = TargetUpdatedEvent.class, count = 2) })
@@ -455,7 +470,8 @@ public class MgmtTargetTagResourceTest extends AbstractManagementApiIntegrationT
/**
* Verifies that tag unassignments done through tag API command are correctly stored in the repository.
*/
@Test @ExpectEvents({
@Test
@ExpectEvents({
@Expect(type = TargetTagCreatedEvent.class, count = 1),
@Expect(type = TargetCreatedEvent.class, count = 2),
@Expect(type = TargetUpdatedEvent.class, count = 3) })
@@ -480,7 +496,8 @@ public class MgmtTargetTagResourceTest extends AbstractManagementApiIntegrationT
/**
* Verifies that tag unassignments (multi targets) done through tag API command are correctly stored in the repository.
*/
@Test @ExpectEvents({
@Test
@ExpectEvents({
@Expect(type = TargetTagCreatedEvent.class, count = 1),
@Expect(type = TargetCreatedEvent.class, count = 3),
@Expect(type = TargetUpdatedEvent.class, count = 5) })
@@ -507,7 +524,8 @@ public class MgmtTargetTagResourceTest extends AbstractManagementApiIntegrationT
/**
* Verifies that tag assignments (multi targets) done through tag API command are correctly stored in the repository.
*/
@Test @ExpectEvents({
@Test
@ExpectEvents({
@Expect(type = TargetTagCreatedEvent.class, count = 1),
@Expect(type = TargetCreatedEvent.class, count = 2),
@Expect(type = TargetUpdatedEvent.class, count = 2) })
@@ -551,7 +569,8 @@ public class MgmtTargetTagResourceTest extends AbstractManagementApiIntegrationT
/**
* Verifies that tag assignments (multi targets) done through tag API command are correctly stored in the repository.
*/
@Test @ExpectEvents({
@Test
@ExpectEvents({
@Expect(type = TargetTagCreatedEvent.class, count = 1),
@Expect(type = TargetCreatedEvent.class, count = 2),
@Expect(type = TargetUpdatedEvent.class, count = 4) })
@@ -595,7 +614,8 @@ public class MgmtTargetTagResourceTest extends AbstractManagementApiIntegrationT
/**
* Verifies that tag assignments (multi targets) done through tag API command are correctly stored in the repository.
*/
@Test @ExpectEvents({
@Test
@ExpectEvents({
@Expect(type = TargetTagCreatedEvent.class, count = 1),
@Expect(type = TargetCreatedEvent.class, count = 2),
@Expect(type = TargetUpdatedEvent.class, count = 4) })

View File

@@ -503,7 +503,8 @@ class MgmtTargetTypeResourceTest extends AbstractManagementApiIntegrationTest {
/**
* Ensures that the server is behaving as expected on invalid requests (wrong media type, wrong ID etc.).
*/
@Test void invalidRequestsOnTargetTypesResource() throws Exception {
@Test
void invalidRequestsOnTargetTypesResource() throws Exception {
String typeName = "TestTypeInvalidReq";
final TargetType testType = createTestTargetTypeInDB(typeName, Collections.singletonList(standardDsType));
@@ -604,7 +605,8 @@ class MgmtTargetTypeResourceTest extends AbstractManagementApiIntegrationTest {
/**
* Search request of target types.
*/
@Test void searchTargetTypeRsql() throws Exception {
@Test
void searchTargetTypeRsql() throws Exception {
targetTypeManagement.create(entityFactory.targetType().create().name("TestName123"));
targetTypeManagement.create(entityFactory.targetType().create().name("TestName1234"));

View File

@@ -51,7 +51,8 @@ public class MgmtTenantManagementResourceTest extends AbstractManagementApiInteg
/**
* Handles GET request for receiving all tenant specific configurations.
*/
@Test public void getTenantConfigurations() throws Exception {
@Test
void getTenantConfigurations() throws Exception {
mvc.perform(get(MgmtRestConstants.SYSTEM_V1_REQUEST_MAPPING + "/configs"))
.andDo(MockMvcResultPrinter.print())
.andExpect(status().isOk())
@@ -64,7 +65,8 @@ public class MgmtTenantManagementResourceTest extends AbstractManagementApiInteg
/**
* Handles GET request for receiving a tenant specific configuration.
*/
@Test public void getTenantConfiguration() throws Exception {
@Test
void getTenantConfiguration() throws Exception {
//Test TenantConfiguration property
mvc.perform(get(MgmtRestConstants.SYSTEM_V1_REQUEST_MAPPING + "/configs/{keyName}",
TenantConfigurationProperties.TenantConfigurationKey.AUTHENTICATION_MODE_GATEWAY_SECURITY_TOKEN_KEY))
@@ -75,7 +77,8 @@ public class MgmtTenantManagementResourceTest extends AbstractManagementApiInteg
/**
* Handles GET request for receiving (TenantMetadata - DefaultDsType) a tenant specific configuration.
*/
@Test public void getTenantMetadata() throws Exception {
@Test
void getTenantMetadata() throws Exception {
//Test TenantMetadata property
mvc.perform(get(MgmtRestConstants.SYSTEM_V1_REQUEST_MAPPING + "/configs/{keyName}",
DEFAULT_DISTRIBUTION_SET_TYPE_KEY))
@@ -87,7 +90,8 @@ public class MgmtTenantManagementResourceTest extends AbstractManagementApiInteg
/**
* Handles PUT request for settings values in tenant specific configuration.
*/
@Test public void putTenantConfiguration() throws Exception {
@Test
void putTenantConfiguration() throws Exception {
final MgmtSystemTenantConfigurationValueRequest bodyPut = new MgmtSystemTenantConfigurationValueRequest();
bodyPut.setValue("exampleToken");
final ObjectMapper mapper = new ObjectMapper();
@@ -103,7 +107,8 @@ public class MgmtTenantManagementResourceTest extends AbstractManagementApiInteg
/**
* Handles PUT request for settings values (TenantMetadata - DefaultDsType) in tenant specific configuration, which is TenantMetadata
*/
@Test public void putTenantMetadata() throws Exception {
@Test
void putTenantMetadata() throws Exception {
final MgmtSystemTenantConfigurationValueRequest bodyPut = new MgmtSystemTenantConfigurationValueRequest();
long updatedTestDefaultDsType = createTestDistributionSetType();
@@ -126,7 +131,8 @@ public class MgmtTenantManagementResourceTest extends AbstractManagementApiInteg
/**
* Update DefaultDistributionSetType Fails if given DistributionSetType ID does not exist.
*/
@Test public void putTenantMetadataFails() throws Exception {
@Test
void putTenantMetadataFails() throws Exception {
long oldDefaultDsType = getActualDefaultDsType();
//try an invalid input
String newDefaultDsType = new JSONObject().put("value", true).toString();
@@ -142,7 +148,8 @@ public class MgmtTenantManagementResourceTest extends AbstractManagementApiInteg
/**
* The 'multi.assignments.enabled' property must not be changed to false.
*/
@Test public void deactivateMultiAssignment() throws Exception {
@Test
void deactivateMultiAssignment() throws Exception {
final String bodyActivate = new JSONObject().put("value", true).toString();
final String bodyDeactivate = new JSONObject().put("value", false).toString();
@@ -160,7 +167,8 @@ public class MgmtTenantManagementResourceTest extends AbstractManagementApiInteg
/**
* The Batch configuration should not be applied, because of invalid TenantConfiguration props
*/
@Test public void changeBatchConfigurationShouldFailOnInvalidTenantConfiguration() throws Exception {
@Test
void changeBatchConfigurationShouldFailOnInvalidTenantConfiguration() throws Exception {
//in this scenario
// some TenantConfiguration are not valid,
// TenantMetadata - DefaultDSType ID is valid,
@@ -176,7 +184,8 @@ public class MgmtTenantManagementResourceTest extends AbstractManagementApiInteg
/**
* The Batch configuration should not be applied, because of invalid TenantMetadata (DefaultDistributionSetType)
*/
@Test public void changeBatchConfigurationShouldOnInvalidTenantMetadata() throws Exception {
@Test
void changeBatchConfigurationShouldOnInvalidTenantMetadata() throws Exception {
//in this scenario
// all TenantConfiguration have valid and new values - using old values, inverted
// TenantMetadata - DefaultDSType ID is invalid
@@ -208,7 +217,8 @@ public class MgmtTenantManagementResourceTest extends AbstractManagementApiInteg
/**
* The Batch configuration should be applied
*/
@Test public void changeBatchConfiguration() throws Exception {
@Test
void changeBatchConfiguration() throws Exception {
long updatedDistributionSetType = createTestDistributionSetType();
boolean updatedRolloutApprovalEnabled = true;
boolean updatedAuthGatewayTokenEnabled = true;
@@ -242,7 +252,8 @@ public class MgmtTenantManagementResourceTest extends AbstractManagementApiInteg
/**
* The 'repository.actions.autoclose.enabled' property must not be modified if Multi-Assignments is enabled.
*/
@Test public void autoCloseCannotBeModifiedIfMultiAssignmentIsEnabled() throws Exception {
@Test
void autoCloseCannotBeModifiedIfMultiAssignmentIsEnabled() throws Exception {
final String bodyActivate = new JSONObject().put("value", true).toString();
final String bodyDeactivate = new JSONObject().put("value", false).toString();
@@ -268,7 +279,8 @@ public class MgmtTenantManagementResourceTest extends AbstractManagementApiInteg
/**
* Handles DELETE request deleting a tenant specific configuration.
*/
@Test public void deleteTenantConfiguration() throws Exception {
@Test
void deleteTenantConfiguration() throws Exception {
mvc.perform(delete(MgmtRestConstants.SYSTEM_V1_REQUEST_MAPPING + "/configs/{keyName}",
TenantConfigurationProperties.TenantConfigurationKey.AUTHENTICATION_MODE_GATEWAY_SECURITY_TOKEN_KEY))
.andDo(MockMvcResultPrinter.print())
@@ -278,7 +290,8 @@ public class MgmtTenantManagementResourceTest extends AbstractManagementApiInteg
/**
* Tests DELETE request must Fail for TenantMetadata properties.
*/
@Test public void deleteTenantMetadataFail() throws Exception {
@Test
void deleteTenantMetadataFail() throws Exception {
mvc.perform(delete(MgmtRestConstants.SYSTEM_V1_REQUEST_MAPPING + "/configs/{keyName}",
DEFAULT_DISTRIBUTION_SET_TYPE_KEY))
.andDo(MockMvcResultPrinter.print())
@@ -288,7 +301,8 @@ public class MgmtTenantManagementResourceTest extends AbstractManagementApiInteg
/**
* Handles GET request for receiving all tenant specific configurations depending on read gateway token permissions.
*/
@Test void getTenantConfigurationReadGWToken() throws Exception {
@Test
void getTenantConfigurationReadGWToken() throws Exception {
SecurityContextSwitch.runAs(SecurityContextSwitch.withUser("tenant_admin", SpPermission.TENANT_CONFIGURATION), () -> {
tenantConfigurationManagement.addOrUpdateConfiguration(
TenantConfigurationProperties.TenantConfigurationKey.AUTHENTICATION_MODE_GATEWAY_SECURITY_TOKEN_KEY,

View File

@@ -38,7 +38,8 @@ class SortUtilityTest {
/**
* Ascending sorting based on name.
*/
@Test void parseSortParam1() {
@Test
void parseSortParam1() {
final List<Order> parse = SortUtility.parse(TargetFields.class, SORT_PARAM_1);
assertThat(parse).as("Count of parsing parameter").hasSize(1);
}
@@ -46,7 +47,8 @@ class SortUtilityTest {
/**
* Ascending sorting based on name and descending sorting based on description.
*/
@Test void parseSortParam2() {
@Test
void parseSortParam2() {
final List<Order> parse = SortUtility.parse(TargetFields.class, SORT_PARAM_2);
assertThat(parse).as("Count of parsing parameter").hasSize(2);
}
@@ -54,7 +56,8 @@ class SortUtilityTest {
/**
* Sorting with wrong syntax leads to SortParameterSyntaxErrorException.
*/
@Test void parseWrongSyntaxParam() {
@Test
void parseWrongSyntaxParam() {
assertThrows(SortParameterSyntaxErrorException.class,
() -> SortUtility.parse(TargetFields.class, SYNTAX_FAILURE_SORT_PARAM));
}
@@ -62,7 +65,8 @@ class SortUtilityTest {
/**
* Sorting based on name with case sensitive is possible.
*/
@Test @SuppressWarnings("squid:S2699") // assert no error
@Test
@SuppressWarnings("squid:S2699") // assert no error
void parsingIsNotCaseSensitive() {
SortUtility.parse(TargetFields.class, CASE_INSENSITIVE_DIRECTION_PARAM);
SortUtility.parse(TargetFields.class, CASE_INSENSITIVE_DIRECTION_PARAM_1);
@@ -71,7 +75,8 @@ class SortUtilityTest {
/**
* Sorting with unknown direction order leads to SortParameterUnsupportedDirectionException.
*/
@Test void parseWrongDirectionParam() {
@Test
void parseWrongDirectionParam() {
assertThrows(SortParameterUnsupportedDirectionException.class,
() -> SortUtility.parse(TargetFields.class, WRONG_DIRECTION_PARAM));
}
@@ -79,7 +84,8 @@ class SortUtilityTest {
/**
* Sorting with unknown field leads to SortParameterUnsupportedFieldException.
*/
@Test void parseWrongFieldParam() {
@Test
void parseWrongFieldParam() {
assertThrows(SortParameterUnsupportedFieldException.class,
() -> SortUtility.parse(TargetFields.class, WRONG_FIELD_PARAM));
}

View File

@@ -28,21 +28,24 @@ class AllowedHostNamesTest extends AbstractSecurityTest {
/**
* Tests whether a RequestRejectedException is thrown when not allowed host is used
*/
@Test void allowedHostNameWithNotAllowedHost() throws Exception {
@Test
void allowedHostNameWithNotAllowedHost() throws Exception {
mvc.perform(get("/").header(HttpHeaders.HOST, "www.google.com")).andExpect(status().isBadRequest());
}
/**
* Tests whether request is redirected when allowed host is used
*/
@Test void allowedHostNameWithAllowedHost() throws Exception {
@Test
void allowedHostNameWithAllowedHost() throws Exception {
mvc.perform(get("/").header(HttpHeaders.HOST, "localhost")).andExpect(status().is3xxRedirection());
}
/**
* Tests whether request without allowed host name and with ignored path end up with a client error
*/
@Test void notAllowedHostnameWithIgnoredPath() throws Exception {
@Test
void notAllowedHostnameWithIgnoredPath() throws Exception {
mvc.perform(get("/index.html").header(HttpHeaders.HOST, "www.google.com"))
.andExpect(status().is4xxClientError());
}

View File

@@ -46,7 +46,8 @@ class CorsTest extends AbstractSecurityTest {
/**
* Ensures that Cors is working.
*/
@Test @WithUser(authorities = SpRole.TENANT_ADMIN, autoCreateTenant = false)
@Test
@WithUser(authorities = SpRole.TENANT_ADMIN, autoCreateTenant = false)
void validateCorsRequest() throws Exception {
performOptionsRequestToRestWithOrigin(ALLOWED_ORIGIN_FIRST).andExpect(status().isOk())
.andExpect(header().string(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN, ALLOWED_ORIGIN_FIRST));

View File

@@ -30,7 +30,8 @@ class PreAuthorizeEnabledTest extends AbstractSecurityTest {
/**
* Tests whether request fail if a role is forbidden for the user
*/
@Test @WithUser(authorities = { SpPermission.READ_TARGET }, autoCreateTenant = false)
@Test
@WithUser(authorities = { SpPermission.READ_TARGET }, autoCreateTenant = false)
void failIfNoRole() throws Exception {
mvc.perform(get("/rest/v1/distributionsets")).andExpect(result ->
assertThat(result.getResponse().getStatus()).isEqualTo(HttpStatus.FORBIDDEN.value()));
@@ -39,7 +40,8 @@ class PreAuthorizeEnabledTest extends AbstractSecurityTest {
/**
* Tests whether request succeed if a role is granted for the user
*/
@Test @WithUser(authorities = { SpPermission.READ_REPOSITORY }, autoCreateTenant = false)
@Test
@WithUser(authorities = { SpPermission.READ_REPOSITORY }, autoCreateTenant = false)
void successIfHasRole() throws Exception {
mvc.perform(get("/rest/v1/distributionsets")).andExpect(result ->
assertThat(result.getResponse().getStatus()).isEqualTo(HttpStatus.OK.value()));
@@ -48,7 +50,8 @@ class PreAuthorizeEnabledTest extends AbstractSecurityTest {
/**
* Tests whether request succeed if a role is granted for the user
*/
@Test @WithUser(authorities = { SpRole.TENANT_ADMIN }, autoCreateTenant = false)
@Test
@WithUser(authorities = { SpRole.TENANT_ADMIN }, autoCreateTenant = false)
void successIfHasTenantAdminRole() throws Exception {
mvc.perform(get("/rest/v1/distributionsets")).andExpect(result ->
assertThat(result.getResponse().getStatus()).isEqualTo(HttpStatus.OK.value()));
@@ -57,7 +60,8 @@ class PreAuthorizeEnabledTest extends AbstractSecurityTest {
/**
* Tests whether read tenant config request fail if a tenant config (or read read) is not granted for the user
*/
@Test @WithUser(authorities = { SpPermission.READ_TARGET }, autoCreateTenant = false)
@Test
@WithUser(authorities = { SpPermission.READ_TARGET }, autoCreateTenant = false)
void onlyDSIfNoTenantConfig() throws Exception {
mvc.perform(get("/rest/v1/system/configs")).andExpect(result -> {
// returns default DS type because of READ_TARGET
@@ -70,7 +74,8 @@ class PreAuthorizeEnabledTest extends AbstractSecurityTest {
/**
* Tests whether read tenant config request succeed if a tenant config (not read explicitly) is granted for the user
*/
@Test @WithUser(authorities = { SpPermission.TENANT_CONFIGURATION }, autoCreateTenant = false)
@Test
@WithUser(authorities = { SpPermission.TENANT_CONFIGURATION }, autoCreateTenant = false)
void successIfHasTenantConfig() throws Exception {
mvc.perform(get("/rest/v1/system/configs")).andExpect(result ->
assertThat(result.getResponse().getStatus()).isEqualTo(HttpStatus.OK.value()));

View File

@@ -29,21 +29,24 @@ class AllowedHostNamesTest extends AbstractSecurityTest {
/**
* Tests whether a RequestRejectedException is thrown when not allowed host is used
*/
@Test void allowedHostNameWithNotAllowedHost() throws Exception {
@Test
void allowedHostNameWithNotAllowedHost() throws Exception {
mvc.perform(get("/").header(HttpHeaders.HOST, "www.google.com")).andExpect(status().isBadRequest());
}
/**
* Tests whether request is redirected when allowed host is used
*/
@Test void allowedHostNameWithAllowedHost() throws Exception {
@Test
void allowedHostNameWithAllowedHost() throws Exception {
mvc.perform(get("/").header(HttpHeaders.HOST, "localhost")).andExpect(status().is3xxRedirection());
}
/**
* Tests whether request without allowed host name and with ignored path end up with a client error
*/
@Test void notAllowedHostnameWithIgnoredPath() throws Exception {
@Test
void notAllowedHostnameWithIgnoredPath() throws Exception {
mvc.perform(get("/index.html").header(HttpHeaders.HOST, "www.google.com"))
.andExpect(status().is4xxClientError());
}

View File

@@ -46,7 +46,8 @@ class CorsTest extends AbstractSecurityTest {
/**
* Ensures that Cors is working.
*/
@Test @WithUser(authorities = SpRole.TENANT_ADMIN, autoCreateTenant = false)
@Test
@WithUser(authorities = SpRole.TENANT_ADMIN, autoCreateTenant = false)
void validateCorsRequest() throws Exception {
performOptionsRequestToRestWithOrigin(ALLOWED_ORIGIN_FIRST).andExpect(status().isOk())
.andExpect(header().string(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN, ALLOWED_ORIGIN_FIRST));

View File

@@ -30,7 +30,8 @@ class PreAuthorizeEnabledTest extends AbstractSecurityTest {
/**
* Tests whether request fail if a role is forbidden for the user
*/
@Test @WithUser(authorities = { SpPermission.READ_TARGET }, autoCreateTenant = false)
@Test
@WithUser(authorities = { SpPermission.READ_TARGET }, autoCreateTenant = false)
void failIfNoRole() throws Exception {
mvc.perform(get("/rest/v1/distributionsets"))
.andExpect(result -> assertThat(result.getResponse().getStatus()).isEqualTo(HttpStatus.FORBIDDEN.value()));
@@ -39,7 +40,8 @@ class PreAuthorizeEnabledTest extends AbstractSecurityTest {
/**
* Tests whether request succeed if a role is granted for the user
*/
@Test @WithUser(authorities = { SpPermission.READ_REPOSITORY }, autoCreateTenant = false)
@Test
@WithUser(authorities = { SpPermission.READ_REPOSITORY }, autoCreateTenant = false)
void successIfHasRole() throws Exception {
mvc.perform(get("/rest/v1/distributionsets"))
.andExpect(result -> assertThat(result.getResponse().getStatus()).isEqualTo(HttpStatus.OK.value()));
@@ -48,7 +50,8 @@ class PreAuthorizeEnabledTest extends AbstractSecurityTest {
/**
* Tests whether request succeed if a role is granted for the user
*/
@Test @WithUser(authorities = { SpRole.TENANT_ADMIN }, autoCreateTenant = false)
@Test
@WithUser(authorities = { SpRole.TENANT_ADMIN }, autoCreateTenant = false)
void successIfHasTenantAdminRole() throws Exception {
mvc.perform(get("/rest/v1/distributionsets"))
.andExpect(result -> assertThat(result.getResponse().getStatus()).isEqualTo(HttpStatus.OK.value()));
@@ -57,7 +60,8 @@ class PreAuthorizeEnabledTest extends AbstractSecurityTest {
/**
* Tests whether read tenant config request fail if a tenant config (or read read) is not granted for the user
*/
@Test @WithUser(authorities = { SpPermission.READ_TARGET }, autoCreateTenant = false)
@Test
@WithUser(authorities = { SpPermission.READ_TARGET }, autoCreateTenant = false)
void onlyDSIfNoTenantConfig() throws Exception {
mvc.perform(get("/rest/v1/system/configs"))
.andExpect(result -> {
@@ -71,7 +75,8 @@ class PreAuthorizeEnabledTest extends AbstractSecurityTest {
/**
* Tests whether read tenant config request succeed if a tenant config (not read explicitly) is granted for the user
*/
@Test @WithUser(authorities = { SpPermission.TENANT_CONFIGURATION }, autoCreateTenant = false)
@Test
@WithUser(authorities = { SpPermission.TENANT_CONFIGURATION }, autoCreateTenant = false)
void successIfHasTenantConfig() throws Exception {
mvc.perform(get("/rest/v1/system/configs"))
.andExpect(result -> assertThat(result.getResponse().getStatus()).isEqualTo(HttpStatus.OK.value()));

View File

@@ -27,7 +27,8 @@ class ArtifactEncryptionServiceTest {
/**
* Verify that no artifact encryption support is given
*/
@Test void verifyNoArtifactEncryptionSupport() {
@Test
void verifyNoArtifactEncryptionSupport() {
final ArtifactEncryptionService artifactEncryptionService = ArtifactEncryptionService.getInstance();
assertThat(artifactEncryptionService.isEncryptionSupported()).isFalse();

View File

@@ -28,7 +28,8 @@ class MaintenanceScheduleHelperTest {
/**
* Verifies that the Cron object is returned for valid cron expression
*/
@Test void getCronFromExpressionValid() {
@Test
void getCronFromExpressionValid() {
final String validCron = "0 0 0 ? * 6"; // at 00:00 every Saturday
assertThat(MaintenanceScheduleHelper.getCronFromExpression(validCron)).isNotNull().isInstanceOf(Cron.class);
}
@@ -36,7 +37,8 @@ class MaintenanceScheduleHelperTest {
/**
* Verifies that the Duration object is returned for valid duration format (hh:mm or hh:mm:ss)
*/
@Test void convertToISODurationValid() {
@Test
void convertToISODurationValid() {
final String duration = "00:10";
assertThat(MaintenanceScheduleHelper.convertToISODuration(duration)).isNotNull().isInstanceOf(Duration.class);
}
@@ -44,7 +46,8 @@ class MaintenanceScheduleHelperTest {
/**
* Verifies that the InvalidMaintenanceScheduleException is thrown for invalid duration format
*/
@Test void validateDurationInvalid() {
@Test
void validateDurationInvalid() {
final String duration = "10";
assertThatThrownBy(() -> MaintenanceScheduleHelper.validateDuration(duration))
.isInstanceOf(InvalidMaintenanceScheduleException.class).hasMessage("Provided duration is not valid")
@@ -54,7 +57,8 @@ class MaintenanceScheduleHelperTest {
/**
* Verifies that the InvalidMaintenanceScheduleException is thrown for invalid cron expression
*/
@Test void validateCronScheduleInvalid() {
@Test
void validateCronScheduleInvalid() {
final String invalidCron = "0 0 0 * * 6";
assertThatThrownBy(() -> MaintenanceScheduleHelper.validateCronSchedule(invalidCron))
.isInstanceOf(InvalidMaintenanceScheduleException.class)
@@ -64,7 +68,8 @@ class MaintenanceScheduleHelperTest {
/**
* Verifies that there is a maintenance window available for correct schedule, duration and timezone
*/
@Test void getNextMaintenanceWindowValid() {
@Test
void getNextMaintenanceWindowValid() {
final ZonedDateTime currentTime = ZonedDateTime.now();
final String cronSchedule = String.format("0 %d %d %d %d ? %d", currentTime.getMinute(), currentTime.getHour(),
currentTime.getDayOfMonth(), currentTime.getMonthValue(), currentTime.getYear());
@@ -76,7 +81,8 @@ class MaintenanceScheduleHelperTest {
/**
* Verifies the maintenance schedule when only one required field is present
*/
@Test void validateMaintenanceScheduleAtLeastOneNotEmpty() {
@Test
void validateMaintenanceScheduleAtLeastOneNotEmpty() {
final String duration = "00:10";
assertThatThrownBy(() -> MaintenanceScheduleHelper.validateMaintenanceSchedule(null, duration, null))
.isInstanceOf(InvalidMaintenanceScheduleException.class)
@@ -86,7 +92,8 @@ class MaintenanceScheduleHelperTest {
/**
* Verifies that there is no valid maintenance window available, scheduled before current time
*/
@Test void validateMaintenanceScheduleBeforeCurrentTime() {
@Test
void validateMaintenanceScheduleBeforeCurrentTime() {
ZonedDateTime currentTime = ZonedDateTime.now();
currentTime = currentTime.plusMinutes(-30);
final String cronSchedule = String.format("0 %d %d %d %d ? %d", currentTime.getMinute(), currentTime.getHour(),

View File

@@ -27,7 +27,8 @@ class RegexCharTest {
/**
* Verifies every RegexChar can be used to exclusively find the desired characters in a String.
*/
@Test void allRegexCharsOnlyFindExpectedChars() {
@Test
void allRegexCharsOnlyFindExpectedChars() {
for (final RegexChar character : RegexChar.values()) {
switch (character) {
case DIGITS:
@@ -52,7 +53,8 @@ class RegexCharTest {
/**
* Verifies that combinations of RegexChars can be used to find the desired characters in a String.
*/
@Test void combinedRegexCharsFindExpectedChars() {
@Test
void combinedRegexCharsFindExpectedChars() {
final RegexCharacterCollection greaterAndLessThan = new RegexCharacterCollection(RegexChar.GREATER_THAN,
RegexChar.LESS_THAN);
final RegexCharacterCollection equalsAndQuestionMark = new RegexCharacterCollection(RegexChar.EQUALS_SYMBOL,

View File

@@ -35,7 +35,8 @@ class RepositoryManagementMethodPreAuthorizeAnnotatedTest {
/**
* Verifies that repository methods are @PreAuthorize annotated
*/
@Test void repositoryManagementMethodsArePreAuthorizedAnnotated() {
@Test
void repositoryManagementMethodsArePreAuthorizedAnnotated() {
final String packageName = getClass().getPackage().getName();
try (final ScanResult scanResult = new ClassGraph().acceptPackages(packageName).scan()) {
final List<? extends Class<?>> matchingClasses = scanResult.getAllClasses()

View File

@@ -71,7 +71,8 @@ class TotalTargetCountStatusTest {
/**
* DownloadOnly actions should be displayed as FINISHED when they have ActionStatus.DOWNLOADED
*/
@Test void shouldCorrectlyMapActionStatusesInDownloadOnlyCase() {
@Test
void shouldCorrectlyMapActionStatusesInDownloadOnlyCase() {
TotalTargetCountStatus status = new TotalTargetCountStatus(targetCountActionStatuses, 55L,
Action.ActionType.DOWNLOAD_ONLY);
assertThat(status.getTotalTargetCountByStatus(TotalTargetCountStatus.Status.SCHEDULED)).isEqualTo(1L);

View File

@@ -47,7 +47,8 @@ class BusProtoStuffMessageConverterTest {
/**
* Verifies that the TargetCreatedEvent can be successfully serialized and deserialized
*/
@Test void successfullySerializeAndDeserializeEvent() {
@Test
void successfullySerializeAndDeserializeEvent() {
final TargetCreatedEvent targetCreatedEvent = new TargetCreatedEvent(targetMock, "1");
// serialize
final Object serializedEvent = underTest.convertToInternal(targetCreatedEvent,
@@ -65,7 +66,8 @@ class BusProtoStuffMessageConverterTest {
/**
* Verifies that a MessageConversationException is thrown on missing event-type information encoding
*/
@Test void missingEventTypeMappingThrowsMessageConversationException() {
@Test
void missingEventTypeMappingThrowsMessageConversationException() {
final DummyRemoteEntityEvent dummyEvent = new DummyRemoteEntityEvent(targetMock, "applicationId");
final MessageHeaders messageHeaders = new MessageHeaders(new HashMap<>());

View File

@@ -35,7 +35,8 @@ class HawkBitEclipseLinkJpaDialectTest {
/**
* Use Case: PersistenceException that can be mapped by EclipseLinkJpaDialect into corresponding DataAccessException.
*/
@Test void jpaOptimisticLockExceptionIsConcurrencyFailureException() {
@Test
void jpaOptimisticLockExceptionIsConcurrencyFailureException() {
assertThat(hawkBitEclipseLinkJpaDialectUnderTest.translateExceptionIfPossible(mock(OptimisticLockException.class)))
.isInstanceOf(ConcurrencyFailureException.class);
}

View File

@@ -37,21 +37,24 @@ class RemoteIdEventTest extends AbstractRemoteEventTest {
/**
* Verifies that the ds id is correct reloaded
*/
@Test void testDistributionSetDeletedEvent() {
@Test
void testDistributionSetDeletedEvent() {
assertAndCreateRemoteEvent(DistributionSetDeletedEvent.class);
}
/**
* Verifies that the ds tag id is correct reloaded
*/
@Test void testDistributionSetTagDeletedEvent() {
@Test
void testDistributionSetTagDeletedEvent() {
assertAndCreateRemoteEvent(DistributionSetTagDeletedEvent.class);
}
/**
* Verifies that the target id is correct reloaded
*/
@Test void testTargetDeletedEvent() {
@Test
void testTargetDeletedEvent() {
final TargetDeletedEvent deletedEvent = new TargetDeletedEvent(TENANT, ENTITY_ID, CONTROLLER_ID, ADDRESS,
ENTITY_CLASS, NODE);
assertEntity(deletedEvent);
@@ -60,21 +63,24 @@ class RemoteIdEventTest extends AbstractRemoteEventTest {
/**
* Verifies that the target tag id is correct reloaded
*/
@Test void testTargetTagDeletedEvent() {
@Test
void testTargetTagDeletedEvent() {
assertAndCreateRemoteEvent(TargetTagDeletedEvent.class);
}
/**
* Verifies that the software module id is correct reloaded
*/
@Test void testSoftwareModuleDeletedEvent() {
@Test
void testSoftwareModuleDeletedEvent() {
assertAndCreateRemoteEvent(SoftwareModuleDeletedEvent.class);
}
/**
* Verifies that the rollout id is correct reloaded
*/
@Test void testRolloutDeletedEvent() {
@Test
void testRolloutDeletedEvent() {
assertAndCreateRemoteEvent(RolloutDeletedEvent.class);
}

View File

@@ -33,7 +33,8 @@ class RemoteTenantAwareEventTest extends AbstractRemoteEventTest {
/**
* Verifies that a testMultiActionAssignEvent can be properly serialized and deserialized
*/
@Test void testMultiActionAssignEvent() {
@Test
void testMultiActionAssignEvent() {
final List<String> controllerIds = List.of("id0", "id1", "id2", "id3", "id4loooooooooooooooooooooooooooooooooooonnnnnnnnnnnnnnnnnng");
final List<Action> actions = controllerIds.stream().map(this::createAction).toList();
@@ -52,7 +53,8 @@ class RemoteTenantAwareEventTest extends AbstractRemoteEventTest {
/**
* Verifies that a MultiActionCancelEvent can be properly serialized and deserialized
*/
@Test void testMultiActionCancelEvent() {
@Test
void testMultiActionCancelEvent() {
final List<String> controllerIds = List.of("id0", "id1", "id2", "id3", "id4loooooooooooooooooooooooooooooooooooonnnnnnnnnnnnnnnnnng");
final List<Action> actions = controllerIds.stream().map(this::createAction).toList();
@@ -71,7 +73,8 @@ class RemoteTenantAwareEventTest extends AbstractRemoteEventTest {
/**
* Verifies that a DownloadProgressEvent can be properly serialized and deserialized
*/
@Test void reloadDownloadProgressByRemoteEvent() {
@Test
void reloadDownloadProgressByRemoteEvent() {
final DownloadProgressEvent downloadProgressEvent = new DownloadProgressEvent(TENANT_DEFAULT, 1L, 3L,
APPLICATION_ID_DEFAULT);
@@ -85,7 +88,8 @@ class RemoteTenantAwareEventTest extends AbstractRemoteEventTest {
/**
* Verifies that a TargetAssignDistributionSetEvent can be properly serialized and deserialized
*/
@Test void testTargetAssignDistributionSetEvent() {
@Test
void testTargetAssignDistributionSetEvent() {
final DistributionSet dsA = testdataFactory.createDistributionSet("");
@@ -113,7 +117,8 @@ class RemoteTenantAwareEventTest extends AbstractRemoteEventTest {
/**
* Verifies that a TargetAssignDistributionSetEvent can be properly serialized and deserialized
*/
@Test void testCancelTargetAssignmentEvent() {
@Test
void testCancelTargetAssignmentEvent() {
final DistributionSet dsA = testdataFactory.createDistributionSet("");

View File

@@ -30,14 +30,16 @@ class ActionEventTest extends AbstractRemoteEntityEventTest<Action> {
/**
* Verifies that the action entity reloading by remote created works
*/
@Test void testActionCreatedEvent() {
@Test
void testActionCreatedEvent() {
assertAndCreateRemoteEvent(ActionCreatedEvent.class);
}
/**
* Verifies that the action entity reloading by remote updated works
*/
@Test void testActionUpdatedEvent() {
@Test
void testActionUpdatedEvent() {
assertAndCreateRemoteEvent(ActionUpdatedEvent.class);
}

View File

@@ -23,7 +23,8 @@ class DistributionSetCreatedEventTest extends AbstractRemoteEntityEventTest<Dist
/**
* Verifies that the distribution set entity reloading by remote created event works
*/
@Test void testDistributionSetCreatedEvent() {
@Test
void testDistributionSetCreatedEvent() {
assertAndCreateRemoteEvent(DistributionSetCreatedEvent.class);
}

View File

@@ -23,14 +23,16 @@ class DistributionSetTagEventTest extends AbstractRemoteEntityEventTest<Distribu
/**
* Verifies that the distribution set tag entity reloading by remote created event works
*/
@Test void testDistributionSetTagCreatedEvent() {
@Test
void testDistributionSetTagCreatedEvent() {
assertAndCreateRemoteEvent(DistributionSetTagCreatedEvent.class);
}
/**
* Verifies that the distribution set tag entity reloading by remote updated event works
*/
@Test void testDistributionSetTagUpdateEvent() {
@Test
void testDistributionSetTagUpdateEvent() {
assertAndCreateRemoteEvent(DistributionSetTagUpdatedEvent.class);
}

View File

@@ -23,7 +23,8 @@ class DistributionSetUpdatedEventTest extends AbstractRemoteEntityEventTest<Dist
/**
* Verifies that the distribution set entity reloading by remote updated event works
*/
@Test void testDistributionSetUpdateEvent() {
@Test
void testDistributionSetUpdateEvent() {
assertAndCreateRemoteEvent(DistributionSetUpdatedEvent.class);
}

View File

@@ -29,7 +29,8 @@ class RolloutEventTest extends AbstractRemoteEntityEventTest<Rollout> {
/**
* Verifies that the rollout entity reloading by remote updated event works
*/
@Test void testRolloutUpdatedEvent() {
@Test
void testRolloutUpdatedEvent() {
assertAndCreateRemoteEvent(RolloutUpdatedEvent.class);
}

View File

@@ -33,7 +33,8 @@ class RolloutGroupEventTest extends AbstractRemoteEntityEventTest<RolloutGroup>
/**
* Verifies that the rollout group entity reloading by remote created event works
*/
@Test void testRolloutGroupCreatedEvent() {
@Test
void testRolloutGroupCreatedEvent() {
final RolloutGroupCreatedEvent createdEvent = (RolloutGroupCreatedEvent) assertAndCreateRemoteEvent(
RolloutGroupCreatedEvent.class);
assertThat(createdEvent.getRolloutId()).isNotNull();
@@ -42,7 +43,8 @@ class RolloutGroupEventTest extends AbstractRemoteEntityEventTest<RolloutGroup>
/**
* Verifies that the rollout group entity reloading by remote updated event works
*/
@Test void testRolloutGroupUpdatedEvent() {
@Test
void testRolloutGroupUpdatedEvent() {
assertAndCreateRemoteEvent(RolloutGroupUpdatedEvent.class);
}

View File

@@ -23,14 +23,16 @@ class SoftwareModuleEventTest extends AbstractRemoteEntityEventTest<SoftwareModu
/**
* Verifies that the software module entity reloading by remote created event works
*/
@Test void testTargetCreatedEvent() {
@Test
void testTargetCreatedEvent() {
assertAndCreateRemoteEvent(SoftwareModuleCreatedEvent.class);
}
/**
* Verifies that the software module entity reloading by remote updated event works
*/
@Test void testTargetUpdatedEvent() {
@Test
void testTargetUpdatedEvent() {
assertAndCreateRemoteEvent(SoftwareModuleUpdatedEvent.class);
}

View File

@@ -23,14 +23,16 @@ class TargetEventTest extends AbstractRemoteEntityEventTest<Target> {
/**
* Verifies that the target entity reloading by remote created event works
*/
@Test void testTargetCreatedEvent() {
@Test
void testTargetCreatedEvent() {
assertAndCreateRemoteEvent(TargetCreatedEvent.class);
}
/**
* Verifies that the target entity reloading by remote updated event works
*/
@Test void testTargetUpdatedEvent() {
@Test
void testTargetUpdatedEvent() {
assertAndCreateRemoteEvent(TargetUpdatedEvent.class);
}

View File

@@ -23,14 +23,16 @@ class TargetTagEventTest extends AbstractRemoteEntityEventTest<TargetTag> {
/**
* Verifies that the target tag entity reloading by remote created event works
*/
@Test void testTargetTagCreatedEvent() {
@Test
void testTargetTagCreatedEvent() {
assertAndCreateRemoteEvent(TargetTagCreatedEvent.class);
}
/**
* Verifies that the target tag entity reloading by remote updated event works
*/
@Test void testTargetTagUpdateEventt() {
@Test
void testTargetTagUpdateEventt() {
assertAndCreateRemoteEvent(TargetTagUpdatedEvent.class);
}

View File

@@ -36,28 +36,32 @@ public abstract class AbstractRepositoryManagementSecurityTest<T, C, U> extends
/**
* Tests RepositoryManagement PreAuthorized method with correct and insufficient permissions.
*/
@Test void createCollectionPermissionCheck() {
@Test
void createCollectionPermissionCheck() {
assertPermissions(() -> getRepositoryManagement().create(List.of(getCreateObject())), List.of(SpPermission.CREATE_REPOSITORY, SpPermission.READ_REPOSITORY));
}
/**
* Tests RepositoryManagement PreAuthorized method with correct and insufficient permissions.
*/
@Test void createPermissionCheck() {
@Test
void createPermissionCheck() {
assertPermissions(() -> getRepositoryManagement().create(getCreateObject()), List.of(SpPermission.CREATE_REPOSITORY, SpPermission.READ_REPOSITORY));
}
/**
* Tests RepositoryManagement PreAuthorized method with correct and insufficient permissions.
*/
@Test void updatePermissionCheck() {
@Test
void updatePermissionCheck() {
assertPermissions(() -> getRepositoryManagement().update(getUpdateObject()), List.of(SpPermission.UPDATE_REPOSITORY));
}
/**
* Tests RepositoryManagement PreAuthorized method with correct and insufficient permissions.
*/
@Test void deletePermissionCheck() {
@Test
void deletePermissionCheck() {
assertPermissions(() -> {
getRepositoryManagement().delete(1L);
return null;
@@ -67,7 +71,8 @@ public abstract class AbstractRepositoryManagementSecurityTest<T, C, U> extends
/**
* Tests RepositoryManagement PreAuthorized method with correct and insufficient permissions.
*/
@Test public void countPermissionCheck() {
@Test
void countPermissionCheck() {
assertPermissions(() -> getRepositoryManagement().count(), List.of(SpPermission.READ_REPOSITORY));
}
@@ -75,7 +80,8 @@ public abstract class AbstractRepositoryManagementSecurityTest<T, C, U> extends
/**
* Tests RepositoryManagement PreAuthorized method with correct and insufficient permissions.
*/
@Test public void deleteCollectionRepositoryManagement() {
@Test
void deleteCollectionRepositoryManagement() {
assertPermissions(() -> {
getRepositoryManagement().delete(List.of(1L));
return null;
@@ -85,35 +91,40 @@ public abstract class AbstractRepositoryManagementSecurityTest<T, C, U> extends
/**
* Tests RepositoryManagement PreAuthorized method with correct and insufficient permissions.
*/
@Test public void getPermissionCheck() {
@Test
void getPermissionCheck() {
assertPermissions(() -> getRepositoryManagement().get(1L), List.of(SpPermission.READ_REPOSITORY));
}
/**
* Tests RepositoryManagement PreAuthorized method with correct and insufficient permissions.
*/
@Test public void getCollectionPermissionCheck() {
@Test
void getCollectionPermissionCheck() {
assertPermissions(() -> getRepositoryManagement().get(List.of(1L)), List.of(SpPermission.READ_REPOSITORY));
}
/**
* Tests RepositoryManagement PreAuthorized method with correct and insufficient permissions.
*/
@Test public void existsCollectionPermissionCheck() {
@Test
void existsCollectionPermissionCheck() {
assertPermissions(() -> getRepositoryManagement().exists(1L), List.of(SpPermission.READ_REPOSITORY));
}
/**
* Tests RepositoryManagement PreAuthorized method with correct and insufficient permissions.
*/
@Test public void findAllPermissionCheck() {
@Test
void findAllPermissionCheck() {
assertPermissions(() -> getRepositoryManagement().findAll(Pageable.ofSize(1)), List.of(SpPermission.READ_REPOSITORY));
}
/**
* Tests RepositoryManagement PreAuthorized method with correct and insufficient permissions.
*/
@Test public void findByRsqlPermissionCheck() {
@Test
void findByRsqlPermissionCheck() {
assertPermissions(() -> getRepositoryManagement().findByRsql("(name==*)", Pageable.ofSize(1)), List.of(SpPermission.READ_REPOSITORY));
}

View File

@@ -54,7 +54,8 @@ class ConcurrentDistributionSetInvalidationTest extends AbstractJpaIntegrationTe
/**
* Verify that a large rollout causes a timeout when trying to invalidate a distribution set
*/
@Test void verifyInvalidateDistributionSetWithLargeRolloutThrowsException() {
@Test
void verifyInvalidateDistributionSetWithLargeRolloutThrowsException() {
final DistributionSet distributionSet = testdataFactory.createDistributionSet();
final Rollout rollout = createRollout(distributionSet);
final String tenant = tenantAware.getCurrentTenant();

View File

@@ -53,7 +53,8 @@ class ContextAwareTest extends AbstractJpaIntegrationTest {
/**
* Verifies acm context is persisted when creating Rollout
*/
@Test void verifyAcmContextIsPersistedInCreatedRollout() {
@Test
void verifyAcmContextIsPersistedInCreatedRollout() {
final SecurityContext securityContext = SecurityContextHolder.getContext();
assertThat(securityContext).isNotNull();
@@ -66,7 +67,8 @@ class ContextAwareTest extends AbstractJpaIntegrationTest {
/**
* Verifies acm context is reused when handling a rollout
*/
@Test void verifyContextIsReusedWhenHandlingRollout() {
@Test
void verifyContextIsReusedWhenHandlingRollout() {
final SecurityContext securityContext = SecurityContextHolder.getContext();
assertThat(securityContext).isNotNull();
@@ -78,7 +80,8 @@ class ContextAwareTest extends AbstractJpaIntegrationTest {
/**
* Verifies acm context is persisted when activating auto assignment
*/
@Test void verifyContextIsPersistedInActiveAutoAssignment() {
@Test
void verifyContextIsPersistedInActiveAutoAssignment() {
final SecurityContext securityContext = SecurityContextHolder.getContext();
assertThat(securityContext).isNotNull();
@@ -91,7 +94,8 @@ class ContextAwareTest extends AbstractJpaIntegrationTest {
/**
* Verifies acm context is used when performing auto assign check on all target
*/
@Test void verifyContextIsReusedWhenCheckingForAutoAssignmentAllTargets() {
@Test
void verifyContextIsReusedWhenCheckingForAutoAssignmentAllTargets() {
final SecurityContext securityContext = SecurityContextHolder.getContext();
assertThat(securityContext).isNotNull();
@@ -103,7 +107,8 @@ class ContextAwareTest extends AbstractJpaIntegrationTest {
/**
* Verifies acm context is used when performing auto assign check on single target
*/
@Test void verifyContextIsReusedWhenCheckingForAutoAssignmentSingleTarget() {
@Test
void verifyContextIsReusedWhenCheckingForAutoAssignmentSingleTarget() {
final SecurityContext securityContext = SecurityContextHolder.getContext();
assertThat(securityContext).isNotNull();

View File

@@ -47,7 +47,8 @@ class DistributionSetAccessControllerTest extends AbstractAccessControllerTest {
/**
* Verifies read access rules for distribution sets
*/
@Test void verifyDistributionSetReadOperations() {
@Test
void verifyDistributionSetReadOperations() {
permitAllOperations(AccessController.Operation.READ);
permitAllOperations(AccessController.Operation.CREATE);
permitAllOperations(AccessController.Operation.UPDATE);
@@ -119,7 +120,8 @@ class DistributionSetAccessControllerTest extends AbstractAccessControllerTest {
/**
* Verifies read access rules for distribution sets
*/
@Test void verifyDistributionSetUpdates() {
@Test
void verifyDistributionSetUpdates() {
// permit all operations first to prepare test setup
permitAllOperations(AccessController.Operation.READ);
permitAllOperations(AccessController.Operation.CREATE);

View File

@@ -51,7 +51,8 @@ class TargetAccessControllerTest extends AbstractAccessControllerTest {
/**
* Verifies read access rules for targets
*/
@Test void verifyTargetReadOperations() {
@Test
void verifyTargetReadOperations() {
permitAllOperations(AccessController.Operation.CREATE);
final Target permittedTarget = targetManagement
@@ -206,7 +207,8 @@ class TargetAccessControllerTest extends AbstractAccessControllerTest {
/**
* Verifies rules for target assignment
*/
@Test void verifyTargetAssignment() {
@Test
void verifyTargetAssignment() {
permitAllOperations(AccessController.Operation.READ);
permitAllOperations(AccessController.Operation.CREATE);
permitAllOperations(AccessController.Operation.UPDATE);
@@ -253,7 +255,8 @@ class TargetAccessControllerTest extends AbstractAccessControllerTest {
/**
* Verifies rules for target assignment
*/
@Test void verifyTargetAssignmentOnNonUpdatableTarget() {
@Test
void verifyTargetAssignmentOnNonUpdatableTarget() {
permitAllOperations(AccessController.Operation.READ);
permitAllOperations(AccessController.Operation.CREATE);
permitAllOperations(AccessController.Operation.UPDATE);
@@ -294,7 +297,8 @@ class TargetAccessControllerTest extends AbstractAccessControllerTest {
/**
* Verifies only manageable targets are part of the rollout
*/
@Test void verifyRolloutTargetScope() {
@Test
void verifyRolloutTargetScope() {
permitAllOperations(AccessController.Operation.READ);
permitAllOperations(AccessController.Operation.CREATE);
permitAllOperations(AccessController.Operation.UPDATE);
@@ -336,7 +340,8 @@ class TargetAccessControllerTest extends AbstractAccessControllerTest {
/**
* Verifies only manageable targets are part of an auto assignment.
*/
@Test void verifyAutoAssignmentTargetScope() {
@Test
void verifyAutoAssignmentTargetScope() {
permitAllOperations(AccessController.Operation.READ);
permitAllOperations(AccessController.Operation.CREATE);
permitAllOperations(AccessController.Operation.UPDATE);

View File

@@ -37,7 +37,8 @@ class TargetTypeAccessControllerTest extends AbstractAccessControllerTest {
/**
* Verifies read access rules for target types
*/
@Test void verifyTargetTypeReadOperations() {
@Test
void verifyTargetTypeReadOperations() {
permitAllOperations(AccessController.Operation.CREATE);
final TargetType permittedTargetType = targetTypeManagement.create(entityFactory.targetType().create().name("type1"));
final TargetType hiddenTargetType = targetTypeManagement.create(entityFactory.targetType().create().name("type2"));
@@ -99,7 +100,8 @@ class TargetTypeAccessControllerTest extends AbstractAccessControllerTest {
/**
* Verifies delete access rules for target types
*/
@Test void verifyTargetTypeDeleteOperations() {
@Test
void verifyTargetTypeDeleteOperations() {
permitAllOperations(AccessController.Operation.CREATE);
final TargetType manageableTargetType = targetTypeManagement.create(entityFactory.targetType().create().name("type1"));
@@ -123,7 +125,8 @@ class TargetTypeAccessControllerTest extends AbstractAccessControllerTest {
/**
* Verifies update operation for target types
*/
@Test void verifyTargetTypeUpdateOperations() {
@Test
void verifyTargetTypeUpdateOperations() {
permitAllOperations(AccessController.Operation.CREATE);
final TargetType manageableTargetType = targetTypeManagement
.create(entityFactory.targetType().create().name("type1"));
@@ -151,7 +154,8 @@ class TargetTypeAccessControllerTest extends AbstractAccessControllerTest {
/**
* Verifies create operation blocked by controller
*/
@Test void verifyTargetTypeCreationBlockedByAccessController() {
@Test
void verifyTargetTypeCreationBlockedByAccessController() {
defineAccess(AccessController.Operation.CREATE); // allows for none
// verify targetTypeManagement#create for any type
final TargetTypeCreate targetTypeCreate = entityFactory.targetType().create().name("type1");

View File

@@ -62,7 +62,8 @@ class AutoAssignCheckerIntTest extends AbstractJpaIntegrationTest {
/**
* Verifies that a running action is auto canceled by a AutoAssignment which assigns another distribution-set.
*/
@Test void autoAssignDistributionSetAndAutoCloseOldActions() {
@Test
void autoAssignDistributionSetAndAutoCloseOldActions() {
tenantConfigurationManagement
.addOrUpdateConfiguration(TenantConfigurationKey.REPOSITORY_ACTIONS_AUTOCLOSE_ENABLED, true);
@@ -107,7 +108,8 @@ class AutoAssignCheckerIntTest extends AbstractJpaIntegrationTest {
/**
* Test auto assignment of a DS to filtered targets
*/
@Test void checkAutoAssign() {
@Test
void checkAutoAssign() {
// will be auto assigned
final DistributionSet setA = testdataFactory.createDistributionSet("dsA");
final DistributionSet setB = testdataFactory.createDistributionSet("dsB");
@@ -160,7 +162,8 @@ class AutoAssignCheckerIntTest extends AbstractJpaIntegrationTest {
/**
* Test auto assignment of a DS for a specific device
*/
@Test void checkAutoAssignmentForDevice() {
@Test
void checkAutoAssignmentForDevice() {
final DistributionSet toAssignDs = testdataFactory.createDistributionSet();
@@ -244,7 +247,8 @@ class AutoAssignCheckerIntTest extends AbstractJpaIntegrationTest {
/**
* Test auto assignment of an incomplete DS to filtered targets, that causes failures
*/
@Test void checkAutoAssignWithFailures() {
@Test
void checkAutoAssignWithFailures() {
// incomplete distribution set that will be assigned
final DistributionSet setF = distributionSetManagement.create(entityFactory.distributionSet().create()
@@ -294,7 +298,8 @@ class AutoAssignCheckerIntTest extends AbstractJpaIntegrationTest {
/**
* Test auto assignment of a distribution set with FORCED, SOFT and DOWNLOAD_ONLY action types
*/
@Test void checkAutoAssignWithDifferentActionTypes() {
@Test
void checkAutoAssignWithDifferentActionTypes() {
final DistributionSet distributionSet = testdataFactory.createDistributionSet();
final String targetDsAIdPref = "A";
final String targetDsBIdPref = "B";
@@ -324,7 +329,8 @@ class AutoAssignCheckerIntTest extends AbstractJpaIntegrationTest {
/**
* An auto assignment target filter with weight creates actions with weights
*/
@Test void actionsWithWeightAreCreated() {
@Test
void actionsWithWeightAreCreated() {
final int amountOfTargets = 5;
final DistributionSet ds = testdataFactory.createDistributionSet();
final int weight = 32;
@@ -344,7 +350,8 @@ class AutoAssignCheckerIntTest extends AbstractJpaIntegrationTest {
/**
* An auto assignment target filter without weight still works after multi assignment is enabled
*/
@Test void filterWithoutWeightWorksInMultiAssignmentMode() {
@Test
void filterWithoutWeightWorksInMultiAssignmentMode() {
final int amountOfTargets = 5;
final DistributionSet ds = testdataFactory.createDistributionSet();
targetFilterQueryManagement.create(
@@ -363,7 +370,8 @@ class AutoAssignCheckerIntTest extends AbstractJpaIntegrationTest {
/**
* Verifies an auto assignment only creates actions for compatible targets
*/
@Test void checkAutoAssignmentWithIncompatibleTargets() {
@Test
void checkAutoAssignmentWithIncompatibleTargets() {
final int TARGET_COUNT = 5;
final DistributionSet testDs = testdataFactory.createDistributionSet();

View File

@@ -68,7 +68,8 @@ class AutoAssignCheckerTest {
/**
* Single device check triggers update for matching auto assignment filter.
*/
@Test void checkForDevice() {
@Test
void checkForDevice() {
mockRunningAsNonSystem();
final String target = getRandomString();
final long ds = getRandomLong();

View File

@@ -40,7 +40,8 @@ class AutoActionCleanupTest extends AbstractJpaIntegrationTest {
/**
* Verifies that running actions are not cleaned up.
*/
@Test void runningActionsAreNotCleanedUp() {
@Test
void runningActionsAreNotCleanedUp() {
// cleanup config for this test case
setupCleanupConfiguration(true, 0, Action.Status.CANCELED, Action.Status.ERROR);
@@ -64,7 +65,8 @@ class AutoActionCleanupTest extends AbstractJpaIntegrationTest {
/**
* Verifies that nothing is cleaned up if the cleanup is disabled.
*/
@Test void cleanupDisabled() {
@Test
void cleanupDisabled() {
// cleanup config for this test case
setupCleanupConfiguration(false, 0, Action.Status.CANCELED);
@@ -90,7 +92,8 @@ class AutoActionCleanupTest extends AbstractJpaIntegrationTest {
/**
* Verifies that canceled and failed actions are cleaned up.
*/
@Test void canceledAndFailedActionsAreCleanedUp() {
@Test
void canceledAndFailedActionsAreCleanedUp() {
// cleanup config for this test case
setupCleanupConfiguration(true, 0, Action.Status.CANCELED, Action.Status.ERROR);
@@ -122,7 +125,8 @@ class AutoActionCleanupTest extends AbstractJpaIntegrationTest {
/**
* Verifies that canceled actions are cleaned up.
*/
@Test void canceledActionsAreCleanedUp() {
@Test
void canceledActionsAreCleanedUp() {
// cleanup config for this test case
setupCleanupConfiguration(true, 0, Action.Status.CANCELED);
@@ -155,7 +159,8 @@ class AutoActionCleanupTest extends AbstractJpaIntegrationTest {
/**
* Verifies that canceled and failed actions are cleaned up once they expired.
*/
@Test @SuppressWarnings("squid:S2925")
@Test
@SuppressWarnings("squid:S2925")
void canceledAndFailedActionsAreCleanedUpWhenExpired() throws InterruptedException {
// cleanup config for this test case
setupCleanupConfiguration(true, 500, Action.Status.CANCELED, Action.Status.ERROR);

View File

@@ -42,7 +42,8 @@ class AutoCleanupSchedulerTest extends AbstractJpaIntegrationTest {
/**
* Verifies that all cleanup handlers are executed regardless if one of them throws an error
*/
@Test void executeHandlerChain() {
@Test
void executeHandlerChain() {
new AutoCleanupScheduler(systemManagement, systemSecurityContext, lockRegistry, Arrays.asList(
new SuccessfulCleanup(), new SuccessfulCleanup(), new FailingCleanup(), new SuccessfulCleanup())).run();

View File

@@ -63,7 +63,8 @@ class RepositoryEntityEventTest extends AbstractJpaIntegrationTest {
/**
* Verifies that the target created event is published when a target has been created
*/
@Test void targetCreatedEventIsPublished() throws InterruptedException {
@Test
void targetCreatedEventIsPublished() throws InterruptedException {
final Target createdTarget = testdataFactory.createTarget("12345");
final TargetCreatedEvent targetCreatedEvent = eventListener.waitForEvent(TargetCreatedEvent.class);
@@ -74,7 +75,8 @@ class RepositoryEntityEventTest extends AbstractJpaIntegrationTest {
/**
* Verifies that the target update event is published when a target has been updated
*/
@Test void targetUpdateEventIsPublished() throws InterruptedException {
@Test
void targetUpdateEventIsPublished() throws InterruptedException {
final Target createdTarget = testdataFactory.createTarget("12345");
targetManagement.update(entityFactory.target().update(createdTarget.getControllerId()).name("updateName"));
@@ -86,7 +88,8 @@ class RepositoryEntityEventTest extends AbstractJpaIntegrationTest {
/**
* Verifies that the target deleted event is published when a target has been deleted
*/
@Test void targetDeletedEventIsPublished() throws InterruptedException {
@Test
void targetDeletedEventIsPublished() throws InterruptedException {
final Target createdTarget = testdataFactory.createTarget("12345");
targetManagement.deleteByControllerID("12345");
@@ -99,7 +102,8 @@ class RepositoryEntityEventTest extends AbstractJpaIntegrationTest {
/**
* Verifies that the target type created event is published when a target type has been created
*/
@Test void targetTypeCreatedEventIsPublished() throws InterruptedException {
@Test
void targetTypeCreatedEventIsPublished() throws InterruptedException {
final TargetType createdTargetType = testdataFactory.findOrCreateTargetType("targettype");
final TargetTypeCreatedEvent targetTypeCreatedEvent = eventListener.waitForEvent(TargetTypeCreatedEvent.class);
@@ -110,7 +114,8 @@ class RepositoryEntityEventTest extends AbstractJpaIntegrationTest {
/**
* Verifies that the target type updated event is published when a target type has been updated
*/
@Test void targetTypeUpdatedEventIsPublished() throws InterruptedException {
@Test
void targetTypeUpdatedEventIsPublished() throws InterruptedException {
final TargetType createdTargetType = testdataFactory.findOrCreateTargetType("targettype");
targetTypeManagement
.update(entityFactory.targetType().update(createdTargetType.getId()).name("updatedtargettype"));
@@ -123,7 +128,8 @@ class RepositoryEntityEventTest extends AbstractJpaIntegrationTest {
/**
* Verifies that the target type deleted event is published when a target type has been deleted
*/
@Test void targetTypeDeletedEventIsPublished() throws InterruptedException {
@Test
void targetTypeDeletedEventIsPublished() throws InterruptedException {
final TargetType createdTargetType = testdataFactory.findOrCreateTargetType("targettype");
targetTypeManagement.delete(createdTargetType.getId());
@@ -135,7 +141,8 @@ class RepositoryEntityEventTest extends AbstractJpaIntegrationTest {
/**
* Verifies that the rollout deleted event is published when a rollout has been deleted
*/
@Test void rolloutDeletedEventIsPublished() throws InterruptedException {
@Test
void rolloutDeletedEventIsPublished() throws InterruptedException {
final int amountTargetsForRollout = 50;
final int amountGroups = 5;
final String successCondition = "50";
@@ -159,7 +166,8 @@ class RepositoryEntityEventTest extends AbstractJpaIntegrationTest {
/**
* Verifies that the distribution set created event is published when a distribution set has been created
*/
@Test void distributionSetCreatedEventIsPublished() throws InterruptedException {
@Test
void distributionSetCreatedEventIsPublished() throws InterruptedException {
final DistributionSet createDistributionSet = testdataFactory.createDistributionSet();
final DistributionSetCreatedEvent dsCreatedEvent = eventListener
@@ -171,7 +179,8 @@ class RepositoryEntityEventTest extends AbstractJpaIntegrationTest {
/**
* Verifies that the distribution set deleted event is published when a distribution set has been deleted
*/
@Test void distributionSetDeletedEventIsPublished() throws InterruptedException {
@Test
void distributionSetDeletedEventIsPublished() throws InterruptedException {
final DistributionSet createDistributionSet = testdataFactory.createDistributionSet();
distributionSetManagement.delete(createDistributionSet.getId());
@@ -185,7 +194,8 @@ class RepositoryEntityEventTest extends AbstractJpaIntegrationTest {
/**
* Verifies that the software module created event is published when a software module has been created
*/
@Test void softwareModuleCreatedEventIsPublished() throws InterruptedException {
@Test
void softwareModuleCreatedEventIsPublished() throws InterruptedException {
final SoftwareModule softwareModule = testdataFactory.createSoftwareModuleApp();
final SoftwareModuleCreatedEvent softwareModuleCreatedEvent = eventListener
@@ -197,7 +207,8 @@ class RepositoryEntityEventTest extends AbstractJpaIntegrationTest {
/**
* Verifies that the software module update event is published when a software module has been updated
*/
@Test void softwareModuleUpdateEventIsPublished() throws InterruptedException {
@Test
void softwareModuleUpdateEventIsPublished() throws InterruptedException {
final SoftwareModule softwareModule = testdataFactory.createSoftwareModuleApp();
softwareModuleManagement
.update(entityFactory.softwareModule().update(softwareModule.getId()).description("New"));
@@ -211,7 +222,8 @@ class RepositoryEntityEventTest extends AbstractJpaIntegrationTest {
/**
* Verifies that the software module deleted event is published when a software module has been deleted
*/
@Test void softwareModuleDeletedEventIsPublished() throws InterruptedException {
@Test
void softwareModuleDeletedEventIsPublished() throws InterruptedException {
final SoftwareModule softwareModule = testdataFactory.createSoftwareModuleApp();
softwareModuleManagement.delete(softwareModule.getId());

View File

@@ -37,7 +37,8 @@ class ActionTest extends AbstractJpaIntegrationTest {
/**
* Ensures that timeforced moded switch from soft to forces after defined timeframe.
*/
@Test void timeForcedHitNewHasCodeIsGenerated() {
@Test
void timeForcedHitNewHasCodeIsGenerated() {
// current time + 1 seconds
final long sleepTime = 1000;
final long timeForceTimeAt = System.currentTimeMillis() + sleepTime;
@@ -53,7 +54,8 @@ class ActionTest extends AbstractJpaIntegrationTest {
/**
* Tests the action type mapping.
*/
@Test void testActionTypeConvert() {
@Test
void testActionTypeConvert() {
final long id = createAction().getId();
for (final ActionType actionType : ActionType.values()) {
final JpaAction action = actionRepository.findById(id).orElseThrow(() -> new IllegalStateException("Action not found"));
@@ -67,7 +69,8 @@ class ActionTest extends AbstractJpaIntegrationTest {
/**
* Tests the status mapping.
*/
@Test void testStatusConvert() {
@Test
void testStatusConvert() {
final long id = createAction().getId();
for (final Status status : Status.values()) {
final JpaAction action = actionRepository.findById(id).orElseThrow(() -> new IllegalStateException("Action not found"));
@@ -81,7 +84,8 @@ class ActionTest extends AbstractJpaIntegrationTest {
/**
* Tests the action status status mapping.
*/
@Test void testActionsStatusStatusConvert() {
@Test
void testActionsStatusStatusConvert() {
for (final Status status : Status.values()) {
final long id = createAction().getId();
controllerManagement.addUpdateActionStatus(entityFactory.actionStatus().create(id).status(status));

View File

@@ -27,7 +27,8 @@ class ArtifactManagementSecurityTest extends AbstractJpaIntegrationTest {
/**
* Tests ArtifactManagement#count() method
*/
@Test @WithUser(principal = "user", authorities = { SpPermission.READ_REPOSITORY })
@Test
@WithUser(principal = "user", authorities = { SpPermission.READ_REPOSITORY })
void countPermissionCheck() {
assertPermissions(() -> artifactManagement.count(), List.of(SpPermission.READ_REPOSITORY));
}
@@ -35,7 +36,8 @@ class ArtifactManagementSecurityTest extends AbstractJpaIntegrationTest {
/**
* Tests ArtifactManagement#create() method
*/
@Test void createPermissionCheck() {
@Test
void createPermissionCheck() {
ArtifactUpload artifactUpload = new ArtifactUpload(new ByteArrayInputStream("RandomString".getBytes()), 1L, "filename", false, 1024);
assertPermissions(() -> artifactManagement.create(artifactUpload), List.of(SpPermission.CREATE_REPOSITORY));
}
@@ -43,7 +45,8 @@ class ArtifactManagementSecurityTest extends AbstractJpaIntegrationTest {
/**
* Tests ArtifactManagement#delete() method
*/
@Test void deletePermissionCheck() {
@Test
void deletePermissionCheck() {
assertPermissions(() -> {
artifactManagement.delete(1);
return null;
@@ -53,7 +56,8 @@ class ArtifactManagementSecurityTest extends AbstractJpaIntegrationTest {
/**
* Tests ArtifactManagement#get() method
*/
@Test void getPermissionCheck() {
@Test
void getPermissionCheck() {
assertPermissions(() -> artifactManagement.get(1L), List.of(SpPermission.READ_REPOSITORY));
assertPermissions(() -> artifactManagement.get(1L), List.of(SpPermission.SpringEvalExpressions.CONTROLLER_ROLE), List.of(SpPermission.CREATE_REPOSITORY));
}
@@ -61,7 +65,8 @@ class ArtifactManagementSecurityTest extends AbstractJpaIntegrationTest {
/**
* Tests ArtifactManagement#getByFilenameAndSoftwareModule() method
*/
@Test void getByFilenameAndSoftwareModulePermissionCheck() {
@Test
void getByFilenameAndSoftwareModulePermissionCheck() {
assertPermissions(() -> artifactManagement.getByFilenameAndSoftwareModule("filename", 1L),
List.of(SpPermission.READ_REPOSITORY), List.of(SpPermission.CREATE_REPOSITORY));
assertPermissions(() -> artifactManagement.getByFilenameAndSoftwareModule("filename", 1L),
@@ -71,7 +76,8 @@ class ArtifactManagementSecurityTest extends AbstractJpaIntegrationTest {
/**
* Tests ArtifactManagement#findFirstBySHA1() method
*/
@Test void findFirstBySHA1PermissionCheck() {
@Test
void findFirstBySHA1PermissionCheck() {
assertPermissions(() -> artifactManagement.findFirstBySHA1("sha1"), List.of(SpPermission.READ_REPOSITORY));
assertPermissions(() -> artifactManagement.findFirstBySHA1("sha1"), List.of(SpPermission.SpringEvalExpressions.CONTROLLER_ROLE), List.of(SpPermission.CREATE_REPOSITORY));
}
@@ -79,7 +85,8 @@ class ArtifactManagementSecurityTest extends AbstractJpaIntegrationTest {
/**
* Tests ArtifactManagement#getByFilename() method
*/
@Test void getByFilenamePermissionCheck() {
@Test
void getByFilenamePermissionCheck() {
assertPermissions(() -> artifactManagement.getByFilename("filename"), List.of(SpPermission.READ_REPOSITORY));
assertPermissions(() -> artifactManagement.getByFilename("filename"), List.of(SpPermission.SpringEvalExpressions.CONTROLLER_ROLE), List.of(SpPermission.CREATE_REPOSITORY));
}
@@ -87,21 +94,24 @@ class ArtifactManagementSecurityTest extends AbstractJpaIntegrationTest {
/**
* Tests ArtifactManagement#findBySoftwareModule() method
*/
@Test void findBySoftwareModulePermissionCheck() {
@Test
void findBySoftwareModulePermissionCheck() {
assertPermissions(() -> artifactManagement.findBySoftwareModule(1L, PAGE), List.of(SpPermission.READ_REPOSITORY));
}
/**
* Tests ArtifactManagement#countBySoftwareModule() method
*/
@Test void countBySoftwareModulePermissionCheck() {
@Test
void countBySoftwareModulePermissionCheck() {
assertPermissions(() -> artifactManagement.countBySoftwareModule(1L), List.of(SpPermission.READ_REPOSITORY));
}
/**
* Tests ArtifactManagement#loadArtifactBinary() method
*/
@Test void loadArtifactBinaryPermissionCheck() {
@Test
void loadArtifactBinaryPermissionCheck() {
assertPermissions(() -> artifactManagement.loadArtifactBinary("sha1", 1L, false), List.of(SpPermission.DOWNLOAD_REPOSITORY_ARTIFACT), List.of(SpPermission.CREATE_REPOSITORY));
assertPermissions(() -> artifactManagement.loadArtifactBinary("sha1", 1L, false), List.of(SpPermission.SpringEvalExpressions.CONTROLLER_ROLE), List.of(SpPermission.CREATE_REPOSITORY));
}

View File

@@ -63,7 +63,8 @@ class ArtifactManagementTest extends AbstractJpaIntegrationTest {
/**
* Verifies that management get access react as specfied on calls for non existing entities by means of Optional not present.
*/
@Test @ExpectEvents({ @Expect(type = SoftwareModuleCreatedEvent.class, count = 1) })
@Test
@ExpectEvents({ @Expect(type = SoftwareModuleCreatedEvent.class, count = 1) })
void nonExistingEntityAccessReturnsNotPresent() {
final SoftwareModule module = testdataFactory.createSoftwareModuleOs();
@@ -104,7 +105,8 @@ class ArtifactManagementTest extends AbstractJpaIntegrationTest {
/**
* Test if a local artifact can be created by API including metadata.
*/
@Test void createArtifact() throws IOException {
@Test
void createArtifact() throws IOException {
// check baseline
assertThat(softwareModuleRepository.findAll()).isEmpty();
assertThat(artifactRepository.findAll()).isEmpty();
@@ -148,7 +150,8 @@ class ArtifactManagementTest extends AbstractJpaIntegrationTest {
/**
* Verifies that artifact management does not create artifacts with illegal filename.
*/
@Test void entityQueryWithIllegalFilenameThrowsException() {
@Test
void entityQueryWithIllegalFilenameThrowsException() {
final String illegalFilename = "<img src=ernw onerror=alert(1)>.xml";
final String artifactData = "test";
final int artifactSize = artifactData.length();
@@ -163,7 +166,8 @@ class ArtifactManagementTest extends AbstractJpaIntegrationTest {
/**
* Verifies that the quota specifying the maximum number of artifacts per software module is enforced.
*/
@Test void createArtifactsUntilQuotaIsExceeded() throws IOException {
@Test
void createArtifactsUntilQuotaIsExceeded() throws IOException {
// create a software module
final long smId = softwareModuleRepository.save(new JpaSoftwareModule(osType, "sm1", "1.0")).getId();
@@ -193,7 +197,8 @@ class ArtifactManagementTest extends AbstractJpaIntegrationTest {
/**
* Verifies that the quota specifying the maximum artifact storage is enforced (across software modules).
*/
@Test void createArtifactsUntilStorageQuotaIsExceeded() throws IOException {
@Test
void createArtifactsUntilStorageQuotaIsExceeded() throws IOException {
// create as many small artifacts as possible w/o violating the storage quota
final long maxBytes = quotaManagement.getMaxArtifactStorage();
final List<Long> artifactIds = new ArrayList<>();
@@ -221,7 +226,8 @@ class ArtifactManagementTest extends AbstractJpaIntegrationTest {
/**
* Verifies that you cannot create artifacts which exceed the configured maximum size.
*/
@Test void createArtifactFailsIfTooLarge() {
@Test
void createArtifactFailsIfTooLarge() {
// create a software module
final long smId = softwareModuleRepository.save(new JpaSoftwareModule(osType, "sm1", "1.0")).getId();
@@ -234,7 +240,8 @@ class ArtifactManagementTest extends AbstractJpaIntegrationTest {
/**
* Tests hard delete directly on repository.
*/
@Test void hardDeleteSoftwareModule() throws IOException {
@Test
void hardDeleteSoftwareModule() throws IOException {
final JpaSoftwareModule sm = softwareModuleRepository.save(new JpaSoftwareModule(osType, "name 1", "version 1"));
createArtifactForSoftwareModule("file1", sm.getId(), 5 * 1024);
@@ -250,7 +257,8 @@ class ArtifactManagementTest extends AbstractJpaIntegrationTest {
/**
* Tests the deletion of a local artifact including metadata.
*/
@Test void deleteArtifact() throws IOException {
@Test
void deleteArtifact() throws IOException {
final JpaSoftwareModule sm = softwareModuleRepository.save(new JpaSoftwareModule(osType, "name 1", "version 1"));
final JpaSoftwareModule sm2 = softwareModuleRepository.save(new JpaSoftwareModule(osType, "name 2", "version 2"));
@@ -322,7 +330,8 @@ class ArtifactManagementTest extends AbstractJpaIntegrationTest {
/**
* Verifies that you cannot delete an artifact which exists with the same hash, in the same tenant and the SoftwareModule is not deleted .
*/
@Test void deleteArtifactWithSameHashAndSoftwareModuleIsNotDeletedInSameTenants() throws IOException {
@Test
void deleteArtifactWithSameHashAndSoftwareModuleIsNotDeletedInSameTenants() throws IOException {
final JpaSoftwareModule sm = softwareModuleRepository.save(new JpaSoftwareModule(osType, "name 1", "version 1"));
final JpaSoftwareModule sm2 = softwareModuleRepository.save(new JpaSoftwareModule(osType, "name 2", "version 2"));
@@ -360,7 +369,8 @@ class ArtifactManagementTest extends AbstractJpaIntegrationTest {
/**
* Verifies that you can not delete artifacts from another tenant which exists in another tenant with the same hash and the SoftwareModule is not deleted
*/
@Test void deleteArtifactWithSameHashAndSoftwareModuleIsNotDeletedInDifferentTenants() throws Exception {
@Test
void deleteArtifactWithSameHashAndSoftwareModuleIsNotDeletedInDifferentTenants() throws Exception {
final String tenant1 = "mytenant";
final String tenant2 = "tenant2";
@@ -388,7 +398,8 @@ class ArtifactManagementTest extends AbstractJpaIntegrationTest {
/**
* Loads an local artifact based on given ID.
*/
@Test void findArtifact() throws IOException {
@Test
void findArtifact() throws IOException {
final int artifactSize = 5 * 1024;
try (final InputStream inputStream = new RandomGeneratedInputStream(artifactSize)) {
final Artifact artifact = createArtifactForSoftwareModule(
@@ -400,7 +411,8 @@ class ArtifactManagementTest extends AbstractJpaIntegrationTest {
/**
* Loads an artifact binary based on given ID.
*/
@Test void loadStreamOfArtifact() throws IOException {
@Test
void loadStreamOfArtifact() throws IOException {
final int artifactSize = 5 * 1024;
final byte[] randomBytes = randomBytes(artifactSize);
try (final InputStream input = new ByteArrayInputStream(randomBytes)) {
@@ -425,7 +437,8 @@ class ArtifactManagementTest extends AbstractJpaIntegrationTest {
/**
* Searches an artifact through the relations of a software module.
*/
@Test void findArtifactBySoftwareModule() throws IOException {
@Test
void findArtifactBySoftwareModule() throws IOException {
final SoftwareModule sm = testdataFactory.createSoftwareModuleOs();
assertThat(artifactManagement.findBySoftwareModule(sm.getId(), PAGE)).isEmpty();
@@ -439,7 +452,8 @@ class ArtifactManagementTest extends AbstractJpaIntegrationTest {
/**
* Searches an artifact through the relations of a software module and the filename.
*/
@Test void findByFilenameAndSoftwareModule() throws IOException {
@Test
void findByFilenameAndSoftwareModule() throws IOException {
final SoftwareModule sm = testdataFactory.createSoftwareModuleOs();
assertThat(artifactManagement.getByFilenameAndSoftwareModule("file1", sm.getId())).isNotPresent();
@@ -456,7 +470,8 @@ class ArtifactManagementTest extends AbstractJpaIntegrationTest {
/**
* Verifies that creation of an artifact with none matching hashes fails.
*/
@Test void createArtifactWithNoneMatchingHashes() throws IOException, NoSuchAlgorithmException {
@Test
void createArtifactWithNoneMatchingHashes() throws IOException, NoSuchAlgorithmException {
final SoftwareModule sm = testdataFactory.createSoftwareModuleOs();
final byte[] testData = randomBytes(100);
@@ -490,7 +505,8 @@ class ArtifactManagementTest extends AbstractJpaIntegrationTest {
/**
* Verifies that creation of an artifact with matching hashes works.
*/
@Test void createArtifactWithMatchingHashes() throws IOException, NoSuchAlgorithmException {
@Test
void createArtifactWithMatchingHashes() throws IOException, NoSuchAlgorithmException {
final SoftwareModule sm = testdataFactory.createSoftwareModuleOs();
final byte[] testData = randomBytes(100);
@@ -513,7 +529,8 @@ class ArtifactManagementTest extends AbstractJpaIntegrationTest {
/**
* Verifies that creation of an existing artifact returns a full hash list.
*/
@Test void createExistingArtifactReturnsFullHashList() throws IOException, NoSuchAlgorithmException {
@Test
void createExistingArtifactReturnsFullHashList() throws IOException, NoSuchAlgorithmException {
final SoftwareModule smOs = testdataFactory.createSoftwareModuleOs();
final SoftwareModule smApp = testdataFactory.createSoftwareModuleApp();

View File

@@ -24,14 +24,16 @@ class ConfirmationManagementSecurityTest extends AbstractJpaIntegrationTest {
/**
* Tests ConfirmationManagement#findActiveActionsWaitingConfirmation() method
*/
@Test void findActiveActionsWaitingConfirmationPermissionsCheck() {
@Test
void findActiveActionsWaitingConfirmationPermissionsCheck() {
assertPermissions(() -> confirmationManagement.findActiveActionsWaitingConfirmation("controllerId"), List.of(SpPermission.READ_TARGET));
}
/**
* Tests ConfirmationManagement#activateAutoConfirmation() method
*/
@Test void activateAutoConfirmationPermissionsCheck() {
@Test
void activateAutoConfirmationPermissionsCheck() {
assertPermissions(() -> confirmationManagement.activateAutoConfirmation("controllerId", "initiator", "remark"),
List.of(SpPermission.READ_REPOSITORY, SpPermission.UPDATE_TARGET));
}
@@ -39,7 +41,8 @@ class ConfirmationManagementSecurityTest extends AbstractJpaIntegrationTest {
/**
* Tests ConfirmationManagement#getStatus() method
*/
@Test void getStatusPermissionsCheck() {
@Test
void getStatusPermissionsCheck() {
assertPermissions(() -> confirmationManagement.getStatus("controllerId"), List.of(SpPermission.READ_TARGET),
List.of(SpPermission.CREATE_TARGET));
assertPermissions(() -> confirmationManagement.getStatus("controllerId"), List.of(SpPermission.SpringEvalExpressions.CONTROLLER_ROLE), List.of(SpPermission.CREATE_TARGET));
@@ -48,7 +51,8 @@ class ConfirmationManagementSecurityTest extends AbstractJpaIntegrationTest {
/**
* Tests ConfirmationManagement#confirmAction() method
*/
@Test void confirmActionPermissionsCheck() {
@Test
void confirmActionPermissionsCheck() {
assertPermissions(() -> confirmationManagement.confirmAction(1L, null, null),
List.of(SpPermission.READ_REPOSITORY, SpPermission.UPDATE_TARGET));
}
@@ -56,7 +60,8 @@ class ConfirmationManagementSecurityTest extends AbstractJpaIntegrationTest {
/**
* Tests ConfirmationManagement#denyAction() method
*/
@Test void denyActionPermissionsCheck() {
@Test
void denyActionPermissionsCheck() {
assertPermissions(() -> confirmationManagement.denyAction(1L, null, null),
List.of(SpPermission.READ_REPOSITORY, SpPermission.UPDATE_TARGET));
}
@@ -64,7 +69,8 @@ class ConfirmationManagementSecurityTest extends AbstractJpaIntegrationTest {
/**
* Tests ConfirmationManagement#deactivateAutoConfirmation() method
*/
@Test void deactivateAutoConfirmationPermissionsCheck() {
@Test
void deactivateAutoConfirmationPermissionsCheck() {
assertPermissions(() -> {
confirmationManagement.deactivateAutoConfirmation("controllerId");
return null;

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