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

working on forwarding using implicit NTAs

- fix regression errors
parent 306ab6a7
No related branches found
No related tags found
1 merge request!24Resolve "Feature: Send enpoint for non-terminal using implicit NTA"
Pipeline #12426 passed
...@@ -5,6 +5,10 @@ Design considerations ...@@ -5,6 +5,10 @@ Design considerations
*/ */
aspect NewStuff { aspect NewStuff {
// unsorted // unsorted
inh boolean EndpointDefinition.isImplied();
eq ConnectSpecification.getEndpointDefinition().isImplied() = false;
eq EndpointTarget.impliedEndpointDefinitions().isImplied() = true;
syn String TypeComponent.disconnectMethodName() { syn String TypeComponent.disconnectMethodName() {
List<TypeEndpointTarget> typeEndpointTargets = getTypeEndpointTargets(); List<TypeEndpointTarget> typeEndpointTargets = getTypeEndpointTargets();
if (typeEndpointTargets.isEmpty()) { if (typeEndpointTargets.isEmpty()) {
...@@ -414,7 +418,9 @@ aspect MustacheReceiveAndSendAndHandleUri { ...@@ -414,7 +418,9 @@ aspect MustacheReceiveAndSendAndHandleUri {
private String TypeEndpointTarget.getterMethodeNameHelper(boolean useForwarding) { private String TypeEndpointTarget.getterMethodeNameHelper(boolean useForwarding) {
return (useForwarding && needForwardingNTA() ? forwardingNTA_Name() : return (useForwarding && needForwardingNTA() ? forwardingNTA_Name() :
"get" + getType().getName() + (typeIsList() && (!containingEndpointDefinition().getIndexBasedListAccess() || containingEndpointDefinition().getWithAdd()) ? "List" : "") + (typeIsOpt() ? "Opt" : "") + "NoTransform"); "get" + getType().getName() + (typeIsList() && (!containingEndpointDefinition().getIndexBasedListAccess() ||
containingEndpointDefinition().getWithAdd()) ? "List" : "") + (typeIsOpt() ? "Opt" : "")
+ (needForwardingNTA() ? "NoTransform" : ""));
} }
eq ContextFreeTypeEndpointTarget.getterMethodName() = null; eq ContextFreeTypeEndpointTarget.getterMethodName() = null;
......
...@@ -25,7 +25,6 @@ import static org.junit.jupiter.api.Assertions.*; ...@@ -25,7 +25,6 @@ import static org.junit.jupiter.api.Assertions.*;
* @author rschoene - Initial contribution * @author rschoene - Initial contribution
*/ */
@Tag("Incremental") @Tag("Incremental")
@Tag("New")
public class ForwardingTest extends AbstractMqttTest { public class ForwardingTest extends AbstractMqttTest {
private static final String TOPIC_A_SINGLE = "a-single"; private static final String TOPIC_A_SINGLE = "a-single";
......
package org.jastadd.ragconnect.tests.singleList; package org.jastadd.ragconnect.tests.singleList;
import org.awaitility.Awaitility;
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.jastadd.ragconnect.tests.TestUtils.IntList;
...@@ -10,11 +9,7 @@ import singleList.ast.MqttHandler; ...@@ -10,11 +9,7 @@ import singleList.ast.MqttHandler;
import java.io.IOException; import java.io.IOException;
import java.nio.file.Paths; import java.nio.file.Paths;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicBoolean;
import java.util.function.Function; import java.util.function.Function;
...@@ -34,6 +29,8 @@ import static org.junit.jupiter.api.Assertions.*; ...@@ -34,6 +29,8 @@ import static org.junit.jupiter.api.Assertions.*;
@Tag("SingleList") @Tag("SingleList")
public abstract class AbstractSingleListTest extends AbstractMqttTest { public abstract class AbstractSingleListTest extends AbstractMqttTest {
protected MqttHandler handler;
public interface TestWrapperJastAddList<T> extends Iterable<T> { public interface TestWrapperJastAddList<T> extends Iterable<T> {
int getNumChild(); int getNumChild();
} }
...@@ -144,10 +141,13 @@ public abstract class AbstractSingleListTest extends AbstractMqttTest { ...@@ -144,10 +141,13 @@ public abstract class AbstractSingleListTest extends AbstractMqttTest {
assertTrue(receiverRoot.connectUsingWildcardWithAddA(mqttUri(TOPIC_A_WILDCARD))); assertTrue(receiverRoot.connectUsingWildcardWithAddA(mqttUri(TOPIC_A_WILDCARD)));
// send: explicit topics, wait between connections to ensure correct arrival at receiver // send: explicit topics, wait between connections to ensure correct arrival at receiver
MqttHandler checkArrivalHandler = new MqttHandler().dontSendWelcomeMessage().setHost(TestUtils.getMqttHost()); handler = new MqttHandler().dontSendWelcomeMessage().setHost(TestUtils.getMqttHost());
ReceiverData checkArrivalData = new ReceiverData(); data = new ReceiverData();
checkArrivalHandler.waitUntilReady(2, TimeUnit.SECONDS); handler.waitUntilReady(2, TimeUnit.SECONDS);
checkArrivalHandler.newConnection("#", bytes -> checkArrivalData.valueSentSinceLastCheck.set(true)); handler.newConnection("#", bytes -> {
data.valueSentSinceLastCheck.set(true);
data.numberOfElements += 1;
});
assertTrue(senderRoot.connectA4(mqttUri(TOPIC_A_4), isWriteCurrentValue())); assertTrue(senderRoot.connectA4(mqttUri(TOPIC_A_4), isWriteCurrentValue()));
waitForValue(); waitForValue();
...@@ -163,7 +163,6 @@ public abstract class AbstractSingleListTest extends AbstractMqttTest { ...@@ -163,7 +163,6 @@ public abstract class AbstractSingleListTest extends AbstractMqttTest {
assertTrue(senderRoot.connectInOutput(mqttUri(TOPIC_A_5_INOUT), isWriteCurrentValue())); assertTrue(senderRoot.connectInOutput(mqttUri(TOPIC_A_5_INOUT), isWriteCurrentValue()));
// no need to wait here, because first "checkTree" will wait anyway // no need to wait here, because first "checkTree" will wait anyway
checkArrivalHandler.close();
} }
private void waitForValue() { private void waitForValue() {
......
package org.jastadd.ragconnect.tests.singleList; package org.jastadd.ragconnect.tests.singleList;
import org.jastadd.ragconnect.tests.TestUtils;
import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Tag;
import singleListInc.ast.*; import singleListInc.ast.A;
import singleListInc.ast.ReceiverRoot;
import singleListInc.ast.Root;
import singleListInc.ast.SenderRoot;
import java.io.IOException;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
/** /**
* Test case "single list incremental". * Test case "single list incremental".
...@@ -19,7 +19,6 @@ import static org.junit.jupiter.api.Assertions.assertTrue; ...@@ -19,7 +19,6 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
public class SingleListIncrementalTest extends AbstractSingleListTest { public class SingleListIncrementalTest extends AbstractSingleListTest {
private Root model; private Root model;
private MqttHandler handler;
SingleListIncrementalTest() { SingleListIncrementalTest() {
super("singleListInc"); super("singleListInc");
...@@ -43,16 +42,10 @@ public class SingleListIncrementalTest extends AbstractSingleListTest { ...@@ -43,16 +42,10 @@ public class SingleListIncrementalTest extends AbstractSingleListTest {
} }
@Override @Override
protected void setupReceiverAndConnectPart() throws IOException { protected void setupReceiverAndConnectPart() {
model.ragconnectSetupMqttWaitUntilReady(2, TimeUnit.SECONDS); model.ragconnectSetupMqttWaitUntilReady(2, TimeUnit.SECONDS);
handler = new MqttHandler().dontSendWelcomeMessage().setHost(TestUtils.getMqttHost());
assertTrue(handler.waitUntilReady(2, TimeUnit.SECONDS));
// no dependencies // no dependencies
data = new ReceiverData();
handler.newConnection(TOPIC_A_WILDCARD, bytes -> data.numberOfElements += 1);
} }
@Override @Override
......
package org.jastadd.ragconnect.tests.singleList; package org.jastadd.ragconnect.tests.singleList;
import org.jastadd.ragconnect.tests.TestUtils; import singleList.ast.A;
import singleList.ast.*; import singleList.ast.ReceiverRoot;
import singleList.ast.Root;
import singleList.ast.SenderRoot;
import java.io.IOException;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
/** /**
* Test case "single list manual". * Test case "single list manual".
...@@ -17,7 +17,6 @@ import static org.junit.jupiter.api.Assertions.assertTrue; ...@@ -17,7 +17,6 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
public class SingleListManualTest extends AbstractSingleListTest { public class SingleListManualTest extends AbstractSingleListTest {
private Root model; private Root model;
private MqttHandler handler;
SingleListManualTest() { SingleListManualTest() {
super("singleList"); super("singleList");
...@@ -41,20 +40,14 @@ public class SingleListManualTest extends AbstractSingleListTest { ...@@ -41,20 +40,14 @@ public class SingleListManualTest extends AbstractSingleListTest {
} }
@Override @Override
protected void setupReceiverAndConnectPart() throws IOException { protected void setupReceiverAndConnectPart() {
model.ragconnectSetupMqttWaitUntilReady(2, TimeUnit.SECONDS); model.ragconnectSetupMqttWaitUntilReady(2, TimeUnit.SECONDS);
handler = new MqttHandler().dontSendWelcomeMessage().setHost(TestUtils.getMqttHost());
assertTrue(handler.waitUntilReady(2, TimeUnit.SECONDS));
// add dependencies // add dependencies
((SenderRoot) senderRoot).addInputDependencyToA1((SenderRoot) senderRoot); ((SenderRoot) senderRoot).addInputDependencyToA1((SenderRoot) senderRoot);
((SenderRoot) senderRoot).addInputDependencyToA2((SenderRoot) senderRoot); ((SenderRoot) senderRoot).addInputDependencyToA2((SenderRoot) senderRoot);
((SenderRoot) senderRoot).addInputDependencyToA3((SenderRoot) senderRoot); ((SenderRoot) senderRoot).addInputDependencyToA3((SenderRoot) senderRoot);
((SenderRoot) senderRoot).addInputDependencyToA4((SenderRoot) senderRoot); ((SenderRoot) senderRoot).addInputDependencyToA4((SenderRoot) senderRoot);
data = new ReceiverData();
handler.newConnection(TOPIC_A_WILDCARD, bytes -> data.numberOfElements += 1);
} }
@Override @Override
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment