Repository: oozie
Updated Branches:
  refs/heads/master 60f3d18f5 -> 6ea1ed833


http://git-wip-us.apache.org/repos/asf/oozie/blob/6ea1ed83/core/src/test/java/org/apache/oozie/command/coord/TestCoordRerunXCommand.java
----------------------------------------------------------------------
diff --git 
a/core/src/test/java/org/apache/oozie/command/coord/TestCoordRerunXCommand.java 
b/core/src/test/java/org/apache/oozie/command/coord/TestCoordRerunXCommand.java
index 53c5122..c199595 100644
--- 
a/core/src/test/java/org/apache/oozie/command/coord/TestCoordRerunXCommand.java
+++ 
b/core/src/test/java/org/apache/oozie/command/coord/TestCoordRerunXCommand.java
@@ -19,7 +19,6 @@
 package org.apache.oozie.command.coord;
 
 import java.io.ByteArrayInputStream;
-import java.io.File;
 import java.io.IOException;
 import java.io.InputStreamReader;
 import java.io.OutputStreamWriter;
@@ -48,11 +47,9 @@ import 
org.apache.oozie.executor.jpa.CoordJobQueryExecutor.CoordJobQuery;
 import org.apache.oozie.local.LocalOozie;
 import org.apache.oozie.service.UUIDService;
 import org.apache.oozie.dependency.URIHandler;
-import org.apache.oozie.executor.jpa.CoordActionGetJPAExecutor;
 import org.apache.oozie.executor.jpa.CoordActionInsertJPAExecutor;
 import org.apache.oozie.executor.jpa.CoordActionQueryExecutor;
 import org.apache.oozie.executor.jpa.CoordActionQueryExecutor.CoordActionQuery;
-import org.apache.oozie.executor.jpa.CoordJobGetJPAExecutor;
 import org.apache.oozie.executor.jpa.CoordJobInsertJPAExecutor;
 import org.apache.oozie.executor.jpa.CoordJobQueryExecutor;
 import org.apache.oozie.executor.jpa.JPAExecutorException;
@@ -60,9 +57,7 @@ import org.apache.oozie.service.JPAService;
 import org.apache.oozie.service.SchemaService;
 import org.apache.oozie.service.Services;
 import org.apache.oozie.service.StatusTransitService;
-import org.apache.oozie.service.StoreService;
 import org.apache.oozie.service.URIHandlerService;
-import org.apache.oozie.store.CoordinatorStore;
 import org.apache.oozie.store.StoreException;
 import org.apache.oozie.test.XDataTestCase;
 import org.apache.oozie.util.DateUtils;
@@ -100,39 +95,26 @@ public class TestCoordRerunXCommand extends XDataTestCase {
         final String jobId = "0000000-" + new Date().getTime() + 
"-testCoordRerun-C";
         final int actionNum = 1;
         final String actionId = jobId + "@" + actionNum;
-        CoordinatorStore store = 
Services.get().get(StoreService.class).getStore(CoordinatorStore.class);
-        store.beginTrx();
         try {
-            addRecordToJobTable(jobId, store, CoordinatorJob.Status.SUCCEEDED);
-            addRecordToActionTable(jobId, actionNum, actionId, store, 
CoordinatorAction.Status.SUCCEEDED,
+            addRecordToJobTable(jobId, CoordinatorJob.Status.SUCCEEDED);
+            addRecordToActionTable(jobId, actionNum, actionId, 
CoordinatorAction.Status.SUCCEEDED,
                     "coord-rerun-action1.xml");
-            store.commitTrx();
         }
         catch (Exception e) {
             e.printStackTrace();
             fail("Could not update db.");
         }
-        finally {
-            store.closeTrx();
-        }
 
-        CoordinatorStore store1 = 
Services.get().get(StoreService.class).getStore(CoordinatorStore.class);
-        store1.beginTrx();
-        CoordinatorActionBean action1 = store1.getCoordinatorAction(actionId, 
false);
+        CoordinatorActionBean action1 = getCoordinatorAction(actionId);
         assertEquals(action1.getStatus(), CoordinatorAction.Status.SUCCEEDED);
-        store1.commitTrx();
-        store1.closeTrx();
 
         final OozieClient coordClient = LocalOozie.getCoordClient();
         coordClient.reRunCoord(jobId, RestConstants.JOB_COORD_SCOPE_ACTION, 
Integer.toString(actionNum), false, true);
 
-        CoordinatorStore store2 = 
Services.get().get(StoreService.class).getStore(CoordinatorStore.class);
-        store2.beginTrx();
-        CoordinatorActionBean action2 = store2.getCoordinatorAction(actionId, 
false);
+        CoordinatorActionBean action2 = getCoordinatorAction(actionId);
+
         assertNotSame(action2.getStatus(), CoordinatorAction.Status.SUCCEEDED);
         assertNull(action2.getExternalId());
-        store2.commitTrx();
-        store2.closeTrx();
     }
 
     /**
@@ -146,37 +128,27 @@ public class TestCoordRerunXCommand extends XDataTestCase 
{
         final int actionNum2 = 2;
         final String actionId1 = jobId + "@" + actionNum1;
         final String actionId2 = jobId + "@" + actionNum2;
-        CoordinatorStore store = 
Services.get().get(StoreService.class).getStore(CoordinatorStore.class);
-        store.beginTrx();
         try {
-            addRecordToJobTable(jobId, store, CoordinatorJob.Status.SUCCEEDED);
-            addRecordToActionTable(jobId, actionNum1, actionId1, store, 
CoordinatorAction.Status.SUCCEEDED,
+            addRecordToJobTable(jobId, CoordinatorJob.Status.SUCCEEDED);
+            addRecordToActionTable(jobId, actionNum1, actionId1, 
CoordinatorAction.Status.SUCCEEDED,
                     "coord-rerun-action1.xml");
-            addRecordToActionTable(jobId, actionNum2, actionId2, store, 
CoordinatorAction.Status.SUCCEEDED,
+            addRecordToActionTable(jobId, actionNum2, actionId2, 
CoordinatorAction.Status.SUCCEEDED,
                     "coord-rerun-action2.xml");
-            store.commitTrx();
         }
         catch (Exception e) {
             e.printStackTrace();
             fail("Could not update db.");
         }
-        finally {
-            store.closeTrx();
-        }
 
         String rerunScope = Integer.toString(actionNum1) + "-" + 
Integer.toString(actionNum2);
 
         final OozieClient coordClient = LocalOozie.getCoordClient();
         coordClient.reRunCoord(jobId, RestConstants.JOB_COORD_SCOPE_ACTION, 
rerunScope, false, true);
 
-        CoordinatorStore store1 = 
Services.get().get(StoreService.class).getStore(CoordinatorStore.class);
-        store1.beginTrx();
-        CoordinatorActionBean action1 = store1.getCoordinatorAction(actionId1, 
false);
+        CoordinatorActionBean action1 = getCoordinatorAction(actionId1);
         assertNotSame(action1.getStatus(), CoordinatorAction.Status.SUCCEEDED);
-        CoordinatorActionBean action2 = store1.getCoordinatorAction(actionId2, 
false);
+        CoordinatorActionBean action2 = getCoordinatorAction(actionId2);
         assertNotSame(action2.getStatus(), CoordinatorAction.Status.SUCCEEDED);
-        store1.commitTrx();
-        store1.closeTrx();
     }
 
     /**
@@ -190,36 +162,26 @@ public class TestCoordRerunXCommand extends XDataTestCase 
{
         final int actionNum2 = 2;
         final String actionId1 = jobId + "@" + actionNum1;
         final String actionId2 = jobId + "@" + actionNum2;
-        CoordinatorStore store = 
Services.get().get(StoreService.class).getStore(CoordinatorStore.class);
-        store.beginTrx();
         try {
-            addRecordToJobTable(jobId, store, CoordinatorJob.Status.SUCCEEDED);
-            addRecordToActionTable(jobId, actionNum1, actionId1, store, 
CoordinatorAction.Status.SUCCEEDED,
+            addRecordToJobTable(jobId, CoordinatorJob.Status.SUCCEEDED);
+            addRecordToActionTable(jobId, actionNum1, actionId1, 
CoordinatorAction.Status.SUCCEEDED,
                     "coord-rerun-action1.xml");
-            addRecordToActionTable(jobId, actionNum2, actionId2, store, 
CoordinatorAction.Status.SUCCEEDED,
+            addRecordToActionTable(jobId, actionNum2, actionId2, 
CoordinatorAction.Status.SUCCEEDED,
                     "coord-rerun-action2.xml");
-            store.commitTrx();
         }
         catch (Exception e) {
             e.printStackTrace();
             fail("Could not update db.");
         }
-        finally {
-            store.closeTrx();
-        }
         String rerunScope = Integer.toString(actionNum1) + "," + 
Integer.toString(actionNum2);
 
         final OozieClient coordClient = LocalOozie.getCoordClient();
         coordClient.reRunCoord(jobId, RestConstants.JOB_COORD_SCOPE_ACTION, 
rerunScope, false, true);
 
-        CoordinatorStore store1 = 
Services.get().get(StoreService.class).getStore(CoordinatorStore.class);
-        store1.beginTrx();
-        CoordinatorActionBean action1 = store1.getCoordinatorAction(actionId1, 
false);
+        CoordinatorActionBean action1 = getCoordinatorAction(actionId1);
         assertNotSame(action1.getStatus(), CoordinatorAction.Status.SUCCEEDED);
-        CoordinatorActionBean action2 = store1.getCoordinatorAction(actionId2, 
false);
+        CoordinatorActionBean action2 = getCoordinatorAction(actionId2);
         assertNotSame(action2.getStatus(), CoordinatorAction.Status.SUCCEEDED);
-        store1.commitTrx();
-        store1.closeTrx();
     }
 
     /**
@@ -233,23 +195,17 @@ public class TestCoordRerunXCommand extends XDataTestCase 
{
         final int actionNum2 = 2;
         final String actionId1 = jobId + "@" + actionNum1;
         final String actionId2 = jobId + "@" + actionNum2;
-        CoordinatorStore store = 
Services.get().get(StoreService.class).getStore(CoordinatorStore.class);
-        store.beginTrx();
         try {
-            addRecordToJobTable(jobId, store, CoordinatorJob.Status.SUCCEEDED);
-            addRecordToActionTable(jobId, actionNum1, actionId1, store, 
CoordinatorAction.Status.SUCCEEDED,
+            addRecordToJobTable(jobId, CoordinatorJob.Status.SUCCEEDED);
+            addRecordToActionTable(jobId, actionNum1, actionId1, 
CoordinatorAction.Status.SUCCEEDED,
                     "coord-rerun-action1.xml");
-            addRecordToActionTable(jobId, actionNum2, actionId2, store, 
CoordinatorAction.Status.SUCCEEDED,
+            addRecordToActionTable(jobId, actionNum2, actionId2, 
CoordinatorAction.Status.SUCCEEDED,
                     "coord-rerun-action2.xml");
-            store.commitTrx();
         }
         catch (Exception e) {
             e.printStackTrace();
             fail("Could not update db.");
         }
-        finally {
-            store.closeTrx();
-        }
 
         String rerunScope = "1-3";
         try {
@@ -269,21 +225,15 @@ public class TestCoordRerunXCommand extends XDataTestCase 
{
         final String jobId = "0000000-" + new Date().getTime() + 
"-testCoordRerun-C";
         final int actionNum = 1;
         final String actionId = jobId + "@" + actionNum;
-        CoordinatorStore store = 
Services.get().get(StoreService.class).getStore(CoordinatorStore.class);
-        store.beginTrx();
         try {
-            addRecordToJobTable(jobId, store, CoordinatorJob.Status.SUCCEEDED);
-            addRecordToActionTable(jobId, actionNum, actionId, store, 
CoordinatorAction.Status.RUNNING,
+            addRecordToJobTable(jobId, CoordinatorJob.Status.SUCCEEDED);
+            addRecordToActionTable(jobId, actionNum, actionId, 
CoordinatorAction.Status.RUNNING,
                     "coord-rerun-action1.xml");
-            store.commitTrx();
         }
         catch (Exception e) {
             e.printStackTrace();
             fail("Could not update db.");
         }
-        finally {
-            store.closeTrx();
-        }
 
         try {
             final OozieClient coordClient = LocalOozie.getCoordClient();
@@ -297,12 +247,8 @@ public class TestCoordRerunXCommand extends XDataTestCase {
             }
         }
 
-        CoordinatorStore store2 = 
Services.get().get(StoreService.class).getStore(CoordinatorStore.class);
-        store2.beginTrx();
-        CoordinatorActionBean action2 = store2.getCoordinatorAction(actionId, 
false);
+        CoordinatorActionBean action2 = getCoordinatorAction(actionId);
         assertEquals(action2.getStatus(), CoordinatorAction.Status.RUNNING);
-        store2.commitTrx();
-        store2.closeTrx();
     }
 
     /**
@@ -314,38 +260,24 @@ public class TestCoordRerunXCommand extends XDataTestCase 
{
         final String jobId = "0000000-" + new Date().getTime() + 
"-testCoordRerun-C";
         final int actionNum = 1;
         final String actionId = jobId + "@" + actionNum;
-        CoordinatorStore store = 
Services.get().get(StoreService.class).getStore(CoordinatorStore.class);
-        store.beginTrx();
         try {
-            addRecordToJobTable(jobId, store, CoordinatorJob.Status.SUCCEEDED);
-            addRecordToActionTable(jobId, actionNum, actionId, store, 
CoordinatorAction.Status.SUCCEEDED,
+            addRecordToJobTable(jobId, CoordinatorJob.Status.SUCCEEDED);
+            addRecordToActionTable(jobId, actionNum, actionId, 
CoordinatorAction.Status.SUCCEEDED,
                     "coord-rerun-action1.xml");
-            store.commitTrx();
         }
         catch (Exception e) {
             e.printStackTrace();
             fail("Could not update db.");
         }
-        finally {
-            store.closeTrx();
-        }
 
-        CoordinatorStore store1 = 
Services.get().get(StoreService.class).getStore(CoordinatorStore.class);
-        store1.beginTrx();
-        CoordinatorActionBean action1 = store1.getCoordinatorAction(actionId, 
false);
+        CoordinatorActionBean action1 = getCoordinatorAction(actionId);
         assertEquals(action1.getStatus(), CoordinatorAction.Status.SUCCEEDED);
-        store1.commitTrx();
-        store1.closeTrx();
 
         final OozieClient coordClient = LocalOozie.getCoordClient();
         coordClient.reRunCoord(jobId, RestConstants.JOB_COORD_SCOPE_DATE, 
"2009-12-15T01:00Z", false, true);
 
-        CoordinatorStore store2 = 
Services.get().get(StoreService.class).getStore(CoordinatorStore.class);
-        store2.beginTrx();
-        CoordinatorActionBean action2 = store2.getCoordinatorAction(actionId, 
false);
+        CoordinatorActionBean action2 = getCoordinatorAction(actionId);
         assertNotSame(action2.getStatus(), CoordinatorAction.Status.SUCCEEDED);
-        store2.commitTrx();
-        store2.closeTrx();
     }
 
     /**
@@ -359,37 +291,27 @@ public class TestCoordRerunXCommand extends XDataTestCase 
{
         final int actionNum2 = 2;
         final String actionId1 = jobId + "@" + actionNum1;
         final String actionId2 = jobId + "@" + actionNum2;
-        CoordinatorStore store = 
Services.get().get(StoreService.class).getStore(CoordinatorStore.class);
-        store.beginTrx();
         try {
-            addRecordToJobTable(jobId, store, CoordinatorJob.Status.SUCCEEDED);
-            addRecordToActionTable(jobId, actionNum1, actionId1, store, 
CoordinatorAction.Status.SUCCEEDED,
+            addRecordToJobTable(jobId, CoordinatorJob.Status.SUCCEEDED);
+            addRecordToActionTable(jobId, actionNum1, actionId1, 
CoordinatorAction.Status.SUCCEEDED,
                     "coord-rerun-action1.xml");
-            addRecordToActionTable(jobId, actionNum2, actionId2, store, 
CoordinatorAction.Status.SUCCEEDED,
+            addRecordToActionTable(jobId, actionNum2, actionId2, 
CoordinatorAction.Status.SUCCEEDED,
                     "coord-rerun-action2.xml");
-            store.commitTrx();
         }
         catch (Exception e) {
             e.printStackTrace();
             fail("Could not update db.");
         }
-        finally {
-            store.closeTrx();
-        }
 
         String rerunScope = "2009-12-15T01:00Z" + "::" + "2009-12-16T01:00Z";
 
         final OozieClient coordClient = LocalOozie.getCoordClient();
         coordClient.reRunCoord(jobId, RestConstants.JOB_COORD_SCOPE_DATE, 
rerunScope, false, true);
 
-        CoordinatorStore store1 = 
Services.get().get(StoreService.class).getStore(CoordinatorStore.class);
-        store1.beginTrx();
-        CoordinatorActionBean action1 = store1.getCoordinatorAction(actionId1, 
false);
+        CoordinatorActionBean action1 = getCoordinatorAction(actionId1);
         assertNotSame(action1.getStatus(), CoordinatorAction.Status.SUCCEEDED);
-        CoordinatorActionBean action2 = store1.getCoordinatorAction(actionId2, 
false);
+        CoordinatorActionBean action2 = getCoordinatorAction(actionId2);
         assertNotSame(action2.getStatus(), CoordinatorAction.Status.SUCCEEDED);
-        store1.commitTrx();
-        store1.closeTrx();
     }
 
     /**
@@ -403,37 +325,27 @@ public class TestCoordRerunXCommand extends XDataTestCase 
{
         final int actionNum2 = 2;
         final String actionId1 = jobId + "@" + actionNum1;
         final String actionId2 = jobId + "@" + actionNum2;
-        CoordinatorStore store = 
Services.get().get(StoreService.class).getStore(CoordinatorStore.class);
-        store.beginTrx();
         try {
-            addRecordToJobTable(jobId, store, CoordinatorJob.Status.SUCCEEDED);
-            addRecordToActionTable(jobId, actionNum1, actionId1, store, 
CoordinatorAction.Status.SUCCEEDED,
+            addRecordToJobTable(jobId, CoordinatorJob.Status.SUCCEEDED);
+            addRecordToActionTable(jobId, actionNum1, actionId1, 
CoordinatorAction.Status.SUCCEEDED,
                     "coord-rerun-action1.xml");
-            addRecordToActionTable(jobId, actionNum2, actionId2, store, 
CoordinatorAction.Status.SUCCEEDED,
+            addRecordToActionTable(jobId, actionNum2, actionId2, 
CoordinatorAction.Status.SUCCEEDED,
                     "coord-rerun-action2.xml");
-            store.commitTrx();
         }
         catch (Exception e) {
             e.printStackTrace();
             fail("Could not update db.");
         }
-        finally {
-            store.closeTrx();
-        }
 
         String rerunScope = "2009-12-15T01:00Z" + "," + "2009-12-16T01:00Z";
 
         final OozieClient coordClient = LocalOozie.getCoordClient();
         coordClient.reRunCoord(jobId, RestConstants.JOB_COORD_SCOPE_DATE, 
rerunScope, false, true);
 
-        CoordinatorStore store1 = 
Services.get().get(StoreService.class).getStore(CoordinatorStore.class);
-        store1.beginTrx();
-        CoordinatorActionBean action1 = store1.getCoordinatorAction(actionId1, 
false);
+        CoordinatorActionBean action1 = getCoordinatorAction(actionId1);
         assertNotSame(action1.getStatus(), CoordinatorAction.Status.SUCCEEDED);
-        CoordinatorActionBean action2 = store1.getCoordinatorAction(actionId2, 
false);
+        CoordinatorActionBean action2 = getCoordinatorAction(actionId2);
         assertNotSame(action2.getStatus(), CoordinatorAction.Status.SUCCEEDED);
-        store1.commitTrx();
-        store1.closeTrx();
     }
 
     /**
@@ -448,37 +360,27 @@ public class TestCoordRerunXCommand extends XDataTestCase 
{
         final int actionNum2 = 2;
         final String actionId1 = jobId + "@" + actionNum1;
         final String actionId2 = jobId + "@" + actionNum2;
-        CoordinatorStore store = 
Services.get().get(StoreService.class).getStore(CoordinatorStore.class);
-        store.beginTrx();
         try {
-            addRecordToJobTable(jobId, store, CoordinatorJob.Status.SUCCEEDED);
-            addRecordToActionTable(jobId, actionNum1, actionId1, store, 
CoordinatorAction.Status.SUCCEEDED,
+            addRecordToJobTable(jobId, CoordinatorJob.Status.SUCCEEDED);
+            addRecordToActionTable(jobId, actionNum1, actionId1, 
CoordinatorAction.Status.SUCCEEDED,
                     "coord-rerun-action1.xml");
-            addRecordToActionTable(jobId, actionNum2, actionId2, store, 
CoordinatorAction.Status.SUCCEEDED,
+            addRecordToActionTable(jobId, actionNum2, actionId2, 
CoordinatorAction.Status.SUCCEEDED,
                     "coord-rerun-action2.xml");
-            store.commitTrx();
         }
         catch (Exception e) {
             e.printStackTrace();
             fail("Could not update db.");
         }
-        finally {
-            store.closeTrx();
-        }
 
         String rerunScope = "2009-12-15T01:00Z" + "::" + "2009-12-17T01:00Z";
 
         final OozieClient coordClient = LocalOozie.getCoordClient();
         coordClient.reRunCoord(jobId, RestConstants.JOB_COORD_SCOPE_DATE, 
rerunScope, false, true);
 
-        CoordinatorStore store1 = 
Services.get().get(StoreService.class).getStore(CoordinatorStore.class);
-        store1.beginTrx();
-        CoordinatorActionBean action1 = store1.getCoordinatorAction(actionId1, 
false);
+        CoordinatorActionBean action1 = getCoordinatorAction(actionId1);
         assertNotSame(action1.getStatus(), CoordinatorAction.Status.SUCCEEDED);
-        CoordinatorActionBean action2 = store1.getCoordinatorAction(actionId2, 
false);
+        CoordinatorActionBean action2 = getCoordinatorAction(actionId2);
         assertNotSame(action2.getStatus(), CoordinatorAction.Status.SUCCEEDED);
-        store1.commitTrx();
-        store1.closeTrx();
     }
 
     /**
@@ -493,23 +395,17 @@ public class TestCoordRerunXCommand extends XDataTestCase 
{
         final int actionNum2 = 2;
         final String actionId1 = jobId + "@" + actionNum1;
         final String actionId2 = jobId + "@" + actionNum2;
-        CoordinatorStore store = 
Services.get().get(StoreService.class).getStore(CoordinatorStore.class);
-        store.beginTrx();
         try {
-            addRecordToJobTable(jobId, store, CoordinatorJob.Status.SUCCEEDED);
-            addRecordToActionTable(jobId, actionNum1, actionId1, store, 
CoordinatorAction.Status.SUCCEEDED,
+            addRecordToJobTable(jobId, CoordinatorJob.Status.SUCCEEDED);
+            addRecordToActionTable(jobId, actionNum1, actionId1, 
CoordinatorAction.Status.SUCCEEDED,
                     "coord-rerun-action1.xml");
-            addRecordToActionTable(jobId, actionNum2, actionId2, store, 
CoordinatorAction.Status.SUCCEEDED,
+            addRecordToActionTable(jobId, actionNum2, actionId2, 
CoordinatorAction.Status.SUCCEEDED,
                     "coord-rerun-action2.xml");
-            store.commitTrx();
         }
         catch (Exception e) {
             e.printStackTrace();
             fail("Could not update db.");
         }
-        finally {
-            store.closeTrx();
-        }
         String rerunScope = 
"2009-12-15T01:00Z,2009-12-16T01:00Z,2009-12-17T01:00Z";
         try {
             final OozieClient coordClient = LocalOozie.getCoordClient();
@@ -530,21 +426,15 @@ public class TestCoordRerunXCommand extends XDataTestCase 
{
         final String jobId = "0000000-" + new Date().getTime() + 
"-testCoordRerun-C";
         final int actionNum = 1;
         final String actionId = jobId + "@" + actionNum;
-        CoordinatorStore store = 
Services.get().get(StoreService.class).getStore(CoordinatorStore.class);
-        store.beginTrx();
         try {
-            addRecordToJobTable(jobId, store, CoordinatorJob.Status.SUCCEEDED);
-            addRecordToActionTable(jobId, actionNum, actionId, store, 
CoordinatorAction.Status.SUCCEEDED,
+            addRecordToJobTable(jobId, CoordinatorJob.Status.SUCCEEDED);
+            addRecordToActionTable(jobId, actionNum, actionId, 
CoordinatorAction.Status.SUCCEEDED,
                     "coord-rerun-action1.xml");
-            store.commitTrx();
         }
         catch (Exception e) {
             e.printStackTrace();
             fail("Could not update db.");
         }
-        finally {
-            store.closeTrx();
-        }
         Path appPath = new Path(getFsTestCaseDir(), "coord");
         String inputDir = appPath.toString() + "/coord-input/2010/07/09/01/00";
         FileSystem fs = getFileSystem();
@@ -554,12 +444,8 @@ public class TestCoordRerunXCommand extends XDataTestCase {
         final OozieClient coordClient = LocalOozie.getCoordClient();
         coordClient.reRunCoord(jobId, RestConstants.JOB_COORD_SCOPE_ACTION, 
Integer.toString(actionNum), true, true);
 
-        CoordinatorStore store2 = 
Services.get().get(StoreService.class).getStore(CoordinatorStore.class);
-        store2.beginTrx();
-        CoordinatorActionBean action2 = store2.getCoordinatorAction(actionId, 
false);
+        CoordinatorActionBean action2 = getCoordinatorAction(actionId);
         assertNotSame(action2.getStatus(), CoordinatorAction.Status.SUCCEEDED);
-        store2.commitTrx();
-        store2.closeTrx();
 
         waitFor(120 * 1000, new Predicate() {
             @Override
@@ -569,16 +455,12 @@ public class TestCoordRerunXCommand extends XDataTestCase 
{
             }
         });
 
-        CoordinatorStore store3 = 
Services.get().get(StoreService.class).getStore(CoordinatorStore.class);
-        store3.beginTrx();
-        CoordinatorActionBean action3 = store3.getCoordinatorAction(actionId, 
false);
+        CoordinatorActionBean action3 = getCoordinatorAction(actionId);
         String actionXml = action3.getActionXml();
         System.out.println("After refresh, action xml= " + actionXml);
 
         Element eAction = XmlUtils.parseXml(actionXml);
         String[] urls = getActionXmlUrls(eAction, getTestUser(), 
getTestGroup());
-        store3.commitTrx();
-        store3.closeTrx();
 
         /*        if (urls != null) {
                     assertEquals(inputDir, urls[0]);
@@ -597,21 +479,15 @@ public class TestCoordRerunXCommand extends XDataTestCase 
{
         final String jobId = "0000000-" + new Date().getTime() + 
"-testCoordRerun-C";
         final int actionNum = 1;
         final String actionId = jobId + "@" + actionNum;
-        CoordinatorStore store = 
Services.get().get(StoreService.class).getStore(CoordinatorStore.class);
-        store.beginTrx();
         try {
-            addRecordToJobTable(jobId, store, CoordinatorJob.Status.SUCCEEDED);
-            addRecordToActionTable(jobId, actionNum, actionId, store, 
CoordinatorAction.Status.SUCCEEDED,
+            addRecordToJobTable(jobId, CoordinatorJob.Status.SUCCEEDED);
+            addRecordToActionTable(jobId, actionNum, actionId, 
CoordinatorAction.Status.SUCCEEDED,
                     "coord-rerun-action4.xml");
-            store.commitTrx();
         }
         catch (Exception e) {
             e.printStackTrace();
             fail("Could not update db.");
         }
-        finally {
-            store.closeTrx();
-        }
         Path appPath = new Path(getFsTestCaseDir(), "coord");
         String outputDir = appPath.toString() + 
"/coord-input/2009/12/14/11/00";
         Path success = new Path(outputDir, "_SUCCESS");
@@ -625,12 +501,8 @@ public class TestCoordRerunXCommand extends XDataTestCase {
         final OozieClient coordClient = LocalOozie.getCoordClient();
         coordClient.reRunCoord(jobId, RestConstants.JOB_COORD_SCOPE_ACTION, 
Integer.toString(actionNum), false, false);
 
-        CoordinatorStore store2 = 
Services.get().get(StoreService.class).getStore(CoordinatorStore.class);
-        store2.beginTrx();
-        CoordinatorActionBean action2 = store2.getCoordinatorAction(actionId, 
false);
+        CoordinatorActionBean action2 = getCoordinatorAction(actionId);
         assertNotSame(action2.getStatus(), CoordinatorAction.Status.SUCCEEDED);
-        store2.commitTrx();
-        store2.closeTrx();
 
         waitFor(120 * 1000, new Predicate() {
             @Override
@@ -655,21 +527,15 @@ public class TestCoordRerunXCommand extends XDataTestCase 
{
         final String jobId = "0000000-" + new Date().getTime() + 
"-testCoordRerun-C";
         final int actionNum = 1;
         final String actionId = jobId + "@" + actionNum;
-        CoordinatorStore store = 
Services.get().get(StoreService.class).getStore(CoordinatorStore.class);
-        store.beginTrx();
         try {
-            addRecordToJobTable(jobId, store, CoordinatorJob.Status.SUCCEEDED);
-            addRecordToActionTable(jobId, actionNum, actionId, store, 
CoordinatorAction.Status.SUCCEEDED,
+            addRecordToJobTable(jobId, CoordinatorJob.Status.SUCCEEDED);
+            addRecordToActionTable(jobId, actionNum, actionId, 
CoordinatorAction.Status.SUCCEEDED,
                     "coord-rerun-action1.xml");
-            store.commitTrx();
         }
         catch (Exception e) {
             e.printStackTrace();
             fail("Could not update db.");
         }
-        finally {
-            store.closeTrx();
-        }
         Path appPath = new Path(getFsTestCaseDir(), "coord");
         String outputDir = appPath.toString() + 
"/coord-input/2009/12/14/11/00";
         Path success = new Path(outputDir, "_SUCCESS");
@@ -682,12 +548,8 @@ public class TestCoordRerunXCommand extends XDataTestCase {
         final OozieClient coordClient = LocalOozie.getCoordClient();
         coordClient.reRunCoord(jobId, RestConstants.JOB_COORD_SCOPE_ACTION, 
Integer.toString(actionNum), false, false);
 
-        CoordinatorStore store2 = 
Services.get().get(StoreService.class).getStore(CoordinatorStore.class);
-        store2.beginTrx();
-        CoordinatorActionBean action2 = store2.getCoordinatorAction(actionId, 
false);
+        CoordinatorActionBean action2 = getCoordinatorAction(actionId);
         assertNotSame(action2.getStatus(), CoordinatorAction.Status.SUCCEEDED);
-        store2.commitTrx();
-        store2.closeTrx();
 
         waitFor(120 * 1000, new Predicate() {
             @Override
@@ -714,21 +576,15 @@ public class TestCoordRerunXCommand extends XDataTestCase 
{
         final String jobId = "0000000-" + new Date().getTime() + 
"-testCoordRerun-C";
         final int actionNum = 1;
         final String actionId = jobId + "@" + actionNum;
-        CoordinatorStore store = 
Services.get().get(StoreService.class).getStore(CoordinatorStore.class);
-        store.beginTrx();
         try {
-            addRecordToJobTable(jobId, store, CoordinatorJob.Status.SUCCEEDED);
-            addRecordToActionTable(jobId, actionNum, actionId, store, 
CoordinatorAction.Status.SUCCEEDED,
+            addRecordToJobTable(jobId, CoordinatorJob.Status.SUCCEEDED);
+            addRecordToActionTable(jobId, actionNum, actionId, 
CoordinatorAction.Status.SUCCEEDED,
                     "coord-rerun-action1.xml", true);
-            store.commitTrx();
         }
         catch (Exception e) {
             e.printStackTrace();
             fail("Could not update db.");
         }
-        finally {
-            store.closeTrx();
-        }
 
         String db = "mydb";
         String table = "mytable";
@@ -773,30 +629,20 @@ public class TestCoordRerunXCommand extends XDataTestCase 
{
         final String jobId = "0000000-" + new Date().getTime() + 
"-testCoordRerun-C";
         final int actionNum = 1;
         final String actionId = jobId + "@" + actionNum;
-        CoordinatorStore store = 
Services.get().get(StoreService.class).getStore(CoordinatorStore.class);
-        store.beginTrx();
         try {
-            addRecordToJobTable(jobId, store, CoordinatorJob.Status.SUCCEEDED);
-            addRecordToActionTable(jobId, actionNum, actionId, store, 
CoordinatorAction.Status.SUCCEEDED,
+            addRecordToJobTable(jobId, CoordinatorJob.Status.SUCCEEDED);
+            addRecordToActionTable(jobId, actionNum, actionId, 
CoordinatorAction.Status.SUCCEEDED,
                     "coord-rerun-action3.xml");
-            store.commitTrx();
         }
         catch (Exception e) {
             e.printStackTrace();
             fail("Could not update db.");
         }
-        finally {
-            store.closeTrx();
-        }
 
         final OozieClient coordClient = LocalOozie.getCoordClient();
         coordClient.reRunCoord(jobId, RestConstants.JOB_COORD_SCOPE_ACTION, 
Integer.toString(actionNum), false, false);
-        CoordinatorStore store2 = 
Services.get().get(StoreService.class).getStore(CoordinatorStore.class);
-        store2.beginTrx();
-        CoordinatorActionBean action2 = store2.getCoordinatorAction(actionId, 
false);
+        CoordinatorActionBean action2 = getCoordinatorAction(actionId);
         assertNotSame(action2.getStatus(), CoordinatorAction.Status.SUCCEEDED);
-        store2.commitTrx();
-        store2.closeTrx();
         waitFor(120 * 1000, new Predicate() {
             @Override
             public boolean evaluate() throws Exception {
@@ -817,10 +663,7 @@ public class TestCoordRerunXCommand extends XDataTestCase {
     public void testCoordRerunInFailed() throws Exception {
         CoordinatorJobBean job = 
this.addRecordToCoordJobTable(Job.Status.FAILED, false, false);
 
-        JPAService jpaService = Services.get().get(JPAService.class);
-        assertNotNull(jpaService);
-        CoordJobGetJPAExecutor coordJobGetExecutor = new 
CoordJobGetJPAExecutor(job.getId());
-        job = jpaService.execute(coordJobGetExecutor);
+        job = getCoordinatorJob(job.getId());
         assertEquals(Job.Status.FAILED, job.getStatus());
 
         try {
@@ -848,13 +691,12 @@ public class TestCoordRerunXCommand extends XDataTestCase 
{
 
         JPAService jpaService = Services.get().get(JPAService.class);
         assertNotNull(jpaService);
-        CoordJobGetJPAExecutor coordJobGetExecutor = new 
CoordJobGetJPAExecutor(job.getId());
-        job = jpaService.execute(coordJobGetExecutor);
+        job = getCoordinatorJob(job.getId());
         assertEquals(Job.Status.DONEWITHERROR, job.getStatus());
 
         new CoordRerunXCommand(job.getId(), 
RestConstants.JOB_COORD_SCOPE_DATE, "2009-12-15T01:00Z", false, true, false,
                 null).call();
-        job = jpaService.execute(coordJobGetExecutor);
+        job = getCoordinatorJob(job.getId());
         assertEquals(Job.Status.RUNNINGWITHERROR, job.getStatus());
 
     }
@@ -871,14 +713,13 @@ public class TestCoordRerunXCommand extends XDataTestCase 
{
 
         JPAService jpaService = Services.get().get(JPAService.class);
         assertNotNull(jpaService);
-        CoordJobGetJPAExecutor coordJobGetExecutor = new 
CoordJobGetJPAExecutor(job.getId());
-        job = jpaService.execute(coordJobGetExecutor);
+        job = getCoordinatorJob(job.getId());
         assertEquals(Job.Status.PAUSED, job.getStatus());
 
         new CoordRerunXCommand(job.getId(), 
RestConstants.JOB_COORD_SCOPE_DATE, "2009-12-15T01:00Z", false, true, false,
                 null).call();
 
-        job = jpaService.execute(coordJobGetExecutor);
+        job = getCoordinatorJob(job.getId());
         assertEquals(Job.Status.PAUSED, job.getStatus());
         assertNotNull(job.getPauseTime());
     }
@@ -896,14 +737,13 @@ public class TestCoordRerunXCommand extends XDataTestCase 
{
 
         JPAService jpaService = Services.get().get(JPAService.class);
         assertNotNull(jpaService);
-        CoordJobGetJPAExecutor coordJobGetExecutor = new 
CoordJobGetJPAExecutor(job.getId());
-        job = jpaService.execute(coordJobGetExecutor);
+        job = getCoordinatorJob(job.getId());
         assertEquals(Job.Status.PAUSEDWITHERROR, job.getStatus());
 
         new CoordRerunXCommand(job.getId(), 
RestConstants.JOB_COORD_SCOPE_DATE, "2009-12-15T01:00Z", false, true, false,
                 null).call();
 
-        job = jpaService.execute(coordJobGetExecutor);
+        job = getCoordinatorJob(job.getId());
         assertEquals(Job.Status.PAUSEDWITHERROR, job.getStatus());
         assertNotNull(job.getPauseTime());
     }
@@ -917,21 +757,15 @@ public class TestCoordRerunXCommand extends XDataTestCase 
{
         final String jobId = "0000000-" + new Date().getTime() + 
"-testCoordRerun-C";
         final int actionNum = 1;
         final String actionId = jobId + "@" + actionNum;
-        CoordinatorStore store = 
Services.get().get(StoreService.class).getStore(CoordinatorStore.class);
-        store.beginTrx();
         try {
-            addRecordToJobTable(jobId, store, CoordinatorJob.Status.KILLED);
-            addRecordToActionTable(jobId, actionNum, actionId, store, 
CoordinatorAction.Status.SUCCEEDED,
+            addRecordToJobTable(jobId, CoordinatorJob.Status.KILLED);
+            addRecordToActionTable(jobId, actionNum, actionId, 
CoordinatorAction.Status.SUCCEEDED,
                     "coord-rerun-action1.xml");
-            store.commitTrx();
         }
         catch (Exception e) {
             e.printStackTrace();
             fail("Could not update db.");
         }
-        finally {
-            store.closeTrx();
-        }
 
         try {
             final OozieClient coordClient = LocalOozie.getCoordClient();
@@ -943,12 +777,8 @@ public class TestCoordRerunXCommand extends XDataTestCase {
             fail("Coord rerun failed");
         }
 
-        CoordinatorStore store2 = 
Services.get().get(StoreService.class).getStore(CoordinatorStore.class);
-        store2.beginTrx();
-        CoordinatorActionBean action2 = store2.getCoordinatorAction(actionId, 
false);
+        CoordinatorActionBean action2 = getCoordinatorAction(actionId);
         assertEquals(action2.getStatus(), CoordinatorAction.Status.WAITING);
-        store2.commitTrx();
-        store2.closeTrx();
     }
 
     /*
@@ -958,21 +788,15 @@ public class TestCoordRerunXCommand extends XDataTestCase 
{
         final String jobId = "0000000-" + new Date().getTime() + 
"-testCoordRerun-C";
         final int actionNum = 1;
         final String actionId = jobId + "@" + actionNum;
-        CoordinatorStore store = 
Services.get().get(StoreService.class).getStore(CoordinatorStore.class);
-        store.beginTrx();
         try {
-            addRecordToJobTable(jobId, store, CoordinatorJob.Status.RUNNING);
-            addRecordToActionTable(jobId, actionNum, actionId, store, 
CoordinatorAction.Status.FAILED,
+            addRecordToJobTable(jobId, CoordinatorJob.Status.RUNNING);
+            addRecordToActionTable(jobId, actionNum, actionId, 
CoordinatorAction.Status.FAILED,
                     "coord-rerun-action1.xml");
-            store.commitTrx();
         }
         catch (Exception e) {
             e.printStackTrace();
             fail("Could not update db.");
         }
-        finally {
-            store.closeTrx();
-        }
 
         try {
             final OozieClient coordClient = LocalOozie.getCoordClient();
@@ -983,8 +807,7 @@ public class TestCoordRerunXCommand extends XDataTestCase {
             ex.printStackTrace();
             fail("Coord rerun failed");
         }
-        CoordinatorStore store2 = 
Services.get().get(StoreService.class).getStore(CoordinatorStore.class);
-        CoordinatorActionBean action2 = store2.getCoordinatorAction(actionId, 
false);
+        CoordinatorActionBean action2 = getCoordinatorAction(actionId);
         assertEquals(action2.getStatus(), CoordinatorAction.Status.WAITING);
         assertEquals(action2.getErrorCode(), "");
         assertEquals(action2.getErrorMessage(), "");
@@ -1026,16 +849,13 @@ public class TestCoordRerunXCommand extends 
XDataTestCase {
         final OozieClient coordClient = LocalOozie.getCoordClient();
         coordClient.reRunCoord(coordJob.getId(), 
RestConstants.JOB_COORD_SCOPE_ACTION, rerunScope, false, true);
 
-        CoordJobGetJPAExecutor coordJobGetCmd = new 
CoordJobGetJPAExecutor(coordJob.getId());
-        coordJob = jpaService.execute(coordJobGetCmd);
+        coordJob = getCoordinatorJob(coordJob.getId());
         assertEquals(CoordinatorJob.Status.SUCCEEDED, coordJob.getStatus());
 
-        CoordActionGetJPAExecutor coordActionGetCmd = new 
CoordActionGetJPAExecutor(action1.getId());
-        action1 = jpaService.execute(coordActionGetCmd);
+        action1 = getCoordinatorAction(action1.getId());
         assertNotSame(action1.getStatus(), CoordinatorAction.Status.FAILED);
 
-        coordActionGetCmd = new CoordActionGetJPAExecutor(action2.getId());
-        action2 = jpaService.execute(coordActionGetCmd);
+        action2 = getCoordinatorAction(action2.getId());
         assertNotSame(action2.getStatus(), CoordinatorAction.Status.SUCCEEDED);
     }
 
@@ -1075,16 +895,13 @@ public class TestCoordRerunXCommand extends 
XDataTestCase {
         final OozieClient coordClient = LocalOozie.getCoordClient();
         coordClient.reRunCoord(coordJob.getId(), 
RestConstants.JOB_COORD_SCOPE_ACTION, rerunScope, false, true);
 
-        CoordJobGetJPAExecutor coordJobGetCmd = new 
CoordJobGetJPAExecutor(coordJob.getId());
-        coordJob = jpaService.execute(coordJobGetCmd);
+        coordJob = getCoordinatorJob(coordJob.getId());
         assertEquals(CoordinatorJob.Status.SUSPENDED, coordJob.getStatus());
 
-        CoordActionGetJPAExecutor coordActionGetCmd = new 
CoordActionGetJPAExecutor(action1.getId());
-        action1 = jpaService.execute(coordActionGetCmd);
+        action1 = getCoordinatorAction(action1.getId());
         assertNotSame(action1.getStatus(), CoordinatorAction.Status.FAILED);
 
-        coordActionGetCmd = new CoordActionGetJPAExecutor(action2.getId());
-        action2 = jpaService.execute(coordActionGetCmd);
+        action2 = getCoordinatorAction(action2.getId());
         assertNotSame(action2.getStatus(), CoordinatorAction.Status.SUCCEEDED);
     }
 
@@ -1125,16 +942,13 @@ public class TestCoordRerunXCommand extends 
XDataTestCase {
         final OozieClient coordClient = LocalOozie.getCoordClient();
         coordClient.reRunCoord(coordJob.getId(), 
RestConstants.JOB_COORD_SCOPE_ACTION, rerunScope, false, true);
 
-        CoordJobGetJPAExecutor coordJobGetCmd = new 
CoordJobGetJPAExecutor(coordJob.getId());
-        coordJob = jpaService.execute(coordJobGetCmd);
+        coordJob = getCoordinatorJob(coordJob.getId());
         assertEquals(CoordinatorJob.Status.SUCCEEDED, coordJob.getStatus());
 
-        CoordActionGetJPAExecutor coordActionGetCmd = new 
CoordActionGetJPAExecutor(action1.getId());
-        action1 = jpaService.execute(coordActionGetCmd);
+        action1 = getCoordinatorAction(action1.getId());
         assertNotSame(action1.getStatus(), CoordinatorAction.Status.SUCCEEDED);
 
-        coordActionGetCmd = new CoordActionGetJPAExecutor(action2.getId());
-        action2 = jpaService.execute(coordActionGetCmd);
+        action2 = getCoordinatorAction(action2.getId());
         assertNotSame(action2.getStatus(), CoordinatorAction.Status.SUCCEEDED);
     }
 
@@ -1157,7 +971,7 @@ public class TestCoordRerunXCommand extends XDataTestCase {
         return coordJob;
     }
 
-    private void addRecordToJobTable(String jobId, CoordinatorStore store, 
CoordinatorJob.Status status)
+    private void addRecordToJobTable(String jobId, CoordinatorJob.Status 
status)
             throws StoreException, IOException {
         Path appPath = new Path(getFsTestCaseDir(), "coord");
         String appXml = getCoordJobXml(appPath);
@@ -1199,22 +1013,21 @@ public class TestCoordRerunXCommand extends 
XDataTestCase {
         }
 
         try {
-            store.insertCoordinatorJob(coordJob);
-        }
-        catch (StoreException se) {
-            se.printStackTrace();
-            store.rollbackTrx();
+            addRecordToCoordJobTable(coordJob);
+        } catch (Exception e) {
+            e.printStackTrace();
             fail("Unable to insert the test job record to table");
-            throw se;
+            throw new StoreException(ErrorCode.E1019, e.getMessage());
         }
+
     }
 
-    private void addRecordToActionTable(String jobId, int actionNum, String 
actionId, CoordinatorStore store,
+    private void addRecordToActionTable(String jobId, int actionNum, String 
actionId,
             CoordinatorAction.Status status, String resourceXmlName) throws 
StoreException, IOException {
-        addRecordToActionTable(jobId, actionNum, actionId, store, status, 
resourceXmlName, false);
+        addRecordToActionTable(jobId, actionNum, actionId, status, 
resourceXmlName, false);
     }
 
-    private void addRecordToActionTable(String jobId, int actionNum, String 
actionId, CoordinatorStore store,
+    private void addRecordToActionTable(String jobId, int actionNum, String 
actionId,
             CoordinatorAction.Status status, String resourceXmlName, boolean 
isHCatDep) throws StoreException,
             IOException {
         Path appPath = new Path(getFsTestCaseDir(), "coord");
@@ -1253,14 +1066,13 @@ public class TestCoordRerunXCommand extends 
XDataTestCase {
         }
 
         try {
-            store.insertCoordinatorAction(action);
-        }
-        catch (StoreException se) {
-            se.printStackTrace();
-            store.rollbackTrx();
+            addRecordToCoordActionTable(action, null);
+        } catch (Exception e) {
+            e.printStackTrace();
             fail("Unable to insert the test job record to table");
-            throw se;
+            throw new StoreException(ErrorCode.E1019, e.getMessage());
         }
+
     }
 
     private Properties getCoordProp(Path appPath) throws IOException {
@@ -1394,8 +1206,7 @@ public class TestCoordRerunXCommand extends XDataTestCase 
{
         String actionId = action.getId();
         new CoordActionStartXCommand(actionId, getTestUser(), "myapp", 
"myjob").call();
 
-        final JPAService jpaService = Services.get().get(JPAService.class);
-        action = jpaService.execute(new CoordActionGetJPAExecutor(actionId));
+        action = getCoordinatorAction(actionId);
 
         if (action.getStatus() == CoordinatorAction.Status.SUBMITTED) {
             fail("CoordActionStartCommand didn't work because the status for 
action id" + actionId + " is :"
@@ -1523,8 +1334,7 @@ public class TestCoordRerunXCommand extends XDataTestCase 
{
         final String actionId = action.getId();
         new CoordActionStartXCommand(actionId, getTestUser(), "myapp", 
"myjob").call();
 
-        final JPAService jpaService = Services.get().get(JPAService.class);
-        action = jpaService.execute(new CoordActionGetJPAExecutor(actionId));
+        action = getCoordinatorAction(actionId);
 
         if (action.getStatus() == CoordinatorAction.Status.SUBMITTED) {
             fail("CoordActionStartCommand didn't work because the status for 
action id" + actionId + " is :"
@@ -1585,8 +1395,7 @@ public class TestCoordRerunXCommand extends XDataTestCase 
{
         final String actionId = action.getId();
         new CoordActionStartXCommand(actionId, getTestUser(), "myapp", 
"myjob").call();
 
-        final JPAService jpaService = Services.get().get(JPAService.class);
-        action = jpaService.execute(new CoordActionGetJPAExecutor(actionId));
+        action = getCoordinatorAction(actionId);
 
         if (action.getStatus() == CoordinatorAction.Status.SUBMITTED) {
             fail("CoordActionStartCommand didn't work because the status for 
action id" + actionId + " is :"

http://git-wip-us.apache.org/repos/asf/oozie/blob/6ea1ed83/core/src/test/java/org/apache/oozie/command/coord/TestFutureActionsTimeOut.java
----------------------------------------------------------------------
diff --git 
a/core/src/test/java/org/apache/oozie/command/coord/TestFutureActionsTimeOut.java
 
b/core/src/test/java/org/apache/oozie/command/coord/TestFutureActionsTimeOut.java
index 801207b..a6fce4e 100644
--- 
a/core/src/test/java/org/apache/oozie/command/coord/TestFutureActionsTimeOut.java
+++ 
b/core/src/test/java/org/apache/oozie/command/coord/TestFutureActionsTimeOut.java
@@ -36,9 +36,9 @@ import org.apache.oozie.CoordinatorJobBean;
 import org.apache.oozie.client.CoordinatorAction;
 import org.apache.oozie.client.CoordinatorJob;
 import org.apache.oozie.client.OozieClient;
+import org.apache.oozie.executor.jpa.CoordJobQueryExecutor;
+import org.apache.oozie.executor.jpa.JPAExecutorException;
 import org.apache.oozie.service.Services;
-import org.apache.oozie.service.StoreService;
-import org.apache.oozie.store.CoordinatorStore;
 import org.apache.oozie.store.StoreException;
 import org.apache.oozie.test.XTestCase;
 import org.apache.oozie.util.XConfiguration;
@@ -133,12 +133,11 @@ public class TestFutureActionsTimeOut extends XTestCase {
      * @throws StoreException
      */
     private void checkCoordJob(String jobId) throws StoreException {
-        CoordinatorStore store = Services.get().get(StoreService.class)
-                .getStore(CoordinatorStore.class);
+        CoordinatorJobBean coordJob = null;
         try {
-            CoordinatorJobBean job = store.getCoordinatorJob(jobId, false);
+            coordJob = 
CoordJobQueryExecutor.getInstance().get(CoordJobQueryExecutor.CoordJobQuery.GET_COORD_JOB,
 jobId);
         }
-        catch (StoreException se) {
+        catch (JPAExecutorException e) {
             fail("Job ID " + jobId + " was not stored properly in db");
         }
     }

http://git-wip-us.apache.org/repos/asf/oozie/blob/6ea1ed83/core/src/test/java/org/apache/oozie/command/coord/TestPastActionsTimeOut.java
----------------------------------------------------------------------
diff --git 
a/core/src/test/java/org/apache/oozie/command/coord/TestPastActionsTimeOut.java 
b/core/src/test/java/org/apache/oozie/command/coord/TestPastActionsTimeOut.java
index 708dcaf..f4327ae 100644
--- 
a/core/src/test/java/org/apache/oozie/command/coord/TestPastActionsTimeOut.java
+++ 
b/core/src/test/java/org/apache/oozie/command/coord/TestPastActionsTimeOut.java
@@ -32,9 +32,9 @@ import org.apache.oozie.CoordinatorActionBean;
 import org.apache.oozie.CoordinatorEngine;
 import org.apache.oozie.CoordinatorJobBean;
 import org.apache.oozie.client.OozieClient;
+import org.apache.oozie.executor.jpa.CoordJobQueryExecutor;
+import org.apache.oozie.executor.jpa.JPAExecutorException;
 import org.apache.oozie.service.Services;
-import org.apache.oozie.service.StoreService;
-import org.apache.oozie.store.CoordinatorStore;
 import org.apache.oozie.store.StoreException;
 import org.apache.oozie.test.XTestCase;
 import org.apache.oozie.util.XConfiguration;
@@ -98,11 +98,11 @@ public class TestPastActionsTimeOut extends XTestCase {
      * @throws StoreException
      */
     private void checkCoordJob(String jobId) throws StoreException {
-        CoordinatorStore store = 
Services.get().get(StoreService.class).getStore(CoordinatorStore.class);
         try {
-            CoordinatorJobBean job = store.getCoordinatorJob(jobId, false);
+            CoordinatorJobBean job = CoordJobQueryExecutor.getInstance()
+                    .get(CoordJobQueryExecutor.CoordJobQuery.GET_COORD_JOB, 
jobId);
         }
-        catch (StoreException se) {
+        catch (JPAExecutorException se) {
             fail("Job ID " + jobId + " was not stored properly in db");
         }
     }

http://git-wip-us.apache.org/repos/asf/oozie/blob/6ea1ed83/core/src/test/java/org/apache/oozie/service/TestRecoveryService.java
----------------------------------------------------------------------
diff --git 
a/core/src/test/java/org/apache/oozie/service/TestRecoveryService.java 
b/core/src/test/java/org/apache/oozie/service/TestRecoveryService.java
index 9f8e65f..c6ecd76 100644
--- a/core/src/test/java/org/apache/oozie/service/TestRecoveryService.java
+++ b/core/src/test/java/org/apache/oozie/service/TestRecoveryService.java
@@ -60,8 +60,6 @@ import 
org.apache.oozie.executor.jpa.WorkflowActionQueryExecutor;
 import org.apache.oozie.executor.jpa.WorkflowJobGetJPAExecutor;
 import 
org.apache.oozie.executor.jpa.WorkflowActionQueryExecutor.WorkflowActionQuery;
 import org.apache.oozie.service.RecoveryService.RecoveryRunnable;
-import org.apache.oozie.store.CoordinatorStore;
-import org.apache.oozie.store.StoreException;
 import org.apache.oozie.store.WorkflowStore;
 import org.apache.oozie.test.XDataTestCase;
 import org.apache.oozie.util.DateUtils;
@@ -270,18 +268,10 @@ public class TestRecoveryService extends XDataTestCase {
      * @throws Exception
      */
     public void testBundleRecoveryCoordCreate() throws Exception {
-        CoordinatorStore store = 
Services.get().get(StoreService.class).getStore(CoordinatorStore.class);
         final BundleActionBean bundleAction;
         final BundleJobBean bundle;
-        store.beginTrx();
-        try {
-            bundle = addRecordToBundleJobTable(Job.Status.RUNNING, false);
-            bundleAction = addRecordToBundleActionTable(bundle.getId(), 
"coord1", 1, Job.Status.PREP);
-            store.commitTrx();
-        }
-        finally {
-            store.closeTrx();
-        }
+        bundle = addRecordToBundleJobTable(Job.Status.RUNNING, false);
+        bundleAction = addRecordToBundleActionTable(bundle.getId(), "coord1", 
1, Job.Status.PREP);
         final JPAService jpaService = Services.get().get(JPAService.class);
 
         sleep(3000);
@@ -319,20 +309,12 @@ public class TestRecoveryService extends XDataTestCase {
      * @throws Exception
      */
     public void testBundleRecoveryCoordExists() throws Exception {
-        CoordinatorStore store = 
Services.get().get(StoreService.class).getStore(CoordinatorStore.class);
         final BundleActionBean bundleAction;
         final BundleJobBean bundle;
         final CoordinatorJob coord;
-        store.beginTrx();
-        try {
-            bundle = addRecordToBundleJobTable(Job.Status.RUNNING, false);
-            coord = addRecordToCoordJobTable(Job.Status.PREP, false, false);
-            bundleAction = addRecordToBundleActionTable(bundle.getId(), 
coord.getId(), "coord1", 1, Job.Status.PREP);
-            store.commitTrx();
-        }
-        finally {
-            store.closeTrx();
-        }
+        bundle = addRecordToBundleJobTable(Job.Status.RUNNING, false);
+        coord = addRecordToCoordJobTable(Job.Status.PREP, false, false);
+        bundleAction = addRecordToBundleActionTable(bundle.getId(), 
coord.getId(), "coord1", 1, Job.Status.PREP);
         final JPAService jpaService = Services.get().get(JPAService.class);
 
         sleep(3000);
@@ -362,20 +344,12 @@ public class TestRecoveryService extends XDataTestCase {
         final int actionNum = 1;
         final String actionId = jobId + "@" + actionNum;
         final CoordinatorEngine ce = new CoordinatorEngine(getTestUser());
-        CoordinatorStore store = 
Services.get().get(StoreService.class).getStore(CoordinatorStore.class);
-        store.beginTrx();
-        try {
-            createTestCaseSubDir("one-op");
-            createTestCaseSubDir("one-op", "lib");
-            createTestCaseSubDir("workflows");
-            createTestCaseSubDir("in");
-            addRecordToJobTable(jobId, store, getTestCaseDir());
-            addRecordToActionTable(jobId, actionNum, actionId, store, 
getTestCaseDir());
-            store.commitTrx();
-        }
-        finally {
-            store.closeTrx();
-        }
+        createTestCaseSubDir("one-op");
+        createTestCaseSubDir("one-op", "lib");
+        createTestCaseSubDir("workflows");
+        createTestCaseSubDir("in");
+        addRecordToJobTable(jobId, getTestCaseDir());
+        addRecordToActionTable(jobId, actionNum, actionId, getTestCaseDir());
 
         sleep(3000);
         Runnable recoveryRunnable = new RecoveryRunnable(0, 1,1);
@@ -388,9 +362,7 @@ public class TestRecoveryService extends XDataTestCase {
             }
         });
 
-        CoordinatorStore store2 = 
Services.get().get(StoreService.class).getStore(CoordinatorStore.class);
-        store2.beginTrx();
-        CoordinatorActionBean action = store2.getCoordinatorAction(actionId, 
false);
+        CoordinatorActionBean action = getCoordinatorAction(actionId);
         if (action.getStatus() == CoordinatorAction.Status.RUNNING
                 || action.getStatus() == CoordinatorAction.Status.SUCCEEDED) {
 
@@ -398,8 +370,6 @@ public class TestRecoveryService extends XDataTestCase {
         else {
             fail();
         }
-        store2.commitTrx();
-        store2.closeTrx();
     }
 
     /**
@@ -664,7 +634,8 @@ public class TestRecoveryService extends XDataTestCase {
         }
     }
 
-    private void addRecordToActionTable(String jobId, int actionNum, String 
actionId, CoordinatorStore store, String baseDir) throws StoreException, 
IOException {
+    private void addRecordToActionTable(String jobId, int actionNum, String 
actionId, String baseDir)
+            throws Exception {
         CoordinatorActionBean action = new CoordinatorActionBean();
         action.setJobId(jobId);
         action.setId(actionId);
@@ -730,7 +701,7 @@ public class TestRecoveryService extends XDataTestCase {
         createdConf = conf.toXmlString(false);
 
         action.setCreatedConf(createdConf);
-        store.insertCoordinatorAction(action);
+        addRecordToCoordActionTable(action, null);
         String content = "<workflow-app xmlns='uri:oozie:workflow:0.1'  
xmlns:sla='uri:oozie:sla:0.1' name='one-op-wf'>";
         content += "<start to='fs1'/><action name='fs1'><fs><mkdir 
path='/tmp'/></fs><ok to='end'/><error to='end'/></action>";
         content += "<end name='end' /></workflow-app>";
@@ -761,7 +732,7 @@ public class TestRecoveryService extends XDataTestCase {
         new File(dir, "_SUCCESS").mkdirs();
     }
 
-    private void addRecordToJobTable(String jobId, CoordinatorStore store, 
String baseDir) throws StoreException {
+    private void addRecordToJobTable(String jobId, String baseDir) throws 
Exception {
         CoordinatorJobBean coordJob = new CoordinatorJobBean();
         coordJob.setId(jobId);
         coordJob.setAppName("testApp");
@@ -829,11 +800,10 @@ public class TestRecoveryService extends XDataTestCase {
         }
 
         try {
-            store.insertCoordinatorJob(coordJob);
+            addRecordToCoordJobTable(coordJob);
         }
-        catch (StoreException se) {
+        catch (Exception se) {
             se.printStackTrace();
-            store.rollbackTrx();
             fail("Unable to insert the test job record to table");
             throw se;
         }

http://git-wip-us.apache.org/repos/asf/oozie/blob/6ea1ed83/core/src/test/java/org/apache/oozie/store/TestCoordinatorStore.java
----------------------------------------------------------------------
diff --git 
a/core/src/test/java/org/apache/oozie/store/TestCoordinatorStore.java 
b/core/src/test/java/org/apache/oozie/store/TestCoordinatorStore.java
deleted file mode 100644
index b8b2405..0000000
--- a/core/src/test/java/org/apache/oozie/store/TestCoordinatorStore.java
+++ /dev/null
@@ -1,403 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.oozie.store;
-
-import java.util.Date;
-import java.util.List;
-
-import org.apache.oozie.CoordinatorActionBean;
-import org.apache.oozie.CoordinatorJobBean;
-import org.apache.oozie.client.CoordinatorAction;
-import org.apache.oozie.client.CoordinatorJob;
-import org.apache.oozie.client.CoordinatorAction.Status;
-import org.apache.oozie.service.CoordinatorStoreService;
-import org.apache.oozie.service.Services;
-import org.apache.oozie.test.XTestCase;
-
-public class TestCoordinatorStore extends XTestCase {
-    Services services;
-    CoordinatorStore store;
-    CoordinatorJobBean coordBean;
-
-    @Override
-    protected void setUp() throws Exception {
-        super.setUp();
-        services = new Services();
-        services.init();
-        store = Services.get().get(CoordinatorStoreService.class).create();
-    }
-
-    @Override
-    protected void tearDown() throws Exception {
-        // dropSchema(dbName, conn);
-        services.destroy();
-        super.tearDown();
-    }
-
-    public void testCoordStore() throws StoreException {
-        String jobId = "00000-" + new Date().getTime() + 
"-TestCoordinatorStore-C";
-        String actionId = jobId + "_1";
-        try {
-            _testInsertJob(jobId);
-            _testGetJob(jobId);
-            _testGetMatJobLists();
-            _testUpdateCoordJob(jobId);
-            _testInsertAction(jobId, actionId);
-            _testGetAction(jobId, actionId);
-            _testGetActionForJob(jobId, actionId);
-            _testGetActionForJobInExecOrder(jobId, actionId);
-            _testGetActionForJobInLastOnly(jobId, actionId);
-            _testGetActionRunningCount(actionId);
-            _testGetRecoveryActionsGroupByJobId(jobId);
-            _testUpdateCoordAction(actionId);
-            _testUpdateCoordActionMin(actionId);
-        }
-        finally {
-            // store.closeTrx();
-        }
-    }
-
-    private void _testUpdateCoordAction(String actionId) {
-        store.beginTrx();
-        try {
-            CoordinatorActionBean action = 
store.getCoordinatorAction(actionId, true);
-            int newActNum = action.getActionNumber() + 1;
-            action.setActionNumber(newActNum);
-            store.updateCoordinatorAction(action);
-            store.getEntityManager().flush();
-            store.getEntityManager().merge(action);
-            action = store.getCoordinatorAction(actionId, false);
-            assertEquals(newActNum, action.getActionNumber());
-            store.commitTrx();
-        }
-        catch (Exception ex) {
-            store.rollbackTrx();
-            ex.printStackTrace();
-            fail("Unable to Update a record in Coord Action. actionId =" + 
actionId);
-        }
-
-    }
-
-    private void _testUpdateCoordActionMin(String actionId) {
-        store.beginTrx();
-        try {
-            CoordinatorActionBean action = 
store.getCoordinatorAction(actionId, true);
-            action.setStatus(CoordinatorAction.Status.SUCCEEDED);
-            action.setMissingDependencies("d1,d2,d3");
-            action.setActionNumber(777);
-            Date lastModifiedTime = new Date();
-            action.setLastModifiedTime(lastModifiedTime);
-            store.updateCoordActionMin(action);
-            store.commitTrx();
-            //store.getEntityManager().merge(action);
-            action = getCoordAction(actionId);
-            assertEquals(CoordinatorAction.Status.SUCCEEDED, 
action.getStatus());
-            assertEquals("d1,d2,d3", action.getMissingDependencies());
-            //assertEquals(lastModifiedTime, action.getLastModifiedTime());
-            if (action.getActionNumber() == 777) {
-                fail("Action number should not be updated");
-            }
-        }
-        catch (Exception ex) {
-            if (store.isActive()) {
-                store.rollbackTrx();
-            }
-            ex.printStackTrace();
-            fail("Unable to Update a record in Coord Action. actionId =" + 
actionId);
-        }
-
-    }
-
-    private void _testGetActionRunningCount(String actionId) {
-        store.beginTrx();
-        try {
-            int count = store.getCoordinatorRunningActionsCount(actionId);
-            assertEquals(count, 0);
-            store.commitTrx();
-        }
-        catch (Exception ex) {
-            store.rollbackTrx();
-            ex.printStackTrace();
-            fail("Unable to GET count for action ID. actionId =" + actionId);
-        }
-    }
-
-
-    private void _testGetActionForJobInExecOrder(String jobId, String 
actionId) {
-        store.beginTrx();
-        try {
-            List<CoordinatorActionBean> actionList = 
store.getCoordinatorActionsForJob(jobId, 1,
-                                                                               
        CoordinatorJob.Execution.FIFO.toString());
-            assertEquals(actionList.size(), 1);
-            store.commitTrx();
-        }
-        catch (Exception ex) {
-            store.rollbackTrx();
-            ex.printStackTrace();
-            fail("Unable to GET a record for COORD Action_FOR_JOB with Exec 
Order. actionId =" + actionId + " jobId ="
-                    + jobId);
-        }
-    }
-
-    private void _testGetActionForJobInLastOnly(String jobId, String actionId) 
{
-        store.beginTrx();
-        try {
-            List<CoordinatorActionBean> actionList = 
store.getCoordinatorActionsForJob(jobId, 3,
-                                                                               
        CoordinatorJob.Execution.LAST_ONLY.toString());
-            assertEquals(actionList.size(), 1);
-            store.commitTrx();
-        }
-        catch (Exception ex) {
-            store.rollbackTrx();
-            ex.printStackTrace();
-            fail("Unable to GET a record for COORD Action_FOR_JOB with Exec 
Order. actionId =" + actionId + " jobId ="
-                    + jobId);
-        }
-    }
-
-    private void _testGetActionForJob(String jobId, String actionId) {
-        store.beginTrx();
-        try {
-            int coordActionsCount = store.getActionsForCoordinatorJob(jobId, 
false);
-            assertEquals(coordActionsCount, 1);
-            store.commitTrx();
-        }
-        catch (Exception ex) {
-            store.rollbackTrx();
-            ex.printStackTrace();
-            fail("Unable to GET a record for COORD Action_FOR_JOB. actionId =" 
+ actionId + " jobId =" + jobId);
-        }
-    }
-
-    private void _testGetAction(String jobId, String actionId) throws 
StoreException {
-        store.beginTrx();
-        try {
-            CoordinatorActionBean action = 
store.getCoordinatorAction(actionId, false);
-            assertEquals(jobId, action.getJobId());
-            assertEquals(action.getStatus(), CoordinatorAction.Status.READY);
-            assertEquals(action.getActionNumber(), 1);
-            assertEquals(action.getExternalId(), actionId + "_E");
-            store.commitTrx();
-        }
-        catch (Exception ex) {
-            store.rollbackTrx();
-            ex.printStackTrace();
-            fail("Unable to GET a record for COORD Action. actionId =" + 
actionId);
-        }
-    }
-
-    private void _testGetRecoveryActionsGroupByJobId(String jobId) throws 
StoreException {
-        store.beginTrx();
-        try {
-            List<String> jobids = store.getRecoveryActionsGroupByJobId(60);
-            assertNotNull(jobids);
-            assertEquals(jobId, jobids.get(0));
-            store.commitTrx();
-        }
-        catch (Exception ex) {
-            store.rollbackTrx();
-            ex.printStackTrace();
-            fail("Unable to GET a record for RecoveryActionsGroupByJobId. 
jobId =" + jobId);
-        }
-    }
-
-    private void _testInsertAction(String jobId, String actionId) {
-        CoordinatorActionBean action = createAction(jobId, actionId);
-    }
-
-    private CoordinatorActionBean createAction(String jobId, String actionId) {
-        CoordinatorActionBean action = new CoordinatorActionBean();
-        action.setJobId(jobId);
-        action.setId(actionId);
-        action.setActionNumber(1);
-        action.setNominalTime(new Date());
-        action.setStatus(Status.READY);
-        action.setExternalId(actionId + "_E");
-        action.setLastModifiedTime(new Date(new Date().getTime() - 1200000));
-        store.beginTrx();
-        try {
-            store.insertCoordinatorAction(action);
-            store.commitTrx();
-        }
-        catch (Exception ex) {
-            store.rollbackTrx();
-            ex.printStackTrace();
-            fail("Unable to insert a record into COORD Action ");
-        }
-        return action;
-    }
-
-    private void _testUpdateCoordJob(String jobId) {
-        store.beginTrx();
-        try {
-            CoordinatorJobBean job = store.getCoordinatorJob(jobId, false);
-            int newFreq = Integer.valueOf(job.getFrequency()) + 1;
-            job.setFrequency(Integer.toString(newFreq));
-            store.updateCoordinatorJob(job);
-            store.getEntityManager().flush();
-            store.getEntityManager().merge(job);
-            job = store.getCoordinatorJob(jobId, false);
-            assertEquals(Integer.toString(newFreq), job.getFrequency());
-            store.commitTrx();
-        }
-        catch (Exception ex) {
-            store.rollbackTrx();
-            ex.printStackTrace();
-            fail("Unable to UPDATE a record for COORD Job. jobId =" + jobId);
-        }
-
-    }
-
-    private void _testGetMatJobLists() throws StoreException {
-        store.beginTrx();
-        try {
-            Date d1 = new Date();
-            Date d2 = new Date(d1.getTime() + 1000);
-            List<CoordinatorJobBean> jobList = 
store.getCoordinatorJobsToBeMaterialized(d2, 50);
-            if (jobList.size() == 0) {
-                fail("Test of getCoordinatorJobsToBeMaterialized returned no 
records. Date =" + d2);
-            }
-            // Assumption: no other older records are there
-            d2 = new Date(d1.getTime() - 86400000L * 365L);
-            jobList = store.getCoordinatorJobsToBeMaterialized(d2, 50);
-            /*
-             * if(jobList.size() > 0){ fail("Test of
-             * getCoordinatorJobsToBeMaterialized returned some records while
-             * expecting no records = " + d2); }
-             */
-            store.commitTrx();
-        }
-        catch (Exception ex) {
-            store.rollbackTrx();
-            ex.printStackTrace();
-            fail("Unable to Get Materialized Jobs ");
-        }
-    }
-
-    private void _testGetJob(String jobId) throws StoreException {
-        store.beginTrx();
-        try {
-            CoordinatorJobBean job = store.getCoordinatorJob(jobId, false);
-            assertEquals(jobId, job.getId());
-            assertEquals(job.getStatus(), CoordinatorJob.Status.PREP);
-            store.commitTrx();
-        }
-        catch (Exception ex) {
-            store.rollbackTrx();
-            ex.printStackTrace();
-            fail("Unable to GET a record for COORD Job. jobId =" + jobId);
-        }
-    }
-
-    private void _testInsertJob(String jobId) throws StoreException {
-        CoordinatorJobBean job = createCoordJob(jobId);
-        store.beginTrx();
-        try {
-            store.insertCoordinatorJob(job);
-            store.commitTrx();
-        }
-        catch (Exception ex) {
-            store.rollbackTrx();
-            ex.printStackTrace();
-            fail("Unable to insert a record into COORD Job ");
-        }
-    }
-
-    private CoordinatorJobBean createCoordJob(String jobId) {
-        CoordinatorJobBean coordJob = new CoordinatorJobBean();
-
-        coordJob.setId(jobId);
-        coordJob.setAppName("testApp");
-        coordJob.setAppPath("testAppPath");
-        coordJob.setStatus(CoordinatorJob.Status.PREP);
-        coordJob.setCreatedTime(new Date());
-        coordJob.setUser("testUser");
-        coordJob.setGroup("testGroup");
-        String confStr = "<configuration></configuration>";
-        coordJob.setConf(confStr);
-        String appXml = "<coordinator-app xmlns='uri:oozie:coordinator:0.1' 
name='NAME' frequency=\"1\" start='2009-02-01T01:00Z' end='2009-02-03T23:59Z' 
timezone='UTC' freq_timeunit='DAY' end_of_duration='NONE'>";
-        appXml += "<controls>";
-        appXml += "<timeout>10</timeout>";
-        appXml += "<concurrency>2</concurrency>";
-        appXml += "<execution>LIFO</execution>";
-        appXml += "</controls>";
-        appXml += "<input-events>";
-        appXml += "<data-in name='A' dataset='a'>";
-        appXml += "<dataset name='a' frequency='7' 
initial-instance='2009-02-01T01:00Z' timezone='UTC' freq_timeunit='DAY' 
end_of_duration='NONE'>";
-        appXml += 
"<uri-template>file:///tmp/coord/workflows/${YEAR}/${DAY}</uri-template>";
-        appXml += "</dataset>";
-        appXml += "<instance>${coord:latest(0)}</instance>";
-        appXml += "</data-in>";
-        appXml += "</input-events>";
-        appXml += "<output-events>";
-        appXml += "<data-out name='LOCAL_A' dataset='local_a'>";
-        appXml += "<dataset name='local_a' frequency='7' 
initial-instance='2009-02-01T01:00Z' timezone='UTC' freq_timeunit='DAY' 
end_of_duration='NONE'>";
-        appXml += 
"<uri-template>file:///tmp/coord/workflows/${YEAR}/${DAY}</uri-template>";
-        appXml += "</dataset>";
-        appXml += "<instance>${coord:current(-1)}</instance>";
-        appXml += "</data-out>";
-        appXml += "</output-events>";
-        appXml += "<action>";
-        appXml += "<workflow>";
-        appXml += "<app-path>hdfs:///tmp/workflows/</app-path>";
-        appXml += "<configuration>";
-        appXml += "<property>";
-        appXml += "<name>inputA</name>";
-        appXml += "<value>${coord:dataIn('A')}</value>";
-        appXml += "</property>";
-        appXml += "<property>";
-        appXml += "<name>inputB</name>";
-        appXml += "<value>${coord:dataOut('LOCAL_A')}</value>";
-        appXml += "</property>";
-        appXml += "</configuration>";
-        appXml += "</workflow>";
-        appXml += "</action>";
-        appXml += "</coordinator-app>";
-        coordJob.setJobXml(appXml);
-        coordJob.setLastActionNumber(0);
-        coordJob.setFrequency("1");
-        Date curr = new Date();
-        coordJob.setNextMaterializedTime(curr);
-        coordJob.setLastModifiedTime(curr);
-        coordJob.setEndTime(new Date(curr.getTime() + 86400000));
-        coordJob.setStartTime(new Date(curr.getTime() - 86400000));
-        return coordJob;
-    }
-
-    /**
-     * Helper methods
-     *
-     * @param jobId
-     * @throws StoreException
-     */
-    private CoordinatorActionBean getCoordAction(String actionId) throws 
StoreException {
-        CoordinatorStore store = new CoordinatorStore(false);
-        try {
-            CoordinatorActionBean action = 
store.getCoordinatorAction(actionId, false);
-            return action;
-        }
-        catch (StoreException se) {
-            fail("Job ID " + actionId + " was not stored properly in db");
-        }finally {
-            store.closeTrx();
-        }
-        return null;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/oozie/blob/6ea1ed83/core/src/test/java/org/apache/oozie/test/XDataTestCase.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/oozie/test/XDataTestCase.java 
b/core/src/test/java/org/apache/oozie/test/XDataTestCase.java
index e885892..ac8f1f9 100644
--- a/core/src/test/java/org/apache/oozie/test/XDataTestCase.java
+++ b/core/src/test/java/org/apache/oozie/test/XDataTestCase.java
@@ -633,6 +633,50 @@ public abstract class XDataTestCase extends XHCatTestCase {
         return action;
     }
 
+    protected CoordinatorActionBean 
addRecordToCoordActionTable(CoordinatorActionBean action, String wfId)
+            throws Exception {
+        try {
+            JPAService jpaService = Services.get().get(JPAService.class);
+            assertNotNull(jpaService);
+            CoordActionInsertJPAExecutor coordActionInsertExecutor = new 
CoordActionInsertJPAExecutor(action);
+            jpaService.execute(coordActionInsertExecutor);
+
+            if (wfId != null) {
+                WorkflowJobBean wfJob = jpaService.execute(new 
WorkflowJobGetJPAExecutor(wfId));
+                wfJob.setParentId(action.getId());
+                
WorkflowJobQueryExecutor.getInstance().executeUpdate(WorkflowJobQuery.UPDATE_WORKFLOW_PARENT_MODIFIED,
 wfJob);
+            }
+        }
+        catch (JPAExecutorException je) {
+            je.printStackTrace();
+            fail("Unable to insert the test coord action record to table");
+            throw je;
+        }
+        return action;
+    }
+
+    protected CoordinatorJobBean getCoordinatorJob(String jobId) throws 
Exception{
+        CoordinatorJobBean coordJob = null;
+        try {
+            coordJob = 
CoordJobQueryExecutor.getInstance().get(CoordJobQueryExecutor.CoordJobQuery.GET_COORD_JOB,
 jobId);
+        }
+        catch (JPAExecutorException e) {
+            throw new Exception(e);
+        }
+        return coordJob;
+    }
+
+    protected CoordinatorActionBean getCoordinatorAction(String actionId) 
throws Exception{
+        CoordinatorActionBean cAction = null;
+        try {
+            cAction = 
CoordActionQueryExecutor.getInstance().get(CoordActionQuery.GET_COORD_ACTION, 
actionId);
+        }
+        catch (JPAExecutorException e) {
+            throw new Exception(e);
+        }
+        return cAction;
+    }
+
     protected CoordinatorActionBean createCoordAction(String jobId, int 
actionNum, CoordinatorAction.Status status,
             String resourceXmlName, int pending) throws Exception {
         return createCoordAction(jobId, actionNum, status, resourceXmlName, 
pending, "Z", null);

http://git-wip-us.apache.org/repos/asf/oozie/blob/6ea1ed83/core/src/test/java/org/apache/oozie/test/XTestCase.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/oozie/test/XTestCase.java 
b/core/src/test/java/org/apache/oozie/test/XTestCase.java
index 27cbdc9..e360369 100644
--- a/core/src/test/java/org/apache/oozie/test/XTestCase.java
+++ b/core/src/test/java/org/apache/oozie/test/XTestCase.java
@@ -38,6 +38,7 @@ import java.util.concurrent.atomic.AtomicInteger;
 import java.util.concurrent.atomic.AtomicLong;
 
 import javax.persistence.EntityManager;
+import javax.persistence.FlushModeType;
 import javax.persistence.Query;
 
 import junit.framework.TestCase;
@@ -78,7 +79,6 @@ import org.apache.oozie.service.StoreService;
 import org.apache.oozie.service.URIHandlerService;
 import org.apache.oozie.sla.SLARegistrationBean;
 import org.apache.oozie.sla.SLASummaryBean;
-import org.apache.oozie.store.CoordinatorStore;
 import org.apache.oozie.store.StoreException;
 import org.apache.oozie.test.MiniHCatServer.RUNMODE;
 import org.apache.oozie.test.hive.MiniHS2;
@@ -794,9 +794,9 @@ public abstract class XTestCase extends TestCase {
     }
 
     private void cleanUpDBTablesInternal() throws StoreException {
-        CoordinatorStore store = new CoordinatorStore(false);
-        EntityManager entityManager = store.getEntityManager();
-        store.beginTrx();
+        EntityManager entityManager = 
Services.get().get(JPAService.class).getEntityManager();
+        entityManager.setFlushMode(FlushModeType.COMMIT);
+        entityManager.getTransaction().begin();
 
         Query q = entityManager.createNamedQuery("GET_WORKFLOWS");
         List<WorkflowJobBean> wfjBeans = q.getResultList();
@@ -861,8 +861,8 @@ public abstract class XTestCase extends TestCase {
             entityManager.remove(w);
         }
 
-        store.commitTrx();
-        store.closeTrx();
+        entityManager.getTransaction().commit();
+        entityManager.close();
         log.info(wfjSize + " entries in WF_JOBS removed from DB!");
         log.info(wfaSize + " entries in WF_ACTIONS removed from DB!");
         log.info(cojSize + " entries in COORD_JOBS removed from DB!");

http://git-wip-us.apache.org/repos/asf/oozie/blob/6ea1ed83/release-log.txt
----------------------------------------------------------------------
diff --git a/release-log.txt b/release-log.txt
index 096bd4f..7e85b2c 100644
--- a/release-log.txt
+++ b/release-log.txt
@@ -1,5 +1,6 @@
 -- Oozie 4.2.0 release (trunk - unreleased)
 
+OOZIE-2163 Remove CoordinatorStore (seoeun25 via bzhang)
 OOZIE-2221 Oozie audit log has null id for some of input request (puru)
 OOZIE-2223 Improve documentation with regard to Java action retries 
(ben.roling via bzhang)
 OOZIE-2218 META-INF directories in the war file have 777 permissions (rkanter)

Reply via email to