Skip to content

Commit

Permalink
added migration script and code changes for action and actionResultNa… (
Browse files Browse the repository at this point in the history
#2069)

* added migration script and code changes for action and actionResultName changes

* added ActionName and ActionResultName to the builder method

* added unit test for 2 added fields
  • Loading branch information
chengjie8 authored Oct 10, 2023
1 parent bd8530a commit e911514
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
ALTER TABLE "bie_contention_event"
ADD COLUMN "action_name" VARCHAR(255) DEFAULT NULL,
ADD COLUMN "action_result_name" VARCHAR(255) DEFAULT NULL;
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ void testSaveContentionEventRoute() {
assertThat(response.getContentionId()).isEqualTo(testItem.getContentionId());
assertThat(response.getContentionTypeCode()).isEqualTo(testItem.getContentionTypeCode());
assertThat(response.getDiagnosticTypeCode()).isEqualTo(testItem.getDiagnosticTypeCode());
assertThat(response.getActionName()).isEqualTo(testItem.getActionName());
assertThat(response.getActionResultName()).isEqualTo(testItem.getActionResultName());

assertMockEndpointsSatisfied();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ public class BieMessagePayload {
private String contentionTypeCode;
private String contentionClassificationName;
private String diagnosticTypeCode;
private String actionName;
private String actionResultName;
private long notifiedAt;
private long occurredAt;
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ public static BieMessagePayload create() {
.diagnosticTypeCode(faker.lorem().characters(10))
.occurredAt(faker.date().past(60, TimeUnit.DAYS).getTime())
.notifiedAt(faker.date().past(60, TimeUnit.DAYS).getTime())
.actionName(faker.lorem().characters(10))
.actionResultName(faker.lorem().characters(10))
.status(200)
.build();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ private BieMessagePayload handleGenericRecord(ConsumerRecord<String, Object> rec
String KEY_CONTENTION_ID = "ContentionId";
String KEY_CONTENTION_TYPE_CODE = "ContentionTypeCode";
String KEY_EVENT_TIME = "EventTime";
String ACTION_NAME = "ActionName";
String ACTION_RESULT_NAME = "ActionResultName";

return BieMessagePayload.builder()
.eventType(
Expand All @@ -73,6 +75,8 @@ private BieMessagePayload handleGenericRecord(ConsumerRecord<String, Object> rec
.diagnosticTypeCode((String) messageValue.get(KEY_DIAGNOSTIC_TYPE_CODE))
.occurredAt((Long) messageValue.get(KEY_EVENT_TIME))
.notifiedAt(record.timestamp())
.actionName((String) messageValue.get(ACTION_NAME))
.actionResultName((String) messageValue.get(ACTION_RESULT_NAME))
.status(200)
.build();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ void shouldConvertAndSendBiePayload() {
.isEqualTo(payload.getContentionClassificationName());
assertThat(value.getDiagnosticTypeCode()).isEqualTo(payload.getDiagnosticTypeCode());
assertThat(value.getNotifiedAt()).isEqualTo(payload.getNotifiedAt());
assertThat(value.getActionName()).isEqualTo(payload.getActionName());
assertThat(value.getActionResultName()).isEqualTo(payload.getActionResultName());
}
}
}

0 comments on commit e911514

Please sign in to comment.