final ComputationTarget target = new ComputationTarget(ComputationTargetType.CURRENCY, Currency.USD);
final MockFunction fn1 = new MockFunction(MockFunction.UNIQUE_ID + "1", target) {
@Override
public Set<ComputedValue> execute(final FunctionExecutionContext executionContext, final FunctionInputs inputs, final ComputationTarget target, final Set<ValueRequirement> desiredValues) {
LogBridge.getInstance().log(new SimpleLogEvent(LogLevel.WARN, "Warning during execution"));
LogBridge.getInstance().log(new SimpleLogEvent(LogLevel.ERROR, "Error during execution"));
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
public Set<ComputedValue> execute(final FunctionExecutionContext executionContext, final FunctionInputs inputs, final ComputationTarget target, final Set<ValueRequirement> desiredValues) {
LogBridge.getInstance().log(new SimpleLogEvent(LogLevel.WARN, "Warning during execution"));
return super.execute(executionContext, inputs, target, desiredValues);
}
};
fn2.addRequirement(requirement1);