Skip to content
Snippets Groups Projects
Commit 557624c0 authored by Komal Makkar's avatar Komal Makkar
Browse files

undoing stray changes.

parent a97a1b66
No related branches found
No related tags found
1 merge request!15Integration tests Refactored
Pipeline #7437 failed
Pipeline: Notification

#7438

    // Copyright © Microsoft 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.
    package org.opengroup.osdu.notification.provider.azure.pubsub;
    import com.google.gson.JsonObject;
    import org.opengroup.osdu.core.common.model.http.AppException;
    import org.opengroup.osdu.notification.provider.interfaces.IPubsubHandshakeHandler;
    import org.springframework.beans.factory.annotation.Autowired;
    import org.springframework.http.HttpStatus;
    import org.springframework.stereotype.Component;
    @Component
    public class EventGridHandshakeHandler implements IPubsubHandshakeHandler {
    @Autowired
    private EventGridRequestBodyExtractor eventGridRequestBodyExtractor;
    /**
    * Extract Handshake response string form Handshake request.
    * TODO: Check if there is a need to verify subscription name with
    * registration service, before verifying the endpoint.
    * @return validation string
    */
    @Override
    public String getHandshakeResponse() {
    String response;
    try {
    String validationCode = this.eventGridRequestBodyExtractor.getValidationCodeForHandshake();
    JsonObject jsonResponse = new JsonObject();
    jsonResponse.addProperty("ValidationResponse", validationCode);
    response = jsonResponse.toString();
    } catch (Exception exception) {
    throw new AppException(HttpStatus.BAD_REQUEST.value(), "Request payload parsing error",
    "Unable to parse request payload.", exception);
    }
    return response;
    }
    }
    \ No newline at end of file
    0% Loading or .
    You are about to add 0 people to the discussion. Proceed with caution.
    Finish editing this message first!
    Please register or to comment