Пример #1
0
  /**
   * Entry point for processing saved view state.
   *
   * @param file project file
   * @param varData view state var data
   * @param fixedData view state fixed data
   * @throws IOException
   */
  public void process(ProjectFile file, Var2Data varData, byte[] fixedData) throws IOException {
    Props props = getProps(varData);
    // System.out.println(props);
    if (props != null) {
      String viewName = MPPUtility.removeAmpersands(props.getUnicodeString(VIEW_NAME));
      byte[] listData = props.getByteArray(VIEW_CONTENTS);
      List<Integer> uniqueIdList = new LinkedList<Integer>();
      if (listData != null) {
        for (int index = 0; index < listData.length; index += 4) {
          Integer uniqueID = Integer.valueOf(MPPUtility.getInt(listData, index));

          //
          // Ensure that we have a valid task, and that if we have and
          // ID of zero, this is the first task shown.
          //
          if (file.getTaskByUniqueID(uniqueID) != null
              && (uniqueID.intValue() != 0 || index == 0)) {
            uniqueIdList.add(uniqueID);
          }
        }
      }

      int filterID = MPPUtility.getShort(fixedData, 128);

      ViewState state = new ViewState(file, viewName, uniqueIdList, filterID);
      file.getViews().setViewState(state);
    }
  }
  /**
   * The main entry point for processing project header data.
   *
   * @param file parent project file
   * @param props properties data
   * @param rootDir Root of the POI file system.
   */
  public void process(ProjectFile file, Props props, DirectoryEntry rootDir) throws MPXJException {
    // MPPUtility.fileDump("c:\\temp\\props.txt", props.toString().getBytes());
    ProjectHeader ph = file.getProjectHeader();
    ph.setStartDate(props.getTimestamp(Props.PROJECT_START_DATE));
    ph.setFinishDate(props.getTimestamp(Props.PROJECT_FINISH_DATE));
    ph.setScheduleFrom(ScheduleFrom.getInstance(1 - props.getShort(Props.SCHEDULE_FROM)));
    ph.setCalendarName(props.getUnicodeString(Props.DEFAULT_CALENDAR_NAME));
    ph.setDefaultStartTime(props.getTime(Props.START_TIME));
    ph.setDefaultEndTime(props.getTime(Props.END_TIME));
    ph.setStatusDate(props.getTimestamp(Props.STATUS_DATE));
    ph.setHyperlinkBase(props.getUnicodeString(Props.HYPERLINK_BASE));

    // ph.setDefaultDurationIsFixed();
    ph.setDefaultDurationUnits(
        MPPUtility.getDurationTimeUnits(props.getShort(Props.DURATION_UNITS)));
    ph.setMinutesPerDay(Integer.valueOf(props.getInt(Props.MINUTES_PER_DAY)));
    ph.setMinutesPerWeek(Integer.valueOf(props.getInt(Props.MINUTES_PER_WEEK)));
    ph.setDefaultOvertimeRate(new Rate(props.getDouble(Props.OVERTIME_RATE), TimeUnit.HOURS));
    ph.setDefaultStandardRate(new Rate(props.getDouble(Props.STANDARD_RATE), TimeUnit.HOURS));
    ph.setDefaultWorkUnits(MPPUtility.getWorkTimeUnits(props.getShort(Props.WORK_UNITS)));
    ph.setSplitInProgressTasks(props.getBoolean(Props.SPLIT_TASKS));
    ph.setUpdatingTaskStatusUpdatesResourceStatus(props.getBoolean(Props.TASK_UPDATES_RESOURCE));

    ph.setCurrencyDigits(Integer.valueOf(props.getShort(Props.CURRENCY_DIGITS)));
    ph.setCurrencySymbol(props.getUnicodeString(Props.CURRENCY_SYMBOL));
    ph.setCurrencyCode(props.getUnicodeString(Props.CURRENCY_CODE));
    // ph.setDecimalSeparator();
    ph.setSymbolPosition(MPPUtility.getSymbolPosition(props.getShort(Props.CURRENCY_PLACEMENT)));
    // ph.setThousandsSeparator();
    ph.setWeekStartDay(Day.getInstance(props.getShort(Props.WEEK_START_DAY) + 1));
    ph.setFiscalYearStartMonth(Integer.valueOf(props.getShort(Props.FISCAL_YEAR_START_MONTH)));
    ph.setFiscalYearStart(props.getShort(Props.FISCAL_YEAR_START) == 1);
    ph.setDaysPerMonth(Integer.valueOf(props.getShort(Props.DAYS_PER_MONTH)));
    ph.setEditableActualCosts(props.getBoolean(Props.EDITABLE_ACTUAL_COSTS));
    ph.setHonorConstraints(!props.getBoolean(Props.HONOR_CONSTRAINTS));

    SummaryInformation summary = new SummaryInformation(rootDir);
    ph.setProjectTitle(summary.getProjectTitle());
    ph.setSubject(summary.getSubject());
    ph.setAuthor(summary.getAuthor());
    ph.setKeywords(summary.getKeywords());
    ph.setComments(summary.getComments());
    ph.setCompany(summary.getCompany());
    ph.setManager(summary.getManager());
    ph.setCategory(summary.getCategory());
    ph.setRevision(summary.getRevision());
    ph.setCreationDate(summary.getCreationDate());
    ph.setLastSaved(summary.getLastSaved());
    ph.setDocumentSummaryInformation(summary.getDocumentSummaryInformation());

    ph.setCalculateMultipleCriticalPaths(props.getBoolean(Props.CALCULATE_MULTIPLE_CRITICAL_PATHS));
  }
Пример #3
0
  /**
   * Test the resource types present in an individual MPP file.
   *
   * @param file MPP file to test
   */
  private void testResourceType(File file) throws MPXJException {
    ProjectFile project = new MPPReader().read(file);
    List<Resource> resources = project.getAllResources();
    assertEquals(10, resources.size());

    testResource(file, project, 1, "Work 1", ResourceType.WORK);
    testResource(file, project, 2, "Work 2", ResourceType.WORK);
    testResource(file, project, 3, "Work 3", ResourceType.WORK);
    testResource(file, project, 4, "Material 1", ResourceType.MATERIAL);
    testResource(file, project, 5, "Material 2", ResourceType.MATERIAL);
    testResource(file, project, 6, "Material 3", ResourceType.MATERIAL);

    //
    // The cost resource type was introduced in MPP12
    //
    ResourceType expectedType =
        NumberHelper.getInt(project.getProjectProperties().getMppFileType()) > 9
            ? ResourceType.COST
            : ResourceType.MATERIAL;
    testResource(file, project, 7, "Cost 1", expectedType);
    testResource(file, project, 8, "Cost 2", expectedType);
    testResource(file, project, 9, "Cost 3", expectedType);
  }
Пример #4
0
  /**
   * Tests common to all file types.
   *
   * @param file project file
   */
  private void testEmbeddedObjects(ProjectFile file) {
    Task task = file.getTaskByID(Integer.valueOf(1));
    assertEquals("Task 1", task.getName());
    String notes = task.getNotes();
    assertNotNull(notes);
    List<List<RTFEmbeddedObject>> list = RTFEmbeddedObject.getEmbeddedObjects(notes);
    assertNull(list);

    task = file.getTaskByID(Integer.valueOf(2));
    assertEquals("Task 2", task.getName());
    notes = task.getNotes();
    assertNotNull(notes);
    list = RTFEmbeddedObject.getEmbeddedObjects(notes);
    assertNotNull(list);
    assertEquals(1, list.size());
    List<RTFEmbeddedObject> objectList = list.get(0);
    assertEquals(4, objectList.size());
    assertEquals("Package", new String(objectList.get(0).getData(), 0, 7));
    assertEquals("METAFILEPICT", new String(objectList.get(2).getData(), 0, 12));

    task = file.getTaskByID(Integer.valueOf(3));
    assertEquals("Task 3", task.getName());
    notes = task.getNotes();
    assertNotNull(notes);
    list = RTFEmbeddedObject.getEmbeddedObjects(notes);
    assertNotNull(list);
    assertEquals(1, list.size());
    objectList = list.get(0);
    assertEquals(4, objectList.size());
    assertEquals("Package", new String(objectList.get(0).getData(), 0, 7));
    assertEquals("METAFILEPICT", new String(objectList.get(2).getData(), 0, 12));

    task = file.getTaskByID(Integer.valueOf(4));
    assertEquals("Task 4", task.getName());
    notes = task.getNotes();
    assertNotNull(notes);
    list = RTFEmbeddedObject.getEmbeddedObjects(notes);
    assertNotNull(list);
    assertEquals(1, list.size());
    objectList = list.get(0);
    assertEquals(4, objectList.size());
    assertEquals("Package", new String(objectList.get(0).getData(), 0, 7));
    assertEquals("METAFILEPICT", new String(objectList.get(2).getData(), 0, 12));

    task = file.getTaskByID(Integer.valueOf(5));
    assertEquals("Task 5", task.getName());
    notes = task.getNotes();
    assertNotNull(notes);
    list = RTFEmbeddedObject.getEmbeddedObjects(notes);
    assertNotNull(list);
    assertEquals(1, list.size());
    objectList = list.get(0);
    assertEquals(4, objectList.size());
    assertEquals("Package", new String(objectList.get(0).getData(), 0, 7));
    assertEquals("METAFILEPICT", new String(objectList.get(2).getData(), 0, 12));

    task = file.getTaskByID(Integer.valueOf(6));
    assertEquals("Task 6", task.getName());
    notes = task.getNotes();
    assertNotNull(notes);
    list = RTFEmbeddedObject.getEmbeddedObjects(notes);
    assertNotNull(list);
    assertEquals(2, list.size());
    objectList = list.get(0);
    assertEquals(4, objectList.size());
    assertEquals("Package", new String(objectList.get(0).getData(), 0, 7));
    assertEquals("METAFILEPICT", new String(objectList.get(2).getData(), 0, 12));
    objectList = list.get(1);
    assertEquals(4, objectList.size());
    assertEquals("Package", new String(objectList.get(0).getData(), 0, 7));
    assertEquals("METAFILEPICT", new String(objectList.get(2).getData(), 0, 12));

    task = file.getTaskByID(Integer.valueOf(7));
    assertEquals("Task 7", task.getName());
    notes = task.getNotes();
    assertNotNull(notes);
    list = RTFEmbeddedObject.getEmbeddedObjects(notes);
    assertNotNull(list);
    assertEquals(2, list.size());
    objectList = list.get(0);
    assertEquals(4, objectList.size());
    assertEquals("Package", new String(objectList.get(0).getData(), 0, 7));
    assertEquals("METAFILEPICT", new String(objectList.get(2).getData(), 0, 12));
    objectList = list.get(1);
    assertEquals(4, objectList.size());
    assertEquals("Package", new String(objectList.get(0).getData(), 0, 7));
    assertEquals("METAFILEPICT", new String(objectList.get(2).getData(), 0, 12));
  }
Пример #5
0
 /**
  * Validate the name and type of an individual resource.
  *
  * @param file MPP file
  * @param project project read from MPP file
  * @param id resource ID
  * @param expectedName expected name
  * @param expectedType expected type
  */
 private void testResource(
     File file, ProjectFile project, int id, String expectedName, ResourceType expectedType) {
   Resource resource = project.getResourceByID(Integer.valueOf(id));
   assertEquals(file.getName(), expectedName, resource.getName());
   assertEquals(file.getName(), expectedType, resource.getType());
 }
Пример #6
0
  /**
   * Exercise slack duration functionality.
   *
   * @throws Exception
   */
  public void testSlack() throws Exception {
    ProjectFile mpp = new MPPReader().read(m_basedir + "/slack9.mpp");
    Task task = mpp.getTaskByID(Integer.valueOf(1));
    assertEquals("Task 1", task.getName());
    assertEquals(Duration.getInstance(8, TimeUnit.HOURS), task.getDuration());
    assertEquals(Duration.getInstance(40, TimeUnit.HOURS), task.getStartSlack());
    assertEquals(Duration.getInstance(40, TimeUnit.HOURS), task.getFinishSlack());
    assertEquals(Duration.getInstance(0, TimeUnit.HOURS), task.getFreeSlack());
    assertEquals(Duration.getInstance(40, TimeUnit.HOURS), task.getTotalSlack());

    task = mpp.getTaskByID(Integer.valueOf(2));
    assertEquals("Task 2", task.getName());
    assertEquals(Duration.getInstance(5, TimeUnit.DAYS), task.getDuration());
    assertEquals(Duration.getInstance(5, TimeUnit.DAYS), task.getStartSlack());
    assertEquals(Duration.getInstance(5, TimeUnit.DAYS), task.getFinishSlack());
    assertEquals(Duration.getInstance(0, TimeUnit.DAYS), task.getFreeSlack());
    assertEquals(Duration.getInstance(5, TimeUnit.DAYS), task.getTotalSlack());

    task = mpp.getTaskByID(Integer.valueOf(3));
    assertEquals("Task 3", task.getName());
    assertEquals(Duration.getInstance(5, TimeUnit.DAYS), task.getDuration());
    assertEquals(Duration.getInstance(10, TimeUnit.DAYS), task.getStartSlack());
    assertEquals(Duration.getInstance(10, TimeUnit.DAYS), task.getFinishSlack());
    assertEquals(Duration.getInstance(5, TimeUnit.DAYS), task.getFreeSlack());
    assertEquals(Duration.getInstance(10, TimeUnit.DAYS), task.getTotalSlack());

    task = mpp.getTaskByID(Integer.valueOf(4));
    assertEquals("Task 4", task.getName());
    assertEquals(Duration.getInstance(5, TimeUnit.DAYS), task.getDuration());
    assertEquals(Duration.getInstance(5, TimeUnit.DAYS), task.getStartSlack());
    assertEquals(Duration.getInstance(5, TimeUnit.DAYS), task.getFinishSlack());
    assertEquals(Duration.getInstance(0, TimeUnit.DAYS), task.getFreeSlack());
    assertEquals(Duration.getInstance(5, TimeUnit.DAYS), task.getTotalSlack());

    task = mpp.getTaskByID(Integer.valueOf(5));
    assertEquals("Milestone 1", task.getName());
    assertEquals(Duration.getInstance(0, TimeUnit.DAYS), task.getDuration());
    assertEquals(Duration.getInstance(5, TimeUnit.DAYS), task.getStartSlack());
    assertEquals(Duration.getInstance(5, TimeUnit.DAYS), task.getFinishSlack());
    assertEquals(Duration.getInstance(5, TimeUnit.DAYS), task.getFreeSlack());
    assertEquals(Duration.getInstance(5, TimeUnit.DAYS), task.getTotalSlack());

    task = mpp.getTaskByID(Integer.valueOf(6));
    assertEquals("Task 5", task.getName());
    assertEquals(Duration.getInstance(5, TimeUnit.DAYS), task.getDuration());
    assertEquals(Duration.getInstance(-1, TimeUnit.DAYS), task.getStartSlack());
    assertEquals(Duration.getInstance(-1, TimeUnit.DAYS), task.getFinishSlack());
    assertEquals(Duration.getInstance(0, TimeUnit.DAYS), task.getFreeSlack());
    assertEquals(Duration.getInstance(-1, TimeUnit.DAYS), task.getTotalSlack());

    task = mpp.getTaskByID(Integer.valueOf(7));
    assertEquals("Task 6", task.getName());
    assertEquals(Duration.getInstance(5, TimeUnit.DAYS), task.getDuration());
    assertEquals(Duration.getInstance(-1, TimeUnit.DAYS), task.getStartSlack());
    assertEquals(Duration.getInstance(-1, TimeUnit.DAYS), task.getFinishSlack());
    assertEquals(Duration.getInstance(0, TimeUnit.DAYS), task.getFreeSlack());
    assertEquals(Duration.getInstance(-1, TimeUnit.DAYS), task.getTotalSlack());

    task = mpp.getTaskByID(Integer.valueOf(8));
    assertEquals("Task 7", task.getName());
    assertEquals(Duration.getInstance(5, TimeUnit.DAYS), task.getDuration());
    assertEquals(Duration.getInstance(-1, TimeUnit.DAYS), task.getStartSlack());
    assertEquals(Duration.getInstance(-1, TimeUnit.DAYS), task.getFinishSlack());
    assertEquals(Duration.getInstance(0, TimeUnit.DAYS), task.getFreeSlack());
    assertEquals(Duration.getInstance(-1, TimeUnit.DAYS), task.getTotalSlack());

    task = mpp.getTaskByID(Integer.valueOf(9));
    assertEquals("Task 8", task.getName());
    assertEquals(Duration.getInstance(5, TimeUnit.DAYS), task.getDuration());
    assertEquals(Duration.getInstance(4, TimeUnit.DAYS), task.getStartSlack());
    assertEquals(Duration.getInstance(4, TimeUnit.DAYS), task.getFinishSlack());
    assertEquals(Duration.getInstance(4, TimeUnit.DAYS), task.getFreeSlack());
    assertEquals(Duration.getInstance(4, TimeUnit.DAYS), task.getTotalSlack());

    task = mpp.getTaskByID(Integer.valueOf(10));
    assertEquals("Milestone 2", task.getName());
    assertEquals(Duration.getInstance(0, TimeUnit.DAYS), task.getDuration());
    assertEquals(Duration.getInstance(-1, TimeUnit.DAYS), task.getStartSlack());
    assertEquals(Duration.getInstance(0, TimeUnit.DAYS), task.getFinishSlack());
    assertEquals(Duration.getInstance(0, TimeUnit.DAYS), task.getFreeSlack());
    assertEquals(Duration.getInstance(-1, TimeUnit.DAYS), task.getTotalSlack());

    task = mpp.getTaskByID(Integer.valueOf(11));
    assertEquals("Task 9", task.getName());
    assertEquals(Duration.getInstance(5, TimeUnit.DAYS), task.getDuration());
    assertEquals(Duration.getInstance(0, TimeUnit.DAYS), task.getStartSlack());
    assertEquals(Duration.getInstance(0, TimeUnit.DAYS), task.getFinishSlack());
    assertEquals(Duration.getInstance(0, TimeUnit.DAYS), task.getFreeSlack());
    assertEquals(Duration.getInstance(0, TimeUnit.DAYS), task.getTotalSlack());

    task = mpp.getTaskByID(Integer.valueOf(12));
    assertEquals("Task 10", task.getName());
    assertEquals(Duration.getInstance(5, TimeUnit.DAYS), task.getDuration());
    assertEquals(Duration.getInstance(0, TimeUnit.DAYS), task.getStartSlack());
    assertEquals(Duration.getInstance(0, TimeUnit.DAYS), task.getFinishSlack());
    assertEquals(Duration.getInstance(0, TimeUnit.DAYS), task.getFreeSlack());
    assertEquals(Duration.getInstance(0, TimeUnit.DAYS), task.getTotalSlack());

    task = mpp.getTaskByID(Integer.valueOf(13));
    assertEquals("Task 11", task.getName());
    assertEquals(Duration.getInstance(5, TimeUnit.DAYS), task.getDuration());
    assertEquals(Duration.getInstance(0, TimeUnit.DAYS), task.getStartSlack());
    assertEquals(Duration.getInstance(0, TimeUnit.DAYS), task.getFinishSlack());
    assertEquals(Duration.getInstance(0, TimeUnit.DAYS), task.getFreeSlack());
    assertEquals(Duration.getInstance(0, TimeUnit.DAYS), task.getTotalSlack());

    task = mpp.getTaskByID(Integer.valueOf(14));
    assertEquals("Task 12", task.getName());
    assertEquals(Duration.getInstance(5, TimeUnit.DAYS), task.getDuration());
    assertEquals(Duration.getInstance(6, TimeUnit.DAYS), task.getStartSlack());
    assertEquals(Duration.getInstance(6, TimeUnit.DAYS), task.getFinishSlack());
    assertEquals(Duration.getInstance(6, TimeUnit.DAYS), task.getFreeSlack());
    assertEquals(Duration.getInstance(6, TimeUnit.DAYS), task.getTotalSlack());

    task = mpp.getTaskByID(Integer.valueOf(15));
    assertEquals("Milestone 3", task.getName());
    assertEquals(Duration.getInstance(0, TimeUnit.DAYS), task.getDuration());
    assertEquals(Duration.getInstance(0, TimeUnit.DAYS), task.getStartSlack());
    assertEquals(Duration.getInstance(0, TimeUnit.DAYS), task.getFinishSlack());
    assertEquals(Duration.getInstance(0, TimeUnit.DAYS), task.getFreeSlack());
    assertEquals(Duration.getInstance(0, TimeUnit.DAYS), task.getTotalSlack());
  }
  /**
   * Common cost rate table tests.
   *
   * @param file project file
   */
  private void testCostRateTable(ProjectFile file) throws Exception {
    //
    // Resource with default tables
    //
    Resource resource = file.getResourceByID(Integer.valueOf(1));
    assertEquals("Resource One", resource.getName());

    // Table A
    CostRateTable table = resource.getCostRateTable(0);
    assertEquals(1, table.size());
    assertEquals(0, TimeUnit.HOURS, 0, TimeUnit.HOURS, 0, "31/12/2049 23:59", table, 0);

    // Table B
    table = resource.getCostRateTable(1);
    assertEquals(1, table.size());
    assertEquals(0, TimeUnit.HOURS, 0, TimeUnit.HOURS, 0, "31/12/2049 23:59", table, 0);

    // Table C
    table = resource.getCostRateTable(2);
    assertEquals(1, table.size());
    assertEquals(0, TimeUnit.HOURS, 0, TimeUnit.HOURS, 0, "31/12/2049 23:59", table, 0);

    // Table D
    table = resource.getCostRateTable(3);
    assertEquals(1, table.size());
    assertEquals(0, TimeUnit.HOURS, 0, TimeUnit.HOURS, 0, "31/12/2049 23:59", table, 0);

    // Table E
    table = resource.getCostRateTable(4);
    assertEquals(1, table.size());
    assertEquals(0, TimeUnit.HOURS, 0, TimeUnit.HOURS, 0, "31/12/2049 23:59", table, 0);

    //
    // Resource with default tables, but non-default values
    //
    resource = file.getResourceByID(Integer.valueOf(2));
    assertEquals("Resource Two", resource.getName());

    // Table A
    table = resource.getCostRateTable(0);
    assertEquals(1, table.size());
    assertEquals(5, TimeUnit.HOURS, 10, TimeUnit.HOURS, 15, "31/12/2049 23:59", table, 0);

    // Table B
    table = resource.getCostRateTable(1);
    assertEquals(1, table.size());
    assertEquals(20, TimeUnit.HOURS, 25, TimeUnit.HOURS, 30, "31/12/2049 23:59", table, 0);

    // Table C
    table = resource.getCostRateTable(2);
    assertEquals(1, table.size());
    assertEquals(35, TimeUnit.HOURS, 40, TimeUnit.HOURS, 45, "31/12/2049 23:59", table, 0);

    // Table D
    table = resource.getCostRateTable(3);
    assertEquals(1, table.size());
    assertEquals(50, TimeUnit.HOURS, 55, TimeUnit.HOURS, 60, "31/12/2049 23:59", table, 0);

    // Table E
    table = resource.getCostRateTable(4);
    assertEquals(1, table.size());
    assertEquals(65, TimeUnit.HOURS, 70, TimeUnit.HOURS, 75, "31/12/2049 23:59", table, 0);

    //
    // Resource with multiple values
    //
    resource = file.getResourceByID(Integer.valueOf(3));
    assertEquals("Resource Three", resource.getName());

    // Table A
    table = resource.getCostRateTable(0);
    assertEquals(2, table.size());
    assertEquals(5, TimeUnit.HOURS, 10, TimeUnit.HOURS, 15, "15/06/2009 08:00", table, 0);
    assertEquals(1200, TimeUnit.MINUTES, 25, TimeUnit.HOURS, 30, "31/12/2049 23:59", table, 1);

    // Table B
    table = resource.getCostRateTable(1);
    assertEquals(2, table.size());
    assertEquals(35, TimeUnit.HOURS, 40, TimeUnit.HOURS, 45, "16/06/2009 08:00", table, 0);
    assertEquals(6.25, TimeUnit.DAYS, 1.375, TimeUnit.WEEKS, 60, "31/12/2049 23:59", table, 1);

    // Table C
    table = resource.getCostRateTable(2);
    assertEquals(2, table.size());
    assertEquals(65, TimeUnit.HOURS, 70, TimeUnit.HOURS, 75, "17/06/2009 08:00", table, 0);
    assertEquals(0.5, TimeUnit.MONTHS, 0.040, TimeUnit.YEARS, 90, "31/12/2049 23:59", table, 1);

    // Table D
    table = resource.getCostRateTable(3);
    assertEquals(2, table.size());
    assertEquals(95, TimeUnit.HOURS, 100, TimeUnit.HOURS, 105, "18/06/2009 08:00", table, 0);
    assertEquals(110, TimeUnit.HOURS, 115, TimeUnit.HOURS, 120, "31/12/2049 23:59", table, 1);

    // Table E
    table = resource.getCostRateTable(4);
    assertEquals(2, table.size());
    assertEquals(125, TimeUnit.HOURS, 130, TimeUnit.HOURS, 135, "19/06/2009 08:00", table, 0);
    assertEquals(140, TimeUnit.HOURS, 145, TimeUnit.HOURS, 150, "31/12/2049 23:59", table, 1);

    //
    // Validate date-based row selection
    //
    CostRateTableEntry entry = table.getEntryByDate(m_df.parse("18/06/2009 07:00"));
    assertEquals(125, TimeUnit.HOURS, 130, TimeUnit.HOURS, 135, "19/06/2009 08:00", entry);
    entry = table.getEntryByDate(m_df.parse("19/06/2009 10:00"));
    assertEquals(140, TimeUnit.HOURS, 145, TimeUnit.HOURS, 150, "31/12/2049 23:59", table, 1);
  }