Package com.opengamma.core.marketdatasnapshot

Examples of com.opengamma.core.marketdatasnapshot.StructuredMarketDataSnapshot


  }

  //-------------------------------------------------------------------------
  @Test
  public void testGetSnapshotByUid() {
    final StructuredMarketDataSnapshot target = new ManageableMarketDataSnapshot();
   
    when(_underlying.get(eq(UID))).thenReturn(target);
   
    Response test = _resource.get(OID.toString(), UID.getVersion());
    assertEquals(Status.OK.getStatusCode(), test.getStatus());
View Full Code Here


  @Path("snapshots/{snapshotId}")
  public Response get(
      @PathParam("snapshotId") String idStr,
      @QueryParam("version") String version) {
    final ObjectId objectId = ObjectId.parse(idStr);
    final StructuredMarketDataSnapshot result = getMarketDataSnapshotSource().get(objectId.atVersion(version));
    return responseOkFudge(result);
  }
View Full Code Here

   
    if (viewDefinitions.size() > 1) {
      endWithError("Multiple view definitions resolved when searching for string '%s': %s", viewDefinitionName, viewDefinitions);
    }
    ConfigItem<?> value = Iterables.get(viewDefinitions, 0).getValue();
    StructuredMarketDataSnapshot snapshot = makeSnapshot(marketDataSnapshotter, viewProcessor, (ViewDefinition) value.getValue(), viewExecutionOptions);
   
    final ManageableMarketDataSnapshot manageableMarketDataSnapshot = new ManageableMarketDataSnapshot(snapshot);
    manageableMarketDataSnapshot.setName(snapshot.getBasisViewName() + "/" + valuationInstant);
    marketDataSnapshotMaster.add(new MarketDataSnapshotDocument(manageableMarketDataSnapshot));
  }
View Full Code Here

    EngineResourceReference<? extends ViewCycle> cycleReference = client.createCycleReference(viewCycleId);
    if (cycleReference == null) {
      throw new IllegalArgumentException("Cycle is not available");
    }
    try {
      StructuredMarketDataSnapshot result = _snapshotter.createSnapshot(client, cycleReference.get());
      return responseOkFudge(result);
    } finally {
      cycleReference.release();
    }
  }
View Full Code Here

    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);

    assertEquals(example(), testResult);
  }
View Full Code Here

    if (snapshot != null) {
      return snapshot;
    }
    synchronized (_initSnapshotLock) {
      if (_snapshot == null) {
        StructuredMarketDataSnapshot structuredSnapshot = getSnapshotSource().get(getSnapshotId());
        snapshot = new UserMarketDataSnapshot(structuredSnapshot);
        snapshot.init();
        _snapshot = snapshot;
      }
      return _snapshot;
View Full Code Here

    values.putValue(testValueId, MarketDataRequirementNames.MARKET_VALUE, new ValueSnapshot(marketValue));
    return values;
  }

  private UserMarketDataSnapshot createSnapshot() {
    final StructuredMarketDataSnapshot snapshot = mock(StructuredMarketDataSnapshot.class);
    final UniqueId snapshotId = UniqueId.of("TestSnapshot", "1");
    final ExternalId testValueId = ExternalId.of("TestScheme", "Value1");
    when(snapshot.getUniqueId()).thenReturn(snapshotId);
    when(snapshot.getGlobalValues()).thenReturn(generateUnstructured(testValueId, 234d));
    final UserMarketDataSnapshot userSnapshot = new UserMarketDataSnapshot(snapshot);
    userSnapshot.init();
    final YieldCurveSnapshot yieldCurveSnapshot = mock(YieldCurveSnapshot.class);
    when(yieldCurveSnapshot.getValues()).thenReturn(generateUnstructured(testValueId, 123d));
    final Map<YieldCurveKey, YieldCurveSnapshot> yieldCurveMap = ImmutableMap.of(new YieldCurveKey(Currency.USD, "testCurve"), yieldCurveSnapshot);
    when(snapshot.getYieldCurves()).thenReturn(yieldCurveMap);
    return userSnapshot;
  }
View Full Code Here

TOP

Related Classes of com.opengamma.core.marketdatasnapshot.StructuredMarketDataSnapshot

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.