String outputRes = entry.createOutputDirectory( JobEntryGetPOP.FOLDER_OUTPUT ); assertTrue( "Variables not working in createOutputDirectory: output directory", outputRes.equals( outputDir.toString() ) ); String attachOutputRes = entry.createOutputDirectory( JobEntryGetPOP.FOLDER_ATTACHMENTS ); assertTrue( "Variables not working in createOutputDirectory: attachment with options false", attachOutputRes.equals( outputDir.toString() ) ); String attachRes = entry.createOutputDirectory( JobEntryGetPOP.FOLDER_ATTACHMENTS ); assertTrue( "Variables not working in createOutputDirectory: attachment with options true", attachRes.equals( outputDir.toString() ) );
/** * 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 the same folder * * @throws IOException */ @Test public void testCreateSameAttachmentsFolder() throws IOException { File attachmentsDir = new File( TestUtils.createTempDir() ); attachmentsDir.deleteOnExit(); entry.setCreateLocalFolder( true ); entry.setSaveAttachment( true ); entry.setOutputDirectory( attachmentsDir.getAbsolutePath() ); entry.setDifferentFolderForAttachment( false ); 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 ) ); assertTrue( "Output and Attachment Folder should match", outputFolderName.equals( attachmentsFolderName ) ); }
/** * 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 ) ); }
entry.createOutputDirectory( JobEntryGetPOP.FOLDER_OUTPUT ); fail( "A KettleException should have been thrown" ); } catch ( Exception e ) { entry.createOutputDirectory( JobEntryGetPOP.FOLDER_ATTACHMENTS ); fail( "A KettleException should have been thrown" ); } catch ( Exception e ) {
getFirstIMAPMails(), 0 ); String realOutputFolder = createOutputDirectory( JobEntryGetPOP.FOLDER_OUTPUT ); String targetAttachmentFolder = createOutputDirectory( JobEntryGetPOP.FOLDER_ATTACHMENTS );