Coverage Report - org.mule.config.QueueProfile
 
Classes in this File Line Coverage Branch Coverage Complexity
QueueProfile
90%
19/21
N/A
1
 
 1  
 /*
 2  
  * $Id: QueueProfile.java 7963 2007-08-21 08:53:15Z dirk.olmes $
 3  
  * --------------------------------------------------------------------------------------
 4  
  * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.com
 5  
  *
 6  
  * The software in this package is published under the terms of the CPAL v1.0
 7  
  * license, a copy of which has been included with this distribution in the
 8  
  * LICENSE.txt file.
 9  
  */
 10  
 
 11  
 package org.mule.config;
 12  
 
 13  
 import org.mule.MuleManager;
 14  
 import org.mule.umo.lifecycle.InitialisationException;
 15  
 import org.mule.util.queue.QueueConfiguration;
 16  
 
 17  
 /**
 18  
  * <code>QueueProfile</code> determines how an internal queue for a component will
 19  
  * behave.
 20  
  */
 21  
 
 22  
 public class QueueProfile
 23  
 {
 24  3518
     private int maxOutstandingMessages = 0;
 25  3518
     private boolean persistent = false;
 26  
 
 27  
     public QueueProfile()
 28  
     {
 29  810
         super();
 30  810
     }
 31  
 
 32  
     public QueueProfile(int maxOutstandingMessages, boolean persistent)
 33  2296
     {
 34  2296
         this.maxOutstandingMessages = maxOutstandingMessages;
 35  2296
         this.persistent = persistent;
 36  2296
     }
 37  
 
 38  
     public QueueProfile(QueueProfile queueProfile)
 39  412
     {
 40  412
         this.maxOutstandingMessages = queueProfile.getMaxOutstandingMessages();
 41  412
         this.persistent = queueProfile.isPersistent();
 42  412
     }
 43  
 
 44  
     /**
 45  
      * This specifies the number of messages that can be queued before it starts
 46  
      * blocking.
 47  
      * 
 48  
      * @return the max number of messages that will be queued
 49  
      */
 50  
     public int getMaxOutstandingMessages()
 51  
     {
 52  416
         return maxOutstandingMessages;
 53  
     }
 54  
 
 55  
     /**
 56  
      * This specifies the number of messages that can be queued before it starts
 57  
      * blocking.
 58  
      * 
 59  
      * @param maxOutstandingMessages the max number of messages that will be queued
 60  
      */
 61  
     public void setMaxOutstandingMessages(int maxOutstandingMessages)
 62  
     {
 63  2
         this.maxOutstandingMessages = maxOutstandingMessages;
 64  2
     }
 65  
 
 66  
     public boolean isPersistent()
 67  
     {
 68  412
         return persistent;
 69  
     }
 70  
 
 71  
     public void setPersistent(boolean persistent)
 72  
     {
 73  0
         this.persistent = persistent;
 74  0
     }
 75  
 
 76  
     public void configureQueue(String component) throws InitialisationException
 77  
     {
 78  34
         QueueConfiguration qc = new QueueConfiguration(maxOutstandingMessages, persistent);
 79  34
         MuleManager.getInstance().getQueueManager().setQueueConfiguration(component, qc);
 80  34
     }
 81  
 
 82  
 }