Skip to content
Snippets Groups Projects
Commit 923ae328 authored by Jonas Blatt's avatar Jonas Blatt :ant:
Browse files

Formatting

parent 017214e1
No related branches found
No related tags found
No related merge requests found
Showing
with 44 additions and 42 deletions
......@@ -20,8 +20,7 @@ public class GreetingResource {
private static Logger LOGGER = LoggerFactory.getLogger("test");
@Inject
WordnetServiceX wordnetServiceX;
@Inject WordnetServiceX wordnetServiceX;
@ConfigProperty(name = "hello")
private String greet;
......
......@@ -6,14 +6,12 @@ import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import org.eclipse.microprofile.config.inject.ConfigProperty;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@Path("/builder")
public class TestApi {
private static Logger LOGGER = LoggerFactory.getLogger(TestApi.class.getSimpleName());
@GET
......
......@@ -4,8 +4,7 @@ public class UniqueIdGenerator {
private static volatile long id = 0;
private UniqueIdGenerator() {
}
private UniqueIdGenerator() {}
public static synchronized long getNextId() {
return id++;
......
......@@ -18,9 +18,7 @@ public class VerificationGenerator {
public static VerifierResultSet generate() {
Config config = ConfigProvider.getConfig();
Integer maxThreads = config
.getOptionalValue(CONF_VERIFIER_THREADS, Integer.class)
.orElse(1);
Integer maxThreads = config.getOptionalValue(CONF_VERIFIER_THREADS, Integer.class).orElse(1);
ExecutorService executor = Executors.newFixedThreadPool(maxThreads);
......@@ -32,15 +30,16 @@ public class VerificationGenerator {
results.add(vType.createNewInstance().verify(executor));
}
results.forEach(r -> {
try {
resultBuilder.addVerifierResult(r.get());
} catch (InterruptedException e) {
e.printStackTrace();
} catch (ExecutionException e) {
e.printStackTrace();
}
});
results.forEach(
r -> {
try {
resultBuilder.addVerifierResult(r.get());
} catch (InterruptedException e) {
e.printStackTrace();
} catch (ExecutionException e) {
e.printStackTrace();
}
});
return resultBuilder.build();
}
......
......@@ -6,7 +6,9 @@ import java.util.HashSet;
import java.util.Set;
public enum VerificationTypeClassification implements Serializable {
DECISION_LOGIC_LEVEL_VERIFICATION("Decision Logic Verification", "",
DECISION_LOGIC_LEVEL_VERIFICATION(
"Decision Logic Verification",
"",
new HashSet<>(Arrays.asList(VerificationType.IDENTICAL_BUSINESS_RULE_VERIFICATION)));
private String name;
......@@ -25,8 +27,8 @@ public enum VerificationTypeClassification implements Serializable {
return new HashSet<>(verificationTypes);
}
VerificationTypeClassification(String name, String description,
Set<VerificationType> verificationTypes) {
VerificationTypeClassification(
String name, String description, Set<VerificationType> verificationTypes) {
this.name = name;
this.description = description;
this.verificationTypes = verificationTypes;
......
......@@ -10,7 +10,10 @@ import org.apache.commons.lang3.Validate;
public class VerificationResultEntry extends AbstractResultObject {
public enum VerificationClassification {
INFO, WARNING, ERROR, FATAL_ERROR;
INFO,
WARNING,
ERROR,
FATAL_ERROR;
}
private Set<VerificationResultEntryElement> verificationResultEntryElements;
......
......@@ -66,9 +66,12 @@ public class VerificationResultEntryElement extends AbstractResultObject {
private VerificationResultEntryElement withProperty(String key, String value) {
// every properties can only be set once
Validate
.isTrue(!properties.containsKey(key), "Property %s with value %s in %s already set", key,
value, VerificationResultEntryElement.class.getSimpleName());
Validate.isTrue(
!properties.containsKey(key),
"Property %s with value %s in %s already set",
key,
value,
VerificationResultEntryElement.class.getSimpleName());
properties.put(key, value);
return this;
}
......
......@@ -35,9 +35,10 @@ public class VerificationResultEntryFactory {
addToEntry(verificationClassification, message, null);
}
public void addToEntry(VerificationClassification verificationClassification, String message,
Object... args) {
Validate.notNull(verificationResultEntryBuilder,
public void addToEntry(
VerificationClassification verificationClassification, String message, Object... args) {
Validate.notNull(
verificationResultEntryBuilder,
"First call \"addElement\" in VerificationResultEntryFactory before calling \"addToEntry\"");
verificationResultEntryBuilder.withClassification(verificationClassification);
verificationResultEntryBuilder.withMessage(String.format(Validate.notNull(message), args));
......
......@@ -29,12 +29,12 @@ public class VerifierResult extends AbstractResultObject {
}
@JsonbProperty("type_description")
public String getVerificationTypeDescription(){
public String getVerificationTypeDescription() {
return verificationType.getDescription();
}
@JsonbProperty("type_classification")
public String getVerificationTypeClassification(){
public String getVerificationTypeClassification() {
return verificationType.getClassification().getName();
}
......
......@@ -4,9 +4,7 @@ import de.unikoblenz.fgbks.core.dmn.verfication.VerificationType;
import de.unikoblenz.fgbks.core.dmn.verfication.result.VerificationResultEntryFactory;
import de.unikoblenz.fgbks.core.dmn.verfication.result.VerifierResult;
import java.util.Objects;
import java.util.Set;
import java.util.concurrent.Callable;
import java.util.concurrent.Executor;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Future;
......
......@@ -13,20 +13,21 @@ public class SampleVerifier extends AbstractVerifier {
@Override
protected void doVerification() {
vref.addElement(VerificationResultEntryElement.create()
.withDecisionId("hello workd")
.withInputEntryId("adsas")
.withRuleId("asdads"));
vref.addElement(VerificationResultEntryElement.create()
.withDecisionId("hello workd")
.withInputEntryId("adsas")
.withRuleId("asdads"));
vref.addElement(
VerificationResultEntryElement.create()
.withDecisionId("hello workd")
.withInputEntryId("adsas")
.withRuleId("asdads"));
vref.addElement(
VerificationResultEntryElement.create()
.withDecisionId("hello workd")
.withInputEntryId("adsas")
.withRuleId("asdads"));
vref.addToEntry(ERROR, "Asd");
try {
Thread.sleep(1500);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
package de.unikoblenz.fgbks.core.dmn.verfication.verifier;
import de.unikoblenz.fgbks.core.dmn.verfication.result.VerifierResult;
import java.util.Set;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Future;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment