- assertThat(nextCommand.getCommand().getType(), is(new WatchingCommand().getType()));
- assertThat(nextCommand.getCommand().getData().get("childrenJobs"), is(Arrays.asList(uuid1.toString(), uuid2.toString(), uuid3.toString())));
- assertThat(nextCommand.getCommand().getData().get("isService"), is(true));
- }
-
- @Test(dataProvider = "processJobStatusData")
- public void processJobStatusTest(Job.JobStatus jobStatus, boolean isNeedToCreateChildJobs, Job.JobStatus expectedStatus) {
-
- when(featureManager.isActive(Features.FLAG_ASYNC_ALACARTE_VNF)).thenReturn(true);
- // All mocks under are used for isNeedToCreateChildJobs=true case
- when(sharedData.getRequest()).thenReturn(request);
- when(request.isALaCarte()).thenReturn(true);
- Map vnfs = mock(Map.class);
- ModelInfo modelInfo = mock(ModelInfo.class);
-
- // if vnfs.isEmpty -> isNeedToCreateChildJobs will return false
- when(vnfs.isEmpty()).thenReturn(!isNeedToCreateChildJobs);
-
- when(request.getVnfs()).thenReturn(vnfs);
- when(request.getModelInfo()).thenReturn(modelInfo);
- command.instanceId = "MockInstId";
-
- NextCommand nextCommand = command.processJobStatus(jobStatus);
- Assert.assertEquals(nextCommand.getStatus(), expectedStatus);
- if (isNeedToCreateChildJobs) {
- Assert.assertEquals(nextCommand.getCommand().getClass(), WatchingCommand.class);
- } else {
- Assert.assertEquals(nextCommand.getCommand(), command);
- }
+ assertThat(nextCommand.getCommand().getType(), is(JobType.ALaCarteService));
+ assertThat(nextCommand.getCommand().getData().get(CHILD_JOBS), is(Arrays.asList(uuid1.toString(), uuid2.toString(), uuid3.toString())));