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);