PRPTImportHandler extends RepositoryFileImportFileHandler implements IPlatformImportHandler { @Override public void importFile( IPlatformImportBundle bundle ) throws PlatformImportException { RepositoryFileImportBundle importBundle = (RepositoryFileImportBundle) bundle; LocaleFilesProcessor localeFilesProcessor = new LocaleFilesProcessor(); IPlatformImporter importer = PentahoSystem.get( IPlatformImporter.class ); String fileName = importBundle.getName(); String filePath = ( importBundle.getPath().equals( "/" ) || importBundle.getPath().equals( "\\" ) ) ? "" : importBundle.getPath(); try { byte[] bytes = IOUtils.toByteArray( bundle.getInputStream() ); InputStream bundleInputStream = new ByteArrayInputStream( bytes ); importBundle.setInputStream( bundleInputStream ); DocumentMetaData documentMetaData = extractMetaData( bytes ); fillLocaleEntry( localeFilesProcessor, documentMetaData, filePath, fileName, importBundle.getFile() ); importBundle.setHidden( this.getMimeTypeMap().get( importBundle.getMimeType() ).isHidden() ); super.importFile( importBundle ); localeFilesProcessor.processLocaleFiles( importer ); } catch ( Exception ex ) { throw new PlatformImportException( ex.getMessage(), ex ); } } PRPTImportHandler( List<IMimeType> mimeTypes ); @Override void importFile( IPlatformImportBundle bundle );  }
@Test( expected = PlatformImportException.class ) public void testImportFile_ErrorRecivingMetadata() throws Exception { when( bundle.getPath() ).thenReturn( SAMPLE_USER_PATH ); handler.importFile( bundle ); }