Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into fix/opensource/identi…
Browse files Browse the repository at this point in the history
…fier-auth-fix
  • Loading branch information
imesh94 committed Oct 2, 2023
2 parents f4751de + e8e49bd commit c5a9985
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 71 deletions.
39 changes: 0 additions & 39 deletions .github/workflows/check-label.yml

This file was deleted.

38 changes: 30 additions & 8 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,20 @@ on:
# Triggers the workflow on push or pull request events but only for the master branch
pull_request:
branches:
- 'master'
types:
- labeled

- 'main'

jobs:

Build-repo-check:

if: ${{ contains(github.event.pull_request.labels.*.name, 'Ready-to-Build') }}
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up JDK 11
- name: Set up JDK 8
uses: actions/setup-java@v1
with:
java-version: 11
java-version: 8
- uses: actions/checkout@v3
- name: Set up Node 16
uses: actions/setup-node@v3
Expand All @@ -50,8 +46,34 @@ jobs:
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Setup Maven settings.xml
uses: whelk-io/maven-settings-xml-action@v11
with:
mirrors: >
[
{
"id": "wso2-nexus",
"mirrorOf": "wso2-nexus",
"url": "http://maven.wso2.org/nexus/content/groups/wso2-public/"
},
{
"id": "wso2.releases",
"mirrorOf": "wso2.releases",
"url": "http://maven.wso2.org/nexus/content/repositories/releases/"
},
{
"id": "wso2.snapshots",
"mirrorOf": "wso2.snapshots",
"url": "http://maven.wso2.org/nexus/content/repositories/snapshots/"
},
{
"id": "knopflerfish",
"mirrorOf": "knopflerfish",
"url": "http://resources.knopflerfish.org/repo/maven2/release"
}
]
- name: Build with Maven
run: |
export MAVEN_OPTS="-Xmx4g -XX:MaxPermSize=512m"
mvn -B install --file pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ public EventPollingResponse pollEvents(JSONObject eventPollingRequest) {
} catch (OBEventNotificationException e) {
log.error("Invalid client ID", e);
eventPollingResponse.setStatus(EventNotificationConstants.BAD_REQUEST);
eventPollingResponse.setErrorResponse(String.format("A client was not found" +
" for the client id : '%s' in the database.. ",
eventPollingDTO.getClientId()));
eventPollingResponse.setErrorResponse(EventNotificationServiceUtil.getErrorDTO(
EventNotificationConstants.INVALID_REQUEST, String.format("A client was not found" +
" for the client id : '%s' in the database.. ", eventPollingDTO.getClientId())));
return eventPollingResponse;
}

Expand All @@ -80,7 +80,8 @@ public EventPollingResponse pollEvents(JSONObject eventPollingRequest) {
} catch (OBEventNotificationException e) {
log.error("OB Event Notification error" , e);
eventPollingResponse.setStatus(EventNotificationConstants.BAD_REQUEST);
eventPollingResponse.setErrorResponse(e.getMessage());
eventPollingResponse.setErrorResponse(EventNotificationServiceUtil.getErrorDTO(
EventNotificationConstants.INVALID_REQUEST, e.getMessage()));
return eventPollingResponse;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
package com.wso2.openbanking.accelerator.event.notifications.service.persistence;

import com.wso2.openbanking.accelerator.common.persistence.JDBCPersistenceManager;
import com.wso2.openbanking.accelerator.common.util.Generated;
import com.wso2.openbanking.accelerator.event.notifications.service.dao.EventSubscriptionDAO;
import com.wso2.openbanking.accelerator.event.notifications.service.dao.EventSubscriptionDAOImpl;
import com.wso2.openbanking.accelerator.event.notifications.service.dao.EventSubscriptionSqlStatements;
Expand All @@ -32,6 +33,7 @@
/**
* Initializer Class for EventSubscription Service DB.
*/
@Generated(message = "Datastore initializer classes")
public class EventSubscriptionStoreInitializer {

private static Log log = LogFactory.getLog(EventSubscriptionStoreInitializer.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public class EventPollingResponse {

private String status;
private JSONObject responseBody;
private String errorResponse;
private Object errorResponse;

public String getStatus() {
return status;
Expand All @@ -45,11 +45,11 @@ public void setResponseBody(JSONObject responseBody) {
this.responseBody = responseBody;
}

public String getErrorResponse() {
public Object getErrorResponse() {
return errorResponse;
}

public void setErrorResponse(String errorResponse) {
public void setErrorResponse(Object errorResponse) {
this.errorResponse = errorResponse;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -97,25 +97,17 @@ public static Response mapEventCreationServiceResponse(EventCreationResponse eve
public static Response mapEventPollingServiceResponse(EventPollingResponse eventPollingResponse) {

if (EventNotificationConstants.OK.equals(eventPollingResponse.getStatus())) {

return Response.status(Response.Status.OK).entity(eventPollingResponse.getResponseBody()).build();

} else if (EventNotificationConstants.NOT_FOUND.equals(eventPollingResponse.getStatus())) {

return Response.status(Response.Status.NOT_FOUND).entity(EventNotificationUtils.getErrorDTO(
EventNotificationEndPointConstants.NOTIFICATIONS_NOT_FOUND,
EventNotificationEndPointConstants.NOT_FOUND_RESPONSE)).build();

} else if (EventNotificationConstants.BAD_REQUEST.equals(eventPollingResponse.getStatus())) {

return Response.status(Response.Status.BAD_REQUEST).entity(EventNotificationUtils.getErrorDTO(
EventNotificationEndPointConstants.INVALID_REQUEST,
eventPollingResponse.getErrorResponse())).build();
} else {
if (eventPollingResponse.getErrorResponse() instanceof String) {
return Response.status(Response.Status.BAD_REQUEST).entity(EventNotificationUtils.getErrorDTO(
EventNotificationEndPointConstants.INVALID_REQUEST,
eventPollingResponse.getErrorResponse().toString())).build();
} else {
return Response.status(Response.Status.BAD_REQUEST).entity(eventPollingResponse.getErrorResponse())
.build();
}
}

return Response.status(Response.Status.BAD_REQUEST).entity(EventNotificationUtils.getErrorDTO(
EventNotificationEndPointConstants.INVALID_REQUEST,
EventNotificationEndPointConstants.POLLING_ERROR_RESPONSE)).build();
}

/**
Expand Down

0 comments on commit c5a9985

Please sign in to comment.