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.transport.jms.integration;
8   
9   import org.junit.Test;
10  
11  /**
12   * Testing durable topic with external subscriber
13   */
14  public class JmsDurableTopicSingleTxTestCase extends JmsDurableTopicTestCase
15  {
16  
17      @Override
18      protected String getConfigResources()
19      {
20          return "integration/jms-durable-topic-single-tx.xml";
21      }
22  
23      /**
24       * @throws Exception
25       */
26      @Test
27      public void testProviderDurableSubscriber() throws Exception
28      {
29          setClientId("Client1");
30          receive(scenarioNotReceive);
31          setClientId("Client2");
32          receive(scenarioNotReceive);
33  
34          setClientId("Sender");
35          send(scenarioCommit);
36  
37          setClientId("Client1");
38          receive(scenarioCommit);
39          receive(scenarioNotReceive);
40          setClientId("Client2");
41          receive(scenarioRollback);
42          receive(scenarioCommit);
43          receive(scenarioNotReceive);
44  
45      }
46  
47      Scenario scenarioCommit = new ScenarioCommit()
48      {
49  
50          @Override
51          public String getOutputDestinationName()
52          {
53              return getJmsConfig().getBroadcastDestinationName();
54          }
55      };
56  
57      Scenario scenarioRollback = new ScenarioRollback()
58      {
59  
60          @Override
61          public String getOutputDestinationName()
62          {
63              return getJmsConfig().getBroadcastDestinationName();
64          }
65      };
66  
67      Scenario scenarioNotReceive = new ScenarioNotReceive()
68      {
69  
70          @Override
71          public String getOutputDestinationName()
72          {
73              return getJmsConfig().getBroadcastDestinationName();
74          }
75      };
76  }