oozie-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From m...@apache.org
Subject git commit: OOZIE-1811 Current test failures in trunk (mona)
Date Fri, 01 Aug 2014 17:57:03 GMT
Repository: oozie
Updated Branches:
  refs/heads/master 3ddd8249c -> 0d42b8dbb


OOZIE-1811 Current test failures in trunk (mona)


Project: http://git-wip-us.apache.org/repos/asf/oozie/repo
Commit: http://git-wip-us.apache.org/repos/asf/oozie/commit/0d42b8db
Tree: http://git-wip-us.apache.org/repos/asf/oozie/tree/0d42b8db
Diff: http://git-wip-us.apache.org/repos/asf/oozie/diff/0d42b8db

Branch: refs/heads/master
Commit: 0d42b8dbb4c49b0a96a81dc0bd2415b6dc4c4d3c
Parents: 3ddd824
Author: mona <chitnis@yahoo-inc.com>
Authored: Fri Aug 1 10:56:52 2014 -0700
Committer: mona <chitnis@yahoo-inc.com>
Committed: Fri Aug 1 10:56:52 2014 -0700

----------------------------------------------------------------------
 .../oozie/executor/jpa/BatchQueryExecutor.java  | 18 +-----------
 .../executor/jpa/BundleActionQueryExecutor.java | 26 ++----------------
 .../executor/jpa/BundleJobQueryExecutor.java    | 23 ++--------------
 .../executor/jpa/CoordActionQueryExecutor.java  | 29 ++------------------
 .../executor/jpa/CoordJobQueryExecutor.java     | 23 ++--------------
 .../jpa/SLARegistrationQueryExecutor.java       | 21 ++------------
 .../executor/jpa/SLASummaryQueryExecutor.java   | 23 +++-------------
 .../jpa/WorkflowActionQueryExecutor.java        | 23 ++--------------
 .../executor/jpa/WorkflowJobQueryExecutor.java  | 23 ++--------------
 .../TestCoordActionInputCheckXCommand.java      |  1 +
 .../oozie/sla/TestSLAEventGeneration.java       |  8 +++---
 .../java/org/apache/oozie/test/XTestCase.java   | 24 +---------------
 core/src/test/resources/coord-action-sla.xml    | 12 +++++++-
 release-log.txt                                 |  1 +
 14 files changed, 44 insertions(+), 211 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/oozie/blob/0d42b8db/core/src/main/java/org/apache/oozie/executor/jpa/BatchQueryExecutor.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/oozie/executor/jpa/BatchQueryExecutor.java b/core/src/main/java/org/apache/oozie/executor/jpa/BatchQueryExecutor.java
index 180ea6b..acf6031 100644
--- a/core/src/main/java/org/apache/oozie/executor/jpa/BatchQueryExecutor.java
+++ b/core/src/main/java/org/apache/oozie/executor/jpa/BatchQueryExecutor.java
@@ -45,8 +45,6 @@ import org.apache.oozie.service.Services;
 import org.apache.oozie.sla.SLARegistrationBean;
 import org.apache.oozie.sla.SLASummaryBean;
 
-import com.google.common.annotations.VisibleForTesting;
-
 /**
  * Query Executor that provides API to run multiple update/insert queries in one
  * transaction. This guarantees entire change to be rolled back when one of
@@ -55,7 +53,6 @@ import com.google.common.annotations.VisibleForTesting;
 public class BatchQueryExecutor {
 
     private static BatchQueryExecutor instance = new BatchQueryExecutor();
-    private static JPAService jpaService;
 
     public static class UpdateEntry<E extends Enum<E>> {
         E namedQuery;
@@ -76,16 +73,9 @@ public class BatchQueryExecutor {
     }
 
     private BatchQueryExecutor() {
-        Services services = Services.get();
-        if (services != null) {
-            jpaService = services.get(JPAService.class);
-        }
     }
 
     public static BatchQueryExecutor getInstance() {
-        if (instance == null) {
-            instance = new BatchQueryExecutor();
-        }
         return BatchQueryExecutor.instance;
     }
 
@@ -93,6 +83,7 @@ public class BatchQueryExecutor {
     public void executeBatchInsertUpdateDelete(Collection<JsonBean> insertList, Collection<UpdateEntry>
updateList,
             Collection<JsonBean> deleteList) throws JPAExecutorException {
         List<QueryEntry> queryList = new ArrayList<QueryEntry>();
+        JPAService jpaService = Services.get().get(JPAService.class);
         EntityManager em = jpaService.getEntityManager();
 
         if (updateList != null) {
@@ -140,11 +131,4 @@ public class BatchQueryExecutor {
         jpaService.executeBatchInsertUpdateDelete(insertList, queryList, deleteList, em);
     }
 
-    @VisibleForTesting
-    public static void destroy() {
-        if (instance != null) {
-            jpaService = null;
-            instance = null;
-        }
-    }
 }

http://git-wip-us.apache.org/repos/asf/oozie/blob/0d42b8db/core/src/main/java/org/apache/oozie/executor/jpa/BundleActionQueryExecutor.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/oozie/executor/jpa/BundleActionQueryExecutor.java
b/core/src/main/java/org/apache/oozie/executor/jpa/BundleActionQueryExecutor.java
index 44f5d87..a6d8e8d 100644
--- a/core/src/main/java/org/apache/oozie/executor/jpa/BundleActionQueryExecutor.java
+++ b/core/src/main/java/org/apache/oozie/executor/jpa/BundleActionQueryExecutor.java
@@ -26,15 +26,10 @@ import javax.persistence.EntityManager;
 import javax.persistence.Query;
 
 import org.apache.oozie.BundleActionBean;
-import org.apache.oozie.CoordinatorActionBean;
 import org.apache.oozie.ErrorCode;
-import org.apache.oozie.WorkflowActionBean;
-import org.apache.oozie.executor.jpa.WorkflowActionQueryExecutor.WorkflowActionQuery;
 import org.apache.oozie.service.JPAService;
 import org.apache.oozie.service.Services;
 
-import com.google.common.annotations.VisibleForTesting;
-
 /**
  * Query Executor that provides API to run query for Bundle Action
  */
@@ -53,21 +48,11 @@ public class BundleActionQueryExecutor extends
     };
 
     private static BundleActionQueryExecutor instance = new BundleActionQueryExecutor();
-    private static JPAService jpaService;
 
     private BundleActionQueryExecutor() {
-        Services services = Services.get();
-        if (services != null) {
-            jpaService = services.get(JPAService.class);
-        }
     }
 
     public static QueryExecutor<BundleActionBean, BundleActionQueryExecutor.BundleActionQuery>
getInstance() {
-        if (instance == null) {
-            // It will not be null in normal execution. Required for testcase as
-            // they reinstantiate JPAService everytime
-            instance = new BundleActionQueryExecutor();
-        }
         return BundleActionQueryExecutor.instance;
     }
 
@@ -132,6 +117,7 @@ public class BundleActionQueryExecutor extends
 
     @Override
     public int executeUpdate(BundleActionQuery namedQuery, BundleActionBean jobBean) throws
JPAExecutorException {
+        JPAService jpaService = Services.get().get(JPAService.class);
         EntityManager em = jpaService.getEntityManager();
         Query query = getUpdateQuery(namedQuery, jobBean, em);
         int ret = jpaService.executeUpdate(namedQuery.name(), query, em);
@@ -140,6 +126,7 @@ public class BundleActionQueryExecutor extends
 
     @Override
     public BundleActionBean get(BundleActionQuery namedQuery, Object... parameters) throws
JPAExecutorException {
+        JPAService jpaService = Services.get().get(JPAService.class);
         EntityManager em = jpaService.getEntityManager();
         Query query = getSelectQuery(namedQuery, em, parameters);
         Object ret = jpaService.executeGet(namedQuery.name(), query, em);
@@ -188,6 +175,7 @@ public class BundleActionQueryExecutor extends
     @Override
     public List<BundleActionBean> getList(BundleActionQuery namedQuery, Object... parameters)
             throws JPAExecutorException {
+        JPAService jpaService = Services.get().get(JPAService.class);
         EntityManager em = jpaService.getEntityManager();
         Query query = getSelectQuery(namedQuery, em, parameters);
         List<?> retList = (List<?>) jpaService.executeGetList(namedQuery.name(),
query, em);
@@ -200,14 +188,6 @@ public class BundleActionQueryExecutor extends
         return beanList;
     }
 
-    @VisibleForTesting
-    public static void destroy() {
-        if (instance != null) {
-            jpaService = null;
-            instance = null;
-        }
-    }
-
     @Override
     public Object getSingleValue(BundleActionQuery namedQuery, Object... parameters) throws
JPAExecutorException {
         throw new UnsupportedOperationException();

http://git-wip-us.apache.org/repos/asf/oozie/blob/0d42b8db/core/src/main/java/org/apache/oozie/executor/jpa/BundleJobQueryExecutor.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/oozie/executor/jpa/BundleJobQueryExecutor.java
b/core/src/main/java/org/apache/oozie/executor/jpa/BundleJobQueryExecutor.java
index 36cd968..4f4b7bd 100644
--- a/core/src/main/java/org/apache/oozie/executor/jpa/BundleJobQueryExecutor.java
+++ b/core/src/main/java/org/apache/oozie/executor/jpa/BundleJobQueryExecutor.java
@@ -31,8 +31,6 @@ import org.apache.oozie.service.JPAService;
 import org.apache.oozie.service.Services;
 import org.apache.oozie.util.DateUtils;
 
-import com.google.common.annotations.VisibleForTesting;
-
 /**
  * Query Executor that provides API to run query for Bundle Job
  */
@@ -53,21 +51,11 @@ public class BundleJobQueryExecutor extends QueryExecutor<BundleJobBean,
BundleJ
     };
 
     private static BundleJobQueryExecutor instance = new BundleJobQueryExecutor();
-    private static JPAService jpaService;
 
     private BundleJobQueryExecutor() {
-        Services services = Services.get();
-        if (services != null) {
-            jpaService = services.get(JPAService.class);
-        }
     }
 
     public static QueryExecutor<BundleJobBean, BundleJobQueryExecutor.BundleJobQuery>
getInstance() {
-        if (instance == null) {
-            // It will not be null in normal execution. Required for testcase as
-            // they reinstantiate JPAService everytime
-            instance = new BundleJobQueryExecutor();
-        }
         return BundleJobQueryExecutor.instance;
     }
 
@@ -154,6 +142,7 @@ public class BundleJobQueryExecutor extends QueryExecutor<BundleJobBean,
BundleJ
 
     @Override
     public int executeUpdate(BundleJobQuery namedQuery, BundleJobBean jobBean) throws JPAExecutorException
{
+        JPAService jpaService = Services.get().get(JPAService.class);
         EntityManager em = jpaService.getEntityManager();
         Query query = getUpdateQuery(namedQuery, jobBean, em);
         int ret = jpaService.executeUpdate(namedQuery.name(), query, em);
@@ -162,6 +151,7 @@ public class BundleJobQueryExecutor extends QueryExecutor<BundleJobBean,
BundleJ
 
     @Override
     public BundleJobBean get(BundleJobQuery namedQuery, Object... parameters) throws JPAExecutorException
{
+        JPAService jpaService = Services.get().get(JPAService.class);
         EntityManager em = jpaService.getEntityManager();
         Query query = getSelectQuery(namedQuery, em, parameters);
         Object ret = jpaService.executeGet(namedQuery.name(), query, em);
@@ -174,6 +164,7 @@ public class BundleJobQueryExecutor extends QueryExecutor<BundleJobBean,
BundleJ
 
     @Override
     public List<BundleJobBean> getList(BundleJobQuery namedQuery, Object... parameters)
throws JPAExecutorException {
+        JPAService jpaService = Services.get().get(JPAService.class);
         EntityManager em = jpaService.getEntityManager();
         Query query = getSelectQuery(namedQuery, em, parameters);
         List<?> retList = (List<?>) jpaService.executeGetList(namedQuery.name(),
query, em);
@@ -221,14 +212,6 @@ public class BundleJobQueryExecutor extends QueryExecutor<BundleJobBean,
BundleJ
         return bean;
     }
 
-    @VisibleForTesting
-    public static void destroy() {
-        if (instance != null) {
-            jpaService = null;
-            instance = null;
-        }
-    }
-
     @Override
     public Object getSingleValue(BundleJobQuery namedQuery, Object... parameters) throws
JPAExecutorException {
         throw new UnsupportedOperationException();

http://git-wip-us.apache.org/repos/asf/oozie/blob/0d42b8db/core/src/main/java/org/apache/oozie/executor/jpa/CoordActionQueryExecutor.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/oozie/executor/jpa/CoordActionQueryExecutor.java
b/core/src/main/java/org/apache/oozie/executor/jpa/CoordActionQueryExecutor.java
index 3008393..cd26e07 100644
--- a/core/src/main/java/org/apache/oozie/executor/jpa/CoordActionQueryExecutor.java
+++ b/core/src/main/java/org/apache/oozie/executor/jpa/CoordActionQueryExecutor.java
@@ -25,18 +25,10 @@ import java.util.List;
 import javax.persistence.EntityManager;
 import javax.persistence.Query;
 
-import org.apache.oozie.BinaryBlob;
 import org.apache.oozie.CoordinatorActionBean;
 import org.apache.oozie.ErrorCode;
-import org.apache.oozie.StringBlob;
-import org.apache.oozie.WorkflowActionBean;
-import org.apache.oozie.WorkflowJobBean;
-import org.apache.oozie.executor.jpa.WorkflowJobQueryExecutor.WorkflowJobQuery;
 import org.apache.oozie.service.JPAService;
 import org.apache.oozie.service.Services;
-import org.apache.oozie.util.DateUtils;
-
-import com.google.common.annotations.VisibleForTesting;
 
 /**
  * Query Executor that provides API to run query for Coordinator Action
@@ -60,21 +52,11 @@ public class CoordActionQueryExecutor extends
     };
 
     private static CoordActionQueryExecutor instance = new CoordActionQueryExecutor();
-    private static JPAService jpaService;
 
     private CoordActionQueryExecutor() {
-        Services services = Services.get();
-        if (services != null) {
-            jpaService = services.get(JPAService.class);
-        }
     }
 
     public static QueryExecutor<CoordinatorActionBean, CoordActionQueryExecutor.CoordActionQuery>
getInstance() {
-        if (instance == null) {
-            // It will not be null in normal execution. Required for testcase as
-            // they reinstantiate JPAService everytime
-            instance = new CoordActionQueryExecutor();
-        }
         return CoordActionQueryExecutor.instance;
     }
 
@@ -196,6 +178,7 @@ public class CoordActionQueryExecutor extends
 
     @Override
     public int executeUpdate(CoordActionQuery namedQuery, CoordinatorActionBean jobBean)
throws JPAExecutorException {
+        JPAService jpaService = Services.get().get(JPAService.class);
         EntityManager em = jpaService.getEntityManager();
         Query query = getUpdateQuery(namedQuery, jobBean, em);
         int ret = jpaService.executeUpdate(namedQuery.name(), query, em);
@@ -204,6 +187,7 @@ public class CoordActionQueryExecutor extends
 
     @Override
     public CoordinatorActionBean get(CoordActionQuery namedQuery, Object... parameters) throws
JPAExecutorException {
+        JPAService jpaService = Services.get().get(JPAService.class);
         EntityManager em = jpaService.getEntityManager();
         Query query = getSelectQuery(namedQuery, em, parameters);
         Object ret = jpaService.executeGet(namedQuery.name(), query, em);
@@ -217,6 +201,7 @@ public class CoordActionQueryExecutor extends
     @Override
     public List<CoordinatorActionBean> getList(CoordActionQuery namedQuery, Object...
parameters)
             throws JPAExecutorException {
+        JPAService jpaService = Services.get().get(JPAService.class);
         EntityManager em = jpaService.getEntityManager();
         Query query = getSelectQuery(namedQuery, em, parameters);
         List<?> retList = (List<?>) jpaService.executeGetList(namedQuery.name(),
query, em);
@@ -251,14 +236,6 @@ public class CoordActionQueryExecutor extends
         return bean;
     }
 
-    @VisibleForTesting
-    public static void destroy() {
-        if (instance != null) {
-            jpaService = null;
-            instance = null;
-        }
-    }
-
     @Override
     public Object getSingleValue(CoordActionQuery namedQuery, Object... parameters) throws
JPAExecutorException {
         throw new UnsupportedOperationException();

http://git-wip-us.apache.org/repos/asf/oozie/blob/0d42b8db/core/src/main/java/org/apache/oozie/executor/jpa/CoordJobQueryExecutor.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/oozie/executor/jpa/CoordJobQueryExecutor.java b/core/src/main/java/org/apache/oozie/executor/jpa/CoordJobQueryExecutor.java
index 04e6e29..42a0968 100644
--- a/core/src/main/java/org/apache/oozie/executor/jpa/CoordJobQueryExecutor.java
+++ b/core/src/main/java/org/apache/oozie/executor/jpa/CoordJobQueryExecutor.java
@@ -32,8 +32,6 @@ import org.apache.oozie.service.JPAService;
 import org.apache.oozie.service.Services;
 import org.apache.oozie.util.DateUtils;
 
-import com.google.common.annotations.VisibleForTesting;
-
 /**
  * Query Executor that provides API to run query for Coordinator Job
  */
@@ -66,21 +64,11 @@ public class CoordJobQueryExecutor extends QueryExecutor<CoordinatorJobBean,
Coo
     };
 
     private static CoordJobQueryExecutor instance = new CoordJobQueryExecutor();
-    private static JPAService jpaService;
 
     private CoordJobQueryExecutor() {
-        Services services = Services.get();
-        if (services != null) {
-            jpaService = services.get(JPAService.class);
-        }
     }
 
     public static CoordJobQueryExecutor getInstance() {
-        if (instance == null) {
-            // It will not be null in normal execution. Required for testcase as
-            // they reinstantiate JPAService everytime
-            instance = new CoordJobQueryExecutor();
-        }
         return CoordJobQueryExecutor.instance;
     }
 
@@ -226,6 +214,7 @@ public class CoordJobQueryExecutor extends QueryExecutor<CoordinatorJobBean,
Coo
 
     @Override
     public int executeUpdate(CoordJobQuery namedQuery, CoordinatorJobBean jobBean) throws
JPAExecutorException {
+        JPAService jpaService = Services.get().get(JPAService.class);
         EntityManager em = jpaService.getEntityManager();
         Query query = getUpdateQuery(namedQuery, jobBean, em);
         int ret = jpaService.executeUpdate(namedQuery.name(), query, em);
@@ -340,6 +329,7 @@ public class CoordJobQueryExecutor extends QueryExecutor<CoordinatorJobBean,
Coo
 
     @Override
     public CoordinatorJobBean get(CoordJobQuery namedQuery, Object... parameters) throws
JPAExecutorException {
+        JPAService jpaService = Services.get().get(JPAService.class);
         EntityManager em = jpaService.getEntityManager();
         Query query = getSelectQuery(namedQuery, em, parameters);
         Object ret = jpaService.executeGet(namedQuery.name(), query, em);
@@ -352,6 +342,7 @@ public class CoordJobQueryExecutor extends QueryExecutor<CoordinatorJobBean,
Coo
 
     @Override
     public List<CoordinatorJobBean> getList(CoordJobQuery namedQuery, Object... parameters)
throws JPAExecutorException {
+        JPAService jpaService = Services.get().get(JPAService.class);
         EntityManager em = jpaService.getEntityManager();
         Query query = getSelectQuery(namedQuery, em, parameters);
         List<?> retList = (List<?>) jpaService.executeGetList(namedQuery.name(),
query, em);
@@ -364,14 +355,6 @@ public class CoordJobQueryExecutor extends QueryExecutor<CoordinatorJobBean,
Coo
         return beanList;
     }
 
-    @VisibleForTesting
-    public static void destroy() {
-        if (instance != null) {
-            jpaService = null;
-            instance = null;
-        }
-    }
-
     @Override
     public Object getSingleValue(CoordJobQuery namedQuery, Object... parameters) throws JPAExecutorException
{
         throw new UnsupportedOperationException();

http://git-wip-us.apache.org/repos/asf/oozie/blob/0d42b8db/core/src/main/java/org/apache/oozie/executor/jpa/SLARegistrationQueryExecutor.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/oozie/executor/jpa/SLARegistrationQueryExecutor.java
b/core/src/main/java/org/apache/oozie/executor/jpa/SLARegistrationQueryExecutor.java
index 3a43d7e..03c7c13 100644
--- a/core/src/main/java/org/apache/oozie/executor/jpa/SLARegistrationQueryExecutor.java
+++ b/core/src/main/java/org/apache/oozie/executor/jpa/SLARegistrationQueryExecutor.java
@@ -27,8 +27,6 @@ import org.apache.oozie.service.JPAService;
 import org.apache.oozie.service.Services;
 import org.apache.oozie.sla.SLARegistrationBean;
 
-import com.google.common.annotations.VisibleForTesting;
-
 /**
  * Query Executor for SLA Event
  *
@@ -42,19 +40,11 @@ public class SLARegistrationQueryExecutor extends QueryExecutor<SLARegistrationB
     };
 
     private static SLARegistrationQueryExecutor instance = new SLARegistrationQueryExecutor();
-    private static JPAService jpaService;
 
     private SLARegistrationQueryExecutor() {
-        Services services = Services.get();
-        if (services != null) {
-            jpaService = Services.get().get(JPAService.class);
-        }
     }
 
     public static QueryExecutor<SLARegistrationBean, SLARegistrationQueryExecutor.SLARegQuery>
getInstance() {
-        if (instance == null) {
-            instance = new SLARegistrationQueryExecutor();
-        }
         return SLARegistrationQueryExecutor.instance;
     }
 
@@ -104,6 +94,7 @@ public class SLARegistrationQueryExecutor extends QueryExecutor<SLARegistrationB
 
     @Override
     public int executeUpdate(SLARegQuery namedQuery, SLARegistrationBean jobBean) throws
JPAExecutorException {
+        JPAService jpaService = Services.get().get(JPAService.class);
         EntityManager em = jpaService.getEntityManager();
         Query query = getUpdateQuery(namedQuery, jobBean, em);
         int ret = jpaService.executeUpdate(namedQuery.name(), query, em);
@@ -112,6 +103,7 @@ public class SLARegistrationQueryExecutor extends QueryExecutor<SLARegistrationB
 
     @Override
     public SLARegistrationBean get(SLARegQuery namedQuery, Object... parameters) throws JPAExecutorException
{
+        JPAService jpaService = Services.get().get(JPAService.class);
         EntityManager em = jpaService.getEntityManager();
         Query query = getSelectQuery(namedQuery, em, parameters);
         Object ret = jpaService.executeGet(namedQuery.name(), query, em);
@@ -124,6 +116,7 @@ public class SLARegistrationQueryExecutor extends QueryExecutor<SLARegistrationB
 
     @Override
     public List<SLARegistrationBean> getList(SLARegQuery namedQuery, Object... parameters)
throws JPAExecutorException {
+        JPAService jpaService = Services.get().get(JPAService.class);
         EntityManager em = jpaService.getEntityManager();
         Query query = getSelectQuery(namedQuery, em, parameters);
         @SuppressWarnings("unchecked")
@@ -158,14 +151,6 @@ public class SLARegistrationQueryExecutor extends QueryExecutor<SLARegistrationB
         return bean;
     }
 
-    @VisibleForTesting
-    public static void destroy() {
-        if (instance != null) {
-            jpaService = null;
-            instance = null;
-        }
-    }
-
     @Override
     public Object getSingleValue(SLARegQuery namedQuery, Object... parameters) throws JPAExecutorException
{
         throw new UnsupportedOperationException();

http://git-wip-us.apache.org/repos/asf/oozie/blob/0d42b8db/core/src/main/java/org/apache/oozie/executor/jpa/SLASummaryQueryExecutor.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/oozie/executor/jpa/SLASummaryQueryExecutor.java
b/core/src/main/java/org/apache/oozie/executor/jpa/SLASummaryQueryExecutor.java
index f60e489..b76ebf5 100644
--- a/core/src/main/java/org/apache/oozie/executor/jpa/SLASummaryQueryExecutor.java
+++ b/core/src/main/java/org/apache/oozie/executor/jpa/SLASummaryQueryExecutor.java
@@ -23,14 +23,10 @@ import javax.persistence.EntityManager;
 import javax.persistence.Query;
 
 import org.apache.oozie.ErrorCode;
-import org.apache.oozie.executor.jpa.SLARegistrationQueryExecutor.SLARegQuery;
 import org.apache.oozie.service.JPAService;
 import org.apache.oozie.service.Services;
-import org.apache.oozie.sla.SLARegistrationBean;
 import org.apache.oozie.sla.SLASummaryBean;
 
-import com.google.common.annotations.VisibleForTesting;
-
 /**
  * Query Executor for SLA Event
  *
@@ -47,19 +43,11 @@ public class SLASummaryQueryExecutor extends QueryExecutor<SLASummaryBean,
SLASu
     };
 
     private static SLASummaryQueryExecutor instance = new SLASummaryQueryExecutor();
-    private static JPAService jpaService;
 
     private SLASummaryQueryExecutor() {
-        Services services = Services.get();
-        if (services != null) {
-            jpaService = Services.get().get(JPAService.class);
-        }
     }
 
     public static QueryExecutor<SLASummaryBean, SLASummaryQueryExecutor.SLASummaryQuery>
getInstance() {
-        if (instance == null) {
-            instance = new SLASummaryQueryExecutor();
-        }
         return SLASummaryQueryExecutor.instance;
     }
 
@@ -132,6 +120,7 @@ public class SLASummaryQueryExecutor extends QueryExecutor<SLASummaryBean,
SLASu
 
     @Override
     public int executeUpdate(SLASummaryQuery namedQuery, SLASummaryBean jobBean) throws JPAExecutorException
{
+        JPAService jpaService = Services.get().get(JPAService.class);
         EntityManager em = jpaService.getEntityManager();
         Query query = getUpdateQuery(namedQuery, jobBean, em);
         int ret = jpaService.executeUpdate(namedQuery.name(), query, em);
@@ -140,6 +129,7 @@ public class SLASummaryQueryExecutor extends QueryExecutor<SLASummaryBean,
SLASu
 
     @Override
     public SLASummaryBean get(SLASummaryQuery namedQuery, Object... parameters) throws JPAExecutorException
{
+        JPAService jpaService = Services.get().get(JPAService.class);
         EntityManager em = jpaService.getEntityManager();
         Query query = getSelectQuery(namedQuery, em, parameters);
         Object ret = jpaService.executeGet(namedQuery.name(), query, em);
@@ -152,6 +142,7 @@ public class SLASummaryQueryExecutor extends QueryExecutor<SLASummaryBean,
SLASu
 
     @Override
     public List<SLASummaryBean> getList(SLASummaryQuery namedQuery, Object... parameters)
throws JPAExecutorException {
+        JPAService jpaService = Services.get().get(JPAService.class);
         EntityManager em = jpaService.getEntityManager();
         Query query = getSelectQuery(namedQuery, em, parameters);
         @SuppressWarnings("unchecked")
@@ -161,6 +152,7 @@ public class SLASummaryQueryExecutor extends QueryExecutor<SLASummaryBean,
SLASu
 
     @Override
     public Object getSingleValue(SLASummaryQuery namedQuery, Object... parameters) throws
JPAExecutorException {
+        JPAService jpaService = Services.get().get(JPAService.class);
         EntityManager em = jpaService.getEntityManager();
         Query query = getSelectQuery(namedQuery, em, parameters);
         Object ret = jpaService.executeGet(namedQuery.name(), query, em);
@@ -188,11 +180,4 @@ public class SLASummaryQueryExecutor extends QueryExecutor<SLASummaryBean,
SLASu
         return bean;
     }
 
-    @VisibleForTesting
-    public static void destroy() {
-        if (instance != null) {
-            jpaService = null;
-            instance = null;
-        }
-    }
 }

http://git-wip-us.apache.org/repos/asf/oozie/blob/0d42b8db/core/src/main/java/org/apache/oozie/executor/jpa/WorkflowActionQueryExecutor.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/oozie/executor/jpa/WorkflowActionQueryExecutor.java
b/core/src/main/java/org/apache/oozie/executor/jpa/WorkflowActionQueryExecutor.java
index 86f2c1b..a83c15f 100644
--- a/core/src/main/java/org/apache/oozie/executor/jpa/WorkflowActionQueryExecutor.java
+++ b/core/src/main/java/org/apache/oozie/executor/jpa/WorkflowActionQueryExecutor.java
@@ -31,8 +31,6 @@ import org.apache.oozie.service.JPAService;
 import org.apache.oozie.service.Services;
 import org.apache.oozie.util.DateUtils;
 
-import com.google.common.annotations.VisibleForTesting;
-
 /**
  * Query Executor that provides API to run query for Workflow Action
  */
@@ -62,21 +60,11 @@ public class WorkflowActionQueryExecutor extends
     };
 
     private static WorkflowActionQueryExecutor instance = new WorkflowActionQueryExecutor();
-    private static JPAService jpaService;
 
     private WorkflowActionQueryExecutor() {
-        Services services = Services.get();
-        if (services != null) {
-            jpaService = services.get(JPAService.class);
-        }
     }
 
     public static QueryExecutor<WorkflowActionBean, WorkflowActionQuery> getInstance()
{
-        if (instance == null) {
-            // It will not be null in normal execution. Required for testcase as
-            // they reinstantiate JPAService everytime
-            instance = new WorkflowActionQueryExecutor();
-        }
         return WorkflowActionQueryExecutor.instance;
     }
 
@@ -234,6 +222,7 @@ public class WorkflowActionQueryExecutor extends
 
     @Override
     public int executeUpdate(WorkflowActionQuery namedQuery, WorkflowActionBean actionBean)
throws JPAExecutorException {
+        JPAService jpaService = Services.get().get(JPAService.class);
         EntityManager em = jpaService.getEntityManager();
         Query query = getUpdateQuery(namedQuery, actionBean, em);
         int ret = jpaService.executeUpdate(namedQuery.name(), query, em);
@@ -376,6 +365,7 @@ public class WorkflowActionQueryExecutor extends
 
     @Override
     public WorkflowActionBean get(WorkflowActionQuery namedQuery, Object... parameters) throws
JPAExecutorException {
+        JPAService jpaService = Services.get().get(JPAService.class);
         EntityManager em = jpaService.getEntityManager();
         Query query = getSelectQuery(namedQuery, em, parameters);
         Object ret = jpaService.executeGet(namedQuery.name(), query, em);
@@ -389,6 +379,7 @@ public class WorkflowActionQueryExecutor extends
     @Override
     public List<WorkflowActionBean> getList(WorkflowActionQuery namedQuery, Object...
parameters)
             throws JPAExecutorException {
+        JPAService jpaService = Services.get().get(JPAService.class);
         EntityManager em = jpaService.getEntityManager();
         Query query = getSelectQuery(namedQuery, em, parameters);
         List<?> retList = (List<?>) jpaService.executeGetList(namedQuery.name(),
query, em);
@@ -401,14 +392,6 @@ public class WorkflowActionQueryExecutor extends
         return beanList;
     }
 
-    @VisibleForTesting
-    public static void destroy() {
-        if (instance != null) {
-            jpaService = null;
-            instance = null;
-        }
-    }
-
     @Override
     public Object getSingleValue(WorkflowActionQuery namedQuery, Object... parameters) throws
JPAExecutorException {
         throw new UnsupportedOperationException();

http://git-wip-us.apache.org/repos/asf/oozie/blob/0d42b8db/core/src/main/java/org/apache/oozie/executor/jpa/WorkflowJobQueryExecutor.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/oozie/executor/jpa/WorkflowJobQueryExecutor.java
b/core/src/main/java/org/apache/oozie/executor/jpa/WorkflowJobQueryExecutor.java
index 733fd64..2111501 100644
--- a/core/src/main/java/org/apache/oozie/executor/jpa/WorkflowJobQueryExecutor.java
+++ b/core/src/main/java/org/apache/oozie/executor/jpa/WorkflowJobQueryExecutor.java
@@ -32,8 +32,6 @@ import org.apache.oozie.service.JPAService;
 import org.apache.oozie.service.Services;
 import org.apache.oozie.util.DateUtils;
 
-import com.google.common.annotations.VisibleForTesting;
-
 /**
  * Query Executor that provides API to run query for Workflow Job
  */
@@ -64,21 +62,11 @@ public class WorkflowJobQueryExecutor extends QueryExecutor<WorkflowJobBean,
Wor
     };
 
     private static WorkflowJobQueryExecutor instance = new WorkflowJobQueryExecutor();
-    private static JPAService jpaService;
 
     private WorkflowJobQueryExecutor() {
-        Services services = Services.get();
-        if (services != null) {
-            jpaService = services.get(JPAService.class);
-        }
     }
 
     public static QueryExecutor<WorkflowJobBean, WorkflowJobQueryExecutor.WorkflowJobQuery>
getInstance() {
-        if (instance == null) {
-            // It will not be null in normal execution. Required for test as
-            // they reinstantiate JPAService everytime
-            instance = new WorkflowJobQueryExecutor();
-        }
         return WorkflowJobQueryExecutor.instance;
     }
 
@@ -203,6 +191,7 @@ public class WorkflowJobQueryExecutor extends QueryExecutor<WorkflowJobBean,
Wor
 
     @Override
     public int executeUpdate(WorkflowJobQuery namedQuery, WorkflowJobBean jobBean) throws
JPAExecutorException {
+        JPAService jpaService = Services.get().get(JPAService.class);
         EntityManager em = jpaService.getEntityManager();
         Query query = getUpdateQuery(namedQuery, jobBean, em);
         int ret = jpaService.executeUpdate(namedQuery.name(), query, em);
@@ -346,6 +335,7 @@ public class WorkflowJobQueryExecutor extends QueryExecutor<WorkflowJobBean,
Wor
 
     @Override
     public WorkflowJobBean get(WorkflowJobQuery namedQuery, Object... parameters) throws
JPAExecutorException {
+        JPAService jpaService = Services.get().get(JPAService.class);
         EntityManager em = jpaService.getEntityManager();
         Query query = getSelectQuery(namedQuery, em, parameters);
         Object ret = jpaService.executeGet(namedQuery.name(), query, em);
@@ -358,6 +348,7 @@ public class WorkflowJobQueryExecutor extends QueryExecutor<WorkflowJobBean,
Wor
 
     @Override
     public List<WorkflowJobBean> getList(WorkflowJobQuery namedQuery, Object... parameters)
throws JPAExecutorException {
+        JPAService jpaService = Services.get().get(JPAService.class);
         EntityManager em = jpaService.getEntityManager();
         Query query = getSelectQuery(namedQuery, em, parameters);
         List<?> retList = (List<?>) jpaService.executeGetList(namedQuery.name(),
query, em);
@@ -370,14 +361,6 @@ public class WorkflowJobQueryExecutor extends QueryExecutor<WorkflowJobBean,
Wor
         return beanList;
     }
 
-    @VisibleForTesting
-    public static void destroy() {
-        if (instance != null) {
-            jpaService = null;
-            instance = null;
-        }
-    }
-
     @Override
     public Object getSingleValue(WorkflowJobQuery namedQuery, Object... parameters) throws
JPAExecutorException {
         throw new UnsupportedOperationException();

http://git-wip-us.apache.org/repos/asf/oozie/blob/0d42b8db/core/src/test/java/org/apache/oozie/command/coord/TestCoordActionInputCheckXCommand.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/oozie/command/coord/TestCoordActionInputCheckXCommand.java
b/core/src/test/java/org/apache/oozie/command/coord/TestCoordActionInputCheckXCommand.java
index fdeec63..3585c7d 100644
--- a/core/src/test/java/org/apache/oozie/command/coord/TestCoordActionInputCheckXCommand.java
+++ b/core/src/test/java/org/apache/oozie/command/coord/TestCoordActionInputCheckXCommand.java
@@ -241,6 +241,7 @@ public class TestCoordActionInputCheckXCommand extends XDataTestCase {
         action = jpaService.execute(new CoordActionGetForInputCheckJPAExecutor(job.getId()
+ "@1"));
         assertTrue(action.getActionXml().contains("action-actual-time=\"2009-02-15T01:00"))
;
 
+        Thread.sleep(1000);
         // providing some of the dataset dirs required as per coordinator specification with
holes
         // before and after action creation time
         createTestCaseSubDir("2009/03/05/_SUCCESS".split("/"));

http://git-wip-us.apache.org/repos/asf/oozie/blob/0d42b8db/core/src/test/java/org/apache/oozie/sla/TestSLAEventGeneration.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/oozie/sla/TestSLAEventGeneration.java b/core/src/test/java/org/apache/oozie/sla/TestSLAEventGeneration.java
index 31c2a47..c1695a2 100644
--- a/core/src/test/java/org/apache/oozie/sla/TestSLAEventGeneration.java
+++ b/core/src/test/java/org/apache/oozie/sla/TestSLAEventGeneration.java
@@ -78,6 +78,8 @@ public class TestSLAEventGeneration extends XDataTestCase {
     JPAService jpa;
     Calendar cal;
     String alert_events = "START_MISS,END_MET,END_MISS";
+    private String[] excludeServices = { "org.apache.oozie.service.StatusTransitService",
+            "org.apache.oozie.service.ActionCheckerService" };
 
     private static final String SLA_XML_1 = "<workflow-app xmlns=\"uri:oozie:workflow:0.2\"
"
             + "xmlns:sla=\"uri:oozie:sla:0.1\" name=\"test-wf-job-sla\">" + "<start
to=\"myjava\"/>"
@@ -102,7 +104,6 @@ public class TestSLAEventGeneration extends XDataTestCase {
         super.setUp();
         services = new Services();
         Configuration conf = services.getConf();
-        String excludeServices[] = { "org.apache.oozie.service.StatusTransitService" };
         setClassesToBeExcluded(conf, excludeServices);
         conf.set(Services.CONF_SERVICE_EXT_CLASSES,
                 EventHandlerService.class.getName() + "," + SLAService.class.getName());
@@ -431,14 +432,13 @@ public class TestSLAEventGeneration extends XDataTestCase {
         assertEquals(expectedEnd, DateUtils.formatDateOozieTZ(slaEvent.getExpectedEnd()));
         assertEquals(30 * 60 * 1000, slaEvent.getExpectedDuration());
         assertEquals(alert_events, slaEvent.getAlertEvents());
-        waitForEventGeneration(200);
         slas.runSLAWorker();
         slaEvent = skipToSLAEvent();
-        assertTrue(SLAStatus.IN_PROCESS == slaEvent.getSLAStatus() || SLAStatus.NOT_STARTED
== slaEvent.getSLAStatus());
+        assertTrue(SLAStatus.NOT_STARTED == slaEvent.getSLAStatus());
         assertEquals(EventStatus.START_MISS, slaEvent.getEventStatus());
 
-        ehs.getEventQueue().clear();
         // test that sla processes the Job Event from Start command
+        ehs.getEventQueue().clear();
         action.setStatus(CoordinatorAction.Status.SUBMITTED);
         CoordActionQueryExecutor.getInstance().executeUpdate(CoordActionQuery.UPDATE_COORD_ACTION_STATUS_PENDING_TIME,
action);
         new CoordActionStartXCommand(actionId, getTestUser(), appName, jobId).call();

http://git-wip-us.apache.org/repos/asf/oozie/blob/0d42b8db/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 7661ebe..f48fff2 100644
--- a/core/src/test/java/org/apache/oozie/test/XTestCase.java
+++ b/core/src/test/java/org/apache/oozie/test/XTestCase.java
@@ -64,15 +64,6 @@ import org.apache.oozie.WorkflowActionBean;
 import org.apache.oozie.WorkflowJobBean;
 import org.apache.oozie.dependency.FSURIHandler;
 import org.apache.oozie.dependency.HCatURIHandler;
-import org.apache.oozie.executor.jpa.BatchQueryExecutor;
-import org.apache.oozie.executor.jpa.BundleActionQueryExecutor;
-import org.apache.oozie.executor.jpa.BundleJobQueryExecutor;
-import org.apache.oozie.executor.jpa.CoordActionQueryExecutor;
-import org.apache.oozie.executor.jpa.CoordJobQueryExecutor;
-import org.apache.oozie.executor.jpa.SLARegistrationQueryExecutor;
-import org.apache.oozie.executor.jpa.SLASummaryQueryExecutor;
-import org.apache.oozie.executor.jpa.WorkflowActionQueryExecutor;
-import org.apache.oozie.executor.jpa.WorkflowJobQueryExecutor;
 import org.apache.oozie.service.ConfigurationService;
 import org.apache.oozie.service.HCatAccessorService;
 import org.apache.oozie.service.HadoopAccessorService;
@@ -426,19 +417,6 @@ public abstract class XTestCase extends TestCase {
         super.tearDown();
         RUNNING_TESTCASES.decrementAndGet();
         LAST_TESTCASE_FINISHED.set(System.currentTimeMillis());
-        resetQueryExecutor();
-    }
-
-    private void resetQueryExecutor(){
-        BatchQueryExecutor.destroy();
-        WorkflowJobQueryExecutor.destroy();
-        WorkflowActionQueryExecutor.destroy();
-        CoordJobQueryExecutor.destroy();
-        CoordActionQueryExecutor.destroy();
-        BundleJobQueryExecutor.destroy();
-        BundleActionQueryExecutor.destroy();
-        SLARegistrationQueryExecutor.destroy();
-        SLASummaryQueryExecutor.destroy();
     }
 
     /**
@@ -1184,7 +1162,7 @@ public abstract class XTestCase extends TestCase {
             return new ArrayList<LoggingEvent>(log);
         }
     }
-    
+
     public TestLogAppender getTestLogAppender() {
         return new TestLogAppender();
     }

http://git-wip-us.apache.org/repos/asf/oozie/blob/0d42b8db/core/src/test/resources/coord-action-sla.xml
----------------------------------------------------------------------
diff --git a/core/src/test/resources/coord-action-sla.xml b/core/src/test/resources/coord-action-sla.xml
index ac93862..8b301fd 100644
--- a/core/src/test/resources/coord-action-sla.xml
+++ b/core/src/test/resources/coord-action-sla.xml
@@ -20,6 +20,17 @@
                  timezone="America/Los_Angeles"
                  xmlns="uri:oozie:coordinator:0.4"
                  xmlns:sla="uri:oozie:sla:0.2">
+
+    <datasets>
+     <dataset name="a" frequency="7" initial-instance="2009-01-01T01:00Z" timezone="UTC">
+        <uri-template>file://#testDir/${YEAR}/${DAY}</uri-template>
+     </dataset>
+    </datasets>
+    <input-events>
+     <data-in name="A" dataset="a">
+      <instance>${coord:current(0)}</instance>
+     </data-in>
+    </input-events>
     <action>
         <workflow>
             <app-path>${wfAppPath}</app-path>
@@ -34,4 +45,3 @@
         </sla:info>
     </action>
 </coordinator-app>
-

http://git-wip-us.apache.org/repos/asf/oozie/blob/0d42b8db/release-log.txt
----------------------------------------------------------------------
diff --git a/release-log.txt b/release-log.txt
index 6462556..702b653 100644
--- a/release-log.txt
+++ b/release-log.txt
@@ -5,6 +5,7 @@ OOZIE-1943 Bump up trunk to 4.2.0-SNAPSHOT (bzhang)
 
 -- Oozie 4.1.0 release (4.1 - unreleased)
 
+OOZIE-1811 Current test failures in trunk (mona)
 OOZIE-1930 oozie coordinator "-info desc" returns earliest instead of latest actions when
specifying "len" after oozie-1532 (bzhang)
 OOZIE-1944 Recursive variable resolution broken when same parameter name in config-default
and action conf (mona)
 OOZIE-1906 Service to periodically remove ZK lock (puru via rohini)


Mime
View raw message