Skip to content
Snippets Groups Projects
Commit 519cd508 authored by René Schöne's avatar René Schöne
Browse files

WIP: working on correct connect and disconnect

- move IntList to TestUtils
- make resolve-element for wildcard connections a method (instead of an attribute). would never be a cache-hit anyway
- added Lock in MqttHandler to avoid simultaneous access/modification of AST
- extend base.clean to remove generated aspects as well
parent b1301aee
No related branches found
No related tags found
1 merge request!12Ensure correct connect and disconnect functionality
Pipeline #10701 passed
Showing
with 88 additions and 106 deletions
...@@ -108,6 +108,14 @@ task relast(type: JavaExec) { ...@@ -108,6 +108,14 @@ task relast(type: JavaExec) {
'./src/gen/jastadd/RagConnectResolverStubs.jrag') './src/gen/jastadd/RagConnectResolverStubs.jrag')
} }
clean {
delete "src/gen/jastadd/Coverage.jrag"
delete "src/gen/jastadd/RagConnect.ast"
delete "src/gen/jastadd/RagConnect.jadd"
delete "src/gen/jastadd/RagConnectRefResolver.jadd"
delete "src/gen/jastadd/RagConnectResolverStubs.jrag"
}
jastadd { jastadd {
configureModuleBuild() configureModuleBuild()
modules { modules {
......
...@@ -165,7 +165,7 @@ aspect AttributesForMustache { ...@@ -165,7 +165,7 @@ aspect AttributesForMustache {
eq MTypeReceiveDefinition.updateMethod() = null; eq MTypeReceiveDefinition.updateMethod() = null;
eq MTypeReceiveDefinition.writeMethod() = null; eq MTypeReceiveDefinition.writeMethod() = null;
syn String MTypeReceiveDefinition.resolveInListAttributeName() = "resolve" + entityName() + "InList"; syn String MTypeReceiveDefinition.resolveInListMethodName() = "_ragconnect_resolve" + entityName() + "InList";
syn String MTypeReceiveDefinition.idTokenName() = endpointDef().idTokenName(); syn String MTypeReceiveDefinition.idTokenName() = endpointDef().idTokenName();
// MTypeSendDefinition // MTypeSendDefinition
......
...@@ -99,6 +99,7 @@ public class MqttHandler { ...@@ -99,6 +99,7 @@ public class MqttHandler {
private org.fusesource.mqtt.client.CallbackConnection connection; private org.fusesource.mqtt.client.CallbackConnection connection;
/** Whether we are connected yet */ /** Whether we are connected yet */
private final java.util.concurrent.CountDownLatch readyLatch; private final java.util.concurrent.CountDownLatch readyLatch;
private final java.util.concurrent.locks.Lock astLock;
private boolean sendWelcomeMessage = true; private boolean sendWelcomeMessage = true;
private org.fusesource.mqtt.client.QoS qos; private org.fusesource.mqtt.client.QoS qos;
/** Dispatch knowledge */ /** Dispatch knowledge */
...@@ -116,6 +117,7 @@ public class MqttHandler { ...@@ -116,6 +117,7 @@ public class MqttHandler {
this.wildcardCallbacks = new java.util.ArrayList<>(); this.wildcardCallbacks = new java.util.ArrayList<>();
this.readyLatch = new java.util.concurrent.CountDownLatch(1); this.readyLatch = new java.util.concurrent.CountDownLatch(1);
this.qos = org.fusesource.mqtt.client.QoS.AT_LEAST_ONCE; this.qos = org.fusesource.mqtt.client.QoS.AT_LEAST_ONCE;
this.astLock = new java.util.concurrent.locks.ReentrantLock();
} }
public MqttHandler dontSendWelcomeMessage() { public MqttHandler dontSendWelcomeMessage() {
...@@ -178,9 +180,12 @@ public class MqttHandler { ...@@ -178,9 +180,12 @@ public class MqttHandler {
byte[] message = body.toByteArray(); byte[] message = body.toByteArray();
for (java.util.function.BiConsumer<String, byte[]> callback : callbackList) { for (java.util.function.BiConsumer<String, byte[]> callback : callbackList) {
try { try {
astLock.lock();
callback.accept(topicString, message); callback.accept(topicString, message);
} catch (Exception e) { } catch (Exception e) {
logger.catching(e); logger.catching(e);
} finally {
astLock.unlock();
} }
} }
} }
...@@ -479,6 +484,8 @@ public class MqttHandler { ...@@ -479,6 +484,8 @@ public class MqttHandler {
} }
public void publish(String topic, byte[] bytes, org.fusesource.mqtt.client.QoS qos, boolean retain) { public void publish(String topic, byte[] bytes, org.fusesource.mqtt.client.QoS qos, boolean retain) {
try {
astLock.lock();
connection.getDispatchQueue().execute(() -> { connection.getDispatchQueue().execute(() -> {
connection.publish(topic, bytes, qos, retain, new org.fusesource.mqtt.client.Callback<>() { connection.publish(topic, bytes, qos, retain, new org.fusesource.mqtt.client.Callback<>() {
@Override @Override
...@@ -492,6 +499,9 @@ public class MqttHandler { ...@@ -492,6 +499,9 @@ public class MqttHandler {
} }
}); });
}); });
} finally {
astLock.unlock();
}
} }
} }
} }
{{#typeIsList}} {{#typeIsList}}
{{^UseList}} {{^UseList}}
/* first try with resolve to type private int {{parentTypeName}}.{{resolveInListMethodName}}(String topic) {
syn {{typeName}} {{parentTypeName}}.{{resolveInListAttributeName}}(String topic) {
for ({{typeName}} element : get{{entityName}}()) {
if (element.get{{idTokenName}}().equals(topic)) {
return element;
}
}
return null;
}
*/
syn int {{parentTypeName}}.{{resolveInListAttributeName}}(String topic) {
for (int index = 0; index < getNum{{entityName}}(); index++) { for (int index = 0; index < getNum{{entityName}}(); index++) {
if (get{{entityName}}(index).get{{idTokenName}}().equals(topic)) { if (get{{entityName}}(index).get{{idTokenName}}().equals(topic)) {
return index; return index;
...@@ -85,7 +75,7 @@ public boolean {{parentTypeName}}.{{connectMethod}}(String {{connectParameterNam ...@@ -85,7 +75,7 @@ public boolean {{parentTypeName}}.{{connectMethod}}(String {{connectParameterNam
System.out.println("[Receive] " + {{connectParameterName}} + " (" + topic + ") -> {{entityName}} = " + {{lastResult}}); System.out.println("[Receive] " + {{connectParameterName}} + " (" + topic + ") -> {{entityName}} = " + {{lastResult}});
{{/loggingEnabledForReads}} {{/loggingEnabledForReads}}
{{lastResult}}.set{{idTokenName}}(topic); {{lastResult}}.set{{idTokenName}}(topic);
int resolvedIndex = {{resolveInListAttributeName}}(topic); int resolvedIndex = {{resolveInListMethodName}}(topic);
if (resolvedIndex == -1) { if (resolvedIndex == -1) {
add{{entityName}}({{lastResult}}); add{{entityName}}({{lastResult}});
} else { } else {
......
...@@ -14,8 +14,12 @@ import java.nio.file.Paths; ...@@ -14,8 +14,12 @@ import java.nio.file.Paths;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import static java.lang.Math.abs;
import static java.util.Collections.addAll;
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.util.Lists.newArrayList;
import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.fail; import static org.junit.jupiter.api.Assertions.fail;
...@@ -136,6 +140,25 @@ public class TestUtils { ...@@ -136,6 +140,25 @@ public class TestUtils {
TimeUnit.MILLISECONDS.sleep(1500); TimeUnit.MILLISECONDS.sleep(1500);
} }
public static class IntList {
private final List<Integer> integers = newArrayList();
public IntList(Integer... values) {
addAll(integers, values);
}
public List<Integer> toList() {
return integers;
}
public List<Integer> toAbsList() {
return integers.stream().map(Math::abs).collect(Collectors.toList());
}
public static IntList list(Integer... values) {
return new IntList(values);
}
}
@SuppressWarnings({"unused", "rawtypes"}) @SuppressWarnings({"unused", "rawtypes"})
public static class DefaultMappings { public static class DefaultMappings {
static class ReadNode extends defaultOnlyRead.ast.ASTNode { static class ReadNode extends defaultOnlyRead.ast.ASTNode {
......
...@@ -2,6 +2,7 @@ package org.jastadd.ragconnect.tests.list; ...@@ -2,6 +2,7 @@ package org.jastadd.ragconnect.tests.list;
import org.jastadd.ragconnect.tests.AbstractMqttTest; import org.jastadd.ragconnect.tests.AbstractMqttTest;
import org.jastadd.ragconnect.tests.TestUtils; import org.jastadd.ragconnect.tests.TestUtils;
import org.jastadd.ragconnect.tests.TestUtils.IntList;
import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
...@@ -10,9 +11,7 @@ import java.nio.file.Paths; ...@@ -10,9 +11,7 @@ import java.nio.file.Paths;
import java.util.List; import java.util.List;
import java.util.function.Function; import java.util.function.Function;
import static java.util.Collections.addAll; import static org.jastadd.ragconnect.tests.TestUtils.IntList.list;
import static org.assertj.core.util.Lists.newArrayList;
import static org.jastadd.ragconnect.tests.list.AbstractListTest.IntList.list;
import static org.jastadd.ragconnect.tests.TestUtils.testJaddContainReferenceToJackson; import static org.jastadd.ragconnect.tests.TestUtils.testJaddContainReferenceToJackson;
import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
...@@ -181,19 +180,4 @@ public abstract class AbstractListTest extends AbstractMqttTest { ...@@ -181,19 +180,4 @@ public abstract class AbstractListTest extends AbstractMqttTest {
int numberOfElements = 0; int numberOfElements = 0;
} }
protected static class IntList {
private final List<Integer> integers = newArrayList();
public IntList(Integer... values) {
addAll(integers, values);
}
public List<Integer> toList() {
return integers;
}
public static IntList list(Integer... values) {
return new IntList(values);
}
}
} }
...@@ -2,6 +2,7 @@ package org.jastadd.ragconnect.tests.singleList; ...@@ -2,6 +2,7 @@ package org.jastadd.ragconnect.tests.singleList;
import org.jastadd.ragconnect.tests.AbstractMqttTest; import org.jastadd.ragconnect.tests.AbstractMqttTest;
import org.jastadd.ragconnect.tests.TestUtils; import org.jastadd.ragconnect.tests.TestUtils;
import org.jastadd.ragconnect.tests.TestUtils.IntList;
import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import singleList.ast.MqttHandler; import singleList.ast.MqttHandler;
...@@ -16,11 +17,9 @@ import java.util.concurrent.CountDownLatch; ...@@ -16,11 +17,9 @@ import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.function.Function; import java.util.function.Function;
import static java.util.Collections.addAll; import static org.jastadd.ragconnect.tests.TestUtils.IntList.list;
import static org.assertj.core.util.Lists.newArrayList;
import static org.jastadd.ragconnect.tests.TestUtils.mqttUri; import static org.jastadd.ragconnect.tests.TestUtils.mqttUri;
import static org.jastadd.ragconnect.tests.TestUtils.testJaddContainReferenceToJackson; import static org.jastadd.ragconnect.tests.TestUtils.testJaddContainReferenceToJackson;
import static org.jastadd.ragconnect.tests.singleList.AbstractSingleListTest.IntList.list;
import static org.junit.jupiter.api.Assertions.*; import static org.junit.jupiter.api.Assertions.*;
/** /**
...@@ -30,7 +29,6 @@ import static org.junit.jupiter.api.Assertions.*; ...@@ -30,7 +29,6 @@ import static org.junit.jupiter.api.Assertions.*;
*/ */
@Tag("List") @Tag("List")
@Tag("SingleList") @Tag("SingleList")
@Tag("New")
public abstract class AbstractSingleListTest extends AbstractMqttTest { public abstract class AbstractSingleListTest extends AbstractMqttTest {
public interface TestWrapperJastAddList<T> extends Iterable<T> { public interface TestWrapperJastAddList<T> extends Iterable<T> {
...@@ -341,19 +339,4 @@ public abstract class AbstractSingleListTest extends AbstractMqttTest { ...@@ -341,19 +339,4 @@ public abstract class AbstractSingleListTest extends AbstractMqttTest {
int numberOfElements = 0; int numberOfElements = 0;
} }
protected static class IntList {
private final List<Integer> integers = newArrayList();
public IntList(Integer... values) {
addAll(integers, values);
}
public List<Integer> toList() {
return integers;
}
public static IntList list(Integer... values) {
return new IntList(values);
}
}
} }
...@@ -11,7 +11,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; ...@@ -11,7 +11,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.jupiter.api.Assertions.assertTrue;
/** /**
* Test case "list incremental". * Test case "single list incremental".
* *
* @author rschoene - Initial contribution * @author rschoene - Initial contribution
*/ */
......
...@@ -10,7 +10,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; ...@@ -10,7 +10,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.jupiter.api.Assertions.assertTrue;
/** /**
* Test case "list manual". * Test case "single list manual".
* *
* @author rschoene - Initial contribution * @author rschoene - Initial contribution
*/ */
......
package org.jastadd.ragconnect.tests.singleListVariant; package org.jastadd.ragconnect.tests.singleListVariant;
import org.assertj.core.api.Assertions;
import org.jastadd.ragconnect.tests.AbstractMqttTest; import org.jastadd.ragconnect.tests.AbstractMqttTest;
import org.jastadd.ragconnect.tests.TestUtils; import org.jastadd.ragconnect.tests.TestUtils;
import org.jastadd.ragconnect.tests.TestUtils.IntList;
import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
...@@ -11,16 +13,14 @@ import java.util.List; ...@@ -11,16 +13,14 @@ import java.util.List;
import java.util.function.BiConsumer; import java.util.function.BiConsumer;
import static java.lang.Math.abs; import static java.lang.Math.abs;
import static java.util.Collections.addAll; import static org.jastadd.ragconnect.tests.TestUtils.IntList.list;
import static org.assertj.core.util.Lists.newArrayList;
import static org.jastadd.ragconnect.tests.TestUtils.mqttUri; import static org.jastadd.ragconnect.tests.TestUtils.mqttUri;
import static org.jastadd.ragconnect.tests.TestUtils.testJaddContainReferenceToJackson; import static org.jastadd.ragconnect.tests.TestUtils.testJaddContainReferenceToJackson;
import static org.jastadd.ragconnect.tests.singleListVariant.AbstractSingleListVariantTest.IntList.list;
import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.jupiter.api.Assertions.assertTrue;
/** /**
* Base class for test cases "singleList manual" and "singleList incremental". * Base class for test cases "singleList variant manual" and "singleList variant incremental".
* *
* @author rschoene - Initial contribution * @author rschoene - Initial contribution
*/ */
...@@ -373,31 +373,31 @@ public abstract class AbstractSingleListVariantTest extends AbstractMqttTest { ...@@ -373,31 +373,31 @@ public abstract class AbstractSingleListVariantTest extends AbstractMqttTest {
assertEquals(expectedTransmissions, data.numberOfElements, "transmissions for any element"); assertEquals(expectedTransmissions, data.numberOfElements, "transmissions for any element");
// check unnamed // check unnamed
checkList(expectedList.toList(), receiverRoot.getT_EmptyList(), (e, n) -> {}); checkList(expectedList, receiverRoot.getT_EmptyList(), (e, n) -> {});
checkList(expectedList.toList(), receiverRoot.getT_TokenList(), checkList(expectedList, receiverRoot.getT_TokenList(),
(e, n) -> assertEquals(Integer.toString(abs(e)), n.getValue())); (e, n) -> assertEquals(Integer.toString(abs(e)), n.getValue()));
checkList(expectedList.toList(), receiverRoot.getT_OneChildList(), checkList(expectedList, receiverRoot.getT_OneChildList(),
(e, n) -> assertEquals(abs(e) + 1, n.getOther().getID())); (e, n) -> assertEquals(abs(e) + 1, n.getOther().getID()));
checkList(expectedList.toList(), receiverRoot.getT_OneOptList(), checkList(expectedList, receiverRoot.getT_OneOptList(),
(e, n) -> { (e, n) -> {
assertEquals(e > 0, n.hasOther()); assertEquals(e > 0, n.hasOther());
if (n.hasOther()) { if (n.hasOther()) {
assertEquals(abs(e) + 1, n.getOther().getID()); assertEquals(abs(e) + 1, n.getOther().getID());
} }
}); });
checkList(expectedList.toList(), receiverRoot.getT_OneListList(), checkList(expectedList, receiverRoot.getT_OneListList(),
(e, n) -> { (e, n) -> {
assertEquals(e > 0 ? 1 : 0, n.getNumOther()); assertEquals(e > 0 ? 1 : 0, n.getNumOther());
if (n.getNumOther() > 0) { if (n.getNumOther() > 0) {
assertEquals(abs(e) + 1, n.getOther(0).getID()); assertEquals(abs(e) + 1, n.getOther(0).getID());
} }
}); });
checkList(expectedList.toList(), receiverRoot.getT_TwoChildrenList(), checkList(expectedList, receiverRoot.getT_TwoChildrenList(),
(e, n) -> { (e, n) -> {
assertEquals(abs(e) + 1, n.getLeft().getID()); assertEquals(abs(e) + 1, n.getLeft().getID());
assertEquals(abs(e) + 1, n.getRight().getID()); assertEquals(abs(e) + 1, n.getRight().getID());
}); });
checkList(expectedList.toList(), receiverRoot.getT_OneOfEachList(), checkList(expectedList, receiverRoot.getT_OneOfEachList(),
(e, n) -> { (e, n) -> {
assertEquals(abs(e) + 1, n.getFirst().getID()); assertEquals(abs(e) + 1, n.getFirst().getID());
assertEquals(e > 0, n.hasSecond()); assertEquals(e > 0, n.hasSecond());
...@@ -410,39 +410,39 @@ public abstract class AbstractSingleListVariantTest extends AbstractMqttTest { ...@@ -410,39 +410,39 @@ public abstract class AbstractSingleListVariantTest extends AbstractMqttTest {
} }
assertEquals(Integer.toString(abs(e)), n.getFourth()); assertEquals(Integer.toString(abs(e)), n.getFourth());
}); });
checkList(expectedList.toList(), receiverRoot.getT_AbstractList(), checkList(expectedList, receiverRoot.getT_AbstractList(),
(e, n) -> { (e, n) -> {
assertEquals(Integer.toString(abs(e)), n.getValueAbstract()); assertEquals(Integer.toString(abs(e)), n.getValueAbstract());
assertEquals(Integer.toString(abs(e)), n.getValueSub()); assertEquals(Integer.toString(abs(e)), n.getValueSub());
}); });
// check named // check named
checkList(expectedList.toList(), receiverRoot.getMyEmptyList(), (e, n) -> {}); checkList(expectedList, receiverRoot.getMyEmptyList(), (e, n) -> {});
// check with add // check with add
checkList(expectedWithAddList.toList(), receiverRoot.getEmptyWithAddList(), (e, n) -> {}); checkList(expectedWithAddList, receiverRoot.getEmptyWithAddList(), (e, n) -> {});
checkList(expectedWithAddList.toList(), receiverRoot.getTokenWithAddList(), checkList(expectedWithAddList, receiverRoot.getTokenWithAddList(),
(e, n) -> assertEquals(Integer.toString(abs(e)), n.getValue())); (e, n) -> assertEquals(Integer.toString(abs(e)), n.getValue()));
checkList(expectedWithAddList.toList(), receiverRoot.getOneChildWithAddList(), checkList(expectedWithAddList, receiverRoot.getOneChildWithAddList(),
(e, n) -> assertEquals(abs(e) + 1, n.getOther().getID())); (e, n) -> assertEquals(abs(e) + 1, n.getOther().getID()));
checkList(expectedWithAddListForOptAndList.toList(), receiverRoot.getOneOptWithAddList(), checkList(expectedWithAddListForOptAndList, receiverRoot.getOneOptWithAddList(),
(e, n) -> { (e, n) -> {
if (n.hasOther()) { if (n.hasOther()) {
assertEquals(abs(e) + 1, n.getOther().getID()); assertEquals(abs(e) + 1, n.getOther().getID());
} }
}); });
checkList(expectedWithAddListForOptAndList.toList(), receiverRoot.getOneListWithAddList(), checkList(expectedWithAddListForOptAndList, receiverRoot.getOneListWithAddList(),
(e, n) -> { (e, n) -> {
if (n.getNumOther() > 0) { if (n.getNumOther() > 0) {
assertEquals(abs(e) + 1, n.getOther(0).getID()); assertEquals(abs(e) + 1, n.getOther(0).getID());
} }
}); });
checkList(expectedWithAddList.toList(), receiverRoot.getTwoChildrenWithAddList(), checkList(expectedWithAddList, receiverRoot.getTwoChildrenWithAddList(),
(e, n) -> { (e, n) -> {
assertEquals(abs(e) + 1, n.getLeft().getID()); assertEquals(abs(e) + 1, n.getLeft().getID());
assertEquals(abs(e) + 1, n.getRight().getID()); assertEquals(abs(e) + 1, n.getRight().getID());
}); });
checkList(expectedWithAddListForOptAndList.toList(), receiverRoot.getOneOfEachWithAddList(), checkList(expectedWithAddListForOptAndList, receiverRoot.getOneOfEachWithAddList(),
(e, n) -> { (e, n) -> {
assertEquals(abs(e) + 1, n.getFirst().getID()); assertEquals(abs(e) + 1, n.getFirst().getID());
if (n.hasSecond()) { if (n.hasSecond()) {
...@@ -453,19 +453,19 @@ public abstract class AbstractSingleListVariantTest extends AbstractMqttTest { ...@@ -453,19 +453,19 @@ public abstract class AbstractSingleListVariantTest extends AbstractMqttTest {
} }
assertEquals(Integer.toString(abs(e)), n.getFourth()); assertEquals(Integer.toString(abs(e)), n.getFourth());
}); });
checkList(expectedWithAddList.toList(), receiverRoot.getAbstractWithAddList(), checkList(expectedWithAddList, receiverRoot.getAbstractWithAddList(),
(e, n) -> { (e, n) -> {
assertEquals(Integer.toString(abs(e)), n.getValueAbstract()); assertEquals(Integer.toString(abs(e)), n.getValueAbstract());
assertEquals(Integer.toString(abs(e)), n.getValueSub()); assertEquals(Integer.toString(abs(e)), n.getValueSub());
}); });
} }
private <T extends TestWrapperNameable> void checkList(List<Integer> expectedList, TestWrapperJastAddList<T> actualList, BiConsumer<Integer, T> additionalTest) { private <T extends TestWrapperNameable> void checkList(IntList expectedList, TestWrapperJastAddList<T> actualList, BiConsumer<Integer, T> additionalTest) {
assertEquals(expectedList.size(), actualList.getNumChild(), "same list size"); Assertions.assertThat(actualList).extracting("ID").containsExactlyElementsOf(expectedList.toAbsList());
List<Integer> normalExpectedList = expectedList.toList();
int index = 0; int index = 0;
for (T element : actualList) { for (T element : actualList) {
assertEquals(abs(expectedList.get(index)), element.getID(), "correct ID for A"); additionalTest.accept(normalExpectedList.get(index), element);
additionalTest.accept(expectedList.get(index), element);
index++; index++;
} }
} }
...@@ -474,19 +474,4 @@ public abstract class AbstractSingleListVariantTest extends AbstractMqttTest { ...@@ -474,19 +474,4 @@ public abstract class AbstractSingleListVariantTest extends AbstractMqttTest {
int numberOfElements = 0; int numberOfElements = 0;
} }
protected static class IntList {
private final List<Integer> integers = newArrayList();
public IntList(Integer... values) {
addAll(integers, values);
}
public List<Integer> toList() {
return integers;
}
public static IntList list(Integer... values) {
return new IntList(values);
}
}
} }
...@@ -11,12 +11,11 @@ import static org.junit.jupiter.api.Assertions.assertEquals; ...@@ -11,12 +11,11 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.jupiter.api.Assertions.assertTrue;
/** /**
* Test case "list incremental". * Test case "singleList variant incremental".
* *
* @author rschoene - Initial contribution * @author rschoene - Initial contribution
*/ */
@Tag("Incremental") @Tag("Incremental")
@Tag("New")
public class SingleListVariantIncrementalVariantTest extends AbstractSingleListVariantTest { public class SingleListVariantIncrementalVariantTest extends AbstractSingleListVariantTest {
private Root model; private Root model;
......
...@@ -10,7 +10,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; ...@@ -10,7 +10,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.jupiter.api.Assertions.assertTrue;
/** /**
* Test case "list manual". * Test case "singleList variant manual".
* *
* @author rschoene - Initial contribution * @author rschoene - Initial contribution
*/ */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment