Search in sources :

Example 1 with JobServerContext

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);
}
Also used : PlanDefinitionRegistry(alluxio.job.plan.PlanDefinitionRegistry) JobServerContext(alluxio.job.JobServerContext) Serializable(java.io.Serializable) CommandManager(alluxio.master.job.command.CommandManager) UfsManager(alluxio.underfs.UfsManager) FileSystem(alluxio.client.file.FileSystem) FileSystemContext(alluxio.client.file.FileSystemContext) WorkerInfo(alluxio.wire.WorkerInfo) JobConfig(alluxio.job.JobConfig) Before(org.junit.Before)

Example 2 with JobServerContext

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));
}
Also used : JobServerContext(alluxio.job.JobServerContext) FileSystem(alluxio.client.file.FileSystem) FileSystemContext(alluxio.client.file.FileSystemContext) AlluxioBlockStore(alluxio.client.block.AlluxioBlockStore) AlluxioURI(alluxio.AlluxioURI) Before(org.junit.Before)

Example 3 with JobServerContext

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);
}
Also used : JobMasterClient(alluxio.worker.job.JobMasterClient) TaskExecutorManager(alluxio.worker.job.task.TaskExecutorManager) JobServerContext(alluxio.job.JobServerContext) UfsManager(alluxio.underfs.UfsManager) WorkerNetAddress(alluxio.wire.WorkerNetAddress) FileSystem(alluxio.client.file.FileSystem) CommandHandlingExecutor(alluxio.worker.job.command.CommandHandlingExecutor) FileSystemContext(alluxio.client.file.FileSystemContext) Before(org.junit.Before)

Example 4 with JobServerContext

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));
}
Also used : JobServerContext(alluxio.job.JobServerContext) FileSystem(alluxio.client.file.FileSystem) FileSystemContext(alluxio.client.file.FileSystemContext) AlluxioBlockStore(alluxio.client.block.AlluxioBlockStore) AlluxioURI(alluxio.AlluxioURI) Before(org.junit.Before)

Example 5 with JobServerContext

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))));
}
Also used : JobServerContext(alluxio.job.JobServerContext) UfsManager(alluxio.underfs.UfsManager) FileInfo(alluxio.wire.FileInfo) BlockInfo(alluxio.wire.BlockInfo) FileBlockInfo(alluxio.wire.FileBlockInfo) FileSystem(alluxio.client.file.FileSystem) FileSystemContext(alluxio.client.file.FileSystemContext) AlluxioBlockStore(alluxio.client.block.AlluxioBlockStore) URIStatus(alluxio.client.file.URIStatus) FileBlockInfo(alluxio.wire.FileBlockInfo) Before(org.junit.Before)

Aggregations

JobServerContext (alluxio.job.JobServerContext)9 FileSystem (alluxio.client.file.FileSystem)7 FileSystemContext (alluxio.client.file.FileSystemContext)7 Before (org.junit.Before)7 AlluxioBlockStore (alluxio.client.block.AlluxioBlockStore)5 AlluxioURI (alluxio.AlluxioURI)3 UfsManager (alluxio.underfs.UfsManager)3 URIStatus (alluxio.client.file.URIStatus)2 Pair (alluxio.collections.Pair)2 SelectExecutorsContext (alluxio.job.SelectExecutorsContext)2 SelectExecutorsTest (alluxio.job.plan.SelectExecutorsTest)2 WorkerInfo (alluxio.wire.WorkerInfo)2 Test (org.junit.Test)2 JobConfig (alluxio.job.JobConfig)1 PlanDefinitionRegistry (alluxio.job.plan.PlanDefinitionRegistry)1 CommandManager (alluxio.master.job.command.CommandManager)1 BlockInfo (alluxio.wire.BlockInfo)1 FileBlockInfo (alluxio.wire.FileBlockInfo)1 FileInfo (alluxio.wire.FileInfo)1 WorkerNetAddress (alluxio.wire.WorkerNetAddress)1