/********************************************************************
 * Copyright © 2007 VHA. All rights reserved
 ********************************************************************/


package gov.va.med.esr.common.batchprocess;

import java.security.SecureRandom;

import junit.framework.TestCase;

/**
 * Initial javadoc for class TestMigrateBulkEEStatistics.
 * TODO - Add content here
 * 
 * Created Mar 2, 2007 3:05:33 PM
 * @author DNS   BOHMEG
 */
public class TestMigrateBulkEEStatistics extends TestCase {
	public void testStatsUpdate() throws Exception {
		MigrateBulkEEProcessStatistics dbStats = new MigrateBulkEEProcessStatistics();
		SecureRandom secureRandom = new SecureRandom();
	    
		MigrateBulkEEProcessStatistics incomingStats = null;
		float total = 0;
		int COUNT = 20;
		for(int i=0; i<COUNT; i++) {
			//dbStats.incrementNumberOfSuccessfulRecords(i);
			incomingStats = new MigrateBulkEEProcessStatistics();
			//incomingStats.incrementTotalSuccessfulDuration((float) (Math.random() * 5.0));
			incomingStats.incrementTotalSuccessfulDuration((float) (secureRandom.nextInt() * 5.0));
			
			dbStats.overlayStats(incomingStats);
			total += incomingStats.getCurrentAverageSuccessfulDuration();
			System.out.println(i + ": " + dbStats.getCurrentAverageSuccessfulDuration() + "(after baking in " +
					incomingStats.getCurrentAverageSuccessfulDuration() + ")");
		}
		System.out.println(total / COUNT);
	}
}
