Package com.opengamma.engine.view.compilation

Examples of com.opengamma.engine.view.compilation.CompiledViewDefinitionWithGraphsImpl


    client.attachToViewProcess(env.getViewDefinition().getUniqueId(), executionOptions);

    final ViewProcessImpl viewProcess = env.getViewProcess(vp, client.getUniqueId());
    final ViewProcessWorker worker = env.getCurrentWorker(viewProcess);

    final CompiledViewDefinitionWithGraphsImpl compilationModel1 = (CompiledViewDefinitionWithGraphsImpl) resultListener.getViewDefinitionCompiled(Timeout.standardTimeoutMillis())
        .getCompiledViewDefinition();

    assertEquals(time0, resultListener.getCycleCompleted(10 * Timeout.standardTimeoutMillis()).getFullResult().getViewCycleExecutionOptions().getValuationTime());

    worker.requestCycle();
    assertEquals(time0.plusMillis(10), resultListener.getCycleCompleted(10 * Timeout.standardTimeoutMillis()).getFullResult().getViewCycleExecutionOptions().getValuationTime());
    resultListener.assertNoCalls(Timeout.standardTimeoutMillis());

    // TODO: This test doesn't belong here; it is specific to the SingleThreadViewComputationJob.

    // Trick the compilation job into thinking it needs to rebuilt after time0 + 20
    final CompiledViewDefinitionWithGraphsImpl compiledViewDefinition = new CompiledViewDefinitionWithGraphsImpl(VersionCorrection.LATEST, "", compilationModel1.getViewDefinition(),
        CompiledViewDefinitionWithGraphsImpl.getDependencyGraphs(compilationModel1), Collections.<ComputationTargetReference, UniqueId>emptyMap(), compilationModel1.getPortfolio(),
        compilationModel1.getFunctionInitId()) {
      @Override
      public Instant getValidTo() {
        return time0.plusMillis(20);
View Full Code Here


  @Test
  public void testCycleSimpleGraph() {
    final ViewProcessorTestEnvironment env = new ViewProcessorTestEnvironment();
    env.init();
    final CompiledViewDefinitionWithGraphsImpl compiledViewDefinition = env.compileViewDefinition(Instant.now(), VersionCorrection.LATEST);
    final DependencyGraph graph = compiledViewDefinition.getDependencyGraphExplorer(ViewProcessorTestEnvironment.TEST_CALC_CONFIG_NAME).getWholeGraph();
    final DependencyGraph cycledGraph = cycleObject(DependencyGraph.class, graph);

    assertEquals(graph.getCalculationConfigurationName(), cycledGraph.getCalculationConfigurationName());
    assertEquals(graph.getAllComputationTargets(), cycledGraph.getAllComputationTargets());
    assertEquals(graph.getOutputSpecifications(), cycledGraph.getOutputSpecifications());
View Full Code Here

        node.addInputNode(previous);
      }
      graph.addDependencyNode(node);
      previous = node;
    }
    final CompiledViewDefinitionWithGraphsImpl viewEvaluationModel = new CompiledViewDefinitionWithGraphsImpl(VersionCorrection.LATEST, "", viewDefinition, Collections.singleton(graph),
        Collections.<ComputationTargetReference, UniqueId>emptyMap(), new SimplePortfolio("Test Portfolio"), 0);
    final ViewCycleExecutionOptions cycleOptions = ViewCycleExecutionOptions.builder().setValuationTime(Instant.ofEpochMilli(1)).setMarketDataSpecification(new MarketDataSpecification()).create();
    final SingleComputationCycle cycle = new SingleComputationCycle(UniqueId.of("Test", "Cycle1"), computationCycleResultListener, vpc, viewEvaluationModel,
        cycleOptions, VersionCorrection.of(Instant.ofEpochMilli(1), Instant.ofEpochMilli(1)));
    return factory.createExecutor(cycle).execute(graph);
View Full Code Here

  private CompiledViewDefinitionWithGraphs compiledViewDefinition(final ViewDefinition viewDefinition, final Map<ComputationTargetReference, UniqueId> resolutions) {
    final VersionCorrection versionCorrection = VersionCorrection.of(Instant.now(), Instant.now());
    final DependencyGraph graph = new DependencyGraph("Default");
    final Portfolio portfolio = Mockito.mock(Portfolio.class);
    return new CompiledViewDefinitionWithGraphsImpl(versionCorrection, "view-id", viewDefinition, Collections.singleton(graph), new HashMap<ComputationTargetReference, UniqueId>(resolutions),
        portfolio, 0);
  }
View Full Code Here

          EHCacheUtils.getCacheFromManager(_cacheManager, cacheName).removeAll();
        }
      }
      for (int i = 0; i < COUNT; i++) {
        final long tStart = System.nanoTime();
        final CompiledViewDefinitionWithGraphsImpl compiled = ViewDefinitionCompiler.compile(view, _viewCompilationServices, Instant.now().minus(Duration.ofDays(10 + i)),
            VersionCorrection.LATEST);
        final long tStop = System.nanoTime();
        s_logger.info("Compilation {} of view in {}ms", i, (tStop - tStart) / 1e6);
        final Map<String, Integer> nodeCounts = new HashMap<String, Integer>();
        for (final DependencyGraph graph : CompiledViewDefinitionWithGraphsImpl.getDependencyGraphs(compiled)) {
View Full Code Here

      for (DependencyGraphHolder graph : _graphs) {
        graphs.add(graph.get(functions));
      }
      final Portfolio portfolio = (Portfolio) parent.getFunctions().getFunctionCompilationContext().getRawComputationTargetResolver()
          .resolve(new ComputationTargetSpecification(ComputationTargetType.PORTFOLIO, _portfolio), _versionCorrection).getValue();
      CompiledViewDefinitionWithGraphsImpl compiledViewDef =
          new CompiledViewDefinitionWithGraphsImpl(_versionCorrection, _compilationId, viewDefinition, graphs,
              _resolutions, portfolio, _functionInitId, _calcConfigs);
      return parent.new CompiledViewDefinitionWithGraphsHolder(compiledViewDef);
    }
View Full Code Here

    }
    return copyTo;
  }

  private CompiledViewDefinitionWithGraphs copy(final CompiledViewDefinitionWithGraphs copyFrom) {
    return new CompiledViewDefinitionWithGraphsImpl(copyFrom.getResolverVersionCorrection(), copyFrom.getCompilationIdentifier(), copyFrom.getViewDefinition(),
        copyGraphs(copyFrom.getDependencyGraphExplorers()), new HashMap<ComputationTargetReference, UniqueId>(copyFrom.getResolvedIdentifiers()), copyFrom.getPortfolio(),
        ((CompiledViewDefinitionWithGraphsImpl) copyFrom).getFunctionInitId(), copyFrom.getCompiledCalculationConfigurations());
  }
View Full Code Here

    // Begin sequence while paused

    addCompile(mergingListener);
    addResults(mergingListener, 10);

    final CompiledViewDefinitionWithGraphsImpl preCompilation = mock(CompiledViewDefinitionWithGraphsImpl.class);
    mergingListener.viewDefinitionCompiled(preCompilation, true);

    addResults(mergingListener, 10);
    mergingListener.cycleCompleted(mock(ViewComputationResultModel.class), getDeltaResult(1));
    final ViewComputationResultModel latestResult = mock(ViewComputationResultModel.class);
    mergingListener.cycleCompleted(latestResult, getDeltaResult(2));

    final CompiledViewDefinitionWithGraphsImpl postCompilation = mock(CompiledViewDefinitionWithGraphsImpl.class);
    mergingListener.viewDefinitionCompiled(postCompilation, true);

    mergingListener.processCompleted();
    mergingListener.processTerminated(false);
View Full Code Here

    viewDefinition.addViewCalculationConfiguration(calcConfig);
    final DependencyGraph graph = createDependencyGraph();
    final Collection<DependencyGraph> graphs = Collections.singleton(graph);
    final Map<ComputationTargetReference, UniqueId> resolutions = ImmutableMap.<ComputationTargetReference, UniqueId>of(
        new ComputationTargetRequirement(ComputationTargetType.SECURITY, ExternalId.of("Security", "Foo")), UniqueId.of("Sec", "0"));
    return new CompiledViewDefinitionWithGraphsImpl(VersionCorrection.LATEST, "", viewDefinition, graphs, resolutions, portfolio, 0);
  }
View Full Code Here

TOP

Related Classes of com.opengamma.engine.view.compilation.CompiledViewDefinitionWithGraphsImpl

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.