Examples of InMemoryFunctionRepository


Examples of com.opengamma.engine.function.InMemoryFunctionRepository

    positionSource.addPortfolio(p);
    final SimpleSecurity defSec = new SimpleSecurity("");
    defSec.addExternalId(secIdentifier);
    final InMemorySecuritySource securitySource = new InMemorySecuritySource();
    securitySource.addSecurity(defSec);
    final InMemoryFunctionRepository functionRepo = new InMemoryFunctionRepository();
    final FunctionCompilationContext functionCompilationContext = new FunctionCompilationContext();
    functionCompilationContext.setFunctionInitId(123);
    functionCompilationContext.setRawComputationTargetResolver(new DefaultCachingComputationTargetResolver(new DefaultComputationTargetResolver(securitySource, positionSource),
        _cacheManager));
    final CompiledFunctionService cfs = new CompiledFunctionService(functionRepo, new CachingFunctionRepositoryCompiler(), functionCompilationContext);
View Full Code Here

Examples of com.opengamma.engine.function.InMemoryFunctionRepository

    final InMemorySecuritySource securitySource = new InMemorySecuritySource();
    securitySource.addSecurity(defSec);
    // This function doesn't actually require anything, so it can compute at the node level without anything else.
    // Hence, the only target will be the node.
    final MockFunction fn1 = MockFunction.getMockFunction(new ComputationTarget(ComputationTargetType.PORTFOLIO_NODE, pn), 14.2);
    final InMemoryFunctionRepository functionRepo = new InMemoryFunctionRepository();
    functionRepo.addFunction(fn1);
    final FunctionCompilationContext functionCompilationContext = new FunctionCompilationContext();
    functionCompilationContext.setFunctionInitId(123);
    functionCompilationContext.setSecuritySource(securitySource);
    final CompiledFunctionService cfs = new CompiledFunctionService(functionRepo, new CachingFunctionRepositoryCompiler(), functionCompilationContext);
    cfs.initialize();
View Full Code Here

Examples of com.opengamma.engine.function.InMemoryFunctionRepository

    final InMemorySecuritySource securitySource = new InMemorySecuritySource();
    securitySource.addSecurity(sec1);
    securitySource.addSecurity(sec2);
    final MockFunction fn2 = MockFunction.getMockFunction("fn2", new ComputationTarget(ComputationTargetType.SECURITY, sec2), 14.2);
    final MockFunction fn1 = MockFunction.getMockFunction("fn1", new ComputationTarget(ComputationTargetType.PORTFOLIO_NODE, pn), 14.2, fn2);
    final InMemoryFunctionRepository functionRepo = new InMemoryFunctionRepository();
    functionRepo.addFunction(fn1);
    functionRepo.addFunction(fn2);
    final FunctionCompilationContext functionCompilationContext = new FunctionCompilationContext();
    functionCompilationContext.setFunctionInitId(123);
    final CompiledFunctionService cfs = new CompiledFunctionService(functionRepo, new CachingFunctionRepositoryCompiler(), functionCompilationContext);
    cfs.initialize();
    final DefaultFunctionResolver functionResolver = new DefaultFunctionResolver(cfs);
View Full Code Here

Examples of com.opengamma.engine.function.InMemoryFunctionRepository

  public void testPrimitivesOnlyNoPortfolioReference() {
    final ViewDefinition viewDefinition = new ViewDefinition("Test", "jonathan");
    final ViewCalculationConfiguration calcConfig = new ViewCalculationConfiguration(viewDefinition, "Config1");
    viewDefinition.addViewCalculationConfiguration(calcConfig);
    final UniqueId t1 = UniqueId.of("TestScheme", "t1");
    final InMemoryFunctionRepository functionRepo = new InMemoryFunctionRepository();
    final MockFunction f1 = MockFunction.getMockFunction(new ComputationTarget(ComputationTargetType.PRIMITIVE, t1), 42);
    functionRepo.addFunction(f1);
    final FunctionCompilationContext compilationContext = new FunctionCompilationContext();
    compilationContext.setFunctionInitId(123);
    final CompiledFunctionService cfs = new CompiledFunctionService(functionRepo, new CachingFunctionRepositoryCompiler(), compilationContext);
    cfs.initialize();
    final DefaultFunctionResolver functionResolver = new DefaultFunctionResolver(cfs);
View Full Code Here

Examples of com.opengamma.engine.function.InMemoryFunctionRepository

    final SimpleSecurity sec1 = new SimpleSecurity("My Sec");
    sec1.addExternalId(secIdentifier1);
    final InMemorySecuritySource securitySource = new InMemorySecuritySource();
    securitySource.addSecurity(sec1);
    final UniqueId t1 = UniqueId.of("TestScheme", "t1");
    final InMemoryFunctionRepository functionRepo = new InMemoryFunctionRepository();
    final MockFunction f1 = MockFunction.getMockFunction("f1", new ComputationTarget(ComputationTargetType.PRIMITIVE, t1), 42);
    final MockFunction f2 = MockFunction.getMockFunction("f2", new ComputationTarget(ComputationTargetType.SECURITY, sec1), 60, f1);
    functionRepo.addFunction(f1);
    functionRepo.addFunction(f2);
    final FunctionCompilationContext compilationContext = new FunctionCompilationContext();
    compilationContext.setFunctionInitId(123);
    final CompiledFunctionService cfs = new CompiledFunctionService(functionRepo, new CachingFunctionRepositoryCompiler(), compilationContext);
    cfs.initialize();
    final DefaultFunctionResolver functionResolver = new DefaultFunctionResolver(cfs);
View Full Code Here

Examples of com.opengamma.engine.function.InMemoryFunctionRepository

  };

  private DependencyGraphExecutionFuture executeTestJob(final DependencyGraphExecutorFactory factory) {
    final InMemoryLKVMarketDataProvider marketDataProvider = new InMemoryLKVMarketDataProvider();
    final MarketDataProviderResolver marketDataProviderResolver = new SingleMarketDataProviderResolver(new SingletonMarketDataProviderFactory(marketDataProvider));
    final InMemoryFunctionRepository functionRepository = new InMemoryFunctionRepository();
    _functionCount.set(0);
    final MockFunction mockFunction = new MockFunction(ComputationTarget.NULL) {
      @Override
      public Set<ComputedValue> execute(final FunctionExecutionContext executionContext, final FunctionInputs inputs, final ComputationTarget target, final Set<ValueRequirement> desiredValues) {
        try {
          Thread.sleep(JOB_FINISH_TIME / (JOB_SIZE * 2));
        } catch (final InterruptedException e) {
          throw new OpenGammaRuntimeException("Function interrupted", e);
        }
        _functionCount.incrementAndGet();
        return super.execute(executionContext, inputs, target, desiredValues);
      }
    };
    functionRepository.addFunction(mockFunction);
    final FunctionCompilationContext compilationContext = new FunctionCompilationContext();
    final CompiledFunctionService compilationService = new CompiledFunctionService(functionRepository, new CachingFunctionRepositoryCompiler(), compilationContext);
    compilationService.initialize();
    final FunctionResolver functionResolver = new DefaultFunctionResolver(compilationService);
    final InMemorySecuritySource securitySource = new InMemorySecuritySource();
View Full Code Here

Examples of com.opengamma.engine.function.InMemoryFunctionRepository

  public void testCancel() throws Exception {
    final ViewDefinition viewDefinition = new ViewDefinition("Test", "jonathan");
    final ViewCalculationConfiguration calcConfig = new ViewCalculationConfiguration(viewDefinition, "Config1");
    viewDefinition.addViewCalculationConfiguration(calcConfig);
    final FunctionRepository functionRepo = new InMemoryFunctionRepository();
    final FunctionCompilationContext compilationContext = new FunctionCompilationContext();
    final CompiledFunctionService cfs = new CompiledFunctionService(functionRepo, new CachingFunctionRepositoryCompiler(), compilationContext);
    cfs.initialize();
    final DefaultFunctionResolver functionResolver = new DefaultFunctionResolver(cfs);
    final SecuritySource securitySource = new InMemorySecuritySource();
View Full Code Here

Examples of com.opengamma.engine.function.InMemoryFunctionRepository

    FunctionRepositoryFactory.constructRepository(null);
  }

  public void emptyConfiguration() {
    final FunctionConfigurationBundle configuration = new FunctionConfigurationBundle();
    final InMemoryFunctionRepository repo = FunctionRepositoryFactory.constructRepository(configuration);
    assertNotNull(repo);
    assertEquals(repo.getAllFunctions().size(), FunctionRepositoryFactory.INTRINSIC_FUNCTION_COUNT);
    for (final FunctionDefinition definition : repo.getAllFunctions()) {
      assertTrue(isIntrinsicFunctionDefinition(definition));
      assertNotNull(definition.getUniqueId());
    }
  }
View Full Code Here

Examples of com.opengamma.engine.function.InMemoryFunctionRepository

  }

  public void singleConfigurationNoArgs() {
    final FunctionConfigurationBundle configuration = new FunctionConfigurationBundle();
    configuration.addFunctions(new StaticFunctionConfiguration(MockEmptyFunction.class.getName()));
    final InMemoryFunctionRepository repo = FunctionRepositoryFactory.constructRepository(configuration);
    assertNotNull(repo);
    final Collection<FunctionDefinition> definitions = repo.getAllFunctions();
    assertNotNull(definitions);
    assertEquals(FunctionRepositoryFactory.INTRINSIC_FUNCTION_COUNT + 1, definitions.size());
    FunctionDefinition definition = null;
    for (final FunctionDefinition d : definitions) {
      if (d instanceof MockEmptyFunction) {
View Full Code Here

Examples of com.opengamma.engine.function.InMemoryFunctionRepository

    final FunctionConfigurationBundle configuration = new FunctionConfigurationBundle();
    configuration.addFunctions(new ParameterizedFunctionConfiguration(MockSingleArgumentFunction.class.getName(), Collections.singleton("foo")));
    configuration.addFunctions(new ParameterizedFunctionConfiguration(MockMultiArgumentFunctionArrayForm.class.getName(), Lists.newArrayList(
        "foo1", "foo2")));
    configuration.addFunctions(new ParameterizedFunctionConfiguration(MockMultiArgumentFunctionIndividualParameterForm.class.getName(), Lists.newArrayList("bar1", "bar2")));
    final InMemoryFunctionRepository repo = FunctionRepositoryFactory.constructRepository(configuration);
    assertNotNull(repo);

    final Collection<FunctionDefinition> definitions = repo.getAllFunctions();
    assertNotNull(definitions);
    assertEquals(FunctionRepositoryFactory.INTRINSIC_FUNCTION_COUNT + 3, definitions.size());
    for (final FunctionDefinition definition : definitions) {
      if (definition instanceof MockSingleArgumentFunction) {
        final MockSingleArgumentFunction single = (MockSingleArgumentFunction) definition;
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.