diff --git a/echo-notifications/src/main/groovy/com/netflix/spinnaker/echo/cdevents/CDEventPipelineRunFinished.java b/echo-notifications/src/main/groovy/com/netflix/spinnaker/echo/cdevents/CDEventPipelineRunFinished.java index 803756575..d609179ac 100644 --- a/echo-notifications/src/main/groovy/com/netflix/spinnaker/echo/cdevents/CDEventPipelineRunFinished.java +++ b/echo-notifications/src/main/groovy/com/netflix/spinnaker/echo/cdevents/CDEventPipelineRunFinished.java @@ -49,9 +49,9 @@ public CloudEvent createCDEvent() { cdEvent.setSubjectUrl(URI.create(getSubjectUrl())); cdEvent.setSubjectErrors(getSubjectError()); - if (subjectError.equals("complete")) { + if ("complete".equals(getSubjectError())) { cdEvent.setSubjectOutcome(CDEventConstants.Outcome.SUCCESS); - } else if (subjectError.equals("failed")) { + } else if ("failed".equals(getSubjectError())) { cdEvent.setSubjectOutcome(CDEventConstants.Outcome.FAILURE); } diff --git a/echo-notifications/src/main/groovy/com/netflix/spinnaker/echo/cdevents/CDEventTaskRunFinished.java b/echo-notifications/src/main/groovy/com/netflix/spinnaker/echo/cdevents/CDEventTaskRunFinished.java index 96dca3179..a72dff0d2 100644 --- a/echo-notifications/src/main/groovy/com/netflix/spinnaker/echo/cdevents/CDEventTaskRunFinished.java +++ b/echo-notifications/src/main/groovy/com/netflix/spinnaker/echo/cdevents/CDEventTaskRunFinished.java @@ -51,9 +51,9 @@ public CloudEvent createCDEvent() { cdEvent.setSubjectUrl(URI.create(getSubjectUrl())); cdEvent.setSubjectErrors(getSubjectError()); cdEvent.setSubjectPipelineRunId(getSubjectPipelineRunId()); - if (getSubjectError().equals("complete")) { + if ("complete".equals(getSubjectError())) { cdEvent.setSubjectOutcome(CDEventConstants.Outcome.SUCCESS); - } else if (getSubjectError().equals("failed")) { + } else if ("failed".equals(getSubjectError())) { cdEvent.setSubjectOutcome(CDEventConstants.Outcome.FAILURE); } diff --git a/echo-notifications/src/main/groovy/com/netflix/spinnaker/echo/cdevents/CDEventsSenderService.java b/echo-notifications/src/main/groovy/com/netflix/spinnaker/echo/cdevents/CDEventsSenderService.java index 38c340981..4b71cae27 100644 --- a/echo-notifications/src/main/groovy/com/netflix/spinnaker/echo/cdevents/CDEventsSenderService.java +++ b/echo-notifications/src/main/groovy/com/netflix/spinnaker/echo/cdevents/CDEventsSenderService.java @@ -77,11 +77,10 @@ private String getEndpointUrl(String webhookUrl) { url.getPort() != -1 ? url.getProtocol() + "://" + url.getHost() + ":" + url.getPort() : url.getProtocol() + "://" + url.getHost(); - log.info("endpoint Url to send CDEvent {} ", endPointURL); + log.info("Endpoint Url to send CDEvent {} ", endPointURL); return endPointURL; } catch (MalformedURLException e) { - throw new InvalidRequestException( - "Unable to determine base URL from Microsoft Teams webhook URL.", e); + throw new InvalidRequestException("Unable to determine CloudEvents broker address.", e); } } @@ -97,7 +96,7 @@ private String getRelativePath(String webhookUrl) { } } catch (MalformedURLException e) { throw new InvalidRequestException( - "Unable to determine relative path from Microsoft Teams webhook URL.", e); + "Unable to determine URL from CloudEvents broker address.", e); } // Remove slash from beginning of path as the client will prefix the string with a slash diff --git a/echo-notifications/src/main/groovy/com/netflix/spinnaker/echo/notification/CDEventsNotificationAgent.java b/echo-notifications/src/main/groovy/com/netflix/spinnaker/echo/notification/CDEventsNotificationAgent.java index 1f67b771f..a6cd43172 100644 --- a/echo-notifications/src/main/groovy/com/netflix/spinnaker/echo/notification/CDEventsNotificationAgent.java +++ b/echo-notifications/src/main/groovy/com/netflix/spinnaker/echo/notification/CDEventsNotificationAgent.java @@ -1,18 +1,18 @@ /* - * Copyright 2020 Cerner Corporation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ + Copyright (C) 2023 Nordix Foundation. + For a full list of individual contributors, please see the commit history. + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + SPDX-License-Identifier: Apache-2.0 +*/ package com.netflix.spinnaker.echo.notification; diff --git a/echo-notifications/src/test/groovy/com/netflix/spinnaker/echo/notification/CDEventsNotificationAgentSpec.groovy b/echo-notifications/src/test/groovy/com/netflix/spinnaker/echo/notification/CDEventsNotificationAgentSpec.groovy index 77dd4e97a..868216c67 100644 --- a/echo-notifications/src/test/groovy/com/netflix/spinnaker/echo/notification/CDEventsNotificationAgentSpec.groovy +++ b/echo-notifications/src/test/groovy/com/netflix/spinnaker/echo/notification/CDEventsNotificationAgentSpec.groovy @@ -1,18 +1,18 @@ /* - * Copyright 2016 Google, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License") - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ + Copyright (C) 2023 Nordix Foundation. + For a full list of individual contributors, please see the commit history. + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + SPDX-License-Identifier: Apache-2.0 +*/ package com.netflix.spinnaker.echo.notification