m-chrzan.xyz
aboutsummaryrefslogtreecommitdiff
path: root/src/test/java/pl
diff options
context:
space:
mode:
authorMarcin Chrzanowski <marcin.j.chrzanowski@gmail.com>2020-01-11 12:08:02 +0100
committerMarcin Chrzanowski <marcin.j.chrzanowski@gmail.com>2020-01-11 12:14:43 +0100
commit0fca21f2011958d709a25aa1f4d863c1d646da6e (patch)
tree5dba6d80fde59889101ea4210bf4033b53e18a44 /src/test/java/pl
parent89af38da0b95445180440e85bb8248ab910ef9f8 (diff)
Send info back from responder
Diffstat (limited to 'src/test/java/pl')
-rw-r--r--src/test/java/pl/edu/mimuw/cloudatlas/agent/modules/GossipGirlTest.java27
1 files changed, 26 insertions, 1 deletions
diff --git a/src/test/java/pl/edu/mimuw/cloudatlas/agent/modules/GossipGirlTest.java b/src/test/java/pl/edu/mimuw/cloudatlas/agent/modules/GossipGirlTest.java
index 170b76e..37fdbe7 100644
--- a/src/test/java/pl/edu/mimuw/cloudatlas/agent/modules/GossipGirlTest.java
+++ b/src/test/java/pl/edu/mimuw/cloudatlas/agent/modules/GossipGirlTest.java
@@ -312,7 +312,7 @@ public class GossipGirlTest {
@Test
public void receiverSendsNoCoTamOnState() throws Exception {
gossipGirl.handleTyped(hejkaMessage);
- executor.messagesToPass.poll();
+ executor.messagesToPass.take();
gossipGirl.handleTyped(stateMessage);
AgentMessage receivedMessage = executor.messagesToPass.poll();
@@ -337,6 +337,31 @@ public class GossipGirlTest {
assertThat(querySet, hasItems(new Attribute("&query")));
}
+ @Test
+ public void receiverSendsInfoOnFirstReceivedInfo() throws Exception {
+ gossipGirl.handleTyped(hejkaMessage);
+ executor.messagesToPass.take();
+ gossipGirl.handleTyped(stateMessage);
+ executor.messagesToPass.take();
+
+ gossipGirl.handleTyped(attributesMessage1);
+
+ // 3 ZMIs, 2 queries, 1 own attributes update
+ assertEquals(6, executor.messagesToPass.size());
+
+ AgentMessage receivedMessage1 = executor.messagesToPass.poll();
+ assertAttributeMessage(receivedMessage1, "/son/bro", "/daughter");
+ AgentMessage receivedMessage2 = executor.messagesToPass.poll();
+ assertAttributeMessage(receivedMessage2, "/son/bro", "/son/sis");
+ AgentMessage receivedMessage3 = executor.messagesToPass.poll();
+ assertAttributeMessage(receivedMessage3, "/son/bro", "/son/grand");
+
+ AgentMessage receivedMessage4 = executor.messagesToPass.poll();
+ assertQueryMessage(receivedMessage4, "/son/bro", "&two", "SELECT 2 AS two");
+ AgentMessage receivedMessage5 = executor.messagesToPass.poll();
+ assertQueryMessage(receivedMessage5, "/son/bro", "&query", "SELECT sum(foo) AS foo");
+ }
+
private void assertQueryMessage(AgentMessage message, String recipientPath, String name, String query) throws Exception {
assertUDUPMessage(
message,