Coverage Report - org.mule.example.geomail.components.DataGenerator
 
Classes in this File Line Coverage Branch Coverage Complexity
DataGenerator
0%
0/12
0%
0/2
0
 
 1  
 /*
 2  
  * $Id: DataGenerator.java 20321 2010-11-24 15:21:24Z dfeist $
 3  
  * --------------------------------------------------------------------------------------
 4  
  * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.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  
 package org.mule.example.geomail.components;
 11  
 
 12  
 import org.mule.api.MuleEventContext;
 13  
 import org.mule.api.lifecycle.Callable;
 14  
 
 15  
 import java.util.ArrayList;
 16  
 import java.util.List;
 17  
 import java.util.Random;
 18  
 
 19  
 /**
 20  
  * TODO
 21  
  */
 22  0
 public class DataGenerator implements Callable
 23  
 {
 24  0
     private Random generator = new Random();
 25  0
     private int batchSize = 10;
 26  
     
 27  
     public Object onCall(MuleEventContext eventContext) throws Exception
 28  
     {
 29  0
         eventContext.getMessage().setOutboundProperty("from.email.address", "testdatagenerator@geomail.com");
 30  
 
 31  
         // Create multiple IPs for each run since many addresses will not be valid
 32  0
         List<String> ipAddresses = new ArrayList<String>(batchSize);
 33  0
         for (int i = 0; i < batchSize; i++)
 34  
         {
 35  0
             String address = new StringBuffer().append(generator.nextInt(255)).append(".")
 36  
                 .append(generator.nextInt(255)).append(".").append(generator.nextInt(255)).
 37  
                 append(".").append(generator.nextInt(255)).toString();
 38  0
             ipAddresses.add(address);
 39  
         }
 40  
 
 41  0
         return ipAddresses;
 42  
     }
 43  
 
 44  
     public int getBatchSize()
 45  
     {
 46  0
         return batchSize;
 47  
     }
 48  
 
 49  
     public void setBatchSize(int batchSize)
 50  
     {
 51  0
         this.batchSize = batchSize;
 52  0
     }
 53  
 }