Skip to main content
Sign in
Snippets Groups Projects
Commit 3fef53c6 authored by René Schöne's avatar René Schöne
Browse files

cleanup

- update dependencies
- move eval counter in receive definition after setting the target
parent 97ba4f4b
No related branches found
No related tags found
1 merge request!33Resolve "Refactorings/Clean-Up"
...@@ -4,3 +4,11 @@ plugins { ...@@ -4,3 +4,11 @@ plugins {
} }
java.toolchain.languageVersion.set(JavaLanguageVersion.of(11)) java.toolchain.languageVersion.set(JavaLanguageVersion.of(11))
if (JavaVersion.current().isJava8Compatible()) {
allprojects {
tasks.withType(Javadoc) {
options.addStringOption('Xdoclint:none', '-quiet')
}
}
}
log4j_version = 2.17.2 log4j_version = 2.17.2
mustache_java_version = 0.9.10 mustache_java_version = 0.9.10
preprocessor_version = 0.1.0-41 preprocessor_version = 0.1.0-41
relast_version = 0.3.0-137
dumpAst_version = 1.2.0
...@@ -31,7 +31,7 @@ configurations { ...@@ -31,7 +31,7 @@ configurations {
} }
dependencies { dependencies {
relast group: 'org.jastadd', name: 'relast', version: "0.3.0-137" relast group: 'org.jastadd', name: 'relast', version: "${relast_version}"
implementation group: 'org.jastadd', name: 'relast-preprocessor', version: "${preprocessor_version}" implementation group: 'org.jastadd', name: 'relast-preprocessor', version: "${preprocessor_version}"
implementation group: 'com.github.spullara.mustache.java', name: 'compiler', version: "${mustache_java_version}" implementation group: 'com.github.spullara.mustache.java', name: 'compiler', version: "${mustache_java_version}"
jastadd2 group: 'org.jastadd', name: 'jastadd2', version: '2.3.5-dresden' jastadd2 group: 'org.jastadd', name: 'jastadd2', version: '2.3.5-dresden'
... ...
......
...@@ -25,9 +25,6 @@ private int {{parentTypeName}}.{{resolveInListMethodName}}(String topic) { ...@@ -25,9 +25,6 @@ private int {{parentTypeName}}.{{resolveInListMethodName}}(String topic) {
*/ */
public boolean {{parentTypeName}}.{{connectMethodName}}(String {{connectParameterName}}{{#typeIsList}}{{#IndexBasedListAccess}}{{^WithAdd}}, int index{{/WithAdd}}{{/IndexBasedListAccess}}{{/typeIsList}}) throws java.io.IOException { public boolean {{parentTypeName}}.{{connectMethodName}}(String {{connectParameterName}}{{#typeIsList}}{{#IndexBasedListAccess}}{{^WithAdd}}, int index{{/WithAdd}}{{/IndexBasedListAccess}}{{/typeIsList}}) throws java.io.IOException {
java.util.function.BiConsumer<String, byte[]> consumer = (topic, message) -> { java.util.function.BiConsumer<String, byte[]> consumer = (topic, message) -> {
{{#configEvaluationCounter}}
{{evaluationCounterVariable}}.incrementReceive("{{parentTypeName}}", "{{entityName}}");
{{/configEvaluationCounter}}
{{> mappingApplication}} {{> mappingApplication}}
{{#configLoggingEnabledForReads}} {{#configLoggingEnabledForReads}}
{{logDebug}}("[Receive] {{log_}} -> {{entityName}} = {{log_}}", {{connectParameterName}}, {{lastResult}}); {{logDebug}}("[Receive] {{log_}} -> {{entityName}} = {{log_}}", {{connectParameterName}}, {{lastResult}});
...@@ -60,6 +57,9 @@ public boolean {{parentTypeName}}.{{connectMethodName}}(String {{connectParamete ...@@ -60,6 +57,9 @@ public boolean {{parentTypeName}}.{{connectMethodName}}(String {{connectParamete
{{^hasTypeEndpointTarget}} {{^hasTypeEndpointTarget}}
set{{entityName}}({{lastResult}}); set{{entityName}}({{lastResult}});
{{/hasTypeEndpointTarget}} {{/hasTypeEndpointTarget}}
{{#configEvaluationCounter}}
{{evaluationCounterVariable}}.incrementReceive("{{parentTypeName}}", "{{entityName}}");
{{/configEvaluationCounter}}
}; };
return {{internalConnectMethodName}}({{connectParameterName}}, consumer); return {{internalConnectMethodName}}({{connectParameterName}}, consumer);
} }
... ...
......
...@@ -47,7 +47,7 @@ dependencies { ...@@ -47,7 +47,7 @@ dependencies {
testImplementation project(':ragconnect.base') testImplementation project(':ragconnect.base')
implementation group: 'org.jastadd', name: 'jastadd2', version: '2.3.5-dresden-7' implementation group: 'org.jastadd', name: 'jastadd2', version: '2.3.5-dresden-7'
relast group: 'org.jastadd', name: 'relast', version: "0.3.0-137" relast group: 'org.jastadd', name: 'relast', version: "${relast_version}"
testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: '5.4.0' testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: '5.4.0'
testRuntimeOnly group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: '5.4.0' testRuntimeOnly group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: '5.4.0'
...@@ -64,7 +64,7 @@ dependencies { ...@@ -64,7 +64,7 @@ dependencies {
// rest and client // rest and client
testImplementation group: 'com.sparkjava', name: 'spark-core', version: '2.9.3' testImplementation group: 'com.sparkjava', name: 'spark-core', version: '2.9.3'
testImplementation group: 'org.apache.logging.log4j', name: 'log4j-slf4j-impl', version: '2.17.1' testImplementation group: 'org.apache.logging.log4j', name: 'log4j-slf4j-impl', version: "${log4j_version}"
testImplementation group: 'org.glassfish.jersey.core', name: 'jersey-client', version: '2.31' testImplementation group: 'org.glassfish.jersey.core', name: 'jersey-client', version: '2.31'
testImplementation group: 'org.glassfish.jersey.inject', name: 'jersey-hk2', version: '2.31' testImplementation group: 'org.glassfish.jersey.inject', name: 'jersey-hk2', version: '2.31'
testImplementation group: 'javax.activation', name: 'activation', version: '1.1.1' testImplementation group: 'javax.activation', name: 'activation', version: '1.1.1'
...@@ -72,7 +72,7 @@ dependencies { ...@@ -72,7 +72,7 @@ dependencies {
testImplementation group: 'net.sf.beaver', name: 'beaver-rt', version: '0.9.11' testImplementation group: 'net.sf.beaver', name: 'beaver-rt', version: '0.9.11'
api group: 'com.google.protobuf', name: 'protobuf-java', version: '3.0.0' api group: 'com.google.protobuf', name: 'protobuf-java', version: '3.0.0'
implementation group: 'de.tudresden.inf.st', name: 'dumpAst', version: "1.0.2-68" implementation group: 'de.tudresden.inf.st', name: 'dumpAst', version: "${dumpAst_version}"
} }
// --- Preprocessors --- // --- Preprocessors ---
... ...
......
...@@ -23,12 +23,12 @@ A _n_ = Input _n_ + _n_, e.g., A1 = Input1 + 1 and A3 = Input3 + 3 ...@@ -23,12 +23,12 @@ A _n_ = Input _n_ + _n_, e.g., A1 = Input1 + 1 and A3 = Input3 + 3
## Execution-Trace (SendInitialValue) ## Execution-Trace (SendInitialValue)
| Input | [A1,A2,A3,A4,IO] | # | A* | UsingWcA | WithAddA | UsingWcWithAddA:A | | Input | [A1,A2,A3,A4,IO] | # | A* | UsingWcA | WithAddA | UsingWcWithAddA:A |
|---|---|---|---|---|---|---| |-------|------------------|-----|-------------|-------------|---------------------|---------------------|
| * | [1,2,3,4,0] | 5 | [1,2,3,4,0] | [1,2,3,4,0] | [1,2,3,4,0] | [1,2,3,4,0] | | * | [1,2,3,4,0] | 5 | [1,2,3,4,0] | [1,2,3,4,0] | [1,2,3,4,0] | [1,2,3,4,0] |
| I1:1 | [2,2,3,4,0] | 6 | [2,2,3,4,0] | [2,2,3,4,0] | [1,2,3,4,0,2] | [1,2,3,4,0,2] | | I1:1 | [2,2,3,4,0] | 6 | [2,2,3,4,0] | [2,2,3,4,0] | [1,2,3,4,0,2] | [1,2,3,4,0,2] |
| I1:1 | [2,2,3,4,0] | 6 | [2,2,3,4,0] | [2,2,3,4,0] | [1,2,3,4,0,2] | [1,2,3,4,0,2] | | I1:1 | [2,2,3,4,0] | 6 | [2,2,3,4,0] | [2,2,3,4,0] | [1,2,3,4,0,2] | [1,2,3,4,0,2] |
| I1:2 | [3,2,3,4,0] | 7 | [3,2,3,4,0] | [3,2,3,4,0] | [1,2,3,4,0,2,3] | [1,2,3,4,0,2,3] | | I1:2 | [3,2,3,4,0] | 7 | [3,2,3,4,0] | [3,2,3,4,0] | [1,2,3,4,0,2,3] | [1,2,3,4,0,2,3] |
| IO:5 | [3,2,3,4,5] | 8 | [3,2,3,4,5] | [3,2,3,4,5] | [1,2,3,4,0,2,3,5] | [1,2,3,4,0,2,3,5] | IO:5 | [3,2,3,4,5] | 8 | [3,2,3,4,5] | [3,2,3,4,5] | [1,2,3,4,0,2,3,5] | [1,2,3,4,0,2,3,5] |
| I3:4 | [3,2,7,4,5] | 9 | [3,2,7,4,5] | [3,2,7,4,5] | [1,2,3,4,0,2,3,5,7] | [1,2,3,4,0,2,3,5,7] | | I3:4 | [3,2,7,4,5] | 9 | [3,2,7,4,5] | [3,2,7,4,5] | [1,2,3,4,0,2,3,5,7] | [1,2,3,4,0,2,3,5,7] |
*: (1:0, 2:0, 3:0, 4:0, 5:0) *: (1:0, 2:0, 3:0, 4:0, 5:0)
...@@ -36,12 +36,12 @@ A _n_ = Input _n_ + _n_, e.g., A1 = Input1 + 1 and A3 = Input3 + 3 ...@@ -36,12 +36,12 @@ A _n_ = Input _n_ + _n_, e.g., A1 = Input1 + 1 and A3 = Input3 + 3
## Execution-Trace (OnlyUpdate) ## Execution-Trace (OnlyUpdate)
| Input | [A1,A2,A3,A4,IO] | # | A* | UsingWcA | WithAddA | UsingWcWithAddA:A | | Input | [A1,A2,A3,A4,IO] | # | A* | UsingWcA | WithAddA | UsingWcWithAddA:A |
|---|---|---|---|---|---|---| |-------|------------------|-----|-------------|----------|-----------|-------------------|
| * | [-,-,-,-,-] | 0 | [0,0,0,0,0] | [] | [] | [] | | * | [-,-,-,-,-] | 0 | [0,0,0,0,0] | [] | [] | [] |
| I1:1 | [2,-,-,-,-] | 1 | [2,0,0,0,0] | [2] | [2] | [2] | | I1:1 | [2,-,-,-,-] | 1 | [2,0,0,0,0] | [2] | [2] | [2] |
| I1:1 | [2,-,-,-,-] | 1 | [2,0,0,0,0] | [2] | [2] | [2] | | I1:1 | [2,-,-,-,-] | 1 | [2,0,0,0,0] | [2] | [2] | [2] |
| I1:2 | [3,-,-,-,-] | 2 | [3,0,0,0,0] | [3] | [2,3] | [2,3] | | I1:2 | [3,-,-,-,-] | 2 | [3,0,0,0,0] | [3] | [2,3] | [2,3] |
| IO:5 | [2,-,-,-,5] | 3 | [3,0,0,0,5] | [3,5] | [2,3,5] | [2,3,5] | IO:5 | [2,-,-,-,5] | 3 | [3,0,0,0,5] | [3,5] | [2,3,5] | [2,3,5] |
| I3:4 | [2,-,7,-,5] | 4 | [3,0,7,0,5] | [3,5,7] | [2,3,5,7] | [2,3,5,7] | | I3:4 | [2,-,7,-,5] | 4 | [3,0,7,0,5] | [3,5,7] | [2,3,5,7] | [2,3,5,7] |
*: (1:0, 2:0, 3:0, 4:0, 5:0) *: (1:0, 2:0, 3:0, 4:0, 5:0)
package org.jastadd.ragconnect.tests; package org.jastadd.ragconnect.tests;
import attributeInc.ast.*; import attributeInc.ast.*;
import de.tudresden.inf.st.jastadd.dumpAst.ast.Dumper;
import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Tag;
import java.io.IOException; import java.io.IOException;
import java.nio.file.Paths;
import java.util.Objects; import java.util.Objects;
import java.util.concurrent.Callable; import java.util.concurrent.Callable;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.function.Predicate; import java.util.function.Predicate;
import java.util.function.Supplier; import java.util.function.Supplier;
import org.jastadd.ragconnect.tests.TestUtils.TestChecker;
import static java.util.function.Predicate.isEqual; import static java.util.function.Predicate.isEqual;
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
...@@ -22,6 +25,7 @@ import static org.junit.jupiter.api.Assertions.*; ...@@ -22,6 +25,7 @@ import static org.junit.jupiter.api.Assertions.*;
* @author rschoene - Initial contribution * @author rschoene - Initial contribution
*/ */
@Tag("Incremental") @Tag("Incremental")
@Tag("New")
public class AttributeTest extends AbstractMqttTest { public class AttributeTest extends AbstractMqttTest {
private static final String TOPIC_WILDCARD = "attr/#"; private static final String TOPIC_WILDCARD = "attr/#";
...@@ -84,7 +88,7 @@ public class AttributeTest extends AbstractMqttTest { ...@@ -84,7 +88,7 @@ public class AttributeTest extends AbstractMqttTest {
data = new ReceiverData(); data = new ReceiverData();
assertTrue(handler.newConnection(TOPIC_WILDCARD, bytes -> data.numberOfValues += 1)); assertTrue(handler.newConnection(TOPIC_WILDCARD, bytes -> data.numberOfValues += 1));
checker = new TestUtils.TestChecker(); checker = new TestChecker();
checker.setActualNumberOfValues(() -> data.numberOfValues) checker.setActualNumberOfValues(() -> data.numberOfValues)
.setCheckForString(CHECK_BASIC, this::checkBasic) .setCheckForString(CHECK_BASIC, this::checkBasic)
.setCheckForString(CHECK_SIMPLE, this::checkSimple) .setCheckForString(CHECK_SIMPLE, this::checkSimple)
...@@ -147,6 +151,35 @@ public class AttributeTest extends AbstractMqttTest { ...@@ -147,6 +151,35 @@ public class AttributeTest extends AbstractMqttTest {
.put(CHECK_CIRCULAR, INITIAL_STRING_FOR_INT_PLUS_2) .put(CHECK_CIRCULAR, INITIAL_STRING_FOR_INT_PLUS_2)
.put(CHECK_COLLECTION, "[" + INITIAL_STRING + "]"); .put(CHECK_COLLECTION, "[" + INITIAL_STRING + "]");
if (!TestUtils.isCi()) {
Dumper.read(model)
.includeAttributeWhen((node, attributeName, isNTA, value) -> {
switch (attributeName) {
case "basic":
case "simple":
case "collectionAttribute":
return node.equals(senderString);
case "transformed":
case "circularAttribute":
return node.equals(senderInt);
case "toReferenceType":
case "toNTA":
return node.equals(senderA);
}
return false;
})
.includeChildWhen((parentNode, childNode, contextName) -> !contextName.equals("Inner"))
.setNameMethod(node -> {
if (node instanceof SenderRoot) {
String suffix = node.equals(senderString) ? "(String)" :
node.equals(senderInt) ? "(int)" : "(reference type)";
return "SenderRoot " + suffix;
}
return node.getClass().getSimpleName();
})
.dumpAsPNG(Paths.get("attribute.png"));
}
communicateBoth(); communicateBoth();
} }
... ...
......
...@@ -43,8 +43,12 @@ public class TestUtils { ...@@ -43,8 +43,12 @@ public class TestUtils {
public static final String INPUT_DIRECTORY_PREFIX = "./src/test/01-input/"; public static final String INPUT_DIRECTORY_PREFIX = "./src/test/01-input/";
public static final String OUTPUT_DIRECTORY_PREFIX = "./src/test/02-after-ragconnect/"; public static final String OUTPUT_DIRECTORY_PREFIX = "./src/test/02-after-ragconnect/";
public static boolean isCi() {
return System.getenv("GITLAB_CI") != null;
}
public static String getMqttHost() { public static String getMqttHost() {
if (System.getenv("GITLAB_CI") != null) { if (isCi()) {
// we are in the CI, so use "mqtt" as host // we are in the CI, so use "mqtt" as host
return "mqtt"; return "mqtt";
} { } {
... ...
......
...@@ -8,3 +8,4 @@ rootProject.name = 'ragconnect' ...@@ -8,3 +8,4 @@ rootProject.name = 'ragconnect'
include 'ragconnect.base' include 'ragconnect.base'
include 'ragconnect.tests' include 'ragconnect.tests'
include 'ragconnect.featureTest'
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment