You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@falcon.apache.org by sh...@apache.org on 2014/07/01 09:24:34 UTC

git commit: FALCON-483 Fix the failing test ConfigurationStoreTest.testConcurrentRemoves on jenkins. Contributed by Sowmya Ramesh

Repository: incubator-falcon
Updated Branches:
  refs/heads/master 1be98326b -> 5517156e1


FALCON-483 Fix the failing test ConfigurationStoreTest.testConcurrentRemoves on jenkins. Contributed by Sowmya Ramesh


Project: http://git-wip-us.apache.org/repos/asf/incubator-falcon/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-falcon/commit/5517156e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-falcon/tree/5517156e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-falcon/diff/5517156e

Branch: refs/heads/master
Commit: 5517156e136194a49921cfbbf1d377c3bd93de94
Parents: 1be9832
Author: Shwetha <sh...@Seemas-MacBook-Air.local>
Authored: Tue Jul 1 00:23:23 2014 -0700
Committer: Shwetha <sh...@Seemas-MacBook-Air.local>
Committed: Tue Jul 1 00:23:23 2014 -0700

----------------------------------------------------------------------
 CHANGES.txt                                     |  3 ++
 .../entity/store/ConfigurationStoreTest.java    | 47 +++++++++++++++-----
 2 files changed, 38 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-falcon/blob/5517156e/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index f72c1c4..b27964b 100755
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -20,6 +20,9 @@ Trunk (Unreleased)
   OPTIMIZATIONS
 
   BUG FIXES
+   FALCON-483 Fix the failing test ConfigurationStoreTest.testConcurrentRemoves 
+   on jenkins. (Sowmya Ramesh via Shwetha GS)
+
    FALCON-430 Process update with user (Shwetha GS via Venkatesh Seetharam)
 
    FALCON-460 Concurrent deletion of same entity results in NPE (Sowmya Ramesh

http://git-wip-us.apache.org/repos/asf/incubator-falcon/blob/5517156e/common/src/test/java/org/apache/falcon/entity/store/ConfigurationStoreTest.java
----------------------------------------------------------------------
diff --git a/common/src/test/java/org/apache/falcon/entity/store/ConfigurationStoreTest.java b/common/src/test/java/org/apache/falcon/entity/store/ConfigurationStoreTest.java
index 9886d88..fa3d3f4 100644
--- a/common/src/test/java/org/apache/falcon/entity/store/ConfigurationStoreTest.java
+++ b/common/src/test/java/org/apache/falcon/entity/store/ConfigurationStoreTest.java
@@ -31,6 +31,7 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.testng.Assert;
 import org.testng.annotations.AfterSuite;
+import org.testng.annotations.BeforeClass;
 import org.testng.annotations.BeforeSuite;
 import org.testng.annotations.Test;
 
@@ -42,6 +43,9 @@ import java.io.IOException;
 public class ConfigurationStoreTest {
 
     private static final Logger LOG = LoggerFactory.getLogger(ConfigurationStoreTest.class);
+    private static final String PROCESS1NAME = "process1";
+    private static final String PROCESS2NAME = "process2";
+    private static final String PROCESS3NAME = "process3";
 
     private ConfigurationStore store = ConfigurationStore.get();
     private TestListener listener = new TestListener();
@@ -68,6 +72,23 @@ public class ConfigurationStoreTest {
         }
     }
 
+
+    @BeforeClass
+    public void setUp() throws Exception {
+        System.out.println("in beforeMethod");
+        Process process1 = new Process();
+        process1.setName(PROCESS1NAME);
+        store.publish(EntityType.PROCESS, process1);
+
+        Process process2 = new Process();
+        process2.setName(PROCESS2NAME);
+        store.publish(EntityType.PROCESS, process2);
+
+        Process process3 = new Process();
+        process3.setName(PROCESS3NAME);
+        store.publish(EntityType.PROCESS, process3);
+    }
+
     @Test
     public void testPublish() throws Exception {
         Process process = new Process();
@@ -118,21 +139,23 @@ public class ConfigurationStoreTest {
 
 
     @Test(threadPoolSize = 3, invocationCount = 6)
-    public void testConcurrentRemoves() throws Exception {
-        Process process = new Process();
-        process.setName("remove");
-        try {
-            store.publish(EntityType.PROCESS, process);
-        } catch(EntityAlreadyExistsException e) {
-            // Ignore this
-        }
-        Process p = store.get(EntityType.PROCESS, "remove");
-        Assert.assertEquals(p, process);
-        store.remove(EntityType.PROCESS, "remove");
-        p = store.get(EntityType.PROCESS, "remove");
+    public void testConcurrentRemoveOfSameProcess() throws Exception {
+        store.remove(EntityType.PROCESS, PROCESS1NAME);
+        Process p = store.get(EntityType.PROCESS, PROCESS1NAME);
         Assert.assertNull(p);
     }
 
+    @Test(threadPoolSize = 3, invocationCount = 6)
+    public void testConcurrentRemove() throws Exception {
+        store.remove(EntityType.PROCESS, PROCESS2NAME);
+        Process p1 = store.get(EntityType.PROCESS, PROCESS2NAME);
+        Assert.assertNull(p1);
+
+        store.remove(EntityType.PROCESS, PROCESS3NAME);
+        Process p2 = store.get(EntityType.PROCESS, PROCESS3NAME);
+        Assert.assertNull(p2);
+    }
+
     @BeforeSuite
     @AfterSuite
     public void cleanup() throws IOException {