Package com.opengamma.engine.view.cycle

Examples of com.opengamma.engine.view.cycle.ComputationCycleQuery


      final Collection<ValueSpecification> requiredSpecs = Lists.newArrayList(requiredSpecsIt);
      if (requiredSpecs.isEmpty()) {
        continue;
      }

      final ComputationCycleQuery cacheQuery = new ComputationCycleQuery();
      cacheQuery.setCalculationConfigurationName(entry.getKey());
      cacheQuery.setValueSpecifications(requiredSpecs);
      final ComputationCacheResponse computationCacheResponse = viewCycle.queryComputationCaches(cacheQuery);

      if (computationCacheResponse.getResults().size() != requiredSpecs.size()) {
        s_logger.debug("Failed to get all results from computation cache");
      }
View Full Code Here


   *
   * @param cycle  the view cycle, not null
   * @param cache  the cache of results, not null
   */
  /* package */void updateResults(ViewCycle cycle, ResultsCache cache) {
    ComputationCycleQuery query = new ComputationCycleQuery();
    query.setCalculationConfigurationName(_calcConfigName);
    query.setValueSpecifications(_gridStructure.getValueSpecifications());
    ComputationResultsResponse resultsResponse = cycle.queryResults(query);
    cache.put(_calcConfigName, resultsResponse.getResults(), cycle.getDuration());
    Pair<ViewportResults, State> resultsAndState = _gridStructure.createResults(_viewportDefinition, cache, _latestResults);
    _latestResults = resultsAndState.getFirst();
    _state = resultsAndState.getSecond();
View Full Code Here

    try {
      final HashMap<ValueSpecification, IntSet> rowIdMap = new HashMap<ValueSpecification, IntSet>();
      _rowStructure = generateRowStructure(depGraph, valueSpecification, rowIdMap);
      _rowIdMap = rowIdMap;

      _cacheQuery = new ComputationCycleQuery();
      _cacheQuery.setCalculationConfigurationName(calcConfigName);
      _cacheQuery.setValueSpecifications(new HashSet<ValueSpecification>(_rowIdMap.keySet()));
    } catch (final Exception e) {
      s_logger.error("Exception initialising dependency graph grid", e);
      _init.set(false);
View Full Code Here

    return msg;
  }

  @Override
  public ComputationCycleQuery buildObject(FudgeDeserializer deserializer, FudgeMsg message) {
    ComputationCycleQuery computationCacheQuery = new ComputationCycleQuery();
    computationCacheQuery.setCalculationConfigurationName(message.getString(CALCULATION_CONFIGURATION_FIELD_NAME));

    Collection<ValueSpecification> specs = Lists.newArrayList();

    FudgeMsg valueSpecificationMessage = message.getMessage(VALUE_SPECIFICATIONS_FIELD_NAME);
    for (FudgeField fudgeField : valueSpecificationMessage) {
      specs.add(deserializer.fieldValueToObject(ValueSpecification.class, fudgeField));
    }
    computationCacheQuery.setValueSpecifications(specs);

    return computationCacheQuery;
  }
View Full Code Here

@Test(groups = TestGroup.UNIT)
public class ComputationCacheQueryBuilderTest extends AbstractFudgeBuilderTestCase {

  @Test
  public void testEmptyQuery() {
    ComputationCycleQuery query = new ComputationCycleQuery();
    query.setCalculationConfigurationName("DEFAULT");
    query.setValueSpecifications(new ArrayList<ValueSpecification>());
    checkCycle(query);
  }
View Full Code Here

    checkCycle(query);
  }

  @Test
  public void testSingleQuery() {
    ComputationCycleQuery query = new ComputationCycleQuery();
    query.setCalculationConfigurationName("DEFAULT");
    ValueSpecification spec = ValueSpecification.of("SomeValue", ComputationTargetType.PRIMITIVE, UniqueId.of("SomeScheme", "SomeValue"), ValueProperties
        .with(ValuePropertyNames.FUNCTION, "SomeFunc").with(ValuePropertyNames.CURRENCY, "USD").get());
    query.setValueSpecifications(Lists.newArrayList(spec));
    checkCycle(query);
  }
View Full Code Here

    checkCycle(query);
  }

  @Test
  public void testMultipleQuery() {
    ComputationCycleQuery query = new ComputationCycleQuery();
    query.setCalculationConfigurationName("DEFAULT");
    ValueSpecification spec = ValueSpecification.of("SomeValue", ComputationTargetType.PRIMITIVE, UniqueId.of("SomeScheme", "SomeValue"),
        ValueProperties.with(ValuePropertyNames.FUNCTION, "SomeFunc").with(ValuePropertyNames.CURRENCY, "USD").get());
    ValueSpecification spec2 = ValueSpecification.of("SomeOtherValue", ComputationTargetType.PRIMITIVE, UniqueId.of("SomeScheme", "SomeOtherValue"),
        ValueProperties.with(ValuePropertyNames.FUNCTION, "SomeOtherFunc").with(ValuePropertyNames.CURRENCY, "USD").get());
    query.setValueSpecifications(Lists.newArrayList(spec, spec2));

    checkCycle(query);
  }
View Full Code Here

    checkCycle(query);
  }

  private void checkCycle(ComputationCycleQuery query) {
    ComputationCycleQuery cycled = cycleObject(ComputationCycleQuery.class, query);

    assertEquals(query.getCalculationConfigurationName(), cycled.getCalculationConfigurationName());
    assertEquals(query.getValueSpecifications(), cycled.getValueSpecifications());
  }
View Full Code Here

TOP

Related Classes of com.opengamma.engine.view.cycle.ComputationCycleQuery

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.