Merge branch 'dev' into executor_humidity

This commit is contained in:
2021-12-15 12:09:40 +01:00
committed by GitHub
21 changed files with 155 additions and 46 deletions

View File

@@ -10,6 +10,7 @@ import java.util.logging.Logger;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Primary;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Component;
import ch.unisg.common.valueobject.ExecutorURI;
@@ -49,12 +50,13 @@ public class GetAssignmentAdapter implements GetAssignmentPort {
.build();
try {
logger.info("Sending getAssignment Request");
logger.info("ExecutorBase | Sending getAssignment request");
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
logger.log(Level.INFO, "getAssignment request result:\n {0}", response.body());
if (response.body().equals("")) {
if (response.statusCode() != HttpStatus.CREATED.value()) {
logger.info("ExecutorBase | No task assigned");
return null;
}
logger.info("ExecutorBase | Task assigned");
JSONObject responseBody = new JSONObject(response.body());
String inputData = responseBody.getString("inputData");

View File

@@ -1,7 +1,7 @@
package ch.unisg.executorbase.executor.domain;
public enum ExecutorType {
ADDITION, ROBOT, HUMIDITY;
COMPUTATION, ROBOT, HUMIDITY;
/**
* Checks if the give executor type exists.