Author: kamrul
Date: Thu Mar 22 21:42:06 2012
New Revision: 1304083
URL: http://svn.apache.org/viewvc?rev=1304083&view=rev
Log:
Adding missed files
Added:
incubator/oozie/branches/branch-3.1/core/src/main/java/org/apache/oozie/executor/jpa/CoordActionUpdateStatusJPAExecutor.java
incubator/oozie/branches/branch-3.1/core/src/main/java/org/apache/oozie/executor/jpa/CoordJobGetActionsNotCompletedJPAExecutor.java
incubator/oozie/branches/branch-3.1/core/src/main/java/org/apache/oozie/executor/jpa/CoordJobGetActionsRunningJPAExecutor.java
incubator/oozie/branches/branch-3.1/core/src/main/java/org/apache/oozie/executor/jpa/CoordJobGetActionsStatusByPendingFalseJPAExecutor.java
incubator/oozie/branches/branch-3.1/core/src/main/java/org/apache/oozie/executor/jpa/CoordJobGetActionsSuspendedJPAExecutor.java
incubator/oozie/branches/branch-3.1/core/src/main/java/org/apache/oozie/executor/jpa/CoordJobGetPendingActionsCountJPAExecutor.java
incubator/oozie/branches/branch-3.1/core/src/test/java/org/apache/oozie/executor/jpa/TestCoordActionUpdateStatusJPAExecutor.java
incubator/oozie/branches/branch-3.1/core/src/test/java/org/apache/oozie/executor/jpa/TestCoordJobGetActionsNotCompletedJPAExecutor.java
incubator/oozie/branches/branch-3.1/core/src/test/java/org/apache/oozie/executor/jpa/TestCoordJobGetActionsRunningJPAExecutor.java
incubator/oozie/branches/branch-3.1/core/src/test/java/org/apache/oozie/executor/jpa/TestCoordJobGetActionsSuspendedJPAExecutor.java
incubator/oozie/branches/branch-3.1/core/src/test/java/org/apache/oozie/executor/jpa/TestCoordJobGetPendingActionsCountJPAExecutor.java
Added:
incubator/oozie/branches/branch-3.1/core/src/main/java/org/apache/oozie/executor/jpa/CoordActionUpdateStatusJPAExecutor.java
URL:
http://svn.apache.org/viewvc/incubator/oozie/branches/branch-3.1/core/src/main/java/org/apache/oozie/executor/jpa/CoordActionUpdateStatusJPAExecutor.java?rev=1304083&view=auto
==============================================================================
---
incubator/oozie/branches/branch-3.1/core/src/main/java/org/apache/oozie/executor/jpa/CoordActionUpdateStatusJPAExecutor.java
(added)
+++
incubator/oozie/branches/branch-3.1/core/src/main/java/org/apache/oozie/executor/jpa/CoordActionUpdateStatusJPAExecutor.java
Thu Mar 22 21:42:06 2012
@@ -0,0 +1,74 @@
+/**
+ * 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.util.Date;
+
+import javax.persistence.EntityManager;
+import javax.persistence.Query;
+
+import org.apache.oozie.CoordinatorActionBean;
+import org.apache.oozie.ErrorCode;
+import org.apache.oozie.util.ParamChecker;
+
+/**
+ * Updates the action status, pending status and last modified time of
CoordinatorAction and persists it.
+ * It executes SQL update query and return type is Void.
+ */
+public class CoordActionUpdateStatusJPAExecutor implements JPAExecutor<Void> {
+
+ private CoordinatorActionBean coordAction = null;
+
+ public CoordActionUpdateStatusJPAExecutor(CoordinatorActionBean
coordAction) {
+ ParamChecker.notNull(coordAction, "coordAction");
+ this.coordAction = coordAction;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
org.apache.oozie.executor.jpa.JPAExecutor#execute(javax.persistence.
+ * EntityManager)
+ */
+ @Override
+ public Void execute(EntityManager em) throws JPAExecutorException {
+ try {
+ Query q =
em.createNamedQuery("UPDATE_COORD_ACTION_STATUS_PENDING_TIME");
+ q.setParameter("id", coordAction.getId());
+ q.setParameter("status", coordAction.getStatus().toString());
+ q.setParameter("pending", coordAction.getPending());
+ q.setParameter("lastModifiedTime", new Date());
+ q.executeUpdate();
+ // Since the return type is Void, we have to return null
+ return null;
+ }
+ catch (Exception e) {
+ throw new JPAExecutorException(ErrorCode.E0603, e);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.oozie.executor.jpa.JPAExecutor#getName()
+ */
+ @Override
+ public String getName() {
+ return "CoordActionUpdateStatusJPAExecutor";
+ }
+}
Added:
incubator/oozie/branches/branch-3.1/core/src/main/java/org/apache/oozie/executor/jpa/CoordJobGetActionsNotCompletedJPAExecutor.java
URL:
http://svn.apache.org/viewvc/incubator/oozie/branches/branch-3.1/core/src/main/java/org/apache/oozie/executor/jpa/CoordJobGetActionsNotCompletedJPAExecutor.java?rev=1304083&view=auto
==============================================================================
---
incubator/oozie/branches/branch-3.1/core/src/main/java/org/apache/oozie/executor/jpa/CoordJobGetActionsNotCompletedJPAExecutor.java
(added)
+++
incubator/oozie/branches/branch-3.1/core/src/main/java/org/apache/oozie/executor/jpa/CoordJobGetActionsNotCompletedJPAExecutor.java
Thu Mar 22 21:42:06 2012
@@ -0,0 +1,96 @@
+/**
+ * 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.util.ArrayList;
+import java.util.List;
+
+import javax.persistence.EntityManager;
+import javax.persistence.Query;
+
+import org.apache.oozie.CoordinatorActionBean;
+import org.apache.oozie.ErrorCode;
+import org.apache.oozie.client.CoordinatorAction;
+import org.apache.oozie.util.ParamChecker;
+
+/**
+ * Load the Coordinator actions which are not completed for a given
Coordinator job
+ */
+public class CoordJobGetActionsNotCompletedJPAExecutor implements
JPAExecutor<List<CoordinatorActionBean>> {
+
+ private String coordJobId = null;
+
+ public CoordJobGetActionsNotCompletedJPAExecutor(String coordJobId) {
+ ParamChecker.notNull(coordJobId, "coordJobId");
+ this.coordJobId = coordJobId;
+ }
+
+ @Override
+ public String getName() {
+ return "CoordJobGetActionsNotCompletedJPAExecutor";
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public List<CoordinatorActionBean> execute(EntityManager em) throws
JPAExecutorException {
+ try {
+ List<CoordinatorActionBean> actionBeansList = new
ArrayList<CoordinatorActionBean>();
+ Query q = em.createNamedQuery("GET_COORD_ACTIONS_NOT_COMPLETED");
+ q.setParameter("jobId", coordJobId);
+ List<Object[]> objectArrList = q.getResultList();
+
+ for (Object[] arr : objectArrList) {
+ CoordinatorActionBean caa =
getBeanForCoordinatorActionFromArray(arr);
+ actionBeansList.add(caa);
+ }
+ return actionBeansList;
+ }
+ catch (Exception e) {
+ throw new JPAExecutorException(ErrorCode.E0603, e);
+ }
+ }
+
+ /*
+ * A Coordinator action bean is constructed from an array of objects.
+ * ActionId, status, pending and externalId of the Coordinator action are
+ * updated. If values of id, status and externalId fetched from db are
+ * null, they will be automatically initialized to default values of null
as
+ * they are Strings. If value of pending fetched from db is null, it will
be
+ * initialized with default value of 0 as it is a int.
+ */
+ private CoordinatorActionBean
getBeanForCoordinatorActionFromArray(Object[] arr) {
+ CoordinatorActionBean bean = new CoordinatorActionBean();
+ if (arr[0] != null) {
+ bean.setId((String) arr[0]);
+ }
+ if (arr[1] != null) {
+ bean.setStatus(CoordinatorAction.Status.valueOf((String) arr[1]));
+ }
+ if (arr[2] != null) {
+ bean.setPending((Integer) arr[2]);
+ }
+ else{
+ bean.setPending(0);
+ }
+ if (arr[3] != null) {
+ bean.setExternalId((String) arr[3]);
+ }
+ return bean;
+ }
+
+}
Added:
incubator/oozie/branches/branch-3.1/core/src/main/java/org/apache/oozie/executor/jpa/CoordJobGetActionsRunningJPAExecutor.java
URL:
http://svn.apache.org/viewvc/incubator/oozie/branches/branch-3.1/core/src/main/java/org/apache/oozie/executor/jpa/CoordJobGetActionsRunningJPAExecutor.java?rev=1304083&view=auto
==============================================================================
---
incubator/oozie/branches/branch-3.1/core/src/main/java/org/apache/oozie/executor/jpa/CoordJobGetActionsRunningJPAExecutor.java
(added)
+++
incubator/oozie/branches/branch-3.1/core/src/main/java/org/apache/oozie/executor/jpa/CoordJobGetActionsRunningJPAExecutor.java
Thu Mar 22 21:42:06 2012
@@ -0,0 +1,94 @@
+/**
+ * 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.util.ArrayList;
+import java.util.List;
+
+import javax.persistence.EntityManager;
+import javax.persistence.Query;
+
+import org.apache.oozie.CoordinatorActionBean;
+import org.apache.oozie.CoordinatorJobBean;
+import org.apache.oozie.ErrorCode;
+import org.apache.oozie.client.CoordinatorAction;
+import org.apache.oozie.client.Job.Status;
+import org.apache.oozie.util.ParamChecker;
+
+/**
+ * Load the running Coordinator actions for a given Coordinator job
+ */
+public class CoordJobGetActionsRunningJPAExecutor implements
JPAExecutor<List<CoordinatorActionBean>> {
+
+ private String coordJobId = null;
+
+ public CoordJobGetActionsRunningJPAExecutor(String coordJobId) {
+ ParamChecker.notNull(coordJobId, "coordJobId");
+ this.coordJobId = coordJobId;
+ }
+
+ @Override
+ public String getName() {
+ return "CoordJobGetActionsRunningJPAExecutor";
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public List<CoordinatorActionBean> execute(EntityManager em) throws
JPAExecutorException {
+ try {
+ List<CoordinatorActionBean> actionBeansList = new
ArrayList<CoordinatorActionBean>();
+ Query q = em.createNamedQuery("GET_COORD_ACTIONS_RUNNING");
+ q.setParameter("jobId", coordJobId);
+ List<Object[]> objectArrList = q.getResultList();
+ for (Object[] arr : objectArrList) {
+ CoordinatorActionBean caa =
getBeanForCoordinatorActionFromArray(arr);
+ actionBeansList.add(caa);
+ }
+ return actionBeansList;
+ }
+ catch (Exception e) {
+ throw new JPAExecutorException(ErrorCode.E0603, e);
+ }
+ }
+
+ /*
+ * A Coordinator action bean is constructed from an array of objects.
+ * ActionId, status, pending and externalId of the Coordinator action are
+ * updated. If values of id, status and externalId fetched from db are
+ * null, they will be automatically initialized to default values of null
as
+ * they are Strings. If value of pending fetched from db is null, it will
be
+ * initialized with default value of 0 as it is a int.
+ */
+ private CoordinatorActionBean
getBeanForCoordinatorActionFromArray(Object[] arr) {
+ CoordinatorActionBean bean = new CoordinatorActionBean();
+ if (arr[0] != null) {
+ bean.setId((String) arr[0]);
+ }
+ if (arr[1] != null) {
+ bean.setStatus(CoordinatorAction.Status.valueOf((String) arr[1]));
+ }
+ if (arr[2] != null) {
+ bean.setPending((Integer) arr[2]);
+ }
+ if (arr[3] != null) {
+ bean.setExternalId((String) arr[3]);
+ }
+ return bean;
+ }
+
+}
Added:
incubator/oozie/branches/branch-3.1/core/src/main/java/org/apache/oozie/executor/jpa/CoordJobGetActionsStatusByPendingFalseJPAExecutor.java
URL:
http://svn.apache.org/viewvc/incubator/oozie/branches/branch-3.1/core/src/main/java/org/apache/oozie/executor/jpa/CoordJobGetActionsStatusByPendingFalseJPAExecutor.java?rev=1304083&view=auto
==============================================================================
---
incubator/oozie/branches/branch-3.1/core/src/main/java/org/apache/oozie/executor/jpa/CoordJobGetActionsStatusByPendingFalseJPAExecutor.java
(added)
+++
incubator/oozie/branches/branch-3.1/core/src/main/java/org/apache/oozie/executor/jpa/CoordJobGetActionsStatusByPendingFalseJPAExecutor.java
Thu Mar 22 21:42:06 2012
@@ -0,0 +1,64 @@
+/**
+ * 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.util.ArrayList;
+import java.util.List;
+
+import javax.persistence.EntityManager;
+import javax.persistence.Query;
+
+import org.apache.oozie.ErrorCode;
+import org.apache.oozie.client.CoordinatorAction;
+import org.apache.oozie.util.ParamChecker;
+
+/**
+ * Get the status of Coordinator actions which are not pending for a given
Coordinator job
+ */
+public class CoordJobGetActionsStatusByPendingFalseJPAExecutor implements
JPAExecutor<List<CoordinatorAction.Status>> {
+
+ private String coordJobId = null;
+
+ public CoordJobGetActionsStatusByPendingFalseJPAExecutor(String
coordJobId) {
+ ParamChecker.notNull(coordJobId, "coordJobId");
+ this.coordJobId = coordJobId;
+ }
+
+ @Override
+ public String getName() {
+ return "CoordJobGetActionsStatusByPendingFalseJPAExecutor";
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public List<CoordinatorAction.Status> execute(EntityManager em) throws
JPAExecutorException {
+ try {
+ Query q =
em.createNamedQuery("GET_COORD_ACTIONS_STATUS_BY_PENDING_FALSE");
+ q.setParameter("jobId", coordJobId);
+ List<String> coordStatusResultList = q.getResultList();
+ List<CoordinatorAction.Status> coordStatus = new
ArrayList<CoordinatorAction.Status>();
+ for (String a : coordStatusResultList) {
+ coordStatus.add(CoordinatorAction.Status.valueOf(a));
+ }
+ return coordStatus;
+ }
+ catch (Exception e) {
+ throw new JPAExecutorException(ErrorCode.E0603, e);
+ }
+ }
+}
Added:
incubator/oozie/branches/branch-3.1/core/src/main/java/org/apache/oozie/executor/jpa/CoordJobGetActionsSuspendedJPAExecutor.java
URL:
http://svn.apache.org/viewvc/incubator/oozie/branches/branch-3.1/core/src/main/java/org/apache/oozie/executor/jpa/CoordJobGetActionsSuspendedJPAExecutor.java?rev=1304083&view=auto
==============================================================================
---
incubator/oozie/branches/branch-3.1/core/src/main/java/org/apache/oozie/executor/jpa/CoordJobGetActionsSuspendedJPAExecutor.java
(added)
+++
incubator/oozie/branches/branch-3.1/core/src/main/java/org/apache/oozie/executor/jpa/CoordJobGetActionsSuspendedJPAExecutor.java
Thu Mar 22 21:42:06 2012
@@ -0,0 +1,95 @@
+/**
+ * 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.util.ArrayList;
+import java.util.List;
+
+import javax.persistence.EntityManager;
+import javax.persistence.Query;
+
+import org.apache.oozie.CoordinatorActionBean;
+import org.apache.oozie.CoordinatorJobBean;
+import org.apache.oozie.ErrorCode;
+import org.apache.oozie.client.CoordinatorAction;
+import org.apache.oozie.client.Job.Status;
+import org.apache.oozie.util.ParamChecker;
+
+/**
+ * Load the suspended Coordinator actions of a given Coordinator job
+ */
+public class CoordJobGetActionsSuspendedJPAExecutor implements
JPAExecutor<List<CoordinatorActionBean>> {
+
+ private String coordJobId = null;
+
+ public CoordJobGetActionsSuspendedJPAExecutor(String coordJobId) {
+ ParamChecker.notNull(coordJobId, "coordJobId");
+ this.coordJobId = coordJobId;
+ }
+
+ @Override
+ public String getName() {
+ return "CoordJobGetActionsSuspendedJPAExecutor";
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public List<CoordinatorActionBean> execute(EntityManager em) throws
JPAExecutorException {
+ try {
+ List<CoordinatorActionBean> actionBeansList = new
ArrayList<CoordinatorActionBean>();
+ Query q = em.createNamedQuery("GET_COORD_ACTIONS_SUSPENDED");
+ q.setParameter("jobId", coordJobId);
+ List<Object[]> objectArrList = q.getResultList();
+
+ for (Object[] arr : objectArrList) {
+ CoordinatorActionBean caa =
getBeanForCoordinatorActionFromArray(arr);
+ actionBeansList.add(caa);
+ }
+ return actionBeansList;
+ }
+ catch (Exception e) {
+ throw new JPAExecutorException(ErrorCode.E0603, e);
+ }
+ }
+
+ /*
+ * A Coordinator action bean is constructed from an array of objects.
+ * ActionId, status, pending and externalId of the Coordinator action are
+ * updated. If values of id, status and externalId fetched from db are
+ * null, they will be automatically initialized to default values of null
as
+ * they are Strings. If value of pending fetched from db is null, it will
be
+ * initialized with default value of 0 as it is a int.
+ */
+ private CoordinatorActionBean getBeanForCoordinatorActionFromArray(Object[]
arr) {
+ CoordinatorActionBean bean = new CoordinatorActionBean();
+ if (arr[0] != null) {
+ bean.setId((String) arr[0]);
+ }
+ if (arr[1] != null) {
+ bean.setStatus(CoordinatorAction.Status.valueOf((String) arr[1]));
+ }
+ if (arr[2] != null) {
+ bean.setPending((Integer) arr[2]);
+ }
+ if (arr[3] != null) {
+ bean.setExternalId((String) arr[3]);
+ }
+ return bean;
+ }
+
+}
Added:
incubator/oozie/branches/branch-3.1/core/src/main/java/org/apache/oozie/executor/jpa/CoordJobGetPendingActionsCountJPAExecutor.java
URL:
http://svn.apache.org/viewvc/incubator/oozie/branches/branch-3.1/core/src/main/java/org/apache/oozie/executor/jpa/CoordJobGetPendingActionsCountJPAExecutor.java?rev=1304083&view=auto
==============================================================================
---
incubator/oozie/branches/branch-3.1/core/src/main/java/org/apache/oozie/executor/jpa/CoordJobGetPendingActionsCountJPAExecutor.java
(added)
+++
incubator/oozie/branches/branch-3.1/core/src/main/java/org/apache/oozie/executor/jpa/CoordJobGetPendingActionsCountJPAExecutor.java
Thu Mar 22 21:42:06 2012
@@ -0,0 +1,56 @@
+/**
+ * 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.ErrorCode;
+import org.apache.oozie.util.ParamChecker;
+
+/**
+ * Get the count of pending coordinator actions of a coordinator job
+ */
+public class CoordJobGetPendingActionsCountJPAExecutor implements
JPAExecutor<Integer> {
+
+ private String coordJobId = null;
+
+ public CoordJobGetPendingActionsCountJPAExecutor(String coordJobId) {
+ ParamChecker.notNull(coordJobId, "coordJobId");
+ this.coordJobId = coordJobId;
+ }
+
+ @Override
+ public String getName() {
+ return "CoordJobGetPendingActionsCountJPAExecutor";
+ }
+
+ @Override
+ public Integer execute(EntityManager em) throws JPAExecutorException {
+ try {
+ Query q = em.createNamedQuery("GET_COORD_ACTIONS_PENDING_COUNT");
+ q.setParameter("jobId", coordJobId);
+ Long count = (Long) q.getSingleResult();
+ return Integer.valueOf(count.intValue());
+ }
+ catch (Exception e) {
+ throw new JPAExecutorException(ErrorCode.E0603, e);
+ }
+ }
+
+}
Added:
incubator/oozie/branches/branch-3.1/core/src/test/java/org/apache/oozie/executor/jpa/TestCoordActionUpdateStatusJPAExecutor.java
URL:
http://svn.apache.org/viewvc/incubator/oozie/branches/branch-3.1/core/src/test/java/org/apache/oozie/executor/jpa/TestCoordActionUpdateStatusJPAExecutor.java?rev=1304083&view=auto
==============================================================================
---
incubator/oozie/branches/branch-3.1/core/src/test/java/org/apache/oozie/executor/jpa/TestCoordActionUpdateStatusJPAExecutor.java
(added)
+++
incubator/oozie/branches/branch-3.1/core/src/test/java/org/apache/oozie/executor/jpa/TestCoordActionUpdateStatusJPAExecutor.java
Thu Mar 22 21:42:06 2012
@@ -0,0 +1,77 @@
+/**
+ * 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 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.local.LocalOozie;
+import org.apache.oozie.service.JPAService;
+import org.apache.oozie.service.Services;
+import org.apache.oozie.test.XDataTestCase;
+
+public class TestCoordActionUpdateStatusJPAExecutor extends XDataTestCase {
+ Services services;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ services = new Services();
+ services.init();
+ cleanUpDBTables();
+ LocalOozie.start();
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ LocalOozie.stop();
+ services.destroy();
+ super.tearDown();
+ }
+
+ public void testCoordActionUpdateStatus() throws Exception {
+ int actionNum = 1;
+ CoordinatorJobBean job =
addRecordToCoordJobTable(CoordinatorJob.Status.RUNNING, false, false);
+ CoordinatorActionBean action =
addRecordToCoordActionTable(job.getId(), actionNum,
+ CoordinatorAction.Status.RUNNING, "coord-action-get.xml", 0);
+ _testCoordActionUpdateStatus(action);
+ }
+
+ private void _testCoordActionUpdateStatus(CoordinatorActionBean action)
throws Exception {
+ JPAService jpaService = Services.get().get(JPAService.class);
+ assertNotNull(jpaService);
+ // Update the status of action to "SUCCEEDED" from "RUNNING"
+ action.setStatus(CoordinatorAction.Status.SUCCEEDED);
+ // Update pending to 1 from 0
+ action.setPending(1);
+
+ // Call the JPAUpdate executor to execute the Update command
+ CoordActionUpdateStatusJPAExecutor coordUpdCmd = new
CoordActionUpdateStatusJPAExecutor(action);
+ jpaService.execute(coordUpdCmd);
+
+ CoordActionGetJPAExecutor coordGetCmd = new
CoordActionGetJPAExecutor(action.getId());
+ CoordinatorActionBean newAction = jpaService.execute(coordGetCmd);
+
+ assertNotNull(newAction);
+ // Check for expected values
+ assertEquals(newAction.getStatus(),
CoordinatorAction.Status.SUCCEEDED);
+ assertEquals(newAction.getPending(), 1);
+ }
+
+}
Added:
incubator/oozie/branches/branch-3.1/core/src/test/java/org/apache/oozie/executor/jpa/TestCoordJobGetActionsNotCompletedJPAExecutor.java
URL:
http://svn.apache.org/viewvc/incubator/oozie/branches/branch-3.1/core/src/test/java/org/apache/oozie/executor/jpa/TestCoordJobGetActionsNotCompletedJPAExecutor.java?rev=1304083&view=auto
==============================================================================
---
incubator/oozie/branches/branch-3.1/core/src/test/java/org/apache/oozie/executor/jpa/TestCoordJobGetActionsNotCompletedJPAExecutor.java
(added)
+++
incubator/oozie/branches/branch-3.1/core/src/test/java/org/apache/oozie/executor/jpa/TestCoordJobGetActionsNotCompletedJPAExecutor.java
Thu Mar 22 21:42:06 2012
@@ -0,0 +1,108 @@
+/**
+ * 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.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.local.LocalOozie;
+import org.apache.oozie.service.JPAService;
+import org.apache.oozie.service.Services;
+import org.apache.oozie.test.XDataTestCase;
+
+public class TestCoordJobGetActionsNotCompletedJPAExecutor extends
XDataTestCase {
+ Services services;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ services = new Services();
+ services.init();
+ cleanUpDBTables();
+ LocalOozie.start();
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ LocalOozie.stop();
+ services.destroy();
+ super.tearDown();
+ }
+
+ /*
+ * Add a Coordinator action with status WAITING and check for expected
column values
+ */
+ public void testCoordActionsNotCompletetedForColumnValues() throws
Exception {
+ int actionNum = 1;
+ CoordinatorJobBean job =
addRecordToCoordJobTable(CoordinatorJob.Status.RUNNING, false, false);
+ String jobId = job.getId();
+ CoordinatorActionBean action = addRecordToCoordActionTable(jobId,
actionNum++,
+ CoordinatorAction.Status.WAITING, "coord-action-get.xml", 0);
+
+ _testCoordActionForCorrectColumnValues(jobId, action.getId(),
action.getStatus(), action.getPending());
+
+ }
+
+ /*
+ * Add 2 Coordinator actions which are not completed (status as RUNNING
and WAITING) and add 2 Coordinator actions
+ * which are completed (status as FAILED and KILLED). Then check for
expected number of actions retrieved.
+ */
+ public void testCoordActionsNotCompletetedForSize() throws Exception {
+ int actionNum = 1;
+ CoordinatorJobBean job =
addRecordToCoordJobTable(CoordinatorJob.Status.RUNNING, false, false);
+ String jobId = job.getId();
+ addRecordToCoordActionTable(jobId, actionNum++,
CoordinatorAction.Status.RUNNING, "coord-action-get.xml", 0);
+ addRecordToCoordActionTable(jobId, actionNum++,
CoordinatorAction.Status.WAITING, "coord-action-get.xml", 0);
+ addRecordToCoordActionTable(jobId, actionNum++,
CoordinatorAction.Status.FAILED, "coord-action-get.xml", 0);
+ addRecordToCoordActionTable(jobId, actionNum++,
CoordinatorAction.Status.KILLED, "coord-action-get.xml", 0);
+
+ _testCoordActionsNotCompletedSize(jobId, 2);
+ }
+
+
+ // test sql projection operator
+ private void _testCoordActionForCorrectColumnValues(String jobId, String
actionId, CoordinatorAction.Status status,
+ int pending) throws Exception {
+ JPAService jpaService = Services.get().get(JPAService.class);
+ assertNotNull(jpaService);
+ // Call JPAExecutor to get actions which are not completed
+ CoordJobGetActionsNotCompletedJPAExecutor actionGetCmd = new
CoordJobGetActionsNotCompletedJPAExecutor(jobId);
+ List<CoordinatorActionBean> actionList =
jpaService.execute(actionGetCmd);
+ // check for expected column values
+ CoordinatorActionBean action = actionList.get(0);
+ assertEquals(action.getId(), actionId);
+ assertEquals(action.getStatus(), status);
+ assertEquals(action.getPending(), pending);
+ }
+
+ // test sql selection operator
+ private void _testCoordActionsNotCompletedSize(String jobId, int
expectedSize) throws Exception {
+ JPAService jpaService = Services.get().get(JPAService.class);
+ assertNotNull(jpaService);
+ // Call JPAExecutor to get actions which are not completed
+ CoordJobGetActionsNotCompletedJPAExecutor actionGetCmd = new
CoordJobGetActionsNotCompletedJPAExecutor(jobId);
+ List<CoordinatorActionBean> actionList =
jpaService.execute(actionGetCmd);
+ // As two actions are not completed, expected result set is of size 2
+ assertEquals(actionList.size(), expectedSize);
+
+ }
+
+}
Added:
incubator/oozie/branches/branch-3.1/core/src/test/java/org/apache/oozie/executor/jpa/TestCoordJobGetActionsRunningJPAExecutor.java
URL:
http://svn.apache.org/viewvc/incubator/oozie/branches/branch-3.1/core/src/test/java/org/apache/oozie/executor/jpa/TestCoordJobGetActionsRunningJPAExecutor.java?rev=1304083&view=auto
==============================================================================
---
incubator/oozie/branches/branch-3.1/core/src/test/java/org/apache/oozie/executor/jpa/TestCoordJobGetActionsRunningJPAExecutor.java
(added)
+++
incubator/oozie/branches/branch-3.1/core/src/test/java/org/apache/oozie/executor/jpa/TestCoordJobGetActionsRunningJPAExecutor.java
Thu Mar 22 21:42:06 2012
@@ -0,0 +1,107 @@
+/**
+ * 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.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.local.LocalOozie;
+import org.apache.oozie.service.JPAService;
+import org.apache.oozie.service.Services;
+import org.apache.oozie.test.XDataTestCase;
+
+public class TestCoordJobGetActionsRunningJPAExecutor extends XDataTestCase {
+ Services services;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ services = new Services();
+ services.init();
+ cleanUpDBTables();
+ LocalOozie.start();
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ LocalOozie.stop();
+ services.destroy();
+ super.tearDown();
+ }
+
+ /*
+ * Add a Coordinator action with status RUNNING and check for expected
column values
+ */
+ public void testCoordActionsRunningForColumnValues() throws Exception {
+ int actionNum = 1;
+ CoordinatorJobBean job =
addRecordToCoordJobTable(CoordinatorJob.Status.RUNNING, false, false);
+ String jobId = job.getId();
+ CoordinatorActionBean action = addRecordToCoordActionTable(jobId,
actionNum++,
+ CoordinatorAction.Status.RUNNING, "coord-action-get.xml", 0);
+
+ _testCoordActionForCorrectColumnValues(jobId, action.getId(),
action.getStatus(), action.getPending());
+ }
+
+ /*
+ * Add 2 Coordinator actions with status RUNNING, 1 action with status
FAILED and 1 with KILLED. Check for expected
+ * number of actions retrieved
+ */
+ public void testCoordActionsRunningForSize() throws Exception {
+ int actionNum = 1;
+ CoordinatorJobBean job =
addRecordToCoordJobTable(CoordinatorJob.Status.RUNNING, false, false);
+ String jobId = job.getId();
+ addRecordToCoordActionTable(jobId, actionNum++,
CoordinatorAction.Status.RUNNING, "coord-action-get.xml", 0);
+ addRecordToCoordActionTable(jobId, actionNum++,
CoordinatorAction.Status.RUNNING, "coord-action-get.xml", 0);
+ addRecordToCoordActionTable(jobId, actionNum++,
CoordinatorAction.Status.FAILED, "coord-action-get.xml", 0);
+ addRecordToCoordActionTable(jobId, actionNum++,
CoordinatorAction.Status.KILLED, "coord-action-get.xml", 0);
+
+ _testCoordActionsRunningSize(jobId, 2);
+ }
+
+
+ // test sql projection operator
+ private void _testCoordActionForCorrectColumnValues(String jobId, String
actionId, CoordinatorAction.Status status,
+ int pending) throws Exception {
+ JPAService jpaService = Services.get().get(JPAService.class);
+ assertNotNull(jpaService);
+ // Call JPAExecutor to get actions which are running
+ CoordJobGetActionsRunningJPAExecutor actionGetCmd = new
CoordJobGetActionsRunningJPAExecutor(jobId);
+ List<CoordinatorActionBean> actionList =
jpaService.execute(actionGetCmd);
+ // check for expected column values
+ CoordinatorActionBean action = actionList.get(0);
+ assertEquals(action.getId(), actionId);
+ assertEquals(action.getStatus(), status);
+ assertEquals(action.getPending(), pending);
+ }
+
+ // test sql selection operator
+ private void _testCoordActionsRunningSize(String jobId, int expectedSize)
throws Exception {
+ JPAService jpaService = Services.get().get(JPAService.class);
+ assertNotNull(jpaService);
+ // Call JPAExecutor to get actions which are running
+ CoordJobGetActionsRunningJPAExecutor actionGetCmd = new
CoordJobGetActionsRunningJPAExecutor(jobId);
+ List<CoordinatorActionBean> actionList =
jpaService.execute(actionGetCmd);
+ // As two actions are running, expected result set is of size 2
+ assertEquals(actionList.size(), expectedSize);
+
+ }
+
+}
Added:
incubator/oozie/branches/branch-3.1/core/src/test/java/org/apache/oozie/executor/jpa/TestCoordJobGetActionsSuspendedJPAExecutor.java
URL:
http://svn.apache.org/viewvc/incubator/oozie/branches/branch-3.1/core/src/test/java/org/apache/oozie/executor/jpa/TestCoordJobGetActionsSuspendedJPAExecutor.java?rev=1304083&view=auto
==============================================================================
---
incubator/oozie/branches/branch-3.1/core/src/test/java/org/apache/oozie/executor/jpa/TestCoordJobGetActionsSuspendedJPAExecutor.java
(added)
+++
incubator/oozie/branches/branch-3.1/core/src/test/java/org/apache/oozie/executor/jpa/TestCoordJobGetActionsSuspendedJPAExecutor.java
Thu Mar 22 21:42:06 2012
@@ -0,0 +1,107 @@
+/**
+ * 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.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.local.LocalOozie;
+import org.apache.oozie.service.JPAService;
+import org.apache.oozie.service.Services;
+import org.apache.oozie.test.XDataTestCase;
+
+public class TestCoordJobGetActionsSuspendedJPAExecutor extends XDataTestCase {
+ Services services;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ services = new Services();
+ services.init();
+ cleanUpDBTables();
+ LocalOozie.start();
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ LocalOozie.stop();
+ services.destroy();
+ super.tearDown();
+ }
+
+ /*
+ * Add a Coordinator action with status SUSPENDED and check for expected
column values
+ */
+ public void testCoordActionsSuspendedForColumnValues() throws Exception {
+ int actionNum = 1;
+ CoordinatorJobBean job =
addRecordToCoordJobTable(CoordinatorJob.Status.RUNNING, false, false);
+ String jobId = job.getId();
+ CoordinatorActionBean action = addRecordToCoordActionTable(jobId,
actionNum++, CoordinatorAction.Status.SUSPENDED,
+ "coord-action-get.xml", 0);
+
+ _testCoordActionsForCorrectColumnValues(jobId, action.getId(),
action.getStatus(), action.getPending());
+ }
+
+ /*
+ * Add 2 Coordinator actions with status as SUSPENDED, 1 Coordinator
action with status FAILED and 1
+ * with KILLED. Then check for expected number of actions retrieved
+ */
+ public void testCoordActionsSuspendedForSize() throws Exception{
+ int actionNum = 1;
+ CoordinatorJobBean job =
addRecordToCoordJobTable(CoordinatorJob.Status.RUNNING, false, false);
+ String jobId = job.getId();
+ addRecordToCoordActionTable(jobId, actionNum++,
CoordinatorAction.Status.SUSPENDED, "coord-action-get.xml", 0);
+ addRecordToCoordActionTable(jobId, actionNum++,
CoordinatorAction.Status.SUSPENDED, "coord-action-get.xml", 1);
+ addRecordToCoordActionTable(jobId, actionNum++,
CoordinatorAction.Status.FAILED, "coord-action-get.xml", 0);
+ addRecordToCoordActionTable(jobId, actionNum++,
CoordinatorAction.Status.KILLED, "coord-action-get.xml", 0);
+
+ _testCoordActionsSuspendedSize(jobId, 2);
+ }
+
+ // test sql projection operator
+ private void _testCoordActionsForCorrectColumnValues(String jobId, String
actionId, CoordinatorAction.Status status,
+ int pending) throws Exception {
+ JPAService jpaService = Services.get().get(JPAService.class);
+ assertNotNull(jpaService);
+ // Call JPAExecutor to get actions which are suspended
+ CoordJobGetActionsSuspendedJPAExecutor actionGetCmd = new
CoordJobGetActionsSuspendedJPAExecutor(jobId);
+ List<CoordinatorActionBean> actionList =
jpaService.execute(actionGetCmd);
+ // check for expected column values
+ CoordinatorActionBean action = actionList.get(0);
+ assertEquals(action.getId(), actionId);
+ assertEquals(action.getStatus(), status);
+ assertEquals(action.getPending(), pending);
+ }
+
+
+ // test sql selection operator
+ private void _testCoordActionsSuspendedSize(String jobId, int
expectedSize) throws Exception {
+ JPAService jpaService = Services.get().get(JPAService.class);
+ assertNotNull(jpaService);
+ // Call JPAExecutor to get actions which are suspended
+ CoordJobGetActionsSuspendedJPAExecutor actionGetCmd = new
CoordJobGetActionsSuspendedJPAExecutor(jobId);
+ List<CoordinatorActionBean> actionList =
jpaService.execute(actionGetCmd);
+ // As two actions are suspended, expected result set is of size 2
+ assertEquals(actionList.size(), expectedSize);
+
+ }
+
+}
Added:
incubator/oozie/branches/branch-3.1/core/src/test/java/org/apache/oozie/executor/jpa/TestCoordJobGetPendingActionsCountJPAExecutor.java
URL:
http://svn.apache.org/viewvc/incubator/oozie/branches/branch-3.1/core/src/test/java/org/apache/oozie/executor/jpa/TestCoordJobGetPendingActionsCountJPAExecutor.java?rev=1304083&view=auto
==============================================================================
---
incubator/oozie/branches/branch-3.1/core/src/test/java/org/apache/oozie/executor/jpa/TestCoordJobGetPendingActionsCountJPAExecutor.java
(added)
+++
incubator/oozie/branches/branch-3.1/core/src/test/java/org/apache/oozie/executor/jpa/TestCoordJobGetPendingActionsCountJPAExecutor.java
Thu Mar 22 21:42:06 2012
@@ -0,0 +1,70 @@
+/**
+ * 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 org.apache.oozie.CoordinatorJobBean;
+import org.apache.oozie.client.CoordinatorAction;
+import org.apache.oozie.client.CoordinatorJob;
+import org.apache.oozie.local.LocalOozie;
+import org.apache.oozie.service.JPAService;
+import org.apache.oozie.service.Services;
+import org.apache.oozie.test.XDataTestCase;
+
+public class TestCoordJobGetPendingActionsCountJPAExecutor extends
XDataTestCase {
+ Services services;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ services = new Services();
+ services.init();
+ cleanUpDBTables();
+ LocalOozie.start();
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ LocalOozie.stop();
+ services.destroy();
+ super.tearDown();
+ }
+
+ public void testCoordJobGetPendingActionsCount() throws Exception {
+ int actionNum = 1;
+ CoordinatorJobBean job =
addRecordToCoordJobTable(CoordinatorJob.Status.RUNNING, false, false);
+ String jobId = job.getId();
+ // Insert 2 coordinator actions with pending true and 1 coordinator
action with pending false
+ addRecordToCoordActionTable(jobId, actionNum++,
CoordinatorAction.Status.FAILED, "coord-action-get.xml", 1);
+ addRecordToCoordActionTable(jobId, actionNum++,
CoordinatorAction.Status.KILLED, "coord-action-get.xml", 1);
+ addRecordToCoordActionTable(jobId, actionNum++,
CoordinatorAction.Status.WAITING, "coord-action-get.xml", 0);
+
+ _testCoordActionsPendingCount(jobId, 2);
+ }
+
+ private void _testCoordActionsPendingCount(String jobId, int expectedSize)
throws Exception {
+ JPAService jpaService = Services.get().get(JPAService.class);
+ assertNotNull(jpaService);
+ // Call JPAExecutor to get actions which are pending
+ CoordJobGetPendingActionsCountJPAExecutor actionGetCmd = new
CoordJobGetPendingActionsCountJPAExecutor(jobId);
+ int pendingCount = jpaService.execute(actionGetCmd);
+ // As two actions are pending, expected count is 2
+ assertEquals(pendingCount, expectedSize);
+
+ }
+
+}