Package com.opengamma.engine.view.client

Examples of com.opengamma.engine.view.client.ViewClient.attachToViewProcess()


    client.detachFromViewProcess();
    assertEquals(ViewProcessState.RUNNING, viewProcess.getState());

    resultListener.assertNoCalls(Timeout.standardTimeoutMillis());

    client.attachToViewProcess(env.getViewDefinition().getUniqueId(), ExecutionOptions.infinite(MarketData.live(), ExecutionFlags.none().get()));
    final ViewProcessImpl viewProcess2 = env.getViewProcess(vp, client.getUniqueId());
    assertEquals(viewProcess, viewProcess2);

    resultListener.expectNextCall(ViewDefinitionCompiledCall.class, Timeout.standardTimeoutMillis());
    resultListener.expectNextCall(CycleCompletedCall.class, Timeout.standardTimeoutMillis());
View Full Code Here


    env.init();
    final ViewProcessorImpl vp = env.getViewProcessor();
    vp.start();

    final ViewClient client = vp.createViewClient(ViewProcessorTestEnvironment.TEST_USER);
    client.attachToViewProcess(env.getViewDefinition().getUniqueId(), ExecutionOptions.infinite(MarketData.live()));

    vp.stop();
  }

  private void waitForCompletionAndShutdown(final ViewProcessorImpl vp, final ViewClient client, final ViewProcessorTestEnvironment env) throws InterruptedException {
View Full Code Here

    final CountDownLatch latch = new CountDownLatch(1);
    final ViewClient client2 = vp.createViewClient(ViewProcessorTestEnvironment.TEST_USER);
    final Thread tryAttach = new Thread() {
      @Override
      public void run() {
        client2.attachToViewProcess(env.getViewDefinition().getUniqueId(), ExecutionOptions.infinite(MarketData.live()));
        client2.shutdown();
        latch.countDown();
      }
    };
    tryAttach.start();
View Full Code Here

    final ViewClient client2 = vp.createViewClient(ViewProcessorTestEnvironment.TEST_USER);
    final CountDownLatch latch = new CountDownLatch(1);
    final Thread tryAttach = new Thread() {
      @Override
      public void run() {
        client2.attachToViewProcess(env.getViewDefinition().getUniqueId(), ExecutionOptions.infinite(MarketData.live()));
        client2.shutdown();
        latch.countDown();
      }
    };
    tryAttach.start();
View Full Code Here

    final CycleCountingViewResultListener listener = new CycleCountingViewResultListener(10);
    client.setResultListener(listener);
    final ViewExecutionOptions executionOptions = ExecutionOptions.of(new InfiniteViewCycleExecutionSequence(), ViewCycleExecutionOptions.builder().setMarketDataSpecification(MarketData.live())
        .create(),
        ExecutionFlags.none().runAsFastAsPossible().get());
    client.attachToViewProcess(env.getViewDefinition().getUniqueId(), executionOptions);
    listener.awaitCycles(10 * Timeout.standardTimeoutMillis());

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

View Full Code Here

    final ViewProcessorImpl vp = env.getViewProcessor();
    vp.start();

    final ViewClient client = vp.createViewClient(ViewProcessorTestEnvironment.TEST_USER);
    final ViewExecutionOptions executionOptions = ExecutionOptions.batch(generateExecutionSequence(10), ViewCycleExecutionOptions.builder().setMarketDataSpecification(MarketData.live()).create());
    client.attachToViewProcess(env.getViewDefinition().getUniqueId(), executionOptions);
    waitForCompletionAndShutdown(vp, client, env);
    assertEquals(0, vp.getViewCycleManager().getResourceCount());
  }

  public void testCycleManagement_processCompletesWithReferences() throws InterruptedException {
View Full Code Here

      }

    };
    client.setResultListener(resultListener);
    final ViewExecutionOptions executionOptions = ExecutionOptions.batch(generateExecutionSequence(10), ViewCycleExecutionOptions.builder().setMarketDataSpecification(MarketData.live()).create());
    client.attachToViewProcess(env.getViewDefinition().getUniqueId(), executionOptions);

    final ViewProcessImpl viewProcess = env.getViewProcess(vp, client.getUniqueId());
    final UniqueId viewProcessId = viewProcess.getUniqueId();

    waitForCompletionAndShutdown(vp, client, env);
View Full Code Here

    final ViewProcessor viewProcessor = _toolContext.getViewProcessor();
    final ViewClient client = viewProcessor.createViewClient(_user);

    final CountDownLatch latch = new CountDownLatch(1);
    client.setResultListener(new ViewStatusResultListener(latch, statusResult, viewDefinition));
    client.attachToViewProcess(viewDefinition.getUniqueId(), ExecutionOptions.infinite(_marketDataSpecification));
  
    try {
      s_logger.info("main thread waiting");
      if (!latch.await(30, TimeUnit.SECONDS)) {
        s_logger.error("Timed out waiting for {}", viewDefinition);
View Full Code Here

      throw new IllegalStateException("Execution context does not contain a " + OpenGammaExecutionContext.VIEW_PROCESSOR_NAME);
    }
    final ViewClient viewClient = viewProcessor.createViewClient(viewEvaluation.getViewDefinition().getMarketDataUser());
    final UniqueId viewClientId = viewClient.getUniqueId();
    s_logger.info("Created view client {}, connecting to {}", viewClientId, viewId);
    viewClient.attachToViewProcess(viewId,
        ExecutionOptions.of(viewEvaluation.getExecutionSequence().createSequence(executionContext), getDefaultCycleOptions(executionContext), getViewExecutionFlags(desiredValues)), true);
    final TResultBuilder resultBuilder = createResultBuilder(viewEvaluation, desiredValues);
    final AsynchronousOperation<Set<ComputedValue>> async = AsynchronousOperation.createSet();
    final AtomicReference<ResultCallback<Set<ComputedValue>>> asyncResult = new AtomicReference<ResultCallback<Set<ComputedValue>>>(async.getCallback());
    viewClient.setResultListener(new ViewResultListener() {
View Full Code Here

    Portfolio portfolio = getPositionSource().getPortfolio(portfolioId, VersionCorrection.LATEST);
    portfolio = PortfolioCompiler.resolvePortfolio(portfolio, Executors.newSingleThreadExecutor(), getSecuritySource());
    final UniqueId viewDefinitionId = getPaymentViewDefinition(portfolio);

    final ViewClient viewClient = getViewProcessor().createViewClient(UserPrincipal.getTestUser());
    viewClient.attachToViewProcess(viewDefinitionId, ExecutionOptions.singleCycle(Instant.now(), MarketData.live()));
    ViewComputationResultModel result;
    try {
      viewClient.waitForCompletion();
      result = viewClient.getLatestResult();
    } catch (final InterruptedException e) {
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.