use of alluxio.job.plan.PlanDefinitionRegistry in project alluxio by Alluxio.
the class PlanCoordinatorTest method before.
@Before
public void before() throws Exception {
mCommandManager = new CommandManager();
// Create mock JobServerContext
FileSystem fs = mock(FileSystem.class);
FileSystemContext fsCtx = PowerMockito.mock(FileSystemContext.class);
UfsManager ufsManager = Mockito.mock(UfsManager.class);
mJobServerContext = new JobServerContext(fs, fsCtx, ufsManager);
// Create mock job info.
mJobconfig = Mockito.mock(JobConfig.class, Mockito.withSettings().serializable());
Mockito.when(mJobconfig.getName()).thenReturn("mock");
mJobId = 1;
// Create mock job definition.
@SuppressWarnings("unchecked") PlanDefinition<JobConfig, Serializable, Serializable> mockPlanDefinition = Mockito.mock(PlanDefinition.class);
PlanDefinitionRegistry singleton = PowerMockito.mock(PlanDefinitionRegistry.class);
Whitebox.setInternalState(PlanDefinitionRegistry.class, "INSTANCE", singleton);
Mockito.when(singleton.getJobDefinition(mJobconfig)).thenReturn(mockPlanDefinition);
mPlanDefinition = mockPlanDefinition;
// Create test worker.
mWorkerInfo = new WorkerInfo();
mWorkerInfo.setId(0);
mWorkerInfoList = Lists.newArrayList(mWorkerInfo);
}
Aggregations