Package com.opengamma.engine.view.impl

Examples of com.opengamma.engine.view.impl.InMemoryViewComputationResultModel.addValue()


    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


    _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);
  }
 
  @Test
  public void truncateSmallValueToZero() {
View Full Code Here

    _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

    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);
View Full Code Here

    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);
View Full Code Here

    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

  @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());
View Full Code Here

    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

  @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());
View Full Code Here

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