executorbase restructure + improvments
This commit is contained in:
@@ -1,7 +1,5 @@
|
||||
package ch.unisg.executorpool.adapter.common.clients;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.eclipse.paho.client.mqttv3.*;
|
||||
import org.eclipse.paho.client.mqttv3.persist.MemoryPersistence;
|
||||
|
||||
@@ -9,7 +7,6 @@ import java.nio.charset.StandardCharsets;
|
||||
import java.util.UUID;
|
||||
|
||||
public class TapasMqttClient {
|
||||
private static final Logger LOGGER = LogManager.getLogger(TapasMqttClient.class);
|
||||
|
||||
private static TapasMqttClient tapasClient = null;
|
||||
|
||||
|
@@ -1,6 +1,5 @@
|
||||
package ch.unisg.executorpool.adapter.in.web;
|
||||
|
||||
import ch.unisg.executorpool.adapter.common.clients.TapasMqttClient;
|
||||
import ch.unisg.executorpool.adapter.common.formats.ExecutorJsonRepresentation;
|
||||
import ch.unisg.executorpool.application.port.in.AddNewExecutorToExecutorPoolUseCase;
|
||||
import ch.unisg.executorpool.application.port.in.AddNewExecutorToExecutorPoolCommand;
|
||||
@@ -14,10 +13,6 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.server.ResponseStatusException;
|
||||
import javax.validation.ConstraintViolationException;
|
||||
import java.net.URI;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.eclipse.paho.client.mqttv3.*;
|
||||
|
||||
@RestController
|
||||
public class AddNewExecutorToExecutorPoolWebController {
|
||||
|
@@ -1,6 +1,5 @@
|
||||
package ch.unisg.executorpool.adapter.out.messaging;
|
||||
|
||||
import ch.unisg.common.ConfigProperties;
|
||||
import ch.unisg.executorpool.adapter.common.clients.TapasMqttClient;
|
||||
import ch.unisg.executorpool.adapter.common.formats.ExecutorJsonRepresentation;
|
||||
import ch.unisg.executorpool.application.port.out.ExecutorAddedEventPort;
|
||||
@@ -13,20 +12,12 @@ import org.springframework.context.annotation.Primary;
|
||||
import org.springframework.core.env.Environment;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.net.URI;
|
||||
|
||||
@Component
|
||||
@Primary
|
||||
public class PublishExecutorAddedEventAdapter implements ExecutorAddedEventPort {
|
||||
|
||||
private static final Logger LOGGER = LogManager.getLogger(PublishExecutorAddedEventAdapter.class);
|
||||
|
||||
// TODO Can't autowire. Find fix
|
||||
/*
|
||||
@Autowired
|
||||
private ConfigProperties config;
|
||||
*/
|
||||
|
||||
@Autowired
|
||||
private Environment environment;
|
||||
|
||||
|
@@ -1,13 +1,14 @@
|
||||
package ch.unisg.executorpool.application.port.in;
|
||||
|
||||
import ch.unisg.common.SelfValidating;
|
||||
import ch.unisg.executorpool.domain.ExecutorPool;
|
||||
import ch.unisg.executorpool.domain.ExecutorClass.ExecutorUri;
|
||||
import ch.unisg.executorpool.domain.ExecutorClass.ExecutorTaskType;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Value;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
@Value
|
||||
@EqualsAndHashCode(callSuper=false)
|
||||
public class AddNewExecutorToExecutorPoolCommand extends SelfValidating<AddNewExecutorToExecutorPoolCommand> {
|
||||
@NotNull
|
||||
private final ExecutorUri executorUri;
|
||||
|
@@ -1,7 +1,6 @@
|
||||
package ch.unisg.executorpool.application.port.in;
|
||||
|
||||
import ch.unisg.executorpool.domain.ExecutorClass;
|
||||
import ch.unisg.executorpool.domain.ExecutorPool;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@@ -16,7 +16,6 @@ import static org.assertj.core.api.BDDAssertions.*;
|
||||
import ch.unisg.executorpool.adapter.common.formats.ExecutorJsonRepresentation;
|
||||
import ch.unisg.executorpool.application.port.out.AddExecutorPort;
|
||||
import ch.unisg.executorpool.domain.ExecutorPool;
|
||||
import ch.unisg.executorpool.domain.ExecutorClass;
|
||||
import ch.unisg.executorpool.domain.ExecutorClass.ExecutorTaskType;
|
||||
import ch.unisg.executorpool.domain.ExecutorClass.ExecutorUri;
|
||||
|
||||
@@ -27,16 +26,13 @@ public class AddNewExecutorToExecutorPoolSystemTest {
|
||||
@Autowired
|
||||
private TestRestTemplate restTemplate;
|
||||
|
||||
@Autowired
|
||||
private AddExecutorPort addExecutorPort;
|
||||
|
||||
@Test
|
||||
void AddNewExecutorToExecutorPool() throws JSONException {
|
||||
|
||||
ExecutorTaskType executorTaskType = new ExecutorTaskType("system-integration-test-type");
|
||||
ExecutorUri executorUri = new ExecutorUri(java.net.URI.create("example.org"));
|
||||
|
||||
ResponseEntity response = whenAddNewExecutorToEmptyPool(executorTaskType, executorUri);
|
||||
ResponseEntity<String> response = whenAddNewExecutorToEmptyPool(executorTaskType, executorUri);
|
||||
|
||||
JSONObject responseJson = new JSONObject(response.getBody().toString());
|
||||
String respExecutorUri = responseJson.getString("executorUri");
|
||||
@@ -50,7 +46,7 @@ public class AddNewExecutorToExecutorPoolSystemTest {
|
||||
}
|
||||
|
||||
private ResponseEntity whenAddNewExecutorToEmptyPool(ExecutorTaskType executorTaskType,
|
||||
ExecutorUri executorUri) throws JSONException {
|
||||
ExecutorUri executorUri) throws JSONException {
|
||||
|
||||
ExecutorPool.getExecutorPool().getListOfExecutors().getValue().clear();
|
||||
|
||||
|
@@ -1,9 +1,6 @@
|
||||
package ch.unisg.executorpool;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
import ch.unisg.executorpool.application.port.out.LoadExecutorPort;
|
||||
import org.bson.json.JsonObject;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.mockito.Mockito;
|
||||
import static org.mockito.BDDMockito.eq;
|
||||
|
@@ -1,7 +1,6 @@
|
||||
package ch.unisg.executorpool;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.Optional;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
|
Reference in New Issue
Block a user