[jbpm-commits] JBoss JBPM SVN: r6196 - in jbpm3/branches/jbpm-3.2-soa/modules/core/src: test/java/org/jbpm/jpdl/par and 1 other directory.
do-not-reply at jboss.org
do-not-reply at jboss.org
Fri Feb 26 00:26:55 EST 2010
Author: alex.guizar at jboss.com
Date: 2010-02-26 00:26:54 -0500 (Fri, 26 Feb 2010)
New Revision: 6196
Modified:
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/svc/Services.java
jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/jpdl/par/ProcessClassLoaderTest.java
Log:
JBPM-2802: revert regression in Services.hasService
Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/svc/Services.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/svc/Services.java 2010-02-26 04:40:39 UTC (rev 6195)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/svc/Services.java 2010-02-26 05:26:54 UTC (rev 6196)
@@ -137,7 +137,7 @@
}
public boolean hasService(String name) {
- return getService(name) != null;
+ return services != null ? services.containsKey(name) : false;
}
public Service getService(String name) {
Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/jpdl/par/ProcessClassLoaderTest.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/jpdl/par/ProcessClassLoaderTest.java 2010-02-26 04:40:39 UTC (rev 6195)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/jpdl/par/ProcessClassLoaderTest.java 2010-02-26 05:26:54 UTC (rev 6196)
@@ -13,10 +13,11 @@
import org.jbpm.util.ClassLoaderUtil;
/**
- * Test case for ProcessClassLoader hierarchy and setting the ContextClassLoader correctly. Relates
- * to {@link ConfigurableClassLoadersTest}.
+ * Test case for ProcessClassLoader hierarchy and setting the ContextClassLoader
+ * correctly. Relates to {@link ConfigurableClassLoadersTest}.
*
- * @author Tom Baeyens, bernd.ruecker at camunda.com
+ * @author Tom Baeyens
+ * @author bernd.ruecker at camunda.com
*/
public class ProcessClassLoaderTest extends AbstractJbpmTestCase {
@@ -27,8 +28,8 @@
}
}
- static int contextLoadedActionInvocations = 0;
- static ClassLoader originalClassLoader = null;
+ static int contextLoadedActionInvocations;
+ static ClassLoader originalClassLoader;
protected void setUp() throws Exception {
super.setUp();
@@ -52,23 +53,23 @@
}
/*
- * DOES NOT configure usage of the context classloader. So this tests the default (backwards
- * compatible) behaviour. so the classloading hierarchy of DefaultLoadedAction should be
- * ProcessClassloader -> jbpm-lib classloader
+ * DOES NOT configure usage of the context classloader. So this tests the
+ * default (backwards compatible) behaviour. so the classloading hierarchy of
+ * DefaultLoadedAction should be ProcessClassloader -> jbpm-lib classloader
*/
public void testDefaultClassLoader() {
ProcessDefinition processDefinition = ProcessDefinition.parseXmlString("<process-definition>"
- + " <start-state name='start'>"
- + " <transition to='state'>"
- + " <action class='"
- + DefaultLoadedAction.class.getName()
- + "' />"
- + " </transition>"
- + " </start-state>"
- + " <state name='state'>"
- + " <transition to='end'/>"
- + " </state>"
- + "</process-definition>");
+ + " <start-state name='start'>"
+ + " <transition to='state'>"
+ + " <action class='"
+ + DefaultLoadedAction.class.getName()
+ + "' />"
+ + " </transition>"
+ + " </start-state>"
+ + " <state name='state'>"
+ + " <transition to='end'/>"
+ + " </state>"
+ + "</process-definition>");
// create the process instance
ProcessInstance processInstance = new ProcessInstance(processDefinition);
@@ -89,40 +90,38 @@
assertSame(TestContextClassLoader.class, testContextClassLoader.getClass());
assertSame(originalClassLoader, testContextClassLoader.getParent());
-
contextLoadedActionInvocations++;
}
}
/*
- * configures usage of the context classloader so the classloading hierarchy of
- * ContextLoadedAction should be ProcessClassloader -> TestContextClassLoader ->
- * Thread.currentContextClassLoader
+ * configures usage of the context classloader so the classloading hierarchy
+ * of ContextLoadedAction should be ProcessClassloader ->
+ * TestContextClassLoader -> Thread.currentContextClassLoader
*/
public void testContextClassLoader() {
-
JbpmConfiguration jbpmConfiguration = JbpmConfiguration.parseXmlString("<jbpm-configuration>"
- + " <string name='jbpm.class.loader' value='context' />"
- + "</jbpm-configuration>");
+ + " <string name='jbpm.class.loader' value='context' />"
+ + "</jbpm-configuration>");
JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
try {
TestContextClassLoader testContextClassLoader = new TestContextClassLoader(
- originalClassLoader);
+ originalClassLoader);
Thread.currentThread().setContextClassLoader(testContextClassLoader);
ProcessDefinition processDefinition = ProcessDefinition.parseXmlString("<process-definition>"
- + " <start-state name='start'>"
- + " <transition to='state'>"
- + " <action class='"
- + ContextLoadedAction.class.getName()
- + "' />"
- + " </transition>"
- + " </start-state>"
- + " <state name='state'>"
- + " <transition to='end'/>"
- + " </state>"
- + "</process-definition>");
+ + " <start-state name='start'>"
+ + " <transition to='state'>"
+ + " <action class='"
+ + ContextLoadedAction.class.getName()
+ + "' />"
+ + " </transition>"
+ + " </start-state>"
+ + " <state name='state'>"
+ + " <transition to='end'/>"
+ + " </state>"
+ + "</process-definition>");
// create the process instance
ProcessInstance processInstance = new ProcessInstance(processDefinition);
@@ -139,9 +138,10 @@
}
/*
- * a third test should set the testcontextClassLoader in the test and then let the action throw an
- * exception. Then it should be verified that the original classloader is still restored
- * correctly. Easiest is to start from a copy of the testContextClassLoader
+ * a third test should set the testcontextClassLoader in the test and then let
+ * the action throw an exception. Then it should be verified that the original
+ * classloader is still restored correctly. Easiest is to start from a copy of
+ * the testContextClassLoader
*/
public static class ContextLoadedExceptionAction implements ActionHandler {
@@ -155,7 +155,6 @@
assertSame(TestContextClassLoader.class, testContextClassLoader.getClass());
assertSame(originalClassLoader, testContextClassLoader.getParent());
-
contextLoadedActionInvocations++;
throw new JbpmException("simulate exception");
@@ -164,37 +163,36 @@
public void testContextClassLoaderException() {
JbpmConfiguration jbpmConfiguration = JbpmConfiguration.parseXmlString("<jbpm-configuration>"
- + " <string name='jbpm.class.loader' value='context' />"
- + "</jbpm-configuration>");
+ + " <string name='jbpm.class.loader' value='context' />"
+ + "</jbpm-configuration>");
JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
- TestContextClassLoader testContextClassLoader = new TestContextClassLoader(originalClassLoader);
+ TestContextClassLoader testContextClassLoader = new TestContextClassLoader(
+ originalClassLoader);
try {
Thread.currentThread().setContextClassLoader(testContextClassLoader);
ProcessDefinition processDefinition = ProcessDefinition.parseXmlString("<process-definition>"
- + " <start-state name='start'>"
- + " <transition to='state'>"
- + " <action class='"
- + ContextLoadedExceptionAction.class.getName()
- + "' />"
- + " </transition>"
- + " </start-state>"
- + " <state name='state'>"
- + " <transition to='end'/>"
- + " </state>"
- + "</process-definition>");
+ + " <start-state name='start'>"
+ + " <transition to='state'>"
+ + " <action class='"
+ + ContextLoadedExceptionAction.class.getName()
+ + "' />"
+ + " </transition>"
+ + " </start-state>"
+ + " <state name='state'>"
+ + " <transition to='end'/>"
+ + " </state>"
+ + "</process-definition>");
// create the process instance
ProcessInstance processInstance = new ProcessInstance(processDefinition);
processInstance.signal();
-
}
catch (JbpmException ex) {
assertEquals(1, contextLoadedActionInvocations);
assertEquals("simulate exception", ex.getMessage());
assertSame(testContextClassLoader, Thread.currentThread().getContextClassLoader());
-
}
finally {
Thread.currentThread().setContextClassLoader(originalClassLoader);
More information about the jbpm-commits
mailing list