Coverage Report - org.apache.camel.component.activemq.ActiveMQConfiguration
 
Classes in this File Line Coverage Branch Coverage Complexity
ActiveMQConfiguration
71% 
0% 
0
 
 1  
 /**
 2  
  * Licensed to the Apache Software Foundation (ASF) under one or more
 3  
  * contributor license agreements.  See the NOTICE file distributed with
 4  
  * this work for additional information regarding copyright ownership.
 5  
  * The ASF licenses this file to You under the Apache License, Version 2.0
 6  
  * (the "License"); you may not use this file except in compliance with
 7  
  * the License.  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  
 package org.apache.camel.component.activemq;
 18  
 
 19  
 import org.apache.activemq.pool.PooledConnectionFactory;
 20  
 import org.apache.activemq.spring.ActiveMQConnectionFactory;
 21  
 import org.apache.camel.component.jms.JmsConfiguration;
 22  
 
 23  
 import javax.jms.ConnectionFactory;
 24  
 
 25  
 /**
 26  
  * @version $Revision: 1.1 $
 27  
  */
 28  9
 public class ActiveMQConfiguration extends JmsConfiguration {
 29  5
     private String brokerURL = ActiveMQConnectionFactory.DEFAULT_BROKER_URL;
 30  
 
 31  5
     public ActiveMQConfiguration() {
 32  5
     }
 33  
 
 34  
     public String getBrokerURL() {
 35  16
         return brokerURL;
 36  
     }
 37  
 
 38  
     /**
 39  
      * Sets the broker URL to use to connect to ActiveMQ using the
 40  
      * <a href="http://activemq.apache.org/configuring-transports.html">ActiveMQ URI format</a>
 41  
      *
 42  
      * @param brokerURL the URL of the broker.
 43  
      */
 44  
     public void setBrokerURL(String brokerURL) {
 45  3
         this.brokerURL = brokerURL;
 46  3
     }
 47  
 
 48  
     @Override
 49  
     public ActiveMQConnectionFactory getListenerConnectionFactory() {
 50  16
         return (ActiveMQConnectionFactory) super.getListenerConnectionFactory();
 51  
     }
 52  
 
 53  
     @Override
 54  
     public void setListenerConnectionFactory(ConnectionFactory listenerConnectionFactory) {
 55  0
         if (listenerConnectionFactory instanceof ActiveMQConnectionFactory) {
 56  0
             super.setListenerConnectionFactory(listenerConnectionFactory);
 57  0
         }
 58  
         else {
 59  0
             throw new IllegalArgumentException("ConnectionFactory " + listenerConnectionFactory
 60  
                     + " is not an instanceof " + ActiveMQConnectionFactory.class.getName());
 61  
         }
 62  0
     }
 63  
 
 64  
     @Override
 65  
     protected ConnectionFactory createListenerConnectionFactory() {
 66  16
         ActiveMQConnectionFactory answer = new ActiveMQConnectionFactory();
 67  16
         answer.setBrokerURL(getBrokerURL());
 68  16
         return answer;
 69  
     }
 70  
 
 71  
     @Override
 72  
     protected ConnectionFactory createTemplateConnectionFactory() {
 73  7
         return new PooledConnectionFactory(getListenerConnectionFactory());
 74  
     }
 75  
 }