Search in sources :

Example 11 with JobContent

use of org.ow2.proactive.scheduler.core.db.JobContent in project scheduling by ow2-proactive.

the class TestWorkflowReSubmission method testEmptyVarsEmptyInfo.

@Test
public void testEmptyVarsEmptyInfo() throws Throwable {
    JobId jobId = schedulerHelper.submitJob(new File(jobDescriptor.toURI()).getAbsolutePath());
    JobId jobId1 = schedulerHelper.getSchedulerInterface().reSubmit(jobId, Collections.emptyMap(), Collections.emptyMap(), null);
    schedulerHelper.waitForEventJobFinished(jobId);
    schedulerHelper.waitForEventJobFinished(jobId1);
    String jobContent = schedulerHelper.getSchedulerInterface().getJobContent(jobId);
    String jobContent1 = schedulerHelper.getSchedulerInterface().getJobContent(jobId1);
    assertEquals(jobContent, jobContent1);
    assertFalse(jobContent.contains("<variables>"));
    assertFalse(jobContent.contains("<genericInformation>"));
}
Also used : File(java.io.File) JobId(org.ow2.proactive.scheduler.common.job.JobId) Test(org.junit.Test)

Example 12 with JobContent

use of org.ow2.proactive.scheduler.core.db.JobContent in project scheduling by ow2-proactive.

the class TestWorkflowReSubmission method testAddVarsAddInfo.

@Test
public void testAddVarsAddInfo() throws Throwable {
    JobId jobId = schedulerHelper.submitJob(new File(jobDescriptor.toURI()).getAbsolutePath());
    Map<String, String> vars = new HashMap<>();
    vars.put("x", "50");
    JobId jobId1 = schedulerHelper.getSchedulerInterface().reSubmit(jobId, vars, vars, null);
    schedulerHelper.waitForEventJobFinished(jobId);
    schedulerHelper.waitForEventJobFinished(jobId1);
    String jobContent = schedulerHelper.getSchedulerInterface().getJobContent(jobId);
    String jobContent1 = schedulerHelper.getSchedulerInterface().getJobContent(jobId1);
    assertFalse(jobContent.contains("<variables>"));
    assertFalse(jobContent.contains("<genericInformation>"));
    assertTrue(jobContent1.contains("<variables>"));
    assertTrue(jobContent1.contains("<genericInformation>"));
}
Also used : HashMap(java.util.HashMap) File(java.io.File) JobId(org.ow2.proactive.scheduler.common.job.JobId) Test(org.junit.Test)

Example 13 with JobContent

use of org.ow2.proactive.scheduler.core.db.JobContent in project scheduling by ow2-proactive.

the class TestWorkflowReSubmission method testNullVarsNullInfo.

@Test
public void testNullVarsNullInfo() throws Throwable {
    JobId jobId = schedulerHelper.submitJob(new File(jobDescriptor.toURI()).getAbsolutePath());
    JobId jobId1 = schedulerHelper.getSchedulerInterface().reSubmit(jobId, null, null, null);
    schedulerHelper.waitForEventJobFinished(jobId);
    schedulerHelper.waitForEventJobFinished(jobId1);
    String jobContent = schedulerHelper.getSchedulerInterface().getJobContent(jobId);
    String jobContent1 = schedulerHelper.getSchedulerInterface().getJobContent(jobId1);
    assertEquals(jobContent, jobContent1);
    assertFalse(jobContent.contains("<variables>"));
    assertFalse(jobContent.contains("<genericInformation>"));
}
Also used : File(java.io.File) JobId(org.ow2.proactive.scheduler.common.job.JobId) Test(org.junit.Test)

Example 14 with JobContent

use of org.ow2.proactive.scheduler.core.db.JobContent in project scheduling by ow2-proactive.

the class TestWorkflowReSubmission method testAddInfo.

@Test
public void testAddInfo() throws Throwable {
    JobId jobId = schedulerHelper.submitJob(new File(jobDescriptor.toURI()).getAbsolutePath());
    Map<String, String> info = new HashMap<>();
    info.put("x", "50");
    JobId jobId1 = schedulerHelper.getSchedulerInterface().reSubmit(jobId, null, info, null);
    schedulerHelper.waitForEventJobFinished(jobId);
    schedulerHelper.waitForEventJobFinished(jobId1);
    String jobContent = schedulerHelper.getSchedulerInterface().getJobContent(jobId);
    String jobContent1 = schedulerHelper.getSchedulerInterface().getJobContent(jobId1);
    assertFalse(jobContent.contains("<variables>"));
    assertFalse(jobContent.contains("<genericInformation>"));
    assertFalse(jobContent1.contains("<variables>"));
    assertTrue(jobContent1.contains("<genericInformation>"));
}
Also used : HashMap(java.util.HashMap) File(java.io.File) JobId(org.ow2.proactive.scheduler.common.job.JobId) Test(org.junit.Test)

Example 15 with JobContent

use of org.ow2.proactive.scheduler.core.db.JobContent in project scheduling by ow2-proactive.

the class GetJobContentGeneratorTest method testReplaceVars.

@Test
public void testReplaceVars() throws IOException {
    URL url = Resources.getResource("org/ow2/proactive/scheduler/common/job/factories/job_with_vars_and_info.xml");
    String jobContent = Resources.toString(url, Charsets.UTF_8);
    Map<String, JobVariable> vars = new HashMap<>();
    vars.put("var", new JobVariable("var", "myvalue"));
    final String newJobContent = generator.replaceVarsAndGenericInfo(jobContent, vars, Collections.emptyMap());
    assertTrue(newJobContent.contains("<variables>"));
    assertTrue(newJobContent.contains("myvalue"));
    assertFalse(newJobContent.contains("<genericInformation>"));
    assertNotEquals(jobContent, newJobContent);
}
Also used : HashMap(java.util.HashMap) JobVariable(org.ow2.proactive.scheduler.common.job.JobVariable) URL(java.net.URL) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)8 JobId (org.ow2.proactive.scheduler.common.job.JobId)7 HashMap (java.util.HashMap)6 JobVariable (org.ow2.proactive.scheduler.common.job.JobVariable)6 File (java.io.File)5 IOException (java.io.IOException)4 LinkedHashMap (java.util.LinkedHashMap)4 Job (org.ow2.proactive.scheduler.common.job.Job)4 JobCreationException (org.ow2.proactive.scheduler.common.exception.JobCreationException)3 JobValidationException (org.ow2.proactive.scheduler.common.exception.JobValidationException)3 FileNotFoundException (java.io.FileNotFoundException)2 URL (java.net.URL)2 XMLStreamException (javax.xml.stream.XMLStreamException)2 DatabaseManagerException (org.ow2.proactive.db.DatabaseManagerException)2 TaskFlowJob (org.ow2.proactive.scheduler.common.job.TaskFlowJob)2 InternalJob (org.ow2.proactive.scheduler.job.InternalJob)2 ImmutableMap (com.google.common.collect.ImmutableMap)1 NonTerminatingJob (functionaltests.jobs.NonTerminatingJob)1 SimpleJob (functionaltests.jobs.SimpleJob)1 StringReader (java.io.StringReader)1