client.attachToViewProcess(env.getViewDefinition().getUniqueId(), ExecutionOptions.infinite(MarketData.live(), ExecutionFlags.none().get()));
resultListener.assertViewDefinitionCompiled(TIMEOUT);
resultListener.assertCycleStarted(TIMEOUT);
resultListener.assertCycleFragmentCompleted(TIMEOUT);
final ViewDeltaResultModel result1 = resultListener.getCycleCompleted(TIMEOUT).getDeltaResult();
assertNotNull(result1);
Map<ValueRequirement, Object> expected = new HashMap<ValueRequirement, Object>();
expected.put(ViewProcessorTestEnvironment.getPrimitive1(), 1);
expected.put(ViewProcessorTestEnvironment.getPrimitive2(), 2);
assertComputationResult(expected, env.getCalculationResult(result1));
client.pause();
// Just update one live data value, and only this one value should end up in the delta
marketDataProvider.addValue(ViewProcessorTestEnvironment.getPrimitive1(), 3);
assertEquals(0, resultListener.getQueueSize());
final ViewProcessImpl viewProcess = env.getViewProcess(vp, client.getUniqueId());
env.getCurrentWorker(viewProcess).requestCycle();
// Should have been merging results received in the meantime
resultListener.assertNoCalls(TIMEOUT);
client.resume();
resultListener.assertCycleStarted(TIMEOUT);
resultListener.assertCycleFragmentCompleted(TIMEOUT);
final ViewDeltaResultModel result2 = resultListener.getCycleCompleted(TIMEOUT).getDeltaResult();
expected = new HashMap<ValueRequirement, Object>();
expected.put(ViewProcessorTestEnvironment.getPrimitive1(), 3);
assertComputationResult(expected, env.getCalculationResult(result2));
}