[jboss-svn-commits] JBL Code SVN: r10890 - in labs/jbossesb/trunk/product/samples/quickstarts/jbpm_simple1: src/quickstart/jbpm_simple1 and 1 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Wed Apr 11 11:51:19 EDT 2007
Author: kurt.stam at jboss.com
Date: 2007-04-11 11:51:19 -0400 (Wed, 11 Apr 2007)
New Revision: 10890
Removed:
labs/jbossesb/trunk/product/samples/quickstarts/jbpm_simple1/hibernate.cfg.xml
labs/jbossesb/trunk/product/samples/quickstarts/jbpm_simple1/jbpm.cfg.xml
labs/jbossesb/trunk/product/samples/quickstarts/jbpm_simple1/src/quickstart/jbpm_simple1/JbpmActionHandler.java
labs/jbossesb/trunk/product/samples/quickstarts/jbpm_simple1/src/quickstart/jbpm_simple1/TestLauncher.java
labs/jbossesb/trunk/product/samples/quickstarts/jbpm_simple1/src/quickstart/jbpm_simple1/test/JunitTest.java
Modified:
labs/jbossesb/trunk/product/samples/quickstarts/jbpm_simple1/build.xml
labs/jbossesb/trunk/product/samples/quickstarts/jbpm_simple1/src/quickstart/jbpm_simple1/test/TestCommandMessages.java
Log:
working on jbpm deployment
Modified: labs/jbossesb/trunk/product/samples/quickstarts/jbpm_simple1/build.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/jbpm_simple1/build.xml 2007-04-11 13:18:57 UTC (rev 10889)
+++ labs/jbossesb/trunk/product/samples/quickstarts/jbpm_simple1/build.xml 2007-04-11 15:51:19 UTC (rev 10890)
@@ -22,8 +22,9 @@
<fileset dir="${basedir}" includes="build/**/*.jar"/>
<fileset dir="${basedir}" includes="build/**/*.xml"/>
<fileset dir="../../../build/jbossesb/lib" includes="*.jar" />
- <pathelement location="." />
-
+ <pathelement location="." />
+ <pathelement location="../../../services/jbpm/build/jbpm.esb" />
+ <fileset dir="../../../services/jbpm/build/jbpm.esb" includes="*jar"/>
</path>
<property name="cp" refid="classpath"/>
Deleted: labs/jbossesb/trunk/product/samples/quickstarts/jbpm_simple1/hibernate.cfg.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/jbpm_simple1/hibernate.cfg.xml 2007-04-11 13:18:57 UTC (rev 10889)
+++ labs/jbossesb/trunk/product/samples/quickstarts/jbpm_simple1/hibernate.cfg.xml 2007-04-11 15:51:19 UTC (rev 10890)
@@ -1,178 +0,0 @@
-<?xml version='1.0' encoding='utf-8'?>
-
-<!DOCTYPE hibernate-configuration PUBLIC
- "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
- "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
-
-<hibernate-configuration>
- <session-factory>
- <!-- jdbc connection properties -->
- <property name="hibernate.dialect">org.hibernate.dialect.HSQLDialect</property>
- <property name="hibernate.connection.driver_class">org.hsqldb.jdbcDriver</property>
- <property name="hibernate.connection.url">jdbc:hsqldb:mem:.;sql.enforce_strict_size=true</property>
-<!--
- <property name="hibernate.connection.url">jdbc:hsqldb:hsql://localhost/juddi</property>
--->
- <property name="hibernate.connection.username">sa</property>
- <property name="hibernate.connection.password"></property>
-<!--
- <property name="hibernate.dialect">org.hibernate.dialect.PostgreSQLDialect</property>
- <property name="hibernate.connection.driver_class">org.postgresql.Driver</property>
- <property name="hibernate.connection.url">jdbc:postgresql://localhost:5432/JbpmDB</property>
- <property name="hibernate.connection.username">postgres</property>
- <property name="hibernate.connection.password"></property>
--->
-
-
- <property name="hibernate.cache.provider_class">org.hibernate.cache.HashtableCacheProvider</property>
-
- <!-- other hibernate properties
- <property name="hibernate.show_sql">true</property>
- <property name="hibernate.format_sql">true</property>
- <property name="hibernate.use_sql_comments">true</property>
- -->
-
- <!-- ############################################ -->
- <!-- # mapping files with external dependencies # -->
- <!-- ############################################ -->
-
- <!-- following mapping file has a dependendy on -->
- <!-- 'bsh-{version}.jar'. -->
- <!-- uncomment this if you don't have bsh on your -->
- <!-- classpath. you won't be able to use the -->
- <!-- script element in process definition files -->
- <mapping resource="org/jbpm/graph/action/Script.hbm.xml"/>
-
- <!-- following mapping files have a dependendy on -->
- <!-- 'jbpm-identity-{version}.jar', mapping files -->
- <!-- of the pluggable jbpm identity component. -->
- <!-- comment out the following 3 lines if you don't-->
- <!-- want to use the default jBPM identity mgmgt -->
- <!-- component -->
- <mapping resource="org/jbpm/identity/User.hbm.xml"/>
- <mapping resource="org/jbpm/identity/Group.hbm.xml"/>
- <mapping resource="org/jbpm/identity/Membership.hbm.xml"/>
-
- <!-- ###################### -->
- <!-- # jbpm mapping files # -->
- <!-- ###################### -->
-
- <!-- hql queries and type defs -->
- <mapping resource="org/jbpm/db/hibernate.queries.hbm.xml" />
-
- <!-- graph.def mapping files -->
- <mapping resource="org/jbpm/graph/def/ProcessDefinition.hbm.xml"/>
- <mapping resource="org/jbpm/graph/def/Node.hbm.xml"/>
- <mapping resource="org/jbpm/graph/def/Transition.hbm.xml"/>
- <mapping resource="org/jbpm/graph/def/Event.hbm.xml"/>
- <mapping resource="org/jbpm/graph/def/Action.hbm.xml"/>
- <mapping resource="org/jbpm/graph/def/SuperState.hbm.xml"/>
- <mapping resource="org/jbpm/graph/def/ExceptionHandler.hbm.xml"/>
- <mapping resource="org/jbpm/instantiation/Delegation.hbm.xml"/>
-
- <!-- graph.node mapping files -->
- <mapping resource="org/jbpm/graph/node/StartState.hbm.xml"/>
- <mapping resource="org/jbpm/graph/node/EndState.hbm.xml"/>
- <mapping resource="org/jbpm/graph/node/ProcessState.hbm.xml"/>
- <mapping resource="org/jbpm/graph/node/Decision.hbm.xml"/>
- <mapping resource="org/jbpm/graph/node/Fork.hbm.xml"/>
- <mapping resource="org/jbpm/graph/node/Join.hbm.xml"/>
- <mapping resource="org/jbpm/graph/node/State.hbm.xml"/>
- <mapping resource="org/jbpm/graph/node/TaskNode.hbm.xml"/>
-
- <!-- context.def mapping files -->
- <mapping resource="org/jbpm/context/def/ContextDefinition.hbm.xml"/>
- <mapping resource="org/jbpm/context/def/VariableAccess.hbm.xml"/>
-
- <!-- taskmgmt.def mapping files -->
- <mapping resource="org/jbpm/taskmgmt/def/TaskMgmtDefinition.hbm.xml"/>
- <mapping resource="org/jbpm/taskmgmt/def/Swimlane.hbm.xml"/>
- <mapping resource="org/jbpm/taskmgmt/def/Task.hbm.xml"/>
- <mapping resource="org/jbpm/taskmgmt/def/TaskController.hbm.xml"/>
-
- <!-- module.def mapping files -->
- <mapping resource="org/jbpm/module/def/ModuleDefinition.hbm.xml"/>
-
- <!-- bytes mapping files -->
- <mapping resource="org/jbpm/bytes/ByteArray.hbm.xml"/>
-
- <!-- file.def mapping files -->
- <mapping resource="org/jbpm/file/def/FileDefinition.hbm.xml"/>
-
- <!-- scheduler.def mapping files -->
- <mapping resource="org/jbpm/scheduler/def/CreateTimerAction.hbm.xml"/>
- <mapping resource="org/jbpm/scheduler/def/CancelTimerAction.hbm.xml"/>
-
- <!-- graph.exe mapping files -->
- <mapping resource="org/jbpm/graph/exe/Comment.hbm.xml"/>
- <mapping resource="org/jbpm/graph/exe/ProcessInstance.hbm.xml"/>
- <mapping resource="org/jbpm/graph/exe/Token.hbm.xml"/>
- <mapping resource="org/jbpm/graph/exe/RuntimeAction.hbm.xml"/>
-
- <!-- module.exe mapping files -->
- <mapping resource="org/jbpm/module/exe/ModuleInstance.hbm.xml"/>
-
- <!-- context.exe mapping files -->
- <mapping resource="org/jbpm/context/exe/ContextInstance.hbm.xml"/>
- <mapping resource="org/jbpm/context/exe/TokenVariableMap.hbm.xml"/>
- <mapping resource="org/jbpm/context/exe/VariableInstance.hbm.xml"/>
- <mapping resource="org/jbpm/context/exe/variableinstance/ByteArrayInstance.hbm.xml"/>
- <mapping resource="org/jbpm/context/exe/variableinstance/DateInstance.hbm.xml"/>
- <mapping resource="org/jbpm/context/exe/variableinstance/DoubleInstance.hbm.xml"/>
- <mapping resource="org/jbpm/context/exe/variableinstance/HibernateLongInstance.hbm.xml"/>
- <mapping resource="org/jbpm/context/exe/variableinstance/HibernateStringInstance.hbm.xml"/>
- <mapping resource="org/jbpm/context/exe/variableinstance/LongInstance.hbm.xml"/>
- <mapping resource="org/jbpm/context/exe/variableinstance/NullInstance.hbm.xml"/>
- <mapping resource="org/jbpm/context/exe/variableinstance/StringInstance.hbm.xml"/>
-
- <!-- msg.db mapping files -->
- <mapping resource="org/jbpm/msg/Message.hbm.xml"/>
- <mapping resource="org/jbpm/msg/db/TextMessage.hbm.xml"/>
- <mapping resource="org/jbpm/command/ExecuteActionCommand.hbm.xml"/>
- <mapping resource="org/jbpm/command/ExecuteNodeCommand.hbm.xml"/>
- <mapping resource="org/jbpm/command/SignalCommand.hbm.xml"/>
- <mapping resource="org/jbpm/command/TaskInstanceEndCommand.hbm.xml"/>
-
- <!-- taskmgmt.exe mapping files -->
- <mapping resource="org/jbpm/taskmgmt/exe/TaskMgmtInstance.hbm.xml"/>
- <mapping resource="org/jbpm/taskmgmt/exe/TaskInstance.hbm.xml"/>
- <mapping resource="org/jbpm/taskmgmt/exe/PooledActor.hbm.xml"/>
- <mapping resource="org/jbpm/taskmgmt/exe/SwimlaneInstance.hbm.xml"/>
-
- <!-- scheduler.exe mapping files -->
- <mapping resource="org/jbpm/scheduler/exe/Timer.hbm.xml"/>
-
- <!-- logging mapping files -->
- <mapping resource="org/jbpm/logging/log/ProcessLog.hbm.xml"/>
- <mapping resource="org/jbpm/logging/log/MessageLog.hbm.xml"/>
- <mapping resource="org/jbpm/logging/log/CompositeLog.hbm.xml"/>
- <mapping resource="org/jbpm/graph/log/ActionLog.hbm.xml"/>
- <mapping resource="org/jbpm/graph/log/NodeLog.hbm.xml"/>
- <mapping resource="org/jbpm/graph/log/ProcessInstanceCreateLog.hbm.xml"/>
- <mapping resource="org/jbpm/graph/log/ProcessInstanceEndLog.hbm.xml"/>
- <mapping resource="org/jbpm/graph/log/ProcessStateLog.hbm.xml"/>
- <mapping resource="org/jbpm/graph/log/SignalLog.hbm.xml"/>
- <mapping resource="org/jbpm/graph/log/TokenCreateLog.hbm.xml"/>
- <mapping resource="org/jbpm/graph/log/TokenEndLog.hbm.xml"/>
- <mapping resource="org/jbpm/graph/log/TransitionLog.hbm.xml"/>
- <mapping resource="org/jbpm/context/log/VariableLog.hbm.xml"/>
- <mapping resource="org/jbpm/context/log/VariableCreateLog.hbm.xml"/>
- <mapping resource="org/jbpm/context/log/VariableDeleteLog.hbm.xml"/>
- <mapping resource="org/jbpm/context/log/VariableUpdateLog.hbm.xml"/>
- <mapping resource="org/jbpm/context/log/variableinstance/ByteArrayUpdateLog.hbm.xml"/>
- <mapping resource="org/jbpm/context/log/variableinstance/DateUpdateLog.hbm.xml"/>
- <mapping resource="org/jbpm/context/log/variableinstance/DoubleUpdateLog.hbm.xml"/>
- <mapping resource="org/jbpm/context/log/variableinstance/HibernateLongUpdateLog.hbm.xml"/>
- <mapping resource="org/jbpm/context/log/variableinstance/HibernateStringUpdateLog.hbm.xml"/>
- <mapping resource="org/jbpm/context/log/variableinstance/LongUpdateLog.hbm.xml"/>
- <mapping resource="org/jbpm/context/log/variableinstance/StringUpdateLog.hbm.xml"/>
- <mapping resource="org/jbpm/taskmgmt/log/TaskLog.hbm.xml"/>
- <mapping resource="org/jbpm/taskmgmt/log/TaskCreateLog.hbm.xml"/>
- <mapping resource="org/jbpm/taskmgmt/log/TaskAssignLog.hbm.xml"/>
- <mapping resource="org/jbpm/taskmgmt/log/TaskEndLog.hbm.xml"/>
- <mapping resource="org/jbpm/taskmgmt/log/SwimlaneLog.hbm.xml"/>
- <mapping resource="org/jbpm/taskmgmt/log/SwimlaneCreateLog.hbm.xml"/>
- <mapping resource="org/jbpm/taskmgmt/log/SwimlaneAssignLog.hbm.xml"/>
-
- </session-factory>
-</hibernate-configuration>
Deleted: labs/jbossesb/trunk/product/samples/quickstarts/jbpm_simple1/jbpm.cfg.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/jbpm_simple1/jbpm.cfg.xml 2007-04-11 13:18:57 UTC (rev 10889)
+++ labs/jbossesb/trunk/product/samples/quickstarts/jbpm_simple1/jbpm.cfg.xml 2007-04-11 15:51:19 UTC (rev 10890)
@@ -1,9 +0,0 @@
-<jbpm-configuration>
-
- <!--
- The default configurations can be found in org/jbpm/default.jbpm.cfg.xml
- Those configurations can be overwritten by putting this file called
- jbpm.cfg.xml on the root of the classpath and put in the customized values.
- -->
-
-</jbpm-configuration>
Deleted: labs/jbossesb/trunk/product/samples/quickstarts/jbpm_simple1/src/quickstart/jbpm_simple1/JbpmActionHandler.java
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/jbpm_simple1/src/quickstart/jbpm_simple1/JbpmActionHandler.java 2007-04-11 13:18:57 UTC (rev 10889)
+++ labs/jbossesb/trunk/product/samples/quickstarts/jbpm_simple1/src/quickstart/jbpm_simple1/JbpmActionHandler.java 2007-04-11 15:51:19 UTC (rev 10890)
@@ -1,21 +0,0 @@
-package quickstart.jbpm_simple1;
-
-import org.apache.log4j.Logger;
-import org.jbpm.graph.def.ActionHandler;
-import org.jbpm.graph.exe.ExecutionContext;
-
-public class JbpmActionHandler implements ActionHandler {
-
- public String message;
- private static final long serialVersionUID = 1L;
-
- public void execute(ExecutionContext ctx) throws Exception {
- ctx.getContextInstance().setVariable("message", message);
- ctx.getContextInstance().setVariable("invocationCounter",++_counter);
- _logger.info(getClass().getSimpleName()+" invoked - count = "+_counter);
-
- }
-
- private static int _counter = 0;
- static Logger _logger=Logger.getLogger(JbpmActionHandler.class);
-}
\ No newline at end of file
Deleted: labs/jbossesb/trunk/product/samples/quickstarts/jbpm_simple1/src/quickstart/jbpm_simple1/TestLauncher.java
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/jbpm_simple1/src/quickstart/jbpm_simple1/TestLauncher.java 2007-04-11 13:18:57 UTC (rev 10889)
+++ labs/jbossesb/trunk/product/samples/quickstarts/jbpm_simple1/src/quickstart/jbpm_simple1/TestLauncher.java 2007-04-11 15:51:19 UTC (rev 10890)
@@ -1,168 +0,0 @@
-package quickstart.jbpm_simple1;
-
-import static org.junit.Assert.assertTrue;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.InputStream;
-import java.sql.DriverManager;
-import java.sql.Statement;
-import java.util.Properties;
-
-import org.apache.log4j.Logger;
-import org.apache.log4j.xml.DOMConfigurator;
-import org.jboss.soa.esb.common.Environment;
-import org.jboss.soa.esb.common.ModulePropertyManager;
-import org.jboss.soa.esb.listeners.StandAloneBootStrapper;
-import org.jboss.soa.esb.testutils.FileUtil;
-import org.jboss.soa.esb.testutils.HsqldbUtil;
-import org.jboss.soa.esb.testutils.TestEnvironmentUtil;
-import org.jbpm.JbpmConfiguration;
-
-import com.arjuna.common.util.propertyservice.PropertyManager;
-
-public class TestLauncher {
-
- private static Logger _logger = Logger.getLogger(TestLauncher.class);
-
- public static void main(String[] args) throws Exception
- {
- try
- {
- _config = JbpmConfiguration.getInstance();
-
-// try { dropJbpmSchema(); }
-// catch (Exception e) {}
-
- createJbpmSchema();
- setupRegistry();
- runBeforeTest();
- StandAloneBootStrapper.main(args);
- }
- finally
- {
- runAfterTest();
- dropJbpmSchema();
- }
- } //________________________________
-
- static JbpmConfiguration _config;
- static void createJbpmSchema()
- {
- _logger.info("&&&&&&&&&&&&&&& CREATING jBPM schema");
- _config.createSchema();
- }
- static void dropJbpmSchema()
- {
- if (null!=_config)
- {
- _logger.info("&&&&&&&&&&&&&&& Dropping jBPM schema");
- _config.dropSchema();
- _config.close();
- }
- }
-
- public static void runAfterTest()
- {
- try
- {
- Thread.sleep(2000);
- if ("org.hsqldb.jdbcDriver".equals(mDbDriver))
- HsqldbUtil.stopHsqldb(mDbUrl, mDbUsername, mDbPassword);
- }
- catch (Exception e) {}
- }
-
- public static void runBeforeTest()
- {
- try {
-
- String userDir = System.getProperty("user.dir");
- String baseDir = (userDir.endsWith("jbpm_simple1"))
- ? userDir
- : userDir + "/product/samples/quickstarts/jbpm_simple1";
- DOMConfigurator.configure(baseDir + "/log4j.xml");
- TestEnvironmentUtil.setESBPropertiesFileToUse(".");
-
- //Set the juddi properties file in System so juddi will pick it up later and use the test values.
- baseDir = (userDir.endsWith("jbpm_simple1"))
- ? userDir+"/../../../.."
- : userDir;
- String juddiPropertiesFile = baseDir+"/qa/junit/src/org/jboss/soa/esb/services/registry/juddi-qatest.properties";
-
- System.setProperty("juddi.propertiesFile", juddiPropertiesFile);
- //Read this properties file to get the db connection string
- Properties props = new Properties();
- InputStream inStream = new FileInputStream(juddiPropertiesFile);
- props.load(inStream);
- mDbDriver = props.getProperty("juddi.jdbcDriver");
- mDbUrl = props.getProperty("juddi.jdbcUrl");
- mDbUsername = props.getProperty("juddi.jdbcUsername");
- mDbPassword = props.getProperty("juddi.jdbcPassword");
-
- String database="not tested yet";
- if ("org.hsqldb.jdbcDriver".equals(mDbDriver)) {
- database = "hsqldb";
- //Bring up hsql on default port 9001
- HsqldbUtil.startHsqldb(TestEnvironmentUtil.getUserDir("product","../product") + "build/hsqltestdb", "juddi");
- } else if ("com.mysql.jdbc.Driver".equals(mDbDriver)) {
- database = "mysql";
- } //add and test your own database..
-
- //Get the registry-schema create scripts
- String sqlDir = baseDir+"/product/install/jUDDI-registry/sql/" + database + "/";
- //Drop what is there now, if exists. We want to start fresh.
- String sqlDropCmd = FileUtil.readTextFile(new File(sqlDir + "drop_database.sql"));
- String sqlCreateCmd = FileUtil.readTextFile(new File(sqlDir + "create_database.sql"));
- String sqlInsertPubCmd = FileUtil.readTextFile(new File(sqlDir + "insert_publishers.sql"));
-
- try {
- Class.forName(mDbDriver);
- } catch (Exception e) {
- System.out.println("ERROR: failed to load " + database + " JDBC driver.");
- e.printStackTrace();
- return;
- }
- java.sql.Connection con = DriverManager.getConnection(mDbUrl, mDbUsername, mDbPassword);
- Statement stmnt = con.createStatement();
- stmnt.execute(sqlDropCmd);
- stmnt.execute(sqlCreateCmd);
- stmnt.execute(sqlInsertPubCmd);
-
- } catch (Throwable e) {
- e.printStackTrace();
- System.out.println("We should stop testing, since we don't have a db.");
- assertTrue(false);
- }
- }
-
- private static String mDbDriver;
- private static String mDbUrl;
- private static String mDbUsername;
- private static String mDbPassword;
-
- /**
- * Invocation of this method should be unnecessary.
- * Had to invoke it because I had trouble to have the properties loaded from jbossesb-properties.xml
- * Once that is solved, you can get rid of the invocation to this method (up in the run() )
- */
- protected static void setupRegistry() {
- PropertyManager mgr = null;
-
- mgr = ModulePropertyManager.getPropertyManager("registry");
- mgr.setProperty(Environment.REGISTRY_IMPEMENTATION_CLASS,"org.jboss.internal.soa.esb.services.registry.JAXRRegistryImpl");
- mgr.setProperty(Environment.REGISTRY_QUERY_MANAGER_URI,"jnp://localhost:1099/InquiryService?org.apache.juddi.registry.rmi.Inquiry#inquire");
- mgr.setProperty(Environment.REGISTRY_LIFECYCLE_MANAGER_URI,"jnp://localhost:1099/PublishService?org.apache.juddi.registry.rmi.Publish#publish");
- mgr.setProperty(Environment.REGISTRY_FACTORY_CLASS,"org.apache.ws.scout.registry.ConnectionFactoryImpl");
- mgr.setProperty(Environment.REGISTRY_SCOUT_TRANSPORT_CLASS,"org.apache.ws.scout.transport.RMITransport");
- mgr.setProperty(Environment.REGISTRY_USER,"jbossesb");
- mgr.setProperty(Environment.REGISTRY_PASSWORD,"password");
- System.setProperty("javax.xml.registry.ConnectionFactoryClass", "org.apache.ws.scout.registry.ConnectionFactoryImpl");
-
- mgr = ModulePropertyManager.getPropertyManager(ModulePropertyManager.CORE_MODULE) ;
- mgr.setProperty(Environment.REGISTRY_FILE_HELPER_DIR, System.getProperty("java.io.tmpdir","/tmp")) ;
-
- }
-
-
-}
Deleted: labs/jbossesb/trunk/product/samples/quickstarts/jbpm_simple1/src/quickstart/jbpm_simple1/test/JunitTest.java
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/jbpm_simple1/src/quickstart/jbpm_simple1/test/JunitTest.java 2007-04-11 13:18:57 UTC (rev 10889)
+++ labs/jbossesb/trunk/product/samples/quickstarts/jbpm_simple1/src/quickstart/jbpm_simple1/test/JunitTest.java 2007-04-11 15:51:19 UTC (rev 10890)
@@ -1,86 +0,0 @@
-package quickstart.jbpm_simple1.test;
-
-import junit.framework.TestCase;
-
-import org.apache.log4j.Logger;
-import org.jbpm.JbpmConfiguration;
-import org.jbpm.JbpmContext;
-import org.jbpm.graph.def.ProcessDefinition;
-import org.jbpm.graph.exe.ProcessInstance;
-
-public class JunitTest extends TestCase {
-
- JbpmConfiguration _config;
- JbpmContext _ctx;
-
- public void setUp() {
- _config = JbpmConfiguration.getInstance();
- _config.createSchema();
- _ctx = _config.createJbpmContext();
- }
-
- public void tearDown() {
- if (null!=_ctx) _ctx.close();
- if (null!=_config)
- {
- _config.dropSchema();
- _config.close();
- }
- }
-
- public void testSimpleProcess() throws Exception {
- ProcessDefinition processDefinition = ProcessDefinition.parseXmlResource("processdefinition.xml");
- assertNotNull("Definition should not be null", processDefinition);
-
- _ctx.getSession().saveOrUpdate(processDefinition);
- String processName = processDefinition.getName();
- processDefinition = null;
-
-
- _ctx.close();
- _ctx = _config.createJbpmContext();
- ProcessInstance instance = _ctx.newProcessInstance(processName);
- assertEquals(
- "Instance is in start state",
- instance.getRootToken().getNode().getName(),
- "start");
- assertNull(
- "Message variable should not exist yet",
- instance.getContextInstance().getVariable("message"));
-
- instance.signal();
- _ctx.save(instance);
- long instanceId = instance.getId();
-
- _ctx.close();
- _ctx = _config.createJbpmContext();
- instance = _ctx.loadProcessInstanceForUpdate(instanceId);
- assertEquals(
- "Instance is in first state",
- instance.getRootToken().getNode().getName(),
- "first");
-
- instance.signal();
- _ctx.save(instance);
-
- _ctx.close();
- _ctx = _config.createJbpmContext();
- instance = _ctx.loadProcessInstanceForUpdate(instanceId);
- assertEquals(
- "Instance is in end state",
- instance.getRootToken().getNode().getName(),
- "end");
-
- _logger.info(
- "Context variable invocationCounter contains "
- +instance.getContextInstance().getVariable("invocationCounter"));
-
- assertTrue("Instance has ended", instance.hasEnded());
- assertEquals(
- "Message variable is changed",
- instance.getContextInstance().getVariable("message"),
- "About to finish!");
-
- }
- Logger _logger = Logger.getLogger(JunitTest.class);
-}
Modified: labs/jbossesb/trunk/product/samples/quickstarts/jbpm_simple1/src/quickstart/jbpm_simple1/test/TestCommandMessages.java
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/jbpm_simple1/src/quickstart/jbpm_simple1/test/TestCommandMessages.java 2007-04-11 13:18:57 UTC (rev 10889)
+++ labs/jbossesb/trunk/product/samples/quickstarts/jbpm_simple1/src/quickstart/jbpm_simple1/test/TestCommandMessages.java 2007-04-11 15:51:19 UTC (rev 10890)
@@ -37,7 +37,9 @@
// following call should not be necessary - see method for comments
setupRegistry();
new TestCommandMessages().run();
- }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
finally
{
System.exit(0);
@@ -70,8 +72,8 @@
public void run() throws Exception {
- String category = "categoryJbpmSimple1";
- String name = "nameJbpmSimple1";
+ String category = "categoryJbpmService";
+ String name = "nameJbpmService";
Collection<EPR> eprs = RegistryUtil.getEprs(category, name);
if (eprs.size()<1)
More information about the jboss-svn-commits
mailing list