String attachmentDirWithVariable = tempDirBase + File.separator + "${" + attachmentVariableName + "}"; entry.setOutputDirectory( outputDirWithVariable ); entry.setAttachmentFolder( attachmentDirWithVariable );
entry.setOutputDirectory( outputDir.getAbsolutePath() ); entry.setDifferentFolderForAttachment( true ); entry.setAttachmentFolder( attachmentsDir.getAbsolutePath() );
/** * PDI-11943 - Get Mail Job Entry: Attachments folder not created * * Test that the Attachments folder is created when the entry is * configured to save attachments and messages in different folders * * @throws IOException */ @Test public void testCreateDifferentAttachmentsFolder() throws IOException { File outputDir = new File( TestUtils.createTempDir() ); File attachmentsDir = new File( TestUtils.createTempDir() ); entry.setCreateLocalFolder( true ); entry.setSaveAttachment( true ); entry.setOutputDirectory( outputDir.getAbsolutePath() ); entry.setDifferentFolderForAttachment( true ); entry.setAttachmentFolder( attachmentsDir.getAbsolutePath() ); String outputFolderName = ""; String attachmentsFolderName = ""; try { outputFolderName = entry.createOutputDirectory( JobEntryGetPOP.FOLDER_OUTPUT ); attachmentsFolderName = entry.createOutputDirectory( JobEntryGetPOP.FOLDER_ATTACHMENTS ); } catch ( Exception e ) { fail( "Could not create folder: " + e.getLocalizedMessage() ); } assertTrue( "Output Folder should be a local path", !Utils.isEmpty( outputFolderName ) ); assertTrue( "Attachment Folder should be a local path", !Utils.isEmpty( attachmentsFolderName ) ); assertFalse( "Output and Attachment Folder should not match", outputFolderName.equals( attachmentsFolderName ) ); }
jobEntry.setSaveMessage( wGetMessage.getSelection() ); jobEntry.setDifferentFolderForAttachment( wDifferentFolderForAttachment.getSelection() ); jobEntry.setAttachmentFolder( wAttachmentFolder.getText() ); jobEntry.setPort( wPort.getText() ); jobEntry.setOutputDirectory( wOutputDirectory.getText() );