Code clean up and test fixes
This commit is contained in:
@@ -36,7 +36,7 @@ public class TapasAuctionHouseApplication {
|
||||
SpringApplication tapasAuctioneerApp = new SpringApplication(TapasAuctionHouseApplication.class);
|
||||
ENVIRONMENT = tapasAuctioneerApp.run(args).getEnvironment();
|
||||
// TODO Set start up of message services with config
|
||||
// We will use these bootstrap methods in Week 6:
|
||||
|
||||
bootstrapMarketplaceWithWebSub();
|
||||
bootstrapMarketplaceWithMqtt();
|
||||
var getExecutorsService = new GetExecutorsService();
|
||||
@@ -56,12 +56,6 @@ public class TapasAuctionHouseApplication {
|
||||
subscriber.subscribeToAuctionHouseEndpoint(endpoint.getWebSubUri().getValue());
|
||||
}
|
||||
}
|
||||
// try {
|
||||
// subscriber.subscribeToAuctionHouseEndpoint(new URI("http://6b4e-130-82-250-227.ngrok.io/websub-discovery"));
|
||||
// } catch (URISyntaxException e) {
|
||||
// // TODO Auto-generated catch block
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -7,5 +7,5 @@ import org.eclipse.paho.client.mqttv3.MqttMessage;
|
||||
*/
|
||||
public abstract class AuctionEventMqttListener {
|
||||
|
||||
public abstract boolean handleEvent(MqttMessage message);
|
||||
public abstract void handleEvent(MqttMessage message);
|
||||
}
|
||||
|
@@ -20,7 +20,7 @@ public class BidReceivedEventListenerMqttAdapter extends AuctionEventMqttListene
|
||||
private static final Logger LOGGER = LogManager.getLogger(BidReceivedEventListenerMqttAdapter.class);
|
||||
|
||||
@Override
|
||||
public boolean handleEvent(MqttMessage message){
|
||||
public void handleEvent(MqttMessage message){
|
||||
String payload = new String(message.getPayload());
|
||||
|
||||
try {
|
||||
@@ -44,9 +44,7 @@ public class BidReceivedEventListenerMqttAdapter extends AuctionEventMqttListene
|
||||
bidReceivedHandler.handleNewBidReceivedEvent(bidReceivedEvent);
|
||||
} catch (JsonProcessingException | NullPointerException e) {
|
||||
LOGGER.error(e.getMessage(), e);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@@ -23,7 +23,7 @@ public class ExecutorAddedEventListenerMqttAdapter extends AuctionEventMqttListe
|
||||
private static final Logger LOGGER = LogManager.getLogger(ExecutorAddedEventListenerMqttAdapter.class);
|
||||
|
||||
@Override
|
||||
public boolean handleEvent(MqttMessage message) {
|
||||
public void handleEvent(MqttMessage message) {
|
||||
String payload = new String(message.getPayload());
|
||||
|
||||
try {
|
||||
@@ -43,9 +43,7 @@ public class ExecutorAddedEventListenerMqttAdapter extends AuctionEventMqttListe
|
||||
newExecutorHandler.handleNewExecutorEvent(executorAddedEvent);
|
||||
} catch (JsonProcessingException | NullPointerException e) {
|
||||
LOGGER.error(e.getMessage(), e);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@@ -23,7 +23,7 @@ public class ExecutorRemovedEventListenerMqttAdapter extends AuctionEventMqttLis
|
||||
private static final Logger LOGGER = LogManager.getLogger(ExecutorRemovedEventListenerMqttAdapter.class);
|
||||
|
||||
@Override
|
||||
public boolean handleEvent(MqttMessage message) {
|
||||
public void handleEvent(MqttMessage message) {
|
||||
String payload = new String(message.getPayload());
|
||||
|
||||
try {
|
||||
@@ -41,9 +41,6 @@ public class ExecutorRemovedEventListenerMqttAdapter extends AuctionEventMqttLis
|
||||
newExecutorHandler.handleExecutorRemovedEvent(executorRemovedEvent);
|
||||
} catch (JsonProcessingException | NullPointerException e) {
|
||||
LOGGER.error(e.getMessage(), e);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@@ -1,12 +1,8 @@
|
||||
package ch.unisg.tapas.auctionhouse.adapter.in.messaging.mqtt;
|
||||
|
||||
import ch.unisg.tapas.auctionhouse.adapter.common.formats.BidJsonRepresentation;
|
||||
import ch.unisg.tapas.auctionhouse.adapter.common.formats.TaskJsonRepresentation;
|
||||
import ch.unisg.tapas.auctionhouse.application.handler.BidReceivedHandler;
|
||||
import ch.unisg.tapas.auctionhouse.application.port.in.BidReceivedEvent;
|
||||
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.Bid;
|
||||
import ch.unisg.tapas.auctionhouse.domain.ExecutorRegistry;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
@@ -14,23 +10,17 @@ import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.eclipse.paho.client.mqttv3.MqttMessage;
|
||||
|
||||
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.sql.Timestamp;
|
||||
|
||||
public class ExternalAuctionStartedEventListenerMqttAdapter extends AuctionEventMqttListener{
|
||||
private static final Logger LOGGER = LogManager.getLogger(ExternalAuctionStartedEventListenerMqttAdapter.class);
|
||||
|
||||
String auctionHouseURI = "https://tapas-auction-house.86-119-35-40.nip.io/";
|
||||
|
||||
String taskListURI = "https://tapas-tasks.86-119-35-40.nip.io";
|
||||
|
||||
@Override
|
||||
public boolean handleEvent(MqttMessage message){
|
||||
public void handleEvent(MqttMessage message){
|
||||
String payload = new String(message.getPayload());
|
||||
|
||||
System.out.println("New auction");
|
||||
System.out.println("New external MQTT auction");
|
||||
|
||||
try {
|
||||
// Note: this message representation is provided only as an example. You should use a
|
||||
@@ -44,46 +34,21 @@ public class ExternalAuctionStartedEventListenerMqttAdapter extends AuctionEvent
|
||||
String taskType = data.get("taskType").asText();
|
||||
String deadline = data.get("deadline").asText();
|
||||
|
||||
var capable = ExecutorRegistry.getInstance().containsTaskType(new Auction.AuctionedTaskType(taskType));
|
||||
System.out.println("Capable: " + capable);
|
||||
// TODO check deadline
|
||||
if(capable){
|
||||
var bid = new Bid(
|
||||
new Auction.AuctionId(auctionId),
|
||||
new Bid.BidderName("Group-1"),
|
||||
new Bid.BidderAuctionHouseUri(URI.create(auctionHouseURI)),
|
||||
new Bid.BidderTaskListUri(URI.create(taskListURI))
|
||||
);
|
||||
var auction = new Auction(
|
||||
new Auction.AuctionId(auctionId),
|
||||
new Auction.AuctionHouseUri(URI.create(auctionHouseUri)),
|
||||
new Auction.AuctionedTaskUri(URI.create(taskUri)),
|
||||
new Auction.AuctionedTaskType(taskType),
|
||||
new Auction.AuctionDeadline(Timestamp.valueOf(deadline))
|
||||
);
|
||||
|
||||
String body = BidJsonRepresentation.serialize(bid);
|
||||
LOGGER.info(body);
|
||||
var postURI = URI.create(auctionHouseUri + "/bid");
|
||||
HttpRequest postRequest = HttpRequest.newBuilder()
|
||||
.uri(postURI)
|
||||
.header("Content-Type", BidJsonRepresentation.MEDIA_TYPE)
|
||||
.POST(HttpRequest.BodyPublishers.ofString(body))
|
||||
.build();
|
||||
var event = new AuctionStartedEvent(auction);
|
||||
var handler = new AuctionStartedHandler();
|
||||
handler.handleAuctionStartedEvent(event);
|
||||
|
||||
HttpClient client = HttpClient.newHttpClient();
|
||||
var postResponse = client.send(postRequest, HttpResponse.BodyHandlers.ofString());
|
||||
|
||||
LOGGER.info(postResponse.statusCode());
|
||||
}
|
||||
} catch (JsonProcessingException | NullPointerException e) {
|
||||
LOGGER.error(e.getMessage(), e);
|
||||
return false;
|
||||
} catch (IOException e) {
|
||||
|
||||
LOGGER.error(e.getMessage(), e);
|
||||
} catch (JsonProcessingException e) {
|
||||
e.printStackTrace();
|
||||
} catch (InterruptedException e) {
|
||||
|
||||
LOGGER.error(e.getMessage(), e);
|
||||
e.printStackTrace();
|
||||
} catch (Exception e){
|
||||
LOGGER.error(e.getMessage(), e);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@@ -1,104 +0,0 @@
|
||||
package ch.unisg.tapas.auctionhouse.adapter.in.messaging.websub;
|
||||
|
||||
import ch.unisg.tapas.auctionhouse.adapter.common.formats.AuctionJsonRepresentation;
|
||||
import ch.unisg.tapas.auctionhouse.adapter.common.formats.BidJsonRepresentation;
|
||||
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.Bid;
|
||||
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.io.IOException;
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.net.http.HttpClient;
|
||||
import java.net.http.HttpRequest;
|
||||
import java.net.http.HttpResponse;
|
||||
import java.security.Timestamp;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONObject;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* This class is a template for handling auction started events received via WebSub
|
||||
*/
|
||||
@RestController
|
||||
public class AuctionStartedEventListenerWebSubAdapter {
|
||||
private final AuctionStartedHandler auctionStartedHandler;
|
||||
|
||||
public AuctionStartedEventListenerWebSubAdapter(AuctionStartedHandler auctionStartedHandler) {
|
||||
this.auctionStartedHandler = auctionStartedHandler;
|
||||
}
|
||||
/**
|
||||
* Controller which listens to auction-started callbacks
|
||||
* @return 200 OK
|
||||
* @throws URISyntaxException
|
||||
**/
|
||||
// TODO generate a new capability ID instead of using a hardcoded one.
|
||||
@PostMapping(path = "/auction-started/74c72c7f-2739-4124-aa35-a3225171a97c")
|
||||
public ResponseEntity<Void> handleExecutorAddedEvent(@RequestBody String payload) throws URISyntaxException {
|
||||
|
||||
System.out.println("new websub auctions");
|
||||
System.out.println(payload);
|
||||
|
||||
|
||||
JSONArray auctions = new JSONArray(payload);
|
||||
if (auctions.length() > 0) {
|
||||
JSONObject auction = auctions.getJSONObject(0);
|
||||
System.out.print(auction);
|
||||
|
||||
|
||||
String auctionHouseURI = "https://tapas-auction-house.86-119-35-40.nip.io/";
|
||||
|
||||
String taskListURI = "https://tapas-tasks.86-119-35-40.nip.io";
|
||||
|
||||
// TODO Sanitize URIs
|
||||
String auctionId = auction.getString("auctionId");
|
||||
String auctionHouseUri = auction.getString("auctionHouseUri");
|
||||
|
||||
var bid = new Bid(
|
||||
new Auction.AuctionId(auctionId),
|
||||
new Bid.BidderName("Group-1"),
|
||||
new Bid.BidderAuctionHouseUri(URI.create(auctionHouseURI)),
|
||||
new Bid.BidderTaskListUri(URI.create(taskListURI))
|
||||
);
|
||||
|
||||
String body;
|
||||
try {
|
||||
body = BidJsonRepresentation.serialize(bid);
|
||||
//LOGGER.info(body);
|
||||
var postURI = URI.create(auctionHouseUri + "/bid");
|
||||
HttpRequest postRequest = HttpRequest.newBuilder()
|
||||
.uri(postURI)
|
||||
.header("Content-Type", BidJsonRepresentation.MEDIA_TYPE)
|
||||
.POST(HttpRequest.BodyPublishers.ofString(body))
|
||||
.build();
|
||||
|
||||
HttpClient client = HttpClient.newHttpClient();
|
||||
var postResponse = client.send(postRequest, HttpResponse.BodyHandlers.ofString());
|
||||
} catch (JsonProcessingException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
} catch (InterruptedException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
};
|
||||
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
}
|
@@ -0,0 +1,66 @@
|
||||
package ch.unisg.tapas.auctionhouse.adapter.in.messaging.websub;
|
||||
|
||||
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 org.json.JSONArray;
|
||||
import org.json.JSONObject;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.sql.Timestamp;
|
||||
|
||||
/**
|
||||
* This class is a template for handling auction started events received via WebSub
|
||||
*/
|
||||
@RestController
|
||||
public class ExternalAuctionStartedEventListenerWebSubAdapter {
|
||||
private final AuctionStartedHandler auctionStartedHandler;
|
||||
|
||||
public ExternalAuctionStartedEventListenerWebSubAdapter(AuctionStartedHandler auctionStartedHandler) {
|
||||
this.auctionStartedHandler = auctionStartedHandler;
|
||||
}
|
||||
/**
|
||||
* Controller which listens to auction-started callbacks
|
||||
* @return 200 OK
|
||||
* @throws URISyntaxException
|
||||
**/
|
||||
// TODO generate a new capability ID instead of using a hardcoded one.
|
||||
@PostMapping(path = "/auction-started/74c72c7f-2739-4124-aa35-a3225171a97c")
|
||||
public ResponseEntity<Void> handleExecutorAddedEvent(@RequestBody String payload) throws URISyntaxException {
|
||||
|
||||
System.out.println("New external WebSub auction");
|
||||
System.out.println(payload);
|
||||
|
||||
|
||||
JSONArray auctions = new JSONArray(payload);
|
||||
if (auctions.length() > 0) {
|
||||
JSONObject auctionJson = auctions.getJSONObject(0);
|
||||
System.out.print(auctionJson);
|
||||
|
||||
String auctionId = auctionJson.getString("auctionId");
|
||||
String auctionHouseUri = auctionJson.getString("auctionHouseUri");
|
||||
String taskUri = auctionJson.getString("taskUri");
|
||||
String taskType = auctionJson.getString("taskType");
|
||||
String deadline = auctionJson.getString("deadline");
|
||||
|
||||
var auction = new Auction(
|
||||
new Auction.AuctionId(auctionId),
|
||||
new Auction.AuctionHouseUri(URI.create(auctionHouseUri)),
|
||||
new Auction.AuctionedTaskUri(URI.create(taskUri)),
|
||||
new Auction.AuctionedTaskType(taskType),
|
||||
new Auction.AuctionDeadline(Timestamp.valueOf(deadline))
|
||||
);
|
||||
|
||||
var event = new AuctionStartedEvent(auction);
|
||||
auctionStartedHandler.handleAuctionStartedEvent(event);
|
||||
}
|
||||
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
}
|
@@ -53,13 +53,13 @@ public class AuctionHouseDiscoveryHttpAdapter implements AuctionHouseDiscoveryPo
|
||||
|
||||
return returnList;
|
||||
}
|
||||
return Collections.<AuctionHouseDiscoveryInformation>emptyList();
|
||||
return Collections.emptyList();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
return Collections.<AuctionHouseDiscoveryInformation>emptyList();
|
||||
return Collections.emptyList();
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
return Collections.<AuctionHouseDiscoveryInformation>emptyList();
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -1,19 +1,48 @@
|
||||
package ch.unisg.tapas.auctionhouse.adapter.out.web;
|
||||
|
||||
import ch.unisg.tapas.auctionhouse.adapter.common.formats.BidJsonRepresentation;
|
||||
import ch.unisg.tapas.auctionhouse.adapter.in.messaging.mqtt.ExternalAuctionStartedEventListenerMqttAdapter;
|
||||
import ch.unisg.tapas.auctionhouse.application.port.out.PlaceBidForAuctionCommand;
|
||||
import ch.unisg.tapas.auctionhouse.application.port.out.PlaceBidForAuctionCommandPort;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.springframework.context.annotation.Primary;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* This class is a tempalte for implementing a place bid for auction command via HTTP.
|
||||
*/
|
||||
import java.io.IOException;
|
||||
import java.net.http.HttpClient;
|
||||
import java.net.http.HttpRequest;
|
||||
import java.net.http.HttpResponse;
|
||||
|
||||
|
||||
@Component
|
||||
@Primary
|
||||
public class PlaceBidForAuctionCommandHttpAdapter implements PlaceBidForAuctionCommandPort {
|
||||
private static final Logger LOGGER = LogManager.getLogger(PlaceBidForAuctionCommandHttpAdapter.class);
|
||||
|
||||
@Override
|
||||
public void placeBid(PlaceBidForAuctionCommand command) {
|
||||
// TODO
|
||||
try{
|
||||
var body = BidJsonRepresentation.serialize(command.getBid());
|
||||
LOGGER.info("Body of bid to be bid:" + body);
|
||||
|
||||
var postRequest = HttpRequest.newBuilder()
|
||||
.uri(command.getAuction().getAuctionHouseUri().getValue())
|
||||
.header("Content-Type", BidJsonRepresentation.MEDIA_TYPE)
|
||||
.POST(HttpRequest.BodyPublishers.ofString(body))
|
||||
.build();
|
||||
|
||||
HttpClient client = HttpClient.newHttpClient();
|
||||
var postResponse = client.send(postRequest, HttpResponse.BodyHandlers.ofString());
|
||||
|
||||
LOGGER.info(postResponse.statusCode());
|
||||
} catch (JsonProcessingException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -37,7 +37,12 @@ public class AuctionStartedHandler implements AuctionStartedEventHandler {
|
||||
public boolean handleAuctionStartedEvent(AuctionStartedEvent auctionStartedEvent) {
|
||||
Auction auction = auctionStartedEvent.getAuction();
|
||||
|
||||
if (ExecutorRegistry.getInstance().containsTaskType(auction.getTaskType())) {
|
||||
var capable = ExecutorRegistry.getInstance().containsTaskType(auction.getTaskType());
|
||||
var auctionOngoing = !auction.deadlineHasPassed();
|
||||
System.out.println("Capable: " + capable);
|
||||
System.out.println("Auction ongoing: " + auction.deadlineHasPassed());
|
||||
|
||||
if(capable && auctionOngoing){
|
||||
LOGGER.info("Placing bid for task " + auction.getTaskUri() + " of type "
|
||||
+ auction.getTaskType() + " in auction " + auction.getAuctionId()
|
||||
+ " from auction house " + auction.getAuctionHouseUri().getValue().toString());
|
||||
@@ -50,7 +55,8 @@ public class AuctionStartedHandler implements AuctionStartedEventHandler {
|
||||
|
||||
PlaceBidForAuctionCommand command = new PlaceBidForAuctionCommand(auction, bid);
|
||||
placeBidForAuctionCommandPort.placeBid(command);
|
||||
} else {
|
||||
}
|
||||
else if(!capable) {
|
||||
LOGGER.info("Cannot execute this task type: " + auction.getTaskType().getValue());
|
||||
}
|
||||
|
||||
|
@@ -5,6 +5,7 @@ import lombok.Value;
|
||||
|
||||
import java.net.URI;
|
||||
import java.sql.Timestamp;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
@@ -129,6 +130,17 @@ public class Auction {
|
||||
return auctionStatus.getValue() == Status.OPEN;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the deadline has passed.
|
||||
* Useful to check if external auctions are finished.
|
||||
*
|
||||
* @return true if deadline is greater than current timestamp, false otherwise
|
||||
*/
|
||||
public boolean deadlineHasPassed() {
|
||||
var currentTime = new Timestamp(System.currentTimeMillis());
|
||||
return currentTime.before(deadline.getValue());
|
||||
}
|
||||
|
||||
/**
|
||||
* Closes the auction. Called by the StartAuctionService after the auction deadline has expired.
|
||||
*/
|
||||
|
@@ -25,7 +25,7 @@ public class AuctionHouseDiscovery {
|
||||
// static String AUCTION_HOUSE_URI = "http://localhost:8086";
|
||||
|
||||
@Getter
|
||||
private List<AuctionHouseDiscoveryInformation> auctionHouseDiscoveryList = new ArrayList<>() {
|
||||
private final List<AuctionHouseDiscoveryInformation> auctionHouseDiscoveryList = new ArrayList<>() {
|
||||
};
|
||||
|
||||
private AuctionHouseDiscovery() {
|
||||
|
@@ -7,7 +7,7 @@ import lombok.Getter;
|
||||
*/
|
||||
public class AuctionStartedEvent {
|
||||
@Getter
|
||||
private Auction auction;
|
||||
private final Auction auction;
|
||||
|
||||
public AuctionStartedEvent(Auction auction) {
|
||||
this.auction = auction;
|
||||
|
@@ -8,7 +8,7 @@ import lombok.Getter;
|
||||
public class AuctionWonEvent {
|
||||
// The winning bid
|
||||
@Getter
|
||||
private Bid winningBid;
|
||||
private final Bid winningBid;
|
||||
|
||||
public AuctionWonEvent(Bid winningBid) {
|
||||
this.winningBid = winningBid;
|
||||
|
@@ -31,12 +31,12 @@ public class AuctionHouseResourceDirectory {
|
||||
this.rdEndpoint = rdEndpoint;
|
||||
}
|
||||
|
||||
private AuctionHouseDiscoveryPort auctionHouseDiscoveryport = new AuctionHouseDiscoveryHttpAdapter();
|
||||
private final AuctionHouseDiscoveryPort auctionHouseDiscoveryport = new AuctionHouseDiscoveryHttpAdapter();
|
||||
|
||||
private List<AuctionHouseDiscoveryInformation> auctionHouseEndpoints = new ArrayList<>();
|
||||
private final List<AuctionHouseDiscoveryInformation> auctionHouseEndpoints = new ArrayList<>();
|
||||
|
||||
// List to keep track of already fetched endpoints
|
||||
private List<URI> fetchedEndpoints = new ArrayList<>();
|
||||
private final List<URI> fetchedEndpoints = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* Retrieves the endpoints of all auctions houses registered with this directory.
|
||||
|
@@ -5,7 +5,7 @@ import java.util.Set;
|
||||
|
||||
public class SelfValidating<T> {
|
||||
|
||||
private Validator validator;
|
||||
private final Validator validator;
|
||||
|
||||
public SelfValidating() {
|
||||
ValidatorFactory factory = Validation.buildDefaultValidatorFactory();
|
||||
|
Reference in New Issue
Block a user