@Test public void test_getFilesByTagResponse_from_FileInfo() throws Exception { FileLocation fileLocation1 = new FileLocation(FILE_STORE_ID_1, MODULE, TAG, TENANT_ID,FILENAME,FILE_SOURCE); FileLocation fileLocation2 = new FileLocation(FILE_STORE_ID_2, MODULE, TAG, TENANT_ID,FILENAME,FILE_SOURCE); FileInfo fileInfo1 = new FileInfo(CONTENT_TYPE_1, fileLocation1, TENANT_ID); FileInfo fileInfo2 = new FileInfo(CONTENT_TYPE_2, fileLocation2, TENANT_ID); List<FileInfo> listOfFileInfo = asList(fileInfo1, fileInfo2); GetFilesByTagResponse result = responseFactory.getFilesByTagResponse(listOfFileInfo); assertThat(result.getFiles().get(0).getContentType()).isEqualTo(CONTENT_TYPE_1); assertThat(result.getFiles().get(0).getUrl()).isEqualTo ("/fileStore/v1/files/id?fileStoreId=FileStoreID1&tenantId=default"); assertThat(result.getFiles().get(1).getContentType()).isEqualTo(CONTENT_TYPE_2); assertThat(result.getFiles().get(1).getUrl()).isEqualTo ("/fileStore/v1/files/id?fileStoreId=FileStoreID2&tenantId=default"); }
public GetFilesByTagResponse getFilesByTagResponse(List<FileInfo> listOfFileInfo) { List<FileRecord> fileRecords = listOfFileInfo.stream().map(fileInfo -> { String url = String.format(FORMAT, contextPath, fileInfo.getFileLocation().getFileStoreId(), fileInfo.getTenantId()); return new FileRecord(url, fileInfo.getContentType()); }).collect(Collectors.toList()); return new GetFilesByTagResponse(fileRecords); }
ResponseFactory { public GetFilesByTagResponse getFilesByTagResponse(List<FileInfo> listOfFileInfo) { List<FileRecord> fileRecords = listOfFileInfo.stream().map(fileInfo -> { String url = String.format(FORMAT, contextPath, fileInfo.getFileLocation().getFileStoreId(), fileInfo.getTenantId()); return new FileRecord(url, fileInfo.getContentType()); }).collect(Collectors.toList()); return new GetFilesByTagResponse(fileRecords); } }
ResponseFactory { public GetFilesByTagResponse getFilesByTagResponse(List<FileInfo> listOfFileInfo) { List<FileRecord> fileRecords = listOfFileInfo.stream().map(fileInfo -> { String url = String.format(FORMAT, contextPath, fileInfo.getFileLocation().getFileStoreId(), fileInfo.getTenantId()); return new FileRecord(url, fileInfo.getContentType()); }).collect(Collectors.toList()); return new GetFilesByTagResponse(fileRecords); } ResponseFactory(@Value("${server.contextPath}") String contextPath); }
ResponseFactory { public GetFilesByTagResponse getFilesByTagResponse(List<FileInfo> listOfFileInfo) { List<FileRecord> fileRecords = listOfFileInfo.stream().map(fileInfo -> { String url = String.format(FORMAT, contextPath, fileInfo.getFileLocation().getFileStoreId(), fileInfo.getTenantId()); return new FileRecord(url, fileInfo.getContentType()); }).collect(Collectors.toList()); return new GetFilesByTagResponse(fileRecords); } ResponseFactory(@Value("${server.contextPath}") String contextPath); GetFilesByTagResponse getFilesByTagResponse(List<FileInfo> listOfFileInfo); }
ResponseFactory { public GetFilesByTagResponse getFilesByTagResponse(List<FileInfo> listOfFileInfo) { List<FileRecord> fileRecords = listOfFileInfo.stream().map(fileInfo -> { String url = String.format(FORMAT, contextPath, fileInfo.getFileLocation().getFileStoreId(), fileInfo.getTenantId()); return new FileRecord(url, fileInfo.getContentType()); }).collect(Collectors.toList()); return new GetFilesByTagResponse(fileRecords); } ResponseFactory(@Value("${server.contextPath}") String contextPath); GetFilesByTagResponse getFilesByTagResponse(List<FileInfo> listOfFileInfo);  }