Package com.opengamma.master.marketdatasnapshot

Examples of com.opengamma.master.marketdatasnapshot.MarketDataSnapshotDocument


    doc.setUniqueId(OTHER_UID);
    _testEmpty.update(doc);
  }

  public void test_update_populatedMaster() {
    MarketDataSnapshotDocument doc = new MarketDataSnapshotDocument();
    doc.setSnapshot(SNAP1);
    doc.setUniqueId(_doc1.getUniqueId());
    MarketDataSnapshotDocument updated = _testPopulated.update(doc);
    assertEquals(_doc1.getUniqueId(), updated.getUniqueId());
    assertNotNull(_doc1.getVersionFromInstant());
    assertNotNull(updated.getVersionFromInstant());
  }
View Full Code Here


  //-------------------------------------------------------------------------
  public void test_getSnapshot_noOverride_found() throws Exception {
    MarketDataSnapshotMaster mock = mock(MarketDataSnapshotMaster.class);

    MarketDataSnapshotDocument doc = new MarketDataSnapshotDocument(example());
    when(mock.get(UID)).thenReturn(doc);
    MasterSnapshotSource test = new MasterSnapshotSource(mock);
    StructuredMarketDataSnapshot testResult = test.get(UID);
    verify(mock, times(1)).get(UID);
View Full Code Here

  //-------------------------------------------------------------------------
  @Test(expectedExceptions = DataNotFoundException.class, expectedExceptionsMessageRegExp = "Some message")
  public void test_getSnapshot_noOverride_notFound() throws Exception {
    MarketDataSnapshotMaster mock = mock(MarketDataSnapshotMaster.class);
   
    new MarketDataSnapshotDocument(example());
    when(mock.get(UID)).thenThrow(new DataNotFoundException("Some message"));
    MasterSnapshotSource test = new MasterSnapshotSource(mock);
    test.get(UID);
  }
View Full Code Here

  @Test
  public void testGetMarketDataSnapshot() {
    final ManageableMarketDataSnapshot target = new ManageableMarketDataSnapshot();
    target.setBasisViewName("Basis");
   
    final MarketDataSnapshotDocument result = new MarketDataSnapshotDocument(target);
    when(_underlying.get(OID, VersionCorrection.LATEST)).thenReturn(result);
   
    Response test = _resource.get(null, null);
    assertEquals(Status.OK.getStatusCode(), test.getStatus());
    assertSame(result, test.getEntity());
View Full Code Here

  @Test
  public void testUpdateMarketDataSnapshot() {
    final ManageableMarketDataSnapshot target = new ManageableMarketDataSnapshot();
    target.setBasisViewName("Basis");
    final MarketDataSnapshotDocument request = new MarketDataSnapshotDocument(target);
    request.setUniqueId(OID.atLatestVersion());
   
    final MarketDataSnapshotDocument result = new MarketDataSnapshotDocument(target);
    result.setUniqueId(OID.atVersion("1"));
    when(_underlying.update(same(request))).thenReturn(result);
   
    Response test = _resource.update(_uriInfo, request);
    assertEquals(Status.CREATED.getStatusCode(), test.getStatus());
    assertSame(result, test.getEntity());
View Full Code Here

    assertEquals(s_mockUniqueId, marketDataSpecification.getUserSnapshotId());
  }
 
  private static MarketDataSnapshotSearchResult makeSearchResult() {
    MarketDataSnapshotSearchResult result = new MarketDataSnapshotSearchResult();
    result.setDocuments(Lists.newArrayList(new MarketDataSnapshotDocument(s_mockUniqueId, new ManageableMarketDataSnapshot())));
    return result;
  }
View Full Code Here

TOP

Related Classes of com.opengamma.master.marketdatasnapshot.MarketDataSnapshotDocument

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.