Package com.opengamma.engine.view.impl

Examples of com.opengamma.engine.view.impl.ViewProcessorImpl


    env.setMarketDataProvider(marketDataProvider);

    env.setViewResultListenerFactory(viewResultListenerFactoryStub);
    env.init();

    final ViewProcessorImpl vp = env.getViewProcessor();

    vp.start();

    final ViewClient client = vp.createViewClient(ViewProcessorTestEnvironment.TEST_USER);
    client.setFragmentResultMode(ViewResultMode.FULL_ONLY);

    marketDataProvider.addValue(ViewProcessorTestEnvironment.getPrimitive1(), (byte) 1);
    marketDataProvider.addValue(ViewProcessorTestEnvironment.getPrimitive2(), (byte) 2);
View Full Code Here


    ViewProcessorTestEnvironment env = new ViewProcessorTestEnvironment();
    BlockingDependencyGraphExecutorFactory dgef = new BlockingDependencyGraphExecutorFactory(TIMEOUT);
    env.setDependencyGraphExecutorFactory(dgef);
    env.init();

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

    ViewClient client = vp.createViewClient(UserPrincipal.getTestUser());
    client.attachToViewProcess(env.getViewDefinition().getUniqueId(), ExecutionOptions.infinite(MarketData.live()));

    BlockingDependencyGraphExecutor executor = dgef.getExecutorInstance();
    assertTrue(executor.awaitFirstRun(TIMEOUT));
View Full Code Here

  }

  @Override
  public ViewProcessor createObject() {
    checkInjectedInputs();
    return new ViewProcessorImpl(
        getName(),
        getConfigSource(),
        getNamedMarketDataSpecificationRepository(),
        getFunctionCompilationService(),
        getFunctionResolver(),
View Full Code Here

      checkNotTerminated();

      // The client is detached right now so the merging update listener is paused. Although the following calls may
      // cause initial updates to be pushed through, they will not be seen until the merging update listener is
      // resumed, at which point the new permission provider will be in place.
      ViewProcessorImpl viewProcessor = getViewProcessor();
      ViewPermissionContext context = privateProcess ?
          viewProcessor.attachClientToPrivateViewProcess(getUniqueId(), _mergingViewProcessListener, viewDefinitionId, executionOptions) :
          viewProcessor.attachClientToSharedViewProcess(getUniqueId(), _mergingViewProcessListener, viewDefinitionId, executionOptions);
      attachToViewProcessCore(context);
    } finally {
      _clientLock.unlock();
    }
  }
View Full Code Here

  @Test
  public void testSingleViewMultipleClients() {
    final ViewProcessorTestEnvironment env = new ViewProcessorTestEnvironment();
    env.init();
    final ViewProcessorImpl vp = env.getViewProcessor();
    vp.start();

    final ViewClient client1 = vp.createViewClient(ViewProcessorTestEnvironment.TEST_USER);
    assertNotNull(client1.getUniqueId());

    client1.attachToViewProcess(env.getViewDefinition().getUniqueId(), ExecutionOptions.infinite(MarketData.live(), ExecutionFlags.none().get()));
    final ViewProcessImpl client1Process = env.getViewProcess(vp, client1.getUniqueId());
    assertTrue(client1Process.getState() == ViewProcessState.RUNNING);

    final ViewClient client2 = vp.createViewClient(ViewProcessorTestEnvironment.TEST_USER);
    assertNotNull(client2.getUniqueId());
    assertFalse(client1.getUniqueId().equals(client2.getUniqueId()));

    client2.attachToViewProcess(env.getViewDefinition().getUniqueId(), ExecutionOptions.infinite(MarketData.live(), ExecutionFlags.none().get()));
    final ViewProcessImpl client2Process = env.getViewProcess(vp, client2.getUniqueId());
View Full Code Here

  @Test
  public void testCascadingShutdown() {
    final ViewProcessorTestEnvironment env = new ViewProcessorTestEnvironment();
    env.init();
    final ViewProcessorImpl vp = env.getViewProcessor();
    vp.start();

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

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

    final ViewProcessImpl view = env.getViewProcess(vp, client1.getUniqueId());

    vp.stop();

    assertFalse(vp.isRunning());
    assertFalse(view.isRunning());
    assertTrue(view.getState() == ViewProcessState.TERMINATED);

    assertFalse(client1.isAttached());
    assertFalse(client2.isAttached());
View Full Code Here

  /**
   * @throws java.lang.Exception
   */
  @AfterMethod
  public void tearDown() throws Exception {
    ViewProcessorImpl viewProcessor = _env.getViewProcessor();
    viewProcessor.stop();
    //Ensure the ViewProcessor stop clears all mbeans from the MBeanServer
    assertMBeanCount(0);
  }
View Full Code Here

  private MBeanServer createMBeanServer() {
    return MBeanServerFactory.createMBeanServer("SimpleAgent");
  }
 
  public void testRegistrationService() throws Exception {
    ViewProcessorImpl vp = _env.getViewProcessor();
    vp.start();
    ManagementService.registerMBeans(vp, _statisticsProvider, _mBeanServer);
    assertMBeanCount(MBEANS_IN_TEST_VIEWPROCESSOR);
  }
View Full Code Here

    ManagementService.registerMBeans(vp, _statisticsProvider, _mBeanServer);
    assertMBeanCount(MBEANS_IN_TEST_VIEWPROCESSOR);
  }
 
  public void testRegistrationServiceListensForViewProcessAdded() throws Exception {
    ViewProcessorImpl viewProcessor = _env.getViewProcessor();
    viewProcessor.start();
    ManagementService.registerMBeans(viewProcessor, _statisticsProvider, _mBeanServer);
    assertMBeanCount(MBEANS_IN_TEST_VIEWPROCESSOR);
    addAnotherView(viewProcessor);
    s_logger.debug("after adding new views");
    assertMBeanCount(MBEANS_IN_TEST_VIEWPROCESSOR + 3);
View Full Code Here

    s_logger.debug("after adding new views");
    assertMBeanCount(MBEANS_IN_TEST_VIEWPROCESSOR + 3);
  }
 
  public void testRegistrationServiceListenersForViewClientAdded() throws Exception {
    ViewProcessorImpl viewProcessor = _env.getViewProcessor();
    viewProcessor.start();
    ManagementService.registerMBeans(viewProcessor, _statisticsProvider, _mBeanServer);
    assertMBeanCount(MBEANS_IN_TEST_VIEWPROCESSOR);
    ViewClient client1 = viewProcessor.createViewClient(UserPrincipal.getTestUser());
    assertMBeanCount(MBEANS_IN_TEST_VIEWPROCESSOR + 1);
    ViewClient client2 = viewProcessor.createViewClient(UserPrincipal.getTestUser());
    assertMBeanCount(MBEANS_IN_TEST_VIEWPROCESSOR + 2);
    client1.shutdown();
    assertMBeanCount(MBEANS_IN_TEST_VIEWPROCESSOR + 1);
    client2.shutdown();
    assertMBeanCount(MBEANS_IN_TEST_VIEWPROCESSOR);
View Full Code Here

TOP

Related Classes of com.opengamma.engine.view.impl.ViewProcessorImpl

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.