@@ -472,32 +472,29 @@ void forceQuitNotAllowedThrowsException() {
472472 + "is correctly executed for targets that do not have a running update already. Those are ignored." )
473473 @ ExpectEvents ({
474474 @ Expect (type = TargetCreatedEvent .class , count = 20 ),
475- @ Expect (type = TargetUpdatedEvent .class , count = 20 ),
475+ @ Expect (type = TargetUpdatedEvent .class , count = 20 ),
476476 @ Expect (type = ActionCreatedEvent .class , count = 20 ),
477477 @ Expect (type = DistributionSetCreatedEvent .class , count = 2 ),
478478 @ Expect (type = SoftwareModuleCreatedEvent .class , count = 6 ),
479479 @ Expect (type = DistributionSetUpdatedEvent .class , count = 2 ), // implicit lock
480480 @ Expect (type = SoftwareModuleUpdatedEvent .class , count = 6 ), // implicit lock
481481 @ Expect (type = TargetAssignDistributionSetEvent .class , count = 1 ) })
482482 void assignedDistributionSet () {
483-
484- final List <String > controllerIds = testdataFactory .createTargets (10 ).stream ().map (Target ::getControllerId )
485- .toList ();
486483 final List <Target > onlineAssignedTargets = testdataFactory .createTargets (10 , "2" );
487- controllerIds .addAll (onlineAssignedTargets .stream ().map (Target ::getControllerId ).toList ());
484+ final List <String > controllerIds = Stream .concat (testdataFactory .createTargets (10 ).stream (), onlineAssignedTargets .stream ())
485+ .map (Target ::getControllerId ).toList ();
488486
489487 final DistributionSet ds = testdataFactory .createDistributionSet ();
490488 assignDistributionSet (testdataFactory .createDistributionSet ("2" ), onlineAssignedTargets );
491489
492490 final long current = System .currentTimeMillis ();
493491
494492 final List <Entry <String , Long >> offlineAssignments = controllerIds .stream ()
495- .map (targetId -> (Entry <String , Long >)new SimpleEntry <>(targetId , ds .getId ())).toList ();
493+ .map (targetId -> (Entry <String , Long >) new SimpleEntry <>(targetId , ds .getId ())).toList ();
496494 final List <DistributionSetAssignmentResult > assignmentResults = deploymentManagement
497495 .offlineAssignedDistributionSets (offlineAssignments );
498496 assertThat (assignmentResults ).hasSize (1 );
499- final List <Target > targets = assignmentResults .get (0 ).getAssignedEntity ().stream ().map (Action ::getTarget )
500- .toList ();
497+ final List <Target > targets = assignmentResults .get (0 ).getAssignedEntity ().stream ().map (Action ::getTarget ).toList ();
501498
502499 assertThat (actionRepository .count ()).isEqualTo (20 );
503500 assertThat (findActionsByDistributionSet (PAGE , ds .getId ())).as ("Offline actions are not active" )
@@ -518,7 +515,7 @@ void assignedDistributionSet() {
518515 @ Description ("Offline assign multiple DSs to a single Target in multiassignment mode." )
519516 @ ExpectEvents ({
520517 @ Expect (type = TargetCreatedEvent .class , count = 1 ),
521- @ Expect (type = TargetUpdatedEvent .class , count = 4 ),
518+ @ Expect (type = TargetUpdatedEvent .class , count = 4 ),
522519 @ Expect (type = ActionCreatedEvent .class , count = 4 ),
523520 @ Expect (type = DistributionSetCreatedEvent .class , count = 4 ),
524521 @ Expect (type = SoftwareModuleCreatedEvent .class , count = 12 ),
@@ -554,7 +551,7 @@ void multiOfflineAssignment() {
554551 @ Description ("Verifies that if an account is set to action autoclose running actions in case of a new assigned set get closed and set to CANCELED." )
555552 @ ExpectEvents ({
556553 @ Expect (type = TargetCreatedEvent .class , count = 10 ),
557- @ Expect (type = TargetUpdatedEvent .class , count = 20 ),
554+ @ Expect (type = TargetUpdatedEvent .class , count = 20 ),
558555 @ Expect (type = ActionCreatedEvent .class , count = 20 ),
559556 @ Expect (type = ActionUpdatedEvent .class , count = 10 ),
560557 @ Expect (type = DistributionSetCreatedEvent .class , count = 2 ),
@@ -597,7 +594,7 @@ void assignDistributionSetAndAutoCloseActiveActions() {
597594 @ Description ("If multi-assignment is enabled, verify that the previous Distribution Set assignment is not canceled when a new one is assigned." )
598595 @ ExpectEvents ({
599596 @ Expect (type = TargetCreatedEvent .class , count = 10 ),
600- @ Expect (type = TargetUpdatedEvent .class , count = 20 ),
597+ @ Expect (type = TargetUpdatedEvent .class , count = 20 ),
601598 @ Expect (type = ActionCreatedEvent .class , count = 20 ),
602599 @ Expect (type = DistributionSetCreatedEvent .class , count = 2 ),
603600 @ Expect (type = SoftwareModuleCreatedEvent .class , count = 6 ),
@@ -628,7 +625,7 @@ void previousAssignmentsAreNotCanceledInMultiAssignMode() {
628625 @ Description ("Assign multiple DSs to a single Target in one request in multiassignment mode." )
629626 @ ExpectEvents ({
630627 @ Expect (type = TargetCreatedEvent .class , count = 1 ),
631- @ Expect (type = TargetUpdatedEvent .class , count = 4 ),
628+ @ Expect (type = TargetUpdatedEvent .class , count = 4 ),
632629 @ Expect (type = ActionCreatedEvent .class , count = 4 ),
633630 @ Expect (type = DistributionSetCreatedEvent .class , count = 4 ),
634631 @ Expect (type = SoftwareModuleCreatedEvent .class , count = 12 ),
@@ -665,7 +662,7 @@ void multiAssignmentInOneRequest() {
665662 @ Description ("Assign multiple DSs to single Target in one request in multiAssignment mode and cancel each created action afterwards." )
666663 @ ExpectEvents ({
667664 @ Expect (type = TargetCreatedEvent .class , count = 1 ),
668- @ Expect (type = TargetUpdatedEvent .class , count = 4 ),
665+ @ Expect (type = TargetUpdatedEvent .class , count = 4 ),
669666 @ Expect (type = ActionCreatedEvent .class , count = 4 ),
670667 @ Expect (type = DistributionSetCreatedEvent .class , count = 4 ),
671668 @ Expect (type = SoftwareModuleCreatedEvent .class , count = 12 ),
@@ -689,12 +686,12 @@ void cancelMultiAssignmentActions() {
689686
690687 final List <Long > dsIds = distributionSets .stream ().map (DistributionSet ::getId ).toList ();
691688 targets .forEach (target ->
692- deploymentManagement .findActionsByTarget (target .getControllerId (), PAGE ).forEach (action -> {
693- assertThat (action .getDistributionSet ().getId ()).isIn (dsIds );
694- assertThat (action .getInitiatedBy ()).as ("Should be Initiated by current user" )
695- .isEqualTo (tenantAware .getCurrentUsername ());
696- deploymentManagement .cancelAction (action .getId ());
697- }));
689+ deploymentManagement .findActionsByTarget (target .getControllerId (), PAGE ).forEach (action -> {
690+ assertThat (action .getDistributionSet ().getId ()).isIn (dsIds );
691+ assertThat (action .getInitiatedBy ()).as ("Should be Initiated by current user" )
692+ .isEqualTo (tenantAware .getCurrentUsername ());
693+ deploymentManagement .cancelAction (action .getId ());
694+ }));
698695 }
699696
700697 @ Test
@@ -756,16 +753,16 @@ void assignmentWithConfirmationFlowActive(final boolean confirmationRequired) {
756753 assertThat (getResultingActionCount (results )).isEqualTo (controllerIds .size ());
757754
758755 controllerIds .forEach (controllerId ->
759- deploymentManagement .findActionsByTarget (controllerId , PAGE ).forEach (action -> {
760- assertThat (action .getDistributionSet ().getId ()).isIn (distributionSet .getId ());
761- assertThat (action .getInitiatedBy ()).as ("Should be Initiated by current user" )
762- .isEqualTo (tenantAware .getCurrentUsername ());
763- if (confirmationRequired ) {
764- assertThat (action .getStatus ()).isEqualTo (Status .WAIT_FOR_CONFIRMATION );
765- } else {
766- assertThat (action .getStatus ()).isEqualTo (RUNNING );
767- }
768- }));
756+ deploymentManagement .findActionsByTarget (controllerId , PAGE ).forEach (action -> {
757+ assertThat (action .getDistributionSet ().getId ()).isIn (distributionSet .getId ());
758+ assertThat (action .getInitiatedBy ()).as ("Should be Initiated by current user" )
759+ .isEqualTo (tenantAware .getCurrentUsername ());
760+ if (confirmationRequired ) {
761+ assertThat (action .getStatus ()).isEqualTo (Status .WAIT_FOR_CONFIRMATION );
762+ } else {
763+ assertThat (action .getStatus ()).isEqualTo (RUNNING );
764+ }
765+ }));
769766 }
770767
771768 @ ParameterizedTest
@@ -870,12 +867,12 @@ void verifyConfirmationRequiredFlagHaveNoInfluenceIfFlowIsDeactivated() {
870867 assertThat (getResultingActionCount (results )).isEqualTo (controllerIds .size ());
871868
872869 controllerIds .forEach (controllerId ->
873- deploymentManagement .findActionsByTarget (controllerId , PAGE ).forEach (action -> {
874- assertThat (action .getDistributionSet ().getId ()).isIn (distributionSet .getId ());
875- assertThat (action .getInitiatedBy ()).as ("Should be Initiated by current user" )
876- .isEqualTo (tenantAware .getCurrentUsername ());
877- assertThat (action .getStatus ()).isEqualTo (RUNNING );
878- }));
870+ deploymentManagement .findActionsByTarget (controllerId , PAGE ).forEach (action -> {
871+ assertThat (action .getDistributionSet ().getId ()).isIn (distributionSet .getId ());
872+ assertThat (action .getInitiatedBy ()).as ("Should be Initiated by current user" )
873+ .isEqualTo (tenantAware .getCurrentUsername ());
874+ assertThat (action .getStatus ()).isEqualTo (RUNNING );
875+ }));
879876 }
880877
881878 @ Test
@@ -887,7 +884,7 @@ void verifyConfirmationRequiredFlagHaveNoInfluenceIfFlowIsDeactivated() {
887884 @ Expect (type = DistributionSetUpdatedEvent .class , count = 1 ), // implicit lock
888885 @ Expect (type = SoftwareModuleUpdatedEvent .class , count = 3 ), // implicit lock
889886 @ Expect (type = TargetAssignDistributionSetEvent .class , count = 1 ),
890- @ Expect (type = ActionCreatedEvent .class , count = 2 ),
887+ @ Expect (type = ActionCreatedEvent .class , count = 2 ),
891888 @ Expect (type = TargetUpdatedEvent .class , count = 2 ),
892889 @ Expect (type = MultiActionAssignEvent .class , count = 1 ),
893890 @ Expect (type = TenantConfigurationCreatedEvent .class , count = 1 ) })
@@ -968,7 +965,7 @@ void weightAllowedWhenMultiAssignmentModeNotEnabled() {
968965 @ Expect (type = SoftwareModuleCreatedEvent .class , count = 3 ),
969966 @ Expect (type = DistributionSetUpdatedEvent .class , count = 1 ), // implicit lock
970967 @ Expect (type = SoftwareModuleUpdatedEvent .class , count = 3 ), // implicit lock
971- @ Expect (type = ActionCreatedEvent .class , count = 2 ),
968+ @ Expect (type = ActionCreatedEvent .class , count = 2 ),
972969 @ Expect (type = TargetUpdatedEvent .class , count = 2 ),
973970 @ Expect (type = MultiActionAssignEvent .class , count = 2 ),
974971 @ Expect (type = TenantConfigurationCreatedEvent .class , count = 1 ) })
@@ -1009,7 +1006,7 @@ void weightValidatedAndSaved() {
10091006 @ Expect (type = SoftwareModuleCreatedEvent .class , count = 3 ),
10101007 @ Expect (type = DistributionSetUpdatedEvent .class , count = 1 ), // implicit lock
10111008 @ Expect (type = SoftwareModuleUpdatedEvent .class , count = 3 ), // implicit lock
1012- @ Expect (type = TargetCreatedEvent .class , count = 30 ),
1009+ @ Expect (type = TargetCreatedEvent .class , count = 30 ),
10131010 @ Expect (type = ActionCreatedEvent .class , count = 20 ),
10141011 @ Expect (type = TargetUpdatedEvent .class , count = 20 ) })
10151012 void assignDistributionSet2Targets () {
@@ -1065,7 +1062,7 @@ void assignDistributionSet2Targets() {
10651062 @ Expect (type = SoftwareModuleCreatedEvent .class , count = 2 ),
10661063 @ Expect (type = DistributionSetUpdatedEvent .class , count = 2 ), // implicit lock
10671064 @ Expect (type = SoftwareModuleUpdatedEvent .class , count = 2 ), // implicit lock
1068- @ Expect (type = TargetCreatedEvent .class , count = 10 ),
1065+ @ Expect (type = TargetCreatedEvent .class , count = 10 ),
10691066 @ Expect (type = ActionCreatedEvent .class , count = 10 ),
10701067 @ Expect (type = TargetUpdatedEvent .class , count = 10 ) })
10711068 void failDistributionSetAssigmentThatIsNotComplete () {
@@ -1557,9 +1554,9 @@ void verifyDSAssignmentForMultipleTargetsWithDifferentTargetTypes() {
15571554 deploymentManagement .assignDistributionSets (deploymentRequests );
15581555 implicitLock (ds );
15591556
1560- final DistributionSet assignedDsTarget1 = ((JpaTarget )targetManagement
1557+ final DistributionSet assignedDsTarget1 = ((JpaTarget ) targetManagement
15611558 .getWithDetails (target1 .getControllerId (), "assignedDistributionSet" )).getAssignedDistributionSet ();
1562- final DistributionSet assignedDsTarget2 = ((JpaTarget )targetManagement
1559+ final DistributionSet assignedDsTarget2 = ((JpaTarget ) targetManagement
15631560 .getWithDetails (target1 .getControllerId (), "assignedDistributionSet" )).getAssignedDistributionSet ();
15641561
15651562 assertThat (assignedDsTarget1 ).isEqualTo (ds );
0 commit comments