Deployment 0.0.1 #25
|
@ -54,12 +54,6 @@
|
|||
<groupId>jakarta.validation</groupId>
|
||||
<artifactId>jakarta.validation-api</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ch.unisg</groupId>
|
||||
<artifactId>tapas-tasks</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.transaction</groupId>
|
||||
<artifactId>javax.transaction-api</artifactId>
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
package ch.unisg.common;
|
||||
|
||||
import javax.validation.ConstraintViolation;
|
||||
import javax.validation.ConstraintViolationException;
|
||||
import javax.validation.Validation;
|
||||
import javax.validation.Validator;
|
||||
import javax.validation.ValidatorFactory;
|
||||
import java.util.Set;
|
||||
|
||||
public class SelfValidating<T> {
|
||||
|
||||
private Validator validator;
|
||||
|
||||
public SelfValidating() {
|
||||
ValidatorFactory factory = Validation.buildDefaultValidatorFactory();
|
||||
validator = factory.getValidator();
|
||||
}
|
||||
|
||||
/**
|
||||
* Evaluates all Bean Validations on the attributes of this
|
||||
* instance.
|
||||
*/
|
||||
protected void validateSelf() {
|
||||
@SuppressWarnings("unchecked")
|
||||
Set<ConstraintViolation<T>> violations = validator.validate((T) this);
|
||||
if (!violations.isEmpty()) {
|
||||
throw new ConstraintViolationException(violations);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
package ch.unisg.executorpool.application.port.in;
|
||||
|
||||
import ch.unisg.common.SelfValidating;
|
||||
import ch.unisg.executorpool.domain.ExecutorPool;
|
||||
import ch.unisg.tapastasks.common.SelfValidating;
|
||||
import ch.unisg.executorpool.domain.ExecutorClass.ExecutorIp;
|
||||
import ch.unisg.executorpool.domain.ExecutorClass.ExecutorPort;
|
||||
import ch.unisg.executorpool.domain.ExecutorClass.ExecutorTaskType;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package ch.unisg.executorpool.application.port.in;
|
||||
|
||||
import ch.unisg.executorpool.domain.ExecutorClass.ExecutorTaskType;
|
||||
import ch.unisg.tapastasks.common.SelfValidating;
|
||||
import ch.unisg.common.SelfValidating;
|
||||
import lombok.Value;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package ch.unisg.executorpool.application.port.in;
|
||||
|
||||
import ch.unisg.executorpool.domain.ExecutorClass;
|
||||
import ch.unisg.tapastasks.common.SelfValidating;
|
||||
import ch.unisg.common.SelfValidating;
|
||||
import ch.unisg.executorpool.domain.ExecutorClass.ExecutorIp;
|
||||
import ch.unisg.executorpool.domain.ExecutorClass.ExecutorPort;
|
||||
import lombok.Value;
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
package ch.unisg.executor2;
|
||||
package ch.unisg.executor1;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
|
||||
@SpringBootTest
|
||||
class Executor2ApplicationTests {
|
||||
class Executor1ApplicationTests {
|
||||
|
||||
@Test
|
||||
void contextLoads() {
|
Loading…
Reference in New Issue
Block a user