Package com.opengamma.master.marketdatasnapshot

Examples of com.opengamma.master.marketdatasnapshot.MarketDataSnapshotDocument


  }

  @POST
  @Path("snapshots")
  public Response add(@Context UriInfo uriInfo, MarketDataSnapshotDocument request) {
    MarketDataSnapshotDocument result = getMarketDataSnapshotMaster().add(request);
    URI createdUri = (new DataMarketDataSnapshotResource()).uriVersion(uriInfo.getBaseUri(), result.getUniqueId());
    return responseCreatedFudge(createdUri, result);
  }
View Full Code Here


  //-------------------------------------------------------------------------
  @Override
  public MarketDataSnapshotDocument get(final UniqueId uniqueId) {
    ArgumentChecker.notNull(uniqueId, "uniqueId");
    validateUniqueId(uniqueId);
    final MarketDataSnapshotDocument document = _store.get(uniqueId.getObjectId());
    if (document == null || !document.getUniqueId().equals(uniqueId)) {
      throw new DataNotFoundException("Snapshot not found: " + uniqueId);
    }
    return document;
  }
View Full Code Here

  @Override
  public MarketDataSnapshotDocument get(final ObjectIdentifiable objectId, final VersionCorrection versionCorrection) {
    ArgumentChecker.notNull(objectId, "objectId");
    ArgumentChecker.notNull(versionCorrection, "versionCorrection");
    validateObjectId(objectId.getObjectId());
    final MarketDataSnapshotDocument document = _store.get(objectId.getObjectId());
    if (document == null) {
      throw new DataNotFoundException("Snapshot not found: " + objectId);
    }
    return document;
  }
View Full Code Here

  //-------------------------------------------------------------------------
  @Test
  public void testAddMarketDataSnapshot() {
    final ManageableMarketDataSnapshot target = new ManageableMarketDataSnapshot();
    target.setBasisViewName("Basis");
    final MarketDataSnapshotDocument request = new MarketDataSnapshotDocument(target);
   
    final MarketDataSnapshotDocument result = new MarketDataSnapshotDocument(target);
    result.setUniqueId(UID);
    when(_underlying.add(same(request))).thenReturn(result);
   
    Response test = _resource.add(_uriInfo, request);
    assertEquals(Status.CREATED.getStatusCode(), test.getStatus());
    assertSame(result, test.getEntity());
View Full Code Here

  @BeforeMethod
  public void setUp() {
    _testEmpty = new InMemorySnapshotMaster(new ObjectIdSupplier("Test"));
    _testPopulated = new InMemorySnapshotMaster(new ObjectIdSupplier("Test"));
    _doc1 = new MarketDataSnapshotDocument();
    _doc1.setSnapshot(SNAP1);
    _doc1 = _testPopulated.add(_doc1);
    _doc2 = new MarketDataSnapshotDocument();
    _doc2.setSnapshot(SNAP2);
    _doc2 = _testPopulated.add(_doc2);
  }
View Full Code Here

    new InMemorySnapshotMaster((Supplier<ObjectId>) null);
  }

  public void test_defaultSupplier() {
    InMemorySnapshotMaster master = new InMemorySnapshotMaster();
    MarketDataSnapshotDocument doc = new MarketDataSnapshotDocument();
    doc.setSnapshot(SNAP1);
    MarketDataSnapshotDocument added = master.add(doc);
    assertEquals("MemSnap", added.getUniqueId().getScheme());
  }
View Full Code Here

    assertEquals("MemSnap", added.getUniqueId().getScheme());
  }

  public void test_alternateSupplier() {
    InMemorySnapshotMaster master = new InMemorySnapshotMaster(new ObjectIdSupplier("Hello"));
    MarketDataSnapshotDocument doc = new MarketDataSnapshotDocument();
    doc.setSnapshot(SNAP1);
    MarketDataSnapshotDocument added = master.add(doc);
    assertEquals("Hello", added.getUniqueId().getScheme());
  }
View Full Code Here

  public void test_search_populatedMaster_filterById() {
    MarketDataSnapshotSearchRequest request = new MarketDataSnapshotSearchRequest();
    request.setSnapshotIds(ImmutableSet.of(_doc1.getUniqueId().getObjectId()));
    MarketDataSnapshotSearchResult result = _testPopulated.search(request);
    assertEquals(1, result.getPaging().getTotalItems());
    MarketDataSnapshotDocument doc = result.getFirstDocument();
    assertEquals(_doc1.getUniqueId(), doc.getUniqueId());
  }
View Full Code Here

    assertSame(_doc2, _testPopulated.get(_doc2.getUniqueId()));
  }

  //-------------------------------------------------------------------------
  public void test_add_emptyMaster() {
    MarketDataSnapshotDocument doc = new MarketDataSnapshotDocument();
    doc.setSnapshot(SNAP1);
    MarketDataSnapshotDocument added = _testEmpty.add(doc);
    assertNotNull(added.getVersionFromInstant());
    assertNotNull(added.getCorrectionFromInstant());
    assertEquals(added.getVersionFromInstant(), added.getCorrectionFromInstant());
    assertEquals("Test", added.getUniqueId().getScheme());
    assertSame(SNAP1, added.getSnapshot());
  }
View Full Code Here

  }

  //-------------------------------------------------------------------------
  @Test(expectedExceptions = DataNotFoundException.class)
  public void test_update_emptyMaster() {
    MarketDataSnapshotDocument doc = new MarketDataSnapshotDocument();
    doc.setSnapshot(SNAP1);
    doc.setUniqueId(OTHER_UID);
    _testEmpty.update(doc);
  }
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.