-
Notifications
You must be signed in to change notification settings - Fork 22
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
[Accelerator 4] Adding event notification endpoint implementation #169
Conversation
if (!parameterMap.isEmpty() && parameterMap.containsKey(EventNotificationEndPointConstants.REQUEST)) { | ||
|
||
requestData = parameterMap.get(EventNotificationEndPointConstants.REQUEST). | ||
toString().replaceAll("\\\\r|\\\\n|\\r|\\n|\\[|]| ", StringUtils.EMPTY); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shall we move this to a constant? "\\\\r|\\\\n|\\r|\\n|\\[|]| "
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FIxed in 1f79f12
//set events to notificationCreationDTO | ||
JSONObject finalNotificationEvents = notificationEvents; | ||
notificationEvents.keySet().forEach(eventName -> { | ||
JSONObject eventInformation = (JSONObject) finalNotificationEvents.get(eventName); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
JSONObject eventInformation = (JSONObject) finalNotificationEvents.get(eventName); | |
JSONObject eventInformation = finalNotificationEvents.getJSONObject(eventName); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FIxed in 1f79f12
} | ||
|
||
//set events to notificationCreationDTO | ||
JSONObject finalNotificationEvents = notificationEvents; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need this variable here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FIxed in 1f79f12
.getErrorDTO(EventNotificationEndPointConstants.INVALID_REQUEST_PAYLOAD, | ||
EventNotificationEndPointConstants.REQUEST_PAYLOAD_ERROR)).build(); | ||
} catch (FSEventNotificationException e) { | ||
return Response.status(e.getStatus()).entity(EventNotificationServiceUtil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missed the log here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FIxed in 1f79f12
@Path("/events") | ||
public class EventPollingEndpoint { | ||
|
||
private static final Log log = LogFactory.getLog(EventCreationEndpoint.class); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
private static final Log log = LogFactory.getLog(EventCreationEndpoint.class); | |
private static final Log log = LogFactory.getLog(EventPollingEndpoint.class); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FIxed in 1f79f12
public class EventPollingEndpoint { | ||
|
||
private static final Log log = LogFactory.getLog(EventCreationEndpoint.class); | ||
private static final EventPollingServiceHandler eventPollingServiceHandler = EventNotificationUtils. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It may get difficult to write unit tests with this approach. may be we could introduce a constructor?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FIxed in 1f79f12
/** | ||
* Events Notification Subscription API Utils. | ||
*/ | ||
public class EventSubscriptionUtils { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's add a private constructor. applicable to other relevant places too
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FIxed in 1f79f12
Adding Event Notification Endpoint Implementation
Issue link: https://github.com/wso2-enterprise/solutions-bfsi/issues/20
Doc Issue: Optional, link issue from documentation repository
Applicable Labels: Spec, product, version, type (specify requested labels)
Development Checklist
Testing Checklist