Skip to content

Commit

Permalink
SSCSSI-438: removed TRIGGER_EVENT_V2_ENABLED (#4253)
Browse files Browse the repository at this point in the history
* SSCSSI-438: removed TRIGGER_EVENT_V2_ENABLED

* Bumping chart version/ fixing aliases

* add logical condition to element click

* refactored code

---------

Co-authored-by: hmcts-jenkins-j-to-z <61242337+hmcts-jenkins-j-to-z[bot]@users.noreply.github.com>
Co-authored-by: gokul-sol <gokul.sridharan@HMCTS.NET>
  • Loading branch information
3 people authored Jan 8, 2025
1 parent 013c08d commit 8b7c43a
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 58 deletions.
2 changes: 1 addition & 1 deletion charts/sscs-tribunals-api/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: v2
name: sscs-tribunals-api
home: https://github.com/hmcts/sscs-tribunals-case-api
version: 0.0.166
version: 0.0.167
description: SSCS Tribunals Case API
maintainers:
- name: HMCTS SSCS Team
Expand Down
3 changes: 1 addition & 2 deletions charts/sscs-tribunals-api/values.preview.template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ java:
SUBMIT_APPEAL_SERVICE_V2_ENABLED: true
PROCESS_EVENT_MESSAGE_V2_ENABLED: true
UPDATE_CASE_ONLY_HEARING_V2_ENABLED: true
TRIGGER_EVENT_V2_ENABLED: true
# START - SSCS-IB RELEASE VARIABLES
DOCUMENTS_ENGLISH_DIRECTION_ISSUED: TB-SCS-GNO-ENG-directions-notice-v2.docx
DOCUMENTS_WELSH_DIRECTION_ISSUED: TB-SCS-GNO-ENG-directions-notice-v2.docx
Expand Down Expand Up @@ -205,7 +204,7 @@ xui-webapp:
- mc-idam-client-secret
- system-user-name
- system-user-password

global:
ccdApiGatewayIngress: http://${SERVICE_NAME}-ccd-api-gw
ccdAdminWebIngress: ${SERVICE_NAME}-ccd-admin-web
Expand Down
1 change: 0 additions & 1 deletion charts/sscs-tribunals-api/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,6 @@ java: &javavalues #This is an anchor to reuse settings in Job mode.
EMAIL_SMTP_TLS_ENABLED: "true"
EMAIL_SMTP_SSL_TRUST: "*"
HEARING_RECORDING_REQUEST_CASE_UPDATE_V2_ENABLED: false
TRIGGER_EVENT_V2_ENABLED: true
SUBMIT_APPEAL_SERVICE_V2_ENABLED: false
HANDLE_CCD_CALLBACKMAP_V2: false
CALLBACK_MAX_RETRY_ATTEMPTS: 3
Expand Down
8 changes: 6 additions & 2 deletions definitions/test/pages/common/homePage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,11 +162,15 @@ export class HomePage {
}

async clickBeforeTabBtn(): Promise<void> {
await this.beforeTabBtn.click();
const isEleVisible = await this.beforeTabBtn.isVisible();

isEleVisible ? await this.beforeTabBtn.click() : logger.info('Before tab button is not visible');
}

async clickAfterTabBtn(): Promise<void> {
await this.afterTabBtn.click();
const isEleVisible = await this.afterTabBtn.isVisible();

isEleVisible ? await this.afterTabBtn.click() : logger.info('After tab button is not visible');
}

async waitForLoadState() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import uk.gov.hmcts.reform.sscs.callback.CallbackHandler;
import uk.gov.hmcts.reform.sscs.ccd.callback.Callback;
Expand All @@ -30,9 +29,6 @@ public class AppealReceivedHandler implements CallbackHandler<SscsCaseData> {

private final IdamService idamService;

@Value("${feature.trigger-eventV2.enabled}")
private boolean isTriggerEventV2Enabled;

@Autowired
public AppealReceivedHandler(CcdService ccdService,
UpdateCcdCaseService updateCcdCaseService,
Expand Down Expand Up @@ -71,26 +67,14 @@ public void handle(CallbackType callbackType, Callback<SscsCaseData> callback) {
log.error("Thread sleep interrupted: " + e.getMessage());
}

if (isTriggerEventV2Enabled) {
log.info("About to update case v2 with appealReceived event for id {}", callback.getCaseDetails().getId());
updateCcdCaseService.triggerCaseEventV2(
callback.getCaseDetails().getId(),
APPEAL_RECEIVED.getCcdType(),
"Appeal received",
"Appeal received event has been triggered from Tribunals API for digital case",
idamService.getIdamTokens()
);
} else {
log.info("About to update case with appealReceived event for id {}", callback.getCaseDetails().getId());
ccdService.updateCase(
callback.getCaseDetails().getCaseData(),
callback.getCaseDetails().getId(),
APPEAL_RECEIVED.getCcdType(),
"Appeal received",
"Appeal received event has been triggered from Evidence Share for digital case",
idamService.getIdamTokens()
);
}
log.info("About to update case v2 with appealReceived event for id {}", callback.getCaseDetails().getId());
updateCcdCaseService.triggerCaseEventV2(
callback.getCaseDetails().getId(),
APPEAL_RECEIVED.getCcdType(),
"Appeal received",
"Appeal received event has been triggered from Tribunals API for digital case",
idamService.getIdamTokens()
);
}

@Override
Expand Down
3 changes: 1 addition & 2 deletions src/main/resources/config/application.properties.old
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,6 @@ feature.citizen-login-service-v2.enabled: ${CITIZEN_LOGIN_SERVICE_V2:false}
feature.add-link-to-other-associated-cases-v2.enabled: ${ADD_LINK_TO_OTHER_ASSOCIATED_CASES_V2:false}
feature.log-selected-properties.enabled: ${LOG_SELECTED_ENVIRONMENT_VARIABLES:false}
feature.hearings-recording-request.case-updateV2.enabled: ${HEARING_RECORDING_REQUEST_CASE_UPDATE_V2_ENABLED:false}
feature.trigger-eventV2.enabled: ${TRIGGER_EVENT_V2_ENABLED:false}
feature.submit-appeal-service-v2.enabled: ${SUBMIT_APPEAL_SERVICE_V2_ENABLED:false}
feature.handle-ccd-callbackMap-v2.enabled: ${HANDLE_CCD_CALLBACKMAP_V2:false}
feature.bypass-hearing-api-service.enabled: ${BYPASS_HEARING_API_SERVICE:false}
Expand Down Expand Up @@ -278,4 +277,4 @@ feign.client.retryer.maxPeriod=2000
feign.client.retryer.maxAttempts=3
retry.hearing-response-update.max-retries=3
# 3 seconds
retry.hearing-response-update.backoff=3000
retry.hearing-response-update.backoff=3000
2 changes: 0 additions & 2 deletions src/main/resources/config/application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -283,8 +283,6 @@ feature:
enabled: ${SCOTTISH_PO_BOX_ENABLED:false}
urgent-hearing:
enabled: ${URGENT_HEARING_ENABLED:false}
trigger-eventV2:
enabled: ${TRIGGER_EVENT_V2_ENABLED:false}
bypass-notifications-service:
enabled: ${BYPASS_NOTIFICATIONS_SERVICE:false}
handle-ccd-callbackMap-v2:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnit;
import org.mockito.junit.MockitoRule;
import org.springframework.test.util.ReflectionTestUtils;
import uk.gov.hmcts.reform.sscs.ccd.callback.CallbackType;
import uk.gov.hmcts.reform.sscs.ccd.domain.EventType;
import uk.gov.hmcts.reform.sscs.ccd.domain.SscsCaseData;
Expand Down Expand Up @@ -79,39 +78,16 @@ public void givenCallbackIsNull_whenCanHandleIsCalled_shouldThrowException() {
handler.canHandle(SUBMITTED, null);
}

@Test
@Parameters({"VALID_APPEAL_CREATED", "DRAFT_TO_VALID_APPEAL_CREATED", "VALID_APPEAL", "INTERLOC_VALID_APPEAL"})
public void givenValidEventAndDigitalCaseAndTriggerEventV2IsDisabled_thenTriggerAppealReceivedEventUsingCcdServiceUpdate(EventType eventType) {
ReflectionTestUtils.setField(handler, "isTriggerEventV2Enabled", false);

handler.handle(SUBMITTED, HandlerHelper.buildTestCallbackForGivenData(SscsCaseData.builder().createdInGapsFrom(READY_TO_LIST.getId()).build(), INTERLOCUTORY_REVIEW_STATE, eventType));

verify(ccdService).updateCase(any(), eq(1L), eq(EventType.APPEAL_RECEIVED.getCcdType()), eq("Appeal received"), eq("Appeal received event has been triggered from Evidence Share for digital case"), any());
}

@Test
@Parameters({"VALID_APPEAL_CREATED", "DRAFT_TO_VALID_APPEAL_CREATED", "VALID_APPEAL", "INTERLOC_VALID_APPEAL"})
public void givenValidEventAndDigitalCaseAndTriggerEventV2IsEnabled_thenTriggerAppealReceivedEventUsingTriggerEventV2(EventType eventType) {
ReflectionTestUtils.setField(handler, "isTriggerEventV2Enabled", true);

handler.handle(SUBMITTED, HandlerHelper.buildTestCallbackForGivenData(SscsCaseData.builder().createdInGapsFrom(READY_TO_LIST.getId()).build(), INTERLOCUTORY_REVIEW_STATE, eventType));

verify(updateCcdCaseService).triggerCaseEventV2(eq(1L), eq(EventType.APPEAL_RECEIVED.getCcdType()), eq("Appeal received"), eq("Appeal received event has been triggered from Tribunals API for digital case"), any());
}

@Test(expected = IllegalStateException.class)
public void givenValidEventAndNonDigitalCaseAndTriggerEventV2IsDisabled_thenThrowException() {
ReflectionTestUtils.setField(handler, "isTriggerEventV2Enabled", false);

handler.handle(SUBMITTED, HandlerHelper.buildTestCallbackForGivenData(SscsCaseData.builder().createdInGapsFrom(VALID_APPEAL.getId()).build(), INTERLOCUTORY_REVIEW_STATE, EventType.VALID_APPEAL_CREATED));

verifyNoInteractions(ccdService, updateCcdCaseService);
}

@Test(expected = IllegalStateException.class)
public void givenValidEventAndNonDigitalCaseAndTriggerEventV2IsEnabled_thenThrowException() {
ReflectionTestUtils.setField(handler, "isTriggerEventV2Enabled", true);

handler.handle(SUBMITTED, HandlerHelper.buildTestCallbackForGivenData(SscsCaseData.builder().createdInGapsFrom(VALID_APPEAL.getId()).build(), INTERLOCUTORY_REVIEW_STATE, EventType.VALID_APPEAL_CREATED));

verifyNoInteractions(ccdService, updateCcdCaseService);
Expand Down

0 comments on commit 8b7c43a

Please sign in to comment.