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

    https://github.com/apache/storm/pull/2154#discussion_r121255326
  
    --- 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.apache.thrift.TBase;
    +import org.junit.Assert;
    +import org.junit.Test;
    +
    +import java.io.File;
    +import java.io.FileOutputStream;
    +import java.io.IOException;
    +import java.util.HashMap;
    +import java.util.Map;
    +
    +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);
    +            Map<String, GlobalStreamId> expected = new HashMap<>();
    +            expected.put("a", globalStreamId_a);
    +            expected.put("b", globalStreamId_b);
    +            Assert.assertEquals(expected, ls1.snapshot());
    +            Assert.assertEquals(expected, new 
LocalState(dir1_tmp.getPath()).snapshot());
    +
    +            Assert.assertTrue(ls2.snapshot().isEmpty());
    +            ls2.put("b", globalStreamId_a);
    +            ls2.put("b", globalStreamId_b);
    +            ls2.put("b", globalStreamId_c);
    +            ls2.put("b", globalStreamId_d);
    +            Assert.assertEquals(globalStreamId_d, ls2.get("b"));
    +        }
    +    }
    +
    +    @Test
    +    public void testEmptyState() throws IOException {
    +        TmpPath tmp_dir = new TmpPath();
    +        String dir = tmp_dir.getPath();
    +        LocalState ls = new LocalState(dir);
    +        GlobalStreamId gs_a = new GlobalStreamId("a", "a");
    +        FileOutputStream data = FileUtils.openOutputStream(new 
File(dir,"12345"));
    +        FileOutputStream version =FileUtils.openOutputStream(new 
File(dir,"12345.version"));
    --- End diff --
    
    Missing space after =. I think checkstyle may complain about this.


---
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 [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to