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

@@ -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();