1 /***
2 *
3 * Copyright 2005 LogicBlaze, Inc.
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *
17 **/
18 package org.jencks;
19
20 import org.activemq.spring.TestingConsumer;
21 import org.springframework.context.ApplicationContext;
22 import org.springframework.context.support.ClassPathXmlApplicationContext;
23
24 import javax.jms.Destination;
25 import javax.jms.TextMessage;
26 import java.util.Date;
27 import java.util.List;
28
29 /***
30 * @version $Revision: 1.1.1.1 $
31 */
32 public class JCAContainerTest extends JCAContainerTestSupport {
33
34 public static void main(String[] args) {
35
36
37 ApplicationContext ctx = new ClassPathXmlApplicationContext("org/activemq/jca/spring.xml");
38
39 System.err.println("Done.");
40
41 }
42
43 public void testMessageDeliveryUsingSharedMesssageListener() throws Exception {
44 TextMessage message = session.createTextMessage("Hello! " + new Date());
45 Destination destination = session.createTopic("test.spring.inboundMessageA");
46 producer.send(destination, message);
47
48 System.out.println("message sent on: " + destination + " of type: " + destination.getClass());
49
50
51 TestingConsumer consumer = (TestingConsumer) applicationContext.getBean("echoBean");
52 consumer.waitForMessageToArrive();
53
54 List list = consumer.flushMessages();
55 assertEquals("Message count: " + list, 1, list.size());
56 }
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72 }