1
2
3
4
5
6
7
8
9
10 package org.mule.test.integration.providers.jms.functional;
11
12 import org.mule.MuleManager;
13 import org.mule.tck.functional.EventCallback;
14 import org.mule.tck.functional.FunctionalTestComponent;
15 import org.mule.transaction.TransactionCoordination;
16 import org.mule.umo.UMOEventContext;
17 import org.mule.umo.UMOTransaction;
18
19 import java.util.HashSet;
20 import java.util.Set;
21
22
23
24
25
26
27
28 public class JmsSingleTransactionComponentTestCase extends AbstractJmsFunctionalTestCase
29 {
30 public static final String MODEL_NAME = "TEST";
31 public static final String COMPONENT_NAME = "Part";
32
33
34
35 public final Set transactions = new HashSet();
36
37 protected String getConfigResources()
38 {
39 return "providers/activemq/jms-single-tx-component.xml";
40 }
41
42 public void testDifferentTx() throws Exception
43 {
44 EventCallback callback = new EventCallback()
45 {
46 public void eventReceived(UMOEventContext context, Object component) throws Exception
47 {
48 UMOTransaction transaction = TransactionCoordination.getInstance().getTransaction();
49 assertNotNull(transaction);
50 assertFalse(transactions.contains(transaction));
51 transactions.add(transaction);
52 }
53 };
54
55 for (int i = 1; i < 5; i++)
56 {
57 ((FunctionalTestComponent) MuleManager.getInstance().lookupModel(MODEL_NAME).getComponent(COMPONENT_NAME + i).getDescriptor().getImplementation()).
58 setEventCallback(callback);
59 }
60
61 dispatchMessage();
62 recieveMessage();
63 }
64 }