2011/08/05 - Jakarta Cactus has been retired.

For more information, please explore the Attic.

View Javadoc

1   /* 
2    * ========================================================================
3    * 
4    * Licensed to the Apache Software Foundation (ASF) under one or more
5    * contributor license agreements.  See the NOTICE file distributed with
6    * this work for additional information regarding copyright ownership.
7    * The ASF licenses this file to You under the Apache License, Version 2.0
8    * (the "License"); you may not use this file except in compliance with
9    * the License.  You may obtain a copy of the License at
10   * 
11   *   http://www.apache.org/licenses/LICENSE-2.0
12   * 
13   * Unless required by applicable law or agreed to in writing, software
14   * distributed under the License is distributed on an "AS IS" BASIS,
15   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16   * See the License for the specific language governing permissions and
17   * limitations under the License.
18   * 
19   * ========================================================================
20   */
21  package org.apache.cactus;
22  
23  import javax.jms.Message;
24  import javax.ejb.MessageDrivenContext;
25  
26  import junit.framework.Test;
27  
28  import org.apache.cactus.internal.AbstractCactusTestCase;
29  import org.apache.cactus.internal.client.connector.http.JmsProtocolHandler;
30  import org.apache.cactus.spi.client.connector.ProtocolHandler;
31  import org.apache.cactus.util.JmsConfiguration;
32  
33  /**
34   * TestCase class to test Message Driven Beans (or any JMS listener for that
35   * matter).
36   *
37   * @author <a href="mailto:vmassol@apache.org">Vincent Massol</a>
38   *
39   * @since 1.4
40   *
41   * @version $Id$
42   */
43  public class JmsTestCase extends AbstractCactusTestCase
44  {
45      /**
46       * Valid <code>Message</code> object that you can access from
47       * the <code>testXXX()</code>, <code>setUp</code> and
48       * <code>tearDown()</code> methods. If you try to access it from either the
49       * <code>beginXXX()</code> or <code>endXXX()</code> methods it will
50       * have the <code>null</code> value.
51       */
52      public Message message;
53  
54      /**
55       * Valid <code>MessageDrivenContext</code> object that you can access from
56       * the <code>testXXX()</code>, <code>setUp</code> and
57       * <code>tearDown()</code> methods. If you try to access it from either the
58       * <code>beginXXX()</code> or <code>endXXX()</code> methods it will
59       * have the <code>null</code> value.
60       */
61      public MessageDrivenContext context;
62      
63      /**
64       * @see AbstractCactusTestCase#AbstractCactusTestCase()
65       */
66      public JmsTestCase()
67      {
68          super();
69      }
70  
71      /**
72       * Constructs a JUnit test case with the given name.
73       *
74       * @param theName the name of the test case
75       */
76      public JmsTestCase(String theName)
77      {
78          super(theName);
79      }
80      
81      /**
82       * Constructs a JUnit test case with the given name.
83       *
84       * @param theName the name of the test case
85       */
86      public JmsTestCase(String theName, Test theTest)
87      {
88          super(theName, theTest);
89      }
90  
91      /**
92       * {@inheritDoc}
93       * @see AbstractCactusTestCase#createProtocolHandler()
94       */
95      protected ProtocolHandler createProtocolHandler()
96      {
97          return new JmsProtocolHandler(new JmsConfiguration());
98      }
99  }