Author: ryota
Date: Fri Sep 27 22:43:37 2013
New Revision: 1527111
URL: http://svn.apache.org/r1527111
Log:
OOZIE-1556 Change Bundle SELECT query to fetch only necessary columns and
consolidate JPA Executors (ryota)
Added:
oozie/trunk/core/src/test/java/org/apache/oozie/executor/jpa/TestBundleActionQueryExecutor.java
oozie/trunk/core/src/test/java/org/apache/oozie/executor/jpa/TestBundleJobQueryExecutor.java
Removed:
oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/BundleActionsGetByLastModifiedTimeJPAExecutor.java
oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/BundleActionsGetStatusPendingJPAExecutor.java
oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/BundleActionsGetWaitingOlderJPAExecutor.java
Modified:
oozie/trunk/core/src/main/java/org/apache/oozie/BundleActionBean.java
oozie/trunk/core/src/main/java/org/apache/oozie/BundleJobBean.java
oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/BundleActionQueryExecutor.java
oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/BundleJobQueryExecutor.java
oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/CoordJobQueryExecutor.java
oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/WorkflowActionQueryExecutor.java
oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/WorkflowJobQueryExecutor.java
oozie/trunk/core/src/main/java/org/apache/oozie/service/RecoveryService.java
oozie/trunk/core/src/main/java/org/apache/oozie/service/StatusTransitService.java
oozie/trunk/core/src/test/java/org/apache/oozie/command/bundle/TestBundleStartXCommand.java
oozie/trunk/release-log.txt
Modified: oozie/trunk/core/src/main/java/org/apache/oozie/BundleActionBean.java
URL:
http://svn.apache.org/viewvc/oozie/trunk/core/src/main/java/org/apache/oozie/BundleActionBean.java?rev=1527111&r1=1527110&r2=1527111&view=diff
==============================================================================
--- oozie/trunk/core/src/main/java/org/apache/oozie/BundleActionBean.java
(original)
+++ oozie/trunk/core/src/main/java/org/apache/oozie/BundleActionBean.java Fri
Sep 27 22:43:37 2013
@@ -56,9 +56,9 @@ import org.json.simple.JSONObject;
@NamedQuery(name = "GET_BUNDLE_ACTIONS", query = "select OBJECT(w)
from BundleActionBean w"),
- @NamedQuery(name = "GET_BUNDLE_ACTIONS_BY_LAST_MODIFIED_TIME", query =
"select OBJECT(w) from BundleActionBean w where w.lastModifiedTimestamp >=
:lastModifiedTime"),
+ @NamedQuery(name = "GET_BUNDLE_ACTIONS_BY_LAST_MODIFIED_TIME", query =
"select w.bundleId from BundleActionBean w where w.lastModifiedTimestamp >=
:lastModifiedTime"),
- @NamedQuery(name = "GET_BUNDLE_WAITING_ACTIONS_OLDER_THAN", query =
"select OBJECT(a) from BundleActionBean a where a.pending > 0 AND
a.lastModifiedTimestamp <= :lastModifiedTime"),
+ @NamedQuery(name = "GET_BUNDLE_WAITING_ACTIONS_OLDER_THAN", query =
"select w.bundleActionId, w.bundleId, w.statusStr, w.coordId, w.coordName from
BundleActionBean w where w.pending > 0 AND w.lastModifiedTimestamp <=
:lastModifiedTime"),
@NamedQuery(name = "GET_BUNDLE_ACTION", query = "select OBJECT(w) from
BundleActionBean w where w.bundleActionId = :bundleActionId"),
Modified: oozie/trunk/core/src/main/java/org/apache/oozie/BundleJobBean.java
URL:
http://svn.apache.org/viewvc/oozie/trunk/core/src/main/java/org/apache/oozie/BundleJobBean.java?rev=1527111&r1=1527110&r2=1527111&view=diff
==============================================================================
--- oozie/trunk/core/src/main/java/org/apache/oozie/BundleJobBean.java
(original)
+++ oozie/trunk/core/src/main/java/org/apache/oozie/BundleJobBean.java Fri Sep
27 22:43:37 2013
@@ -74,6 +74,10 @@ import org.json.simple.JSONObject;
@NamedQuery(name = "GET_BUNDLE_JOB_STATUS", query = "select
w.statusStr from BundleJobBean w where w.id = :id"),
+ @NamedQuery(name = "GET_BUNDLE_JOB_ID_STATUS_PENDING_MODTIME", query =
"select w.id, w.statusStr, w.pending, w.lastModifiedTimestamp from
BundleJobBean w where w.id = :id"),
+
+ @NamedQuery(name = "GET_BUNDLE_JOB_ID_JOBXML_CONF", query = "select
w.id, w.jobXml, w.conf from BundleJobBean w where w.id = :id"),
+
@NamedQuery(name = "GET_BUNDLE_JOBS_COUNT", query = "select count(w)
from BundleJobBean w"),
@NamedQuery(name = "GET_BUNDLE_JOBS_COLUMNS", query = "select w.id,
w.appName, w.appPath, w.conf, w.statusStr, w.kickoffTimestamp,
w.startTimestamp, w.endTimestamp, w.pauseTimestamp, w.createdTimestamp, w.user,
w.group, w.timeUnitStr, w.timeOut from BundleJobBean w order by
w.createdTimestamp desc"),
@@ -311,6 +315,15 @@ public class BundleJobBean implements Wr
}
/**
+ * Set pending value
+ *
+ * @param pending set pending value
+ */
+ public void setPending(int i) {
+ this.pending = i;
+ }
+
+ /**
* Set pending to false
*
* @param pending set pending to false
Modified:
oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/BundleActionQueryExecutor.java
URL:
http://svn.apache.org/viewvc/oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/BundleActionQueryExecutor.java?rev=1527111&r1=1527110&r2=1527111&view=diff
==============================================================================
---
oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/BundleActionQueryExecutor.java
(original)
+++
oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/BundleActionQueryExecutor.java
Fri Sep 27 22:43:37 2013
@@ -17,11 +17,17 @@
*/
package org.apache.oozie.executor.jpa;
+import java.sql.Timestamp;
+import java.util.ArrayList;
+import java.util.Date;
import java.util.List;
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;
@@ -38,7 +44,10 @@ public class BundleActionQueryExecutor e
UPDATE_BUNDLE_ACTION_STATUS_PENDING_MODTIME,
UPDATE_BUNDLE_ACTION_STATUS_PENDING_MODTIME_COORDID,
GET_BUNDLE_ACTION,
- GET_BUNDLE_ACTIONS_FOR_BUNDLE
+ GET_BUNDLE_ACTIONS_FOR_BUNDLE,
+ GET_BUNDLE_ACTIONS_BY_LAST_MODIFIED_TIME,
+ GET_BUNDLE_WAITING_ACTIONS_OLDER_THAN,
+ GET_BUNDLE_ACTION_STATUS_PENDING_FOR_BUNDLE
};
private static BundleActionQueryExecutor instance = new
BundleActionQueryExecutor();
@@ -102,6 +111,16 @@ public class BundleActionQueryExecutor e
case GET_BUNDLE_ACTIONS_FOR_BUNDLE:
query.setParameter("bundleId", parameters[0]);
break;
+ case GET_BUNDLE_ACTIONS_BY_LAST_MODIFIED_TIME:
+ query.setParameter("lastModifiedTime", new
Timestamp(((Date)parameters[0]).getTime()));
+ break;
+ case GET_BUNDLE_WAITING_ACTIONS_OLDER_THAN:
+ Timestamp ts = new Timestamp(System.currentTimeMillis() -
(Long)parameters[0] * 1000);
+ query.setParameter("lastModifiedTime", ts);
+ break;
+ case GET_BUNDLE_ACTION_STATUS_PENDING_FOR_BUNDLE:
+ query.setParameter("bundleId", parameters[0]);
+ break;
default:
throw new JPAExecutorException(ErrorCode.E0603, "QueryExecutor
cannot set parameters for "
+ namedQuery.name());
@@ -121,20 +140,62 @@ public class BundleActionQueryExecutor e
public BundleActionBean get(BundleActionQuery namedQuery, Object...
parameters) throws JPAExecutorException {
EntityManager em = jpaService.getEntityManager();
Query query = getSelectQuery(namedQuery, em, parameters);
- BundleActionBean bean = (BundleActionBean)
jpaService.executeGet(namedQuery.name(), query, em);
- if (bean == null) {
+ Object ret = jpaService.executeGet(namedQuery.name(), query, em);
+ if (ret == null) {
throw new JPAExecutorException(ErrorCode.E0604, query.toString());
}
+ BundleActionBean bean = constructBean(namedQuery, ret);
+ return bean;
+ }
+
+ private BundleActionBean constructBean(BundleActionQuery namedQuery,
Object ret) throws JPAExecutorException {
+ BundleActionBean bean;
+ Object[] arr;
+ switch (namedQuery) {
+ case GET_BUNDLE_ACTION:
+ case GET_BUNDLE_ACTIONS_FOR_BUNDLE:
+ bean = (BundleActionBean) ret;
+ break;
+ case GET_BUNDLE_ACTIONS_BY_LAST_MODIFIED_TIME:
+ bean = new BundleActionBean();
+ bean.setBundleId((String) ret);
+ break;
+ case GET_BUNDLE_WAITING_ACTIONS_OLDER_THAN:
+ bean = new BundleActionBean();
+ arr = (Object[]) ret;
+ bean.setBundleActionId((String) arr[0]);
+ bean.setBundleId((String) arr[1]);
+ bean.setStatusStr((String) arr[2]);
+ bean.setCoordId((String) arr[3]);
+ bean.setCoordName((String) arr[4]);
+ break;
+ case GET_BUNDLE_ACTION_STATUS_PENDING_FOR_BUNDLE:
+ bean = new BundleActionBean();
+ arr = (Object[]) ret;
+ bean.setCoordId((String) arr[0]);
+ bean.setStatusStr((String) arr[1]);
+ bean.setPending((Integer) arr[2]);
+ break;
+ default:
+ throw new JPAExecutorException(ErrorCode.E0603, "QueryExecutor
cannot construct action bean for "
+ + namedQuery.name());
+ }
return bean;
}
- @SuppressWarnings("unchecked")
@Override
public List<BundleActionBean> getList(BundleActionQuery namedQuery,
Object... parameters)
throws JPAExecutorException {
EntityManager em = jpaService.getEntityManager();
Query query = getSelectQuery(namedQuery, em, parameters);
- return (List<BundleActionBean>)
jpaService.executeGetList(namedQuery.name(), query, em);
+ List<?> retList = (List<?>)
jpaService.executeGetList(namedQuery.name(), query, em);
+ List<BundleActionBean> beanList = new ArrayList<BundleActionBean>();
+ if (retList != null) {
+ for (Object ret : retList) {
+ beanList.add(constructBean(namedQuery, ret));
+ }
+ }
+ return beanList;
}
@VisibleForTesting
Modified:
oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/BundleJobQueryExecutor.java
URL:
http://svn.apache.org/viewvc/oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/BundleJobQueryExecutor.java?rev=1527111&r1=1527110&r2=1527111&view=diff
==============================================================================
---
oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/BundleJobQueryExecutor.java
(original)
+++
oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/BundleJobQueryExecutor.java
Fri Sep 27 22:43:37 2013
@@ -17,14 +17,19 @@
*/
package org.apache.oozie.executor.jpa;
+import java.sql.Timestamp;
+import java.util.ArrayList;
import java.util.List;
import javax.persistence.EntityManager;
import javax.persistence.Query;
import org.apache.oozie.BundleJobBean;
import org.apache.oozie.ErrorCode;
+import org.apache.oozie.StringBlob;
import org.apache.oozie.service.JPAService;
import org.apache.oozie.service.Services;
+import org.apache.oozie.util.DateUtils;
+
import com.google.common.annotations.VisibleForTesting;
/**
@@ -41,7 +46,9 @@ public class BundleJobQueryExecutor exte
UPDATE_BUNDLE_JOB_STATUS_PAUSE_ENDTIME,
UPDATE_BUNDLE_JOB_PAUSE_KICKOFF,
GET_BUNDLE_JOB,
- GET_BUNDLE_JOB_STATUS
+ GET_BUNDLE_JOB_STATUS,
+ GET_BUNDLE_JOB_ID_STATUS_PENDING_MODTIME,
+ GET_BUNDLE_JOB_ID_JOBXML_CONF
};
private static BundleJobQueryExecutor instance = new
BundleJobQueryExecutor();
@@ -130,15 +137,16 @@ public class BundleJobQueryExecutor exte
public Query getSelectQuery(BundleJobQuery namedQuery, EntityManager em,
Object... parameters)
throws JPAExecutorException {
Query query = em.createNamedQuery(namedQuery.name());
- BundleJobQuery bjQuery = (BundleJobQuery) namedQuery;
- switch (bjQuery) {
+ switch (namedQuery) {
case GET_BUNDLE_JOB:
+ case GET_BUNDLE_JOB_ID_STATUS_PENDING_MODTIME:
+ case GET_BUNDLE_JOB_ID_JOBXML_CONF:
case GET_BUNDLE_JOB_STATUS:
query.setParameter("id", parameters[0]);
break;
default:
throw new JPAExecutorException(ErrorCode.E0603, "QueryExecutor
cannot set parameters for "
- + bjQuery.name());
+ + namedQuery.name());
}
return query;
}
@@ -165,13 +173,22 @@ public class BundleJobQueryExecutor exte
@Override
public List<BundleJobBean> getList(BundleJobQuery namedQuery, Object...
parameters) throws JPAExecutorException {
- // TODO
- return null;
+ EntityManager em = jpaService.getEntityManager();
+ Query query = getSelectQuery(namedQuery, em, parameters);
+ List<?> retList = (List<?>)
jpaService.executeGetList(namedQuery.name(), query, em);
+ List<BundleJobBean> beanList = new ArrayList<BundleJobBean>();
+ if (retList != null) {
+ for (Object ret : retList) {
+ beanList.add(constructBean(namedQuery, ret));
+ }
+ }
+ return beanList;
}
private BundleJobBean constructBean(BundleJobQuery namedQuery, Object ret,
Object... parameters)
throws JPAExecutorException {
BundleJobBean bean;
+ Object[] arr;
switch (namedQuery) {
case GET_BUNDLE_JOB:
bean = (BundleJobBean) ret;
@@ -181,6 +198,21 @@ public class BundleJobQueryExecutor exte
bean.setId((String) parameters[0]);
bean.setStatus((String) ret);
break;
+ case GET_BUNDLE_JOB_ID_STATUS_PENDING_MODTIME:
+ bean = new BundleJobBean();
+ arr = (Object[]) ret;
+ bean.setId((String) arr[0]);
+ bean.setStatus((String) arr[1]);
+ bean.setPending((Integer) arr[2]);
+ bean.setLastModifiedTime(DateUtils.toDate((Timestamp) arr[3]));
+ break;
+ case GET_BUNDLE_JOB_ID_JOBXML_CONF:
+ bean = new BundleJobBean();
+ arr = (Object[]) ret;
+ bean.setId((String) arr[0]);
+ bean.setJobXmlBlob((StringBlob) arr[1]);
+ bean.setConfBlob((StringBlob) arr[2]);
+ break;
default:
throw new JPAExecutorException(ErrorCode.E0603, "QueryExecutor
cannot construct job bean for "
+ namedQuery.name());
Modified:
oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/CoordJobQueryExecutor.java
URL:
http://svn.apache.org/viewvc/oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/CoordJobQueryExecutor.java?rev=1527111&r1=1527110&r2=1527111&view=diff
==============================================================================
---
oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/CoordJobQueryExecutor.java
(original)
+++
oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/CoordJobQueryExecutor.java
Fri Sep 27 22:43:37 2013
@@ -323,9 +323,8 @@ public class CoordJobQueryExecutor exten
EntityManager em = jpaService.getEntityManager();
Query query = getSelectQuery(namedQuery, em, parameters);
List<?> retList = (List<?>)
jpaService.executeGetList(namedQuery.name(), query, em);
- List<CoordinatorJobBean> beanList = null;
+ List<CoordinatorJobBean> beanList = new
ArrayList<CoordinatorJobBean>();
if (retList != null) {
- beanList = new ArrayList<CoordinatorJobBean>();
for (Object ret : retList) {
beanList.add(constructBean(namedQuery, ret, parameters));
}
Modified:
oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/WorkflowActionQueryExecutor.java
URL:
http://svn.apache.org/viewvc/oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/WorkflowActionQueryExecutor.java?rev=1527111&r1=1527110&r2=1527111&view=diff
==============================================================================
---
oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/WorkflowActionQueryExecutor.java
(original)
+++
oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/WorkflowActionQueryExecutor.java
Fri Sep 27 22:43:37 2013
@@ -431,9 +431,8 @@ public class WorkflowActionQueryExecutor
EntityManager em = jpaService.getEntityManager();
Query query = getSelectQuery(namedQuery, em, parameters);
List<?> retList = (List<?>)
jpaService.executeGetList(namedQuery.name(), query, em);
- List<WorkflowActionBean> beanList = null;
+ List<WorkflowActionBean> beanList = new
ArrayList<WorkflowActionBean>();
if (retList != null) {
- beanList = new ArrayList<WorkflowActionBean>();
for (Object ret : retList) {
beanList.add(constructBean(namedQuery, ret));
}
Modified:
oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/WorkflowJobQueryExecutor.java
URL:
http://svn.apache.org/viewvc/oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/WorkflowJobQueryExecutor.java?rev=1527111&r1=1527110&r2=1527111&view=diff
==============================================================================
---
oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/WorkflowJobQueryExecutor.java
(original)
+++
oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/WorkflowJobQueryExecutor.java
Fri Sep 27 22:43:37 2013
@@ -324,9 +324,8 @@ public class WorkflowJobQueryExecutor ex
EntityManager em = jpaService.getEntityManager();
Query query = getSelectQuery(namedQuery, em, parameters);
List<?> retList = (List<?>)
jpaService.executeGetList(namedQuery.name(), query, em);
- List<WorkflowJobBean> beanList = null;
+ List<WorkflowJobBean> beanList = new ArrayList<WorkflowJobBean>();
if (retList != null) {
- beanList = new ArrayList<WorkflowJobBean>();
for (Object ret : retList) {
beanList.add(constructBean(namedQuery, ret, parameters));
}
Modified:
oozie/trunk/core/src/main/java/org/apache/oozie/service/RecoveryService.java
URL:
http://svn.apache.org/viewvc/oozie/trunk/core/src/main/java/org/apache/oozie/service/RecoveryService.java?rev=1527111&r1=1527110&r2=1527111&view=diff
==============================================================================
---
oozie/trunk/core/src/main/java/org/apache/oozie/service/RecoveryService.java
(original)
+++
oozie/trunk/core/src/main/java/org/apache/oozie/service/RecoveryService.java
Fri Sep 27 22:43:37 2013
@@ -47,11 +47,13 @@ import org.apache.oozie.command.wf.KillX
import org.apache.oozie.command.wf.ResumeXCommand;
import org.apache.oozie.command.wf.SignalXCommand;
import org.apache.oozie.command.wf.SuspendXCommand;
-import org.apache.oozie.executor.jpa.BundleActionsGetWaitingOlderJPAExecutor;
-import org.apache.oozie.executor.jpa.BundleJobGetJPAExecutor;
+import org.apache.oozie.executor.jpa.BundleActionQueryExecutor;
+import org.apache.oozie.executor.jpa.BundleJobQueryExecutor;
import org.apache.oozie.executor.jpa.CoordActionsGetForRecoveryJPAExecutor;
import
org.apache.oozie.executor.jpa.CoordActionsGetReadyGroupbyJobIDJPAExecutor;
import org.apache.oozie.executor.jpa.CoordJobQueryExecutor;
+import
org.apache.oozie.executor.jpa.BundleActionQueryExecutor.BundleActionQuery;
+import org.apache.oozie.executor.jpa.BundleJobQueryExecutor.BundleJobQuery;
import org.apache.oozie.executor.jpa.CoordJobQueryExecutor.CoordJobQuery;
import org.apache.oozie.executor.jpa.JPAExecutorException;
import org.apache.oozie.executor.jpa.WorkflowActionQueryExecutor;
@@ -165,7 +167,8 @@ public class RecoveryService implements
XLog log = XLog.getLog(getClass());
List<BundleActionBean> bactions = null;
try {
- bactions = jpaService.execute(new
BundleActionsGetWaitingOlderJPAExecutor(bundleOlderThan));
+ bactions = BundleActionQueryExecutor.getInstance().getList(
+
BundleActionQuery.GET_BUNDLE_WAITING_ACTIONS_OLDER_THAN, bundleOlderThan);
}
catch (JPAExecutorException ex) {
log.warn("Error reading bundle actions from database", ex);
@@ -184,7 +187,8 @@ public class RecoveryService implements
if (baction.getStatus() == Job.Status.PREP) {
BundleJobBean bundleJob = null;
if (jpaService != null) {
- bundleJob = jpaService.execute(new
BundleJobGetJPAExecutor(baction.getBundleId()));
+ bundleJob =
BundleJobQueryExecutor.getInstance().get(
+
BundleJobQuery.GET_BUNDLE_JOB_ID_JOBXML_CONF, baction.getBundleId());
}
if (bundleJob != null) {
Element bAppXml =
XmlUtils.parseXml(bundleJob.getJobXml());
Modified:
oozie/trunk/core/src/main/java/org/apache/oozie/service/StatusTransitService.java
URL:
http://svn.apache.org/viewvc/oozie/trunk/core/src/main/java/org/apache/oozie/service/StatusTransitService.java?rev=1527111&r1=1527110&r2=1527111&view=diff
==============================================================================
---
oozie/trunk/core/src/main/java/org/apache/oozie/service/StatusTransitService.java
(original)
+++
oozie/trunk/core/src/main/java/org/apache/oozie/service/StatusTransitService.java
Fri Sep 27 22:43:37 2013
@@ -36,11 +36,10 @@ import org.apache.oozie.client.Job;
import org.apache.oozie.command.CommandException;
import org.apache.oozie.command.bundle.BundleKillXCommand;
import org.apache.oozie.command.bundle.BundleStatusUpdateXCommand;
-import
org.apache.oozie.executor.jpa.BundleActionsGetByLastModifiedTimeJPAExecutor;
-import org.apache.oozie.executor.jpa.BundleActionsGetStatusPendingJPAExecutor;
-import org.apache.oozie.executor.jpa.BundleJobGetJPAExecutor;
import org.apache.oozie.executor.jpa.BundleJobQueryExecutor;
+import
org.apache.oozie.executor.jpa.BundleActionQueryExecutor.BundleActionQuery;
import org.apache.oozie.executor.jpa.BundleJobQueryExecutor.BundleJobQuery;
+import org.apache.oozie.executor.jpa.BundleActionQueryExecutor;
import org.apache.oozie.executor.jpa.BundleJobsGetRunningOrPendingJPAExecutor;
import
org.apache.oozie.executor.jpa.CoordActionsGetByLastModifiedTimeJPAExecutor;
import org.apache.oozie.executor.jpa.CoordJobGetActionsStatusJPAExecutor;
@@ -158,15 +157,16 @@ public class StatusTransitService implem
+ DateUtils.formatDateOozieTZ(lastInstanceStartTime));
// this is not the first instance, we should only check jobs
that have actions been
// updated >= start time of last service run;
- List<BundleActionBean> actionList = jpaService
- .execute(new
BundleActionsGetByLastModifiedTimeJPAExecutor(lastInstanceStartTime));
+ List<BundleActionBean> actionList =
BundleActionQueryExecutor.getInstance().getList(
+
BundleActionQuery.GET_BUNDLE_ACTIONS_BY_LAST_MODIFIED_TIME,
lastInstanceStartTime);
Set<String> bundleIds = new HashSet<String>();
for (BundleActionBean action : actionList) {
bundleIds.add(action.getBundleId());
}
pendingJobCheckList = new ArrayList<BundleJobBean>();
for (String bundleId : bundleIds.toArray(new
String[bundleIds.size()])) {
- BundleJobBean bundle = jpaService.execute(new
BundleJobGetJPAExecutor(bundleId));
+ BundleJobBean bundle =
BundleJobQueryExecutor.getInstance().get(
+
BundleJobQuery.GET_BUNDLE_JOB_ID_STATUS_PENDING_MODTIME, bundleId);
// Running bundle job might have pending false
if (bundle.isPending() ||
bundle.getStatus().equals(Job.Status.RUNNING)
||
bundle.getStatus().equals(Job.Status.RUNNINGWITHERROR)
@@ -187,8 +187,8 @@ public class StatusTransitService implem
String jobId = bundleJob.getId();
Job.Status[] bundleStatus = new Job.Status[1];
bundleStatus[0] = bundleJob.getStatus();
- List<BundleActionBean> bundleActions =
jpaService.execute(new BundleActionsGetStatusPendingJPAExecutor(
- jobId));
+ List<BundleActionBean> bundleActions =
BundleActionQueryExecutor.getInstance().getList(
+
BundleActionQuery.GET_BUNDLE_ACTION_STATUS_PENDING_FOR_BUNDLE, jobId);
HashMap<Job.Status, Integer> bundleActionStatus =
new HashMap<Job.Status, Integer>();
boolean foundPending = false;
for (BundleActionBean bAction : bundleActions) {
@@ -632,7 +632,8 @@ public class StatusTransitService implem
bundleJob.resetPending();
LOG.info("Bundle job [" + jobId + "] Pending set to FALSE");
}
-
BundleJobQueryExecutor.getInstance().executeUpdate(BundleJobQuery.UPDATE_BUNDLE_JOB_STATUS_PENDING_MODTIME,
bundleJob);
+
BundleJobQueryExecutor.getInstance().executeUpdate(BundleJobQuery.UPDATE_BUNDLE_JOB_STATUS_PENDING_MODTIME,
+ bundleJob);
}
private void updateCoordJob(boolean isPending, CoordinatorJobBean
coordJob, Job.Status coordStatus)
Modified:
oozie/trunk/core/src/test/java/org/apache/oozie/command/bundle/TestBundleStartXCommand.java
URL:
http://svn.apache.org/viewvc/oozie/trunk/core/src/test/java/org/apache/oozie/command/bundle/TestBundleStartXCommand.java?rev=1527111&r1=1527110&r2=1527111&view=diff
==============================================================================
---
oozie/trunk/core/src/test/java/org/apache/oozie/command/bundle/TestBundleStartXCommand.java
(original)
+++
oozie/trunk/core/src/test/java/org/apache/oozie/command/bundle/TestBundleStartXCommand.java
Fri Sep 27 22:43:37 2013
@@ -270,10 +270,14 @@ public class TestBundleStartXCommand ext
assertNull(actions.get(0).getCoordId());
assertEquals(Job.Status.FAILED, actions.get(0).getStatus());
Runnable runnable = new StatusTransitRunnable();
+ //1st run of StatusTransitionService changes bundle to running
+ runnable.run();
+ sleep(2000);
+ //2nd run changes bundle to DoneWithError
runnable.run();
sleep(2000);
job = jpaService.execute(bundleJobGetExecutor);
- assertEquals(job.getStatus(), Job.Status.KILLED);
+ assertEquals(job.getStatus(), Job.Status.DONEWITHERROR);
}
Added:
oozie/trunk/core/src/test/java/org/apache/oozie/executor/jpa/TestBundleActionQueryExecutor.java
URL:
http://svn.apache.org/viewvc/oozie/trunk/core/src/test/java/org/apache/oozie/executor/jpa/TestBundleActionQueryExecutor.java?rev=1527111&view=auto
==============================================================================
---
oozie/trunk/core/src/test/java/org/apache/oozie/executor/jpa/TestBundleActionQueryExecutor.java
(added)
+++
oozie/trunk/core/src/test/java/org/apache/oozie/executor/jpa/TestBundleActionQueryExecutor.java
Fri Sep 27 22:43:37 2013
@@ -0,0 +1,181 @@
+/**
+ * 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.executor.jpa;
+
+import java.sql.Timestamp;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.List;
+
+import javax.persistence.EntityManager;
+import javax.persistence.Query;
+
+import org.apache.oozie.BundleActionBean;
+import org.apache.oozie.BundleJobBean;
+import org.apache.oozie.client.Job;
+import
org.apache.oozie.executor.jpa.BundleActionQueryExecutor.BundleActionQuery;
+import org.apache.oozie.service.JPAService;
+import org.apache.oozie.service.Services;
+import org.apache.oozie.test.XDataTestCase;
+import org.apache.oozie.util.DateUtils;
+
+public class TestBundleActionQueryExecutor extends XDataTestCase {
+ Services services;
+ JPAService jpaService;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ services = new Services();
+ services.init();
+ jpaService = Services.get().get(JPAService.class);
+ cleanUpDBTables();
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ services.destroy();
+ super.tearDown();
+ }
+
+ public void testGetUpdateQuery() throws Exception {
+ EntityManager em = jpaService.getEntityManager();
+ BundleJobBean job = this.addRecordToBundleJobTable(Job.Status.RUNNING,
false);
+ BundleActionBean bundleAction =
this.addRecordToBundleActionTable(job.getId(), "action1", 1, Job.Status.PREP);
+
+ // UPDATE_BUNDLE_ACTION_PENDING_MODTIME
+ Query query = BundleActionQueryExecutor.getInstance().getUpdateQuery(
+ BundleActionQuery.UPDATE_BUNDLE_ACTION_PENDING_MODTIME,
bundleAction, em);
+ assertEquals(query.getParameterValue("lastModifiedTime"),
bundleAction.getLastModifiedTimestamp());
+ assertEquals(query.getParameterValue("pending"),
bundleAction.getPending());
+ assertEquals(query.getParameterValue("bundleActionId"),
bundleAction.getBundleActionId());
+
+ // UPDATE_BUNDLE_ACTION_STATUS_PENDING_MODTIME:
+ query = BundleActionQueryExecutor.getInstance().getUpdateQuery(
+
BundleActionQuery.UPDATE_BUNDLE_ACTION_STATUS_PENDING_MODTIME_COORDID,
bundleAction, em);
+ assertEquals(query.getParameterValue("status"),
bundleAction.getStatus().toString());
+ assertEquals(query.getParameterValue("lastModifiedTime"),
bundleAction.getLastModifiedTimestamp());
+ assertEquals(query.getParameterValue("pending"),
bundleAction.getPending());
+ assertEquals(query.getParameterValue("coordId"),
bundleAction.getCoordId());
+ assertEquals(query.getParameterValue("bundleActionId"),
bundleAction.getBundleActionId());
+
+ // UPDATE_BUNDLE_ACTION_STATUS_PENDING_MODTIME_COORDID
+ query = BundleActionQueryExecutor.getInstance().getUpdateQuery(
+
BundleActionQuery.UPDATE_BUNDLE_ACTION_STATUS_PENDING_MODTIME_COORDID,
bundleAction, em);
+ assertEquals(query.getParameterValue("status"),
bundleAction.getStatus().toString());
+ assertEquals(query.getParameterValue("lastModifiedTime"),
bundleAction.getLastModifiedTimestamp());
+ assertEquals(query.getParameterValue("pending"),
bundleAction.isPending() ? 1 : 0);
+ assertEquals(query.getParameterValue("coordId"),
bundleAction.getCoordId());
+ assertEquals(query.getParameterValue("bundleActionId"),
bundleAction.getBundleActionId());
+
+ em.close();
+ }
+
+ public void testGetSelectQuery() throws Exception {
+
+ EntityManager em = jpaService.getEntityManager();
+ BundleActionBean bean = addRecordToBundleActionTable("test-bundle-id",
"test-coord", 0, Job.Status.RUNNING);
+
+ Query query = null;
+ query =
BundleActionQueryExecutor.getInstance().getSelectQuery(BundleActionQuery.GET_BUNDLE_ACTION,
em,
+ bean.getBundleId());
+ assertEquals(query.getParameterValue("bundleActionId"),
bean.getBundleId());
+
+ query = BundleActionQueryExecutor.getInstance().getSelectQuery(
+ BundleActionQuery.GET_BUNDLE_ACTIONS_BY_LAST_MODIFIED_TIME,
em, bean.getLastModifiedTime());
+ assertEquals(query.getParameterValue("lastModifiedTime"),
bean.getLastModifiedTimestamp());
+
+ query = BundleActionQueryExecutor.getInstance().getSelectQuery(
+ BundleActionQuery.GET_BUNDLE_WAITING_ACTIONS_OLDER_THAN, em,
(long) 100);
+ Date date = DateUtils.toDate((Timestamp)
(query.getParameterValue("lastModifiedTime")));
+ assertTrue(date.before(Calendar.getInstance().getTime()));
+
+ query = BundleActionQueryExecutor.getInstance().getSelectQuery(
+ BundleActionQuery.GET_BUNDLE_ACTION_STATUS_PENDING_FOR_BUNDLE,
em, bean.getBundleId());
+ assertEquals(query.getParameterValue("bundleId"), bean.getBundleId());
+ }
+
+ public void testExecuteUpdate() throws Exception {
+ BundleJobBean job = this.addRecordToBundleJobTable(Job.Status.RUNNING,
false);
+ BundleActionBean bean = this.addRecordToBundleActionTable(job.getId(),
"action1", 1, Job.Status.PREP);
+ bean.setStatus(Job.Status.RUNNING);
+ BundleActionQueryExecutor.getInstance().executeUpdate(
+ BundleActionQuery.UPDATE_BUNDLE_ACTION_STATUS_PENDING_MODTIME,
bean);
+ BundleActionBean retBean =
BundleActionQueryExecutor.getInstance().get(BundleActionQuery.GET_BUNDLE_ACTION,
+ bean.getBundleActionId());
+ assertEquals(retBean.getStatus(), Job.Status.RUNNING);
+ }
+
+ public void testGet() throws Exception {
+ BundleJobBean job = this.addRecordToBundleJobTable(Job.Status.RUNNING,
false);
+ BundleActionBean bundleAction =
this.addRecordToBundleActionTable(job.getId(), "action1", 1, Job.Status.PREP);
+ // GET_BUNDLE_ACTION_STATUS_PENDING_FOR_BUNDLE
+ BundleActionBean retBean = BundleActionQueryExecutor.getInstance().get(
+ BundleActionQuery.GET_BUNDLE_ACTION_STATUS_PENDING_FOR_BUNDLE,
bundleAction.getBundleId());
+ assertEquals(bundleAction.getCoordId(), retBean.getCoordId());
+ assertEquals(bundleAction.getStatusStr(), retBean.getStatusStr());
+ assertEquals(bundleAction.getPending(), retBean.getPending());
+ // GET_BUNDLE_ACTION
+ retBean =
BundleActionQueryExecutor.getInstance().get(BundleActionQuery.GET_BUNDLE_ACTION,
+ bundleAction.getBundleActionId());
+ assertEquals(bundleAction.getStatus(), retBean.getStatus());
+ }
+
+ public void testGetList() throws Exception {
+ BundleJobBean job = this.addRecordToBundleJobTable(Job.Status.RUNNING,
false);
+ BundleActionBean bean1 =
this.addRecordToBundleActionTable(job.getId(), "coord1", 0, Job.Status.PREP);
+ BundleActionBean bean2 =
this.addRecordToBundleActionTable(job.getId(), "coord2", 1, Job.Status.RUNNING);
+ BundleActionBean bean3 =
this.addRecordToBundleActionTable(job.getId(), "coord3", 1, Job.Status.RUNNING);
+ // GET_BUNDLE_ACTIONS_BY_LAST_MODIFIED_TIME
+ Date timeBefore = new Date(bean1.getLastModifiedTime().getTime() -
1000 * 60);
+ List<BundleActionBean> bActions =
BundleActionQueryExecutor.getInstance().getList(
+ BundleActionQuery.GET_BUNDLE_ACTIONS_BY_LAST_MODIFIED_TIME,
timeBefore);
+ assertEquals(3, bActions.size());
+ Date timeAfter = new Date(bean3.getLastModifiedTime().getTime() + 100
* 60);
+ bActions = BundleActionQueryExecutor.getInstance().getList(
+ BundleActionQuery.GET_BUNDLE_ACTIONS_BY_LAST_MODIFIED_TIME,
timeAfter);
+ assertEquals(0, bActions.size());
+ // GET_BUNDLE_WAITING_ACTIONS_OLDER_THAN
+ bActions = BundleActionQueryExecutor.getInstance().getList(
+ BundleActionQuery.GET_BUNDLE_WAITING_ACTIONS_OLDER_THAN,
(long) (1000 * 60));
+ assertEquals(0, bActions.size());
+ bActions = BundleActionQueryExecutor.getInstance().getList(
+ BundleActionQuery.GET_BUNDLE_WAITING_ACTIONS_OLDER_THAN,
(long) (-1000 * 60));
+ assertEquals(2, bActions.size());
+ // GET_BUNDLE_ACTIONS_FOR_BUNDLE
+ List<BundleActionBean> retList =
BundleActionQueryExecutor.getInstance().getList(
+ BundleActionQuery.GET_BUNDLE_ACTIONS_FOR_BUNDLE, job.getId());
+ assertEquals(3, retList.size());
+ for (BundleActionBean bean : retList) {
+ assertTrue(bean.getCoordName().equals("coord1") ||
bean.getCoordName().equals("coord2")
+ || bean.getCoordName().equals("coord3"));
+ }
+ }
+
+ public void testInsert() throws Exception {
+ BundleActionBean bean = new BundleActionBean();
+ bean.setBundleActionId("test-oozie");
+ bean.setCoordName("testApp");
+ bean.setStatus(Job.Status.RUNNING);
+ BundleActionQueryExecutor.getInstance().insert(bean);
+ BundleActionBean retBean =
BundleActionQueryExecutor.getInstance().get(BundleActionQuery.GET_BUNDLE_ACTION,
+ "test-oozie");
+ assertEquals(retBean.getCoordName(), "testApp");
+ assertEquals(retBean.getStatus(), Job.Status.RUNNING);
+ }
+}
\ No newline at end of file
Added:
oozie/trunk/core/src/test/java/org/apache/oozie/executor/jpa/TestBundleJobQueryExecutor.java
URL:
http://svn.apache.org/viewvc/oozie/trunk/core/src/test/java/org/apache/oozie/executor/jpa/TestBundleJobQueryExecutor.java?rev=1527111&view=auto
==============================================================================
---
oozie/trunk/core/src/test/java/org/apache/oozie/executor/jpa/TestBundleJobQueryExecutor.java
(added)
+++
oozie/trunk/core/src/test/java/org/apache/oozie/executor/jpa/TestBundleJobQueryExecutor.java
Fri Sep 27 22:43:37 2013
@@ -0,0 +1,158 @@
+/**
+ * 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.executor.jpa;
+
+import javax.persistence.EntityManager;
+import javax.persistence.Query;
+
+import org.apache.oozie.BundleJobBean;
+import org.apache.oozie.client.Job;
+import org.apache.oozie.executor.jpa.BundleJobQueryExecutor.BundleJobQuery;
+import org.apache.oozie.service.JPAService;
+import org.apache.oozie.service.Services;
+import org.apache.oozie.test.XDataTestCase;
+
+public class TestBundleJobQueryExecutor extends XDataTestCase {
+ Services services;
+ JPAService jpaService;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ services = new Services();
+ services.init();
+ jpaService = Services.get().get(JPAService.class);
+ cleanUpDBTables();
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ services.destroy();
+ super.tearDown();
+ }
+
+ public void testGetUpdateQuery() throws Exception {
+ EntityManager em = jpaService.getEntityManager();
+ BundleJobBean bean = addRecordToBundleJobTable(Job.Status.PREP, false);
+ // UPDATE_BUNDLE_JOB
+ Query query =
BundleJobQueryExecutor.getInstance().getUpdateQuery(BundleJobQuery.UPDATE_BUNDLE_JOB,
bean, em);
+ assertEquals(query.getParameterValue("appName"), bean.getAppName());
+ assertEquals(query.getParameterValue("appPath"), bean.getAppPath());
+ assertEquals(query.getParameterValue("conf"), bean.getConfBlob());
+ assertEquals(query.getParameterValue("timeOut"), bean.getTimeout());
+ assertEquals(query.getParameterValue("createdTime"),
bean.getCreatedTimestamp());
+ assertEquals(query.getParameterValue("endTime"),
bean.getEndTimestamp());
+ assertEquals(query.getParameterValue("jobXml"), bean.getJobXmlBlob());
+ assertEquals(query.getParameterValue("lastModifiedTime"),
bean.getLastModifiedTimestamp());
+ assertEquals(query.getParameterValue("origJobXml"),
bean.getOrigJobXmlBlob());
+ assertEquals(query.getParameterValue("startTime"),
bean.getstartTimestamp());
+ assertEquals(query.getParameterValue("status"),
bean.getStatus().toString());
+ assertEquals(query.getParameterValue("timeUnit"), bean.getTimeUnit());
+ assertEquals(query.getParameterValue("pending"), bean.getPending());
+ assertEquals(query.getParameterValue("id"), bean.getId());
+
+ // UPDATE_BUNDLE_JOB_STATUS
+ query =
BundleJobQueryExecutor.getInstance().getUpdateQuery(BundleJobQuery.UPDATE_BUNDLE_JOB_STATUS,
bean, em);
+ assertEquals(query.getParameterValue("status"),
bean.getStatus().toString());
+ assertEquals(query.getParameterValue("id"), bean.getId());
+
+ // UPDATE_BUNDLE_JOB_STATUS_PENDING
+ query =
BundleJobQueryExecutor.getInstance().getUpdateQuery(BundleJobQuery.UPDATE_BUNDLE_JOB_STATUS_PENDING,
+ bean, em);
+ assertEquals(query.getParameterValue("status"),
bean.getStatus().toString());
+ assertEquals(query.getParameterValue("pending"), bean.getPending());
+ assertEquals(query.getParameterValue("id"), bean.getId());
+
+ // UPDATE_BUNDLE_JOB_STATUS_PENDING_SUSP_MOD_TIME:
+ query = BundleJobQueryExecutor.getInstance().getUpdateQuery(
+ BundleJobQuery.UPDATE_BUNDLE_JOB_STATUS_PENDING_SUSP_MOD_TIME,
bean, em);
+ assertEquals(query.getParameterValue("status"),
bean.getStatus().toString());
+ assertEquals(query.getParameterValue("lastModifiedTime"),
bean.getLastModifiedTimestamp());
+ assertEquals(query.getParameterValue("pending"), bean.getPending());
+ assertEquals(query.getParameterValue("suspendedTime"),
bean.getSuspendedTimestamp());
+ assertEquals(query.getParameterValue("id"), bean.getId());
+
+ // UPDATE_BUNDLE_JOB_STATUS_PENDING_MODTIME:
+ query = BundleJobQueryExecutor.getInstance().getUpdateQuery(
+ BundleJobQuery.UPDATE_BUNDLE_JOB_STATUS_PENDING_MODTIME, bean,
em);
+ assertEquals(query.getParameterValue("status"),
bean.getStatus().toString());
+ assertEquals(query.getParameterValue("lastModifiedTime"),
bean.getLastModifiedTimestamp());
+ assertEquals(query.getParameterValue("pending"), bean.getPending());
+ assertEquals(query.getParameterValue("id"), bean.getId());
+
+ // UPDATE_BUNDLE_JOB_STATUS_PAUSE_ENDTIME:
+ query = BundleJobQueryExecutor.getInstance().getUpdateQuery(
+ BundleJobQuery.UPDATE_BUNDLE_JOB_STATUS_PAUSE_ENDTIME, bean,
em);
+ assertEquals(query.getParameterValue("status"),
bean.getStatus().toString());
+ assertEquals(query.getParameterValue("pauseTime"),
bean.getPauseTimestamp());
+ assertEquals(query.getParameterValue("endTime"),
bean.getEndTimestamp());
+ assertEquals(query.getParameterValue("id"), bean.getId());
+
+ // UPDATE_BUNDLE_JOB_PAUSE_KICKOFF:
+ query =
BundleJobQueryExecutor.getInstance().getUpdateQuery(BundleJobQuery.UPDATE_BUNDLE_JOB_PAUSE_KICKOFF,
+ bean, em);
+ assertEquals(query.getParameterValue("pauseTime"),
bean.getPauseTimestamp());
+ assertEquals(query.getParameterValue("kickoffTime"),
bean.getKickoffTimestamp());
+ assertEquals(query.getParameterValue("id"), bean.getId());
+
+ em.close();
+ }
+
+ public void testExecuteUpdate() throws Exception {
+ BundleJobBean bean = addRecordToBundleJobTable(Job.Status.PREP, false);
+ bean.setStatus(org.apache.oozie.client.BundleJob.Status.RUNNING);
+
BundleJobQueryExecutor.getInstance().executeUpdate(BundleJobQuery.UPDATE_BUNDLE_JOB_STATUS,
bean);
+ BundleJobBean retBean =
BundleJobQueryExecutor.getInstance().get(BundleJobQuery.GET_BUNDLE_JOB,
bean.getId());
+ assertEquals(retBean.getStatus(),
org.apache.oozie.client.BundleJob.Status.RUNNING);
+ }
+
+ public void testGet() throws Exception {
+ BundleJobBean bean =
this.addRecordToBundleJobTable(Job.Status.RUNNING, false);
+ // GET_BUNDLE_JOB_ID_STATUS_PENDING_MODTIME
+ BundleJobBean retBean = BundleJobQueryExecutor.getInstance().get(
+ BundleJobQuery.GET_BUNDLE_JOB_ID_STATUS_PENDING_MODTIME,
bean.getId());
+ assertEquals(bean.getId(), retBean.getId());
+ assertEquals(bean.getStatusStr(), retBean.getStatusStr());
+ assertEquals(bean.getPending(), retBean.getPending());
+ assertEquals(bean.getLastModifiedTime().getTime(),
retBean.getLastModifiedTime().getTime());
+ // GET_BUNDLE_JOB_ID_JOBXML_CONF
+ retBean =
BundleJobQueryExecutor.getInstance().get(BundleJobQuery.GET_BUNDLE_JOB_ID_JOBXML_CONF,
bean.getId());
+ assertEquals(bean.getId(), retBean.getId());
+ assertEquals(bean.getJobXml(), retBean.getJobXml());
+ assertEquals(bean.getConf(), retBean.getConf());
+ // GET_BUNDLE_JOB_STATUS
+ retBean =
BundleJobQueryExecutor.getInstance().get(BundleJobQuery.GET_BUNDLE_JOB_STATUS,
bean.getId());
+ assertEquals(bean.getStatus(), retBean.getStatus());
+ assertEquals(bean.getId(), retBean.getId());
+ }
+
+ public void testGetList() throws Exception {
+ // TODO
+ }
+
+ public void testInsert() throws Exception {
+ BundleJobBean bean = new BundleJobBean();
+ bean.setId("test-oozie");
+ bean.setAppName("testApp");
+ bean.setUser("oozie");
+ BundleJobQueryExecutor.getInstance().insert(bean);
+ BundleJobBean retBean =
BundleJobQueryExecutor.getInstance().get(BundleJobQuery.GET_BUNDLE_JOB,
"test-oozie");
+ assertEquals(retBean.getAppName(), "testApp");
+ assertEquals(retBean.getUser(), "oozie");
+ }
+}
\ No newline at end of file
Modified: oozie/trunk/release-log.txt
URL:
http://svn.apache.org/viewvc/oozie/trunk/release-log.txt?rev=1527111&r1=1527110&r2=1527111&view=diff
==============================================================================
--- oozie/trunk/release-log.txt (original)
+++ oozie/trunk/release-log.txt Fri Sep 27 22:43:37 2013
@@ -1,5 +1,6 @@
-- Oozie 4.1.0 release (trunk - unreleased)
+OOZIE-1556 Change Bundle SELECT query to fetch only necessary columns and
consolidate JPA Executors (ryota)
OOZIE-1523 Create Windows versions of the shell scripts (dwann via rkanter)
OOZIE-1558 RAT Warning from BundleActionsGetJPAExecutor.java (rkanter)
OOZIE-1557 TestFsActionExecutor.testChmodWithGlob fails against Hadoop
2.1.x-beta (rkanter)