use of alluxio.job.JobServerContext 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);
}
use of alluxio.job.JobServerContext in project alluxio by Alluxio.
the class BatchedJobDefinitionTest method before.
@Before
public void before() throws Exception {
mMockFileSystem = PowerMockito.mock(FileSystem.class);
mMockBlockStore = PowerMockito.mock(AlluxioBlockStore.class);
mMockFsContext = PowerMockito.mock(FileSystemContext.class);
PowerMockito.mockStatic(AlluxioBlockStore.class);
PowerMockito.when(AlluxioBlockStore.create(any(FileSystemContext.class))).thenReturn(mMockBlockStore);
Mockito.when(mMockFsContext.getCachedWorkers()).thenReturn(BLOCK_WORKERS);
PowerMockito.when(mMockFsContext.getClientContext()).thenReturn(ClientContext.create(ServerConfiguration.global()));
PowerMockito.when(mMockFsContext.getClusterConf()).thenReturn(ServerConfiguration.global());
PowerMockito.when(mMockFsContext.getPathConf(any(AlluxioURI.class))).thenReturn(ServerConfiguration.global());
mJobServerContext = new JobServerContext(mMockFileSystem, mMockFsContext, Mockito.mock(UfsManager.class));
}
use of alluxio.job.JobServerContext in project alluxio by Alluxio.
the class CommandHandlingExecutorTest method before.
@Before
public void before() {
mWorkerId = 0;
mJobMasterClient = Mockito.mock(JobMasterClient.class);
mTaskExecutorManager = PowerMockito.mock(TaskExecutorManager.class);
WorkerNetAddress workerNetAddress = PowerMockito.mock(WorkerNetAddress.class);
mUfsManager = Mockito.mock(UfsManager.class);
mFileSystemContext = Mockito.mock(FileSystemContext.class);
mFileSystem = Mockito.mock(FileSystem.class);
JobServerContext ctx = new JobServerContext(mFileSystem, mFileSystemContext, mUfsManager);
mCommandHandlingExecutor = new CommandHandlingExecutor(ctx, mTaskExecutorManager, mJobMasterClient, workerNetAddress);
}
use of alluxio.job.JobServerContext in project alluxio by Alluxio.
the class LoadDefinitionTest method before.
@Before
public void before() throws Exception {
mMockFileSystem = PowerMockito.mock(FileSystem.class);
mMockBlockStore = PowerMockito.mock(AlluxioBlockStore.class);
mMockFsContext = PowerMockito.mock(FileSystemContext.class);
PowerMockito.mockStatic(AlluxioBlockStore.class);
PowerMockito.when(AlluxioBlockStore.create(any(FileSystemContext.class))).thenReturn(mMockBlockStore);
Mockito.when(mMockFsContext.getCachedWorkers()).thenReturn(BLOCK_WORKERS);
PowerMockito.when(mMockFsContext.getClientContext()).thenReturn(ClientContext.create(ServerConfiguration.global()));
PowerMockito.when(mMockFsContext.getClusterConf()).thenReturn(ServerConfiguration.global());
PowerMockito.when(mMockFsContext.getPathConf(any(AlluxioURI.class))).thenReturn(ServerConfiguration.global());
mJobServerContext = new JobServerContext(mMockFileSystem, mMockFsContext, Mockito.mock(UfsManager.class));
}
use of alluxio.job.JobServerContext in project alluxio by Alluxio.
the class ReplicateDefinitionTest method before.
@Before
public void before() throws Exception {
mMockFileSystemContext = PowerMockito.mock(FileSystemContext.class);
when(mMockFileSystemContext.getClientContext()).thenReturn(ClientContext.create(ServerConfiguration.global()));
when(mMockFileSystemContext.getClusterConf()).thenReturn(ServerConfiguration.global());
mMockBlockStore = PowerMockito.mock(AlluxioBlockStore.class);
mMockFileSystem = mock(FileSystem.class);
mMockUfsManager = mock(UfsManager.class);
mMockJobServerContext = new JobServerContext(mMockFileSystem, mMockFileSystemContext, mMockUfsManager);
PowerMockito.mockStatic(AlluxioBlockStore.class);
when(AlluxioBlockStore.create(mMockFileSystemContext)).thenReturn(mMockBlockStore);
mTestBlockInfo = new BlockInfo().setBlockId(TEST_BLOCK_ID).setLength(TEST_BLOCK_SIZE);
when(mMockBlockStore.getInfo(TEST_BLOCK_ID)).thenReturn(mTestBlockInfo);
mTestStatus = new URIStatus(new FileInfo().setPath(TEST_PATH).setBlockIds(Lists.newArrayList(TEST_BLOCK_ID)).setPersisted(true).setFileBlockInfos(Lists.newArrayList(new FileBlockInfo().setBlockInfo(mTestBlockInfo))));
}
Aggregations