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