Examples of InMemoryViewComputationResultModel


Examples of com.opengamma.engine.view.impl.InMemoryViewComputationResultModel

    assertNull(_batchWriter.getRiskRun(run.getObjectId()));
  }

  @Test(expectedExceptions = IllegalArgumentException.class)
  public void addJobResultsToUnstartedBatch() {
    final ViewComputationResultModel result = new InMemoryViewComputationResultModel();
    _batchMaster.addJobResults(null, result);
  }
View Full Code Here

Examples of com.opengamma.engine.view.impl.InMemoryViewComputationResultModel

    _batchMaster.createMarketData(marketDataUid);

    final RiskRun run = _batchMaster.startRiskRun(_cycleMetadataStub, Maps.<String, String>newHashMap(), RunCreationMode.AUTO, SnapshotMode.PREPARED);

    final InMemoryViewComputationResultModel result = new InMemoryViewComputationResultModel();
    final ComputationTargetSpecification computationTargetSpec = new ComputationTargetSpecification(ComputationTargetType.SECURITY, UniqueId.of("Sec", "APPL"));
    final ValueProperties properties = ValueProperties.with(ValuePropertyNames.FUNCTION, "asd").get();
    final ValueSpecification valueSpec = new ValueSpecification("value", computationTargetSpec, properties);
    final ComputedValueResult cvr = new ComputedValueResult(valueSpec, 1000.0, AggregatedExecutionLog.EMPTY, null, null, InvocationResult.SUCCESS);
    //cvr.setRequirements(newHashSet(_requirement));
    result.addValue("config_1", cvr);
   
    // Result will be skipped but should not cause any exception to be thrown
    _batchMaster.addJobResults(run.getObjectId(), result);
  }
View Full Code Here

Examples of com.opengamma.engine.view.impl.InMemoryViewComputationResultModel

  @Test
  public void addJobResults() {
    final UniqueId marketDataUid = _cycleMetadataStub.getMarketDataSnapshotId();
    _batchMaster.createMarketData(marketDataUid);
    final RiskRun run = _batchMaster.startRiskRun(_cycleMetadataStub, Maps.<String, String>newHashMap(), RunCreationMode.AUTO, SnapshotMode.PREPARED);
    final InMemoryViewComputationResultModel result = new InMemoryViewComputationResultModel();
    final ComputedValueResult cvr = new ComputedValueResult(_specification, 1000.0, AggregatedExecutionLog.EMPTY, "someComputeNode", null, InvocationResult.SUCCESS);
    //cvr.setRequirements(newHashSet(_requirement));
    result.addValue("config_1", cvr);
    _batchMaster.addJobResults(run.getObjectId(), result);
  }
View Full Code Here

Examples of com.opengamma.engine.view.impl.InMemoryViewComputationResultModel

  @Test
  public void truncateSmallValueToZero() {
    final UniqueId marketDataUid = _cycleMetadataStub.getMarketDataSnapshotId();
    _batchMaster.createMarketData(marketDataUid);
    final RiskRun run = _batchMaster.startRiskRun(_cycleMetadataStub, Maps.<String, String>newHashMap(), RunCreationMode.AUTO, SnapshotMode.PREPARED);
    final InMemoryViewComputationResultModel result = new InMemoryViewComputationResultModel();
    final ComputedValueResult cvr = new ComputedValueResult(_specification, 1e-323, AggregatedExecutionLog.EMPTY, "someComputeNode", null, InvocationResult.SUCCESS);
    //cvr.setRequirements(newHashSet(_requirement));
    result.addValue("config_1", cvr);
    _batchMaster.addJobResults(run.getObjectId(), result);
   
    List<ViewResultEntry> resultEntries = _batchMaster.getBatchValues(run.getObjectId(), PagingRequest.ALL).getFirst();
    ViewResultEntry resultEntry = Iterables.getOnlyElement(resultEntries);
    assertEquals(0d, resultEntry.getComputedValue().getValue());
View Full Code Here

Examples of com.opengamma.engine.view.impl.InMemoryViewComputationResultModel

  @Test
  public void putResultsNoHistory() {
    final String spec1value1 = "spec1value1";
    final String spec2value1 = "spec2value1";

    final InMemoryViewComputationResultModel results1 = new InMemoryViewComputationResultModel();
    results1.setViewCycleExecutionOptions(ViewCycleExecutionOptions.builder().setValuationTime(Instant.now()).create());
    results1.addValue(CALC_CONFIG, new ComputedValueResult(_spec1, spec1value1, AggregatedExecutionLog.EMPTY));
    results1.addValue(CALC_CONFIG, new ComputedValueResult(_spec2, spec2value1, AggregatedExecutionLog.EMPTY));

    final ResultsCache cache = new ResultsCache();
    cache.put(results1);

    final ResultsCache.Result result1_1 = cache.getResult(CALC_CONFIG, _spec1, String.class);
    final ResultsCache.Result result2_1 = cache.getResult(CALC_CONFIG, _spec2, String.class);
    assertEquals(spec1value1, result1_1.getValue());
    assertEquals(spec2value1, result2_1.getValue());
    assertNull(result1_1.getHistory());
    assertNull(result2_1.getHistory());
    assertTrue(result1_1.isUpdated());
    assertTrue(result2_1.isUpdated());

    final String spec1value2 = "spec1value2";
    final InMemoryViewComputationResultModel results2 = new InMemoryViewComputationResultModel();
    results2.setViewCycleExecutionOptions(ViewCycleExecutionOptions.builder().setValuationTime(Instant.now()).create());
    results2.addValue(CALC_CONFIG, new ComputedValueResult(_spec1, spec1value2, AggregatedExecutionLog.EMPTY));
    cache.put(results2);

    final ResultsCache.Result result1_2 = cache.getResult(CALC_CONFIG, _spec1, String.class);
    final ResultsCache.Result result2_2 = cache.getResult(CALC_CONFIG, _spec2, String.class);
    assertEquals(spec1value2, result1_2.getValue());
View Full Code Here

Examples of com.opengamma.engine.view.impl.InMemoryViewComputationResultModel

    assertFalse(result2_2.isUpdated());
  }

  @Test
  public void putResultsWithHistory() {
    final InMemoryViewComputationResultModel results1 = new InMemoryViewComputationResultModel();
    results1.setViewCycleExecutionOptions(ViewCycleExecutionOptions.builder().setValuationTime(Instant.now()).create());
    results1.addValue(CALC_CONFIG, new ComputedValueResult(_spec1, 1d, AggregatedExecutionLog.EMPTY));
    final ResultsCache cache = new ResultsCache();
    cache.put(results1);

    final ResultsCache.Result result1 = cache.getResult(CALC_CONFIG, _spec1, Double.class);
    assertEquals(1d, result1.getValue());
    assertEquals(1, result1.getHistory().size());
    assertEquals(1d, result1.getHistory().iterator().next());

    final InMemoryViewComputationResultModel results2 = new InMemoryViewComputationResultModel();
    results2.setViewCycleExecutionOptions(ViewCycleExecutionOptions.builder().setValuationTime(Instant.now()).create());
    results2.addValue(CALC_CONFIG, new ComputedValueResult(_spec1, 2d, AggregatedExecutionLog.EMPTY));
    cache.put(results2);

    final ResultsCache.Result result2 = cache.getResult(CALC_CONFIG, _spec1, Double.class);
    assertEquals(2d, result2.getValue());
    assertEquals(2, result2.getHistory().size());
View Full Code Here

Examples of com.opengamma.engine.view.impl.InMemoryViewComputationResultModel

    assertEquals(2d, history.get(1));
  }

  @Test
  public void errorValues() {
    final InMemoryViewComputationResultModel resultsModel1 = new InMemoryViewComputationResultModel();
    resultsModel1.setViewCycleExecutionOptions(ViewCycleExecutionOptions.builder().setValuationTime(Instant.now()).create());
    resultsModel1.addValue(CALC_CONFIG, new ComputedValueResult(_spec1, MissingOutput.EVALUATION_ERROR, AggregatedExecutionLog.EMPTY));
    final ResultsCache cache = new ResultsCache();
    cache.put(resultsModel1);

    final ResultsCache.Result result1 = cache.getResult(CALC_CONFIG, _spec1, Double.class);
    assertEquals(MissingOutput.EVALUATION_ERROR, result1.getValue());
    assertNull(result1.getHistory());

    final InMemoryViewComputationResultModel resultsModel2 = new InMemoryViewComputationResultModel();
    resultsModel2.setViewCycleExecutionOptions(ViewCycleExecutionOptions.builder().setValuationTime(Instant.now()).create());
    resultsModel2.addValue(CALC_CONFIG, new ComputedValueResult(_spec1, 1d, AggregatedExecutionLog.EMPTY));
    cache.put(resultsModel2);

    final InMemoryViewComputationResultModel resultsModel3 = new InMemoryViewComputationResultModel();
    resultsModel3.setViewCycleExecutionOptions(ViewCycleExecutionOptions.builder().setValuationTime(Instant.now()).create());
    resultsModel3.addValue(CALC_CONFIG, new ComputedValueResult(_spec1, MissingOutput.EVALUATION_ERROR, AggregatedExecutionLog.EMPTY));
    cache.put(resultsModel3);

    final ResultsCache.Result result2 = cache.getResult(CALC_CONFIG, _spec1, Double.class);
    assertEquals(MissingOutput.EVALUATION_ERROR, result2.getValue());
    final List<Object> history = Lists.newArrayList(result2.getHistory());
View Full Code Here

Examples of com.opengamma.engine.view.impl.InMemoryViewComputationResultModel

*/
@Test(groups = TestGroup.UNIT)
public class ViewComputationResultModelImplTest {
 
  public void test() {
    InMemoryViewComputationResultModel model = new InMemoryViewComputationResultModel();
    checkModel(model);
  }
View Full Code Here

Examples of com.opengamma.engine.view.impl.InMemoryViewComputationResultModel

   * @param newResult  the new result to merge
   */
  public void merge(ViewComputationResultModel newResult) {
    if (_currentMergedResult == null) {
      // Start of a new result
      _currentMergedResult = new InMemoryViewComputationResultModel();
    }
    for (ComputedValue marketData : newResult.getAllMarketData()) {
      _currentMergedResult.addMarketData(marketData);
    }
    ViewResultModelMergeUtils.merge(newResult, _currentMergedResult);
View Full Code Here

Examples of com.opengamma.engine.view.impl.InMemoryViewComputationResultModel

        if (_issueFragmentResults) {
          if (_executing.isEmpty()) {
            s_logger.info("Discarding fragment completion message - overall execution is complete");
          } else {
            s_logger.debug("Building result fragment");
            final InMemoryViewComputationResultModel fragmentResultModel = getCycle().constructTemplateResultModel();
            final InMemoryViewComputationResultModel fullResultModel = getCycle().getResultModel();
            for (ExecutingCalculationConfiguration calcConfig : _executing.values()) {
              calcConfig.buildResults(fragmentResultModel, fullResultModel);
            }
            s_logger.info("Fragment execution complete");
            getCycle().notifyFragmentCompleted(fragmentResultModel);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.