View Javadoc

1   /*
2    * $Id: BpmNamespaceHandlerTestCase.java 20321 2010-11-24 15:21:24Z dfeist $
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  package org.mule.module.bpm.config;
11  
12  import org.mule.module.bpm.BPMS;
13  import org.mule.module.bpm.ProcessComponent;
14  import org.mule.module.bpm.test.TestBpms;
15  import org.mule.tck.FunctionalTestCase;
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 testDefaultsComponent() throws Exception
29      {
30          ProcessComponent c = (ProcessComponent) muleContext.getRegistry().lookupService("Service1").getComponent();
31          assertNotNull(c);
32          
33          assertEquals("test.def", c.getResource());
34          assertNull(c.getProcessIdField());
35          
36          // BPMS gets set explicitly in config
37          BPMS bpms = c.getBpms();
38          assertNotNull(bpms);
39          assertEquals(TestBpms.class, bpms.getClass());
40          assertEquals("bar", ((TestBpms) bpms).getFoo());
41      }
42      
43      public void testConfigComponent() throws Exception
44      {
45          ProcessComponent c = (ProcessComponent) muleContext.getRegistry().lookupService("Service2").getComponent();
46          assertNotNull(c);
47          
48          assertEquals("test.def", c.getResource());
49          assertEquals("myId", c.getProcessIdField());
50          
51          // BPMS gets set implicitly via MuleRegistry.lookupObject(BPMS.class)
52          BPMS bpms = c.getBpms();
53          assertNotNull(bpms);
54          assertEquals(TestBpms.class, bpms.getClass());
55          assertEquals("bar", ((TestBpms) bpms).getFoo());
56      }
57      
58  }