Package com.opengamma.engine.view.compilation

Examples of com.opengamma.engine.view.compilation.CompiledViewCalculationConfiguration


*/
@Test(groups = TestGroup.UNIT)
public class CompiledViewCalculationConfigurationFudgeBuilderTest extends AbstractFudgeBuilderTestCase {

  public void testEmpty() {
    final CompiledViewCalculationConfiguration in = new CompiledViewCalculationConfigurationImpl("1", Collections.<ComputationTargetSpecification>emptySet(),
        Collections.<ValueSpecification, Set<ValueRequirement>>emptyMap(), Collections.<ValueSpecification, Collection<ValueSpecification>>emptyMap());
    final CompiledViewCalculationConfiguration out = cycleObject(CompiledViewCalculationConfiguration.class, in);
    assertEquals(out.getName(), in.getName());
    assertEquals(out.getComputationTargets(), in.getComputationTargets());
    assertEquals(out.getMarketDataRequirements(), in.getMarketDataRequirements());
    assertEquals(out.getTerminalOutputSpecifications(), in.getTerminalOutputSpecifications());
  }
View Full Code Here


    final ValueSpecification dataSpecification2a = new ValueSpecification("Data2a", targetSpec, ValueProperties.with(ValuePropertyNames.FUNCTION, "Bar").get());
    final ValueSpecification dataSpecification2b = new ValueSpecification("Data2b", targetSpec, ValueProperties.with(ValuePropertyNames.FUNCTION, "Bar").get());
    final ValueSpecification dataSpecification3a = new ValueSpecification("Data3a", targetSpec, ValueProperties.with(ValuePropertyNames.FUNCTION, "Bar").get());
    final ValueSpecification dataSpecification3b = new ValueSpecification("Data3b", targetSpec, ValueProperties.with(ValuePropertyNames.FUNCTION, "Bar").get());
    final ValueSpecification dataSpecification3c = new ValueSpecification("Data3c", targetSpec, ValueProperties.with(ValuePropertyNames.FUNCTION, "Bar").get());
    final CompiledViewCalculationConfiguration in = new CompiledViewCalculationConfigurationImpl("2", ImmutableSet.of(ComputationTargetSpecification.NULL, targetSpec),
        ImmutableMap.<ValueSpecification, Set<ValueRequirement>>of(valueSpecification, ImmutableSet.of(valueRequirement)), ImmutableMap.<ValueSpecification, Collection<ValueSpecification>>of(
            dataSpecification1, Collections.singleton(dataSpecification1),
            dataSpecification2a, Collections.singleton(dataSpecification2b),
            dataSpecification3a, ImmutableSet.of(dataSpecification3a, dataSpecification3b, dataSpecification3c)));
    final CompiledViewCalculationConfiguration out = cycleObject(CompiledViewCalculationConfiguration.class, in);
    assertEquals(out.getName(), in.getName());
    assertEquals(out.getComputationTargets(), in.getComputationTargets());
    assertEquals(out.getTerminalOutputSpecifications(), in.getTerminalOutputSpecifications());
    assertEquals(out.getMarketDataRequirements(), in.getMarketDataRequirements());
  }
View Full Code Here

    }

    @Override
    public void viewDefinitionCompiled(CompiledViewDefinition compiledViewDefinition, boolean hasMarketDataPermissions) {
      s_logger.error("View definition compiled");
      CompiledViewCalculationConfiguration compiledCalculationConfiguration = compiledViewDefinition.getCompiledCalculationConfiguration(DEFAULT_CALC_CONFIG);
      Map<ValueSpecification, Set<ValueRequirement>> terminalOutputs = compiledCalculationConfiguration.getTerminalOutputSpecifications();
      for (ValueSpecification valueSpec : terminalOutputs.keySet()) {
        ComputationTargetType computationTargetType = valueSpec.getTargetSpecification().getType();
        if (isValidTargetType(computationTargetType)) {
          UniqueId uniqueId = valueSpec.getTargetSpecification().getUniqueId();
          String currency = getCurrency(uniqueId, computationTargetType);
View Full Code Here

      }
    }
    if (calcConfigName == null) {
      return null;
    }
    CompiledViewCalculationConfiguration compiledCalcConfig = compiledViewDefinition.getCompiledCalculationConfiguration(calcConfigName);
    for (ValueSpecification candidateSpec : specificationCandidates) {
      if (compiledCalcConfig.getTerminalOutputSpecifications().keySet().contains(candidateSpec)) {
        return Pair.of(calcConfigName, candidateSpec);
      }
    }
    return null;
  }
View Full Code Here

    return true;
  }

  private void provideFunctionParameters(String calcConfigurationName) {

    CompiledViewCalculationConfiguration calculationConfiguration =
        _compiledViewDefinition.getCompiledCalculationConfiguration(calcConfigurationName);

    Map<DistinctMarketDataSelector, Set<ValueSpecification>> marketDataSelections =
        calculationConfiguration.getMarketDataSelections();

    if (!marketDataSelections.isEmpty()) {

      s_logger.info("Building function parameters for market data manipulation in graph [{}]", calcConfigurationName);
      DependencyGraph graph = _compiledViewDefinition.getDependencyGraphExplorer(calcConfigurationName).getWholeGraph();

      // Get function params configured through the view definition
      Map<DistinctMarketDataSelector, FunctionParameters> functionParameters =
          Maps.newHashMap(calculationConfiguration.getMarketDataSelectionFunctionParameters());
      s_logger.info("Added in function parameters from view definition - now have {} entries", functionParameters.size());

      // Add the function params passed through the execution options which will
      // potentially override the same functions from the view definition
      // A future enhancement could look at merging/composing the functions if desired
View Full Code Here

  public ValueMappings(CompiledViewDefinition compiledViewDef) {
    _configurations = Maps.newHashMap();
    for (ViewCalculationConfiguration calcConfig : compiledViewDef.getViewDefinition().getAllCalculationConfigurations()) {
      String configName = calcConfig.getName();
      CompiledViewCalculationConfiguration compiledConfig = compiledViewDef.getCompiledCalculationConfiguration(configName);
      // store the mappings from outputs to requirements for each calc config
      _configurations.put(configName, new ConfigurationData(compiledConfig));
    }
  }
View Full Code Here

TOP

Related Classes of com.opengamma.engine.view.compilation.CompiledViewCalculationConfiguration

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.