Author: alex.guizar(a)jboss.com
Date: 2010-10-16 09:21:11 -0400 (Sat, 16 Oct 2010)
New Revision: 6763
Added:
jbpm3/branches/jbpm-3.2-soa/core/src/main/resources/org/jbpm/job/Timer.calendar.hbm.xml
jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/context/exe/LongIdVariableDbTest.java
jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/context/exe/StringIdVariableDbTest.java
jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/jbpm1776/BusinessTimeSubstractionTest.java
jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/jbpm2825/ProcessClassLoaderNoContextTest.java
jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/jbpm2908/AlternateConfigurationAction.java
jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/jbpm2958/
jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/jbpm2958/TimerCalendarTest.java
jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/context/exe/jbpm.cfg.xml
jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/graph/
jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/graph/node/
jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/graph/node/jbpm.cfg.xml
jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm2908/jbpm.cfg.xml
jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm2958/
jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm2958/gpd.xml
jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm2958/jbpm.cfg.xml
jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm2958/processdefinition.xml
jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm2958/saturday-business-calendar.properties
jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm2958/saturday-jbpm.cfg.xml
Removed:
jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/context/exe/CustomVariableLongIdDbTest.java
jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/context/exe/CustomVariableStringIdDbTest.java
jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/jbpm1776/JBPM1776Test.java
jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/jbpm2825/JBPM2825Test.java
jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/jbpm2908/ChangeJbpmConfigurationAction.java
jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm2908/jbpm-no-auto.cfg.xml
jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm2908/jbpm.cfg.xml
Modified:
jbpm3/branches/jbpm-3.2-soa/core/pom.xml
jbpm3/branches/jbpm-3.2-soa/core/scripts/antrun-config.xml
jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/JbpmConfiguration.java
jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/calendar/BusinessCalendar.java
jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/job/Timer.java
jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/persistence/db/DbPersistenceServiceFactory.java
jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/persistence/db/StaleObjectLogConfigurer.java
jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/scheduler/db/DbSchedulerService.java
jbpm3/branches/jbpm-3.2-soa/core/src/main/resources/org/jbpm/calendar/jbpm.business.calendar.properties
jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/calendar/BusinessCalendarTest.java
jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/context/exe/CustomLongClass.java
jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/context/exe/CustomStringClass.java
jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/graph/node/JoinDbTest.java
jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/jbpm2908/JBPM2908Test.java
jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/log4j.xml
jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm2908/processdefinition1.xml
Log:
JBPM-2958 save business calendar resource used to create timer
Modified: jbpm3/branches/jbpm-3.2-soa/core/pom.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/core/pom.xml 2010-10-16 02:10:32 UTC (rev 6762)
+++ jbpm3/branches/jbpm-3.2-soa/core/pom.xml 2010-10-16 13:21:11 UTC (rev 6763)
@@ -156,7 +156,7 @@
<executions>
<execution>
<id>gen-config</id>
- <phase>compile</phase>
+ <phase>process-resources</phase>
<goals>
<goal>run</goal>
</goals>
@@ -168,6 +168,21 @@
</tasks>
</configuration>
</execution>
+
+ <execution>
+ <id>gen-test-config</id>
+ <phase>process-test-resources</phase>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <configuration>
+ <tasks>
+ <property name="project.output.dir"
value="${project.build.outputDirectory}" />
+ <property name="project.test.output.dir"
value="${project.build.testOutputDirectory}" />
+ <ant antfile="scripts/antrun-config.xml"
target="gen-hibernate-test-config" />
+ </tasks>
+ </configuration>
+ </execution>
</executions>
</plugin>
</plugins>
@@ -195,85 +210,6 @@
</profile>
<!--
- Name: no-database
- Desc: Default Database Setup
- -->
- <profile>
- <id>no-database</id>
- <activation>
- <property>
- <name>!database</name>
- </property>
- </activation>
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-antrun-plugin</artifactId>
- <executions>
- <execution>
- <id>no-hibernate-auto-create</id>
- <phase>process-test-resources</phase>
- <goals>
- <goal>run</goal>
- </goals>
- <configuration>
- <tasks>
- <property name="project.output.dir"
- value="${project.build.outputDirectory}" />
- <property name="project.test.output.dir"
- value="${project.build.testOutputDirectory}" />
- <ant antfile="scripts/antrun-config.xml"
- target="gen-hibernate-config-no-auto" />
- </tasks>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- </profile>
-
- <!--
- Name: hsqldb
- Desc: Hypersonic Database Setup
- -->
- <profile>
- <id>hsqldb</id>
- <activation>
- <property>
- <name>database</name>
- <value>hsqldb</value>
- </property>
- </activation>
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-antrun-plugin</artifactId>
- <executions>
- <execution>
- <id>no-hibernate-auto-create</id>
- <phase>process-test-resources</phase>
- <goals>
- <goal>run</goal>
- </goals>
- <configuration>
- <tasks>
- <property name="project.output.dir"
- value="${project.build.outputDirectory}" />
- <property name="project.test.output.dir"
- value="${project.build.testOutputDirectory}" />
- <ant antfile="scripts/antrun-config.xml"
- target="gen-hibernate-config-no-auto" />
- </tasks>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- </profile>
-
- <!--
Name: db2
Desc: DB2 Test Exclusions
-->
Modified: jbpm3/branches/jbpm-3.2-soa/core/scripts/antrun-config.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/core/scripts/antrun-config.xml 2010-10-16 02:10:32 UTC
(rev 6762)
+++ jbpm3/branches/jbpm-3.2-soa/core/scripts/antrun-config.xml 2010-10-16 13:21:11 UTC
(rev 6763)
@@ -11,7 +11,7 @@
<property name="project.output.dir"
value="${basedir}/target/classes" />
<property name="project.test.output.dir"
value="${basedir}/target/classes" />
- <macrodef name="macro-disable">
+ <macrodef name="comment-out">
<attribute name="file" />
<attribute name="section" />
<sequential>
@@ -23,19 +23,6 @@
</sequential>
</macrodef>
- <macrodef name="macro-enable">
- <attribute name="file" />
- <attribute name="section" />
- <sequential>
- <replace file="@{file}">
- <replacefilter token="<!-- @{section} (begin) ==="
- value="<!-- @{section} (begin) -->" />
- <replacefilter token="==== @{section} (end) -->"
- value="<!-- @{section} (end) -->" />
- </replace>
- </sequential>
- </macrodef>
-
<macrodef name="cat-hibernate-config">
<attribute name="database" />
<sequential>
@@ -92,10 +79,24 @@
tofile="${project.output.dir}/hibernate.cfg.xml" />
</target>
- <target name="gen-hibernate-config-no-auto">
+ <target name="gen-hibernate-test-config">
<copy file="${project.output.dir}/hibernate.cfg.xml"
- tofile="${project.test.output.dir}/hibernate-no-auto.cfg.xml" />
- <macro-disable
file="${project.test.output.dir}/hibernate-no-auto.cfg.xml"
- section="Automatic schema creation" />
+ todir="${project.test.output.dir}/org/jbpm/graph/node" />
+ <replace
file="${project.test.output.dir}/org/jbpm/graph/node/hibernate.cfg.xml"
+ token="Join.hbm.xml" value="Join.lock.hbm.xml" />
+ <comment-out
file="${project.test.output.dir}/org/jbpm/graph/node/hibernate.cfg.xml"
+ section="Automatic schema creation" />
+
+ <copy file="${project.output.dir}/hibernate.cfg.xml"
+ todir="${project.test.output.dir}/org/jbpm/jbpm2908" />
+ <comment-out
file="${project.test.output.dir}/org/jbpm/jbpm2908/hibernate.cfg.xml"
+ section="Automatic schema creation" />
+
+ <copy file="${project.output.dir}/hibernate.cfg.xml"
+ todir="${project.test.output.dir}/org/jbpm/jbpm2958" />
+ <replace
file="${project.test.output.dir}/org/jbpm/jbpm2958/hibernate.cfg.xml"
+ token="Timer.hbm.xml" value="Timer.calendar.hbm.xml"
/>
+ <comment-out
file="${project.test.output.dir}/org/jbpm/jbpm2958/hibernate.cfg.xml"
+ section="Automatic schema creation" />
</target>
</project>
Modified: jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/JbpmConfiguration.java
===================================================================
---
jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/JbpmConfiguration.java 2010-10-16
02:10:32 UTC (rev 6762)
+++
jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/JbpmConfiguration.java 2010-10-16
13:21:11 UTC (rev 6763)
@@ -41,7 +41,6 @@
import org.jbpm.instantiation.ProcessClassLoaderFactory;
import org.jbpm.job.executor.JobExecutor;
import org.jbpm.persistence.db.DbPersistenceServiceFactory;
-import org.jbpm.persistence.db.StaleObjectLogConfigurer;
import org.jbpm.svc.ServiceFactory;
import org.jbpm.svc.Services;
import org.jbpm.util.ClassLoaderUtil;
@@ -358,21 +357,9 @@
objectFactoryImpl.addObjectInfo(new ValueInfo("jbpmConfiguration",
jbpmConfiguration));
objectFactoryImpl.addObjectInfo(new ValueInfo(OBJECT_NAME, jbpmConfiguration));
}
- // honor hide stale state exceptions setting
- if (getHideStaleObjectExceptions(objectFactory)) {
- StaleObjectLogConfigurer.hideStaleObjectExceptions();
- }
return jbpmConfiguration;
}
- private static boolean getHideStaleObjectExceptions(ObjectFactory objectFactory) {
- if (objectFactory.hasObject("jbpm.hide.stale.object.exceptions")) {
- Object hide =
objectFactory.createObject("jbpm.hide.stale.object.exceptions");
- if (Boolean.FALSE.equals(hide)) return false;
- }
- return true;
- }
-
public static JbpmConfiguration parseInputStream(InputStream inputStream) {
ObjectFactory objectFactory;
if (inputStream != null) {
Modified:
jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/calendar/BusinessCalendar.java
===================================================================
---
jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/calendar/BusinessCalendar.java 2010-10-16
02:10:32 UTC (rev 6762)
+++
jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/calendar/BusinessCalendar.java 2010-10-16
13:21:11 UTC (rev 6763)
@@ -30,7 +30,7 @@
import java.util.Map;
import java.util.Properties;
-import org.jbpm.JbpmConfiguration;
+import org.jbpm.JbpmConfiguration.Configs;
import org.jbpm.util.ClassLoaderUtil;
/**
@@ -40,47 +40,51 @@
private static final long serialVersionUID = 1L;
- private Day[] weekDays;
- private List holidays;
+ private final Day[] weekDays;
+ private final List holidays;
private static final Map propertiesByResource = new HashMap();
public static Properties getBusinessCalendarProperties() {
- String resource =
JbpmConfiguration.Configs.getString("resource.business.calendar");
+ String calendarResource = Configs.getString("resource.business.calendar");
+ return getBusinessCalendarProperties(calendarResource);
+ }
+
+ private static Properties getBusinessCalendarProperties(String calendarResource) {
synchronized (propertiesByResource) {
- Properties properties = (Properties) propertiesByResource.get(resource);
+ Properties properties = (Properties) propertiesByResource.get(calendarResource);
if (properties == null) {
- properties = ClassLoaderUtil.getProperties(resource);
- propertiesByResource.put(resource, properties);
+ properties = ClassLoaderUtil.getProperties(calendarResource);
+ propertiesByResource.put(calendarResource, properties);
}
return properties;
}
}
public BusinessCalendar() {
- // do not load properties during creation time!
- // see
http://community.jboss.org/message/404365
- // this(getBusinessCalendarProperties());
+ /*
+ * loading properties at construction time used to be bad, as business calendars were
kept
+ * in static attributes of persistent classes, resulting in the default configuration
being
+ * unduly loaded; however, business calendars are no longer static.
+ * see
http://community.jboss.org/message/404365
+ */
+ this(getBusinessCalendarProperties());
}
+ public BusinessCalendar(String calendarResource) {
+ this(getBusinessCalendarProperties(calendarResource));
+ }
+
public BusinessCalendar(Properties calendarProperties) {
weekDays = Day.parseWeekDays(calendarProperties, this);
holidays = Holiday.parseHolidays(calendarProperties, this);
}
public Day[] getWeekDays() {
- if (weekDays == null) {
- // lazy load properties if not set during creation
- weekDays = Day.parseWeekDays(getBusinessCalendarProperties(), this);
- }
return weekDays;
}
public List getHolidays() {
- if (holidays == null) {
- // lazy load properties if not set during creation
- holidays = Holiday.parseHolidays(getBusinessCalendarProperties(), this);
- }
return holidays;
}
Modified: jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/job/Timer.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/job/Timer.java 2010-10-16
02:10:32 UTC (rev 6762)
+++ jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/job/Timer.java 2010-10-16
13:21:11 UTC (rev 6763)
@@ -26,6 +26,7 @@
private String transitionName;
private Action action;
private GraphElement graphElement;
+ private String calendarResource;
public Timer() {
}
@@ -75,28 +76,23 @@
// if repeat is specified, reschedule the job
if (repeat != null) {
- // suppose that it took the timer runner thread a
- // very long time to execute the timers.
- // then the repeat action dueDate could already have passed.
- Duration interval = new Duration(repeat);
- long currentTime = System.currentTimeMillis();
+ // if a calendar resource is specified, use it to calculate repeat dates
+ //
https://jira.jboss.org/browse/JBPM-2958
+ BusinessCalendar businessCalendar = calendarResource == null ? new
BusinessCalendar()
+ : new BusinessCalendar(calendarResource);
- BusinessCalendar businessCalendar = new BusinessCalendar();
- Date repeatDate = getDueDate();
- do {
- repeatDate = businessCalendar.add(repeatDate, interval);
- } while (repeatDate.getTime() <= currentTime);
-
+ Date repeatDate = businessCalendar.add(getDueDate(), new Duration(repeat));
if (log.isDebugEnabled()) {
log.debug("scheduling " + this + " for repeat on " +
repeatDate);
}
setDueDate(repeatDate);
// unlock timer so that:
- // (a) any job executor thread can acquire it next time
- // (b) the engine knows it is not executing and can be deleted
- // see
https://jira.jboss.org/jira/browse/JBPM-2036
+ // (a) any job executor thread can acquire it the next time
+ // (b) the engine knows it is not executing and can be canceled
+ //
https://jira.jboss.org/jira/browse/JBPM-2036
setLockOwner(null);
+
return false;
}
@@ -157,5 +153,19 @@
this.action = action;
}
+ /**
+ * Gets the business calendar resource used for calculating repeat dates.
+ */
+ public String getCalendarResource() {
+ return calendarResource;
+ }
+
+ /**
+ * Sets the business calendar resource to use for calculating repeat dates.
+ */
+ public void setCalendarResource(String calendarResource) {
+ this.calendarResource = calendarResource;
+ }
+
private static final Log log = LogFactory.getLog(Timer.class);
}
Modified:
jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/persistence/db/DbPersistenceServiceFactory.java
===================================================================
---
jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/persistence/db/DbPersistenceServiceFactory.java 2010-10-16
02:10:32 UTC (rev 6762)
+++
jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/persistence/db/DbPersistenceServiceFactory.java 2010-10-16
13:21:11 UTC (rev 6763)
@@ -27,6 +27,7 @@
import org.apache.commons.logging.LogFactory;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;
+import org.hibernate.cfg.Environment;
import org.hibernate.tool.hbm2ddl.SchemaExport;
import org.jbpm.JbpmConfiguration;
import org.jbpm.db.JbpmSchema;
@@ -130,7 +131,7 @@
boolean getScript() {
boolean script = false;
- String showSql = getConfiguration().getProperty("hibernate.show_sql");
+ String showSql = getConfiguration().getProperty(Environment.SHOW_SQL);
if ("true".equalsIgnoreCase(showSql)) {
script = true;
}
Modified:
jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/persistence/db/StaleObjectLogConfigurer.java
===================================================================
---
jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/persistence/db/StaleObjectLogConfigurer.java 2010-10-16
02:10:32 UTC (rev 6762)
+++
jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/persistence/db/StaleObjectLogConfigurer.java 2010-10-16
13:21:11 UTC (rev 6763)
@@ -26,100 +26,21 @@
public class StaleObjectLogConfigurer {
- private static Log staleObjectExceptionsLog = LogFactory
- .getLog(StaleObjectLogConfigurer.class.getName() +
".staleObjectExceptions");
+ private static final Log log = LogFactory.getLog(StaleObjectLogConfigurer.class);
private StaleObjectLogConfigurer() {
// hide default constructor to prevent instantiation
}
public static Log getStaleObjectExceptionsLog() {
- return staleObjectExceptionsLog;
+ return log;
}
+ /**
+ * @deprecated to hide stale object exceptions, just set the log category threshold
above
+ * ERROR.
+ */
public static void hideStaleObjectExceptions() {
- Log log = LogFactory.getLog(StaleObjectLogConfigurer.class);
-
- // check whether stale state exceptions are already hidden
- if (staleObjectExceptionsLog instanceof LogWrapper) {
- if (log.isDebugEnabled()) {
- log.debug("stale object exceptions already hidden from logging");
- }
- return;
- }
-
- log.info("stale object exceptions will not be logged");
- staleObjectExceptionsLog = new LogWrapper(staleObjectExceptionsLog);
+ // nothing to do here
}
-
- private static class LogWrapper implements Log {
-
- private final Log delegate;
-
- LogWrapper(Log delegate) {
- this.delegate = delegate;
- }
-
- public void debug(Object arg0, Throwable arg1) {
- }
-
- public void debug(Object arg0) {
- }
-
- public void error(Object arg0, Throwable arg1) {
- }
-
- public void error(Object arg0) {
- }
-
- public void info(Object arg0, Throwable arg1) {
- }
-
- public void info(Object arg0) {
- }
-
- public void trace(Object arg0, Throwable arg1) {
- }
-
- public void trace(Object arg0) {
- }
-
- public void warn(Object arg0, Throwable arg1) {
- }
-
- public void warn(Object arg0) {
- }
-
- public void fatal(Object arg0, Throwable arg1) {
- delegate.fatal(arg0, arg1);
- }
-
- public void fatal(Object arg0) {
- delegate.fatal(arg0);
- }
-
- public boolean isDebugEnabled() {
- return false;
- }
-
- public boolean isErrorEnabled() {
- return false;
- }
-
- public boolean isFatalEnabled() {
- return delegate.isFatalEnabled();
- }
-
- public boolean isInfoEnabled() {
- return false;
- }
-
- public boolean isTraceEnabled() {
- return false;
- }
-
- public boolean isWarnEnabled() {
- return false;
- }
- }
}
Modified:
jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/scheduler/db/DbSchedulerService.java
===================================================================
---
jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/scheduler/db/DbSchedulerService.java 2010-10-16
02:10:32 UTC (rev 6762)
+++
jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/scheduler/db/DbSchedulerService.java 2010-10-16
13:21:11 UTC (rev 6763)
@@ -23,7 +23,7 @@
import org.jbpm.JbpmContext;
import org.jbpm.JbpmException;
-import org.jbpm.db.JobSession;
+import org.jbpm.configuration.ObjectFactory;
import org.jbpm.graph.exe.ProcessInstance;
import org.jbpm.graph.exe.Token;
import org.jbpm.job.Timer;
@@ -34,39 +34,45 @@
private static final long serialVersionUID = 1L;
- private final JobSession jobSession;
- private final JobExecutor jobExecutor;
+ private final JbpmContext jbpmContext;
private boolean hasProducedJobs;
public DbSchedulerService() {
- JbpmContext jbpmContext = JbpmContext.getCurrentJbpmContext();
+ jbpmContext = JbpmContext.getCurrentJbpmContext();
if (jbpmContext == null) throw new JbpmException("no active jbpm
context");
-
- this.jobSession = jbpmContext.getJobSession();
- this.jobExecutor = jbpmContext.getJbpmConfiguration().getJobExecutor();
}
- public void createTimer(Timer timerJob) {
- jobSession.saveJob(timerJob);
+ public void createTimer(Timer timer) {
+ // save business calendar resource used to create timer
+ //
https://jira.jboss.org/browse/JBPM-2958
+ ObjectFactory objectFactory = jbpmContext.getObjectFactory();
+ if (objectFactory.hasObject("resource.business.calendar")) {
+ timer.setCalendarResource((String)
objectFactory.getObject("resource.business.calendar"));
+ }
+
+ jbpmContext.getJobSession().saveJob(timer);
hasProducedJobs = true;
}
public void deleteTimer(Timer timer) {
- jobSession.deleteJob(timer);
+ jbpmContext.getJobSession().deleteJob(timer);
}
public void deleteTimersByName(String timerName, Token token) {
- jobSession.deleteTimersByName(timerName, token);
+ jbpmContext.getJobSession().deleteTimersByName(timerName, token);
}
public void deleteTimersByProcessInstance(ProcessInstance processInstance) {
- jobSession.deleteJobsForProcessInstance(processInstance);
+ jbpmContext.getJobSession().deleteJobsForProcessInstance(processInstance);
}
public void close() {
- // if timers were produced
- if (hasProducedJobs && jobExecutor != null) {
- // notify job executor
+ // if no timers were produced, just return
+ if (!hasProducedJobs) return;
+
+ // notify job executor
+ JobExecutor jobExecutor = jbpmContext.getJbpmConfiguration().getJobExecutor();
+ if (jobExecutor != null) {
synchronized (jobExecutor) {
jobExecutor.notify();
}
Modified:
jbpm3/branches/jbpm-3.2-soa/core/src/main/resources/org/jbpm/calendar/jbpm.business.calendar.properties
===================================================================
---
jbpm3/branches/jbpm-3.2-soa/core/src/main/resources/org/jbpm/calendar/jbpm.business.calendar.properties 2010-10-16
02:10:32 UTC (rev 6762)
+++
jbpm3/branches/jbpm-3.2-soa/core/src/main/resources/org/jbpm/calendar/jbpm.business.calendar.properties 2010-10-16
13:21:11 UTC (rev 6763)
@@ -11,7 +11,7 @@
weekday.saturday=
weekday.sunday=
-day.format=dd/MM/yyyy
+day.format=MM/dd/yyyy
# holiday ::= <holiday-period>
# holiday-period ::= <start-day> [- <end-day>]
# start-day and end-day must be in the day.format
@@ -19,32 +19,31 @@
# new year's day
holiday.1= 01/01/2010
# birthday of martin luther king
-holiday.2= 18/01/2010
+holiday.2= 01/18/2010
# washington's birthday
-holiday.3= 15/02/2010
+holiday.3= 02/15/2010
# memorial day
-holiday.4= 31/05/2010
+holiday.4= 05/31/2010
# independence day
-holiday.5= 05/07/2010
+holiday.5= 07/05/2010
# labor day
-holiday.6= 06/09/2010
+holiday.6= 09/06/2010
# columbus day
-holiday.7= 11/10/2010
+holiday.7= 10/11/2010
# veterans day
holiday.8= 11/11/2010
# thanksgiving day
-holiday.9= 25/11/2010
+holiday.9= 11/25/2010
# day after thanksgiving
-holiday.10= 26/11/2010
+holiday.10= 11/26/2010
# christmas day
-holiday.11= 24/12/2010
+holiday.11= 12/24/2010
# typical workday excluding breaks
business.day.expressed.in.hours= 7.5
# 7.5 hours * 5 days a week
business.week.expressed.in.hours= 37.5
-# 253 business days / 12 months
+# 250 business days / 12 months
business.month.expressed.in.business.days= 21
-# 365 natural days - 105 weekend days - 7 holidays
-business.year.expressed.in.business.days= 253
-
+# 365 natural days - 104 weekend days - 11 holidays
+business.year.expressed.in.business.days= 250
Added:
jbpm3/branches/jbpm-3.2-soa/core/src/main/resources/org/jbpm/job/Timer.calendar.hbm.xml
===================================================================
---
jbpm3/branches/jbpm-3.2-soa/core/src/main/resources/org/jbpm/job/Timer.calendar.hbm.xml
(rev 0)
+++
jbpm3/branches/jbpm-3.2-soa/core/src/main/resources/org/jbpm/job/Timer.calendar.hbm.xml 2010-10-16
13:21:11 UTC (rev 6763)
@@ -0,0 +1,32 @@
+<?xml version="1.0"?>
+
+<!DOCTYPE hibernate-mapping PUBLIC
+ "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+
+<hibernate-mapping auto-import="false" default-access="field">
+
+ <subclass name="org.jbpm.job.Timer"
+ discriminator-value="T"
+ extends="org.jbpm.job.Job">
+
+ <property name="name" column="NAME_" />
+ <property name="repeat" column="REPEAT_" />
+ <property name="transitionName" column="TRANSITIONNAME_"
/>
+
+ <many-to-one name="action"
+ column="ACTION_"
+ cascade="lock"
+ foreign-key="FK_JOB_ACTION"
+ index="IDX_JOB_ACTION"/>
+
+ <any name="graphElement" id-type="long"
cascade="lock">
+ <column name="GRAPHELEMENTTYPE_"/>
+ <column name="GRAPHELEMENT_"/>
+ </any>
+
+ <property name="calendarResource" column="CALENDARRESOURCE_"
/>
+
+ </subclass>
+
+</hibernate-mapping>
Property changes on:
jbpm3/branches/jbpm-3.2-soa/core/src/main/resources/org/jbpm/job/Timer.calendar.hbm.xml
___________________________________________________________________
Name: svn:eol-style
+ native
Modified:
jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/calendar/BusinessCalendarTest.java
===================================================================
---
jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/calendar/BusinessCalendarTest.java 2010-10-16
02:10:32 UTC (rev 6762)
+++
jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/calendar/BusinessCalendarTest.java 2010-10-16
13:21:11 UTC (rev 6763)
@@ -291,12 +291,11 @@
public void testBusinessYearAddition() {
Calendar calendar = Calendar.getInstance();
- calendar.set(2010, Calendar.FEBRUARY, 8, 9, 30, 0);
+ calendar.set(2009, Calendar.DECEMBER, 28, 9, 30, 0);
calendar.set(Calendar.MILLISECOND, 0);
Date start = calendar.getTime();
- calendar.set(Calendar.YEAR, 2011);
- calendar.set(Calendar.DAY_OF_MONTH, 9);
+ calendar.set(Calendar.YEAR, 2010);
Date expected = calendar.getTime();
assertEquals(expected, businessCalendar.add(start, new Duration("1 business
year")));
Modified:
jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/context/exe/CustomLongClass.java
===================================================================
---
jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/context/exe/CustomLongClass.java 2010-10-16
02:10:32 UTC (rev 6762)
+++
jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/context/exe/CustomLongClass.java 2010-10-16
13:21:11 UTC (rev 6763)
@@ -22,13 +22,17 @@
package org.jbpm.context.exe;
public class CustomLongClass {
- long id = 0;
- public String name = null;
+
+ long id;
+ String name;
+
public CustomLongClass() {
}
+
public CustomLongClass(String name) {
this.name = name;
}
+
public String getName() {
return name;
}
Modified:
jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/context/exe/CustomStringClass.java
===================================================================
---
jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/context/exe/CustomStringClass.java 2010-10-16
02:10:32 UTC (rev 6762)
+++
jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/context/exe/CustomStringClass.java 2010-10-16
13:21:11 UTC (rev 6763)
@@ -22,13 +22,17 @@
package org.jbpm.context.exe;
public class CustomStringClass {
- String id = null;
- public String name = null;
+
+ String id;
+ String name;
+
public CustomStringClass() {
}
+
public CustomStringClass(String name) {
this.name = name;
}
+
public String getName() {
return name;
}
Deleted:
jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/context/exe/CustomVariableLongIdDbTest.java
===================================================================
---
jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/context/exe/CustomVariableLongIdDbTest.java 2010-10-16
02:10:32 UTC (rev 6762)
+++
jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/context/exe/CustomVariableLongIdDbTest.java 2010-10-16
13:21:11 UTC (rev 6763)
@@ -1,95 +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.context.exe;
-
-import org.hibernate.cfg.Configuration;
-
-import org.jbpm.JbpmConfiguration;
-import org.jbpm.JbpmContext;
-import org.jbpm.context.def.ContextDefinition;
-import org.jbpm.db.AbstractDbTestCase;
-import org.jbpm.db.JbpmSchema;
-import org.jbpm.graph.def.ProcessDefinition;
-import org.jbpm.graph.exe.ProcessInstance;
-import org.jbpm.persistence.db.DbPersistenceServiceFactory;
-import org.jbpm.svc.Services;
-
-public class CustomVariableLongIdDbTest extends AbstractDbTestCase {
-
- protected JbpmConfiguration getJbpmConfiguration() {
- if (jbpmConfiguration == null) {
- // disable logging service to prevent logs from referencing custom object
- jbpmConfiguration =
JbpmConfiguration.parseXmlString("<jbpm-configuration>"
- + "<jbpm-context>"
- + " <service name='persistence'"
- + " factory='org.jbpm.persistence.db.DbPersistenceServiceFactory'
/>"
- + " <service name='tx'
factory='org.jbpm.tx.TxServiceFactory' />"
- + "</jbpm-context>"
- + "</jbpm-configuration>");
-
- JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
- try {
- DbPersistenceServiceFactory persistenceServiceFactory =
- (DbPersistenceServiceFactory)
jbpmContext.getServiceFactory(Services.SERVICENAME_PERSISTENCE);
- Configuration configuration = persistenceServiceFactory.getConfiguration();
- configuration.addClass(CustomLongClass.class);
-
- JbpmSchema jbpmSchema = new JbpmSchema(configuration);
- jbpmSchema.createTable("JBPM_TEST_CUSTOMLONGID");
- }
- finally {
- jbpmContext.close();
- }
- }
- return jbpmConfiguration;
- }
-
- protected void tearDown() throws Exception {
- super.tearDown();
- jbpmConfiguration.close();
- }
-
- public void testCustomVariableClassWithLongId() {
- // create and save process definition
- ProcessDefinition processDefinition = new ProcessDefinition(getName());
- processDefinition.addDefinition(new ContextDefinition());
- deployProcessDefinition(processDefinition);
-
- // create process instance
- ProcessInstance processInstance = new ProcessInstance(processDefinition);
- // create custom object
- CustomLongClass customLongObject = new CustomLongClass("my stuff");
- processInstance.getContextInstance().setVariable("custom",
customLongObject);
-
- // save process instance
- processInstance = saveAndReload(processInstance);
- // get custom object from variables
- customLongObject = (CustomLongClass) processInstance.getContextInstance()
- .getVariable("custom");
- assertNotNull(customLongObject);
- assertEquals("my stuff", customLongObject.getName());
-
- // delete custom object
- processInstance.getContextInstance().deleteVariable("custom");
- session.delete(customLongObject);
- }
-}
Deleted:
jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/context/exe/CustomVariableStringIdDbTest.java
===================================================================
---
jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/context/exe/CustomVariableStringIdDbTest.java 2010-10-16
02:10:32 UTC (rev 6762)
+++
jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/context/exe/CustomVariableStringIdDbTest.java 2010-10-16
13:21:11 UTC (rev 6763)
@@ -1,95 +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.context.exe;
-
-import org.hibernate.cfg.Configuration;
-
-import org.jbpm.JbpmConfiguration;
-import org.jbpm.JbpmContext;
-import org.jbpm.context.def.ContextDefinition;
-import org.jbpm.db.AbstractDbTestCase;
-import org.jbpm.db.JbpmSchema;
-import org.jbpm.graph.def.ProcessDefinition;
-import org.jbpm.graph.exe.ProcessInstance;
-import org.jbpm.persistence.db.DbPersistenceServiceFactory;
-import org.jbpm.svc.Services;
-
-public class CustomVariableStringIdDbTest extends AbstractDbTestCase {
-
- protected JbpmConfiguration getJbpmConfiguration() {
- if (jbpmConfiguration == null) {
- // disable logging service to prevent logs from referencing custom object
- jbpmConfiguration =
JbpmConfiguration.parseXmlString("<jbpm-configuration>"
- + "<jbpm-context>"
- + " <service name='persistence'"
- + " factory='org.jbpm.persistence.db.DbPersistenceServiceFactory'
/>"
- + " <service name='tx'
factory='org.jbpm.tx.TxServiceFactory' />"
- + "</jbpm-context>"
- + "</jbpm-configuration>");
-
- JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
- try {
- DbPersistenceServiceFactory persistenceServiceFactory =
- (DbPersistenceServiceFactory)
jbpmContext.getServiceFactory(Services.SERVICENAME_PERSISTENCE);
- Configuration configuration = persistenceServiceFactory.getConfiguration();
- configuration.addClass(CustomStringClass.class);
-
- JbpmSchema jbpmSchema = new JbpmSchema(configuration);
- jbpmSchema.createTable("JBPM_TEST_CUSTOMSTRINGID");
- }
- finally {
- jbpmContext.close();
- }
- }
- return jbpmConfiguration;
- }
-
- protected void tearDown() throws Exception {
- super.tearDown();
- jbpmConfiguration.close();
- }
-
- public void testCustomVariableClassWithStringId() {
- // create and save process definition
- ProcessDefinition processDefinition = new ProcessDefinition(getName());
- processDefinition.addDefinition(new ContextDefinition());
- deployProcessDefinition(processDefinition);
-
- // create process instance
- ProcessInstance processInstance = new ProcessInstance(processDefinition);
- // create custom object
- CustomStringClass customStringObject = new CustomStringClass("my stuff");
- processInstance.getContextInstance().setVariable("custom",
customStringObject);
-
- // save process instance
- processInstance = saveAndReload(processInstance);
- // get custom object from variables
- customStringObject = (CustomStringClass) processInstance.getContextInstance()
- .getVariable("custom");
- assertNotNull(customStringObject);
- assertEquals("my stuff", customStringObject.getName());
-
- // delete custom object
- processInstance.getContextInstance().deleteVariable("custom");
- session.delete(customStringObject);
- }
-}
Copied:
jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/context/exe/LongIdVariableDbTest.java
(from rev 6741,
jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/context/exe/CustomVariableLongIdDbTest.java)
===================================================================
---
jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/context/exe/LongIdVariableDbTest.java
(rev 0)
+++
jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/context/exe/LongIdVariableDbTest.java 2010-10-16
13:21:11 UTC (rev 6763)
@@ -0,0 +1,89 @@
+/*
+ * 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.context.exe;
+
+import org.hibernate.cfg.Configuration;
+
+import org.jbpm.JbpmConfiguration;
+import org.jbpm.JbpmContext;
+import org.jbpm.context.def.ContextDefinition;
+import org.jbpm.db.AbstractDbTestCase;
+import org.jbpm.db.JbpmSchema;
+import org.jbpm.graph.def.ProcessDefinition;
+import org.jbpm.graph.exe.ProcessInstance;
+import org.jbpm.persistence.db.DbPersistenceServiceFactory;
+import org.jbpm.svc.Services;
+
+public class LongIdVariableDbTest extends AbstractDbTestCase {
+
+ protected JbpmConfiguration getJbpmConfiguration() {
+ if (jbpmConfiguration == null) {
+ // disable logging service to prevent logs from referencing custom object
+ jbpmConfiguration =
JbpmConfiguration.parseResource("org/jbpm/context/exe/jbpm.cfg.xml");
+
+ JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
+ try {
+ DbPersistenceServiceFactory persistenceServiceFactory =
+ (DbPersistenceServiceFactory)
jbpmContext.getServiceFactory(Services.SERVICENAME_PERSISTENCE);
+ Configuration configuration = persistenceServiceFactory.getConfiguration();
+ configuration.addClass(CustomLongClass.class);
+
+ JbpmSchema jbpmSchema = new JbpmSchema(configuration);
+ jbpmSchema.createTable("JBPM_TEST_CUSTOMLONGID");
+ }
+ finally {
+ jbpmContext.close();
+ }
+ }
+ return jbpmConfiguration;
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ jbpmConfiguration.close();
+ }
+
+ public void testCustomVariableClassWithLongId() {
+ // create and save process definition
+ ProcessDefinition processDefinition = new ProcessDefinition(getName());
+ processDefinition.addDefinition(new ContextDefinition());
+ deployProcessDefinition(processDefinition);
+
+ // create process instance
+ ProcessInstance processInstance = new ProcessInstance(processDefinition);
+ // create custom object
+ CustomLongClass customLongObject = new CustomLongClass("my stuff");
+ processInstance.getContextInstance().setVariable("custom",
customLongObject);
+
+ // save process instance
+ processInstance = saveAndReload(processInstance);
+ // get custom object from variables
+ customLongObject = (CustomLongClass) processInstance.getContextInstance()
+ .getVariable("custom");
+ assertNotNull(customLongObject);
+ assertEquals("my stuff", customLongObject.getName());
+
+ // delete custom object
+ processInstance.getContextInstance().deleteVariable("custom");
+ session.delete(customLongObject);
+ }
+}
Copied:
jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/context/exe/StringIdVariableDbTest.java
(from rev 6741,
jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/context/exe/CustomVariableStringIdDbTest.java)
===================================================================
---
jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/context/exe/StringIdVariableDbTest.java
(rev 0)
+++
jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/context/exe/StringIdVariableDbTest.java 2010-10-16
13:21:11 UTC (rev 6763)
@@ -0,0 +1,89 @@
+/*
+ * 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.context.exe;
+
+import org.hibernate.cfg.Configuration;
+
+import org.jbpm.JbpmConfiguration;
+import org.jbpm.JbpmContext;
+import org.jbpm.context.def.ContextDefinition;
+import org.jbpm.db.AbstractDbTestCase;
+import org.jbpm.db.JbpmSchema;
+import org.jbpm.graph.def.ProcessDefinition;
+import org.jbpm.graph.exe.ProcessInstance;
+import org.jbpm.persistence.db.DbPersistenceServiceFactory;
+import org.jbpm.svc.Services;
+
+public class StringIdVariableDbTest extends AbstractDbTestCase {
+
+ protected JbpmConfiguration getJbpmConfiguration() {
+ if (jbpmConfiguration == null) {
+ // disable logging service to prevent logs from referencing custom object
+ jbpmConfiguration =
JbpmConfiguration.parseResource("org/jbpm/context/exe/jbpm.cfg.xml");
+
+ JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
+ try {
+ DbPersistenceServiceFactory persistenceServiceFactory =
+ (DbPersistenceServiceFactory)
jbpmContext.getServiceFactory(Services.SERVICENAME_PERSISTENCE);
+ Configuration configuration = persistenceServiceFactory.getConfiguration();
+ configuration.addClass(CustomStringClass.class);
+
+ JbpmSchema jbpmSchema = new JbpmSchema(configuration);
+ jbpmSchema.createTable("JBPM_TEST_CUSTOMSTRINGID");
+ }
+ finally {
+ jbpmContext.close();
+ }
+ }
+ return jbpmConfiguration;
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ jbpmConfiguration.close();
+ }
+
+ public void testCustomVariableClassWithStringId() {
+ // create and save process definition
+ ProcessDefinition processDefinition = new ProcessDefinition(getName());
+ processDefinition.addDefinition(new ContextDefinition());
+ deployProcessDefinition(processDefinition);
+
+ // create process instance
+ ProcessInstance processInstance = new ProcessInstance(processDefinition);
+ // create custom object
+ CustomStringClass customStringObject = new CustomStringClass("my stuff");
+ processInstance.getContextInstance().setVariable("custom",
customStringObject);
+
+ // save process instance
+ processInstance = saveAndReload(processInstance);
+ // get custom object from variables
+ customStringObject = (CustomStringClass) processInstance.getContextInstance()
+ .getVariable("custom");
+ assertNotNull(customStringObject);
+ assertEquals("my stuff", customStringObject.getName());
+
+ // delete custom object
+ processInstance.getContextInstance().deleteVariable("custom");
+ session.delete(customStringObject);
+ }
+}
Modified:
jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/graph/node/JoinDbTest.java
===================================================================
---
jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/graph/node/JoinDbTest.java 2010-10-16
02:10:32 UTC (rev 6762)
+++
jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/graph/node/JoinDbTest.java 2010-10-16
13:21:11 UTC (rev 6763)
@@ -21,23 +21,10 @@
*/
package org.jbpm.graph.node;
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.OutputStream;
-import java.io.PrintWriter;
-import java.net.URI;
-import java.net.URL;
-import java.util.regex.Pattern;
-
import org.hibernate.LockMode;
import org.jbpm.JbpmConfiguration;
import org.jbpm.JbpmContext;
-import org.jbpm.JbpmException;
import org.jbpm.db.AbstractDbTestCase;
import org.jbpm.db.JbpmSchema;
import org.jbpm.graph.def.ProcessDefinition;
@@ -53,28 +40,12 @@
protected JbpmConfiguration getJbpmConfiguration() {
if (jbpmConfiguration == null) {
- URL cfgResource =
getClass().getClassLoader().getResource("hibernate.cfg.xml");
- try {
- InputStream cfgSource = cfgResource.openStream();
- OutputStream cfgSink = new FileOutputStream(new
File(URI.create(cfgResource.toString())
- .resolve("hibernate.join.cfg.xml")));
+ jbpmConfiguration =
JbpmConfiguration.parseResource("org/jbpm/graph/node/jbpm.cfg.xml");
- sed("Join\\.hbm\\.xml", "Join.lock.hbm.xml", cfgSource,
cfgSink);
-
- cfgSource.close();
- cfgSink.close();
- }
- catch (IOException e) {
- throw new JbpmException("could not edit hibernate configuration", e);
- }
- jbpmConfiguration =
JbpmConfiguration.parseXmlString("<jbpm-configuration>"
- + " <string name='resource.hibernate.cfg.xml'
value='hibernate.join.cfg.xml' />"
- + "</jbpm-configuration>");
-
JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
try {
- DbPersistenceServiceFactory persistenceServiceFactory =
(DbPersistenceServiceFactory) jbpmContext
- .getServiceFactory(Services.SERVICENAME_PERSISTENCE);
+ DbPersistenceServiceFactory persistenceServiceFactory =
(DbPersistenceServiceFactory)
+ jbpmContext.getServiceFactory(Services.SERVICENAME_PERSISTENCE);
JbpmSchema jbpmSchema = new
JbpmSchema(persistenceServiceFactory.getConfiguration());
jbpmSchema.updateTable("JBPM_NODE");
}
@@ -90,18 +61,6 @@
jbpmConfiguration.close();
}
- private static void sed(String regex, String replacement, InputStream inStream,
- OutputStream outStream) throws IOException {
- BufferedReader reader = new BufferedReader(new InputStreamReader(inStream));
- PrintWriter writer = new PrintWriter(outStream);
- Pattern pattern = Pattern.compile(regex);
- for (String inLine; (inLine = reader.readLine()) != null;) {
- String outLine = pattern.matcher(inLine).replaceAll(replacement);
- writer.println(outLine);
- }
- writer.flush();
- }
-
public void testParentLockMode() {
ProcessDefinition processDefinition =
ProcessDefinition.parseXmlString("<process-definition name='lock
mode'>"
+ " <join name='read' lock='READ' />"
Copied:
jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/jbpm1776/BusinessTimeSubstractionTest.java
(from rev 6757,
jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/jbpm1776/JBPM1776Test.java)
===================================================================
---
jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/jbpm1776/BusinessTimeSubstractionTest.java
(rev 0)
+++
jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/jbpm1776/BusinessTimeSubstractionTest.java 2010-10-16
13:21:11 UTC (rev 6763)
@@ -0,0 +1,294 @@
+/*
+ * 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.jbpm1776;
+
+import java.util.Calendar;
+import java.util.Date;
+
+import org.jbpm.AbstractJbpmTestCase;
+import org.jbpm.calendar.BusinessCalendar;
+import org.jbpm.calendar.Duration;
+
+/**
+ * Business time subtraction delivers unexpected results.
+ *
+ * @see <a
href="https://jira.jboss.org/browse/JBPM-1776">JBPM-1776<...
+ * @author Alejandro Guizar
+ */
+public class BusinessTimeSubstractionTest extends AbstractJbpmTestCase {
+
+ static BusinessCalendar businessCalendar = new BusinessCalendar();
+
+ public void testNonBusinessSecondSubtraction() {
+ Calendar calendar = Calendar.getInstance();
+ calendar.set(2005, Calendar.APRIL, 7, 10, 30, 0);
+ calendar.set(Calendar.MILLISECOND, 0);
+ Date start = calendar.getTime();
+
+ calendar.add(Calendar.SECOND, -20);
+ Date expected = calendar.getTime();
+
+ Date actual = businessCalendar.add(start, new Duration("-20 seconds"));
+ assertEquals(expected, actual);
+ }
+
+ public void testNonBusinessMinuteSubtraction() {
+ Calendar calendar = Calendar.getInstance();
+ calendar.set(2005, Calendar.APRIL, 7, 11, 55, 0);
+ calendar.set(Calendar.MILLISECOND, 0);
+ Date start = calendar.getTime();
+
+ calendar.add(Calendar.MINUTE, -10);
+ Date expected = calendar.getTime();
+
+ assertEquals(expected, businessCalendar.add(start, new Duration("-10
minutes")));
+ }
+
+ public void testNonBusinessFractionalDurationSubtraction() {
+ Calendar calendar = Calendar.getInstance();
+ calendar.set(2008, Calendar.FEBRUARY, 5, 6, 30, 45);
+ calendar.set(Calendar.MILLISECOND, 125);
+ Date start = calendar.getTime();
+
+ calendar.add(Calendar.HOUR, -7);
+ calendar.add(Calendar.MINUTE, -45);
+ Date expected = calendar.getTime();
+
+ assertEquals(expected, businessCalendar.add(start, new Duration("-7.75
hours")));
+ }
+
+ public void testNonBusinessDaySubtraction() {
+ Calendar calendar = Calendar.getInstance();
+ calendar.set(2005, Calendar.FEBRUARY, 5, 6, 30, 45);
+ calendar.set(Calendar.MILLISECOND, 125);
+ Date start = calendar.getTime();
+
+ calendar.add(Calendar.DAY_OF_MONTH, -10);
+ Date expected = calendar.getTime();
+
+ assertEquals(expected, businessCalendar.add(start, new Duration("-10
days")));
+ }
+
+ public void testNonBusinessWeekSubtraction() {
+ Calendar calendar = Calendar.getInstance();
+ calendar.set(2008, Calendar.FEBRUARY, 5, 6, 30, 45);
+ calendar.set(Calendar.MILLISECOND, 125);
+ Date start = calendar.getTime();
+
+ calendar.add(Calendar.WEEK_OF_YEAR, -5);
+ Date expected = calendar.getTime();
+
+ assertEquals(expected, businessCalendar.add(start, new Duration("-5
weeks")));
+ }
+
+ public void testNonBusinessMonthSubtraction() {
+ Calendar calendar = Calendar.getInstance();
+ calendar.set(2008, Calendar.FEBRUARY, 5, 6, 30, 45);
+ calendar.set(Calendar.MILLISECOND, 125);
+ Date start = calendar.getTime();
+
+ calendar.add(Calendar.MONTH, -3);
+ Date expected = calendar.getTime();
+
+ assertEquals(expected, businessCalendar.add(start, new Duration("-3
months")));
+ }
+
+ public void testNonBusinessYearSubtraction() {
+ Calendar calendar = Calendar.getInstance();
+ calendar.set(2008, Calendar.FEBRUARY, 5, 6, 30, 45);
+ calendar.set(Calendar.MILLISECOND, 125);
+ Date start = calendar.getTime();
+
+ calendar.add(Calendar.YEAR, -1);
+ Date expected = calendar.getTime();
+
+ assertEquals(expected, businessCalendar.add(start, new Duration("-1
year")));
+ }
+
+ public void testBusinessDurationSubtractionOverBusinessTime() {
+ Calendar calendar = Calendar.getInstance();
+ calendar.set(2005, Calendar.APRIL, 7, 11, 55, 0);
+ calendar.set(Calendar.MILLISECOND, 0);
+ Date start = calendar.getTime();
+
+ calendar.add(Calendar.MINUTE, -1);
+ Date expected = calendar.getTime();
+
+ assertEquals(expected, businessCalendar.add(start, new Duration("-1 business
minute")));
+ }
+
+ public void testBusinessDurationSubtractionOverLunchBreak() {
+ Calendar calendar = Calendar.getInstance();
+ calendar.set(2005, Calendar.APRIL, 7, 12, 35, 0);
+ calendar.set(Calendar.MILLISECOND, 0);
+ Date start = calendar.getTime();
+
+ calendar.add(Calendar.MINUTE, -10);
+ // lunch break spans 30 minutes
+ calendar.add(Calendar.MINUTE, -30);
+ Date expected = calendar.getTime();
+
+ assertEquals(expected, businessCalendar.add(start, new Duration("-10 business
minutes")));
+ }
+
+ public void testBusinessDurationSubtractionOverDayBreak() {
+ Calendar calendar = Calendar.getInstance();
+ calendar.set(2005, Calendar.APRIL, 8, 9, 5, 0);
+ calendar.set(Calendar.MILLISECOND, 0);
+ Date start = calendar.getTime();
+
+ calendar.add(Calendar.MINUTE, -10);
+ // there are 16 hours between 17:00 and 9:00
+ calendar.add(Calendar.HOUR, -16);
+ Date expected = calendar.getTime();
+
+ assertEquals(expected, businessCalendar.add(start, new Duration("-10 business
minutes")));
+ }
+
+ public void testBusinessDurationSubtractionOverHoliday() {
+ Calendar calendar = Calendar.getInstance();
+ calendar.set(2010, Calendar.NOVEMBER, 12, 9, 5, 0);
+ calendar.set(Calendar.MILLISECOND, 0);
+ Date start = calendar.getTime();
+
+ calendar.add(Calendar.MINUTE, -10);
+ // there are 16 hours between 17:00 and 9:00
+ calendar.add(Calendar.HOUR, -16);
+ // holiday
+ calendar.add(Calendar.DAY_OF_MONTH, -1);
+ Date expected = calendar.getTime();
+
+ assertEquals(expected, businessCalendar.add(start, new Duration("-10 business
minutes")));
+ }
+
+ public void testBusinessDurationSubtractionOverWeekend() {
+ Calendar calendar = Calendar.getInstance();
+ calendar.set(2005, Calendar.APRIL, 11, 9, 5, 0);
+ calendar.set(Calendar.MILLISECOND, 0);
+ Date start = calendar.getTime();
+
+ calendar.add(Calendar.MINUTE, -10);
+ // there are 16 hours between 17:00 and 9:00
+ calendar.add(Calendar.HOUR, -16);
+ // weekend
+ calendar.add(Calendar.DAY_OF_MONTH, -2);
+ Date expected = calendar.getTime();
+
+ assertEquals(expected, businessCalendar.add(start, new Duration("-10 business
minutes")));
+ }
+
+ public void testTwoBusinessHoursOverLunch() {
+ Calendar calendar = Calendar.getInstance();
+ calendar.set(2005, Calendar.APRIL, 7, 13, 45, 0);
+ calendar.set(Calendar.MILLISECOND, 0);
+ Date start = calendar.getTime();
+
+ calendar.add(Calendar.HOUR, -2);
+ // lunch break spans 30 minutes
+ calendar.add(Calendar.MINUTE, -30);
+ Date expected = calendar.getTime();
+
+ assertEquals(expected, businessCalendar.add(start, new Duration("-2 business
hours")));
+ }
+
+ public void testBusinessDurationSubtractionOutsideBusinessHours() {
+ Calendar calendar = Calendar.getInstance();
+ calendar.set(2005, Calendar.APRIL, 8, 12, 15, 0);
+ calendar.set(Calendar.MILLISECOND, 0);
+ Date start = calendar.getTime();
+
+ calendar.add(Calendar.MINUTE, -30);
+ // lunch break ends at 12:30
+ calendar.add(Calendar.MINUTE, -15);
+ Date expected = calendar.getTime();
+
+ assertEquals(expected, businessCalendar.add(start, new Duration("-30 business
minutes")));
+ }
+
+ public void testBusinessDurationSubtractionOutsideBusinessHoursOverWeekend() {
+ Calendar calendar = Calendar.getInstance();
+ calendar.set(2005, Calendar.APRIL, 11, 12, 15, 0);
+ calendar.set(Calendar.MILLISECOND, 0);
+ Date start = calendar.getTime();
+
+ calendar.add(Calendar.HOUR, -5);
+ // lunch break ends at 12:30
+ calendar.add(Calendar.MINUTE, -15);
+ // there are 16 hours between 17:00 and 9:00
+ calendar.add(Calendar.HOUR, -16);
+ // weekend
+ calendar.add(Calendar.DAY_OF_MONTH, -2);
+ Date expected = calendar.getTime();
+
+ assertEquals(expected, businessCalendar.add(start, new Duration("-5 business
hours")));
+ }
+
+ public void testBusinessDaySubtraction() {
+ Calendar calendar = Calendar.getInstance();
+ calendar.set(2005, Calendar.FEBRUARY, 21, 9, 30, 0);
+ calendar.set(Calendar.MILLISECOND, 0);
+ Date start = calendar.getTime();
+
+ calendar.set(Calendar.DAY_OF_MONTH, 7);
+ Date expected = calendar.getTime();
+
+ assertEquals(expected, businessCalendar.add(start, new Duration("-10 business
days")));
+ }
+
+ public void testBusinessWeekSubtraction() {
+ Calendar calendar = Calendar.getInstance();
+ calendar.set(2005, Calendar.MARCH, 14, 9, 30, 0);
+ calendar.set(Calendar.MILLISECOND, 0);
+ Date start = calendar.getTime();
+
+ calendar.set(Calendar.MONTH, Calendar.FEBRUARY);
+ calendar.set(Calendar.DAY_OF_MONTH, 7);
+ Date expected = calendar.getTime();
+
+ assertEquals(expected, businessCalendar.add(start, new Duration("-5 business
weeks")));
+ }
+
+ public void testBusinessMonthSubtraction() {
+ Calendar calendar = Calendar.getInstance();
+ calendar.set(2010, Calendar.MAY, 4, 9, 30, 0);
+ calendar.set(Calendar.MILLISECOND, 0);
+ Date start = calendar.getTime();
+
+ calendar.set(Calendar.MONTH, Calendar.FEBRUARY);
+ calendar.set(Calendar.DAY_OF_MONTH, 3);
+ Date expected = calendar.getTime();
+
+ assertEquals(expected, businessCalendar.add(start, new Duration("-3 business
months")));
+ }
+
+ public void testBusinessYearSubtraction() {
+ Calendar calendar = Calendar.getInstance();
+ calendar.set(2010, Calendar.DECEMBER, 28, 9, 30, 0);
+ calendar.set(Calendar.MILLISECOND, 0);
+ Date start = calendar.getTime();
+
+ calendar.set(Calendar.YEAR, 2009);
+ Date expected = calendar.getTime();
+
+ assertEquals(expected, businessCalendar.add(start, new Duration("-1 business
year")));
+ }
+}
Deleted:
jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/jbpm1776/JBPM1776Test.java
===================================================================
---
jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/jbpm1776/JBPM1776Test.java 2010-10-16
02:10:32 UTC (rev 6762)
+++
jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/jbpm1776/JBPM1776Test.java 2010-10-16
13:21:11 UTC (rev 6763)
@@ -1,295 +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.jbpm1776;
-
-import java.util.Calendar;
-import java.util.Date;
-
-import org.jbpm.AbstractJbpmTestCase;
-import org.jbpm.calendar.BusinessCalendar;
-import org.jbpm.calendar.Duration;
-
-/**
- * Business time subtraction delivers unexpected results.
- *
- * @see <a
href="https://jira.jboss.org/browse/JBPM-1776">JBPM-1776<...
- * @author Alejandro Guizar
- */
-public class JBPM1776Test extends AbstractJbpmTestCase {
-
- static BusinessCalendar businessCalendar = new BusinessCalendar();
-
- public void testNonBusinessSecondSubtraction() {
- Calendar calendar = Calendar.getInstance();
- calendar.set(2005, Calendar.APRIL, 7, 10, 30, 0);
- calendar.set(Calendar.MILLISECOND, 0);
- Date start = calendar.getTime();
-
- calendar.add(Calendar.SECOND, -20);
- Date expected = calendar.getTime();
-
- Date actual = businessCalendar.add(start, new Duration("-20 seconds"));
- assertEquals(expected, actual);
- }
-
- public void testNonBusinessMinuteSubtraction() {
- Calendar calendar = Calendar.getInstance();
- calendar.set(2005, Calendar.APRIL, 7, 11, 55, 0);
- calendar.set(Calendar.MILLISECOND, 0);
- Date start = calendar.getTime();
-
- calendar.add(Calendar.MINUTE, -10);
- Date expected = calendar.getTime();
-
- assertEquals(expected, businessCalendar.add(start, new Duration("-10
minutes")));
- }
-
- public void testNonBusinessFractionalDurationSubtraction() {
- Calendar calendar = Calendar.getInstance();
- calendar.set(2008, Calendar.FEBRUARY, 5, 6, 30, 45);
- calendar.set(Calendar.MILLISECOND, 125);
- Date start = calendar.getTime();
-
- calendar.add(Calendar.HOUR, -7);
- calendar.add(Calendar.MINUTE, -45);
- Date expected = calendar.getTime();
-
- assertEquals(expected, businessCalendar.add(start, new Duration("-7.75
hours")));
- }
-
- public void testNonBusinessDaySubtraction() {
- Calendar calendar = Calendar.getInstance();
- calendar.set(2005, Calendar.FEBRUARY, 5, 6, 30, 45);
- calendar.set(Calendar.MILLISECOND, 125);
- Date start = calendar.getTime();
-
- calendar.add(Calendar.DAY_OF_MONTH, -10);
- Date expected = calendar.getTime();
-
- assertEquals(expected, businessCalendar.add(start, new Duration("-10
days")));
- }
-
- public void testNonBusinessWeekSubtraction() {
- Calendar calendar = Calendar.getInstance();
- calendar.set(2008, Calendar.FEBRUARY, 5, 6, 30, 45);
- calendar.set(Calendar.MILLISECOND, 125);
- Date start = calendar.getTime();
-
- calendar.add(Calendar.WEEK_OF_YEAR, -5);
- Date expected = calendar.getTime();
-
- assertEquals(expected, businessCalendar.add(start, new Duration("-5
weeks")));
- }
-
- public void testNonBusinessMonthSubtraction() {
- Calendar calendar = Calendar.getInstance();
- calendar.set(2008, Calendar.FEBRUARY, 5, 6, 30, 45);
- calendar.set(Calendar.MILLISECOND, 125);
- Date start = calendar.getTime();
-
- calendar.add(Calendar.MONTH, -3);
- Date expected = calendar.getTime();
-
- assertEquals(expected, businessCalendar.add(start, new Duration("-3
months")));
- }
-
- public void testNonBusinessYearSubtraction() {
- Calendar calendar = Calendar.getInstance();
- calendar.set(2008, Calendar.FEBRUARY, 5, 6, 30, 45);
- calendar.set(Calendar.MILLISECOND, 125);
- Date start = calendar.getTime();
-
- calendar.add(Calendar.YEAR, -1);
- Date expected = calendar.getTime();
-
- assertEquals(expected, businessCalendar.add(start, new Duration("-1
year")));
- }
-
- public void testBusinessDurationSubtractionOverBusinessTime() {
- Calendar calendar = Calendar.getInstance();
- calendar.set(2005, Calendar.APRIL, 7, 11, 55, 0);
- calendar.set(Calendar.MILLISECOND, 0);
- Date start = calendar.getTime();
-
- calendar.add(Calendar.MINUTE, -1);
- Date expected = calendar.getTime();
-
- assertEquals(expected, businessCalendar.add(start, new Duration("-1 business
minute")));
- }
-
- public void testBusinessDurationSubtractionOverLunchBreak() {
- Calendar calendar = Calendar.getInstance();
- calendar.set(2005, Calendar.APRIL, 7, 12, 35, 0);
- calendar.set(Calendar.MILLISECOND, 0);
- Date start = calendar.getTime();
-
- calendar.add(Calendar.MINUTE, -10);
- // lunch break spans 30 minutes
- calendar.add(Calendar.MINUTE, -30);
- Date expected = calendar.getTime();
-
- assertEquals(expected, businessCalendar.add(start, new Duration("-10 business
minutes")));
- }
-
- public void testBusinessDurationSubtractionOverDayBreak() {
- Calendar calendar = Calendar.getInstance();
- calendar.set(2005, Calendar.APRIL, 8, 9, 5, 0);
- calendar.set(Calendar.MILLISECOND, 0);
- Date start = calendar.getTime();
-
- calendar.add(Calendar.MINUTE, -10);
- // there are 16 hours between 17:00 and 9:00
- calendar.add(Calendar.HOUR, -16);
- Date expected = calendar.getTime();
-
- assertEquals(expected, businessCalendar.add(start, new Duration("-10 business
minutes")));
- }
-
- public void testBusinessDurationSubtractionOverHoliday() {
- Calendar calendar = Calendar.getInstance();
- calendar.set(2010, Calendar.NOVEMBER, 12, 9, 5, 0);
- calendar.set(Calendar.MILLISECOND, 0);
- Date start = calendar.getTime();
-
- calendar.add(Calendar.MINUTE, -10);
- // there are 16 hours between 17:00 and 9:00
- calendar.add(Calendar.HOUR, -16);
- // holiday
- calendar.add(Calendar.DAY_OF_MONTH, -1);
- Date expected = calendar.getTime();
-
- assertEquals(expected, businessCalendar.add(start, new Duration("-10 business
minutes")));
- }
-
- public void testBusinessDurationSubtractionOverWeekend() {
- Calendar calendar = Calendar.getInstance();
- calendar.set(2005, Calendar.APRIL, 11, 9, 5, 0);
- calendar.set(Calendar.MILLISECOND, 0);
- Date start = calendar.getTime();
-
- calendar.add(Calendar.MINUTE, -10);
- // there are 16 hours between 17:00 and 9:00
- calendar.add(Calendar.HOUR, -16);
- // weekend
- calendar.add(Calendar.DAY_OF_MONTH, -2);
- Date expected = calendar.getTime();
-
- assertEquals(expected, businessCalendar.add(start, new Duration("-10 business
minutes")));
- }
-
- public void testTwoBusinessHoursOverLunch() {
- Calendar calendar = Calendar.getInstance();
- calendar.set(2005, Calendar.APRIL, 7, 13, 45, 0);
- calendar.set(Calendar.MILLISECOND, 0);
- Date start = calendar.getTime();
-
- calendar.add(Calendar.HOUR, -2);
- // lunch break spans 30 minutes
- calendar.add(Calendar.MINUTE, -30);
- Date expected = calendar.getTime();
-
- assertEquals(expected, businessCalendar.add(start, new Duration("-2 business
hours")));
- }
-
- public void testBusinessDurationSubtractionOutsideBusinessHours() {
- Calendar calendar = Calendar.getInstance();
- calendar.set(2005, Calendar.APRIL, 8, 12, 15, 0);
- calendar.set(Calendar.MILLISECOND, 0);
- Date start = calendar.getTime();
-
- calendar.add(Calendar.MINUTE, -30);
- // lunch break ends at 12:30
- calendar.add(Calendar.MINUTE, -15);
- Date expected = calendar.getTime();
-
- assertEquals(expected, businessCalendar.add(start, new Duration("-30 business
minutes")));
- }
-
- public void testBusinessDurationSubtractionOutsideBusinessHoursOverWeekend() {
- Calendar calendar = Calendar.getInstance();
- calendar.set(2005, Calendar.APRIL, 11, 12, 15, 0);
- calendar.set(Calendar.MILLISECOND, 0);
- Date start = calendar.getTime();
-
- calendar.add(Calendar.HOUR, -5);
- // lunch break ends at 12:30
- calendar.add(Calendar.MINUTE, -15);
- // there are 16 hours between 17:00 and 9:00
- calendar.add(Calendar.HOUR, -16);
- // weekend
- calendar.add(Calendar.DAY_OF_MONTH, -2);
- Date expected = calendar.getTime();
-
- assertEquals(expected, businessCalendar.add(start, new Duration("-5 business
hours")));
- }
-
- public void testBusinessDaySubtraction() {
- Calendar calendar = Calendar.getInstance();
- calendar.set(2005, Calendar.FEBRUARY, 21, 9, 30, 0);
- calendar.set(Calendar.MILLISECOND, 0);
- Date start = calendar.getTime();
-
- calendar.set(Calendar.DAY_OF_MONTH, 7);
- Date expected = calendar.getTime();
-
- assertEquals(expected, businessCalendar.add(start, new Duration("-10 business
days")));
- }
-
- public void testBusinessWeekSubtraction() {
- Calendar calendar = Calendar.getInstance();
- calendar.set(2005, Calendar.MARCH, 14, 9, 30, 0);
- calendar.set(Calendar.MILLISECOND, 0);
- Date start = calendar.getTime();
-
- calendar.set(Calendar.MONTH, Calendar.FEBRUARY);
- calendar.set(Calendar.DAY_OF_MONTH, 7);
- Date expected = calendar.getTime();
-
- assertEquals(expected, businessCalendar.add(start, new Duration("-5 business
weeks")));
- }
-
- public void testBusinessMonthSubtraction() {
- Calendar calendar = Calendar.getInstance();
- calendar.set(2010, Calendar.MAY, 7, 9, 30, 0);
- calendar.set(Calendar.MILLISECOND, 0);
- Date start = calendar.getTime();
-
- calendar.set(Calendar.MONTH, Calendar.FEBRUARY);
- calendar.set(Calendar.DAY_OF_MONTH, 8);
- Date expected = calendar.getTime();
-
- assertEquals(expected, businessCalendar.add(start, new Duration("-3 business
months")));
- }
-
- public void testBusinessYearSubtraction() {
- Calendar calendar = Calendar.getInstance();
- calendar.set(2011, Calendar.FEBRUARY, 9, 9, 30, 0);
- calendar.set(Calendar.MILLISECOND, 0);
- Date start = calendar.getTime();
-
- calendar.set(Calendar.YEAR, 2010);
- calendar.set(Calendar.DAY_OF_MONTH, 8);
- Date expected = calendar.getTime();
-
- assertEquals(expected, businessCalendar.add(start, new Duration("-1 business
year")));
- }
-}
Deleted:
jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/jbpm2825/JBPM2825Test.java
===================================================================
---
jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/jbpm2825/JBPM2825Test.java 2010-10-16
02:10:32 UTC (rev 6762)
+++
jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/jbpm2825/JBPM2825Test.java 2010-10-16
13:21:11 UTC (rev 6763)
@@ -1,60 +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.jbpm2825;
-
-import org.jbpm.JbpmConfiguration;
-import org.jbpm.db.AbstractDbTestCase;
-import org.jbpm.file.def.FileDefinition;
-import org.jbpm.graph.def.ProcessDefinition;
-
-/**
- * @author Alejandro Guizar
- */
-public class JBPM2825Test extends AbstractDbTestCase {
-
- public void testProcessClassLoaderOutsideContext() {
- FileDefinition fileDefinition = new FileDefinition();
- byte[] magicNumber = {
- (byte) 0xCA, (byte) 0xFE, (byte) 0xBA, (byte) 0xBE
- };
- fileDefinition.addFile("classes/org/example/Undef", magicNumber);
-
- ProcessDefinition processDefinition = new ProcessDefinition(getName());
- processDefinition.addDefinition(fileDefinition);
- jbpmContext.deployProcessDefinition(processDefinition);
-
- ClassLoader procClassLoader =
JbpmConfiguration.getProcessClassLoader(processDefinition);
- String undefClassName = "org.example.Undef";
-
- closeJbpmContext();
- try {
- Class.forName(undefClassName, false, procClassLoader);
- fail("expected class " + undefClassName + " to not be found");
- }
- catch (ClassNotFoundException e) {
- assertEquals(undefClassName, e.getMessage());
- }
- finally {
- createJbpmContext();
- }
- }
-}
Copied:
jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/jbpm2825/ProcessClassLoaderNoContextTest.java
(from rev 6741,
jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/jbpm2825/JBPM2825Test.java)
===================================================================
---
jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/jbpm2825/ProcessClassLoaderNoContextTest.java
(rev 0)
+++
jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/jbpm2825/ProcessClassLoaderNoContextTest.java 2010-10-16
13:21:11 UTC (rev 6763)
@@ -0,0 +1,65 @@
+/*
+ * 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.jbpm2825;
+
+import org.jbpm.JbpmConfiguration;
+import org.jbpm.db.AbstractDbTestCase;
+import org.jbpm.file.def.FileDefinition;
+import org.jbpm.graph.def.ProcessDefinition;
+import org.jbpm.instantiation.ProcessClassLoader;
+
+/**
+ * {@link ProcessClassLoader} throws {@link NullPointerException} when no current context
is
+ * available.
+ *
+ * @see <a
href="https://jira.jboss.org/browse/JBPM-2825">JBPM-2825<...
+ * @author Alejandro Guizar
+ */
+public class ProcessClassLoaderNoContextTest extends AbstractDbTestCase {
+
+ public void testProcessClassLoaderNoContext() {
+ FileDefinition fileDefinition = new FileDefinition();
+ byte[] magicNumber = {
+ (byte) 0xCA, (byte) 0xFE, (byte) 0xBA, (byte) 0xBE
+ };
+ fileDefinition.addFile("classes/org/example/Undef", magicNumber);
+
+ ProcessDefinition processDefinition = new ProcessDefinition(getName());
+ processDefinition.addDefinition(fileDefinition);
+ jbpmContext.deployProcessDefinition(processDefinition);
+
+ ClassLoader procClassLoader =
JbpmConfiguration.getProcessClassLoader(processDefinition);
+ String undefClassName = "org.example.Undef";
+
+ closeJbpmContext();
+ try {
+ Class.forName(undefClassName, false, procClassLoader);
+ fail("expected class " + undefClassName + " to not be found");
+ }
+ catch (ClassNotFoundException e) {
+ assertEquals(undefClassName, e.getMessage());
+ }
+ finally {
+ createJbpmContext();
+ }
+ }
+}
Copied:
jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/jbpm2908/AlternateConfigurationAction.java
(from rev 6741,
jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/jbpm2908/ChangeJbpmConfigurationAction.java)
===================================================================
---
jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/jbpm2908/AlternateConfigurationAction.java
(rev 0)
+++
jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/jbpm2908/AlternateConfigurationAction.java 2010-10-16
13:21:11 UTC (rev 6763)
@@ -0,0 +1,32 @@
+package org.jbpm.jbpm2908;
+
+import org.jbpm.JbpmConfiguration;
+import org.jbpm.JbpmContext;
+import org.jbpm.graph.def.ActionHandler;
+import org.jbpm.graph.exe.ExecutionContext;
+import org.jbpm.graph.exe.ProcessInstance;
+
+public class AlternateConfigurationAction implements ActionHandler {
+
+ private static final long serialVersionUID = 1L;
+
+ public void execute(ExecutionContext exeContext) throws Exception {
+ // load another configuration
+ JbpmConfiguration jbpmConfiguration =
JbpmConfiguration.parseResource("org/jbpm/jbpm2908/jbpm.cfg.xml");
+ try {
+ JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
+ try {
+ // start instance
+ ProcessInstance processInstance =
jbpmContext.newProcessInstance("process2");
+ processInstance.signal();
+ jbpmContext.save(processInstance);
+ }
+ finally {
+ jbpmContext.close();
+ }
+ }
+ finally {
+ jbpmConfiguration.close();
+ }
+ }
+}
Deleted:
jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/jbpm2908/ChangeJbpmConfigurationAction.java
===================================================================
---
jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/jbpm2908/ChangeJbpmConfigurationAction.java 2010-10-16
02:10:32 UTC (rev 6762)
+++
jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/jbpm2908/ChangeJbpmConfigurationAction.java 2010-10-16
13:21:11 UTC (rev 6763)
@@ -1,34 +0,0 @@
-package org.jbpm.jbpm2908;
-
-import org.jbpm.JbpmConfiguration;
-import org.jbpm.JbpmContext;
-import org.jbpm.graph.def.ActionHandler;
-import org.jbpm.graph.exe.ExecutionContext;
-import org.jbpm.graph.exe.ProcessInstance;
-
-public class ChangeJbpmConfigurationAction implements ActionHandler {
-
- private static final long serialVersionUID = 1L;
-
- public void execute(ExecutionContext exeContext) throws Exception {
- // load another configuration
- String dialect = (String) exeContext.getVariable("dialect");
- JbpmConfiguration jbpmConfiguration =
JbpmConfiguration.parseResource(dialect.indexOf("HSQL") != -1 ?
- "org/jbpm/jbpm2908/jbpm-no-auto.cfg.xml" :
"org/jbpm/jbpm2908/jbpm.cfg.xml");
- try {
- JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
- try {
- // start instance
- ProcessInstance processInstance =
jbpmContext.newProcessInstance("process2");
- processInstance.signal();
- jbpmContext.save(processInstance);
- }
- finally {
- jbpmContext.close();
- }
- }
- finally {
- jbpmConfiguration.close();
- }
- }
-}
Modified:
jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/jbpm2908/JBPM2908Test.java
===================================================================
---
jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/jbpm2908/JBPM2908Test.java 2010-10-16
02:10:32 UTC (rev 6762)
+++
jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/jbpm2908/JBPM2908Test.java 2010-10-16
13:21:11 UTC (rev 6763)
@@ -44,8 +44,7 @@
// start instance
ProcessInstance processInstance =
jbpmContext.newProcessInstanceForUpdate("process1");
- processInstance.getContextInstance().setVariable("dialect",
getHibernateDialect());
processInstance.signal();
- assert processInstance.hasEnded() : processInstance;
+ assert processInstance.hasEnded() : "expected " + processInstance + "
to have ended";
}
}
Added:
jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/jbpm2958/TimerCalendarTest.java
===================================================================
---
jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/jbpm2958/TimerCalendarTest.java
(rev 0)
+++
jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/jbpm2958/TimerCalendarTest.java 2010-10-16
13:21:11 UTC (rev 6763)
@@ -0,0 +1,125 @@
+/*
+ * 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.jbpm2958;
+
+import java.util.Calendar;
+import java.util.Date;
+
+import org.jbpm.JbpmConfiguration;
+import org.jbpm.JbpmContext;
+import org.jbpm.db.AbstractDbTestCase;
+import org.jbpm.db.JbpmSchema;
+import org.jbpm.graph.def.ProcessDefinition;
+import org.jbpm.graph.exe.ProcessInstance;
+import org.jbpm.job.Timer;
+import org.jbpm.persistence.db.DbPersistenceServiceFactory;
+import org.jbpm.svc.Services;
+
+/**
+ * Timer should employ the very calendar that computed the first due date to calculate
repeat
+ * dates.
+ *
+ * @see <a
href="https://jira.jboss.org/browse/JBPM-2958">JBPM-2958<...
+ * @author Alejandro Guizar
+ */
+public class TimerCalendarTest extends AbstractDbTestCase {
+
+ protected JbpmConfiguration getJbpmConfiguration() {
+ if (jbpmConfiguration == null) {
+ jbpmConfiguration =
JbpmConfiguration.parseResource("org/jbpm/jbpm2958/saturday-jbpm.cfg.xml");
+
+ JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
+ try {
+ DbPersistenceServiceFactory persistenceServiceFactory =
(DbPersistenceServiceFactory)
jbpmContext.getServiceFactory(Services.SERVICENAME_PERSISTENCE);
+ JbpmSchema jbpmSchema = new
JbpmSchema(persistenceServiceFactory.getConfiguration());
+ jbpmSchema.updateTable("JBPM_JOB");
+ }
+ finally {
+ jbpmContext.close();
+ }
+ }
+ return jbpmConfiguration;
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ ProcessDefinition processDefinition =
ProcessDefinition.parseXmlResource("org/jbpm/jbpm2958/processdefinition.xml");
+ deployProcessDefinition(processDefinition);
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ jbpmConfiguration.close();
+ }
+
+ public void testTimerCalendarResource() {
+ // baseDate is a Friday, one hour before close of business
+ Calendar calendar = Calendar.getInstance();
+ calendar.set(2010, Calendar.OCTOBER, 8, 16, 0, 0);
+ calendar.set(Calendar.MILLISECOND, 0);
+ Date baseDate = calendar.getTime();
+
+ // processInstance schedules a timer due on baseDate
+ // in jbpmConfiguration, Saturday is a work day
+ ProcessInstance processInstance =
jbpmContext.newProcessInstanceForUpdate("jbpm2958");
+ processInstance.getContextInstance().setVariable("baseDate", baseDate);
+ processInstance.signal();
+
+ closeJbpmContext();
+ try {
+ // in standardConfiguration, Saturday is NOT a work day
+ JbpmConfiguration standardConfiguration =
JbpmConfiguration.parseResource("org/jbpm/jbpm2958/jbpm.cfg.xml");
+ JbpmContext standardContext = standardConfiguration.createJbpmContext();
+ try {
+ Timer timer = (Timer) standardContext.getSession()
+ .createCriteria(Timer.class)
+ .uniqueResult();
+ timer.execute(standardContext);
+ }
+ catch (Exception e) {
+ standardContext.setRollbackOnly();
+ fail(e.getMessage());
+ }
+ finally {
+ standardContext.close();
+ standardConfiguration.close();
+ }
+ }
+ finally {
+ createJbpmContext();
+ }
+
+ calendar.add(Calendar.HOUR, 2);
+ // there are 16 hours between 17:00 and 9:00
+ calendar.add(Calendar.HOUR, 16);
+ // repeatDate is a Saturday
+ Date repeatDate = calendar.getTime();
+
+ Timer timer = (Timer) session.createCriteria(Timer.class).uniqueResult();
+ assertEquals(repeatDate, new Date(timer.getDueDate().getTime()));
+
+ processInstance = jbpmContext.loadProcessInstanceForUpdate(processInstance.getId());
+ processInstance.signal();
+ assert processInstance.hasEnded() : "expected " + processInstance + "
to have ended";
+ }
+}
Property changes on:
jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/jbpm2958/TimerCalendarTest.java
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/log4j.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/log4j.xml 2010-10-16 02:10:32 UTC
(rev 6762)
+++ jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/log4j.xml 2010-10-16 13:21:11 UTC
(rev 6763)
@@ -37,13 +37,18 @@
<priority value="DEBUG" />
</category>
+ <!-- stale state errors -->
+ <category name="org.jbpm.persistence.db.StaleObjectLogConfigurer">
+ <priority value="OFF" />
+ </category>
+
<category name="org.hibernate">
<priority value="INFO" />
</category>
<!-- proxy narrowing warnings -->
<category
name="org.hibernate.engine.StatefulPersistenceContext.ProxyWarnLog">
- <priority value="ERROR" />
+ <priority value="OFF" />
</category>
<!-- optimistic locking failures
Added:
jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/context/exe/jbpm.cfg.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/context/exe/jbpm.cfg.xml
(rev 0)
+++
jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/context/exe/jbpm.cfg.xml 2010-10-16
13:21:11 UTC (rev 6763)
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<jbpm-configuration>
+ <jbpm-context>
+ <service name="authentication"
factory="org.jbpm.security.authentication.DefaultAuthenticationServiceFactory"
/>
+ <!-- disable logging service to prevent logs from referencing custom object
-->
+ <service name="message"
factory="org.jbpm.msg.db.DbMessageServiceFactory" />
+ <service name="persistence"
factory="org.jbpm.persistence.db.DbPersistenceServiceFactory" />
+ <service name="scheduler"
factory="org.jbpm.scheduler.db.DbSchedulerServiceFactory" />
+ <service name="tx" factory="org.jbpm.tx.TxServiceFactory"
/>
+ </jbpm-context>
+</jbpm-configuration>
\ No newline at end of file
Property changes on:
jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/context/exe/jbpm.cfg.xml
___________________________________________________________________
Name: svn:eol-style
+ native
Added:
jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/graph/node/jbpm.cfg.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/graph/node/jbpm.cfg.xml
(rev 0)
+++
jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/graph/node/jbpm.cfg.xml 2010-10-16
13:21:11 UTC (rev 6763)
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<jbpm-configuration>
+ <string name='resource.hibernate.cfg.xml'
value='org/jbpm/graph/node/hibernate.cfg.xml' />
+</jbpm-configuration>
Property changes on:
jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/graph/node/jbpm.cfg.xml
___________________________________________________________________
Name: svn:eol-style
+ native
Deleted:
jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm2908/jbpm-no-auto.cfg.xml
===================================================================
---
jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm2908/jbpm-no-auto.cfg.xml 2010-10-16
02:10:32 UTC (rev 6762)
+++
jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm2908/jbpm-no-auto.cfg.xml 2010-10-16
13:21:11 UTC (rev 6763)
@@ -1,4 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<jbpm-configuration>
- <string name="resource.hibernate.cfg.xml"
value="hibernate-no-auto.cfg.xml" />
-</jbpm-configuration>
Deleted:
jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm2908/jbpm.cfg.xml
===================================================================
---
jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm2908/jbpm.cfg.xml 2010-10-16
02:10:32 UTC (rev 6762)
+++
jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm2908/jbpm.cfg.xml 2010-10-16
13:21:11 UTC (rev 6763)
@@ -1,2 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<jbpm-configuration />
Copied: jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm2908/jbpm.cfg.xml
(from rev 6741,
jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm2908/jbpm-no-auto.cfg.xml)
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm2908/jbpm.cfg.xml
(rev 0)
+++
jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm2908/jbpm.cfg.xml 2010-10-16
13:21:11 UTC (rev 6763)
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<jbpm-configuration>
+ <string name="resource.hibernate.cfg.xml"
value="org/jbpm/jbpm2908/hibernate.cfg.xml" />
+</jbpm-configuration>
Modified:
jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm2908/processdefinition1.xml
===================================================================
---
jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm2908/processdefinition1.xml 2010-10-16
02:10:32 UTC (rev 6762)
+++
jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm2908/processdefinition1.xml 2010-10-16
13:21:11 UTC (rev 6763)
@@ -7,7 +7,7 @@
<node name="node1">
<event type="node-enter">
- <action class="org.jbpm.jbpm2908.ChangeJbpmConfigurationAction" />
+ <action class="org.jbpm.jbpm2908.AlternateConfigurationAction" />
</event>
<transition to="end" />
</node>
Added: jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm2958/gpd.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm2958/gpd.xml
(rev 0)
+++
jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm2958/gpd.xml 2010-10-16
13:21:11 UTC (rev 6763)
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<root-container name="jbpm2958" width="788"
height="585">
+ <node name="start" x="96" y="48" width="121"
height="37">
+ <edge>
+ <label x="5" y="-10"/>
+ </edge>
+ </node>
+ <node name="midway" x="96" y="120"
width="121" height="37">
+ <edge>
+ <label x="5" y="-10"/>
+ </edge>
+ </node>
+ <node name="end" x="0" y="0" width="132"
height="36"/>
+ <deployment serverName="" serverPort=""
serverDeployer="">
+ <classesAndResources/>
+ <filesAndFolders>
+ <element
value="/jbpm-jpdl/src/test/resources/org/jbpm/jbpm2958/gpd.xml"/>
+ <element
value="/jbpm-jpdl/src/test/resources/org/jbpm/jbpm2958/processdefinition.xml"/>
+ </filesAndFolders>
+ </deployment>
+</root-container>
Property changes on:
jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm2958/gpd.xml
___________________________________________________________________
Name: svn:eol-style
+ native
Added: jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm2958/jbpm.cfg.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm2958/jbpm.cfg.xml
(rev 0)
+++
jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm2958/jbpm.cfg.xml 2010-10-16
13:21:11 UTC (rev 6763)
@@ -0,0 +1,5 @@
+<?xml version="1.0"?>
+
+<jbpm-configuration>
+ <string name="resource.hibernate.cfg.xml"
value="org/jbpm/jbpm2958/hibernate.cfg.xml" />
+</jbpm-configuration>
\ No newline at end of file
Property changes on:
jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm2958/jbpm.cfg.xml
___________________________________________________________________
Name: svn:eol-style
+ native
Added:
jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm2958/processdefinition.xml
===================================================================
---
jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm2958/processdefinition.xml
(rev 0)
+++
jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm2958/processdefinition.xml 2010-10-16
13:21:11 UTC (rev 6763)
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<process-definition xmlns="urn:jbpm.org:jpdl-3.2"
name="jbpm2958">
+ <start-state name="start">
+ <transition to="midway" />
+ </start-state>
+
+ <state name="midway">
+ <timer duedate="${baseDate}" repeat="2 business hours">
+ <action />
+ </timer>
+ <transition to="end" />
+ </state>
+
+ <end-state name="end" />
+</process-definition>
\ No newline at end of file
Property changes on:
jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm2958/processdefinition.xml
___________________________________________________________________
Name: svn:eol-style
+ native
Added:
jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm2958/saturday-business-calendar.properties
===================================================================
---
jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm2958/saturday-business-calendar.properties
(rev 0)
+++
jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm2958/saturday-business-calendar.properties 2010-10-16
13:21:11 UTC (rev 6763)
@@ -0,0 +1,49 @@
+hour.format=HH:mm
+# weekday ::= [<daypart> [& <daypart>]*]
+# daypart ::= <start-hour>-<end-hour>
+# start-hour and end-hour must be in the hour.format
+# dayparts have to be ordered
+weekday.monday= 9:00-12:30 & 13:00-17:00
+weekday.tuesday= 9:00-12:30 & 13:00-17:00
+weekday.wednesday= 9:00-12:30 & 13:00-17:00
+weekday.thursday= 9:00-12:30 & 13:00-17:00
+weekday.friday= 9:00-12:30 & 13:00-17:00
+weekday.saturday= 9:00-13:00
+weekday.sunday=
+
+day.format=dd/MM/yyyy
+# holiday ::= <holiday-period>
+# holiday-period ::= <start-day> [- <end-day>]
+# start-day and end-day must be in the day.format
+# below are the u.s. official holidays
+# new year's day
+holiday.1= 01/01/2010
+# birthday of martin luther king
+holiday.2= 18/01/2010
+# washington's birthday
+holiday.3= 15/02/2010
+# memorial day
+holiday.4= 31/05/2010
+# independence day
+holiday.5= 05/07/2010
+# labor day
+holiday.6= 06/09/2010
+# columbus day
+holiday.7= 11/10/2010
+# veterans day
+holiday.8= 11/11/2010
+# thanksgiving day
+holiday.9= 25/11/2010
+# day after thanksgiving
+holiday.10= 26/11/2010
+# christmas day
+holiday.11= 24/12/2010
+
+# typical workday excluding breaks
+business.day.expressed.in.hours= 7.5
+# 7.5 hours * 5 days a week
+business.week.expressed.in.hours= 37.5
+# 253 business days / 12 months
+business.month.expressed.in.business.days= 20.75
+# 365 natural days - 105 weekend days - 7 holidays
+business.year.expressed.in.business.days= 249
Property changes on:
jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm2958/saturday-business-calendar.properties
___________________________________________________________________
Name: svn:eol-style
+ native
Added:
jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm2958/saturday-jbpm.cfg.xml
===================================================================
---
jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm2958/saturday-jbpm.cfg.xml
(rev 0)
+++
jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm2958/saturday-jbpm.cfg.xml 2010-10-16
13:21:11 UTC (rev 6763)
@@ -0,0 +1,7 @@
+<?xml version="1.0"?>
+
+<jbpm-configuration>
+ <string name="resource.hibernate.cfg.xml"
value="org/jbpm/jbpm2958/hibernate.cfg.xml" />
+ <string name="resource.business.calendar"
+ value="org/jbpm/jbpm2958/saturday-business-calendar.properties" />
+</jbpm-configuration>
\ No newline at end of file
Property changes on:
jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm2958/saturday-jbpm.cfg.xml
___________________________________________________________________
Name: svn:eol-style
+ native