1   /*
2    * $Id: JBpmFunctionalTestCase.java 7976 2007-08-21 14:26:13Z dirk.olmes $
3    * --------------------------------------------------------------------------------------
4    * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.com
5    *
6    * The software in this package is published under the terms of the CPAL v1.0
7    * license, a copy of which has been included with this distribution in the
8    * LICENSE.txt file.
9    */
10  
11  package org.mule.examples.loanbroker.bpm;
12  
13  import org.mule.MuleManager;
14  import org.mule.config.ConfigurationBuilder;
15  import org.mule.config.ConfigurationException;
16  import org.mule.config.i18n.MessageFactory;
17  import org.mule.examples.loanbroker.tests.AbstractAsynchronousLoanBrokerTestCase;
18  import org.mule.extras.spring.config.SpringConfigurationBuilder;
19  import org.mule.providers.bpm.BPMS;
20  import org.mule.providers.bpm.ProcessConnector;
21  
22  
23  public class JBpmFunctionalTestCase extends AbstractAsynchronousLoanBrokerTestCase
24  {
25      /** For unit tests, we assume a virgin database, therefore the process ID is assumed to be = 1 */
26      public static final long PROCESS_ID = 1;
27      
28      protected ConfigurationBuilder getBuilder() throws Exception {
29          return new SpringConfigurationBuilder();
30      }
31      
32      // @Override
33      protected String getConfigResources()
34      {
35          return "loan-broker-bpm-mule-config.xml";
36      }
37  
38      // @Override
39      public void testSingleLoanRequest() throws Exception
40      {
41          super.testSingleLoanRequest();
42          
43          ProcessConnector connector =
44              (ProcessConnector) MuleManager.getInstance().lookupConnector("jBpmConnector");
45          if (connector == null)
46          {
47              throw new ConfigurationException(MessageFactory.createStaticMessage("Unable to look up jBpmConnector from Mule registry."));
48          }
49          BPMS bpms = connector.getBpms();
50          // TODO MULE-1558 The following assert is throwing a 
51          //   org.hibernate.LazyInitializationException: could not initialize proxy - the owning Session was closed
52          // See http://forum.springframework.org/archive/index.php/t-24800.html
53          //assertEquals("loanApproved", bpms.getState(bpms.lookupProcess(new Long(PROCESS_ID))));
54      }
55  }