org.kuali.hr.time.test
Class TkTestUtils

java.lang.Object
  extended by org.kuali.hr.time.test.TkTestUtils

public class TkTestUtils
extends Object


Constructor Summary
TkTestUtils()
           
 
Method Summary
static com.gargoylesoftware.htmlunit.html.HtmlPage clickButton(com.gargoylesoftware.htmlunit.html.HtmlPage page, String name)
           
static com.gargoylesoftware.htmlunit.html.HtmlPage clickClockInOrOutButton(com.gargoylesoftware.htmlunit.html.HtmlPage page)
           
static com.gargoylesoftware.htmlunit.html.HtmlPage clickLunchInOrOutButton(com.gargoylesoftware.htmlunit.html.HtmlPage page, String lunchAction)
           
static Date createDate(int month, int day, int year, int hours, int minutes, int seconds)
           
static TimeBlock createDummyTimeBlock(org.joda.time.DateTime clockIn, org.joda.time.DateTime clockOut, BigDecimal hours, String earnCode)
           
static TimeBlock createDummyTimeBlock(org.joda.time.DateTime clockIn, org.joda.time.DateTime clockOut, BigDecimal hours, String earnCode, Long jobNumber, Long workArea)
           
static void createEarnGroup(String earnGroup, List<String> earnCodes, Date asOfDate)
           
static TimeBlock createTimeBlock(TimesheetDocument timesheetDocument, int dayInPeriod, int numHours)
           
static TimeBlock createTimeBlock(TimesheetDocument timesheetDocument, int dayInPeriod, int numHours, String earnCode)
           
static List<TimeBlock> createUniformActualTimeBlocks(TimesheetDocument timesheetDocument, Assignment assignment, String earnCode, org.joda.time.DateTime start, int days, BigDecimal hours, BigDecimal amount)
          Helper method to generate time blocks suitable for db persistence in unit tests.
static List<TimeBlock> createUniformTimeBlocks(org.joda.time.DateTime start, int days, BigDecimal hours, String earnCode, Long jobNumber, Long workArea)
          Helper method to create regular time blocks for use in testing.
static List<TimeBlock> createUniformTimeBlocks(org.joda.time.DateTime start, int days, BigDecimal hours, String earnCode, Long jobNumber, Long workArea, Long task)
           
static com.gargoylesoftware.htmlunit.html.HtmlPage fillOutForm(com.gargoylesoftware.htmlunit.html.HtmlPage page, Map<String,Object> criteria)
           
static Map<Timestamp,BigDecimal> getDateToHoursMap(TimeBlock timeBlock, TimeHourDetail timeHourDetail)
           
static List<Job> getJobs(Date calDate)
           
static String getOnClickHref(com.gargoylesoftware.htmlunit.html.HtmlElement button)
          Method to obtain the HREF onclick='' value from the button when the client side typically processes the request.
static TimesheetDocument populateBlankTimesheetDocument(Date calDate)
           
static TimesheetDocument populateTimesheetDocument(Date calDate)
           
static void verifyAggregateHourSums(Map<String,BigDecimal> ecToHoursMap, TkTimeBlockAggregate aggregate, int flsaWeek)
           
static void verifyAggregateHourSums(String msg, Map<String,BigDecimal> ecToHoursMap, TkTimeBlockAggregate aggregate, int flsaWeek)
          Helper method to verify that the aggregate contains the correct sums as indicated in the ecToHoursMapping, on a SINGLE given flsaWeek.
static void verifyAggregateHourSumsFlatList(String msg, Map<String,BigDecimal> ecToHoursMap, TkTimeBlockAggregate aggregate)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TkTestUtils

public TkTestUtils()
Method Detail

populateBlankTimesheetDocument

public static TimesheetDocument populateBlankTimesheetDocument(Date calDate)

populateTimesheetDocument

public static TimesheetDocument populateTimesheetDocument(Date calDate)

createEarnGroup

public static void createEarnGroup(String earnGroup,
                                   List<String> earnCodes,
                                   Date asOfDate)

createUniformTimeBlocks

public static List<TimeBlock> createUniformTimeBlocks(org.joda.time.DateTime start,
                                                      int days,
                                                      BigDecimal hours,
                                                      String earnCode,
                                                      Long jobNumber,
                                                      Long workArea)
Helper method to create regular time blocks for use in testing.

Parameters:
start -
days -
hours -
earnCode -
jobNumber -
workArea -
Returns:

createUniformTimeBlocks

public static List<TimeBlock> createUniformTimeBlocks(org.joda.time.DateTime start,
                                                      int days,
                                                      BigDecimal hours,
                                                      String earnCode,
                                                      Long jobNumber,
                                                      Long workArea,
                                                      Long task)

createDummyTimeBlock

public static TimeBlock createDummyTimeBlock(org.joda.time.DateTime clockIn,
                                             org.joda.time.DateTime clockOut,
                                             BigDecimal hours,
                                             String earnCode)

createDummyTimeBlock

public static TimeBlock createDummyTimeBlock(org.joda.time.DateTime clockIn,
                                             org.joda.time.DateTime clockOut,
                                             BigDecimal hours,
                                             String earnCode,
                                             Long jobNumber,
                                             Long workArea)

createTimeBlock

public static TimeBlock createTimeBlock(TimesheetDocument timesheetDocument,
                                        int dayInPeriod,
                                        int numHours)

createTimeBlock

public static TimeBlock createTimeBlock(TimesheetDocument timesheetDocument,
                                        int dayInPeriod,
                                        int numHours,
                                        String earnCode)

getJobs

public static List<Job> getJobs(Date calDate)

fillOutForm

public static com.gargoylesoftware.htmlunit.html.HtmlPage fillOutForm(com.gargoylesoftware.htmlunit.html.HtmlPage page,
                                                                      Map<String,Object> criteria)
                                                               throws Exception
Parameters:
page: - current html page
criteria: - The key is the field name and the value is a string array which contains the field value and the field type which can be chosen from TkTestConstants
Returns:
HtmlPage resultPage
Throws:
Exception

clickButton

public static com.gargoylesoftware.htmlunit.html.HtmlPage clickButton(com.gargoylesoftware.htmlunit.html.HtmlPage page,
                                                                      String name)
                                                               throws Exception
Parameters:
page: - current html page //NOTE doesnt seem to work currently for js setting of form variables
name: - the button name
Returns:
Throws:
Exception

clickClockInOrOutButton

public static com.gargoylesoftware.htmlunit.html.HtmlPage clickClockInOrOutButton(com.gargoylesoftware.htmlunit.html.HtmlPage page)
                                                                           throws Exception
Throws:
Exception

clickLunchInOrOutButton

public static com.gargoylesoftware.htmlunit.html.HtmlPage clickLunchInOrOutButton(com.gargoylesoftware.htmlunit.html.HtmlPage page,
                                                                                  String lunchAction)
                                                                           throws Exception
Throws:
Exception

verifyAggregateHourSumsFlatList

public static void verifyAggregateHourSumsFlatList(String msg,
                                                   Map<String,BigDecimal> ecToHoursMap,
                                                   TkTimeBlockAggregate aggregate)

verifyAggregateHourSums

public static void verifyAggregateHourSums(String msg,
                                           Map<String,BigDecimal> ecToHoursMap,
                                           TkTimeBlockAggregate aggregate,
                                           int flsaWeek)
Helper method to verify that the aggregate contains the correct sums as indicated in the ecToHoursMapping, on a SINGLE given flsaWeek. Warning! Contains Assertions, use only with Test Cases.

Parameters:
ecToHoursMap - ex: { 'REG' => 40, 'OVT' => 10 }
aggregate - An aggregate object containing the time blocks
flsaWeek - 0 indexed start week (pulling from aggregate)

verifyAggregateHourSums

public static void verifyAggregateHourSums(Map<String,BigDecimal> ecToHoursMap,
                                           TkTimeBlockAggregate aggregate,
                                           int flsaWeek)

createUniformActualTimeBlocks

public static List<TimeBlock> createUniformActualTimeBlocks(TimesheetDocument timesheetDocument,
                                                            Assignment assignment,
                                                            String earnCode,
                                                            org.joda.time.DateTime start,
                                                            int days,
                                                            BigDecimal hours,
                                                            BigDecimal amount)
Helper method to generate time blocks suitable for db persistence in unit tests.


getDateToHoursMap

public static Map<Timestamp,BigDecimal> getDateToHoursMap(TimeBlock timeBlock,
                                                          TimeHourDetail timeHourDetail)

createDate

public static Date createDate(int month,
                              int day,
                              int year,
                              int hours,
                              int minutes,
                              int seconds)

getOnClickHref

public static String getOnClickHref(com.gargoylesoftware.htmlunit.html.HtmlElement button)
Method to obtain the HREF onclick='' value from the button when the client side typically processes the request.

Parameters:
button -


Copyright © 2004-2012 The Kuali Foundation. All Rights Reserved.