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

move TestUtils to separate package

- also extracted inner classes
parent 3fef53c6
No related branches found
No related tags found
1 merge request!33Resolve "Refactorings/Clean-Up"
Showing
with 108 additions and 731 deletions
......@@ -2,9 +2,8 @@ package org.jastadd.ragconnect.tests;
import defaultOnlyRead.ast.MqttHandler;
import io.github.artsok.RepeatedIfExceptionsTest;
import org.jastadd.ragconnect.tests.utils.TestUtils;
import org.junit.jupiter.api.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.util.concurrent.TimeUnit;
......
......@@ -2,6 +2,7 @@ package org.jastadd.ragconnect.tests;
import attributeInc.ast.*;
import de.tudresden.inf.st.jastadd.dumpAst.ast.Dumper;
import org.jastadd.ragconnect.tests.utils.TestUtils;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Tag;
......@@ -12,11 +13,11 @@ import java.util.concurrent.Callable;
import java.util.concurrent.TimeUnit;
import java.util.function.Predicate;
import java.util.function.Supplier;
import org.jastadd.ragconnect.tests.TestUtils.TestChecker;
import org.jastadd.ragconnect.tests.utils.TestChecker;
import static java.util.function.Predicate.isEqual;
import static org.assertj.core.api.Assertions.assertThat;
import static org.jastadd.ragconnect.tests.TestUtils.*;
import static org.jastadd.ragconnect.tests.utils.TestUtils.*;
import static org.junit.jupiter.api.Assertions.*;
/**
......
......@@ -4,13 +4,16 @@ import contextFreeSimpleInc.ast.A;
import contextFreeSimpleInc.ast.MqttHandler;
import contextFreeSimpleInc.ast.Root;
import contextFreeSimpleInc.ast.SerializationException;
import org.jastadd.ragconnect.tests.utils.DefaultMappings;
import org.jastadd.ragconnect.tests.utils.TestChecker;
import org.jastadd.ragconnect.tests.utils.TestUtils;
import org.junit.jupiter.api.Tag;
import java.io.IOException;
import java.util.Objects;
import java.util.concurrent.TimeUnit;
import static org.jastadd.ragconnect.tests.TestUtils.mqttUri;
import static org.jastadd.ragconnect.tests.utils.TestUtils.mqttUri;
import static org.junit.jupiter.api.Assertions.*;
/**
......@@ -41,7 +44,7 @@ public class ContextFreeSimpleTest extends AbstractMqttTest {
private ReceiverData data;
private MqttHandler handler;
private TestUtils.TestChecker checker;
private TestChecker checker;
@Override
protected void createModel() {
......@@ -70,7 +73,7 @@ public class ContextFreeSimpleTest extends AbstractMqttTest {
handler.newConnection(TOPIC_WILDCARD, (topic, bytes) -> data.valuesSent += 1);
checker = new TestUtils.TestChecker();
checker = new TestChecker();
checker.alwaysWait()
.setCheckForString(TOPIC_UNNAMED, (name, expected) -> this.check(name, expected, model.getA(), unnamedA))
.setCheckForString(TOPIC_SINGLE, (name, expected) -> this.check(name, expected, model.getSingleA(), singleA))
......@@ -143,7 +146,7 @@ public class ContextFreeSimpleTest extends AbstractMqttTest {
private void send(String topic, String value) throws IOException {
A a = new A().setValue(value);
try {
publisher.publish(topic, TestUtils.DefaultMappings.TreeToBytes(a::serialize));
publisher.publish(topic, DefaultMappings.TreeToBytes(a::serialize));
} catch (SerializationException e) {
throw new IOException(e);
}
......
......@@ -3,14 +3,16 @@ package org.jastadd.ragconnect.tests;
import defaultOnlyRead.ast.A;
import defaultOnlyRead.ast.BoxedTypes;
import defaultOnlyRead.ast.NativeTypes;
import org.jastadd.ragconnect.tests.utils.DefaultMappings;
import org.jastadd.ragconnect.tests.utils.TestUtils;
import org.junit.jupiter.api.Test;
import java.io.IOException;
import java.nio.file.Paths;
import java.util.concurrent.TimeUnit;
import static org.jastadd.ragconnect.tests.TestUtils.mqttUri;
import static org.jastadd.ragconnect.tests.TestUtils.testJaddContainReferenceToJackson;
import static org.jastadd.ragconnect.tests.utils.TestUtils.mqttUri;
import static org.jastadd.ragconnect.tests.utils.TestUtils.testJaddContainReferenceToJackson;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
......@@ -119,22 +121,22 @@ public class DefaultOnlyReadTest extends AbstractMqttTest {
final char expectedCharValue = 'c';
final String expectedStringValue = "6.3";
publisher.publish(TOPIC_NATIVE_BOOLEAN, TestUtils.DefaultMappings.BoolToBytes(expectedBooleanValue));
publisher.publish(TOPIC_NATIVE_INT, TestUtils.DefaultMappings.IntToBytes(expectedIntValue));
publisher.publish(TOPIC_NATIVE_SHORT, TestUtils.DefaultMappings.ShortToBytes(expectedShortValue));
publisher.publish(TOPIC_NATIVE_LONG, TestUtils.DefaultMappings.LongToBytes(expectedLongValue));
publisher.publish(TOPIC_NATIVE_FLOAT, TestUtils.DefaultMappings.FloatToBytes(expectedFloatValue));
publisher.publish(TOPIC_NATIVE_DOUBLE, TestUtils.DefaultMappings.DoubleToBytes(expectedDoubleValue));
publisher.publish(TOPIC_NATIVE_CHAR, TestUtils.DefaultMappings.CharToBytes(expectedCharValue));
publisher.publish(TOPIC_NATIVE_STRING, TestUtils.DefaultMappings.StringToBytes(expectedStringValue));
publisher.publish(TOPIC_BOXED_BOOLEAN, TestUtils.DefaultMappings.BoolToBytes(expectedBooleanValue));
publisher.publish(TOPIC_BOXED_INTEGER, TestUtils.DefaultMappings.IntToBytes(expectedIntValue));
publisher.publish(TOPIC_BOXED_SHORT, TestUtils.DefaultMappings.ShortToBytes(expectedShortValue));
publisher.publish(TOPIC_BOXED_LONG, TestUtils.DefaultMappings.LongToBytes(expectedLongValue));
publisher.publish(TOPIC_BOXED_FLOAT, TestUtils.DefaultMappings.FloatToBytes(expectedFloatValue));
publisher.publish(TOPIC_BOXED_DOUBLE, TestUtils.DefaultMappings.DoubleToBytes(expectedDoubleValue));
publisher.publish(TOPIC_BOXED_CHARACTER, TestUtils.DefaultMappings.CharToBytes(expectedCharValue));
publisher.publish(TOPIC_NATIVE_BOOLEAN, DefaultMappings.BoolToBytes(expectedBooleanValue));
publisher.publish(TOPIC_NATIVE_INT, DefaultMappings.IntToBytes(expectedIntValue));
publisher.publish(TOPIC_NATIVE_SHORT, DefaultMappings.ShortToBytes(expectedShortValue));
publisher.publish(TOPIC_NATIVE_LONG, DefaultMappings.LongToBytes(expectedLongValue));
publisher.publish(TOPIC_NATIVE_FLOAT, DefaultMappings.FloatToBytes(expectedFloatValue));
publisher.publish(TOPIC_NATIVE_DOUBLE, DefaultMappings.DoubleToBytes(expectedDoubleValue));
publisher.publish(TOPIC_NATIVE_CHAR, DefaultMappings.CharToBytes(expectedCharValue));
publisher.publish(TOPIC_NATIVE_STRING, DefaultMappings.StringToBytes(expectedStringValue));
publisher.publish(TOPIC_BOXED_BOOLEAN, DefaultMappings.BoolToBytes(expectedBooleanValue));
publisher.publish(TOPIC_BOXED_INTEGER, DefaultMappings.IntToBytes(expectedIntValue));
publisher.publish(TOPIC_BOXED_SHORT, DefaultMappings.ShortToBytes(expectedShortValue));
publisher.publish(TOPIC_BOXED_LONG, DefaultMappings.LongToBytes(expectedLongValue));
publisher.publish(TOPIC_BOXED_FLOAT, DefaultMappings.FloatToBytes(expectedFloatValue));
publisher.publish(TOPIC_BOXED_DOUBLE, DefaultMappings.DoubleToBytes(expectedDoubleValue));
publisher.publish(TOPIC_BOXED_CHARACTER, DefaultMappings.CharToBytes(expectedCharValue));
TestUtils.waitForMqtt();
......
......@@ -4,13 +4,15 @@ import defaultOnlyWrite.ast.A;
import defaultOnlyWrite.ast.BoxedTypesSyn;
import defaultOnlyWrite.ast.MqttHandler;
import defaultOnlyWrite.ast.NativeTypesSyn;
import org.jastadd.ragconnect.tests.utils.DefaultMappings;
import org.jastadd.ragconnect.tests.utils.TestUtils;
import org.junit.jupiter.api.Test;
import java.io.IOException;
import java.nio.file.Paths;
import java.util.concurrent.TimeUnit;
import static org.jastadd.ragconnect.tests.TestUtils.*;
import static org.jastadd.ragconnect.tests.utils.TestUtils.*;
import static org.junit.jupiter.api.Assertions.*;
/**
......@@ -177,63 +179,63 @@ public class DefaultOnlyWriteTest extends AbstractMqttTest {
receiver.newConnection(transformed ? TOPIC_NATIVE_BOOLEAN_TRANSFORMED : TOPIC_NATIVE_BOOLEAN, bytes -> {
result.numberOfNativeBoolValues += 1;
result.lastNativeBoolValue = TestUtils.DefaultMappings.BytesToBool(bytes);
result.lastNativeBoolValue = DefaultMappings.BytesToBool(bytes);
});
receiver.newConnection(transformed ? TOPIC_NATIVE_INT_TRANSFORMED : TOPIC_NATIVE_INT, bytes -> {
result.numberOfNativeIntValues += 1;
result.lastNativeIntValue = TestUtils.DefaultMappings.BytesToInt(bytes);
result.lastNativeIntValue = DefaultMappings.BytesToInt(bytes);
});
receiver.newConnection(transformed ? TOPIC_NATIVE_SHORT_TRANSFORMED : TOPIC_NATIVE_SHORT, bytes -> {
result.numberOfNativeShortValues += 1;
result.lastNativeShortValue = TestUtils.DefaultMappings.BytesToShort(bytes);
result.lastNativeShortValue = DefaultMappings.BytesToShort(bytes);
});
receiver.newConnection(transformed ? TOPIC_NATIVE_LONG_TRANSFORMED : TOPIC_NATIVE_LONG, bytes -> {
result.numberOfNativeLongValues += 1;
result.lastNativeLongValue = TestUtils.DefaultMappings.BytesToLong(bytes);
result.lastNativeLongValue = DefaultMappings.BytesToLong(bytes);
});
receiver.newConnection(transformed ? TOPIC_NATIVE_FLOAT_TRANSFORMED : TOPIC_NATIVE_FLOAT, bytes -> {
result.numberOfNativeFloatValues += 1;
result.lastNativeFloatValue = TestUtils.DefaultMappings.BytesToFloat(bytes);
result.lastNativeFloatValue = DefaultMappings.BytesToFloat(bytes);
});
receiver.newConnection(transformed ? TOPIC_NATIVE_DOUBLE_TRANSFORMED : TOPIC_NATIVE_DOUBLE, bytes -> {
result.numberOfNativeDoubleValues += 1;
result.lastNativeDoubleValue = TestUtils.DefaultMappings.BytesToDouble(bytes);
result.lastNativeDoubleValue = DefaultMappings.BytesToDouble(bytes);
});
receiver.newConnection(transformed ? TOPIC_NATIVE_CHAR_TRANSFORMED : TOPIC_NATIVE_CHAR, bytes -> {
result.numberOfNativeCharValues += 1;
result.lastNativeCharValue = TestUtils.DefaultMappings.BytesToChar(bytes);
result.lastNativeCharValue = DefaultMappings.BytesToChar(bytes);
});
receiver.newConnection(transformed ? TOPIC_NATIVE_STRING_TRANSFORMED : TOPIC_NATIVE_STRING, bytes -> {
result.numberOfNativeStringValues += 1;
result.lastNativeStringValue = TestUtils.DefaultMappings.BytesToString(bytes);
result.lastNativeStringValue = DefaultMappings.BytesToString(bytes);
});
receiver.newConnection(transformed ? TOPIC_BOXED_BOOLEAN_TRANSFORMED : TOPIC_BOXED_BOOLEAN, bytes -> {
result.numberOfBoxedBoolValues += 1;
result.lastBoxedBoolValue = TestUtils.DefaultMappings.BytesToBool(bytes);
result.lastBoxedBoolValue = DefaultMappings.BytesToBool(bytes);
});
receiver.newConnection(transformed ? TOPIC_BOXED_INTEGER_TRANSFORMED : TOPIC_BOXED_INTEGER, bytes -> {
result.numberOfBoxedIntValues += 1;
result.lastBoxedIntValue = TestUtils.DefaultMappings.BytesToInt(bytes);
result.lastBoxedIntValue = DefaultMappings.BytesToInt(bytes);
});
receiver.newConnection(transformed ? TOPIC_BOXED_SHORT_TRANSFORMED : TOPIC_BOXED_SHORT, bytes -> {
result.numberOfBoxedShortValues += 1;
result.lastBoxedShortValue = TestUtils.DefaultMappings.BytesToShort(bytes);
result.lastBoxedShortValue = DefaultMappings.BytesToShort(bytes);
});
receiver.newConnection(transformed ? TOPIC_BOXED_LONG_TRANSFORMED : TOPIC_BOXED_LONG, bytes -> {
result.numberOfBoxedLongValues += 1;
result.lastBoxedLongValue = TestUtils.DefaultMappings.BytesToLong(bytes);
result.lastBoxedLongValue = DefaultMappings.BytesToLong(bytes);
});
receiver.newConnection(transformed ? TOPIC_BOXED_FLOAT_TRANSFORMED : TOPIC_BOXED_FLOAT, bytes -> {
result.numberOfBoxedFloatValues += 1;
result.lastBoxedFloatValue = TestUtils.DefaultMappings.BytesToFloat(bytes);
result.lastBoxedFloatValue = DefaultMappings.BytesToFloat(bytes);
});
receiver.newConnection(transformed ? TOPIC_BOXED_DOUBLE_TRANSFORMED : TOPIC_BOXED_DOUBLE, bytes -> {
result.numberOfBoxedDoubleValues += 1;
result.lastBoxedDoubleValue = TestUtils.DefaultMappings.BytesToDouble(bytes);
result.lastBoxedDoubleValue = DefaultMappings.BytesToDouble(bytes);
});
receiver.newConnection(transformed ? TOPIC_BOXED_CHARACTER_TRANSFORMED : TOPIC_BOXED_CHARACTER, bytes -> {
result.numberOfBoxedCharValues += 1;
result.lastBoxedCharValue = TestUtils.DefaultMappings.BytesToChar(bytes);
result.lastBoxedCharValue = DefaultMappings.BytesToChar(bytes);
});
return result;
}
......
package org.jastadd.ragconnect.tests;
import org.jastadd.ragconnect.tests.utils.TestUtils;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File;
import java.io.IOException;
......@@ -14,7 +13,7 @@ import java.util.List;
import java.util.stream.Collectors;
import static org.assertj.core.api.Assertions.assertThat;
import static org.jastadd.ragconnect.tests.TestUtils.readFile;
import static org.jastadd.ragconnect.tests.utils.TestUtils.readFile;
import static org.junit.jupiter.api.Assertions.assertTrue;
/**
......
......@@ -3,7 +3,8 @@ package org.jastadd.ragconnect.tests;
import com.google.protobuf.InvalidProtocolBufferException;
import config.Config.RobotConfig;
import example.ast.*;
import org.jastadd.ragconnect.tests.TestUtils.TestChecker;
import org.jastadd.ragconnect.tests.utils.TestUtils;
import org.jastadd.ragconnect.tests.utils.TestChecker;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import robot.RobotStateOuterClass.RobotState;
......@@ -11,8 +12,8 @@ import robot.RobotStateOuterClass.RobotState;
import java.io.IOException;
import java.util.concurrent.TimeUnit;
import static org.jastadd.ragconnect.tests.TestUtils.mqttUri;
import static org.jastadd.ragconnect.tests.TestUtils.waitForMqtt;
import static org.jastadd.ragconnect.tests.utils.TestUtils.mqttUri;
import static org.jastadd.ragconnect.tests.utils.TestUtils.waitForMqtt;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
......
package org.jastadd.ragconnect.tests;
import forwardingInc.ast.*;
import org.jastadd.ragconnect.tests.utils.TestChecker;
import org.jastadd.ragconnect.tests.utils.TestUtils;
import org.junit.jupiter.api.Tag;
import java.io.IOException;
......@@ -11,7 +13,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.groups.Tuple.tuple;
import static org.jastadd.ragconnect.tests.TestUtils.*;
import static org.jastadd.ragconnect.tests.utils.TestUtils.*;
import static org.junit.jupiter.api.Assertions.assertTrue;
/**
......
......@@ -3,12 +3,14 @@ package org.jastadd.ragconnect.tests;
import incremental.ast.A;
import incremental.ast.B;
import incremental.ast.MqttHandler;
import org.jastadd.ragconnect.tests.utils.DefaultMappings;
import org.jastadd.ragconnect.tests.utils.TestUtils;
import org.junit.jupiter.api.Tag;
import java.io.IOException;
import java.util.concurrent.TimeUnit;
import static org.jastadd.ragconnect.tests.TestUtils.mqttUri;
import static org.jastadd.ragconnect.tests.utils.TestUtils.mqttUri;
import static org.junit.jupiter.api.Assertions.*;
/**
......@@ -61,15 +63,15 @@ public class IncrementalDependencyTest extends AbstractMqttTest {
handler.newConnection(TOPIC_OUT_A, bytes -> {
dataA.numberOfStringValues += 1;
dataA.lastStringValue = TestUtils.DefaultMappings.BytesToString(bytes);
dataA.lastStringValue = DefaultMappings.BytesToString(bytes);
});
handler.newConnection(TOPIC_OUT_B1, bytes -> {
dataB1.numberOfStringValues += 1;
dataB1.lastStringValue = TestUtils.DefaultMappings.BytesToString(bytes);
dataB1.lastStringValue = DefaultMappings.BytesToString(bytes);
});
handler.newConnection(TOPIC_OUT_B2, bytes -> {
dataB2.numberOfStringValues += 1;
dataB2.lastStringValue = TestUtils.DefaultMappings.BytesToString(bytes);
dataB2.lastStringValue = DefaultMappings.BytesToString(bytes);
});
assertTrue(model.connectInput(mqttUri(TOPIC_IN)));
......
......@@ -4,6 +4,8 @@ import indexedSendInc.ast.*;
import io.github.artsok.RepeatedIfExceptionsTest;
import org.assertj.core.api.Assertions;
import org.assertj.core.groups.Tuple;
import org.jastadd.ragconnect.tests.utils.TestChecker;
import org.jastadd.ragconnect.tests.utils.TestUtils;
import org.junit.jupiter.api.Tag;
import java.io.IOException;
......@@ -13,7 +15,7 @@ import java.util.function.Predicate;
import java.util.function.Supplier;
import static org.assertj.core.groups.Tuple.tuple;
import static org.jastadd.ragconnect.tests.TestUtils.*;
import static org.jastadd.ragconnect.tests.utils.TestUtils.*;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
......@@ -40,7 +42,7 @@ public class IndexedSendTest extends AbstractMqttTest {
private MqttHandler handler;
private ReceiverData data;
private TestUtils.TestChecker checker;
private TestChecker checker;
private Root model;
private SenderRoot senderRoot;
......
......@@ -2,18 +2,15 @@ package org.jastadd.ragconnect.tests;
import javaInc.ast.*;
import org.assertj.core.groups.Tuple;
import org.jastadd.ragconnect.tests.TestUtils.TestChecker;
import org.jastadd.ragconnect.tests.utils.TestChecker;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.util.List;
import static org.assertj.core.api.Assertions.tuple;
import static org.jastadd.ragconnect.tests.TestUtils.javaUri;
import static org.jastadd.ragconnect.tests.utils.TestUtils.javaUri;
import static org.junit.jupiter.api.Assertions.*;
/**
......
......@@ -4,11 +4,13 @@ import mapping.ast.A;
import mapping.ast.BoxedTypes;
import mapping.ast.MqttHandler;
import mapping.ast.NativeTypes;
import org.jastadd.ragconnect.tests.utils.DefaultMappings;
import org.jastadd.ragconnect.tests.utils.TestUtils;
import java.io.IOException;
import java.util.concurrent.TimeUnit;
import static org.jastadd.ragconnect.tests.TestUtils.mqttUri;
import static org.jastadd.ragconnect.tests.utils.TestUtils.mqttUri;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
......@@ -62,31 +64,31 @@ public class MappingTest extends AbstractMqttTest {
data = new ReceiverData();
handler.newConnection(TOPIC_WRITE_NATIVE_INT, bytes -> {
data.numberOfNativeIntValues += 1;
data.lastNativeIntValue = TestUtils.DefaultMappings.BytesToInt(bytes);
data.lastNativeIntValue = DefaultMappings.BytesToInt(bytes);
});
handler.newConnection(TOPIC_WRITE_NATIVE_SHORT, bytes -> {
data.numberOfNativeShortValues += 1;
data.lastNativeShortValue = TestUtils.DefaultMappings.BytesToShort(bytes);
data.lastNativeShortValue = DefaultMappings.BytesToShort(bytes);
});
handler.newConnection(TOPIC_WRITE_NATIVE_LONG, bytes -> {
data.numberOfNativeLongValues += 1;
data.lastNativeLongValue = TestUtils.DefaultMappings.BytesToLong(bytes);
data.lastNativeLongValue = DefaultMappings.BytesToLong(bytes);
});
handler.newConnection(TOPIC_WRITE_NATIVE_FLOAT, bytes -> {
data.numberOfNativeFloatValues += 1;
data.lastNativeFloatValue = TestUtils.DefaultMappings.BytesToFloat(bytes);
data.lastNativeFloatValue = DefaultMappings.BytesToFloat(bytes);
});
handler.newConnection(TOPIC_WRITE_NATIVE_DOUBLE, bytes -> {
data.numberOfNativeDoubleValues += 1;
data.lastNativeDoubleValue = TestUtils.DefaultMappings.BytesToDouble(bytes);
data.lastNativeDoubleValue = DefaultMappings.BytesToDouble(bytes);
});
handler.newConnection(TOPIC_WRITE_NATIVE_CHAR, bytes -> {
data.numberOfNativeCharValues += 1;
data.lastNativeCharValue = TestUtils.DefaultMappings.BytesToChar(bytes);
data.lastNativeCharValue = DefaultMappings.BytesToChar(bytes);
});
handler.newConnection(TOPIC_WRITE_NATIVE_BOOLEAN, bytes -> {
data.numberOfNativeBooleanValues += 1;
data.lastNativeBooleanValue = TestUtils.DefaultMappings.BytesToBool(bytes);
data.lastNativeBooleanValue = DefaultMappings.BytesToBool(bytes);
});
assertTrue(natives.connectWriteIntValue(mqttUri(TOPIC_WRITE_NATIVE_INT), isWriteCurrentValue()));
......
package org.jastadd.ragconnect.tests;
import example.ast.MqttHandler;
import org.jastadd.ragconnect.tests.utils.TestUtils;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
......
package org.jastadd.ragconnect.tests;
import org.jastadd.ragconnect.tests.utils.DefaultMappings;
import org.jastadd.ragconnect.tests.utils.TestUtils;
import read1write2.ast.*;
import java.io.IOException;
import java.util.concurrent.TimeUnit;
import static org.jastadd.ragconnect.tests.TestUtils.mqttUri;
import static org.jastadd.ragconnect.tests.utils.TestUtils.mqttUri;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
......@@ -75,29 +77,29 @@ public class Read1Write2Test extends AbstractMqttTest {
handler.newConnection(TOPIC_SAME_WRITE_INT, bytes -> {
dataSame.numberOfIntValues += 1;
dataSame.lastIntValue = TestUtils.DefaultMappings.BytesToInt(bytes);
dataSame.lastIntValue = DefaultMappings.BytesToInt(bytes);
});
handler.newConnection(TOPIC_SAME_WRITE_STRING, bytes -> {
dataSame.numberOfStringValues += 1;
dataSame.lastStringValue = TestUtils.DefaultMappings.BytesToString(bytes);
dataSame.lastStringValue = DefaultMappings.BytesToString(bytes);
});
handler.newConnection(TOPIC_DIFFERENT_WRITE1_INT, bytes -> {
dataOther1.numberOfIntValues += 1;
dataOther1.lastIntValue = TestUtils.DefaultMappings.BytesToInt(bytes);
dataOther1.lastIntValue = DefaultMappings.BytesToInt(bytes);
});
handler.newConnection(TOPIC_DIFFERENT_WRITE1_STRING, bytes -> {
dataOther1.numberOfStringValues += 1;
dataOther1.lastStringValue = TestUtils.DefaultMappings.BytesToString(bytes);
dataOther1.lastStringValue = DefaultMappings.BytesToString(bytes);
});
handler.newConnection(TOPIC_DIFFERENT_WRITE2_INT, bytes -> {
dataOther2.numberOfIntValues += 1;
dataOther2.lastIntValue = TestUtils.DefaultMappings.BytesToInt(bytes);
dataOther2.lastIntValue = DefaultMappings.BytesToInt(bytes);
});
handler.newConnection(TOPIC_DIFFERENT_WRITE2_STRING, bytes -> {
dataOther2.numberOfStringValues += 1;
dataOther2.lastStringValue = TestUtils.DefaultMappings.BytesToString(bytes);
dataOther2.lastStringValue = DefaultMappings.BytesToString(bytes);
});
assertTrue(onSameNonterminal.connectInput(mqttUri(TOPIC_SAME_READ)));
......
package org.jastadd.ragconnect.tests;
import org.jastadd.ragconnect.tests.utils.DefaultMappings;
import org.jastadd.ragconnect.tests.utils.TestUtils;
import read2write1.ast.*;
import java.io.IOException;
import java.util.concurrent.TimeUnit;
import static org.jastadd.ragconnect.tests.TestUtils.mqttUri;
import static org.jastadd.ragconnect.tests.utils.TestUtils.mqttUri;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
......@@ -76,17 +78,17 @@ public class Read2Write1Test extends AbstractMqttTest {
handler.newConnection(TOPIC_SAME_WRITE_INT, bytes -> {
dataSame.numberOfIntValues += 1;
dataSame.lastIntValue = TestUtils.DefaultMappings.BytesToInt(bytes);
dataSame.lastIntValue = DefaultMappings.BytesToInt(bytes);
});
handler.newConnection(TOPIC_DIFFERENT_WRITE1_INT, bytes -> {
dataOther1.numberOfIntValues += 1;
dataOther1.lastIntValue = TestUtils.DefaultMappings.BytesToInt(bytes);
dataOther1.lastIntValue = DefaultMappings.BytesToInt(bytes);
});
handler.newConnection(TOPIC_DIFFERENT_WRITE2_INT, bytes -> {
dataOther2.numberOfIntValues += 1;
dataOther2.lastIntValue = TestUtils.DefaultMappings.BytesToInt(bytes);
dataOther2.lastIntValue = DefaultMappings.BytesToInt(bytes);
});
assertTrue(onSameNonterminal.connectInput1(mqttUri(TOPIC_SAME_READ1)));
......
package org.jastadd.ragconnect.tests;
import org.jastadd.ragconnect.tests.utils.TestUtils;
import org.junit.jupiter.api.Test;
import via.ast.A;
......
......@@ -5,7 +5,7 @@ import tutorial.ast.B;
import java.io.IOException;
import static org.jastadd.ragconnect.tests.TestUtils.mqttUri;
import static org.jastadd.ragconnect.tests.utils.TestUtils.mqttUri;
import static org.junit.jupiter.api.Assertions.assertTrue;
/**
......
package org.jastadd.ragconnect.tests;
import org.jastadd.ragconnect.tests.TestUtils.TestChecker;
import org.jastadd.ragconnect.tests.utils.DefaultMappings;
import org.jastadd.ragconnect.tests.utils.TestUtils;
import org.jastadd.ragconnect.tests.utils.TestChecker;
import org.junit.jupiter.api.Tag;
import via.ast.A;
import via.ast.MqttHandler;
......@@ -13,8 +15,8 @@ import javax.ws.rs.core.MediaType;
import java.io.IOException;
import java.util.concurrent.TimeUnit;
import static org.jastadd.ragconnect.tests.TestUtils.mqttUri;
import static org.jastadd.ragconnect.tests.TestUtils.restUri;
import static org.jastadd.ragconnect.tests.utils.TestUtils.mqttUri;
import static org.jastadd.ragconnect.tests.utils.TestUtils.restUri;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
......@@ -91,15 +93,15 @@ public class ViaTest extends AbstractMqttTest {
handler.newConnection(TOPIC_MQTT_2_MQTT_SEND, bytes -> {
dataMqtt2Mqtt.numberOfStringValues += 1;
dataMqtt2Mqtt.lastStringValue = TestUtils.DefaultMappings.BytesToString(bytes);
dataMqtt2Mqtt.lastStringValue = DefaultMappings.BytesToString(bytes);
});
handler.newConnection(TOPIC_REST_2_MQTT_SEND, bytes -> {
dataRest2Mqtt.numberOfStringValues += 1;
dataRest2Mqtt.lastStringValue = TestUtils.DefaultMappings.BytesToString(bytes);
dataRest2Mqtt.lastStringValue = DefaultMappings.BytesToString(bytes);
});
handler.newConnection(TOPIC_BOTH_2_MQTT_SEND, bytes -> {
dataBoth2Mqtt.numberOfStringValues += 1;
dataBoth2Mqtt.lastStringValue = TestUtils.DefaultMappings.BytesToString(bytes);
dataBoth2Mqtt.lastStringValue = DefaultMappings.BytesToString(bytes);
});
checker = new TestChecker();
......
package org.jastadd.ragconnect.tests;
import org.jastadd.ragconnect.tests.utils.TestUtils;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File;
import java.io.IOException;
......@@ -13,7 +12,7 @@ import java.util.Collections;
import java.util.List;
import static org.assertj.core.api.Assertions.assertThat;
import static org.jastadd.ragconnect.tests.TestUtils.readFile;
import static org.jastadd.ragconnect.tests.utils.TestUtils.readFile;
import static org.junit.jupiter.api.Assertions.assertTrue;
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment