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

Merge branch 'feat/dmnapp' into 'develop'

Feat/dmnapp

See merge request jonasblatt/ma-jonasblatt-dmn-verifier!20
parents 7b192d83 9bcaf523
No related branches found
No related tags found
No related merge requests found
Showing
with 79 additions and 48 deletions
......@@ -35,25 +35,6 @@
<artifactId>jwi</artifactId>
<version>2.2.3</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-core -->
<dependency>
<artifactId>jackson-core</artifactId>
<groupId>com.fasterxml.jackson.core</groupId>
<version>2.10.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-databind -->
<dependency>
<artifactId>jackson-databind</artifactId>
<groupId>com.fasterxml.jackson.core</groupId>
<version>2.10.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-annotations -->
<dependency>
<artifactId>jackson-annotations</artifactId>
<groupId>com.fasterxml.jackson.core</groupId>
<version>2.10.0</version>
</dependency>
<!-- Utils -->
<dependency>
<groupId>org.apache.commons</groupId>
......
package de.unikoblenz.fgbks.core.dmn.verification.metrics;
import com.fasterxml.jackson.annotation.JsonProperty;
import de.unikoblenz.fgbks.core.dmn.verification.verifier.types.VerificationType;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import javax.json.bind.annotation.JsonbProperty;
/**
* A metric instance give statistics about the execution of one verifier {@link VerificationType}).
......@@ -29,7 +29,7 @@ public class Metric implements Serializable {
*
* @return the number of executions
*/
@JsonProperty("amountOfExecutions")
@JsonbProperty("amountOfExecutions")
public int getAmountOfExecutions() {
return executionTimes.size();
}
......@@ -39,7 +39,7 @@ public class Metric implements Serializable {
*
* @return the average execution time
*/
@JsonProperty("averageExecutionTime")
@JsonbProperty("averageExecutionTime")
public double getAverageExecutionTime() {
return executionTimes.stream().mapToLong(Long::longValue).average().orElseGet(() -> 0);
}
......@@ -49,14 +49,14 @@ public class Metric implements Serializable {
*
* @return the average execution time
*/
@JsonProperty("averageExecutionTimeInMs")
@JsonbProperty("averageExecutionTimeInMs")
public double getAverageExecutionTimeInMs() {
return executionTimes.stream().mapToLong(Long::longValue).average().orElseGet(() -> 0)
/ NANO_SECONDS_PER_SECOND;
}
/** Get the total execution time in ns. */
@JsonProperty("totalExecutionTime")
@JsonbProperty("totalExecutionTime")
public long getTotalExecutionTime() {
return executionTimes.stream().mapToLong(Long::longValue).sum();
}
......@@ -66,7 +66,7 @@ public class Metric implements Serializable {
*
* @return the {@link VerificationType}
*/
@JsonProperty("type")
@JsonbProperty("type")
public VerificationType getType() {
return type;
}
......@@ -74,9 +74,9 @@ public class Metric implements Serializable {
/**
* Get the total execution time in ms.
*
* @return
* @return the execution time in ms
*/
@JsonProperty("totalExecutionTimeInMs")
@JsonbProperty("totalExecutionTimeInMs")
public long getTotalExecutionTimeInMs() {
return executionTimes.stream().mapToLong(Long::longValue).sum() / NANO_SECONDS_PER_SECOND;
}
......
package de.unikoblenz.fgbks.core.dmn.verification.metrics;
import com.fasterxml.jackson.annotation.JsonProperty;
import de.unikoblenz.fgbks.core.dmn.verification.verifier.types.VerificationType;
import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;
import javax.json.bind.annotation.JsonbProperty;
import org.apache.commons.lang3.Validate;
/**
......@@ -19,7 +19,7 @@ public class MetricSet implements Serializable {
*
* @return the set of {@link Metric}s
*/
@JsonProperty("verificationMetrics")
@JsonbProperty("verificationMetrics")
public Set<Metric> getMetrics() {
return new HashSet<>(metrics);
}
......
......@@ -8,11 +8,11 @@ import static de.unikoblenz.fgbks.core.dmn.verification.result.actions.Action.AC
import static de.unikoblenz.fgbks.core.dmn.verification.result.actions.Action.ACTION_SHOW_OUTPUT_ENTRIES;
import static de.unikoblenz.fgbks.core.dmn.verification.result.actions.Action.ACTION_SHOW_RULES;
import com.fasterxml.jackson.annotation.JsonProperty;
import de.unikoblenz.fgbks.base.builder.DefaultBuilder;
import de.unikoblenz.fgbks.base.domain.Name;
import java.util.ArrayList;
import java.util.List;
import javax.json.bind.annotation.JsonbProperty;
import org.apache.commons.lang3.Validate;
public class VerificationFix {
......@@ -69,12 +69,12 @@ public class VerificationFix {
private Name fixName;
private List<Action> actions;
@JsonProperty("fixName")
@JsonbProperty("fixName")
public Name getFixName() {
return fixName;
}
@JsonProperty("actions")
@JsonbProperty("actions")
public List<Action> getActions() {
return actions;
}
......
......@@ -10,7 +10,8 @@ public class DecisionLogicLevelVerification extends AbstractClassificationType {
new DecisionLogicLevelVerification();
private DecisionLogicLevelVerification() {
super(new Name("DecisionLogic"), new Name("Decision Logic"), new Description("test")); // TODO
super(new Name("DecisionLogicLevel"), new Name("Decision Logic Level"),
new Description("Checks and verifications on the Decision Logic Level.<br/>xxxx"));
}
public static DecisionLogicLevelVerification getInstance() {
......
......@@ -9,7 +9,8 @@ public class DrdModelingLevelVerification extends AbstractClassificationType {
private static final DrdModelingLevelVerification instance = new DrdModelingLevelVerification();
private DrdModelingLevelVerification() {
super(new Name("DrdModeling"), new Name("DRD Modeling"), new Description("test")); // TODO
super(new Name("DrdModelingLevel"), new Name("DRD Modeling Level"),
new Description("test")); // TODO
}
public static DrdModelingLevelVerification getInstance() {
......
......@@ -10,7 +10,7 @@ public class ModelingLevelVerification extends AbstractClassificationType {
new ModelingLevelVerification();
private ModelingLevelVerification() {
super(new Name("Modeling"), new Description("test")); // TODO
super(new Name("ModelingLevel"), new Name("Modeling Level"), new Description("test")); // TODO
}
public static ModelingLevelVerification getInstance() {
......
......@@ -9,7 +9,7 @@ public class SyntaxLevelVerification extends AbstractClassificationType {
private static final SyntaxLevelVerification instance = new SyntaxLevelVerification();
private SyntaxLevelVerification() {
super(new Name("Syntax"), new Description("test")); // TODO
super(new Name("SyntaxLevel"), new Name("Syntax Level"), new Description("test")); // TODO
}
public static SyntaxLevelVerification getInstance() {
......
......@@ -68,10 +68,8 @@ public class MissingInputColumnVerifier extends AbstractVerifier {
.build())
.addToEntry(
VerificationClassification.WARNING,
inputDataNode.isInputData()
? "Input data"
: "Decision"
+ " node \"%s\" has no corresponding input column in decision \"%s\"",
(inputDataNode.isInputData() ? "Input data" : "Decision")
+ " node \"%s\" has no corresponding input column in decision \"%s\"",
inputDataNode.getName().orElse(Name.NO_NAME),
decision.getName().orElse(Name.NO_NAME));
}
......
......@@ -49,12 +49,13 @@ public class MissingRuleVerifier extends AbstractVerifier {
for (VDmnRule missingRule : missingRules) {
StringBuilder sb = new StringBuilder();
sb.append(templateDecision(dmnDecisionTable.getDmnDecision()));
sb.append("The following rule is not defined: {");
sb.append("The following rule is not defined: { ");
sb.append(
missingRule.getDmnInputValues().stream()
.map(v -> v.getBoundary().getParsedText())
.collect(Collectors.joining("), (")));
sb.append("}");
.map(s -> s.isEmpty() ? "-" : s)
.collect(Collectors.joining(" / ")));
sb.append(" }");
vreFactory.addElement(VerificationResultEntryElement.create(dmnDecisionTable));
vreFactory.addToEntry(VerificationClassification.WARNING, sb.toString());
......
......@@ -2,6 +2,7 @@
html, body {
padding: 0;
font-size: 11pt;
font-family: 'Open Sans', sans-serif;
}
h1 {
......@@ -17,6 +18,27 @@ h2 {
margin: 10px;
}
.status-dot {
height: 15px;
width: 15px;
background-color: #bbb;
border-radius: 50%;
display: inline-block;
}
.status-dot.active {
background-color: #0f0;
}
.status-dot.inactive {
background-color: #f00;
}
#backend-status {
float: right;
flex-grow: 1;
}
select {
-moz-appearance: none;
-webkit-appearance: none;
......
......@@ -23,23 +23,26 @@
<div class="dmn-root">
<div class="dmn-top">
<div class="dmn-top-item dmn-upload">
<label class="clickable" for="dmn-file-upload">
<label class="clickable" for="dmn-file-upload" title="Upload dmn">
</label>
<input id="dmn-file-upload" type="file"/>
</div>
<div class="dmn-top-item dmn-empty-file">
<label class="clickable" for="dmn-file-empty">
<label class="clickable" for="dmn-file-empty" title="Create empty dmn">
</label>
<input id="dmn-file-empty" type="button"/>
</div>
<div class="dmn-top-item dmn-download">
<label class="clickable" for="dmn-file-download">
<label class="clickable" for="dmn-file-download" title="Download current dmn">
</label>
<input id="dmn-file-download" type="button"/>
</div>
<div class="dmn-top-item">
<h1>Verification for Decision Modeling Notation</h1>
</div>
<div class="dmn-top-item">
<span class="status-dot" id="backend-status" title="Backend status"/>
</div>
</div>
<div id="content-dmn">
<div class="editor-parent">
......
let rootUrl = 'http://' + window.location.hostname + ':8080/';
let dmnApi = rootUrl + 'api/dmn/';
let inactiveBackend = true;
/**
* Global definition for verification results
......@@ -15,12 +16,31 @@ let types = [];
let $verifierTypes;
function handleStatus() {
let $dot = $('#backend-status');
if (inactiveBackend) {
$dot.removeClass('active');
$dot.addClass('inactive');
} else {
$dot.removeClass('inactive');
$dot.addClass('active');
}
}
// load types
$.ajax({
timeout: 500,
url: dmnApi + 'verification/types',
type: 'GET',
contentType: 'text/xml',
error: function (err) {
verifierResults = {};
inactiveBackend = true;
handleStatus();
},
success: function (data) {
inactiveBackend = false;
handleStatus();
types = data;
// sort types by classification and name
types.sort(function (
......@@ -59,7 +79,8 @@ function cleanDmnVerifierRoot() {
});
// Add Button
$header.append($(`
<button class="clickable dmn-verifier-header-item" id="dmn-button-verify" onClick="checkVerifications()">
<button class="clickable dmn-verifier-header-item" id="dmn-button-verify"
title="Request verifications" onClick="checkVerifications()">
Verify</button>
`));
// add header to root
......@@ -95,6 +116,7 @@ function getVerifications() {
}
}
$.ajax({
timeout: 0, // ??
url: apiPath,
type: 'POST',
contentType: 'text/xml',
......@@ -132,6 +154,7 @@ function getVerifications() {
function renderTypeOptions() {
let $select = $(`
<select name="verifier[]" id="dmn-verifier-types" multiple="multiple"
title="Preselect verifications"
class="dmn-verifier-header-item dmn-verifier-select clickable">
`);
let currentOpt = '';
......@@ -162,6 +185,7 @@ function renderDmnVerifierOptions() {
let $select = $(`
<select name="verifier" id="verifier"
class="dmn-verifier-header-item dmn-verifier-select clickable"
title="Select calculated verification"
onchange="renderVerifierResult(this)">
`);
$select.append($(`<option>Select a verifier</option>`));
......
......@@ -9,7 +9,7 @@
<properties>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<surefire-plugin.version>2.22.0</surefire-plugin.version>
<quarkus.version>0.24.0</quarkus.version>
<quarkus.version>0.25.0</quarkus.version>
<maven.compiler.source>1.8</maven.compiler.source>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.target>1.8</maven.compiler.target>
......
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