[jbpm-commits] JBoss JBPM SVN: r3895 - in jbpm3/trunk/modules/core/src: main/resources/org/jbpm/db and 1 other directories.
do-not-reply at jboss.org
do-not-reply at jboss.org
Tue Feb 17 02:46:31 EST 2009
Author: thomas.diesler at jboss.com
Date: 2009-02-17 02:46:30 -0500 (Tue, 17 Feb 2009)
New Revision: 3895
Removed:
jbpm3/trunk/modules/core/src/test/java/org/jbpm/db/JobSessionDbTest.java
Modified:
jbpm3/trunk/modules/core/src/main/java/org/jbpm/db/JobSession.java
jbpm3/trunk/modules/core/src/main/resources/org/jbpm/db/hibernate.queries.hbm.xml
Log:
[JBPM-2042] Rollback -r3882:3879
Modified: jbpm3/trunk/modules/core/src/main/java/org/jbpm/db/JobSession.java
===================================================================
--- jbpm3/trunk/modules/core/src/main/java/org/jbpm/db/JobSession.java 2009-02-16 17:22:34 UTC (rev 3894)
+++ jbpm3/trunk/modules/core/src/main/java/org/jbpm/db/JobSession.java 2009-02-17 07:46:30 UTC (rev 3895)
@@ -110,19 +110,6 @@
+ monitoredJobs, e);
}
}
-
- /**
- * get all failed jobs. Failed job have a retry count
- * of 0 and the occured exception set.
- */
- public List<Job> findFailedJobs() {
- try {
- Query query = session.getNamedQuery("JobSession.findFailedJobs");
- return CollectionUtil.checkList(query.list(), Job.class);
- } catch (Exception e) {
- throw new JbpmException("couldn't find failed jobs", e);
- }
- }
public void saveJob(Job job) {
try {
Modified: jbpm3/trunk/modules/core/src/main/resources/org/jbpm/db/hibernate.queries.hbm.xml
===================================================================
--- jbpm3/trunk/modules/core/src/main/resources/org/jbpm/db/hibernate.queries.hbm.xml 2009-02-16 17:22:34 UTC (rev 3894)
+++ jbpm3/trunk/modules/core/src/main/resources/org/jbpm/db/hibernate.queries.hbm.xml 2009-02-17 07:46:30 UTC (rev 3895)
@@ -377,14 +377,6 @@
where job.token = :token
]]>
</query>
-
- <query name="JobSession.findFailedJobs">
- <![CDATA[
- select job
- from org.jbpm.job.Job as job
- where job.retries=0 and job.exception is not null
- ]]>
- </query>
<query name="JobSession.findJobsWithOverdueLockTime">
<![CDATA[
Deleted: jbpm3/trunk/modules/core/src/test/java/org/jbpm/db/JobSessionDbTest.java
===================================================================
--- jbpm3/trunk/modules/core/src/test/java/org/jbpm/db/JobSessionDbTest.java 2009-02-16 17:22:34 UTC (rev 3894)
+++ jbpm3/trunk/modules/core/src/test/java/org/jbpm/db/JobSessionDbTest.java 2009-02-17 07:46:30 UTC (rev 3895)
@@ -1,112 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.db;
-
-import java.util.List;
-
-import org.hibernate.StaleObjectStateException;
-import org.jbpm.graph.def.ActionHandler;
-import org.jbpm.graph.def.ProcessDefinition;
-import org.jbpm.graph.exe.ExecutionContext;
-import org.jbpm.graph.exe.ProcessInstance;
-import org.jbpm.job.ExecuteNodeJob;
-import org.jbpm.job.Job;
-
-public class JobSessionDbTest extends AbstractDbTestCase {
-
- public static final int timeout = 60000;
-
- public static class FailingAction implements ActionHandler {
- public void execute(ExecutionContext executionContext) throws Exception
- {
- throw new RuntimeException("TEST-EXCEPTION");
- }
- }
-
- /**
- * Test case which generates a {@link Job} ({@link ExecuteNodeJob} via async=true)
- * which causes an excpetion. Afterwards it is checked if this job
- * is found by the getFailedJobs method
- */
- public void testLoadFailedJobs() throws Exception {
- String xml =
- "<process-definition name='TestJob'>"
- + " <start-state>"
- + " <transition to='async state' />"
- + " </start-state>"
- + " <node name='async state' async='true'>"
- + " <transition to='end'>"
- + " <action name='throw exception' class='org.jbpm.db.JobSessionDbTest$FailingAction' />"
- + " </transition>"
- + " </node>"
- + " <end-state name='end' />"
- + "</process-definition>";
-
- // create a process definition
- ProcessDefinition processDefinition = ProcessDefinition.parseXmlString(xml);
- // save it in the database
- graphSession.saveProcessDefinition(processDefinition);
-
- newTransaction();
-
- try {
- // start a new process instance and signal it
- ProcessInstance pi = jbpmContext.newProcessInstance("TestJob");
- pi.getRootToken().signal();
-
- newTransaction();
-
- // job is created now, but not yet executed
- assertEquals(1, getNbrOfJobsAvailable());
- assertEquals(0, jobSession.findFailedJobs().size());
-
- // start job executor wait for job to be executed
- // and failure is written to database
- startJobExecutor();
- long startTime = System.currentTimeMillis();
- while( jobSession.findFailedJobs().size() <= 0 ) {
- if (System.currentTimeMillis() - startTime > timeout) {
- fail("test execution exceeded treshold of " + timeout + " milliseconds");
- }
- Thread.sleep(500);
- }
- stopJobExecutor();
- List<Job> failedJobs = jobSession.findFailedJobs();
-
- // now the one job we have should be failed
- assertEquals(1, getNbrOfJobsAvailable());
- assertEquals(1, failedJobs.size());
-
- // and information is set on the job
- assertEquals(0, failedJobs.get(0).getRetries());
- assertNotNull(failedJobs.get(0).getException() + "==null",
- failedJobs.get(0).getException());
- assertTrue(failedJobs.get(0).getException() + " contains TEST-EXCEPTION",
- failedJobs.get(0).getException().indexOf("TEST-EXCEPTION")>0);
- }
- finally {
- newTransaction();
- // cleanup
- jbpmContext.getGraphSession().deleteProcessDefinition(processDefinition.getId());
- }
- }
-}
More information about the jbpm-commits
mailing list