Package com.opengamma.engine.depgraph

Examples of com.opengamma.engine.depgraph.DependencyNode


    for (final Entry<String, DependencyGraph> graphEntry : graphs.entrySet()) {
      final DependencyGraph graph = graphEntry.getValue();
      Set<ValueSpecification> resolvedValues = Sets.newHashSet();
      for (ComputedValue computedValue : results.getAllMarketData()) {
        resolvedValues.add(computedValue.getSpecification());
        final DependencyNode nodeProducing = graph.getNodeProducing(computedValue.getSpecification());
        if ((nodeProducing != null) && isTerminalUnstructuredOutput(nodeProducing, graph)) {
          ExternalIdBundle identifiers = resolveExternalIdBundle(resolver, computedValue.getSpecification());
          if (identifiers != null) {
            snapshot.putValue(identifiers, computedValue.getSpecification().getValueName(), new ValueSnapshot(computedValue.getValue()));
          }
View Full Code Here


    return new ComputationTarget(ComputationTargetType.PRIMITIVE, UniqueId.of("testdomain", name));
  }

  private DependencyNode createNode(final String name, final Set<DependencyNode> inputNodes) {
    final ComputationTarget target = getTarget(name);
    final DependencyNode node = new DependencyNode(target);
    final ValueSpecification output;
    if (inputNodes.isEmpty()) {
      final MarketDataSourcingFunction msdf = MarketDataSourcingFunction.INSTANCE;
      output = new ValueSpecification(name, target.toSpecification(), ValueProperties.with(ValuePropertyNames.FUNCTION, msdf.getUniqueId()).get());
      node.setFunction(new ParameterizedFunction(msdf, msdf.getDefaultParameters()));
    } else {
      final MockFunction mock = new MockFunction(target);
      output = new ValueSpecification(name, target.toSpecification(), ValueProperties.with(ValuePropertyNames.FUNCTION, mock.getUniqueId()).get());
      node.setFunction(mock);
      mock.addResult(new ComputedValue(output, null));
    }
    node.addOutputValue(output);
    node.addInputNodes(inputNodes);
    return node;
  }
View Full Code Here

  public void createGraph() {
    _testGraph = new DependencyGraph("Default");
    _testNode = new DependencyNode[5];
    for (int i = 0; i < _testNode.length; i++) {
      final ComputationTarget target = new ComputationTarget(ComputationTargetType.PRIMITIVE, UniqueId.of("Test", Integer.toString(i)));
      _testNode[i] = new DependencyNode(target);
      _testNode[i].setFunction(MockFunction.getMockFunction(target, "foo"));
    }
    _testNode[0].addOutputValue(_testValue0x);
    _testNode[1].addOutputValue(_testValue1x);
    _testNode[2].addOutputValue(_testValue20);
View Full Code Here

    assertEquals(_testGraph.getTerminalOutputSpecifications(), cycledGraph.getTerminalOutputSpecifications());
   
    for (DependencyNode node : _testGraph.getDependencyNodes()) {
      boolean isRoot = _testGraph.getRootNodes().contains(node);
      for (ValueSpecification spec : node.getOutputValues()) {
        DependencyNode equivalentNode = cycledGraph.getNodeProducing(spec);
        assertEquals(isRoot, cycledGraph.getRootNodes().contains(equivalentNode));
        assertEquals(node.getInputValues(), equivalentNode.getInputValues());
        assertEquals(node.getOutputValues(), equivalentNode.getOutputValues());
        assertEquals(node.getTerminalOutputValues(), equivalentNode.getTerminalOutputValues());
        assertEquals(node.getFunction().getFunction().getFunctionDefinition().getShortName(), equivalentNode.getFunction().getFunction().getFunctionDefinition().getShortName());
        assertEquals(node.getFunction().getFunction().getFunctionDefinition().getUniqueId(), equivalentNode.getFunction().getFunction().getFunctionDefinition().getUniqueId());
      }
    }
  }
View Full Code Here

    //assertEquals(graph.getAllRequiredMarketData(), cycledGraph.getAllRequiredMarketData()); [PLAT-3126]

    for (final DependencyNode node : graph.getDependencyNodes()) {
      final boolean isRoot = graph.getRootNodes().contains(node);
      for (final ValueSpecification spec : node.getOutputValues()) {
        final DependencyNode equivalentNode = cycledGraph.getNodeProducing(spec);
        assertEquals(isRoot, cycledGraph.getRootNodes().contains(equivalentNode));
        assertEquals(node.getInputValues(), equivalentNode.getInputValues());
        assertEquals(node.getOutputValues(), equivalentNode.getOutputValues());
        assertEquals(node.getTerminalOutputValues(), equivalentNode.getTerminalOutputValues());
      }
    }
  }
View Full Code Here

                                                          new DefaultViewPortfolioPermissionProvider(),
                                                          marketDataProviderResolver, compilationService, functionResolver,
        computationCacheSource, jobDispatcher, new SingleThreadViewProcessWorkerFactory(), new DependencyGraphBuilderFactory(), factory, graphExecutorStatisticsProvider,
        new DummyOverrideOperationCompiler(), new EngineResourceManagerImpl<SingleComputationCycle>(), new VersionedUniqueIdSupplier("Test", "1"), new InMemoryViewExecutionCache());
    final DependencyGraph graph = new DependencyGraph("Default");
    DependencyNode previous = null;
    for (int i = 0; i < JOB_SIZE; i++) {
      final DependencyNode node = new DependencyNode(ComputationTarget.NULL);
      node.setFunction(mockFunction);
      if (previous != null) {
        node.addInputNode(previous);
      }
      graph.addDependencyNode(node);
      previous = node;
    }
    final CompiledViewDefinitionWithGraphsImpl viewEvaluationModel = new CompiledViewDefinitionWithGraphsImpl(VersionCorrection.LATEST, "", viewDefinition, Collections.singleton(graph),
View Full Code Here

public class InvalidTargetDependencyNodeFilterTest {

  public void testAccept() {
    final Set<UniqueId> invalid = ImmutableSet.of(UniqueId.of("Sec", "1"), UniqueId.of("Pos", "2"), UniqueId.of("Pos", "3", "X"));
    final InvalidTargetDependencyNodeFilter filter = new InvalidTargetDependencyNodeFilter(invalid);
    assertTrue(filter.accept(new DependencyNode(new ComputationTargetSpecification(ComputationTargetType.POSITION, UniqueId.of("Pos", "1")))));
    assertFalse(filter.accept(new DependencyNode(new ComputationTargetSpecification(ComputationTargetType.POSITION, UniqueId.of("Pos", "2")))));
    assertTrue(filter.accept(new DependencyNode(new ComputationTargetSpecification(ComputationTargetType.POSITION, UniqueId.of("Pos", "2", "V")))));
    assertTrue(filter.accept(new DependencyNode(new ComputationTargetSpecification(ComputationTargetType.POSITION, UniqueId.of("Pos", "3")))));
    assertFalse(filter.accept(new DependencyNode(new ComputationTargetSpecification(ComputationTargetType.POSITION, UniqueId.of("Pos", "3", "X")))));
    assertTrue(filter.accept(new DependencyNode(new ComputationTargetSpecification(ComputationTargetType.POSITION, UniqueId.of("Pos", "3", "Y")))));
    assertTrue(filter.accept(new DependencyNode(ComputationTargetSpecification.NULL)));
  }
View Full Code Here

  private ComputationTargetSpecification target(final int id) {
    return new ComputationTargetSpecification(ComputationTargetType.PRIMITIVE, id(id));
  }

  private DependencyNode node(final int id) {
    final DependencyNode node = new DependencyNode(target(id));
    node.setFunction(Mockito.mock(ParameterizedFunction.class));
    return node;
  }
View Full Code Here

    builder.addTarget(Collections.singleton(helper.getRequirement1()));
    DependencyGraph graph = builder.getDependencyGraph();
    graph.removeUnnecessaryValues();
   
    assertEquals(1, graph.getDependencyNodes().size());
    DependencyNode functionNode = graph.getDependencyNodes().iterator().next();
   
    // Nothing should be included in the output
    assertFalse(ResultOutputMode.NONE.shouldOutputFromNode(functionNode));
    assertFalse(ResultOutputMode.NONE.shouldOutputResult(helper.getSpec1(), graph));
    assertFalse(ResultOutputMode.NONE.shouldOutputResult(helper.getSpec2(), graph));
View Full Code Here

    node.setFunction(Mockito.mock(ParameterizedFunction.class));
    return node;
  }

  private DependencyNode tnode(final int id) {
    final DependencyNode node = node(id);
    node.addTerminalOutputValue(new ValueSpecification("V", node.getComputationTarget(), ValueProperties.with(ValuePropertyNames.FUNCTION, "Test").get()));
    return node;
  }
View Full Code Here

TOP

Related Classes of com.opengamma.engine.depgraph.DependencyNode

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.