DbMarketDataSnapshotMaster extends AbstractDocumentDbMaster<MarketDataSnapshotDocument> implements MarketDataSnapshotMaster { @Override public MarketDataSnapshotDocument get(final UniqueId uniqueId) { return doGet(uniqueId, new MarketDataSnapshotDocumentExtractor(true), "MarketDataSnapshot"); } DbMarketDataSnapshotMaster(DbConnector dbConnector); MarketDataSnapshotSearchResult search(final MarketDataSnapshotSearchRequest request); @Override MarketDataSnapshotDocument get(final UniqueId uniqueId); @Override MarketDataSnapshotDocument get(final ObjectIdentifiable objectId, final VersionCorrection versionCorrection); MarketDataSnapshotHistoryResult history(final MarketDataSnapshotHistoryRequest request); static final String IDENTIFIER_SCHEME_DEFAULT; }
@Test public void test_example() throws Exception { final ManageableMarketDataSnapshot marketDataSnapshot = new ManageableMarketDataSnapshot(); marketDataSnapshot.setName("Test"); final HashMap<YieldCurveKey, YieldCurveSnapshot> yieldCurves = new HashMap<>(); final ManageableUnstructuredMarketDataSnapshot globalValues = new ManageableUnstructuredMarketDataSnapshot(); marketDataSnapshot.setGlobalValues(globalValues); marketDataSnapshot.setYieldCurves(yieldCurves); final MarketDataSnapshotDocument addDoc = new MarketDataSnapshotDocument(marketDataSnapshot); final MarketDataSnapshotDocument added = _snpMaster.add(addDoc); final MarketDataSnapshotDocument loaded = _snpMaster.get(added.getUniqueId()); assertEquivalent(added, loaded); }
@Test public void test_alternative_snapshot() throws Exception { NamedSnapshot snapshot1 = new MockNamedSnapshot(null, "Test 1", 42); MarketDataSnapshotDocument doc1 = new MarketDataSnapshotDocument(snapshot1); doc1 = _snpMaster.add(doc1); NamedSnapshot snapshot2 = new MockNamedSnapshot(null, "Test 2", 84); MarketDataSnapshotDocument doc2 = new MarketDataSnapshotDocument(snapshot2); doc2 = _snpMaster.add(doc2); final MarketDataSnapshotDocument doc1Loaded = _snpMaster.get(doc1.getUniqueId()); assertEquivalent(doc1, doc1Loaded); final MarketDataSnapshotDocument doc2Loaded = _snpMaster.get(doc2.getUniqueId()); assertEquivalent(doc2, doc2Loaded); }