Github user revans2 commented on a diff in the pull request: https://github.com/apache/storm/pull/2074#discussion_r116600864 --- Diff: storm-server/src/test/java/org/apache/storm/LocalStateTest.java --- @@ -0,0 +1,61 @@ +package org.apache.storm; + +import org.apache.commons.io.FileUtils; +import org.apache.storm.generated.GlobalStreamId; +import org.apache.storm.testing.TmpPath; +import org.apache.storm.utils.LocalState; +import org.junit.Assert; +import org.junit.Test; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; + +public class LocalStateTest { + + @Test + public void testLocalState() throws Exception{ + try(TmpPath dir1_tmp = new TmpPath(); TmpPath dir2_tmp = new TmpPath() ) { + GlobalStreamId globalStreamId_a = new GlobalStreamId("a", "a"); + GlobalStreamId globalStreamId_b = new GlobalStreamId("b", "b"); + GlobalStreamId globalStreamId_c = new GlobalStreamId("c", "c"); + GlobalStreamId globalStreamId_d = new GlobalStreamId("d", "d"); + + LocalState ls1 = new LocalState(dir1_tmp.getPath()); + LocalState ls2 = new LocalState(dir2_tmp.getPath()); + Assert.assertTrue(ls1.snapshot().isEmpty()); + + ls1.put("a", globalStreamId_a); + ls1.put("b", globalStreamId_b); + Assert.assertTrue(ls1.snapshot().containsKey("a")); + Assert.assertTrue(ls1.snapshot().containsValue(globalStreamId_a)); + Assert.assertTrue(ls1.snapshot().containsKey("b")); + Assert.assertTrue(ls1.snapshot().containsValue(globalStreamId_b)); --- End diff -- I would prefer to have to code more closely follow the test. ``` //(is (= {"a" gs-a "b" gs-b} (.snapshot ls1))) Map<String, TBase> expected = new HashMap<>(); expected.put("a", globalStreamId_a); expected.put("b", globalStreamId_b); Assert.assertEquals(expected, ls1.snapshot()); ```
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---