@Test @Ignore public void testCompressResponseFolder() throws Exception { long requestId = 101l; long responseFolderId = 103l; String pathToCompressedFile = "path_to_compressed_file"; expect(mockedCaseFileDao.find(requestId)).andReturn(mockedCaseFile); expect(mockedResponseFolderService.getResponseFolder(mockedCaseFile)).andReturn(mockedResponseFolder); expect(mockedResponseFolder.getId()).andReturn(responseFolderId); expect(mockedCompressor.compressFolder(responseFolderId)).andReturn(pathToCompressedFile); mockedApplicationEventPublisher.publishEvent(anyObject()); expectLastCall().andVoid(); replayAll(); String compressedFilePath = compresssorService.compressResponseFolder(requestId); assertThat(compressedFilePath, equalTo(pathToCompressedFile)); }
public String compressResponseFolder(Long requestId) throws AcmUserActionFailedException, AcmObjectNotFoundException, AcmFolderException { CaseFile request = caseFileDao.find(requestId); String compressFileName = ""; if(getAcmFolderService().getFolderChildren(getResponseFolderService().getResponseFolder(request).getId()).size() <= 0) { return compressFileName; } compressFileName = compressor.compressFolder(getResponseFolderService().getResponseFolder(request).getId()); publishResponseFolderCompressedEvent(request); return compressFileName; }
ResponseFolderCompressorService implements ApplicationEventPublisherAware { public String compressResponseFolder(Long requestId) throws AcmUserActionFailedException, AcmObjectNotFoundException, AcmFolderException { CaseFile request = caseFileDao.find(requestId); String compressFileName = ""; if(getAcmFolderService().getFolderChildren(getResponseFolderService().getResponseFolder(request).getId()).size() <= 0) { return compressFileName; } compressFileName = compressor.compressFolder(getResponseFolderService().getResponseFolder(request).getId()); publishResponseFolderCompressedEvent(request); return compressFileName; } }
ResponseFolderCompressorService implements ApplicationEventPublisherAware { public String compressResponseFolder(Long requestId) throws AcmUserActionFailedException, AcmObjectNotFoundException, AcmFolderException { CaseFile request = caseFileDao.find(requestId); String compressFileName = ""; if(getAcmFolderService().getFolderChildren(getResponseFolderService().getResponseFolder(request).getId()).size() <= 0) { return compressFileName; } compressFileName = compressor.compressFolder(getResponseFolderService().getResponseFolder(request).getId()); publishResponseFolderCompressedEvent(request); return compressFileName; }  }
ResponseFolderCompressorService implements ApplicationEventPublisherAware { public String compressResponseFolder(Long requestId) throws AcmUserActionFailedException, AcmObjectNotFoundException, AcmFolderException { CaseFile request = caseFileDao.find(requestId); String compressFileName = ""; if(getAcmFolderService().getFolderChildren(getResponseFolderService().getResponseFolder(request).getId()).size() <= 0) { return compressFileName; } compressFileName = compressor.compressFolder(getResponseFolderService().getResponseFolder(request).getId()); publishResponseFolderCompressedEvent(request); return compressFileName; }  String compressResponseFolder(Long requestId); void setCaseFileDao(CaseFileDao caseFileDao); FolderCompressor getCompressor(); void setCompressor(FolderCompressor compressor); ResponseFolderService getResponseFolderService(); void setResponseFolderService(ResponseFolderService responseFolderService); @Override void setApplicationEventPublisher(ApplicationEventPublisher applicationEventPublisher); AcmFolderService getAcmFolderService(); void setAcmFolderService(AcmFolderService acmFolderService); }
ResponseFolderCompressorService implements ApplicationEventPublisherAware { public String compressResponseFolder(Long requestId) throws AcmUserActionFailedException, AcmObjectNotFoundException, AcmFolderException { CaseFile request = caseFileDao.find(requestId); String compressFileName = ""; if(getAcmFolderService().getFolderChildren(getResponseFolderService().getResponseFolder(request).getId()).size() <= 0) { return compressFileName; } compressFileName = compressor.compressFolder(getResponseFolderService().getResponseFolder(request).getId()); publishResponseFolderCompressedEvent(request); return compressFileName; }  String compressResponseFolder(Long requestId); void setCaseFileDao(CaseFileDao caseFileDao); FolderCompressor getCompressor(); void setCompressor(FolderCompressor compressor); ResponseFolderService getResponseFolderService(); void setResponseFolderService(ResponseFolderService responseFolderService); @Override void setApplicationEventPublisher(ApplicationEventPublisher applicationEventPublisher); AcmFolderService getAcmFolderService(); void setAcmFolderService(AcmFolderService acmFolderService);  }