Package com.opengamma.engine.depgraph

Examples of com.opengamma.engine.depgraph.DepGraphTestHelper


*/
@Test(groups = TestGroup.UNIT)
public class ResultOutputModeTest {

  public void testOutputModes() {
    DepGraphTestHelper helper = new DepGraphTestHelper();
    helper.addFunctionProducing1and2();
    DependencyGraphBuilder builder = helper.createBuilder(null);
    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));
   
    // The node contains one terminal output, so the function should be executed, and only this result should be included in the output
    assertTrue(ResultOutputMode.TERMINAL_OUTPUTS.shouldOutputFromNode(functionNode));
    assertTrue(ResultOutputMode.TERMINAL_OUTPUTS.shouldOutputResult(helper.getSpec1(), graph));
    assertFalse(ResultOutputMode.TERMINAL_OUTPUTS.shouldOutputResult(helper.getSpec2(), graph));
   
    // Everything should be included in the output
    assertTrue(ResultOutputMode.ALL.shouldOutputResult(helper.getSpec1(), graph));
    assertTrue(ResultOutputMode.ALL.shouldOutputResult(helper.getSpec2(), graph));
    assertTrue(ResultOutputMode.ALL.shouldOutputFromNode(functionNode));
  }
View Full Code Here

TOP

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

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.