Package com.opengamma.engine.test

Examples of com.opengamma.engine.test.MockFunction


  private final Set<ValueSpecification> _inputs2;
  private final Set<ValueSpecification> _outputs1;
  private final Set<ValueSpecification> _outputs2;

  public DefaultFunctionBlacklistQueryTest() {
    _function1 = new ParameterizedFunction(new MockFunction("F1", null), new EmptyFunctionParameters());
    _function2 = new ParameterizedFunction(new MockFunction("F2", null), new EmptyFunctionParameters());
    _function3 = new ParameterizedFunction(new MockFunction("F1", null), new SimpleFunctionParameters());
    _function4 = new ParameterizedFunction(new MockFunction("F2", null), new SimpleFunctionParameters());
    _target1 = ComputationTargetSpecification.of(UniqueId.of("Test", "Foo"));
    _target2 = ComputationTargetSpecification.of(UniqueId.of("Test", "Bar"));
    _inputs1 = Collections.singleton(new ValueSpecification("Foo", _target1, ValueProperties.with(ValuePropertyNames.FUNCTION, "X").get()));
    _inputs2 = Collections.singleton(new ValueSpecification("Bar", _target1, ValueProperties.with(ValuePropertyNames.FUNCTION, "X").get()));
    _outputs1 = Collections.singleton(new ValueSpecification("Foo", _target2, ValueProperties.with(ValuePropertyNames.FUNCTION, "Y").get()));
View Full Code Here


  private final ComputationTargetSpecification _target;
  private final Set<ValueSpecification> _inputs;
  private final Set<ValueSpecification> _outputs;

  public DefaultManageableFunctionBlacklistExpiryTest() {
    _function = new ParameterizedFunction(new MockFunction("F1", null), new EmptyFunctionParameters());
    _target = ComputationTargetSpecification.of(UniqueId.of("Test", "Foo"));
    _inputs = Collections.singleton(new ValueSpecification("Foo", _target, ValueProperties.with(ValuePropertyNames.FUNCTION, "X").get()));
    _outputs = Collections.singleton(new ValueSpecification("Bar", _target, ValueProperties.with(ValuePropertyNames.FUNCTION, "Y").get()));
  }
View Full Code Here

  private DependencyGraph createDependencyGraph() {
    final DependencyGraph graph = new DependencyGraph("Default");
    final ValueProperties properties = ValueProperties.with(ValuePropertyNames.FUNCTION, "Mock").get();
    final ComputationTarget t1 = new ComputationTarget(ComputationTargetType.PORTFOLIO_NODE, new SimplePortfolioNode(UniqueId.of("Node", "0"), "node"));
    final DependencyNode n1 = new DependencyNode(t1.toSpecification());
    n1.setFunction(new MockFunction("F1", t1));
    n1.addOutputValue(new ValueSpecification("Foo", t1.toSpecification(), properties));
    n1.addTerminalOutputValue(new ValueSpecification("Foo", t1.toSpecification(), properties));
    graph.addDependencyNode(n1);
    final ComputationTarget t2 = new ComputationTarget(ComputationTargetType.POSITION, new SimplePosition(UniqueId.of("Pos", "0"), BigDecimal.ONE, ExternalId.of("Security", "Foo")));
    final DependencyNode n2 = new DependencyNode(t2.toSpecification());
    n2.setFunction(new MockFunction("F2", t1));
    n2.addOutputValue(new ValueSpecification("Foo", t2.toSpecification(), properties));
    n1.addInputValue(new ValueSpecification("Foo", t2.toSpecification(), properties));
    n1.addInputNode(n2);
    graph.addDependencyNode(n2);
    final ComputationTarget t3 = new ComputationTarget(ComputationTargetType.SECURITY, createSecurity(UniqueId.of("Pos", "0"), ExternalId.of("Security", "Foo")));
    final DependencyNode n3 = new DependencyNode(t3.toSpecification());
    n3.setFunction(new MockFunction("F3", t1));
    n3.addOutputValue(new ValueSpecification("Foo", t3.toSpecification(), properties));
    n2.addInputValue(new ValueSpecification("Foo", t3.toSpecification(), properties));
    n2.addInputNode(n3);
    graph.addDependencyNode(n3);
    graph.addTerminalOutput(new ValueRequirement("Foo", t1.toSpecification()), new ValueSpecification("Foo", t1.toSpecification(), properties));
View Full Code Here

    return context;
  }

  private FunctionRepository createFunctionRepository() {
    final InMemoryFunctionRepository functions = new InMemoryFunctionRepository();
    functions.addFunction(new MockFunction("F1", new ComputationTarget(ComputationTargetType.PORTFOLIO_NODE, new SimplePortfolioNode(UniqueId.of("Node", "0"), "node"))));
    functions.addFunction(new MockFunction("F2", new ComputationTarget(ComputationTargetType.POSITION, new SimplePosition(UniqueId.of("Pos", "0"), BigDecimal.ONE, ExternalId.of("Security", "Foo")))));
    functions.addFunction(new MockFunction("F3", new ComputationTarget(ComputationTargetType.SECURITY, createSecurity(UniqueId.of("Pos", "0"), ExternalId.of("Security", "Foo")))));
    return functions;
  }
View Full Code Here

        Currency.USD.getUniqueId());

    ComputationTarget target = new ComputationTarget(targetSpecification, Currency.USD);

    DependencyNode yieldCurveNode = new DependencyNode(targetSpecification);
    yieldCurveNode.setFunction(new MockFunction(target));
    yieldCurveNode.addOutputValue(new ValueSpecification(
        "YieldCurve",
        targetSpecification,
        ValueProperties.builder().with("Curve", "Forward3M").with("Function", "someFunction").get()));
View Full Code Here

  public InMemoryFunctionRepository getFunctionRepository() {
    return _functionRepo;
  }

  public MockFunction addFunctionProducing1and2() {
    final MockFunction function = new MockFunction(FUNCTION_PRODUCING_1_AND_2, _target);
    function.addResults(Sets.newHashSet(_value1, _value2));
    _functionRepo.addFunction(function);
    return function;
  }
View Full Code Here

    _functionRepo.addFunction(function);
    return function;
  }

  public MockFunction addFunctionRequiring2Producing1() {
    final MockFunction function = new MockFunction(FUNCTION_REQUIRING_2_PRODUCING_1, _target);
    function.addRequirement(_req2);
    function.addResult(_value1);
    _functionRepo.addFunction(function);
    return function;
  }
View Full Code Here

    _functionRepo.addFunction(function);
    return function;
  }

  public MockFunction addFunctionProducing2() {
    final MockFunction function = new MockFunction(FUNCTION_PRODUCING_2, _target);
    function.addResult(_value2);
    _functionRepo.addFunction(function);
    return function;
  }
View Full Code Here

    _functionRepo.addFunction(function);
    return function;
  }

  public MockFunction addFunctionProducing2Beta() {
    final MockFunction function = new MockFunction(FUNCTION_PRODUCING_2_BETA, _target);
    function.addResult(_value2Beta);
    _functionRepo.addFunction(function);
    return function;
  }
View Full Code Here

    _functionRepo.addFunction(function);
    return function;
  }

  public MockFunction addFunctionProducing(final ComputedValue result) {
    final MockFunction function = new MockFunction(Integer.toString(_mockId++), _target);
    function.addResult(result);
    _functionRepo.addFunction(function);
    return function;
  }
View Full Code Here

TOP

Related Classes of com.opengamma.engine.test.MockFunction

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.