View Javadoc

1   /*
2    * $Id: BpmConnectorTestCase.java 19710 2010-09-23 16:29:07Z tcarlson $
3    * --------------------------------------------------------------------------------------
4    * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.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.transport.bpm;
12  
13  import org.mule.api.transport.Connector;
14  import org.mule.module.bpm.BPMS;
15  import org.mule.module.bpm.test.TestBpms;
16  import org.mule.transport.AbstractConnectorTestCase;
17  
18  import com.mockobjects.dynamic.Mock;
19  
20  /**
21   * Generic connector tests.
22   * 
23   * @deprecated It is recommended to configure BPM as a component rather than a transport for 3.x
24   */
25  public class BpmConnectorTestCase extends AbstractConnectorTestCase
26  {
27  
28      @Override
29      public Connector createConnector() throws Exception
30      {
31          ProcessConnector c = new ProcessConnector(muleContext);
32          c.setName("ProcessConnector");
33          c.setBpms(new TestBpms());
34  
35          return c;
36      }
37  
38      public void testMessageServiceSet() throws Exception
39      {
40          ProcessConnector c = (ProcessConnector) this.createConnector();
41          // The BPMS must be set prior to initializing the connector.
42          Mock bpms = new Mock(BPMS.class);
43          bpms.expect("setMessageService", c);
44          c.setBpms((BPMS) bpms.proxy());
45          c.initialise();
46          bpms.verify();
47      }
48  
49      @Override
50      public Object getValidMessage() throws Exception
51      {
52          return "test";
53      }
54  
55      @Override
56      public String getTestEndpointURI()
57      {
58          return "bpm://dummyProcess?processId=1234";
59      }
60  
61  }