View Javadoc

1   /*
2    * $Id: AbstractAxisOverJMSWithTransactionsTestCase.java 22431 2011-07-18 07:40:35Z dirk.olmes $
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.test.integration.transport.axis;
12  
13  import org.mule.DefaultMuleMessage;
14  import org.mule.api.MuleMessage;
15  import org.mule.api.transport.Connector;
16  import org.mule.module.client.MuleClient;
17  import org.mule.tck.junit4.FunctionalTestCase;
18  import org.mule.transport.soap.axis.AxisConnector;
19  
20  import java.util.Collection;
21  import java.util.Iterator;
22  
23  import org.junit.Test;
24  
25  import static junit.framework.Assert.assertTrue;
26  import static org.junit.Assert.assertNotNull;
27  
28  
29  public abstract class AbstractAxisOverJMSWithTransactionsTestCase extends FunctionalTestCase
30  {
31  
32      @Test
33      public void testTransactionPropertiesOnEndpoint() throws Exception
34      {
35          Collection<?> connectors = muleContext.getRegistry().lookupObjects(Connector.class);
36          AxisConnector connector = null;
37          for (Iterator<?> iterator = connectors.iterator(); iterator.hasNext();)
38          {
39              Connector candidate = (Connector) iterator.next();
40              if (candidate instanceof AxisConnector)
41              {
42                  connector = (AxisConnector) candidate;
43              }
44          }
45          assertNotNull(connector);
46          //This no longer works because the Axis descriptor name is made unique per connector
47          //MuleDescriptor axisDescriptor = (MuleDescriptor)MuleManager.getInstance().lookupModel(ModelHelper.SYSTEM_MODEL).getDescriptor(connector.AXIS_SERVICE_COMPONENT_NAME);
48          //assertNotNull(axisDescriptor.getInboundRouter().getEndpoint("jms.TestComponent").getTransactionConfig());
49      }
50  
51      @Test
52      public void testTransactionsOverAxis() throws Exception
53      {
54          MuleClient client = new MuleClient(muleContext);
55          client.dispatch("axis:jms://TestComponent?method=echo", new DefaultMuleMessage("test", muleContext));
56          MuleMessage message = client.request("jms://testout", 5000);
57          assertNotNull(message.getPayload());
58          assertTrue(message.getPayloadAsString().equals("test"));
59      }
60  
61  }