Package com.opengamma.engine.function

Examples of com.opengamma.engine.function.InMemoryFunctionRepository$IdentifiedFunction


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

  private CompiledFunctionService createFunctionCompilationService() {
    final InMemoryFunctionRepository functions = new InMemoryFunctionRepository();
    functions.addFunction(new AbstractFunction.NonCompiled() {

      @Override
      public ComputationTargetType getTargetType() {
        return ComputationTargetType.PRIMITIVE;
      }
View Full Code Here


    private final LinkedBlockingQueue<Boolean> _suspendState = new LinkedBlockingQueue<Boolean>();
    private boolean _running;
    private boolean _suspended;

    public MockViewProcessor() {
      final InMemoryFunctionRepository functions = new InMemoryFunctionRepository();
      _compiledFunctionService = new CompiledFunctionService(functions, new CachingFunctionRepositoryCompiler(), new FunctionCompilationContext());
      functions.addFunction(new MockFunction("mock", ComputationTarget.NULL) {

        @Override
        public void init(final FunctionCompilationContext context) {
          context.getFunctionReinitializer().reinitializeFunction(getFunctionDefinition(), ObjectId.of("Test", "Watched"));
        }
View Full Code Here

    }

  }

  private FunctionRepository createFunctionRepository() {
    final InMemoryFunctionRepository functions = new InMemoryFunctionRepository();
    // Default property functions
    functions.addFunction(new CalcConfigDefaultPropertyFunction.Generic());
    functions.addFunction(new CalcConfigDefaultPropertyFunction.Specific());
    functions.addFunction(new PositionDefaultPropertyFunction());
    functions.addFunction(new AttributableDefaultPropertyFunction());
    functions.addFunction(new AggregationDefaultPropertyFunction("Present Value", SummingFunction.AGGREGATION_STYLE_FULL));
    // Basic scaling and aggregation
    functions.addFunction(new SummingFunction("Present Value"));
    functions.addFunction(new PositionOrTradeScalingFunction("Present Value"));
    functions.addFunction(new TradeScalingFunction("Present Value"));
    // Mock PV function
    functions.addFunction(new MockPVFunction());
    // Default curve injection
    functions.addFunction(new DefaultForwardFundingCurveFunction("DefaultForward", "DefaultFunding", "Present Value"));
    return functions;
  }
View Full Code Here

    configureTestCalcNode(calcNode, mockFunction);
    return calcNode;
  }

  public static void configureTestCalcNode(final TestCalculationNode calcNode, final MockFunction mockFunction) {
    final InMemoryFunctionRepository functionRepo = (InMemoryFunctionRepository) calcNode.getFunctionCompilationService().getFunctionRepository();
    functionRepo.addFunction(mockFunction);
    calcNode.getFunctionCompilationService().initialize();
  }
View Full Code Here

  public void setFunctionRepository(final FunctionRepository functionRepository) {
    _functionRepository = functionRepository;
  }

  private FunctionRepository generateFunctionRepository() {
    final FunctionRepository functionRepository = new InMemoryFunctionRepository();
    setFunctionRepository(functionRepository);
    return functionRepository;
  }
View Full Code Here

    context.setRawComputationTargetResolver(new DefaultComputationTargetResolver(context.getSecuritySource(), new MockPositionSource()));
    return context;
  }

  private static CompiledFunctionService initializedCFS() {
    final CompiledFunctionService cfs = new CompiledFunctionService(new InMemoryFunctionRepository(), new CachingFunctionRepositoryCompiler(), compilationContext());
    cfs.initialize();
    return cfs;
  }
View Full Code Here

   *
   * @param configuration the configuration, not null
   * @return the repository, not null
   */
  public static InMemoryFunctionRepository constructRepository(final FunctionConfigurationBundle configuration) {
    final InMemoryFunctionRepository repository = constructRepositoryWithIntrinsicFunctions();
    if (configuration.getFunctions() != null) {
      for (final FunctionConfiguration functionConfig : configuration.getFunctions()) {
        if (functionConfig instanceof ParameterizedFunctionConfiguration) {
          addParameterizedFunctionConfiguration(repository, (ParameterizedFunctionConfiguration) functionConfig);
        } else if (functionConfig instanceof StaticFunctionConfiguration) {
View Full Code Here

    }
    return repository;
  }

  private static InMemoryFunctionRepository constructRepositoryWithIntrinsicFunctions() {
    final InMemoryFunctionRepository repository = new InMemoryFunctionRepository();
    for (FunctionDefinition intrinsicFunction : INTRINSIC_FUNCTIONS) {
      repository.addFunction(intrinsicFunction);
    }
    return repository;
  }
View Full Code Here

  public void simpleInvocation() {
    final IdentifierMap identifierMap = new InMemoryIdentifierMap ();
    final DirectFudgeConnection conduit = new DirectFudgeConnection(s_fudgeContext);
    final CollectingFudgeMessageReceiver messages = new CollectingFudgeMessageReceiver();
    conduit.getEnd2().setFudgeMessageReceiver(messages);
    final RemoteNodeClient client = new RemoteNodeClient(conduit.getEnd1(), new CompiledFunctionService (new InMemoryFunctionRepository (), new CachingFunctionRepositoryCompiler(), new FunctionCompilationContext ()), new InMemoryIdentifierMap (), new FunctionInvocationStatisticsSender ());
    final SimpleCalculationNode node = new TestCalculationNode();
    assertEquals(0, messages.getMessages().size());
    client.addNode(node);
    assertEquals(0, messages.getMessages().size());
    client.start();
View Full Code Here

  public void isAlive () {
    final IdentifierMap identifierMap = new InMemoryIdentifierMap ();
    final DirectFudgeConnection conduit = new DirectFudgeConnection(s_fudgeContext);
    final CollectingFudgeMessageReceiver messages = new CollectingFudgeMessageReceiver();
    conduit.getEnd2().setFudgeMessageReceiver(messages);
    final RemoteNodeClient client = new RemoteNodeClient(conduit.getEnd1(), new CompiledFunctionService (new InMemoryFunctionRepository (), new CachingFunctionRepositoryCompiler(), new FunctionCompilationContext ()), new InMemoryIdentifierMap (), new FunctionInvocationStatisticsSender ());
    client.start();
    assertEquals(1, messages.getMessages().size());
    final FudgeMsgEnvelope readyMsgEnvelope = messages.getMessages().get(0);
    messages.clear();
    final FudgeDeserializer dcontext = new FudgeDeserializer(s_fudgeContext);
View Full Code Here

TOP

Related Classes of com.opengamma.engine.function.InMemoryFunctionRepository$IdentifiedFunction

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.