Package org.jbpm.formbuilder.server.file

Examples of org.jbpm.formbuilder.server.file.FileService


        EasyMock.replay(context);
        restService.setContext(context);
        EasyMock.verify(context);

        FileService service = restService.getFileService();
        assertNotNull("service shouldn't be null", service);
    }
View Full Code Here


   
    //test happy path of RESTFileService.deleteFile(...)
    public void testDeleteFileOK() throws Exception {
        RESTFileService restService = new RESTFileService();
        List<Object> requestMocks = createRequestMocks();
        FileService fileService = EasyMock.createMock(FileService.class);
        fileService.deleteFile(EasyMock.same("somePackage"), EasyMock.same("myFile.tmp"));
        EasyMock.expectLastCall().once();
        requestMocks.add(fileService);
        restService.setFileService(fileService);
        Object[] mocks = requestMocks.toArray();
        EasyMock.replay(mocks);
View Full Code Here

   
    //test response to a FileException of RESTFileService.deleteFile(...)
    public void testDeleteFileServiceProblem() throws Exception {
        RESTFileService restService = new RESTFileService();
        List<Object> requestMocks = createRequestMocks();
        FileService fileService = EasyMock.createMock(FileService.class);
        FileException exception = new FileException("Something went wrong", new NullPointerException());
        fileService.deleteFile(EasyMock.same("somePackage"), EasyMock.same("myFile.tmp"));
        EasyMock.expectLastCall().andThrow(exception).once();
        requestMocks.add(fileService);
        restService.setFileService(fileService);
        Object[] mocks = requestMocks.toArray();
        EasyMock.replay(mocks);
View Full Code Here

   
    //test happy path for RESTFileService.getFiles(...) returning files
    public void testGetFilesOK() throws Exception {
        RESTFileService restService = new RESTFileService();
        List<Object> requestMocks = createRequestMocks();
        FileService fileService = EasyMock.createMock(FileService.class);
        List<String> retval = new ArrayList<String>();
        retval.add("myFile1.tmp");
        retval.add("myFile2.tmp");
        EasyMock.expect(fileService.loadFilesByType(EasyMock.same("somePackage"), EasyMock.same("tmp"))).
            andReturn(retval);
        requestMocks.add(fileService);
        restService.setFileService(fileService);
        Object[] mocks = requestMocks.toArray();
        EasyMock.replay(mocks);
View Full Code Here

   
    //test happy path for RESTFileService.getFiles(...) returning no files
    public void testGetFilesEmpty() throws Exception {
        RESTFileService restService = new RESTFileService();
        List<Object> requestMocks = createRequestMocks();
        FileService fileService = EasyMock.createMock(FileService.class);
        List<String> retval = new ArrayList<String>();
        EasyMock.expect(fileService.loadFilesByType(EasyMock.same("somePackage"), EasyMock.same("tmp"))).
            andReturn(retval);
        requestMocks.add(fileService);
        restService.setFileService(fileService);
        Object[] mocks = requestMocks.toArray();
        EasyMock.replay(mocks);
View Full Code Here

   
    //test response to a FileException of RESTFileService.getFiles(...)
    public void testGetFilesServiceProblem() throws Exception {
        RESTFileService restService = new RESTFileService();
        List<Object> requestMocks = createRequestMocks();
        FileService fileService = EasyMock.createMock(FileService.class);
        FileException exception = new FileException();
        EasyMock.expect(fileService.loadFilesByType(EasyMock.same("somePackage"), EasyMock.same("tmp"))).
            andThrow(exception);
        requestMocks.add(fileService);
        restService.setFileService(fileService);
        Object[] mocks = requestMocks.toArray();
        EasyMock.replay(mocks);
View Full Code Here

   
    //test happy path for RESTFileService.getFile(...)
    public void testGetFileOK() throws Exception {
        RESTFileService restService = new RESTFileService();
        List<Object> requestMocks = createRequestMocks();
        FileService fileService = EasyMock.createMock(FileService.class);
        byte[] myContent = new byte[] {1, 2, 3, 4, 5, 6, 7, 8, 9};
        EasyMock.expect(fileService.loadFile(EasyMock.same("somePackage"), EasyMock.same("myFile.tmp"))).
            andReturn(myContent);
        requestMocks.add(fileService);
        restService.setFileService(fileService);
        Object[] mocks = requestMocks.toArray();
        EasyMock.replay(mocks);
View Full Code Here

   
    //test response to a FileException for RESTFileService.getFile(...)
    public void testGetFileServiceProblem() throws Exception {
        RESTFileService restService = new RESTFileService();
        List<Object> requestMocks = createRequestMocks();
        FileService fileService = EasyMock.createMock(FileService.class);
        FileException exception = new FileException(new NullPointerException());
        EasyMock.expect(fileService.loadFile(EasyMock.same("somePackage"), EasyMock.same("myFile.tmp"))).
            andThrow(exception);
        requestMocks.add(fileService);
        restService.setFileService(fileService);
        Object[] mocks = requestMocks.toArray();
        EasyMock.replay(mocks);
View Full Code Here

        assertStatus(resp.getStatus(), Status.INTERNAL_SERVER_ERROR);
    }
   
    public void testSaveFileNotMultipart() throws Exception {
        RESTFileService restService = createSaveFileMockService(null, null, null, false);
        FileService fileService = EasyMock.createMock(FileService.class);
        restService.setFileService(fileService);
        HttpServletRequest request = EasyMock.createMock(HttpServletRequest.class);
        HttpSession session = EasyMock.createMock(HttpSession.class);
        EasyMock.expect(request.getSession()).andReturn(session).once();
        ServletContext context = EasyMock.createMock(ServletContext.class);
View Full Code Here

   
    public void testSaveFileOK() throws Exception {
        byte[] bstream = new byte[] { 1, 2, 3, 4, 5, 6, 7, 8, 9};
        String fileName = "fileName";       
        RESTFileService restService = createSaveFileMockService(bstream, fileName, null, true);
        FileService fileService = EasyMock.createMock(FileService.class);
        String url = "http://www.redhat.com";
        EasyMock.expect(fileService.storeFile(EasyMock.eq("somePackage"), EasyMock.eq("fileName"), EasyMock.same(bstream))).
            andReturn(url).once();
        restService.setFileService(fileService);
        HttpServletRequest request = EasyMock.createMock(HttpServletRequest.class);
        HttpSession session = EasyMock.createMock(HttpSession.class);
        EasyMock.expect(request.getSession()).andReturn(session).once();
View Full Code Here

TOP

Related Classes of org.jbpm.formbuilder.server.file.FileService

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.