Coverage Report - org.mule.tck.testmodels.fruit.Orange
 
Classes in this File Line Coverage Branch Coverage Complexity
Orange
0%
0/79
0%
0/17
1.958
 
 1  
 /*
 2  
  * $Id: Orange.java 7976 2007-08-21 14:26:13Z 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.tck.testmodels.fruit;
 12  
 
 13  
 import org.mule.umo.UMOEventContext;
 14  
 import org.mule.umo.UMOException;
 15  
 import org.mule.umo.lifecycle.Callable;
 16  
 
 17  
 import java.util.HashMap;
 18  
 import java.util.List;
 19  
 import java.util.Map;
 20  
 
 21  
 import org.apache.commons.logging.Log;
 22  
 import org.apache.commons.logging.LogFactory;
 23  
 
 24  
 public class Orange implements Fruit, Callable
 25  
 {
 26  
     /**
 27  
      * Serial version
 28  
      */
 29  
     private static final long serialVersionUID = 2556604671068150589L;
 30  
 
 31  
     /**
 32  
      * logger used by this class
 33  
      */
 34  0
     private static final Log logger = LogFactory.getLog(Orange.class);
 35  
 
 36  0
     private boolean bitten = false;
 37  0
     private Integer segments = new Integer(10);
 38  0
     private Double radius = new Double(4.34);
 39  
     private String brand;
 40  
 
 41  
     private FruitCleaner cleaner;
 42  
 
 43  
     private Map mapProperties;
 44  
 
 45  
     private List listProperties;
 46  
 
 47  
     private List arrayProperties;
 48  
 
 49  
     public Orange()
 50  
     {
 51  0
         super();
 52  0
     }
 53  
 
 54  
     public Orange(Integer segments, Double radius, String brand)
 55  
     {
 56  0
         super();
 57  0
         this.segments = segments;
 58  0
         this.radius = radius;
 59  0
         this.brand = brand;
 60  0
     }
 61  
 
 62  
     public Orange(HashMap props) throws UMOException
 63  0
     {
 64  0
         setBrand((String) props.get("brand"));
 65  0
         setRadius((Double) props.get("radius"));
 66  0
         setSegments((Integer) props.get("segments"));
 67  0
     }
 68  
 
 69  
     public void bite()
 70  
     {
 71  0
         bitten = true;
 72  0
     }
 73  
 
 74  
     public boolean isBitten()
 75  
     {
 76  0
         return bitten;
 77  
     }
 78  
 
 79  
     public Object onCall(UMOEventContext context) throws UMOException
 80  
     {
 81  0
         logger.debug("Orange received an event in UMOCallable.onEvent! Event says: "
 82  
                      + context.getMessageAsString());
 83  0
         bite();
 84  0
         return null;
 85  
     }
 86  
 
 87  
     /**
 88  
      * @return
 89  
      */
 90  
     public String getBrand()
 91  
     {
 92  0
         return brand;
 93  
     }
 94  
 
 95  
     /**
 96  
      * @return
 97  
      */
 98  
     public Integer getSegments()
 99  
     {
 100  0
         return segments;
 101  
     }
 102  
 
 103  
     /**
 104  
      * @return
 105  
      */
 106  
     public Double getRadius()
 107  
     {
 108  0
         return radius;
 109  
     }
 110  
 
 111  
     /**
 112  
      * @param string
 113  
      */
 114  
     public void setBrand(String string)
 115  
     {
 116  0
         brand = string;
 117  0
     }
 118  
 
 119  
     /**
 120  
      * @param integer
 121  
      */
 122  
     public void setSegments(Integer integer)
 123  
     {
 124  0
         segments = integer;
 125  0
     }
 126  
 
 127  
     /**
 128  
      * @param double1
 129  
      */
 130  
     public void setRadius(Double double1)
 131  
     {
 132  0
         radius = double1;
 133  0
     }
 134  
 
 135  
     /**
 136  
      * @return Returns the listProperties.
 137  
      */
 138  
     public List getListProperties()
 139  
     {
 140  0
         return listProperties;
 141  
     }
 142  
 
 143  
     /**
 144  
      * @param listProperties The listProperties to set.
 145  
      */
 146  
     public void setListProperties(List listProperties)
 147  
     {
 148  0
         this.listProperties = listProperties;
 149  0
     }
 150  
 
 151  
     /**
 152  
      * @return Returns the mapProperties.
 153  
      */
 154  
     public Map getMapProperties()
 155  
     {
 156  0
         return mapProperties;
 157  
     }
 158  
 
 159  
     /**
 160  
      * @param mapProperties The mapProperties to set.
 161  
      */
 162  
     public void setMapProperties(Map mapProperties)
 163  
     {
 164  0
         this.mapProperties = mapProperties;
 165  0
     }
 166  
 
 167  
     /**
 168  
      * @return Returns the arrayProperties.
 169  
      */
 170  
     public List getArrayProperties()
 171  
     {
 172  0
         return arrayProperties;
 173  
     }
 174  
 
 175  
     /**
 176  
      * @param arrayProperties The arrayProperties to set.
 177  
      */
 178  
     public void setArrayProperties(List arrayProperties)
 179  
     {
 180  0
         this.arrayProperties = arrayProperties;
 181  0
     }
 182  
 
 183  
 
 184  
     public FruitCleaner getCleaner()
 185  
     {
 186  0
         return cleaner;
 187  
     }
 188  
 
 189  
     public void setCleaner(FruitCleaner cleaner)
 190  
     {
 191  0
         this.cleaner = cleaner;
 192  0
     }
 193  
 
 194  
     public void wash()
 195  
     {
 196  0
         cleaner.wash(this);
 197  0
     }
 198  
 
 199  
     public void polish()
 200  
     {
 201  0
         cleaner.polish(this);
 202  0
     }
 203  
 
 204  
     public int hashCode()
 205  
     {
 206  0
         final int prime = 31;
 207  0
         int result = 1;
 208  0
         result = prime * result + (bitten ? 1231 : 1237);
 209  0
         result = prime * result + ((brand == null) ? 0 : brand.hashCode());
 210  0
         result = prime * result + ((radius == null) ? 0 : radius.hashCode());
 211  0
         result = prime * result + ((segments == null) ? 0 : segments.hashCode());
 212  0
         return result;
 213  
     }
 214  
 
 215  
     public boolean equals(Object obj)
 216  
     {
 217  0
         if (this == obj)
 218  
         {
 219  0
             return true;
 220  
         }
 221  0
         if (obj == null)
 222  
         {
 223  0
             return false;
 224  
         }
 225  0
         if (getClass() != obj.getClass())
 226  
         {
 227  0
             return false;
 228  
         }
 229  0
         final Orange other = (Orange) obj;
 230  0
         if (bitten != other.bitten)
 231  
         {
 232  0
             return false;
 233  
         }
 234  0
         if (brand == null)
 235  
         {
 236  0
             if (other.brand != null)
 237  
             {
 238  0
                 return false;
 239  
             }
 240  
         }
 241  0
         else if (!brand.equals(other.brand))
 242  
         {
 243  0
             return false;
 244  
         }
 245  0
         if (radius == null)
 246  
         {
 247  0
             if (other.radius != null)
 248  
             {
 249  0
                 return false;
 250  
             }
 251  
         }
 252  0
         else if (!radius.equals(other.radius))
 253  
         {
 254  0
             return false;
 255  
         }
 256  0
         if (segments == null)
 257  
         {
 258  0
             if (other.segments != null)
 259  
             {
 260  0
                 return false;
 261  
             }
 262  
         }
 263  0
         else if (!segments.equals(other.segments))
 264  
         {
 265  0
             return false;
 266  
         }
 267  0
         return true;
 268  
     }
 269  
 
 270  
 }