From 18fdf819f1d45e5cc1d45a5ec41c557b12e5ad24 Mon Sep 17 00:00:00 2001 From: Marcel Date: Wed, 10 Nov 2021 15:14:41 +0100 Subject: [PATCH 1/3] First implementation of WebSub --- mocks/README.md | 29 +++++++ mocks/auction-house/auctions.js | 39 +++++++++ mocks/auction-house/publisher.js | 17 ++++ mocks/auction-house/subscriber.js | 42 +++++++++ tapas-auction-house/pom.xml | 11 +++ .../tapas/TapasAuctionHouseApplication.java | 11 ++- .../common/clients/WebSubSubscriber.java | 85 +++++++++++++++++++ ...tionStartedEventListenerWebSubAdapter.java | 21 ++++- .../websub/ValidateIntentWebSubAdapter.java | 36 ++++++++ ...blishAuctionStartedEventWebSubAdapter.java | 38 ++++++++- .../src/main/resources/application.properties | 4 + 11 files changed, 328 insertions(+), 5 deletions(-) create mode 100644 mocks/README.md create mode 100644 mocks/auction-house/auctions.js create mode 100644 mocks/auction-house/publisher.js create mode 100644 mocks/auction-house/subscriber.js create mode 100644 tapas-auction-house/src/main/java/ch/unisg/tapas/auctionhouse/adapter/in/messaging/websub/ValidateIntentWebSubAdapter.java diff --git a/mocks/README.md b/mocks/README.md new file mode 100644 index 0000000..7135682 --- /dev/null +++ b/mocks/README.md @@ -0,0 +1,29 @@ +In this directory are some files to mock an auction house to test WebSub local. + +To run a local WebSubHub instance + +1. Start a mongodb in docker: + +- docker run -d -p 27017:27017 -p 28017:28017 -e AUTH=no tutum/mongodb + +2. Install a local hub + +- yarn global add websub-hub + +3. Run the hub localy + +- websub-hub -l info -m mongodb://localhost:27017/hub + +Create an example subscription + +- node auction-house/subscriber.js + +Create an example auctionhouse + +- node auction-house/auctions.js + +Publish to the hub + +- node auction-house/publisher.js + +Mostly inspired by: https://github.com/hemerajs/websub-hub diff --git a/mocks/auction-house/auctions.js b/mocks/auction-house/auctions.js new file mode 100644 index 0000000..68a6aa5 --- /dev/null +++ b/mocks/auction-house/auctions.js @@ -0,0 +1,39 @@ +// Require the framework and instantiate it +const fastify = require('fastify')({ logger: true }) + +// Declare a route +fastify.get('/auctions', async (request, reply) => { + console.log('content provided') + + return [ + { + id: '2', + content_text: 'This is a second item.', + url: 'https://example.org/second-item' + }, + { + id: '1', + content_html: '

Hello, world!

', + url: 'https://example.org/initial-post' + } + ] +}) + +fastify.get('/websub', async (request, reply) => { + console.log('content provided') + + return { + topic: 'http://localhost:3100/auctions' + } +}) + +// Run the server! +const start = async () => { + try { + await fastify.listen(3100) + } catch (err) { + fastify.log.error(err) + process.exit(1) + } +} +start() diff --git a/mocks/auction-house/publisher.js b/mocks/auction-house/publisher.js new file mode 100644 index 0000000..c760820 --- /dev/null +++ b/mocks/auction-house/publisher.js @@ -0,0 +1,17 @@ +const axios = require('axios').default + +// Run the server! +const start = async () => { + await axios + .post('http://localhost:3000/publish', { + 'hub.mode': 'publish', + 'hub.url': 'http://localhost:3100/auctions' + }) + .then(response => { + console.log(response.data) + }) + .catch(error => { + console.log(error) + }) +} +start() diff --git a/mocks/auction-house/subscriber.js b/mocks/auction-house/subscriber.js new file mode 100644 index 0000000..ce27197 --- /dev/null +++ b/mocks/auction-house/subscriber.js @@ -0,0 +1,42 @@ +// Require the framework and instantiate it +const fastify = require('fastify')({ logger: true }) +const axios = require('axios').default + +// Declare a route +fastify.get('/auction-created', async (request, reply) => { + console.log('subscription verified', request.query) + console.log(request.query) + return request.query +}) + +fastify.post('/auction-created', async (request, reply) => { + console.log('received blog content', request.body) + reply.send() +}) + +// Run the server! +const start = async () => { + // subscribe to the feed + + try { + await fastify.listen(3200) + } catch (err) { + fastify.log.error(err) + process.exit(1) + } + + await axios + .post('http://localhost:3000', { + 'hub.callback': 'http://localhost:3200/auction-created', + 'hub.mode': 'subscribe', + 'hub.topic': 'http://localhost:3100/auctions', + 'hub.ws': false + }) + .then(response => { + console.log(response.data) + }) + .catch(error => { + console.log(error) + }) +} +start() diff --git a/tapas-auction-house/pom.xml b/tapas-auction-house/pom.xml index 4b9cbb6..df44681 100644 --- a/tapas-auction-house/pom.xml +++ b/tapas-auction-house/pom.xml @@ -58,6 +58,17 @@ validation-api 1.1.0.Final + + org.json + json + 20210307 + + + org.springframework.boot + spring-boot-devtools + runtime + true + diff --git a/tapas-auction-house/src/main/java/ch/unisg/tapas/TapasAuctionHouseApplication.java b/tapas-auction-house/src/main/java/ch/unisg/tapas/TapasAuctionHouseApplication.java index 8fc22d0..3459cff 100644 --- a/tapas-auction-house/src/main/java/ch/unisg/tapas/TapasAuctionHouseApplication.java +++ b/tapas-auction-house/src/main/java/ch/unisg/tapas/TapasAuctionHouseApplication.java @@ -7,6 +7,7 @@ import ch.unisg.tapas.common.AuctionHouseResourceDirectory; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.eclipse.paho.client.mqttv3.MqttException; +import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @@ -26,17 +27,21 @@ public class TapasAuctionHouseApplication { public static void main(String[] args) { SpringApplication tapasAuctioneerApp = new SpringApplication(TapasAuctionHouseApplication.class); - // We will use these bootstrap methods in Week 6: - // bootstrapMarketplaceWithWebSub(); - // bootstrapMarketplaceWithMqtt(); + tapasAuctioneerApp.run(args); + + // We will use these bootstrap methods in Week 6: + + // bootstrapMarketplaceWithMqtt(); + bootstrapMarketplaceWithWebSub(); } /** * Discovers auction houses and subscribes to WebSub notifications */ private static void bootstrapMarketplaceWithWebSub() { + System.out.println("HAHA"); List auctionHouseEndpoints = discoverAuctionHouseEndpoints(); LOGGER.info("Found auction house endpoints: " + auctionHouseEndpoints); diff --git a/tapas-auction-house/src/main/java/ch/unisg/tapas/auctionhouse/adapter/common/clients/WebSubSubscriber.java b/tapas-auction-house/src/main/java/ch/unisg/tapas/auctionhouse/adapter/common/clients/WebSubSubscriber.java index da2b096..8066010 100644 --- a/tapas-auction-house/src/main/java/ch/unisg/tapas/auctionhouse/adapter/common/clients/WebSubSubscriber.java +++ b/tapas-auction-house/src/main/java/ch/unisg/tapas/auctionhouse/adapter/common/clients/WebSubSubscriber.java @@ -1,6 +1,18 @@ package ch.unisg.tapas.auctionhouse.adapter.common.clients; +import java.io.IOException; import java.net.URI; +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.logging.Level; +import java.util.logging.Logger; + +import org.json.JSONObject; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.http.HttpStatus; +import org.springframework.stereotype.Component; /** * Subscribes to the WebSub hubs of auction houses discovered at run time. This class is instantiated @@ -9,7 +21,23 @@ import java.net.URI; */ public class WebSubSubscriber { + // TODO get this somehow from properties file. But on clue how to do this with static variables + static String WEBSUB_HUB_ENDPOINT = "http://localhost:3000"; + static String AUCTION_HOUSE_ENDPOINT = "http://localhost:8086"; + + Logger logger = Logger.getLogger(WebSubSubscriber.class.getName()); + public void subscribeToAuctionHouseEndpoint(URI endpoint) { + // TODO decide with other groups about auction house endpoint uri to discover websub topics + // and replace the hardcoded one with it + String topic = discoverWebSubTopic("http://localhost:3100/websub"); + + if (topic == null) { + return; + } + + subscribeToWebSub(topic); + // TODO Subscribe to the auction house endpoint via WebSub: // 1. Send a request to the auction house in order to discover the WebSub hub to subscribe to. // The request URI should depend on the design of the Auction House HTTP API. @@ -25,4 +53,61 @@ public class WebSubSubscriber { // - W3C WebSub Recommendation: https://www.w3.org/TR/websub/ // - the implementation notes of the WebSub hub you are using to distribute events } + + private String discoverWebSubTopic(String endpoint) { + HttpClient client = HttpClient.newHttpClient(); + HttpRequest request = HttpRequest.newBuilder() + .uri(URI.create(endpoint)) + .header("Content-Type", "application/json") + .GET() + .build(); + + + try { + HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); + if (response.statusCode() == HttpStatus.OK.value()) { + // TODO decide with other groups about response structure and replace the hardcoded + // uri with response uri + JSONObject jsonObject = new JSONObject(response.body()); + System.out.println(jsonObject); + return jsonObject.getString("topic"); + } else { + logger.log(Level.SEVERE, "Could not find a websub uri"); + } + } catch (InterruptedException e) { + logger.log(Level.SEVERE, e.getLocalizedMessage(), e); + Thread.currentThread().interrupt(); + } catch (IOException e) { + logger.log(Level.SEVERE, e.getLocalizedMessage(), e); + } + return null; + } + + private void subscribeToWebSub(String topic) { + HttpClient client = HttpClient.newHttpClient(); + + String body = new JSONObject() + .put("hub.callback", AUCTION_HOUSE_ENDPOINT + "/auction-started") + .put("hub.mode", "subscribe") + .put("hub.topic", topic) + .put("hub.ws", false) + .toString(); + + + HttpRequest request = HttpRequest.newBuilder() + .uri(URI.create(WEBSUB_HUB_ENDPOINT)) + .header("Content-Type", "application/json") + .POST(HttpRequest.BodyPublishers.ofString(body)) + .build(); + + + try { + client.send(request, HttpResponse.BodyHandlers.ofString()); + } catch (InterruptedException e) { + logger.log(Level.SEVERE, e.getLocalizedMessage(), e); + Thread.currentThread().interrupt(); + } catch (IOException e) { + logger.log(Level.SEVERE, e.getLocalizedMessage(), e); + } + } } diff --git a/tapas-auction-house/src/main/java/ch/unisg/tapas/auctionhouse/adapter/in/messaging/websub/AuctionStartedEventListenerWebSubAdapter.java b/tapas-auction-house/src/main/java/ch/unisg/tapas/auctionhouse/adapter/in/messaging/websub/AuctionStartedEventListenerWebSubAdapter.java index d156452..9e7a356 100644 --- a/tapas-auction-house/src/main/java/ch/unisg/tapas/auctionhouse/adapter/in/messaging/websub/AuctionStartedEventListenerWebSubAdapter.java +++ b/tapas-auction-house/src/main/java/ch/unisg/tapas/auctionhouse/adapter/in/messaging/websub/AuctionStartedEventListenerWebSubAdapter.java @@ -1,6 +1,10 @@ package ch.unisg.tapas.auctionhouse.adapter.in.messaging.websub; import ch.unisg.tapas.auctionhouse.application.handler.AuctionStartedHandler; + +import org.json.JSONArray; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; /** @@ -13,6 +17,21 @@ public class AuctionStartedEventListenerWebSubAdapter { public AuctionStartedEventListenerWebSubAdapter(AuctionStartedHandler auctionStartedHandler) { this.auctionStartedHandler = auctionStartedHandler; } + /** + * Controller which listens to auction-started callbacks + * @return 200 OK + **/ + @PostMapping(path = "/auction-started") + public ResponseEntity handleExecutorAddedEvent(@RequestBody String payload) { - //TODO + // Payload should be a JSONArray with auctions + JSONArray jsonArray = new JSONArray(payload); + for (Object auction : jsonArray) { + System.out.println(auction); + // TODO logic to call handleAuctionStartedEvent() + // auctionStartedHandler.handleAuctionStartedEvent(auctionStartedEvent) + } + + return new ResponseEntity<>(HttpStatus.OK); + } } diff --git a/tapas-auction-house/src/main/java/ch/unisg/tapas/auctionhouse/adapter/in/messaging/websub/ValidateIntentWebSubAdapter.java b/tapas-auction-house/src/main/java/ch/unisg/tapas/auctionhouse/adapter/in/messaging/websub/ValidateIntentWebSubAdapter.java new file mode 100644 index 0000000..9e25a69 --- /dev/null +++ b/tapas-auction-house/src/main/java/ch/unisg/tapas/auctionhouse/adapter/in/messaging/websub/ValidateIntentWebSubAdapter.java @@ -0,0 +1,36 @@ +package ch.unisg.tapas.auctionhouse.adapter.in.messaging.websub; + +import org.json.JSONObject; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.*; + +/** + * This class validates the subscription intent from the websub hub + */ +@RestController +public class ValidateIntentWebSubAdapter { + + @Value("${application.environment}") + private String environment; + + @GetMapping(path = "/auction-started") + public ResponseEntity handleExecutorAddedEvent(@RequestParam("hub.challenge") String challenge) { + + + + // Different implementation depending on local development or production + if (environment.equalsIgnoreCase("development")) { + HttpHeaders headers = new HttpHeaders(); + headers.add("Content-Type", "application/json"); + String body = new JSONObject() + .put("hub.challenge", challenge) + .toString(); + return new ResponseEntity<>(body, headers, HttpStatus.OK); + } else { + return new ResponseEntity<>(challenge, HttpStatus.OK); + } + } +} diff --git a/tapas-auction-house/src/main/java/ch/unisg/tapas/auctionhouse/adapter/out/messaging/websub/PublishAuctionStartedEventWebSubAdapter.java b/tapas-auction-house/src/main/java/ch/unisg/tapas/auctionhouse/adapter/out/messaging/websub/PublishAuctionStartedEventWebSubAdapter.java index 9e6ec67..01350d3 100644 --- a/tapas-auction-house/src/main/java/ch/unisg/tapas/auctionhouse/adapter/out/messaging/websub/PublishAuctionStartedEventWebSubAdapter.java +++ b/tapas-auction-house/src/main/java/ch/unisg/tapas/auctionhouse/adapter/out/messaging/websub/PublishAuctionStartedEventWebSubAdapter.java @@ -4,12 +4,16 @@ import ch.unisg.tapas.auctionhouse.application.port.out.AuctionStartedEventPort; import ch.unisg.tapas.auctionhouse.domain.Auction; import ch.unisg.tapas.auctionhouse.domain.AuctionStartedEvent; import ch.unisg.tapas.common.ConfigProperties; + +import org.json.JSONObject; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Primary; import org.springframework.http.HttpStatus; import org.springframework.stereotype.Component; import java.io.IOException; +import java.net.URI; import java.net.URLEncoder; import java.net.http.HttpClient; import java.net.http.HttpRequest; @@ -17,6 +21,8 @@ import java.net.http.HttpResponse; import java.nio.charset.StandardCharsets; import java.util.HashMap; import java.util.Map; +import java.util.logging.Level; +import java.util.logging.Logger; import java.util.stream.Collectors; /** @@ -30,8 +36,38 @@ public class PublishAuctionStartedEventWebSubAdapter implements AuctionStartedEv @Autowired private ConfigProperties config; + @Value("${auctionhouse.uri}") + private String auctionHouseUri; + + @Value("${websub.hub.uri}") + private String webSubHubUri; + + Logger logger = Logger.getLogger(PublishAuctionStartedEventWebSubAdapter.class.getName()); + @Override public void publishAuctionStartedEvent(AuctionStartedEvent event) { - // TODO + HttpClient client = HttpClient.newHttpClient(); + + String body = new JSONObject() + .put("hub.url", auctionHouseUri + "/auctions") + .put("hub.mode", "publish") + .toString(); + + + HttpRequest request = HttpRequest.newBuilder() + .uri(URI.create(webSubHubUri)) + .header("Content-Type", "application/json") + .POST(HttpRequest.BodyPublishers.ofString(body)) + .build(); + + + try { + client.send(request, HttpResponse.BodyHandlers.ofString()); + } catch (InterruptedException e) { + logger.log(Level.SEVERE, e.getLocalizedMessage(), e); + Thread.currentThread().interrupt(); + } catch (IOException e) { + logger.log(Level.SEVERE, e.getLocalizedMessage(), e); + } } } diff --git a/tapas-auction-house/src/main/resources/application.properties b/tapas-auction-house/src/main/resources/application.properties index e9c609f..96e231c 100644 --- a/tapas-auction-house/src/main/resources/application.properties +++ b/tapas-auction-house/src/main/resources/application.properties @@ -6,3 +6,7 @@ websub.hub.publish=https://websub.appspot.com/ group=tapas-group-tutors auction.house.uri=https://tapas-auction-house.86-119-34-23.nip.io/ tasks.list.uri=https://tapas-tasks.86-119-34-23.nip.io/ + +application.environment=development +auctionhouse.uri=http://localhost:8086 +websub.hub.uri=http://localhost:3000 From 333f6aab2117f652f5404d25371446269ce4a38c Mon Sep 17 00:00:00 2001 From: Marcel Date: Sun, 14 Nov 2021 20:46:42 +0100 Subject: [PATCH 2/3] finished websub implementation --- .../tapas/TapasAuctionHouseApplication.java | 12 ++------ .../common/clients/WebSubSubscriber.java | 4 +-- ...tionStartedEventListenerWebSubAdapter.java | 30 ++++++++++++++----- .../websub/ValidateIntentWebSubAdapter.java | 3 -- 4 files changed, 27 insertions(+), 22 deletions(-) diff --git a/tapas-auction-house/src/main/java/ch/unisg/tapas/TapasAuctionHouseApplication.java b/tapas-auction-house/src/main/java/ch/unisg/tapas/TapasAuctionHouseApplication.java index 3459cff..1f958d9 100644 --- a/tapas-auction-house/src/main/java/ch/unisg/tapas/TapasAuctionHouseApplication.java +++ b/tapas-auction-house/src/main/java/ch/unisg/tapas/TapasAuctionHouseApplication.java @@ -27,23 +27,17 @@ public class TapasAuctionHouseApplication { public static void main(String[] args) { SpringApplication tapasAuctioneerApp = new SpringApplication(TapasAuctionHouseApplication.class); - + // We will use these bootstrap methods in Week 6: + bootstrapMarketplaceWithWebSub(); + // bootstrapMarketplaceWithMqtt(); tapasAuctioneerApp.run(args); - - // We will use these bootstrap methods in Week 6: - - // bootstrapMarketplaceWithMqtt(); - bootstrapMarketplaceWithWebSub(); } - /** * Discovers auction houses and subscribes to WebSub notifications */ private static void bootstrapMarketplaceWithWebSub() { - System.out.println("HAHA"); List auctionHouseEndpoints = discoverAuctionHouseEndpoints(); - LOGGER.info("Found auction house endpoints: " + auctionHouseEndpoints); WebSubSubscriber subscriber = new WebSubSubscriber(); diff --git a/tapas-auction-house/src/main/java/ch/unisg/tapas/auctionhouse/adapter/common/clients/WebSubSubscriber.java b/tapas-auction-house/src/main/java/ch/unisg/tapas/auctionhouse/adapter/common/clients/WebSubSubscriber.java index 8066010..5b3fc32 100644 --- a/tapas-auction-house/src/main/java/ch/unisg/tapas/auctionhouse/adapter/common/clients/WebSubSubscriber.java +++ b/tapas-auction-house/src/main/java/ch/unisg/tapas/auctionhouse/adapter/common/clients/WebSubSubscriber.java @@ -9,10 +9,7 @@ import java.util.logging.Level; import java.util.logging.Logger; import org.json.JSONObject; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; import org.springframework.http.HttpStatus; -import org.springframework.stereotype.Component; /** * Subscribes to the WebSub hubs of auction houses discovered at run time. This class is instantiated @@ -38,6 +35,7 @@ public class WebSubSubscriber { subscribeToWebSub(topic); + // Shoudl be done :D // TODO Subscribe to the auction house endpoint via WebSub: // 1. Send a request to the auction house in order to discover the WebSub hub to subscribe to. // The request URI should depend on the design of the Auction House HTTP API. diff --git a/tapas-auction-house/src/main/java/ch/unisg/tapas/auctionhouse/adapter/in/messaging/websub/AuctionStartedEventListenerWebSubAdapter.java b/tapas-auction-house/src/main/java/ch/unisg/tapas/auctionhouse/adapter/in/messaging/websub/AuctionStartedEventListenerWebSubAdapter.java index 9e7a356..4f67dad 100644 --- a/tapas-auction-house/src/main/java/ch/unisg/tapas/auctionhouse/adapter/in/messaging/websub/AuctionStartedEventListenerWebSubAdapter.java +++ b/tapas-auction-house/src/main/java/ch/unisg/tapas/auctionhouse/adapter/in/messaging/websub/AuctionStartedEventListenerWebSubAdapter.java @@ -1,6 +1,18 @@ package ch.unisg.tapas.auctionhouse.adapter.in.messaging.websub; +import ch.unisg.tapas.auctionhouse.adapter.common.formats.AuctionJsonRepresentation; import ch.unisg.tapas.auctionhouse.application.handler.AuctionStartedHandler; +import ch.unisg.tapas.auctionhouse.application.port.in.AuctionStartedEvent; +import ch.unisg.tapas.auctionhouse.domain.Auction; +import ch.unisg.tapas.auctionhouse.domain.Auction.AuctionDeadline; +import ch.unisg.tapas.auctionhouse.domain.Auction.AuctionHouseUri; +import ch.unisg.tapas.auctionhouse.domain.Auction.AuctionId; +import ch.unisg.tapas.auctionhouse.domain.Auction.AuctionedTaskType; +import ch.unisg.tapas.auctionhouse.domain.Auction.AuctionedTaskUri; + +import java.net.URI; +import java.net.URISyntaxException; +import java.util.Collection; import org.json.JSONArray; import org.springframework.http.HttpStatus; @@ -20,16 +32,20 @@ public class AuctionStartedEventListenerWebSubAdapter { /** * Controller which listens to auction-started callbacks * @return 200 OK + * @throws URISyntaxException **/ @PostMapping(path = "/auction-started") - public ResponseEntity handleExecutorAddedEvent(@RequestBody String payload) { + public ResponseEntity handleExecutorAddedEvent(@RequestBody Collection payload) throws URISyntaxException { - // Payload should be a JSONArray with auctions - JSONArray jsonArray = new JSONArray(payload); - for (Object auction : jsonArray) { - System.out.println(auction); - // TODO logic to call handleAuctionStartedEvent() - // auctionStartedHandler.handleAuctionStartedEvent(auctionStartedEvent) + for (AuctionJsonRepresentation auction : payload) { + auctionStartedHandler.handleAuctionStartedEvent( + new AuctionStartedEvent( + new Auction(new AuctionId(auction.getAuctionId()), + new AuctionHouseUri(new URI(auction.getAuctionHouseUri())), + new AuctionedTaskUri(new URI(auction.getTaskUri())), + new AuctionedTaskType(auction.getTaskType()), + new AuctionDeadline(auction.getDeadline())) + )); } return new ResponseEntity<>(HttpStatus.OK); diff --git a/tapas-auction-house/src/main/java/ch/unisg/tapas/auctionhouse/adapter/in/messaging/websub/ValidateIntentWebSubAdapter.java b/tapas-auction-house/src/main/java/ch/unisg/tapas/auctionhouse/adapter/in/messaging/websub/ValidateIntentWebSubAdapter.java index 9e25a69..8509b09 100644 --- a/tapas-auction-house/src/main/java/ch/unisg/tapas/auctionhouse/adapter/in/messaging/websub/ValidateIntentWebSubAdapter.java +++ b/tapas-auction-house/src/main/java/ch/unisg/tapas/auctionhouse/adapter/in/messaging/websub/ValidateIntentWebSubAdapter.java @@ -18,9 +18,6 @@ public class ValidateIntentWebSubAdapter { @GetMapping(path = "/auction-started") public ResponseEntity handleExecutorAddedEvent(@RequestParam("hub.challenge") String challenge) { - - - // Different implementation depending on local development or production if (environment.equalsIgnoreCase("development")) { HttpHeaders headers = new HttpHeaders(); From 613c1482d7365408e0512e0d3f2ff39a4a481dad Mon Sep 17 00:00:00 2001 From: Marcel Date: Sun, 14 Nov 2021 22:09:10 +0100 Subject: [PATCH 3/3] fixed nameing --- .../in/messaging/websub/ValidateIntentWebSubAdapter.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tapas-auction-house/src/main/java/ch/unisg/tapas/auctionhouse/adapter/in/messaging/websub/ValidateIntentWebSubAdapter.java b/tapas-auction-house/src/main/java/ch/unisg/tapas/auctionhouse/adapter/in/messaging/websub/ValidateIntentWebSubAdapter.java index 8509b09..7bfb450 100644 --- a/tapas-auction-house/src/main/java/ch/unisg/tapas/auctionhouse/adapter/in/messaging/websub/ValidateIntentWebSubAdapter.java +++ b/tapas-auction-house/src/main/java/ch/unisg/tapas/auctionhouse/adapter/in/messaging/websub/ValidateIntentWebSubAdapter.java @@ -17,7 +17,7 @@ public class ValidateIntentWebSubAdapter { private String environment; @GetMapping(path = "/auction-started") - public ResponseEntity handleExecutorAddedEvent(@RequestParam("hub.challenge") String challenge) { + public ResponseEntity validateIntent(@RequestParam("hub.challenge") String challenge) { // Different implementation depending on local development or production if (environment.equalsIgnoreCase("development")) { HttpHeaders headers = new HttpHeaders();