Github user revans2 commented on a diff in the pull request:

    https://github.com/apache/storm/pull/2074#discussion_r116601117
  
    --- 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));
    +            Assert.assertEquals(globalStreamId_a, ls1.get("a"));
    +            Assert.assertEquals(null, ls1.get("c"));
    +            Assert.assertEquals(ls1.snapshot(), new 
LocalState(dir1_tmp.getPath()).snapshot());
    --- End diff --
    
    Similar here I would prefer to see it match the test
    ```
    //(is (= {"a" gs-a "b" gs-b} (.snapshot (LocalState. dir1))))
    Assert.assertEquals(expected, new 
LocalState(dir1_tmp.getPath()).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.
---

Reply via email to