diff --git a/src/test/java/cloudgene/mapred/jobs/WorkflowEngineTest.java b/src/test/java/cloudgene/mapred/jobs/WorkflowEngineTest.java index b54b3b21..f59df19f 100644 --- a/src/test/java/cloudgene/mapred/jobs/WorkflowEngineTest.java +++ b/src/test/java/cloudgene/mapred/jobs/WorkflowEngineTest.java @@ -8,6 +8,7 @@ import java.util.List; import java.util.Map; +import cloudgene.mapred.jobs.workspace.IWorkspace; import org.junit.jupiter.api.Test; import cloudgene.mapred.TestApplication; @@ -470,10 +471,10 @@ public void testWriteTextToStdOutStep() throws Exception { assertEquals(AbstractJob.STATE_SUCCESS, job.getState()); - String stdout = FileUtil.path(application.getSettings().getLocalWorkspace(), job.getId(), "std.out"); + String stdout = FileUtil.path(application.getSettings().getLocalWorkspace(), job.getId(), "logs", "std.out"); String contentStdOut = FileUtil.readFileAsString(stdout); - String log = FileUtil.path(application.getSettings().getLocalWorkspace(), job.getId(), "job.txt"); + String log = FileUtil.path(application.getSettings().getLocalWorkspace(), job.getId(), "logs", "job.txt"); String contentlog = FileUtil.readFileAsString(log); assertTrue(contentStdOut.contains("taks write to system out")); @@ -670,10 +671,16 @@ public CloudgeneJob createJobFromWdl(WdlApp app, Map inputs, Use String localWorkspace = FileUtil.path(settings.getLocalWorkspace(), id); FileUtil.createDirectory(localWorkspace); + + // setup workspace + IWorkspace workspace = workspaceFactory.getDefault(); + workspace.setJob(id); + workspace.setup(); + CloudgeneJob job = new CloudgeneJob(user, id, app, inputs); job.setId(id); job.setName(id); - job.setWorkspace(workspaceFactory.getDefault()); + job.setWorkspace(workspace); job.setLocalWorkspace(localWorkspace); job.setSettings(settings); job.setApplication(app.getName() + " " + app.getVersion()); diff --git a/src/test/java/cloudgene/mapred/steps/TestCommand.java b/src/test/java/cloudgene/mapred/steps/TestCommand.java index b4fc62a2..5743c199 100644 --- a/src/test/java/cloudgene/mapred/steps/TestCommand.java +++ b/src/test/java/cloudgene/mapred/steps/TestCommand.java @@ -7,6 +7,7 @@ import java.util.List; import java.util.Map; +import cloudgene.mapred.jobs.workspace.IWorkspace; import org.junit.jupiter.api.Test; import cloudgene.mapred.TestApplication; @@ -57,13 +58,13 @@ public void testValidCommand() throws Exception { assertEquals(messages.get(0).getType(), WorkflowContext.OK); assertTrue(messages.get(0).getMessage().contains("Execution successful.")); - String stdout = FileUtil.path(application.getSettings().getLocalWorkspace(), job.getId(), "std.out"); + String stdout = FileUtil.path(application.getSettings().getLocalWorkspace(), job.getId(), "logs", "std.out"); String contentStdOut = FileUtil.readFileAsString(stdout); // simple ls result check assertTrue(contentStdOut.contains("invalid-command.yaml")); - String jobLog = FileUtil.path(application.getSettings().getLocalWorkspace(), job.getId(), "job.txt"); + String jobLog = FileUtil.path(application.getSettings().getLocalWorkspace(), job.getId(), "logs", "job.txt"); String contentjobLog = FileUtil.readFileAsString(jobLog); // simple check if exit code = 0 @@ -139,9 +140,14 @@ public CloudgeneJob createJobFromWdl(WdlApp app, Map inputs) thr String localWorkspace = FileUtil.path(settings.getLocalWorkspace(), id); FileUtil.createDirectory(localWorkspace); + // setup workspace + IWorkspace workspace = workspaceFactory.getDefault(); + workspace.setJob(id); + workspace.setup(); + CloudgeneJob job = new CloudgeneJob(user, id, app, inputs); job.setId(id); - job.setWorkspace(workspaceFactory.getDefault()); + job.setWorkspace(workspace); job.setName(id); job.setLocalWorkspace(localWorkspace); job.setSettings(settings);