From a4f33174c4a69ae06960335895e41486f96bd197 Mon Sep 17 00:00:00 2001 From: Alejandro Arroyo Date: Wed, 31 Jan 2024 16:43:49 +0000 Subject: [PATCH 1/9] Adding new casegroup transition --- .../casesvc/state/CaseSvcStateTransitionManagerFactory.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/uk/gov/ons/ctp/response/casesvc/state/CaseSvcStateTransitionManagerFactory.java b/src/main/java/uk/gov/ons/ctp/response/casesvc/state/CaseSvcStateTransitionManagerFactory.java index 6dd345eed..c39942ce3 100644 --- a/src/main/java/uk/gov/ons/ctp/response/casesvc/state/CaseSvcStateTransitionManagerFactory.java +++ b/src/main/java/uk/gov/ons/ctp/response/casesvc/state/CaseSvcStateTransitionManagerFactory.java @@ -13,7 +13,7 @@ import uk.gov.ons.ctp.response.lib.common.state.StateTransitionManagerFactory; /** - * This is the state transition manager actory for the actionsvc. It intended that this will be + * This is the state transition manager factory for the actionsvc. It intended that this will be * refactored into a common framework class and that it initialises each entities manager from * database held transitions. */ @@ -262,6 +262,10 @@ private StateTransitionManager caseStateTransitionManager( CaseGroupStatus.NOLONGERREQUIRED, CategoryDTO.CategoryName.COMPLETED_TO_NOTSTARTED, CaseGroupStatus.NOTSTARTED); + builder.put( + CaseGroupStatus.COMPLETE, + CategoryDTO.CategoryName.COMPLETED_TO_NOTSTARTED, + CaseGroupStatus.NOTSTARTED); // In response-operations-ui, looking at the cases for a survey also shows you an unused IAC // code. By viewing this From 16af572cb381e9186bb24dff0afdafbc1bdadb71 Mon Sep 17 00:00:00 2001 From: ras-rm-pr-bot Date: Thu, 1 Feb 2024 09:50:16 +0000 Subject: [PATCH 2/9] auto patch increment --- _infra/helm/case/Chart.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/_infra/helm/case/Chart.yaml b/_infra/helm/case/Chart.yaml index d3f113b7b..891cc2500 100644 --- a/_infra/helm/case/Chart.yaml +++ b/_infra/helm/case/Chart.yaml @@ -14,8 +14,8 @@ type: application # This is the chart version. This version number should be incremented each time you make changes # to the chart and its templates, including the app version. -version: 12.0.18 +version: 12.0.19 # This is the version number of the application being deployed. This version number should be # incremented each time you make changes to the application. -appVersion: 12.0.18 +appVersion: 12.0.19 From 6c6bf0d9aef6c18bd1783c1c2a2975059cdd415b Mon Sep 17 00:00:00 2001 From: Alejandro Arroyo Date: Mon, 5 Feb 2024 15:25:17 +0000 Subject: [PATCH 3/9] adding test for transition --- .../state/StateTransitionManagerUnitTest.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/test/java/uk/gov/ons/ctp/response/casesvc/state/StateTransitionManagerUnitTest.java b/src/test/java/uk/gov/ons/ctp/response/casesvc/state/StateTransitionManagerUnitTest.java index 185fb6331..eca6689c4 100644 --- a/src/test/java/uk/gov/ons/ctp/response/casesvc/state/StateTransitionManagerUnitTest.java +++ b/src/test/java/uk/gov/ons/ctp/response/casesvc/state/StateTransitionManagerUnitTest.java @@ -580,4 +580,19 @@ public void givenUnknownEligibilityWhenEqLaunchThenComplete() throws CTPExceptio // Then assertEquals(CaseGroupStatus.COMPLETE, destinationState); } + + @Test + public void givenStatusCompleteWhenTransitionCompletedToNotStartedThenStatusNotStarted() + throws CTPException { + // Given + CaseGroupStatus complete = CaseGroupStatus.COMPLETE; + + // When + CaseGroupStatus destinationState = + caseGroupStateMachine.transition( + complete, CategoryDTO.CategoryName.OFFLINE_RESPONSE_PROCESSED); + + // Then + assertEquals(CaseGroupStatus.COMPLETE, destinationState); + } } From 186a83f5d3319f2f4b83df239b49a217ab082d51 Mon Sep 17 00:00:00 2001 From: Alejandro Arroyo Date: Mon, 5 Feb 2024 15:56:24 +0000 Subject: [PATCH 4/9] cleaning up name --- .../response/casesvc/state/StateTransitionManagerUnitTest.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/test/java/uk/gov/ons/ctp/response/casesvc/state/StateTransitionManagerUnitTest.java b/src/test/java/uk/gov/ons/ctp/response/casesvc/state/StateTransitionManagerUnitTest.java index eca6689c4..e887dc5f3 100644 --- a/src/test/java/uk/gov/ons/ctp/response/casesvc/state/StateTransitionManagerUnitTest.java +++ b/src/test/java/uk/gov/ons/ctp/response/casesvc/state/StateTransitionManagerUnitTest.java @@ -582,8 +582,7 @@ public void givenUnknownEligibilityWhenEqLaunchThenComplete() throws CTPExceptio } @Test - public void givenStatusCompleteWhenTransitionCompletedToNotStartedThenStatusNotStarted() - throws CTPException { + public void testCaseGroupTransitionFromCompleteToNotStarted() throws CTPException { // Given CaseGroupStatus complete = CaseGroupStatus.COMPLETE; From ed86c52c4db7203a34142dc13550d85ac03fa239 Mon Sep 17 00:00:00 2001 From: Alejandro Arroyo Date: Mon, 5 Feb 2024 15:58:46 +0000 Subject: [PATCH 5/9] swapping asserts for consistency --- .../state/StateTransitionManagerUnitTest.java | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/test/java/uk/gov/ons/ctp/response/casesvc/state/StateTransitionManagerUnitTest.java b/src/test/java/uk/gov/ons/ctp/response/casesvc/state/StateTransitionManagerUnitTest.java index e887dc5f3..fe1666d6a 100644 --- a/src/test/java/uk/gov/ons/ctp/response/casesvc/state/StateTransitionManagerUnitTest.java +++ b/src/test/java/uk/gov/ons/ctp/response/casesvc/state/StateTransitionManagerUnitTest.java @@ -36,7 +36,7 @@ public void givenCaseStateSampledInitWhenActivatedThenActionable() throws CTPExc caseStateMachine.transition(sampledInit, CaseDTO.CaseEvent.ACTIVATED); // Then - assertEquals(destinationState, CaseState.ACTIONABLE); + assertEquals(CaseState.ACTIONABLE, destinationState); } @Test @@ -49,7 +49,7 @@ public void givenCaseStateReplacementInitWhenReplacedThenActionable() throws CTP caseStateMachine.transition(replacementInit, CaseDTO.CaseEvent.REPLACED); // Then - assertEquals(destinationState, CaseState.ACTIONABLE); + assertEquals(CaseState.ACTIONABLE, destinationState); } @Test @@ -62,7 +62,7 @@ public void givenCaseStateActionableWhenDisabledThenInactionable() throws CTPExc caseStateMachine.transition(actionable, CaseDTO.CaseEvent.DISABLED); // Then - assertEquals(destinationState, CaseState.INACTIONABLE); + assertEquals(CaseState.INACTIONABLE, destinationState); } @Test @@ -75,7 +75,7 @@ public void givenCaseStateActionableWhenDeactivatedThenInactionable() throws CTP caseStateMachine.transition(actionable, CaseDTO.CaseEvent.DEACTIVATED); // Then - assertEquals(destinationState, CaseState.INACTIONABLE); + assertEquals(CaseState.INACTIONABLE, destinationState); } @Test @@ -88,7 +88,7 @@ public void givenCaseStateInactionableWhenDisabledThenInactionable() throws CTPE caseStateMachine.transition(inactionable, CaseDTO.CaseEvent.DISABLED); // Then - assertEquals(destinationState, CaseState.INACTIONABLE); + assertEquals(CaseState.INACTIONABLE, destinationState); } @Test @@ -101,7 +101,7 @@ public void givenCaseStateInactionableWhenDeactivatedThenInactionable() throws C caseStateMachine.transition(inactionable, CaseDTO.CaseEvent.DEACTIVATED); // Then - assertEquals(destinationState, CaseState.INACTIONABLE); + assertEquals(CaseState.INACTIONABLE, destinationState); } @Test @@ -115,7 +115,7 @@ public void givenCaseGroupStateNotStartedWhenCIDownloadedThenInProgress() throws notStarted, CategoryDTO.CategoryName.COLLECTION_INSTRUMENT_DOWNLOADED); // Then - assertEquals(destinationState, CaseGroupStatus.INPROGRESS); + assertEquals(CaseGroupStatus.INPROGRESS, destinationState); } @Test @@ -128,7 +128,7 @@ public void givenCaseGroupStateNotStartedWhenEQLaunchThenInProgress() throws CTP caseGroupStateMachine.transition(notStarted, CategoryDTO.CategoryName.EQ_LAUNCH); // Then - assertEquals(destinationState, CaseGroupStatus.INPROGRESS); + assertEquals(CaseGroupStatus.INPROGRESS, destinationState); } @Test @@ -143,7 +143,7 @@ public void givenCaseGroupStateNotStartedWhenSuccessfulResponseUploadedThenCompl notStarted, CategoryDTO.CategoryName.SUCCESSFUL_RESPONSE_UPLOAD); // Then - assertEquals(destinationState, CaseGroupStatus.COMPLETE); + assertEquals(CaseGroupStatus.COMPLETE, destinationState); } @Test @@ -157,7 +157,7 @@ public void givenCaseGroupStateNotStartedWhenCompletedByPhoneThenCompletedByPhon caseGroupStateMachine.transition(notStarted, CategoryDTO.CategoryName.COMPLETED_BY_PHONE); // Then - assertEquals(destinationState, CaseGroupStatus.COMPLETEDBYPHONE); + assertEquals(CaseGroupStatus.COMPLETEDBYPHONE, destinationState); } @Test @@ -171,7 +171,7 @@ public void givenCaseGroupStateNotStartedWhenNoLongerRequiredThenNoLongerRequire caseGroupStateMachine.transition(notStarted, CategoryDTO.CategoryName.NO_LONGER_REQUIRED); // Then - assertEquals(destinationState, CaseGroupStatus.NOLONGERREQUIRED); + assertEquals(CaseGroupStatus.NOLONGERREQUIRED, destinationState); } @Test @@ -186,7 +186,7 @@ public void givenCaseGroupStateInProgressWhenSuccessfulResponseUploadThenComplet inProgress, CategoryDTO.CategoryName.SUCCESSFUL_RESPONSE_UPLOAD); // Then - assertEquals(destinationState, CaseGroupStatus.COMPLETE); + assertEquals(CaseGroupStatus.COMPLETE, destinationState); } @Test @@ -200,7 +200,7 @@ public void givenCaseGroupStateInProgressWhenCompletedByPhoneThenCompletedByPhon caseGroupStateMachine.transition(inProgress, CategoryDTO.CategoryName.COMPLETED_BY_PHONE); // Then - assertEquals(destinationState, CaseGroupStatus.COMPLETEDBYPHONE); + assertEquals(CaseGroupStatus.COMPLETEDBYPHONE, destinationState); } @Test @@ -214,7 +214,7 @@ public void givenCaseGroupStateInProgressWhenNoLongerRequiredThenNoLongerRequire caseGroupStateMachine.transition(inProgress, CategoryDTO.CategoryName.NO_LONGER_REQUIRED); // Then - assertEquals(destinationState, CaseGroupStatus.NOLONGERREQUIRED); + assertEquals(CaseGroupStatus.NOLONGERREQUIRED, destinationState); } @Test @@ -228,7 +228,7 @@ public void givenCaseGroupStateReopenedWhenCompletedByPhoneThenCompletedByPhone( caseGroupStateMachine.transition(reopened, CategoryDTO.CategoryName.COMPLETED_BY_PHONE); // Then - assertEquals(destinationState, CaseGroupStatus.COMPLETEDBYPHONE); + assertEquals(CaseGroupStatus.COMPLETEDBYPHONE, destinationState); } @Test @@ -242,7 +242,7 @@ public void givenCaseGroupStateReopenedWhenNoLongerRequiredThenNoLongerRequired( caseGroupStateMachine.transition(reopened, CategoryDTO.CategoryName.NO_LONGER_REQUIRED); // Then - assertEquals(destinationState, CaseGroupStatus.NOLONGERREQUIRED); + assertEquals(CaseGroupStatus.NOLONGERREQUIRED, destinationState); } // Social Outcomes From d0a434f9a4f8401ea27bfa5e24cdf949e51ae610 Mon Sep 17 00:00:00 2001 From: Alejandro Arroyo Date: Tue, 6 Feb 2024 09:44:39 +0000 Subject: [PATCH 6/9] making the test change to the right state --- .../casesvc/state/StateTransitionManagerUnitTest.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/test/java/uk/gov/ons/ctp/response/casesvc/state/StateTransitionManagerUnitTest.java b/src/test/java/uk/gov/ons/ctp/response/casesvc/state/StateTransitionManagerUnitTest.java index fe1666d6a..2c1f9a378 100644 --- a/src/test/java/uk/gov/ons/ctp/response/casesvc/state/StateTransitionManagerUnitTest.java +++ b/src/test/java/uk/gov/ons/ctp/response/casesvc/state/StateTransitionManagerUnitTest.java @@ -584,12 +584,12 @@ public void givenUnknownEligibilityWhenEqLaunchThenComplete() throws CTPExceptio @Test public void testCaseGroupTransitionFromCompleteToNotStarted() throws CTPException { // Given - CaseGroupStatus complete = CaseGroupStatus.COMPLETE; + CaseGroupStatus notStarted = CaseGroupStatus.NOTSTARTED; // When CaseGroupStatus destinationState = caseGroupStateMachine.transition( - complete, CategoryDTO.CategoryName.OFFLINE_RESPONSE_PROCESSED); + notStarted, CategoryDTO.CategoryName.OFFLINE_RESPONSE_PROCESSED); // Then assertEquals(CaseGroupStatus.COMPLETE, destinationState); From 72d64c27a3edaca960e6c9ebc3b4632d747ad843 Mon Sep 17 00:00:00 2001 From: ras-rm-pr-bot Date: Tue, 6 Feb 2024 09:50:16 +0000 Subject: [PATCH 7/9] auto patch increment --- _infra/helm/case/Chart.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/_infra/helm/case/Chart.yaml b/_infra/helm/case/Chart.yaml index 891cc2500..f9f5ca1fb 100644 --- a/_infra/helm/case/Chart.yaml +++ b/_infra/helm/case/Chart.yaml @@ -14,8 +14,8 @@ type: application # This is the chart version. This version number should be incremented each time you make changes # to the chart and its templates, including the app version. -version: 12.0.19 +version: 12.0.20 # This is the version number of the application being deployed. This version number should be # incremented each time you make changes to the application. -appVersion: 12.0.19 +appVersion: 12.0.20 From 60fb707d346c489053e85b9a8d9ed8473ffda582 Mon Sep 17 00:00:00 2001 From: Alejandro Arroyo Date: Mon, 12 Feb 2024 09:11:42 +0000 Subject: [PATCH 8/9] updating comment --- .../casesvc/state/CaseSvcStateTransitionManagerFactory.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/uk/gov/ons/ctp/response/casesvc/state/CaseSvcStateTransitionManagerFactory.java b/src/main/java/uk/gov/ons/ctp/response/casesvc/state/CaseSvcStateTransitionManagerFactory.java index c39942ce3..92f32de32 100644 --- a/src/main/java/uk/gov/ons/ctp/response/casesvc/state/CaseSvcStateTransitionManagerFactory.java +++ b/src/main/java/uk/gov/ons/ctp/response/casesvc/state/CaseSvcStateTransitionManagerFactory.java @@ -252,7 +252,7 @@ private StateTransitionManager caseStateTransitionManager( CategoryDTO.CategoryName.NO_LONGER_REQUIRED, CaseGroupStatus.NOLONGERREQUIRED); - // New transition to enable users to change completed by phone and no longer required to not + // New transition to enable users to change completed by phone, no longer required and complete to not // started builder.put( CaseGroupStatus.COMPLETEDBYPHONE, From b06cc4165012a97ab697e653662edb31475c7b23 Mon Sep 17 00:00:00 2001 From: Alejandro Arroyo Date: Mon, 12 Feb 2024 09:46:23 +0000 Subject: [PATCH 9/9] formatting --- .../casesvc/state/CaseSvcStateTransitionManagerFactory.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/uk/gov/ons/ctp/response/casesvc/state/CaseSvcStateTransitionManagerFactory.java b/src/main/java/uk/gov/ons/ctp/response/casesvc/state/CaseSvcStateTransitionManagerFactory.java index 92f32de32..1e7638145 100644 --- a/src/main/java/uk/gov/ons/ctp/response/casesvc/state/CaseSvcStateTransitionManagerFactory.java +++ b/src/main/java/uk/gov/ons/ctp/response/casesvc/state/CaseSvcStateTransitionManagerFactory.java @@ -252,7 +252,8 @@ private StateTransitionManager caseStateTransitionManager( CategoryDTO.CategoryName.NO_LONGER_REQUIRED, CaseGroupStatus.NOLONGERREQUIRED); - // New transition to enable users to change completed by phone, no longer required and complete to not + // New transition to enable users to change completed by phone, no longer required and complete + // to not // started builder.put( CaseGroupStatus.COMPLETEDBYPHONE,