assertFalse(adj2.getCacheSelectHint().isPrivateValue(VS_B));
assertFalse(adj2.getCacheSelectHint().isPrivateValue(VS_C));
}
public void testStandardJob_WholeWatchedJob() {
final CalculationJob job1 = new CalculationJob(createJobSpecification(), 0, VersionCorrection.LATEST, null, Arrays.asList(JOB_ITEM_A), CacheSelectHint.allShared());
final CalculationJob job2 = new CalculationJob(createJobSpecification(), 0, VersionCorrection.LATEST, new long[] {job1.getSpecification().getJobId() }, Arrays.asList(JOB_ITEM_AB),
CacheSelectHint.allShared());
job1.addTail(job2);
final CalculationJob job3 = new CalculationJob(createJobSpecification(), 0, VersionCorrection.LATEST, new long[] {job1.getSpecification().getJobId() }, Arrays.asList(JOB_ITEM_AC),
CacheSelectHint.allShared());
job1.addTail(job3);
final CalculationJob job4 = new CalculationJob(createJobSpecification(), 0, VersionCorrection.LATEST, new long[] {job2.getSpecification().getJobId(), job3.getSpecification().getJobId() },
Arrays.asList(JOB_ITEM_BCD), CacheSelectHint.allShared());
job3.addTail(job4);
final JobResultReceiver receiver = Mockito.mock(JobResultReceiver.class);
final Queue<DispatchableJob> dispatched = new LinkedList<DispatchableJob>();
final JobDispatcher dispatcher = new JobDispatcher() {
@Override
protected void dispatchJobImpl(final DispatchableJob job) {
dispatched.add(job);
}
};
final StandardJob parent = new StandardJob(dispatcher, job1, receiver);
final WholeWatchedJob wjob1 = parent.createWholeWatchedJob(job1);
final CalculationJobResult result1 = new CalculationJobResult(job1.getSpecification(), 0, Arrays.asList(CalculationJobResultItem.success()), "Test");
wjob1.getResultReceiver(result1).resultReceived(result1);
Mockito.verify(receiver).resultReceived(result1);
Mockito.reset();
assertEquals(dispatched.size(), 2);
final WholeWatchedJob wjob2 = (WholeWatchedJob) dispatched.poll();
final WholeWatchedJob wjob3 = (WholeWatchedJob) dispatched.poll();
final CalculationJobResult result2 = new CalculationJobResult(job2.getSpecification(), 0, Arrays.asList(CalculationJobResultItem.success()), "Test");
final CalculationJobResult result3 = new CalculationJobResult(job3.getSpecification(), 0, Arrays.asList(CalculationJobResultItem.success()), "Test");
wjob3.getResultReceiver(result3).resultReceived(result3);
Mockito.verify(receiver).resultReceived(result3);
Mockito.reset();
assertEquals(dispatched.size(), 0);
wjob2.getResultReceiver(result2).resultReceived(result2);
Mockito.verify(receiver).resultReceived(result2);
Mockito.reset();
assertEquals(dispatched.size(), 1);
final WholeWatchedJob wjob4 = (WholeWatchedJob) dispatched.poll();
final CalculationJobResult result4 = new CalculationJobResult(job4.getSpecification(), 0, Arrays.asList(CalculationJobResultItem.success()), "Test");
wjob4.getResultReceiver(result4).resultReceived(result4);
Mockito.verify(receiver).resultReceived(result4);
Mockito.reset();
}