Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix : update notification-invoke-service to accept list of notificati… #1133

Conversation

raviteja-mandala
Copy link
Contributor

…ons or single notification in the payload

Description

Please include a summary of the changes and the related issue. Please also include relevant motivation and context. List
any dependencies that are required for this change.

  1. Update notification-invoke-service to accept and process an array of notification requests or a single notification request.

Fixes # (issue)

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Chore (no code changes)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also
list any relevant details for your test configuration

  • Test A
  • Test B

Checklist:

  • My code follows the style guidelines of this project
  • My commit message/PR follows the contribution guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

Other information:

List any documentation updates that are needed for the Wiki

@raviteja-mandala raviteja-mandala force-pushed the fix/update-send-notification-service-to-accept-single-event branch from a41e73b to 1d4c851 Compare April 20, 2023 16:32
@sonarcloud
Copy link

sonarcloud bot commented Apr 20, 2023

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell B 3 Code Smells

0.0% 0.0% Coverage
0.0% 0.0% Duplication

@santhosh-challa santhosh-challa merged commit 1e9792b into master Apr 20, 2023
@santhosh-challa santhosh-challa deleted the fix/update-send-notification-service-to-accept-single-event branch April 20, 2023 17:14

Object payloadObj = gson.fromJson(payloadString,Object.class);
if(payloadObj instanceof List){
List<Object> notificationRequestList = gson.fromJson(payloadString,List.class);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@raviteja-mandala @santhosh-challa this line is an error. when sending a object (not an array of events), the code falls through the first if and considers the object to be a list as well

@@ -40,6 +40,26 @@ public String handleRequest(Map<String,Object> event, Context context)
System.out.println("bodyJson--"+bodyJson.toString());
payloadString = bodyJson.getAsJsonObject().get("Sns").getAsJsonObject().get("Message").getAsString();
}

Object payloadObj = gson.fromJson(payloadString,Object.class);
if(payloadObj instanceof List){
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this line here is what allowing the single events to fall through here. This "if" statement is not working as intended for single objects

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants