1   /*
2    * $Id: BpmNamespaceHandlerTestCase.java 10489 2008-01-23 17:53:38Z dfeist $
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  package org.mule.transport.bpm.config;
11  
12  import org.mule.tck.FunctionalTestCase;
13  import org.mule.transport.bpm.BPMS;
14  import org.mule.transport.bpm.ProcessConnector;
15  import org.mule.transport.bpm.test.TestBpms;
16  
17  
18  /**
19   * Tests the Spring XML namespace for the BPM transport.
20   */
21  public class BpmNamespaceHandlerTestCase extends FunctionalTestCase
22  {
23      protected String getConfigResources()
24      {
25          return "bpm-namespace-config.xml";
26      }
27  
28      public void testDefaults() throws Exception
29      {
30          ProcessConnector c = (ProcessConnector)muleContext.getRegistry().lookupConnector("bpmConnectorDefaults");
31          assertNotNull(c);
32          
33          assertFalse(c.isAllowGlobalDispatcher());
34          assertFalse(c.isAllowGlobalReceiver());
35          assertNull(c.getProcessIdField());
36          
37          BPMS bpms = c.getBpms();
38          assertNotNull(bpms);
39          assertEquals(TestBpms.class, bpms.getClass());
40          assertEquals("bar", ((TestBpms) bpms).getFoo());
41          
42          assertTrue(c.isConnected());
43          assertTrue(c.isStarted());
44      }
45      
46      public void testConfig() throws Exception
47      {
48          ProcessConnector c = (ProcessConnector)muleContext.getRegistry().lookupConnector("bpmConnector1");
49          assertNotNull(c);
50          
51          assertTrue(c.isAllowGlobalDispatcher());
52          assertTrue(c.isAllowGlobalReceiver());
53          assertEquals("myId", c.getProcessIdField());
54          
55          BPMS bpms = c.getBpms();
56          assertNotNull(bpms);
57          assertEquals(TestBpms.class, bpms.getClass());
58          assertEquals("bar", ((TestBpms) bpms).getFoo());
59  
60          assertTrue(c.isConnected());
61          assertTrue(c.isStarted());
62      }    
63  }