From d06559f7e1a9c6966d28ed4dcd11fa6763ba9c6a Mon Sep 17 00:00:00 2001 From: "internal\\HN03022" Date: Wed, 8 Nov 2023 10:23:21 +0100 Subject: [PATCH 1/9] Improved response handling none json error payload --- .../client/events/HttpApiServiceImpl.java | 271 +++++++++--------- 1 file changed, 136 insertions(+), 135 deletions(-) diff --git a/src/main/java/com/github/dikhan/pagerduty/client/events/HttpApiServiceImpl.java b/src/main/java/com/github/dikhan/pagerduty/client/events/HttpApiServiceImpl.java index cb2f370..3bd0363 100644 --- a/src/main/java/com/github/dikhan/pagerduty/client/events/HttpApiServiceImpl.java +++ b/src/main/java/com/github/dikhan/pagerduty/client/events/HttpApiServiceImpl.java @@ -1,149 +1,150 @@ package com.github.dikhan.pagerduty.client.events; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +import org.apache.commons.io.IOUtils; +import org.apache.http.HttpHost; +import org.apache.http.HttpStatus; +import org.json.JSONObject; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import com.github.dikhan.pagerduty.client.events.domain.ChangeEvent; import com.github.dikhan.pagerduty.client.events.domain.EventResult; import com.github.dikhan.pagerduty.client.events.domain.PagerDutyEvent; import com.github.dikhan.pagerduty.client.events.exceptions.NotifyEventException; -import com.github.dikhan.pagerduty.client.events.utils.JsonUtils; import com.mashape.unirest.http.HttpResponse; -import com.mashape.unirest.http.JsonNode; import com.mashape.unirest.http.Unirest; import com.mashape.unirest.http.exceptions.UnirestException; import com.mashape.unirest.request.HttpRequestWithBody; -import org.apache.commons.io.IOUtils; -import org.apache.http.HttpHost; -import org.apache.http.HttpStatus; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.io.IOException; -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; public class HttpApiServiceImpl implements ApiService { - private static final Logger log = LoggerFactory.getLogger(HttpApiServiceImpl.class); - - private static final int RATE_LIMIT_STATUS_CODE = 429; - - // The time between retries for each different result status codes. - private static final Map RETRY_WAIT_TIME_MILLISECONDS = new HashMap<>(); - static { - // "quickly" retrying in case of 500s to recover from flapping errors - RETRY_WAIT_TIME_MILLISECONDS.put(HttpStatus.SC_INTERNAL_SERVER_ERROR, new long[]{500, 1_000, 2_000}); - // "slowly" retrying from Rate Limit to give it time to recover - RETRY_WAIT_TIME_MILLISECONDS.put(RATE_LIMIT_STATUS_CODE, new long[]{10_000, 25_000, 55_000}); - } - - private final String eventApi; - private final String changeEventApi; - private final boolean doRetries; - - public HttpApiServiceImpl(String eventApi, String changeEventApi, boolean doRetries) { - this.eventApi = eventApi; - this.changeEventApi = changeEventApi; - this.doRetries = doRetries; - initUnirest(); - } - - public HttpApiServiceImpl(String eventApi, String changeEventApi, String proxyHost, Integer proxyPort, boolean doRetries) { - this.eventApi = eventApi; - this.changeEventApi = changeEventApi; - this.doRetries = doRetries; - initUnirestWithProxy(proxyHost, proxyPort); - } - - private void initUnirest() { - Unirest.setObjectMapper(new JacksonObjectMapper()); - } - - private void initUnirestWithProxy(String proxyHost, Integer proxyPort) { - initUnirest(); - Unirest.setProxy(new HttpHost(proxyHost, proxyPort)); - } - - public EventResult notifyEvent(PagerDutyEvent event) throws NotifyEventException { - if (event instanceof ChangeEvent) { - return notifyEvent(event, changeEventApi, 0); - } - return notifyEvent(event, eventApi, 0); - } - - private EventResult notifyEvent(PagerDutyEvent event, String api, int retryCount) throws NotifyEventException { - try { - HttpRequestWithBody request = Unirest.post(api) - .header("Content-Type", "application/json") - .header("Accept", "application/json"); - request.body(event); - HttpResponse jsonResponse = request.asJson(); - - if (log.isDebugEnabled()) { - log.debug(IOUtils.toString(jsonResponse.getRawBody())); - // A reset, so we can get the contents from the body that were dumped in the log before - jsonResponse.getRawBody().reset(); - } - - int responseStatus = jsonResponse.getStatus(); - switch(responseStatus) { - case HttpStatus.SC_OK: - case HttpStatus.SC_CREATED: - case HttpStatus.SC_ACCEPTED: - return EventResult.successEvent(JsonUtils.getPropertyValue(jsonResponse, "status"), JsonUtils.getPropertyValue(jsonResponse, "message"), JsonUtils.getPropertyValue(jsonResponse, "dedup_key")); - case HttpStatus.SC_BAD_REQUEST: - return EventResult.errorEvent(JsonUtils.getPropertyValue(jsonResponse, "status"), JsonUtils.getPropertyValue(jsonResponse, "message"), JsonUtils.getArrayValue(jsonResponse, "errors")); - case RATE_LIMIT_STATUS_CODE: - case HttpStatus.SC_INTERNAL_SERVER_ERROR: - if (doRetries) { - return handleRetries(event, api, retryCount, jsonResponse, responseStatus); - } else { - return EventResult.errorEvent(String.valueOf(responseStatus), "", IOUtils.toString(jsonResponse.getRawBody())); - } - default: - return EventResult.errorEvent(String.valueOf(responseStatus), "", IOUtils.toString(jsonResponse.getRawBody())); - } - } catch (UnirestException | IOException e) { - throw new NotifyEventException(e); - } - } - - private EventResult handleRetries(PagerDutyEvent event, String api, int retryCount, HttpResponse jsonResponse, int responseStatus) throws IOException, NotifyEventException { - long[] retryDelays = RETRY_WAIT_TIME_MILLISECONDS.get(responseStatus); - - int maxRetries = retryDelays.length; - if (retryCount == maxRetries) { - log.debug("Received a {} response. Exhausted all the possibilities to retry.", responseStatus); - return EventResult.errorEvent(String.valueOf(responseStatus), "", IOUtils.toString(jsonResponse.getRawBody())); - } - - log.debug("Received a {} response. Will retry again. ({}/{})", responseStatus, retryCount, maxRetries); - - try { - Thread.sleep(retryDelays[retryCount]); - } - catch (InterruptedException e) { - Thread.currentThread().interrupt(); - } - - return notifyEvent(event, api, retryCount + 1); - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - - HttpApiServiceImpl that = (HttpApiServiceImpl) o; - - return doRetries == that.doRetries && Objects.equals(eventApi, that.eventApi) && Objects.equals(changeEventApi, that.changeEventApi); - } - - @Override - public int hashCode() { - return Objects.hash(eventApi, changeEventApi, doRetries); - } + private static final Logger log = LoggerFactory.getLogger(HttpApiServiceImpl.class); + + private static final int RATE_LIMIT_STATUS_CODE = 429; + + // The time between retries for each different result status codes. + private static final Map RETRY_WAIT_TIME_MILLISECONDS = new HashMap<>(); + static { + // "quickly" retrying in case of 500s to recover from flapping errors + RETRY_WAIT_TIME_MILLISECONDS.put(HttpStatus.SC_INTERNAL_SERVER_ERROR, new long[] { 500, 1_000, 2_000 }); + // "slowly" retrying from Rate Limit to give it time to recover + RETRY_WAIT_TIME_MILLISECONDS.put(RATE_LIMIT_STATUS_CODE, new long[] { 10_000, 25_000, 55_000 }); + } + + private final String eventApi; + private final String changeEventApi; + private final boolean doRetries; + + public HttpApiServiceImpl(String eventApi, String changeEventApi, boolean doRetries) { + this.eventApi = eventApi; + this.changeEventApi = changeEventApi; + this.doRetries = doRetries; + initUnirest(); + } + + public HttpApiServiceImpl(String eventApi, String changeEventApi, String proxyHost, Integer proxyPort, boolean doRetries) { + this.eventApi = eventApi; + this.changeEventApi = changeEventApi; + this.doRetries = doRetries; + initUnirestWithProxy(proxyHost, proxyPort); + } + + private void initUnirest() { + Unirest.setObjectMapper(new JacksonObjectMapper()); + } + + private void initUnirestWithProxy(String proxyHost, Integer proxyPort) { + initUnirest(); + Unirest.setProxy(new HttpHost(proxyHost, proxyPort)); + } + + public EventResult notifyEvent(PagerDutyEvent event) throws NotifyEventException { + if (event instanceof ChangeEvent) { + return notifyEvent(event, changeEventApi, 0); + } + return notifyEvent(event, eventApi, 0); + } + + private EventResult notifyEvent(PagerDutyEvent event, String api, int retryCount) throws NotifyEventException { + try { + HttpRequestWithBody request = Unirest.post(api) + .header("Content-Type", "application/json") // + .header("Accept", "application/json"); + request.body(event); + HttpResponse httpResponse = request.asString(); + + if (log.isDebugEnabled()) { + log.debug(IOUtils.toString(httpResponse.getRawBody())); + // A reset, so we can get the contents from the body that were dumped in the log before + httpResponse.getRawBody().reset(); + } + + int responseStatus = httpResponse.getStatus(); + switch (responseStatus) { + case HttpStatus.SC_OK: + case HttpStatus.SC_CREATED: + case HttpStatus.SC_ACCEPTED: + JSONObject jsonObject = new JSONObject(httpResponse.getBody()); + return EventResult.successEvent(jsonObject.getString("status"), jsonObject.getString("message"), jsonObject.getString("dedup_key")); + case HttpStatus.SC_BAD_REQUEST: + return EventResult.errorEvent(httpResponse.getStatusText(), httpResponse.getBody(), IOUtils.toString(httpResponse.getRawBody())); + case RATE_LIMIT_STATUS_CODE: + case HttpStatus.SC_INTERNAL_SERVER_ERROR: + if (doRetries) { + return handleRetries(event, api, retryCount, httpResponse, responseStatus); + } else { + return EventResult.errorEvent(String.valueOf(responseStatus), "", IOUtils.toString(httpResponse.getRawBody())); + } + default: + return EventResult.errorEvent(String.valueOf(responseStatus), "", IOUtils.toString(httpResponse.getRawBody())); + } + } catch (UnirestException | IOException e) { + throw new NotifyEventException(e); + } + } + + private EventResult handleRetries(PagerDutyEvent event, String api, int retryCount, HttpResponse httpResponse, + int responseStatus) throws IOException, NotifyEventException { + long[] retryDelays = RETRY_WAIT_TIME_MILLISECONDS.get(responseStatus); + + int maxRetries = retryDelays.length; + if (retryCount == maxRetries) { + log.debug("Received a {} response. Exhausted all the possibilities to retry.", responseStatus); + return EventResult.errorEvent(String.valueOf(responseStatus), "", IOUtils.toString(httpResponse.getRawBody())); + } + + log.debug("Received a {} response. Will retry again. ({}/{})", responseStatus, retryCount, maxRetries); + + try { + Thread.sleep(retryDelays[retryCount]); + } catch (InterruptedException e) { + Thread.currentThread().interrupt(); + } + + return notifyEvent(event, api, retryCount + 1); + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + + HttpApiServiceImpl that = (HttpApiServiceImpl) o; + + return doRetries == that.doRetries && Objects.equals(eventApi, that.eventApi) && Objects.equals(changeEventApi, that.changeEventApi); + } + + @Override + public int hashCode() { + return Objects.hash(eventApi, changeEventApi, doRetries); + } } \ No newline at end of file From 309b0864cbbfe7bb70bae496b511a224eeac1ced Mon Sep 17 00:00:00 2001 From: "internal\\HN03022" Date: Wed, 8 Nov 2023 16:41:31 +0100 Subject: [PATCH 2/9] PD doesn't return json payload with http 400 --- .../client/events/HttpApiServiceImpl.java | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/github/dikhan/pagerduty/client/events/HttpApiServiceImpl.java b/src/main/java/com/github/dikhan/pagerduty/client/events/HttpApiServiceImpl.java index 3bd0363..5256bb1 100644 --- a/src/main/java/com/github/dikhan/pagerduty/client/events/HttpApiServiceImpl.java +++ b/src/main/java/com/github/dikhan/pagerduty/client/events/HttpApiServiceImpl.java @@ -8,6 +8,7 @@ import org.apache.commons.io.IOUtils; import org.apache.http.HttpHost; import org.apache.http.HttpStatus; +import org.json.JSONException; import org.json.JSONObject; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -16,6 +17,7 @@ import com.github.dikhan.pagerduty.client.events.domain.EventResult; import com.github.dikhan.pagerduty.client.events.domain.PagerDutyEvent; import com.github.dikhan.pagerduty.client.events.exceptions.NotifyEventException; +import com.github.dikhan.pagerduty.client.events.utils.JsonUtils; import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; import com.mashape.unirest.http.exceptions.UnirestException; @@ -89,10 +91,20 @@ private EventResult notifyEvent(PagerDutyEvent event, String api, int retryCount case HttpStatus.SC_OK: case HttpStatus.SC_CREATED: case HttpStatus.SC_ACCEPTED: - JSONObject jsonObject = new JSONObject(httpResponse.getBody()); - return EventResult.successEvent(jsonObject.getString("status"), jsonObject.getString("message"), jsonObject.getString("dedup_key")); + JSONObject jsonBody = new JSONObject(httpResponse.getBody()); + return EventResult.successEvent(JsonUtils.getPropertyValue(jsonBody, "status"), + JsonUtils.getPropertyValue(jsonBody, "message"), + JsonUtils.getPropertyValue(jsonBody, "dedup_key")); case HttpStatus.SC_BAD_REQUEST: - return EventResult.errorEvent(httpResponse.getStatusText(), httpResponse.getBody(), IOUtils.toString(httpResponse.getRawBody())); + try { + jsonBody = new JSONObject(httpResponse.getBody()); + return EventResult.errorEvent(JsonUtils.getPropertyValue(jsonBody, "status"), + JsonUtils.getPropertyValue(jsonBody, "message"), JsonUtils.getArrayValue(jsonBody, "errors")); + } catch (JSONException e) { + // No Json payload returned + return EventResult.errorEvent(httpResponse.getStatusText(), httpResponse.getBody(), IOUtils.toString(httpResponse.getRawBody())); + // return EventResult.errorEvent(String.valueOf(responseStatus), "", IOUtils.toString(httpResponse.getRawBody())); + } case RATE_LIMIT_STATUS_CODE: case HttpStatus.SC_INTERNAL_SERVER_ERROR: if (doRetries) { From fea46e83f1d8c3a61e4bfc82fe25465f82d47f0a Mon Sep 17 00:00:00 2001 From: "internal\\HN03022" Date: Wed, 8 Nov 2023 16:42:00 +0100 Subject: [PATCH 3/9] Added helpers --- .../client/events/utils/JsonUtils.java | 41 +++++++++++++------ 1 file changed, 29 insertions(+), 12 deletions(-) diff --git a/src/main/java/com/github/dikhan/pagerduty/client/events/utils/JsonUtils.java b/src/main/java/com/github/dikhan/pagerduty/client/events/utils/JsonUtils.java index d2549c3..c6b058c 100644 --- a/src/main/java/com/github/dikhan/pagerduty/client/events/utils/JsonUtils.java +++ b/src/main/java/com/github/dikhan/pagerduty/client/events/utils/JsonUtils.java @@ -1,23 +1,40 @@ package com.github.dikhan.pagerduty.client.events.utils; +import org.json.JSONObject; + import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.JsonNode; public class JsonUtils { - public static String getPropertyValue(HttpResponse jsonResponse, String key) { - if (jsonResponse.getBody().getObject().has(key)) { - return jsonResponse.getBody().getObject().getString(key); - } + public static String getPropertyValue(HttpResponse jsonResponse, String key) { + if (jsonResponse.getBody().getObject().has(key)) { + return jsonResponse.getBody().getObject().getString(key); + } + + return null; + } - return null; - } + public static String getArrayValue(HttpResponse jsonResponse, String key) { + if (jsonResponse.getBody().getObject().has(key)) { + return jsonResponse.getBody().getObject().getJSONArray(key).toString(); + } - public static String getArrayValue(HttpResponse jsonResponse, String key) { - if (jsonResponse.getBody().getObject().has(key)) { - return jsonResponse.getBody().getObject().getJSONArray(key).toString(); - } + return null; + } + + // Helpers for JSONObject + public static String getPropertyValue(JSONObject jsonResponse, String key) { + if (jsonResponse.has(key)) { + return jsonResponse.getString(key); + } + return null; + } - return null; - } + public static String getArrayValue(JSONObject jsonResponse, String key) { + if (jsonResponse.has(key)) { + return jsonResponse.getJSONArray(key).toString(); + } + return null; + } } From 10cdb9467dc0ae9a196fe098a6380134cce20a52 Mon Sep 17 00:00:00 2001 From: "internal\\HN03022" Date: Wed, 8 Nov 2023 17:17:14 +0100 Subject: [PATCH 4/9] Added notify...ServerInvalidRoutingKey test --- .../client/events/HttpApiServiceImplTest.java | 470 +++++++++--------- 1 file changed, 235 insertions(+), 235 deletions(-) diff --git a/src/test/java/com/github/dikhan/pagerduty/client/events/HttpApiServiceImplTest.java b/src/test/java/com/github/dikhan/pagerduty/client/events/HttpApiServiceImplTest.java index 02ef0c3..7ea9c89 100644 --- a/src/test/java/com/github/dikhan/pagerduty/client/events/HttpApiServiceImplTest.java +++ b/src/test/java/com/github/dikhan/pagerduty/client/events/HttpApiServiceImplTest.java @@ -1,10 +1,10 @@ package com.github.dikhan.pagerduty.client.events; -import com.github.dikhan.pagerduty.client.events.domain.ChangeEvent; -import com.github.dikhan.pagerduty.client.events.domain.EventResult; -import com.github.dikhan.pagerduty.client.events.domain.Incident; -import com.github.dikhan.pagerduty.client.events.utils.EventHelper; -import com.github.dikhan.pagerduty.client.events.utils.MockServerUtils; +import static com.github.dikhan.pagerduty.client.events.utils.ChangeEventHelper.prepareSampleChangeEvent; +import static com.github.dikhan.pagerduty.client.events.utils.IncidentHelper.prepareSampleTriggerIncident; +import static org.assertj.core.api.Assertions.assertThat; + +import java.net.UnknownHostException; import org.junit.After; import org.junit.Before; @@ -13,310 +13,310 @@ import org.mockserver.client.server.MockServerClient; import org.mockserver.junit.MockServerRule; -import java.net.UnknownHostException; - -import static com.github.dikhan.pagerduty.client.events.utils.IncidentHelper.prepareSampleTriggerIncident; -import static com.github.dikhan.pagerduty.client.events.utils.ChangeEventHelper.prepareSampleChangeEvent; -import static org.assertj.core.api.Assertions.assertThat; +import com.github.dikhan.pagerduty.client.events.domain.ChangeEvent; +import com.github.dikhan.pagerduty.client.events.domain.EventResult; +import com.github.dikhan.pagerduty.client.events.domain.Incident; +import com.github.dikhan.pagerduty.client.events.utils.EventHelper; +import com.github.dikhan.pagerduty.client.events.utils.MockServerUtils; public class HttpApiServiceImplTest { - @Rule - public MockServerRule mockServerRule = new MockServerRule(this); - private MockServerClient mockServerClient; + @Rule + public MockServerRule mockServerRule = new MockServerRule(this); + private MockServerClient mockServerClient; + + private final String MOCK_PAGER_DUTY_HOSTNAME = "localhost"; + private final int MOCK_PAGER_DUTY_PORT = mockServerRule.getPort(); + + private final String EVENT_END_POINT = "/v2/enqueue"; + private final String EVENT_API = "http://" + MOCK_PAGER_DUTY_HOSTNAME + ":" + MOCK_PAGER_DUTY_PORT + "/" + EVENT_END_POINT; - private final String MOCK_PAGER_DUTY_HOSTNAME = "localhost"; - private final int MOCK_PAGER_DUTY_PORT = mockServerRule.getPort(); + private final String CHANGE_EVENT_END_POINT = "/v2/change/enqueue"; + private final String CHANGE_EVENT_API = "http://" + MOCK_PAGER_DUTY_HOSTNAME + ":" + MOCK_PAGER_DUTY_PORT + "/" + + CHANGE_EVENT_END_POINT; - private final String EVENT_END_POINT = "/v2/enqueue"; - private final String EVENT_API = "http://" + MOCK_PAGER_DUTY_HOSTNAME + ":" + MOCK_PAGER_DUTY_PORT + "/" + EVENT_END_POINT; + private HttpApiServiceImpl httpApiServiceImpl; + private HttpApiServiceImpl httpApiServiceImplWithRetriesEnabled; - private final String CHANGE_EVENT_END_POINT = "/v2/change/enqueue"; - private final String CHANGE_EVENT_API = "http://" + MOCK_PAGER_DUTY_HOSTNAME + ":" + MOCK_PAGER_DUTY_PORT + "/" + CHANGE_EVENT_END_POINT; + @Before + public void setUp() throws UnknownHostException { + httpApiServiceImpl = new HttpApiServiceImpl(EVENT_API, CHANGE_EVENT_API, false); + httpApiServiceImplWithRetriesEnabled = new HttpApiServiceImpl(EVENT_API, CHANGE_EVENT_API, true); + } - private HttpApiServiceImpl httpApiServiceImpl; - private HttpApiServiceImpl httpApiServiceImplWithRetriesEnabled; + @After + public void afterEach() { + mockServerClient.reset(); + } - @Before - public void setUp() throws UnknownHostException { - httpApiServiceImpl = new HttpApiServiceImpl(EVENT_API, CHANGE_EVENT_API, false); - httpApiServiceImplWithRetriesEnabled = new HttpApiServiceImpl(EVENT_API, CHANGE_EVENT_API, true); - } + @Test + public void notifyIncidentEventAndSuccessfulResponseFromUpstreamServer() throws Exception { + String dedupKey = "DEDUP_KEY"; + Incident incident = prepareSampleTriggerIncident("SERVICE_KEY"); + MockServerUtils.prepareMockServerToReceiveGivenEventAndReplyWithSuccessfulResponse(mockServerClient, incident, + EventHelper.successEvent(dedupKey)); - @After - public void afterEach() { - mockServerClient.reset(); - } + EventResult eventResult = httpApiServiceImpl.notifyEvent(incident); + EventResult expectedResult = EventHelper.successEvent(dedupKey); - @Test - public void notifyIncidentEventAndSuccessfulResponseFromUpstreamServer() throws Exception { - String dedupKey = "DEDUP_KEY"; - Incident incident = prepareSampleTriggerIncident("SERVICE_KEY"); - MockServerUtils - .prepareMockServerToReceiveGivenEventAndReplyWithSuccessfulResponse(mockServerClient, incident, - EventHelper.successEvent(dedupKey)); + assertThat(eventResult).isEqualTo(expectedResult); + } - EventResult eventResult = httpApiServiceImpl.notifyEvent(incident); - EventResult expectedResult = EventHelper.successEvent(dedupKey); + @Test + public void notifyIncidentEventAndAcceptedResponseFromUpstreamServer() throws Exception { + String dedupKey = "DEDUP_KEY"; + Incident incident = prepareSampleTriggerIncident("SERVICE_KEY"); + MockServerUtils.prepareMockServerToReceiveGivenEventAndReplyWithAcceptedResponse(mockServerClient, incident, + EventHelper.successEvent(dedupKey)); - assertThat(eventResult).isEqualTo(expectedResult); - } + EventResult eventResult = httpApiServiceImpl.notifyEvent(incident); + EventResult expectedResult = EventHelper.successEvent(dedupKey); - @Test - public void notifyIncidentEventAndAcceptedResponseFromUpstreamServer() throws Exception { - String dedupKey = "DEDUP_KEY"; - Incident incident = prepareSampleTriggerIncident("SERVICE_KEY"); - MockServerUtils - .prepareMockServerToReceiveGivenEventAndReplyWithAcceptedResponse(mockServerClient, incident, - EventHelper.successEvent(dedupKey)); + assertThat(eventResult).isEqualTo(expectedResult); + } - EventResult eventResult = httpApiServiceImpl.notifyEvent(incident); - EventResult expectedResult = EventHelper.successEvent(dedupKey); + @Test + public void notifyIncidentEventAndErrorResponseFromUpstreamServer() throws Exception { + Incident incident = prepareSampleTriggerIncident("SERVICE_KEY"); + MockServerUtils.prepareMockServerToReceiveEventAndReplyWithWithErrorResponse(mockServerClient, incident, EventHelper.errorEvent()); - assertThat(eventResult).isEqualTo(expectedResult); - } + EventResult eventResult = httpApiServiceImpl.notifyEvent(incident); + EventResult expectedResult = EventHelper.errorEvent(); - @Test - public void notifyIncidentEventAndErrorResponseFromUpstreamServer() throws Exception { - Incident incident = prepareSampleTriggerIncident("SERVICE_KEY"); - MockServerUtils.prepareMockServerToReceiveEventAndReplyWithWithErrorResponse(mockServerClient, incident, - EventHelper.errorEvent()); + assertThat(eventResult).isEqualTo(expectedResult); + } - EventResult eventResult = httpApiServiceImpl.notifyEvent(incident); - EventResult expectedResult = EventHelper.errorEvent(); + @Test + public void notifyIncidentEventAndErrorResponseFromUpstreamServerInvalidRoutingKey() throws Exception { + Incident incident = prepareSampleTriggerIncident("SERVICE_KEY"); + MockServerUtils.prepareMockServerToReceiveEventAndReplyWithWithErrorResponseInvalidRoutingKey(mockServerClient, incident, + EventHelper.errorEvent()); - assertThat(eventResult).isEqualTo(expectedResult); - } + EventResult eventResult = httpApiServiceImpl.notifyEvent(incident); + EventResult expectedResult = EventHelper.errorEventInvalidRoutingKey(); - @Test - public void notifyIncidentEventAnUnexpectedErrorResponseFromUpstreamServer() throws Exception { - Incident incident = prepareSampleTriggerIncident("SERVICE_KEY"); - MockServerUtils.prepareMockServerWithUnexpectedErrorResponse(mockServerClient, incident); + assertThat(eventResult).isEqualTo(expectedResult); + } - EventResult eventResult = httpApiServiceImpl.notifyEvent(incident); - EventResult expectedResult = EventHelper.unexpectedErrorEvent(); + @Test + public void notifyIncidentEventAnUnexpectedErrorResponseFromUpstreamServer() throws Exception { + Incident incident = prepareSampleTriggerIncident("SERVICE_KEY"); + MockServerUtils.prepareMockServerWithUnexpectedErrorResponse(mockServerClient, incident); - assertThat(eventResult).isEqualTo(expectedResult); - } + EventResult eventResult = httpApiServiceImpl.notifyEvent(incident); + EventResult expectedResult = EventHelper.unexpectedErrorEvent(); + assertThat(eventResult).isEqualTo(expectedResult); + } - @Test - public void notifyIncidentEventAnServerInternalErrorResponseFromUpstreamServer() throws Exception { - Incident incident = prepareSampleTriggerIncident("SERVICE_KEY"); - MockServerUtils.prepareMockServerWithInternalServerErrorResponse(mockServerClient, incident); + @Test + public void notifyIncidentEventAnServerInternalErrorResponseFromUpstreamServer() throws Exception { + Incident incident = prepareSampleTriggerIncident("SERVICE_KEY"); + MockServerUtils.prepareMockServerWithInternalServerErrorResponse(mockServerClient, incident); - EventResult eventResult = httpApiServiceImpl.notifyEvent(incident); - EventResult expectedResult = EventHelper.internalServerErrorEvent(); + EventResult eventResult = httpApiServiceImpl.notifyEvent(incident); + EventResult expectedResult = EventHelper.internalServerErrorEvent(); - assertThat(eventResult).isEqualTo(expectedResult); - } + assertThat(eventResult).isEqualTo(expectedResult); + } - @Test - public void notifyIncidentEventAnServerInternalErrorResponseFromUpstreamServerWithRetries() throws Exception { - Incident incident = prepareSampleTriggerIncident("SERVICE_KEY"); + @Test + public void notifyIncidentEventAnServerInternalErrorResponseFromUpstreamServerWithRetries() throws Exception { + Incident incident = prepareSampleTriggerIncident("SERVICE_KEY"); - // 1 initial request + 3 retries - MockServerUtils.prepareMockServerWithInternalServerErrorResponse(mockServerClient, incident); - MockServerUtils.prepareMockServerWithInternalServerErrorResponse(mockServerClient, incident); - MockServerUtils.prepareMockServerWithInternalServerErrorResponse(mockServerClient, incident); - MockServerUtils.prepareMockServerWithInternalServerErrorResponse(mockServerClient, incident); + // 1 initial request + 3 retries + MockServerUtils.prepareMockServerWithInternalServerErrorResponse(mockServerClient, incident); + MockServerUtils.prepareMockServerWithInternalServerErrorResponse(mockServerClient, incident); + MockServerUtils.prepareMockServerWithInternalServerErrorResponse(mockServerClient, incident); + MockServerUtils.prepareMockServerWithInternalServerErrorResponse(mockServerClient, incident); - EventResult eventResult = httpApiServiceImplWithRetriesEnabled.notifyEvent(incident); - EventResult expectedResult = EventHelper.internalServerErrorEvent(); + EventResult eventResult = httpApiServiceImplWithRetriesEnabled.notifyEvent(incident); + EventResult expectedResult = EventHelper.internalServerErrorEvent(); - assertThat(eventResult).isEqualTo(expectedResult); - } + assertThat(eventResult).isEqualTo(expectedResult); + } - @Test - public void notifyIncidentEventAnServerInternalErrorResponseFromUpstreamServerWithRetriesAndRecovery() throws Exception { - String dedupKey = "DEDUP_KEY"; - Incident incident = prepareSampleTriggerIncident("SERVICE_KEY"); + @Test + public void notifyIncidentEventAnServerInternalErrorResponseFromUpstreamServerWithRetriesAndRecovery() throws Exception { + String dedupKey = "DEDUP_KEY"; + Incident incident = prepareSampleTriggerIncident("SERVICE_KEY"); - // 1 initial request + 2 retry + 1 success - MockServerUtils.prepareMockServerWithInternalServerErrorResponse(mockServerClient, incident); - MockServerUtils.prepareMockServerWithInternalServerErrorResponse(mockServerClient, incident); - MockServerUtils.prepareMockServerWithInternalServerErrorResponse(mockServerClient, incident); - MockServerUtils - .prepareMockServerToReceiveGivenEventAndReplyWithSuccessfulResponse(mockServerClient, incident, - EventHelper.successEvent(dedupKey)); + // 1 initial request + 2 retry + 1 success + MockServerUtils.prepareMockServerWithInternalServerErrorResponse(mockServerClient, incident); + MockServerUtils.prepareMockServerWithInternalServerErrorResponse(mockServerClient, incident); + MockServerUtils.prepareMockServerWithInternalServerErrorResponse(mockServerClient, incident); + MockServerUtils.prepareMockServerToReceiveGivenEventAndReplyWithSuccessfulResponse(mockServerClient, incident, + EventHelper.successEvent(dedupKey)); - EventResult eventResult = httpApiServiceImplWithRetriesEnabled.notifyEvent(incident); - EventResult expectedResult = EventHelper.successEvent(dedupKey); + EventResult eventResult = httpApiServiceImplWithRetriesEnabled.notifyEvent(incident); + EventResult expectedResult = EventHelper.successEvent(dedupKey); - assertThat(eventResult).isEqualTo(expectedResult); - } + assertThat(eventResult).isEqualTo(expectedResult); + } - @Test - public void notifyIncidentEventAnServerRateLimitResponseFromUpstreamServer() throws Exception { - Incident incident = prepareSampleTriggerIncident("SERVICE_KEY"); - MockServerUtils.prepareMockServerWithRateLimitResponse(mockServerClient, incident); + @Test + public void notifyIncidentEventAnServerRateLimitResponseFromUpstreamServer() throws Exception { + Incident incident = prepareSampleTriggerIncident("SERVICE_KEY"); + MockServerUtils.prepareMockServerWithRateLimitResponse(mockServerClient, incident); - EventResult eventResult = httpApiServiceImpl.notifyEvent(incident); - EventResult expectedResult = EventHelper.rateLimitErrorEvent(); + EventResult eventResult = httpApiServiceImpl.notifyEvent(incident); + EventResult expectedResult = EventHelper.rateLimitErrorEvent(); - assertThat(eventResult).isEqualTo(expectedResult); - } + assertThat(eventResult).isEqualTo(expectedResult); + } - @Test - public void notifyIncidentEventAnServerRateLimitResponseFromUpstreamServerWithRetries() throws Exception { - Incident incident = prepareSampleTriggerIncident("SERVICE_KEY"); + @Test + public void notifyIncidentEventAnServerRateLimitResponseFromUpstreamServerWithRetries() throws Exception { + Incident incident = prepareSampleTriggerIncident("SERVICE_KEY"); - // 1 initial request + 3 retries - MockServerUtils.prepareMockServerWithRateLimitResponse(mockServerClient, incident); - MockServerUtils.prepareMockServerWithRateLimitResponse(mockServerClient, incident); - MockServerUtils.prepareMockServerWithRateLimitResponse(mockServerClient, incident); - MockServerUtils.prepareMockServerWithRateLimitResponse(mockServerClient, incident); + // 1 initial request + 3 retries + MockServerUtils.prepareMockServerWithRateLimitResponse(mockServerClient, incident); + MockServerUtils.prepareMockServerWithRateLimitResponse(mockServerClient, incident); + MockServerUtils.prepareMockServerWithRateLimitResponse(mockServerClient, incident); + MockServerUtils.prepareMockServerWithRateLimitResponse(mockServerClient, incident); - EventResult eventResult = httpApiServiceImplWithRetriesEnabled.notifyEvent(incident); - EventResult expectedResult = EventHelper.rateLimitErrorEvent(); + EventResult eventResult = httpApiServiceImplWithRetriesEnabled.notifyEvent(incident); + EventResult expectedResult = EventHelper.rateLimitErrorEvent(); - assertThat(eventResult).isEqualTo(expectedResult); - } + assertThat(eventResult).isEqualTo(expectedResult); + } - @Test - public void notifyIncidentEventAnServerRateLimitResponseFromUpstreamServerWithRetriesWithRecovery() throws Exception { - String dedupKey = "DEDUP_KEY"; - Incident incident = prepareSampleTriggerIncident("SERVICE_KEY"); + @Test + public void notifyIncidentEventAnServerRateLimitResponseFromUpstreamServerWithRetriesWithRecovery() throws Exception { + String dedupKey = "DEDUP_KEY"; + Incident incident = prepareSampleTriggerIncident("SERVICE_KEY"); - // 1 initial request + 1 retry + 1 success - MockServerUtils.prepareMockServerWithRateLimitResponse(mockServerClient, incident); - MockServerUtils.prepareMockServerWithRateLimitResponse(mockServerClient, incident); - MockServerUtils - .prepareMockServerToReceiveGivenEventAndReplyWithSuccessfulResponse(mockServerClient, incident, - EventHelper.successEvent(dedupKey)); + // 1 initial request + 1 retry + 1 success + MockServerUtils.prepareMockServerWithRateLimitResponse(mockServerClient, incident); + MockServerUtils.prepareMockServerWithRateLimitResponse(mockServerClient, incident); + MockServerUtils.prepareMockServerToReceiveGivenEventAndReplyWithSuccessfulResponse(mockServerClient, incident, + EventHelper.successEvent(dedupKey)); - EventResult eventResult = httpApiServiceImplWithRetriesEnabled.notifyEvent(incident); - EventResult expectedResult = EventHelper.successEvent(dedupKey); + EventResult eventResult = httpApiServiceImplWithRetriesEnabled.notifyEvent(incident); + EventResult expectedResult = EventHelper.successEvent(dedupKey); - assertThat(eventResult).isEqualTo(expectedResult); + assertThat(eventResult).isEqualTo(expectedResult); - } + } - @Test - public void notifyChangeEventAndAcceptedResponseFromUpstreamServer() throws Exception { - ChangeEvent changeEvent = prepareSampleChangeEvent("SERVICE_KEY"); - MockServerUtils - .prepareMockServerToReceiveGivenEventAndReplyWithAcceptedResponse(mockServerClient, changeEvent, - EventHelper.successEvent()); + @Test + public void notifyChangeEventAndAcceptedResponseFromUpstreamServer() throws Exception { + ChangeEvent changeEvent = prepareSampleChangeEvent("SERVICE_KEY"); + MockServerUtils.prepareMockServerToReceiveGivenEventAndReplyWithAcceptedResponse(mockServerClient, changeEvent, EventHelper.successEvent()); - EventResult eventResult = httpApiServiceImpl.notifyEvent(changeEvent); - EventResult expectedResult = EventHelper.successEvent(); + EventResult eventResult = httpApiServiceImpl.notifyEvent(changeEvent); + EventResult expectedResult = EventHelper.successEvent(); - assertThat(eventResult).isEqualTo(expectedResult); - } + assertThat(eventResult).isEqualTo(expectedResult); + } - @Test - public void notifyChangeEventAndErrorResponseFromUpstreamServer() throws Exception { - ChangeEvent changeEvent = prepareSampleChangeEvent("SERVICE_KEY"); - MockServerUtils.prepareMockServerToReceiveEventAndReplyWithWithErrorResponse(mockServerClient, changeEvent, - EventHelper.errorEvent()); + @Test + public void notifyChangeEventAndErrorResponseFromUpstreamServer() throws Exception { + ChangeEvent changeEvent = prepareSampleChangeEvent("SERVICE_KEY"); + MockServerUtils.prepareMockServerToReceiveEventAndReplyWithWithErrorResponse(mockServerClient, changeEvent, EventHelper.errorEvent()); - EventResult eventResult = httpApiServiceImpl.notifyEvent(changeEvent); - EventResult expectedResult = EventHelper.errorEvent(); + EventResult eventResult = httpApiServiceImpl.notifyEvent(changeEvent); + EventResult expectedResult = EventHelper.errorEvent(); - assertThat(eventResult).isEqualTo(expectedResult); - } + assertThat(eventResult).isEqualTo(expectedResult); + } - @Test - public void notifyChangeEventAnUnexpectedErrorResponseFromUpstreamServer() throws Exception { - ChangeEvent changeEvent = prepareSampleChangeEvent("SERVICE_KEY"); - MockServerUtils.prepareMockServerWithUnexpectedErrorResponse(mockServerClient, changeEvent); + @Test + public void notifyChangeEventAnUnexpectedErrorResponseFromUpstreamServer() throws Exception { + ChangeEvent changeEvent = prepareSampleChangeEvent("SERVICE_KEY"); + MockServerUtils.prepareMockServerWithUnexpectedErrorResponse(mockServerClient, changeEvent); - EventResult eventResult = httpApiServiceImpl.notifyEvent(changeEvent); - EventResult expectedResult = EventHelper.unexpectedErrorEvent(); - - assertThat(eventResult).isEqualTo(expectedResult); - } + EventResult eventResult = httpApiServiceImpl.notifyEvent(changeEvent); + EventResult expectedResult = EventHelper.unexpectedErrorEvent(); + assertThat(eventResult).isEqualTo(expectedResult); + } - @Test - public void notifyChangeEventAnServerInternalErrorResponseFromUpstreamServer() throws Exception { - ChangeEvent changeEvent = prepareSampleChangeEvent("SERVICE_KEY"); - MockServerUtils.prepareMockServerWithInternalServerErrorResponse(mockServerClient, changeEvent); + @Test + public void notifyChangeEventAnServerInternalErrorResponseFromUpstreamServer() throws Exception { + ChangeEvent changeEvent = prepareSampleChangeEvent("SERVICE_KEY"); + MockServerUtils.prepareMockServerWithInternalServerErrorResponse(mockServerClient, changeEvent); - EventResult eventResult = httpApiServiceImpl.notifyEvent(changeEvent); - EventResult expectedResult = EventHelper.internalServerErrorEvent(); + EventResult eventResult = httpApiServiceImpl.notifyEvent(changeEvent); + EventResult expectedResult = EventHelper.internalServerErrorEvent(); - assertThat(eventResult).isEqualTo(expectedResult); - } + assertThat(eventResult).isEqualTo(expectedResult); + } - @Test - public void notifyChangeEventAnServerInternalErrorResponseFromUpstreamServerWithRetries() throws Exception { - ChangeEvent changeEvent = prepareSampleChangeEvent("SERVICE_KEY"); + @Test + public void notifyChangeEventAnServerInternalErrorResponseFromUpstreamServerWithRetries() throws Exception { + ChangeEvent changeEvent = prepareSampleChangeEvent("SERVICE_KEY"); - // 1 initial request + 3 retries - MockServerUtils.prepareMockServerWithInternalServerErrorResponse(mockServerClient, changeEvent); - MockServerUtils.prepareMockServerWithInternalServerErrorResponse(mockServerClient, changeEvent); - MockServerUtils.prepareMockServerWithInternalServerErrorResponse(mockServerClient, changeEvent); - MockServerUtils.prepareMockServerWithInternalServerErrorResponse(mockServerClient, changeEvent); + // 1 initial request + 3 retries + MockServerUtils.prepareMockServerWithInternalServerErrorResponse(mockServerClient, changeEvent); + MockServerUtils.prepareMockServerWithInternalServerErrorResponse(mockServerClient, changeEvent); + MockServerUtils.prepareMockServerWithInternalServerErrorResponse(mockServerClient, changeEvent); + MockServerUtils.prepareMockServerWithInternalServerErrorResponse(mockServerClient, changeEvent); - EventResult eventResult = httpApiServiceImplWithRetriesEnabled.notifyEvent(changeEvent); - EventResult expectedResult = EventHelper.internalServerErrorEvent(); + EventResult eventResult = httpApiServiceImplWithRetriesEnabled.notifyEvent(changeEvent); + EventResult expectedResult = EventHelper.internalServerErrorEvent(); - assertThat(eventResult).isEqualTo(expectedResult); - } + assertThat(eventResult).isEqualTo(expectedResult); + } - @Test - public void notifyChangeEventAnServerInternalErrorResponseFromUpstreamServerWithRetriesAndRecovery() throws Exception { - String dedupKey = "DEDUP_KEY"; - ChangeEvent changeEvent = prepareSampleChangeEvent("SERVICE_KEY"); + @Test + public void notifyChangeEventAnServerInternalErrorResponseFromUpstreamServerWithRetriesAndRecovery() throws Exception { + String dedupKey = "DEDUP_KEY"; + ChangeEvent changeEvent = prepareSampleChangeEvent("SERVICE_KEY"); - // 1 initial request + 2 retry + 1 success - MockServerUtils.prepareMockServerWithInternalServerErrorResponse(mockServerClient, changeEvent); - MockServerUtils.prepareMockServerWithInternalServerErrorResponse(mockServerClient, changeEvent); - MockServerUtils.prepareMockServerWithInternalServerErrorResponse(mockServerClient, changeEvent); - MockServerUtils - .prepareMockServerToReceiveGivenEventAndReplyWithSuccessfulResponse(mockServerClient, changeEvent, - EventHelper.successEvent()); + // 1 initial request + 2 retry + 1 success + MockServerUtils.prepareMockServerWithInternalServerErrorResponse(mockServerClient, changeEvent); + MockServerUtils.prepareMockServerWithInternalServerErrorResponse(mockServerClient, changeEvent); + MockServerUtils.prepareMockServerWithInternalServerErrorResponse(mockServerClient, changeEvent); + MockServerUtils.prepareMockServerToReceiveGivenEventAndReplyWithSuccessfulResponse(mockServerClient, changeEvent, EventHelper.successEvent()); - EventResult eventResult = httpApiServiceImplWithRetriesEnabled.notifyEvent(changeEvent); - EventResult expectedResult = EventHelper.successEvent(); + EventResult eventResult = httpApiServiceImplWithRetriesEnabled.notifyEvent(changeEvent); + EventResult expectedResult = EventHelper.successEvent(); - assertThat(eventResult).isEqualTo(expectedResult); - } + assertThat(eventResult).isEqualTo(expectedResult); + } - @Test - public void notifyChangeEventAnServerRateLimitResponseFromUpstreamServer() throws Exception { - ChangeEvent changeEvent = prepareSampleChangeEvent("SERVICE_KEY"); - MockServerUtils.prepareMockServerWithRateLimitResponse(mockServerClient, changeEvent); + @Test + public void notifyChangeEventAnServerRateLimitResponseFromUpstreamServer() throws Exception { + ChangeEvent changeEvent = prepareSampleChangeEvent("SERVICE_KEY"); + MockServerUtils.prepareMockServerWithRateLimitResponse(mockServerClient, changeEvent); - EventResult eventResult = httpApiServiceImpl.notifyEvent(changeEvent); - EventResult expectedResult = EventHelper.rateLimitErrorEvent(); + EventResult eventResult = httpApiServiceImpl.notifyEvent(changeEvent); + EventResult expectedResult = EventHelper.rateLimitErrorEvent(); - assertThat(eventResult).isEqualTo(expectedResult); - } + assertThat(eventResult).isEqualTo(expectedResult); + } - @Test - public void notifyChangeEventAnServerRateLimitResponseFromUpstreamServerWithRetries() throws Exception { - ChangeEvent changeEvent = prepareSampleChangeEvent("SERVICE_KEY"); + @Test + public void notifyChangeEventAnServerRateLimitResponseFromUpstreamServerWithRetries() throws Exception { + ChangeEvent changeEvent = prepareSampleChangeEvent("SERVICE_KEY"); - // 1 initial request + 3 retries - MockServerUtils.prepareMockServerWithRateLimitResponse(mockServerClient, changeEvent); - MockServerUtils.prepareMockServerWithRateLimitResponse(mockServerClient, changeEvent); - MockServerUtils.prepareMockServerWithRateLimitResponse(mockServerClient, changeEvent); - MockServerUtils.prepareMockServerWithRateLimitResponse(mockServerClient, changeEvent); + // 1 initial request + 3 retries + MockServerUtils.prepareMockServerWithRateLimitResponse(mockServerClient, changeEvent); + MockServerUtils.prepareMockServerWithRateLimitResponse(mockServerClient, changeEvent); + MockServerUtils.prepareMockServerWithRateLimitResponse(mockServerClient, changeEvent); + MockServerUtils.prepareMockServerWithRateLimitResponse(mockServerClient, changeEvent); - EventResult eventResult = httpApiServiceImplWithRetriesEnabled.notifyEvent(changeEvent); - EventResult expectedResult = EventHelper.rateLimitErrorEvent(); + EventResult eventResult = httpApiServiceImplWithRetriesEnabled.notifyEvent(changeEvent); + EventResult expectedResult = EventHelper.rateLimitErrorEvent(); - assertThat(eventResult).isEqualTo(expectedResult); - } + assertThat(eventResult).isEqualTo(expectedResult); + } - @Test - public void notifyChangeEventAnServerRateLimitResponseFromUpstreamServerWithRetriesWithRecovery() throws Exception { - String dedupKey = "DEDUP_KEY"; - ChangeEvent changeEvent = prepareSampleChangeEvent("SERVICE_KEY"); + @Test + public void notifyChangeEventAnServerRateLimitResponseFromUpstreamServerWithRetriesWithRecovery() throws Exception { + String dedupKey = "DEDUP_KEY"; + ChangeEvent changeEvent = prepareSampleChangeEvent("SERVICE_KEY"); - // 1 initial request + 1 retry + 1 success - MockServerUtils.prepareMockServerWithRateLimitResponse(mockServerClient, changeEvent); - MockServerUtils.prepareMockServerWithRateLimitResponse(mockServerClient, changeEvent); - MockServerUtils - .prepareMockServerToReceiveGivenEventAndReplyWithSuccessfulResponse(mockServerClient, changeEvent, - EventHelper.successEvent(dedupKey)); + // 1 initial request + 1 retry + 1 success + MockServerUtils.prepareMockServerWithRateLimitResponse(mockServerClient, changeEvent); + MockServerUtils.prepareMockServerWithRateLimitResponse(mockServerClient, changeEvent); + MockServerUtils.prepareMockServerToReceiveGivenEventAndReplyWithSuccessfulResponse(mockServerClient, changeEvent, + EventHelper.successEvent(dedupKey)); - EventResult eventResult = httpApiServiceImplWithRetriesEnabled.notifyEvent(changeEvent); - EventResult expectedResult = EventHelper.successEvent(dedupKey); + EventResult eventResult = httpApiServiceImplWithRetriesEnabled.notifyEvent(changeEvent); + EventResult expectedResult = EventHelper.successEvent(dedupKey); - assertThat(eventResult).isEqualTo(expectedResult); - } + assertThat(eventResult).isEqualTo(expectedResult); + } } \ No newline at end of file From 8f09e38fd3f429afa46a6df35fd5a43b1a576f56 Mon Sep 17 00:00:00 2001 From: "internal\\HN03022" Date: Wed, 8 Nov 2023 17:17:52 +0100 Subject: [PATCH 5/9] Added errorEventInvalidRoutingKey errorEvent --- .../client/events/utils/EventHelper.java | 112 ++++++++++-------- 1 file changed, 61 insertions(+), 51 deletions(-) diff --git a/src/test/java/com/github/dikhan/pagerduty/client/events/utils/EventHelper.java b/src/test/java/com/github/dikhan/pagerduty/client/events/utils/EventHelper.java index ea8a4a0..a031848 100644 --- a/src/test/java/com/github/dikhan/pagerduty/client/events/utils/EventHelper.java +++ b/src/test/java/com/github/dikhan/pagerduty/client/events/utils/EventHelper.java @@ -1,58 +1,68 @@ package com.github.dikhan.pagerduty.client.events.utils; -import com.github.dikhan.pagerduty.client.events.domain.EventResult; import org.apache.http.HttpStatus; +import com.github.dikhan.pagerduty.client.events.domain.EventResult; + public class EventHelper { - private static final int SC_RATE_LIMIT = 429; - - /** - * Helper method to create a successful event result - * @return successful event result - */ - public static EventResult successEvent() { - return EventResult.successEvent("success", "Event processed", null); - } - - /** - * Helper method to create a successful event result - * @param dedupKey this would be the dedup key auto-generated by PagerDuty - * @return successful event result - */ - public static EventResult successEvent(String dedupKey) { - return EventResult.successEvent("success", "Event processed", dedupKey); - } - - /** - * Helper method to create an error event result - * @return error event result - */ - public static EventResult errorEvent() { - return EventResult.errorEvent("invalid event", "Event object is invalid", "[\"some error from upstream server...\"]"); - } - - /** - * Helper method to create an unexpected event result, by default containing a forbidden status code - * @return error event result - */ - public static EventResult unexpectedErrorEvent() { - return EventResult.errorEvent(String.valueOf(HttpStatus.SC_FORBIDDEN), "", "{}"); - } - - /** - * Helper method to create an internal server error event result, by default containing a 500 status code - * @return error event result - */ - public static EventResult internalServerErrorEvent() { - return EventResult.errorEvent(String.valueOf(HttpStatus.SC_INTERNAL_SERVER_ERROR), "", "{}"); - } - - /** - * Helper method to create an internal server error event result, by default containing a 500 status code - * @return error event result - */ - public static EventResult rateLimitErrorEvent() { - return EventResult.errorEvent(String.valueOf(SC_RATE_LIMIT), "", "{}"); - } + private static final int SC_RATE_LIMIT = 429; + + /** + * Helper method to create a successful event result + * @return successful event result + */ + public static EventResult successEvent() { + return EventResult.successEvent("success", "Event processed", null); + } + + /** + * Helper method to create a successful event result + * @param dedupKey this would be the dedup key auto-generated by PagerDuty + * @return successful event result + */ + public static EventResult successEvent(String dedupKey) { + return EventResult.successEvent("success", "Event processed", dedupKey); + } + + /** + * Helper method to create an error event result + * @return error event result + */ + public static EventResult errorEvent() { + return EventResult.errorEvent("invalid event", "Event object is invalid", "[\"some error from upstream server...\"]"); + } + + /** + * Helper method to create an error event result + * @return error event result + */ + public static EventResult errorEventInvalidRoutingKey() { + return EventResult.errorEvent("Bad Request", "Invalid routing key", "Invalid routing key"); + } + + /** + * Helper method to create an unexpected event result, by default containing a forbidden status code + * @return error event result + */ + public static EventResult unexpectedErrorEvent() { + return EventResult.errorEvent(String.valueOf(HttpStatus.SC_FORBIDDEN), "", "{}"); + } + + /** + * Helper method to create an internal server error event result, by default containing a 500 status code + * @return error event result + */ + public static EventResult internalServerErrorEvent() { + return EventResult.errorEvent(String.valueOf(HttpStatus.SC_INTERNAL_SERVER_ERROR), "", "{}"); + } + + /** + * Helper method to create an internal server error event result, by default containing a 500 status code + * @return error event result + */ + public static EventResult rateLimitErrorEvent() { + return EventResult.errorEvent(String.valueOf(SC_RATE_LIMIT), "", "{}"); + } + } From 9f801e8d3311a580a8f744e18e1847b3b8b1ae37 Mon Sep 17 00:00:00 2001 From: "internal\\HN03022" Date: Wed, 8 Nov 2023 17:19:10 +0100 Subject: [PATCH 6/9] Added prep...ErrorResponseInvalidRoutingKey Mock --- .../client/events/utils/MockServerUtils.java | 238 +++++++++--------- 1 file changed, 123 insertions(+), 115 deletions(-) diff --git a/src/test/java/com/github/dikhan/pagerduty/client/events/utils/MockServerUtils.java b/src/test/java/com/github/dikhan/pagerduty/client/events/utils/MockServerUtils.java index ed49775..3e79092 100644 --- a/src/test/java/com/github/dikhan/pagerduty/client/events/utils/MockServerUtils.java +++ b/src/test/java/com/github/dikhan/pagerduty/client/events/utils/MockServerUtils.java @@ -1,127 +1,135 @@ package com.github.dikhan.pagerduty.client.events.utils; +import static org.mockserver.matchers.Times.exactly; +import static org.mockserver.model.HttpRequest.request; +import static org.mockserver.model.HttpResponse.response; +import static org.mockserver.model.StringBody.exact; + +import java.util.Date; +import java.util.concurrent.TimeUnit; + +import org.apache.http.HttpStatus; +import org.mockserver.client.server.MockServerClient; +import org.mockserver.model.Delay; +import org.mockserver.model.Header; + import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import com.github.dikhan.pagerduty.client.events.domain.ChangeEvent; import com.github.dikhan.pagerduty.client.events.domain.EventResult; import com.github.dikhan.pagerduty.client.events.domain.PagerDutyEvent; -import org.apache.http.HttpStatus; -import org.mockserver.client.server.MockServerClient; -import org.mockserver.model.Delay; -import org.mockserver.model.Header; -import java.util.Date; -import java.util.concurrent.TimeUnit; +public class MockServerUtils { -import static org.mockserver.matchers.Times.exactly; -import static org.mockserver.model.HttpRequest.request; -import static org.mockserver.model.HttpResponse.response; -import static org.mockserver.model.StringBody.exact; + private static final String CHANGE_EVENT_END_POINT = "/v2/change/enqueue"; + private static final String EVENT_END_POINT = "/v2/enqueue"; + private static final int SC_RATE_LIMIT = 429; -public class MockServerUtils { + /** + * Prepare the mock server to receive the given event and reply with a successful eventResult + * @param mockServerClient mock client to configure the incident/event upon + * @param event expected to be received in the mock server from the client + * @param eventResult to be returned by the mock server + * @throws JsonProcessingException + */ + public static void prepareMockServerToReceiveGivenEventAndReplyWithSuccessfulResponse(MockServerClient mockServerClient, PagerDutyEvent event, + EventResult eventResult) throws JsonProcessingException { + prepareMockServer(mockServerClient, event, HttpStatus.SC_OK, getSuccessResponseBody(eventResult)); + } + + /** + * Prepare the mock server to receive the given event and reply with a accepted eventResult + * @param mockServerClient mock client to configure the incident/event upon + * @param event expected to be received in the mock server from the client + * @param eventResult to be returned by the mock server + * @throws JsonProcessingException + */ + public static void prepareMockServerToReceiveGivenEventAndReplyWithAcceptedResponse(MockServerClient mockServerClient, PagerDutyEvent event, + EventResult eventResult) throws JsonProcessingException { + prepareMockServer(mockServerClient, event, HttpStatus.SC_ACCEPTED, getSuccessResponseBody(eventResult)); + } + + /** + * Prepare the mock server to receive the given event and reply with an error eventResult + * @param mockServerClient mock client to configure the incident/event upon + * @param event expected to be received in the mock server from the client + * @param eventResult to be returned by the mock server + * @throws JsonProcessingException + */ + public static void prepareMockServerToReceiveEventAndReplyWithWithErrorResponse(MockServerClient mockServerClient, PagerDutyEvent event, + EventResult eventResult) throws JsonProcessingException { + String responseBody = "{\"status\":\"" + eventResult.getStatus() + "\",\"message\":\"" + eventResult.getMessage() + "\",\"errors\":" + + eventResult.getErrors() + "}"; + prepareMockServer(mockServerClient, event, HttpStatus.SC_BAD_REQUEST, responseBody); + } + + /** + * Prepare the mock server to receive the given event and reply with an error eventResult + * @param mockServerClient mock client to configure the incident/event upon + * @param event expected to be received in the mock server from the client + * @param eventResult to be returned by the mock server + * @throws JsonProcessingException + */ + public static void prepareMockServerToReceiveEventAndReplyWithWithErrorResponseInvalidRoutingKey(MockServerClient mockServerClient, + PagerDutyEvent event, + EventResult eventResult) throws JsonProcessingException { + String responseBody = "Invalid routing key"; + prepareMockServer(mockServerClient, event, HttpStatus.SC_BAD_REQUEST, responseBody); + } + + /** + * Prepare the mock server to receive the given event and reply with a predefined forbidden response with no content + * @param mockServerClient mock client to configure the incident/event upon + * @param event expected to be received in the mock server from the client + * @throws JsonProcessingException + */ + public static void prepareMockServerWithUnexpectedErrorResponse(MockServerClient mockServerClient, + PagerDutyEvent event) throws JsonProcessingException { + String noContentResponseBody = "{}"; + prepareMockServer(mockServerClient, event, HttpStatus.SC_FORBIDDEN, noContentResponseBody); + } + + /** + * Prepare the mock server to receive the given event and reply with a predefined internal server error (500) response with no content + * @param mockServerClient mock client to configure the incident/event upon + * @param event expected to be received in the mock server from the client + * @throws JsonProcessingException + */ + public static void prepareMockServerWithInternalServerErrorResponse(MockServerClient mockServerClient, + PagerDutyEvent event) throws JsonProcessingException { + String noContentResponseBody = "{}"; + prepareMockServer(mockServerClient, event, HttpStatus.SC_INTERNAL_SERVER_ERROR, noContentResponseBody); + } + + /** + * Prepare the mock server to receive the given event and reply with a predefined internal server error (500) response with no content + * @param mockServerClient mock client to configure the incident/event upon + * @param event expected to be received in the mock server from the client + * @throws JsonProcessingException + */ + public static void prepareMockServerWithRateLimitResponse(MockServerClient mockServerClient, PagerDutyEvent event) throws JsonProcessingException { + String noContentResponseBody = "{}"; + prepareMockServer(mockServerClient, event, SC_RATE_LIMIT, noContentResponseBody); + } + + private static void prepareMockServer(MockServerClient mockServerClient, PagerDutyEvent event, int statusCode, + String responseBody) throws JsonProcessingException { + ObjectMapper mapper = new ObjectMapper(); + String endpoint = event instanceof ChangeEvent ? CHANGE_EVENT_END_POINT : EVENT_END_POINT; + mockServerClient.when(request().withMethod("POST").withPath(endpoint).withBody(exact(mapper.writeValueAsString(event))), exactly(1)) + .respond(response().withStatusCode(statusCode) + .withHeaders(new Header("Server", "MockServer"), new Header("Date", new Date().toString()), + new Header("Content-Type", "application/json; charset=utf-8")) + .withBody(responseBody) + .withDelay(new Delay(TimeUnit.SECONDS, 1))); + } + + private static String getSuccessResponseBody(EventResult eventResult) { + if (eventResult.getDedupKey() == null) { + return "{\"status\":\"" + eventResult.getStatus() + "\",\"message\":\"" + eventResult.getMessage() + "\"}"; + } - private static final String CHANGE_EVENT_END_POINT = "/v2/change/enqueue"; - private static final String EVENT_END_POINT = "/v2/enqueue"; - private static final int SC_RATE_LIMIT = 429; - - /** - * Prepare the mock server to receive the given event and reply with a successful eventResult - * @param mockServerClient mock client to configure the incident/event upon - * @param event expected to be received in the mock server from the client - * @param eventResult to be returned by the mock server - * @throws JsonProcessingException - */ - public static void prepareMockServerToReceiveGivenEventAndReplyWithSuccessfulResponse(MockServerClient mockServerClient, PagerDutyEvent event, EventResult eventResult) throws JsonProcessingException { - prepareMockServer(mockServerClient, event, HttpStatus.SC_OK, getSuccessResponseBody(eventResult)); - } - - /** - * Prepare the mock server to receive the given event and reply with a accepted eventResult - * @param mockServerClient mock client to configure the incident/event upon - * @param event expected to be received in the mock server from the client - * @param eventResult to be returned by the mock server - * @throws JsonProcessingException - */ - public static void prepareMockServerToReceiveGivenEventAndReplyWithAcceptedResponse(MockServerClient mockServerClient, PagerDutyEvent event, EventResult eventResult) throws JsonProcessingException { - prepareMockServer(mockServerClient, event, HttpStatus.SC_ACCEPTED, getSuccessResponseBody(eventResult)); - } - - /** - * Prepare the mock server to receive the given event and reply with an error eventResult - * @param mockServerClient mock client to configure the incident/event upon - * @param event expected to be received in the mock server from the client - * @param eventResult to be returned by the mock server - * @throws JsonProcessingException - */ - public static void prepareMockServerToReceiveEventAndReplyWithWithErrorResponse(MockServerClient mockServerClient, PagerDutyEvent event, EventResult eventResult) throws JsonProcessingException { - String responseBody = "{\"status\":\"" + eventResult.getStatus() - + "\",\"message\":\"" + eventResult.getMessage() - + "\",\"errors\":" + eventResult.getErrors() + "}"; - prepareMockServer(mockServerClient, event, HttpStatus.SC_BAD_REQUEST, responseBody); - } - - /** - * Prepare the mock server to receive the given event and reply with a predefined forbidden response with no content - * @param mockServerClient mock client to configure the incident/event upon - * @param event expected to be received in the mock server from the client - * @throws JsonProcessingException - */ - public static void prepareMockServerWithUnexpectedErrorResponse(MockServerClient mockServerClient, PagerDutyEvent event) throws JsonProcessingException { - String noContentResponseBody = "{}"; - prepareMockServer(mockServerClient, event, HttpStatus.SC_FORBIDDEN, noContentResponseBody); - } - - /** - * Prepare the mock server to receive the given event and reply with a predefined internal server error (500) response with no content - * @param mockServerClient mock client to configure the incident/event upon - * @param event expected to be received in the mock server from the client - * @throws JsonProcessingException - */ - public static void prepareMockServerWithInternalServerErrorResponse(MockServerClient mockServerClient, PagerDutyEvent event) throws JsonProcessingException { - String noContentResponseBody = "{}"; - prepareMockServer(mockServerClient, event, HttpStatus.SC_INTERNAL_SERVER_ERROR, noContentResponseBody); - } - - /** - * Prepare the mock server to receive the given event and reply with a predefined internal server error (500) response with no content - * @param mockServerClient mock client to configure the incident/event upon - * @param event expected to be received in the mock server from the client - * @throws JsonProcessingException - */ - public static void prepareMockServerWithRateLimitResponse(MockServerClient mockServerClient, PagerDutyEvent event) throws JsonProcessingException { - String noContentResponseBody = "{}"; - prepareMockServer(mockServerClient, event, SC_RATE_LIMIT, noContentResponseBody); - } - - private static void prepareMockServer(MockServerClient mockServerClient, PagerDutyEvent event, int statusCode, String responseBody) throws JsonProcessingException { - ObjectMapper mapper = new ObjectMapper(); - String endpoint = event instanceof ChangeEvent ? CHANGE_EVENT_END_POINT : EVENT_END_POINT; - mockServerClient - .when(request() - .withMethod("POST") - .withPath(endpoint) - .withBody(exact(mapper.writeValueAsString(event))), - exactly(1)) - .respond(response() - .withStatusCode(statusCode) - .withHeaders( - new Header("Server", "MockServer"), - new Header("Date", new Date().toString()), - new Header("Content-Type", "application/json; charset=utf-8") - ) - .withBody(responseBody) - .withDelay(new Delay(TimeUnit.SECONDS, 1)) - ); - } - - private static String getSuccessResponseBody(EventResult eventResult) { - if (eventResult.getDedupKey() == null) { - return "{\"status\":\"" + eventResult.getStatus() - + "\",\"message\":\"" + eventResult.getMessage() + "\"}"; - } - - return "{\"status\":\"" + eventResult.getStatus() - + "\",\"message\":\"" + eventResult.getMessage() - + "\",\"dedup_key\":\"" + eventResult.getDedupKey() + "\"}"; - } + return "{\"status\":\"" + eventResult.getStatus() + "\",\"message\":\"" + eventResult.getMessage() + "\",\"dedup_key\":\"" + + eventResult.getDedupKey() + "\"}"; + } } From 43d48f5970817e1d1991b06bfad7832c8fba18ba Mon Sep 17 00:00:00 2001 From: "internal\\HN03022" Date: Wed, 22 Nov 2023 12:39:53 +0100 Subject: [PATCH 7/9] GetDefault should pass doRetries to no instance when noproxy is used --- .classpath | 57 +++ .project | 34 ++ .settings/org.eclipse.core.resources.prefs | 5 + .settings/org.eclipse.jdt.apt.core.prefs | 2 + .settings/org.eclipse.jdt.core.prefs | 9 + .settings/org.eclipse.m2e.core.prefs | 4 + hans150.xml | 401 ++++++++++++++++++ .../client/events/ApiServiceFactory.java | 2 +- 8 files changed, 513 insertions(+), 1 deletion(-) create mode 100644 .classpath create mode 100644 .project create mode 100644 .settings/org.eclipse.core.resources.prefs create mode 100644 .settings/org.eclipse.jdt.apt.core.prefs create mode 100644 .settings/org.eclipse.jdt.core.prefs create mode 100644 .settings/org.eclipse.m2e.core.prefs create mode 100644 hans150.xml diff --git a/.classpath b/.classpath new file mode 100644 index 0000000..5070d13 --- /dev/null +++ b/.classpath @@ -0,0 +1,57 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/.project b/.project new file mode 100644 index 0000000..cd39905 --- /dev/null +++ b/.project @@ -0,0 +1,34 @@ + + + pagerduty-client + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.m2e.core.maven2Builder + + + + + + org.eclipse.jdt.core.javanature + org.eclipse.m2e.core.maven2Nature + + + + 1699354262406 + + 30 + + org.eclipse.core.resources.regexFilterMatcher + node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__ + + + + diff --git a/.settings/org.eclipse.core.resources.prefs b/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..cdfe4f1 --- /dev/null +++ b/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,5 @@ +eclipse.preferences.version=1 +encoding//src/main/java=UTF-8 +encoding//src/test/java=UTF-8 +encoding//src/test/resources=UTF-8 +encoding/=UTF-8 diff --git a/.settings/org.eclipse.jdt.apt.core.prefs b/.settings/org.eclipse.jdt.apt.core.prefs new file mode 100644 index 0000000..d4313d4 --- /dev/null +++ b/.settings/org.eclipse.jdt.apt.core.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.apt.aptEnabled=false diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..1b6e1ef --- /dev/null +++ b/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,9 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled +org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore +org.eclipse.jdt.core.compiler.processAnnotations=disabled +org.eclipse.jdt.core.compiler.release=disabled +org.eclipse.jdt.core.compiler.source=1.8 diff --git a/.settings/org.eclipse.m2e.core.prefs b/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 0000000..f897a7f --- /dev/null +++ b/.settings/org.eclipse.m2e.core.prefs @@ -0,0 +1,4 @@ +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1 diff --git a/hans150.xml b/hans150.xml new file mode 100644 index 0000000..7ae3e9b --- /dev/null +++ b/hans150.xml @@ -0,0 +1,401 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/java/com/github/dikhan/pagerduty/client/events/ApiServiceFactory.java b/src/main/java/com/github/dikhan/pagerduty/client/events/ApiServiceFactory.java index 1e4714d..55d2894 100644 --- a/src/main/java/com/github/dikhan/pagerduty/client/events/ApiServiceFactory.java +++ b/src/main/java/com/github/dikhan/pagerduty/client/events/ApiServiceFactory.java @@ -35,7 +35,7 @@ public ApiService getDefault() { if (!StringUtils.isEmpty(proxyHost) && proxyPort!= null) { return new HttpApiServiceImpl(eventApi, changeEventApi, proxyHost, proxyPort, doRetries); } - return new HttpApiServiceImpl(eventApi, changeEventApi, false); + return new HttpApiServiceImpl(eventApi, changeEventApi, doRetries); } } From a34887fd63ebdb945309d2f22a6f376b9206713d Mon Sep 17 00:00:00 2001 From: "internal\\HN03022" Date: Wed, 22 Nov 2023 12:53:51 +0100 Subject: [PATCH 8/9] Remove eclipse settings --- .classpath | 57 --- .project | 34 -- .settings/org.eclipse.core.resources.prefs | 5 - .settings/org.eclipse.jdt.apt.core.prefs | 2 - .settings/org.eclipse.jdt.core.prefs | 9 - .settings/org.eclipse.m2e.core.prefs | 4 - hans150.xml | 401 --------------------- 7 files changed, 512 deletions(-) delete mode 100644 .classpath delete mode 100644 .project delete mode 100644 .settings/org.eclipse.core.resources.prefs delete mode 100644 .settings/org.eclipse.jdt.apt.core.prefs delete mode 100644 .settings/org.eclipse.jdt.core.prefs delete mode 100644 .settings/org.eclipse.m2e.core.prefs delete mode 100644 hans150.xml diff --git a/.classpath b/.classpath deleted file mode 100644 index 5070d13..0000000 --- a/.classpath +++ /dev/null @@ -1,57 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/.project b/.project deleted file mode 100644 index cd39905..0000000 --- a/.project +++ /dev/null @@ -1,34 +0,0 @@ - - - pagerduty-client - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.m2e.core.maven2Builder - - - - - - org.eclipse.jdt.core.javanature - org.eclipse.m2e.core.maven2Nature - - - - 1699354262406 - - 30 - - org.eclipse.core.resources.regexFilterMatcher - node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__ - - - - diff --git a/.settings/org.eclipse.core.resources.prefs b/.settings/org.eclipse.core.resources.prefs deleted file mode 100644 index cdfe4f1..0000000 --- a/.settings/org.eclipse.core.resources.prefs +++ /dev/null @@ -1,5 +0,0 @@ -eclipse.preferences.version=1 -encoding//src/main/java=UTF-8 -encoding//src/test/java=UTF-8 -encoding//src/test/resources=UTF-8 -encoding/=UTF-8 diff --git a/.settings/org.eclipse.jdt.apt.core.prefs b/.settings/org.eclipse.jdt.apt.core.prefs deleted file mode 100644 index d4313d4..0000000 --- a/.settings/org.eclipse.jdt.apt.core.prefs +++ /dev/null @@ -1,2 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.apt.aptEnabled=false diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 1b6e1ef..0000000 --- a/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,9 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 -org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled -org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning -org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore -org.eclipse.jdt.core.compiler.processAnnotations=disabled -org.eclipse.jdt.core.compiler.release=disabled -org.eclipse.jdt.core.compiler.source=1.8 diff --git a/.settings/org.eclipse.m2e.core.prefs b/.settings/org.eclipse.m2e.core.prefs deleted file mode 100644 index f897a7f..0000000 --- a/.settings/org.eclipse.m2e.core.prefs +++ /dev/null @@ -1,4 +0,0 @@ -activeProfiles= -eclipse.preferences.version=1 -resolveWorkspaceProjects=true -version=1 diff --git a/hans150.xml b/hans150.xml deleted file mode 100644 index 7ae3e9b..0000000 --- a/hans150.xml +++ /dev/null @@ -1,401 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - From becbd193dbd0d8bb7ed163e8a67b5ab2124e0ab7 Mon Sep 17 00:00:00 2001 From: "internal\\HN03022" Date: Wed, 22 Nov 2023 12:57:12 +0100 Subject: [PATCH 9/9] ignore eclipse settings --- .gitignore | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 6f72990..c324f38 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,7 @@ .idea *.iml target/* -secrets/* \ No newline at end of file +secrets/* +.settings/* +.classpath +.project \ No newline at end of file