From 3606ce2bd9a4fd02e12e74023908b8390d57a3c8 Mon Sep 17 00:00:00 2001 From: Elton Cardoso do Nascimento <43186596+EltonCN@users.noreply.github.com> Date: Wed, 11 Dec 2024 16:23:48 -0300 Subject: [PATCH] Test MS mind names --- .../cst/memorystorage/MemoryStorageTest.java | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/test/java/br/unicamp/cst/memorystorage/MemoryStorageTest.java b/src/test/java/br/unicamp/cst/memorystorage/MemoryStorageTest.java index 2576849..8c06eb0 100644 --- a/src/test/java/br/unicamp/cst/memorystorage/MemoryStorageTest.java +++ b/src/test/java/br/unicamp/cst/memorystorage/MemoryStorageTest.java @@ -76,6 +76,32 @@ public void tearDown() throws Exception { commands.flushall().get(); } + @Test + public void testMindName() throws Exception{ + MemoryStorageCodelet msCodelet = new MemoryStorageCodelet(mind, "Mind1"); + msCodelet.setTimeStep(50); + mind.insertCodelet(msCodelet); + + RedisURI uri = RedisURI.Builder + .redis("localhost", 6379) + .build(); + RedisClient client = RedisClient.create(uri); + + MemoryStorageCodelet msCodelet2 = new MemoryStorageCodelet(mind, "Mind2", client); + msCodelet2.setTimeStep(50); + mind.insertCodelet(msCodelet2); + + mind.start(); + + Set members = commands.smembers("Mind1:nodes").get(); + assertEquals(1, members.size()); + assertTrue(members.contains("node")); + + Set members2 = commands.smembers("Mind2:nodes").get(); + assertEquals(1, members2.size()); + assertTrue(members2.contains("node")); + } + @Test public void nodeEnterTest() throws Exception { MemoryStorageCodelet msCodelet = new MemoryStorageCodelet(mind);