View Javadoc
1   /*
2    * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
3    * The software in this package is published under the terms of the CPAL v1.0
4    * license, a copy of which has been included with this distribution in the
5    * LICENSE.txt file.
6    */
7   package org.mule.test.integration.transport.axis;
8   
9   import org.mule.DefaultMuleMessage;
10  import org.mule.api.MuleMessage;
11  import org.mule.api.transport.Connector;
12  import org.mule.module.client.MuleClient;
13  import org.mule.tck.junit4.FunctionalTestCase;
14  import org.mule.transport.soap.axis.AxisConnector;
15  
16  import java.util.Collection;
17  import java.util.Iterator;
18  
19  import org.junit.Test;
20  
21  import static junit.framework.Assert.assertTrue;
22  import static org.junit.Assert.assertNotNull;
23  
24  
25  public abstract class AbstractAxisOverJMSWithTransactionsTestCase extends FunctionalTestCase
26  {
27  
28      @Test
29      public void testTransactionPropertiesOnEndpoint() throws Exception
30      {
31          Collection<?> connectors = muleContext.getRegistry().lookupObjects(Connector.class);
32          AxisConnector connector = null;
33          for (Iterator<?> iterator = connectors.iterator(); iterator.hasNext();)
34          {
35              Connector candidate = (Connector) iterator.next();
36              if (candidate instanceof AxisConnector)
37              {
38                  connector = (AxisConnector) candidate;
39              }
40          }
41          assertNotNull(connector);
42          //This no longer works because the Axis descriptor name is made unique per connector
43          //MuleDescriptor axisDescriptor = (MuleDescriptor)MuleManager.getInstance().lookupModel(ModelHelper.SYSTEM_MODEL).getDescriptor(connector.AXIS_SERVICE_COMPONENT_NAME);
44          //assertNotNull(axisDescriptor.getInboundRouter().getEndpoint("jms.TestComponent").getTransactionConfig());
45      }
46  
47      @Test
48      public void testTransactionsOverAxis() throws Exception
49      {
50          MuleClient client = new MuleClient(muleContext);
51          client.dispatch("axis:jms://TestComponent?method=echo", new DefaultMuleMessage("test", muleContext));
52          MuleMessage message = client.request("jms://testout", 5000);
53          assertNotNull(message.getPayload());
54          assertTrue(message.getPayloadAsString().equals("test"));
55      }
56  
57  }