1   /***
2    * 
3    * Copyright 2005 LogicBlaze, Inc. http://www.logicblaze.com
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.logicblaze.lingo.jms;
19  
20  import org.logicblaze.lingo.jms.impl.MultiplexingRequestor;
21  
22  import javax.jms.DeliveryMode;
23  
24  import java.util.List;
25  
26  /***
27   *
28   * @version $Revision$ $Date$
29   * @author <a href="mailto:pavel@jehlanka.cz">Pavel Mueller</a>
30   */
31  public class JmsProxyFactoryBeanTest extends JmsTestSupport {
32  
33      public static void main(String[] args) {
34          junit.textui.TestRunner.run(JmsProxyFactoryBeanTest.class);
35      }
36      
37      public void testJmsConfigConfiguresRequestor() throws Exception {
38          JmsProxyFactoryBean factoryBean = new JmsProxyFactoryBean();
39          factoryBean.setConnectionFactory(connectionFactory);
40          factoryBean.setServiceInterface(List.class);
41          factoryBean.setPersistentDelivery(true); // set persistent
42          factoryBean.setTimeToLive(5000);
43          factoryBean.afterPropertiesSet(); // init factory bean
44          
45          // test requestor if it's correctly configured
46          Requestor requestor = factoryBean.getRequestor();
47          assertTrue(requestor instanceof MultiplexingRequestor);
48          MultiplexingRequestor mpxRequestor = (MultiplexingRequestor) requestor;
49          
50          // expected: persistent delivery
51          assertEquals(DeliveryMode.PERSISTENT, mpxRequestor.getDeliveryMode());
52          assertEquals(5000, mpxRequestor.getTimeToLive());
53      }
54  
55  }