m-chrzan.xyz
aboutsummaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'src/test')
-rw-r--r--src/test/java/pl/edu/mimuw/cloudatlas/agent/modules/StanikTest.java19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/test/java/pl/edu/mimuw/cloudatlas/agent/modules/StanikTest.java b/src/test/java/pl/edu/mimuw/cloudatlas/agent/modules/StanikTest.java
index 7c869e7..1c1e216 100644
--- a/src/test/java/pl/edu/mimuw/cloudatlas/agent/modules/StanikTest.java
+++ b/src/test/java/pl/edu/mimuw/cloudatlas/agent/modules/StanikTest.java
@@ -9,7 +9,9 @@ import pl.edu.mimuw.cloudatlas.agent.messages.HierarchyMessage;
import pl.edu.mimuw.cloudatlas.agent.messages.ResponseMessage;
import pl.edu.mimuw.cloudatlas.agent.MockExecutor;
import pl.edu.mimuw.cloudatlas.model.Attribute;
+import pl.edu.mimuw.cloudatlas.model.AttributesMap;
import pl.edu.mimuw.cloudatlas.model.Value;
+import pl.edu.mimuw.cloudatlas.model.ValueInt;
import pl.edu.mimuw.cloudatlas.model.ZMI;
import org.junit.Before;
@@ -46,4 +48,21 @@ public class StanikTest {
}
assertTrue(empty);
}
+
+ @Test
+ public void hierarchyIsDeepCopy() throws Exception {
+ GetHierarchyMessage message = new GetHierarchyMessage("test_msg", 0, ModuleType.TEST, 42);
+ stanik.handleTyped(message);
+ HierarchyMessage receivedMessage = (HierarchyMessage) executor.messagesToPass.poll();
+ assertNotNull(receivedMessage);
+ AttributesMap attributes = receivedMessage.getZMI().getAttributes();
+ assertNull(attributes.getOrNull("foo"));
+ attributes.add("foo", new ValueInt(1337l));
+
+ GetHierarchyMessage newMessage = new GetHierarchyMessage("test_msg2", 123, ModuleType.TEST, 43);
+ stanik.handleTyped(newMessage);
+ HierarchyMessage newReceivedMessage = (HierarchyMessage) executor.messagesToPass.poll();
+ AttributesMap newAttributes = newReceivedMessage.getZMI().getAttributes();
+ assertNull(newAttributes.getOrNull("foo"));
+ }
}