Clover coverage report -
Coverage timestamp: Sat Jul 7 2007 16:41:13 CEST
file stats: LOC: 164   Methods: 10
NCLOC: 65   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
JMSConfig.java 60% 86.7% 90% 82%
coverage coverage
 1    /**
 2    * JTRunner is free software; you can redistribute it and/or modify it under the
 3    * terms of the GNU General Public License as published by the Free Software
 4    * Foundation; either version 2, or (at your option) any later version.
 5    */
 6   
 7    package jtr.config.jms;
 8   
 9    import java.io.Serializable;
 10    import java.util.Collection;
 11    import java.util.Vector;
 12    import java.util.Iterator;
 13   
 14    /**
 15    * This class is the object oriented representation of the content of the
 16    * <code>jtx.xml &ltjms&gt</code> element. It provides:<br>
 17    * 1. a unique name identifying the current JMS configuration<br>
 18    * 2. a set of queues<br>
 19    * 3. a set of topics<br>
 20    * 4. a set of connection factories<br>
 21    * Both queues and topics are shaped as <code>JMSDestination</code> instances,
 22    * while connection factories are represented by means of
 23    * <code>JMSConnectionFactory</code> instances.
 24    *
 25    * @author Francesco Russo (frusso@dev.java.net)
 26    * @version 4.0
 27    * @since 1.1
 28    * @see jtr.config.jms.JMSDestination jtr.config.JMSConnectionFactory
 29    */
 30    public class JMSConfig implements Serializable {
 31    /**
 32    * The default constructor.
 33    */
 34  1 public JMSConfig() {
 35  1 queues = new Vector<JMSDestination>();
 36  1 topics = new Vector<JMSDestination>();
 37    }
 38   
 39    /**
 40    * Set the unique name of this JMS configuration.
 41    *
 42    * @param name
 43    * The unique name
 44    */
 45  1 public void setUniqueName(String name) {
 46  1 uniqueName = name;
 47    }
 48   
 49    /**
 50    * Get the unique name of this JMS configuration.
 51    *
 52    * @return The unique name
 53    */
 54  4915 public String getUniqueName() {
 55  4911 return uniqueName;
 56    }
 57   
 58    /**
 59    * Add a queue to the set of queues available with this JMS configuration
 60    *
 61    * @param jndiName
 62    * The queue's JNDI name
 63    * @param propertyName
 64    * The name of the property exposed by the runner that will hold
 65    * the queue
 66    */
 67  1 public void addQueue(String jndiName, String propertyName) {
 68  1 queues.add(new JMSDestination(jndiName, propertyName));
 69    }
 70   
 71    /**
 72    * Return the set of confiured queues.
 73    *
 74    * @return Collection The configured queues
 75    */
 76  14 public Collection<JMSDestination> getQueues() {
 77  14 return queues;
 78    }
 79   
 80    /**
 81    * Add a topic to the set of topics available with this JMS configuration
 82    *
 83    * @param jndiName
 84    * The topic's JNDI name
 85    * @param propertyName
 86    * String
 87    */
 88  0 public void addTopic(String jndiName, String propertyName) {
 89  0 topics.add(new JMSDestination(jndiName, propertyName));
 90    }
 91   
 92    /**
 93    * Return the set of configured topics
 94    *
 95    * @return Collection The topics
 96    */
 97  14 public Collection<JMSDestination> getTopics() {
 98  14 return topics;
 99    }
 100   
 101    /**
 102    * Set the connection factories available with the current JMS configuration
 103    *
 104    * @param jmsF
 105    * The connection factories
 106    */
 107  1 public void setConnectionFactories(JMSFactories jmsF) {
 108  1 connectionFactories = jmsF;
 109    }
 110   
 111    /**
 112    * Get the connection factories available with the current JMS configuration
 113    *
 114    * @return Collection The connection factories
 115    */
 116  14 public Collection<JMSConnectionFactory> getConnectionFactories() {
 117  14 return connectionFactories.getConnectionFactories();
 118    }
 119   
 120    /**
 121    * @see java.lang.Object#toString()
 122    */
 123  14 public String toString() {
 124  14 String res = "JMSConfig: [uniqueName: " + uniqueName + "\n";
 125  14 res = res + "Queues:\n";
 126  14 if (queues != null) {
 127  14 Iterator iter = queues.iterator();
 128  14 int i = 0;
 129  14 while (iter.hasNext()) {
 130  14 i++;
 131  14 JMSDestination tmp = (JMSDestination) iter.next();
 132  14 res = res + i + ". JNDI " + tmp.getJndi() + " - bean property " + tmp.getProperty() + "\n";
 133    }
 134    }
 135  14 res = res + "Topics:\n";
 136  14 if (topics != null) {
 137  14 Iterator iter = topics.iterator();
 138  14 int i = 0;
 139  14 while (iter.hasNext()) {
 140  0 i++;
 141  0 JMSDestination tmp = (JMSDestination) iter.next();
 142  0 res = res + i + ". JNDI " + tmp.getJndi() + " - bean property " + tmp.getProperty() + "\n";
 143    }
 144    }
 145  14 if (connectionFactories != null)
 146  14 res = res + connectionFactories.toString();
 147   
 148  14 return res;
 149    }
 150   
 151    private String uniqueName;
 152   
 153    /**
 154    * Collection <JMSDestination>
 155    */
 156    private Collection<JMSDestination> queues;
 157   
 158    /**
 159    * Collection <JMSDestination>
 160    */
 161    private Collection<JMSDestination> topics;
 162   
 163    private JMSFactories connectionFactories;
 164    }