SingleThreadViewProcessWorker implements ViewProcessWorker, MarketDataChangeListener { @Override public synchronized boolean triggerCycle() { s_logger.debug("Cycle triggered manually"); _forceTriggerCycle = true; notifyAll(); return true; } SingleThreadViewProcessWorker(final ViewProcessWorkerContext context, final ViewExecutionOptions executionOptions, final ViewDefinition viewDefinition); FixedTimeTrigger getCompilationExpiryCycleTrigger(); CompiledViewDefinitionWithGraphs getCachedCompiledViewDefinition(final Instant valuationTime, final VersionCorrection resolverVersionCorrection); void cacheCompiledViewDefinition(final CompiledViewDefinitionWithGraphs latestCompiledViewDefinition); ViewDefinition getViewDefinition(); @Override void onMarketDataValuesChanged(final Collection<ValueSpecification> valueSpecifications); @Override synchronized boolean triggerCycle(); @Override synchronized boolean requestCycle(); @Override void updateViewDefinition(final ViewDefinition viewDefinition); @Override void terminate(); @Override void join(); @Override boolean join(final long timeout); @Override boolean isTerminated(); @Override @Deprecated void forceGraphRebuild();  }
@Test public void testTriggerCycle() { TestLifecycle.begin(); try { final ViewProcessorTestEnvironment env = new ViewProcessorTestEnvironment(); env.init(); final ViewProcessorImpl vp = env.getViewProcessor(); vp.start(); final ViewClient client = vp.createViewClient(ViewProcessorTestEnvironment.TEST_USER); final TestViewResultListener resultListener = new TestViewResultListener(); client.setResultListener(resultListener); final EnumSet<ViewExecutionFlags> flags = ExecutionFlags.none().get(); final ViewExecutionOptions viewExecutionOptions = ExecutionOptions.infinite(MarketData.live(), flags); client.attachToViewProcess(env.getViewDefinition().getUniqueId(), viewExecutionOptions); final ViewProcessWorker worker = env.getCurrentWorker(env.getViewProcess(vp, client.getUniqueId())); resultListener.assertViewDefinitionCompiled(TIMEOUT); resultListener.assertCycleCompleted(TIMEOUT); worker.triggerCycle(); resultListener.assertCycleCompleted(TIMEOUT); client.shutdown(); } finally { TestLifecycle.end(); } }