Package com.opengamma.engine.test

Examples of com.opengamma.engine.test.MockFunction.addResult()


      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 MockFunction addFunctionRequiring2Producing1() {
    final MockFunction function = new MockFunction(FUNCTION_REQUIRING_2_PRODUCING_1, _target);
    function.addRequirement(_req2);
    function.addResult(_value1);
    _functionRepo.addFunction(function);
    return function;
  }

  public MockFunction addFunctionProducing2() {
View Full Code Here

    return function;
  }

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

  public MockFunction addFunctionProducing2Beta() {
View Full Code Here

    return function;
  }

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

  public MockFunction addFunctionProducing(final ComputedValue result) {
View Full Code Here

    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;
  }

  public MockFunction addFunctionRequiringProducing(final ValueRequirement requirement, final ComputedValue result) {
View Full Code Here

  }

  public MockFunction addFunctionRequiringProducing(final ValueRequirement requirement, final ComputedValue result) {
    final MockFunction function = new MockFunction(Integer.toString(_mockId++), _target);
    function.addRequirement(requirement);
    function.addResult(result);
    _functionRepo.addFunction(function);
    return function;
  }

  public void make2AvailableFromLiveData() {
View Full Code Here

    return resultItem;
  }

  private MockFunction getMockLoggingFunction() {
    final MockFunction fn = new MockLoggingFunction(MockFunction.UNIQUE_ID, ComputationTarget.NULL);
    fn.addResult(new ValueSpecification("OUTPUT", ComputationTargetSpecification.NULL, ValueProperties.with(ValuePropertyNames.FUNCTION, MockFunction.UNIQUE_ID).get()), "Result");
    return fn;
  }

  private class MockLoggingFunction extends MockFunction {
View Full Code Here

    final ComputationTarget target1 = new ComputationTarget(ComputationTargetType.PRIMITIVE, UniqueId.of("Target", "1"));
    final ComputationTarget target2 = new ComputationTarget(ComputationTargetType.PRIMITIVE, UniqueId.of("Target", "2"));
    final ComputationTarget target3 = new ComputationTarget(ComputationTargetType.PRIMITIVE, UniqueId.of("Target", "3"));
    final String property = "Constraint";
    MockFunction source = new MockFunction("source1", target1);
    source.addResult(new ComputedValue(new ValueSpecification("A", target1.toSpecification(), ValueProperties.with(ValuePropertyNames.FUNCTION, "1").with(property, "Foo").get()), 1.0));
    helper.getFunctionRepository().addFunction(source);
    source = new MockFunction("source2", target2);
    source.addResult(new ComputedValue(new ValueSpecification("A", target2.toSpecification(), ValueProperties.with(ValuePropertyNames.FUNCTION, "1").with(property, "Bar").get()), 2.0));
    helper.getFunctionRepository().addFunction(source);
    // Constraint preserving A->B
View Full Code Here

    final String property = "Constraint";
    MockFunction source = new MockFunction("source1", target1);
    source.addResult(new ComputedValue(new ValueSpecification("A", target1.toSpecification(), ValueProperties.with(ValuePropertyNames.FUNCTION, "1").with(property, "Foo").get()), 1.0));
    helper.getFunctionRepository().addFunction(source);
    source = new MockFunction("source2", target2);
    source.addResult(new ComputedValue(new ValueSpecification("A", target2.toSpecification(), ValueProperties.with(ValuePropertyNames.FUNCTION, "1").with(property, "Bar").get()), 2.0));
    helper.getFunctionRepository().addFunction(source);
    // Constraint preserving A->B
    helper.getFunctionRepository().addFunction(new TestFunction() {

      @Override
View Full Code Here

        return super.execute(executionContext, inputs, target, desiredValues);
      }

    };
    final ValueRequirement requirement1 = new ValueRequirement("value1", target.toSpecification());
    fn1.addResult(new ValueSpecification(requirement1.getValueName(), target.toSpecification(), ValueProperties.with(ValuePropertyNames.FUNCTION, "fn1").get()), "result1");
    functionRepository.addFunction(fn1);

    final MockFunction fn2 = new MockFunction(MockFunction.UNIQUE_ID + "2", target) {

      @Override
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.