use of org.ow2.proactive.scheduler.job.JobIdImpl in project scheduling by ow2-proactive.
the class SchedulerStateRestJobTaskResultTest method testValueOfJobResult.
@Test
public void testValueOfJobResult() throws Throwable {
TaskResultImpl taskResult = new TaskResultImpl(TaskIdImpl.createTaskId(JobIdImpl.makeJobId("42"), "mytask", 1), ObjectToByteConverter.ObjectStream.convert("hello"), null, null, false);
JobResultImpl jobResultWithValue = new JobResultImpl();
JobInfoImpl jobInfo = new JobInfoImpl();
jobInfo.setJobId(new JobIdImpl(12, "myjob"));
jobResultWithValue.setJobInfo(jobInfo);
jobResultWithValue.addTaskResult("mytask", taskResult, false);
when(mockOfScheduler.getJobResult("42")).thenReturn(jobResultWithValue);
JobResultData jobResultData = restInterface.jobResult(sessionId, "42");
TaskResultData taskResultData = jobResultData.getAllResults().get("mytask");
assertNotNull(taskResultData);
assertNotNull(taskResultData.getValue());
assertEquals("hello", taskResultData.getValue());
Map<String, String> jobResult = restInterface.jobResultValue(sessionId, "42");
String result = jobResult.get("mytask");
assertNotNull(result);
assertEquals("hello", result);
}
use of org.ow2.proactive.scheduler.job.JobIdImpl in project scheduling by ow2-proactive.
the class NoVncSecuredTargetResolverTest method testMagicStringFoundInLiveLogs.
@Test
public void testMagicStringFoundInLiveLogs() throws Exception {
String sessionId = SharedSessionStoreTestUtils.createValidSession(schedulerMock);
SharedSessionStore.getInstance().get(sessionId).getJobsOutputController().addJobOutputAppender("42", createLiveLogs("[Visualization_task@node2;10:38:06]PA_REMOTE_CONNECTION;42;1;vnc;node.grid.com:5900"));
when(schedulerMock.getTaskResult("42", "remoteVisuTask")).thenReturn(new TaskResultImpl(TaskIdImpl.createTaskId(new JobIdImpl(42, "job"), "remoteVisuTask", 1), new byte[0], new byte[0], new SimpleTaskLogs("", ""), true));
InetSocketAddress targetVncHost = new NoVncSecuredTargetResolver().doResolve(sessionId, "42", "remoteVisuTask");
assertEquals(5900, targetVncHost.getPort());
assertEquals("node.grid.com", targetVncHost.getHostName());
}
use of org.ow2.proactive.scheduler.job.JobIdImpl in project scheduling by ow2-proactive.
the class NoVncSecuredTargetResolverTest method testMagicStringFoundInLogs.
@Test
public void testMagicStringFoundInLogs() throws Exception {
String sessionId = SharedSessionStoreTestUtils.createValidSession(schedulerMock);
when(schedulerMock.getTaskResult("42", "remoteVisuTask")).thenReturn(new TaskResultImpl(TaskIdImpl.createTaskId(new JobIdImpl(42, "job"), "remoteVisuTask", 1), new byte[0], new byte[0], new SimpleTaskLogs("PA_REMOTE_CONNECTION;42;1;vnc;node.grid.com:5900", ""), true));
InetSocketAddress targetVncHost = new NoVncSecuredTargetResolver().doResolve(sessionId, "42", "remoteVisuTask");
assertEquals(5900, targetVncHost.getPort());
assertEquals("node.grid.com", targetVncHost.getHostName());
}
use of org.ow2.proactive.scheduler.job.JobIdImpl in project scheduling by ow2-proactive.
the class SchedulerFrontendStateTest method getIdentifiedJobTest.
@Test
public void getIdentifiedJobTest() throws Exception {
SchedulerJMXHelper mockJMX = mock(SchedulerJMXHelper.class);
when(mockJMX.getSchedulerRuntimeMBean()).thenReturn(new RuntimeDataMBeanImpl(null));
SchedulerStateImpl<ClientJobState> schedulerStateImpl = new SchedulerStateImpl<>();
JobIdImpl jobId = new JobIdImpl(1234L, "job name");
ClientJobState jobState = mock(ClientJobState.class);
when(jobState.getId()).thenReturn(jobId);
schedulerStateImpl.setFinishedJobs(new Vector(Lists.newArrayList(jobState)));
final SchedulerFrontendState schedulerFrontendState = new SchedulerFrontendState(schedulerStateImpl, mockJMX);
assertEquals(schedulerFrontendState.getIdentifiedJob(jobId).getJobId(), (jobId));
}
use of org.ow2.proactive.scheduler.job.JobIdImpl in project scheduling by ow2-proactive.
the class SchedulerFrontendTest method init.
@Before
public void init() {
MockitoAnnotations.initMocks(this);
this.schedulerFrontend = new SchedulerFrontend(frontendState, spacesSupport);
this.jobId = new JobIdImpl(123L, "readableName");
}
Aggregations