[jboss-svn-commits] JBL Code SVN: r11117 - in labs/jbossesb/trunk/product/samples/quickstarts/jbpm_simple1: src/quickstart/jbpm_simple1/test and 1 other directory.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Thu Apr 19 04:06:56 EDT 2007
Author: estebanschifman
Date: 2007-04-19 04:06:56 -0400 (Thu, 19 Apr 2007)
New Revision: 11117
Removed:
labs/jbossesb/trunk/product/samples/quickstarts/jbpm_simple1/src/quickstart/jbpm_simple1/test/TestCommandMessages.java
Modified:
labs/jbossesb/trunk/product/samples/quickstarts/jbpm_simple1/
Log:
Migrate jbpm related libraries/classes to jBPM-jpdl 3.2
Property changes on: labs/jbossesb/trunk/product/samples/quickstarts/jbpm_simple1
___________________________________________________________________
Name: svn:ignore
-
build
product
+ build
product
gpd.xml
Deleted: 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-19 08:03:43 UTC (rev 11116)
+++ labs/jbossesb/trunk/product/samples/quickstarts/jbpm_simple1/src/quickstart/jbpm_simple1/test/TestCommandMessages.java 2007-04-19 08:06:56 UTC (rev 11117)
@@ -1,251 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, 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 quickstart.jbpm_simple1.test;
-
-import java.io.ByteArrayOutputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.InputStream;
-import java.net.URISyntaxException;
-import java.util.Collection;
-
-import org.apache.log4j.Logger;
-import org.jboss.soa.esb.addressing.EPR;
-import org.jboss.soa.esb.addressing.MalformedEPRException;
-import org.jboss.soa.esb.common.Environment;
-import org.jboss.soa.esb.common.ModulePropertyManager;
-import org.jboss.soa.esb.couriers.CourierException;
-import org.jboss.soa.esb.couriers.CourierTimeoutException;
-import org.jboss.soa.esb.listeners.RegistryUtil;
-import org.jboss.soa.esb.listeners.message.Invoker;
-import org.jboss.soa.esb.message.Message;
-import org.jboss.soa.esb.services.jbpm.util.CommandVehicle;
-import org.jboss.soa.esb.services.registry.RegistryException;
-
-import com.arjuna.common.util.propertyservice.PropertyManager;
-
-public class TestCommandMessages {
-
- static Logger _logger = Logger.getLogger(TestCommandMessages.class);
-
- EPR _jbpmEpr;
-
- public static void main(String[] args) throws Exception
- {
- try
- {
- // following call should not be necessary - see method for comments
- setupRegistry();
- new TestCommandMessages().run();
- } catch (Exception e) {
- e.printStackTrace();
- }
- finally
- {
- System.exit(0);
- }
- }
-
- private Message invokeJbpm(CommandVehicle command)
- throws CourierTimeoutException, CourierException
- , MalformedEPRException, URISyntaxException, RegistryException
- {
- return Invoker.invokeAndAwaitResponse
- (command, "categoryJbpmService","nameJbpmService" , 15000);
- }
-
- public void run() throws Exception {
-
- String category = "categoryJbpmService";
- String name = "nameJbpmService";
-
- Collection<EPR> eprs = RegistryUtil.getEprs(category, name);
- if (eprs.size()<1)
- throw new Exception("No listeners serving <"+category+","+name+">");
-
- // Use first EPR
- _jbpmEpr = eprs.iterator().next();
-
- Enum operation = null;
- CommandVehicle command = null;
-
- operation = CommandVehicle.Operation.deployProcessDefinition;
- command = new CommandVehicle(operation);
- command.setProcessDefinitionXml(stringFromFile("processdefinition.xml"));
- Message respMsg = invokeJbpm(command);
- CommandVehicle response = (null==respMsg) ? null : new CommandVehicle(respMsg);
- if (null!=response)
- {
- _logger.info("Invoked : "+operation.toString());
- _logger.info("Return code = "+response.getReturnCode());
- _logger.info("Error messg = "+response.getErrorMessage());
- Exception e = response.getException();
- if (null==e)
- {
- _logger.info("PrcDef name = "+response.getProcessDefinitionName());
- _logger.info("PrcDef vers = "+response.getProcessVersion());
- }
- else
- _logger.error("Problems in jbpm.CommandInterpreter",e);
- }
- else
- _logger.info("Response was not received");
- _logger.info("_______________________________________________________________________");
-
- operation = CommandVehicle.Operation.newProcessInstance;
- command = new CommandVehicle(operation);
- command.setProcessDefinitionName(response.getProcessDefinitionName());
- respMsg = invokeJbpm(command);
- response = (null==respMsg) ? null : new CommandVehicle(respMsg);
- if (null!=response)
- {
- _logger.info("Invoked : "+operation.toString());
- _logger.info("Return code = "+response.getReturnCode());
- _logger.info("Error messg = "+response.getErrorMessage());
- Exception e = response.getException();
- if (null==e)
- {
- _logger.info("PrcDef name = "+response.getProcessDefinitionName());
- _logger.info("PrcDef vers = "+response.getProcessVersion());
- _logger.info("Instance id = "+response.getInstanceId());
- _logger.info("Token id = "+response.getTokenId());
- _logger.info("Current node= "+response.getCurrentNodeName());
- }
- else
- _logger.error("Problems in jbpm.CommandInterpreter",e);
- }
- else
- _logger.info("Response was not received");
- _logger.info("_______________________________________________________________________");
-
- boolean signalToken = true;
- for (boolean continueLooping = true; continueLooping;)
- {
- operation = (signalToken) ? CommandVehicle.Operation.signalToken
- : CommandVehicle.Operation.signalProcess;
- // for this test, alternatively signal: token - process - token ...
- signalToken = ! signalToken;
-
- command = new CommandVehicle(operation);
- command.setInstanceId(response.getInstanceId());
- command.setTokenId(response.getTokenId());
- respMsg = invokeJbpm(command);
- response = (null==respMsg) ? null : new CommandVehicle(respMsg);
- if (null!=response)
- {
- _logger.info("Invoked : "+operation.toString());
- _logger.info("Return code = "+response.getReturnCode());
- _logger.info("Error messg = "+response.getErrorMessage());
- Exception e = response.getException();
- if (null==e)
- {
- _logger.info("PrcDef name = "+response.getProcessDefinitionName());
- _logger.info("PrcDef vers = "+response.getProcessVersion());
- _logger.info("Instance id = "+response.getInstanceId());
- _logger.info("Token id = "+response.getTokenId());
- _logger.info("Current node= "+response.getCurrentNodeName());
- Object obj = response.getUserObject();
- String ended = (null==obj)?"<null>":obj.toString();
- _logger.info("Has ended = "+ ended);
- continueLooping = "false".equals(ended);
- }
- else
- _logger.error("Problems in jbpm.CommandInterpreter",e);
- }
- else
- _logger.info("Response was not received");
- _logger.info("_______________________________________________________________________");
-
- if (! CommandVehicle.RETCODE_OK.equals(response.getReturnCode()))
- break;
- }
-
- // Invoke 'hasInstanceEnded' once just to exemplify use of this operation
- operation = CommandVehicle.Operation.hasInstanceEnded;
- command = new CommandVehicle(operation);
- command.setInstanceId(response.getInstanceId());
- respMsg = invokeJbpm(command);
- response = (null==respMsg) ? null : new CommandVehicle(respMsg);
- if (null!=response)
- {
- _logger.info("Invoked : "+operation.toString());
- _logger.info("Return code = "+response.getReturnCode());
- _logger.info("Error messg = "+response.getErrorMessage());
- Exception e = response.getException();
- if (null==e)
- {
- _logger.info("PrcDef name = "+response.getProcessDefinitionName());
- _logger.info("PrcDef vers = "+response.getProcessVersion());
- _logger.info("Instance id = "+response.getInstanceId());
- _logger.info("Token id = "+response.getTokenId());
- _logger.info("Current node= "+response.getCurrentNodeName());
- Object obj = response.getUserObject();
- String ended = (null==obj)?"<null>":obj.toString();
- _logger.info("Has ended = "+ ended);
- }
- else
- _logger.error("Problems in jbpm.CommandInterpreter",e);
- }
- else
- _logger.info("Response was not received");
- _logger.info("_______________________________________________________________________");
- }
-
- protected String stringFromFile(String pFileName) throws Exception
- {
- String userDir = System.getProperty("user.dir");
- String baseDir = (userDir.endsWith("jbpm_simple1"))
- ? userDir
- : userDir + "/product/samples/quickstarts/jbpm_simple1";
- InputStream in = new FileInputStream(new File(baseDir,pFileName));
- ByteArrayOutputStream out = new ByteArrayOutputStream();
- byte[]ba = new byte[1000];
- int iQ = -1;
- while (-1<(iQ=in.read(ba)))
- if (iQ>0) out.write(ba,0,iQ);
- return out.toString();
- }
-
- /**
- * 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")) ;
-
- }
-
-}
More information about the jboss-svn-commits
mailing list