Skip to content

Commit

Permalink
Status bug fix (#285)
Browse files Browse the repository at this point in the history
* Renaming completed to processed status enum to match the previous data

* adding feature toggle on/off for status

* auto patch increment

Co-authored-by: ras-rm-pr-bot <[email protected]>
  • Loading branch information
creativeappdevamit and ras-rm-pr-bot authored Nov 12, 2021
1 parent 0b37d70 commit f456d9b
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 10 deletions.
4 changes: 2 additions & 2 deletions _infra/helm/collection-exercise/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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.1.8
version: 12.1.9

# 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.1.8
appVersion: 12.1.9
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public class EventDTO {
@Nullable
public enum Status {
SCHEDULED,
COMPLETED,
PROCESSED,
FAILED,
RETRY,
PROCESSING
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -425,15 +425,19 @@ public void processEvents() {
log.with("tag", event.getTag()).info("Event is actionable, beginning processing");
boolean success;
// feature toggled based on if action is deprecated
if (appConfig.getActionSvc().isDeprecated()) {
boolean isActionDeprecated = appConfig.getActionSvc().isDeprecated();
if (isActionDeprecated) {
success = caseSvcClient.processEvent(event.getTag(), exercise.getId());
} else {
success = actionSvcClient.processEvent(event.getTag(), exercise.getId());
}

if (success) {
log.info("Event processing succeeded, setting to PROCESSING state");
event.setStatus(EventDTO.Status.PROCESSING);
// feature toggled based on if action is deprecated
EventDTO.Status status =
isActionDeprecated ? EventDTO.Status.PROCESSING : EventDTO.Status.PROCESSED;
event.setStatus(status);
event.setMessageSent(Timestamp.from(Instant.now()));
} else {
log.error(
Expand All @@ -443,7 +447,7 @@ public void processEvents() {
} else {
log.with("tag", event.getTag())
.debug("Event is not actionable, setting to COMPLETED state");
event.setStatus(EventDTO.Status.COMPLETED);
event.setStatus(EventDTO.Status.PROCESSED);
}
eventRepository.saveAndFlush(event);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,14 +120,14 @@ public void shouldUpdateEventStatus() throws IOException, CTPException, Interrup
+ "\"collectionExerciseID\": \"%s\","
+ "\"tag\": \"mps\","
+ "\"status\":"
+ "\"COMPLETED\""
+ "\"PROCESSED\""
+ "}",
collectionExercise.getId());
PUBSUBEMULATOR.publishMessage(eventStatusUpdate, PUBSUB_TOPIC);
Thread.sleep(5000);
Event finalEvent =
eventRepository.findOneByCollectionExerciseIdAndTag(collectionExercise.getId(), "mps");
Assert.assertEquals(EventDTO.Status.COMPLETED, finalEvent.getStatus());
Assert.assertEquals(EventDTO.Status.PROCESSED, finalEvent.getStatus());
}

private EventDTO createEventDTO(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,7 @@ public void testEventStatusNothingToUpdate() {
.thenReturn(null);
UUID collectionExerciseId = UUID.randomUUID();
CaseActionEventStatusDTO eventStatusDTO = new CaseActionEventStatusDTO();
eventStatusDTO.setStatus(EventDTO.Status.COMPLETED);
eventStatusDTO.setStatus(EventDTO.Status.PROCESSED);
eventStatusDTO.setTag(CaseActionEventStatusDTO.EventTag.mps);
eventStatusDTO.setCollectionExerciseID(collectionExerciseId);
// When
Expand All @@ -533,7 +533,7 @@ public void testEventStatusUpdate() {
.thenReturn(event);
UUID collectionExerciseId = UUID.randomUUID();
CaseActionEventStatusDTO eventStatusDTO = new CaseActionEventStatusDTO();
eventStatusDTO.setStatus(EventDTO.Status.COMPLETED);
eventStatusDTO.setStatus(EventDTO.Status.PROCESSED);
eventStatusDTO.setTag(CaseActionEventStatusDTO.EventTag.mps);
eventStatusDTO.setCollectionExerciseID(collectionExerciseId);
// When
Expand Down

0 comments on commit f456d9b

Please sign in to comment.