Beispiel #1
1
  public void testUpdateTimeSeriesAddNewLaterPointsOnly() {
    // Add the test series
    testAddTimeSeries();

    List<LocalDate> dates = ImmutableList.of(_today.plusDays(1));
    List<Double> values = ImmutableList.of(4d);
    ArrayLocalDateDoubleTimeSeries newTs = new ArrayLocalDateDoubleTimeSeries(dates, values);
    UniqueId id =
        _htsWriter.writeTimeSeries(
            DESCRIPTION,
            DATA_SOURCE,
            DATA_PROVIDER,
            DATA_FIELD,
            OBSERVATION_TIME,
            ExternalIdBundle.of(ID),
            newTs);

    ManageableHistoricalTimeSeries manageableTs = _htsMaster.getTimeSeries(id);
    LocalDateDoubleTimeSeries readTs = manageableTs.getTimeSeries();
    List<LocalDate> expectedDates =
        ImmutableList.of(_today.minusDays(2), _today.minusDays(1), _today, _today.plusDays(1));
    List<Double> expectedValues = ImmutableList.of(1d, 2d, 3d, 4d);
    ArrayLocalDateDoubleTimeSeries expectedTs =
        new ArrayLocalDateDoubleTimeSeries(expectedDates, expectedValues);
    assertEquals(expectedTs, readTs);
  }
Beispiel #2
1
 @Override
 public HistoricalTimeSeries getHistoricalTimeSeries(
     ExternalIdBundle identifiers,
     String dataSource,
     String dataProvider,
     String dataField,
     LocalDate start,
     boolean includeStart,
     LocalDate end,
     boolean includeEnd,
     int maxPoints) {
   LocalDate resolvedStart = null;
   if (!includeStart && start != null) {
     resolvedStart = start.plusDays(1);
   } else {
     resolvedStart = start;
   }
   LocalDate resolvedEnd = null;
   if (!includeEnd && end != null) {
     resolvedEnd = end.minusDays(1);
   } else {
     resolvedEnd = end;
   }
   return doGetHistoricalTimeSeries(
       identifiers, dataSource, dataProvider, dataField, resolvedStart, resolvedEnd, maxPoints);
 }
Beispiel #3
0
  public void testAddTimeSeries() {
    List<LocalDate> dates = ImmutableList.of(_today.minusDays(2), _today.minusDays(1), _today);
    List<Double> values = ImmutableList.of(1d, 2d, 3d);
    ArrayLocalDateDoubleTimeSeries origTs = new ArrayLocalDateDoubleTimeSeries(dates, values);
    UniqueId id =
        _htsWriter.writeTimeSeries(
            DESCRIPTION,
            DATA_SOURCE,
            DATA_PROVIDER,
            DATA_FIELD,
            OBSERVATION_TIME,
            ExternalIdBundle.of(ID),
            origTs);

    ManageableHistoricalTimeSeries manageableTs = _htsMaster.getTimeSeries(id);
    LocalDateDoubleTimeSeries readTs = manageableTs.getTimeSeries();
    assertEquals(origTs, readTs);
  }
Beispiel #4
0
  @Test(enabled = false) // Current implementation does not support removing points
  public void testUpdateTimeSeriesRemoveExistingPoints() {
    // Add the test series
    testAddTimeSeries();

    List<LocalDate> dates = ImmutableList.of(_today.minusDays(2), _today);
    List<Double> values = ImmutableList.of(6d, 7d);
    ArrayLocalDateDoubleTimeSeries updatedTs = new ArrayLocalDateDoubleTimeSeries(dates, values);
    UniqueId id =
        _htsWriter.writeTimeSeries(
            DESCRIPTION,
            DATA_SOURCE,
            DATA_PROVIDER,
            DATA_FIELD,
            OBSERVATION_TIME,
            ExternalIdBundle.of(ID),
            updatedTs);

    ManageableHistoricalTimeSeries manageableTs = _htsMaster.getTimeSeries(id);
    LocalDateDoubleTimeSeries readTs = manageableTs.getTimeSeries();
    assertEquals(updatedTs, readTs);
  }