PGETaskInstance implements WorkflowTaskInstance { protected void createOuputDirsIfRequested() throws PGEException { for (OutputDir outputDir : pgeConfig.getOuputDirs()) { if (outputDir.isCreateBeforeExe()) { logger.info("Creating PGE file ouput directory: [{}]", outputDir.getPath()); File dir = new File(outputDir.getPath()); if (!(dir.exists() || dir.mkdirs())) { logger.warn("Unable to create output dirs: {}", outputDir.getPath()); throw new PGEException("mkdir returned false for creating [" + outputDir.getPath() + "]"); } } } } protected  PGETaskInstance(); @Override void run(Metadata metadata, WorkflowTaskConfiguration config); String getWorkflowInstId(); void setWorkflowInstId(String workflowInstId); void setWmClient(WorkflowManagerClient wmClient); @Override void finalize();  }
@Test public void testCreateOuputDirsIfRequested() throws Exception { PGETaskInstance pgeTask = createTestInstance(); File outputDir1 = createTmpDir(); FileUtils.forceDelete(outputDir1); File outputDir2 = createTmpDir(); FileUtils.forceDelete(outputDir2); File outputDir3 = new File("/some/file/path"); assertFalse(outputDir1.exists()); assertFalse(outputDir2.exists()); assertFalse(outputDir3.exists()); pgeTask.pgeConfig.addOuputDirAndExpressions(new OutputDir(outputDir1 .getAbsolutePath(), true)); pgeTask.pgeConfig.addOuputDirAndExpressions(new OutputDir(outputDir2 .getAbsolutePath(), true)); pgeTask.pgeConfig.addOuputDirAndExpressions(new OutputDir(outputDir3 .getAbsolutePath(), false)); pgeTask.createOuputDirsIfRequested(); assertTrue(outputDir1.exists()); assertTrue(outputDir2.exists()); assertFalse(outputDir3.exists()); }