InMemoryHistoricalTimeSeriesMaster extends SimpleAbstractInMemoryMaster<HistoricalTimeSeriesInfoDocument> implements HistoricalTimeSeriesMaster { @Override public HistoricalTimeSeriesInfoDocument update(final HistoricalTimeSeriesInfoDocument document) { validateDocument(document); ArgumentChecker.notNull(document.getUniqueId(), "document.uniqueId"); final UniqueId uniqueId = document.getUniqueId(); final Instant now = Instant.now(); final HistoricalTimeSeriesInfoDocument storedDocument = _store.get(uniqueId.getObjectId()); if (storedDocument == null) { throw new DataNotFoundException("Historical time-series not found: " + uniqueId); } document.setVersionFromInstant(now); document.setVersionToInstant(null); document.setCorrectionFromInstant(now); document.setCorrectionToInstant(null); if (_store.replace(uniqueId.getObjectId(), storedDocument, document) == false) { throw new IllegalArgumentException("Concurrent modification"); } _changeManager.entityChanged(ChangeType.CHANGED, document.getObjectId(), document.getVersionFromInstant(), document.getVersionToInstant(), now); return document; } InMemoryHistoricalTimeSeriesMaster();  InMemoryHistoricalTimeSeriesMaster(final ChangeManager changeManager);  InMemoryHistoricalTimeSeriesMaster(final Supplier<ObjectId> objectIdSupplier);  InMemoryHistoricalTimeSeriesMaster(final Supplier<ObjectId> objectIdSupplier, final ChangeManager changeManager); @Override HistoricalTimeSeriesInfoMetaDataResult metaData(HistoricalTimeSeriesInfoMetaDataRequest request); @Override HistoricalTimeSeriesInfoSearchResult search(HistoricalTimeSeriesInfoSearchRequest request); @Override HistoricalTimeSeriesInfoDocument get(final UniqueId uniqueId); @Override HistoricalTimeSeriesInfoDocument get(final ObjectIdentifiable objectKey, VersionCorrection versionCorrection); @Override HistoricalTimeSeriesInfoDocument add(final HistoricalTimeSeriesInfoDocument document); @Override HistoricalTimeSeriesInfoDocument update(final HistoricalTimeSeriesInfoDocument document); @Override void remove(final ObjectIdentifiable objectIdentifiable); @Override HistoricalTimeSeriesInfoDocument correct(final HistoricalTimeSeriesInfoDocument document); @Override HistoricalTimeSeriesInfoHistoryResult history(HistoricalTimeSeriesInfoHistoryRequest request); ManageableHistoricalTimeSeries getTimeSeries(UniqueId uniqueId); ManageableHistoricalTimeSeries getTimeSeries(UniqueId uniqueId, HistoricalTimeSeriesGetFilter filter); ManageableHistoricalTimeSeries getTimeSeries(ObjectIdentifiable objectId, VersionCorrection versionCorrection); ManageableHistoricalTimeSeries getTimeSeries(ObjectIdentifiable objectKey, VersionCorrection versionCorrection, HistoricalTimeSeriesGetFilter filter); @Override UniqueId updateTimeSeriesDataPoints(ObjectIdentifiable objectKey, LocalDateDoubleTimeSeries series); @Override UniqueId correctTimeSeriesDataPoints(ObjectIdentifiable objectKey, LocalDateDoubleTimeSeries series); @Override UniqueId removeTimeSeriesDataPoints(ObjectIdentifiable objectKey, LocalDate fromDateInclusive, LocalDate toDateInclusive); static final String DEFAULT_OID_SCHEME; }
@Test(expectedExceptions = DataNotFoundException.class) public void test_update_emptyMaster() { HistoricalTimeSeriesInfoDocument doc = new HistoricalTimeSeriesInfoDocument(); doc.setInfo(info1); doc.setUniqueId(OTHER_UID); testEmpty.update(doc); }