ZipExportProcessor extends BaseExportProcessor { protected String getFixedZipEntryName( RepositoryFile repositoryFile, String filePath ) { String result = getZipEntryName( repositoryFile, filePath ); if ( this.withManifest ) { result = ExportFileNameEncoder.encodeZipPathName( result ); } return result; } ZipExportProcessor( String path, IUnifiedRepository repository, boolean withManifest ); File performExport( RepositoryFile exportRepositoryFile ); void exportFile( RepositoryFile repositoryFile, OutputStream outputStream, String filePath ); @Override void exportDirectory( RepositoryFile repositoryDir, OutputStream outputStream, String filePath ); List<String> getLocaleExportList(); void setLocaleExportList( List<String> localeExportList ); ExportManifest getExportManifest(); void setExportManifest( ExportManifest exportManifest );  }
@Test public void testGetFixedZipEntryName() { IUnifiedRepository repo = mock( IUnifiedRepository.class ); final String fileName = "eval (+)%.prpt"; final String filePath = "/home/test user/two words/eval (+)%.prpt"; String processorBasePath = "/home/test user"; ZipExportProcessor zipMF = new ZipExportProcessor( processorBasePath, repo, true ); ZipExportProcessor zipNoMF = new ZipExportProcessor( processorBasePath, repo, false ); String basePath = "/home/test user"; String simpleZipEntryName = "two words/eval (+)%.prpt"; String encodedZipEntryName = "two+words/eval+%28%2B%29%25.prpt"; RepositoryFile file = null; file = new RepositoryFile.Builder( fileName ).path( filePath ).folder( false ).build(); assertEquals( simpleZipEntryName, zipNoMF.getFixedZipEntryName( file, basePath ) ); assertEquals( encodedZipEntryName, zipMF.getFixedZipEntryName( file, basePath ) ); file = new RepositoryFile.Builder( fileName ).path( filePath ).folder( true ).build(); assertEquals( simpleZipEntryName + "/", zipNoMF.getFixedZipEntryName( file, basePath ) ); assertEquals( encodedZipEntryName + "/", zipMF.getFixedZipEntryName( file, basePath ) ); basePath = "/"; simpleZipEntryName = "home/test user/two words/eval (+)%.prpt"; encodedZipEntryName = "home/test+user/two+words/eval+%28%2B%29%25.prpt"; file = new RepositoryFile.Builder( fileName ).path( filePath ).folder( false ).build(); assertEquals( simpleZipEntryName, zipNoMF.getFixedZipEntryName( file, basePath ) ); assertEquals( encodedZipEntryName, zipMF.getFixedZipEntryName( file, basePath ) ); file = new RepositoryFile.Builder( fileName ).path( filePath ).folder( true ).build(); assertEquals( simpleZipEntryName + "/", zipNoMF.getFixedZipEntryName( file, basePath ) ); assertEquals( encodedZipEntryName + "/", zipMF.getFixedZipEntryName( file, basePath ) ); basePath = ""; simpleZipEntryName = "home/test user/two words/eval (+)%.prpt"; encodedZipEntryName = "home/test+user/two+words/eval+%28%2B%29%25.prpt"; file = new RepositoryFile.Builder( fileName ).path( filePath ).folder( false ).build(); assertEquals( simpleZipEntryName, zipNoMF.getFixedZipEntryName( file, basePath ) ); assertEquals( encodedZipEntryName, zipMF.getFixedZipEntryName( file, basePath ) ); file = new RepositoryFile.Builder( fileName ).path( filePath ).folder( true ).build(); assertEquals( simpleZipEntryName + "/", zipNoMF.getFixedZipEntryName( file, basePath ) ); assertEquals( encodedZipEntryName + "/", zipMF.getFixedZipEntryName( file, basePath ) ); }