Clover coverage report -
Coverage timestamp: Thu Jul 5 2007 20:02:32 EDT
file stats: LOC: 98   Methods: 10
NCLOC: 63   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
NetworkDomain.java 83.3% 60% 60% 63.9%
coverage coverage
 1    /*
 2    * JBoss, the OpenSource J2EE webOS
 3    *
 4    * Distributable under LGPL license.
 5    * See terms of license at gnu.org.
 6    */
 7    package org.jboss.cache.pojo.test;
 8   
 9    import java.util.ArrayList;
 10    import java.util.List;
 11   
 12    /**
 13    * <p>Top level sample Pojo for a sample network management software. It is a logical object that can be presented to
 14    * the user. Example of domain is like temperature or vibration sensor domains.</p>
 15    * <p>This object is used to illustrate the pojo cache capability of PojoCache. Note the absence of <code>Serializable</code>
 16    * interface.</p>
 17    *
 18    * @author <a href="mailto:ben.wang@jboss.com">Ben Wang</a>
 19    */
 20    // We are using JDK1.5 annotation.
 21    @org.jboss.cache.pojo.annotation.Replicable
 22    public class NetworkDomain
 23    {
 24    String name_;
 25    // The associated nodes from the elements
 26    List nodes_;
 27    // All the elements to be managed in this domain
 28    List elements_;
 29    // Adminstration such id, pass
 30    NetworkAdmin admin_;
 31   
 32    static final int TEMP_SENSOR = 0;
 33    static final int VIBRATION_SENSOR = 1;
 34   
 35  0 public String getName()
 36    {
 37  0 return name_;
 38    }
 39   
 40  10 public void setName(String name)
 41    {
 42  10 name_ = name;
 43    }
 44   
 45  6 public List getNodes()
 46    {
 47  6 return nodes_;
 48    }
 49   
 50  0 protected void setNodes(List nodes)
 51    {
 52  0 nodes_ = nodes;
 53    }
 54   
 55  0 public List getElements()
 56    {
 57  0 return nodes_;
 58    }
 59   
 60  12 protected void addNode(NetworkNode node)
 61    {
 62  12 if (nodes_ == null)
 63  6 nodes_ = new ArrayList();
 64   
 65  12 nodes_.add(node);
 66    }
 67   
 68  12 public void addElement(NetworkElement element)
 69    {
 70  12 if (elements_ == null)
 71  6 elements_ = new ArrayList();
 72   
 73  12 elements_.add(element);
 74   
 75  12 if (element.getParentNode() == null)
 76  0 throw new RuntimeException("NetworkDomain.addElement(): parent node of element is null: " + element);
 77   
 78  12 addNode(element.getParentNode());
 79    }
 80   
 81  12 public NetworkAdmin getAdmin()
 82    {
 83  12 return admin_;
 84    }
 85   
 86  8 public void setAdmin(NetworkAdmin admin)
 87    {
 88  8 admin_ = admin;
 89    }
 90   
 91  0 public String toString()
 92    {
 93  0 StringBuffer sb = new StringBuffer();
 94  0 sb.append("* Damain * name= ").append(getName()).append(" + admin +: ").append(getAdmin());
 95  0 sb.append(" + nodes +: ").append(getNodes());
 96  0 return sb.toString();
 97    }
 98    }