Examples of FileService


Examples of com.sun.faban.harness.agent.FileService

    @Deprecated public synchronized boolean copy(String srcmachine, String destmachine,
            String srcfile, String destfile,
            boolean append) {

        FileAgent srcf, destf = null;
        FileService srcfilep = null, destfilep = null;
        int sidx = machinesList.indexOf(srcmachine);
        int didx = machinesList.indexOf(destmachine);
        byte[] buf;
        if (sidx == didx && srcfile.equals(destfile)) {
            return (true);
        }

        if (srcfile.equals(destfile)) {
            try {
                String dest = cmdp.get(didx).getHostName();
                String src = cmdp.get(sidx).getHostName();
                if (dest == src) {
                    return true;
                }
            } catch (Exception e) {
                logger.severe("CmdService: Copying - CmdAgent getHostName exception");
                logger.log(Level.FINE, "Exception", e);
            }
        }
        logger.fine("CmdService: Copying " + srcfile + " from " + srcmachine + " to " + destfile + " in " + destmachine);

        srcf = filep.get(sidx);
        destf = filep.get(didx);
        try {
            srcfilep = srcf.open(srcfile, FileAgent.READ);
            if (append) {
                destfilep = destf.open(destfile, FileAgent.APPEND);
            } else {
                destfilep = destf.open(destfile, FileAgent.WRITE);
            }

            // Read from src and write to dest.
            buf = srcfilep.read();
            destfilep.write(buf);

            srcfilep.close();
            destfilep.close();
        } catch (Exception ie) {
            logger.log(Level.WARNING, "CmdService: Could not copy " +
                    srcmachine + ":" + srcfile + " to " + destmachine + ":" +
                    destfile, ie);
View Full Code Here

Examples of net.sf.regain.ui.desktop.FileService

    super(context);
   
    mParser = new ExecuterParser();
   
    // TODO: Find out, how simpleweb calls another service
    mFileService = new FileService(context);
  }
View Full Code Here

Examples of org.b3log.solo.jsonrpc.impl.FileService

            final CommentService commentService = CommentService.getInstance();
            JSONRPCBridge.getGlobalBridge().registerObject(commentService.
                    getServiceObjectName(), commentService);

            final FileService fileService = FileService.getInstance();
            JSONRPCBridge.getGlobalBridge().registerObject(fileService.
                    getServiceObjectName(), fileService);

            final LinkService linkService = LinkService.getInstance();
            JSONRPCBridge.getGlobalBridge().registerObject(linkService.
                    getServiceObjectName(), linkService);
View Full Code Here

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

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

   
    //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

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

   
    //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

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

   
    //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

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

   
    //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

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

   
    //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

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

   
    //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
TOP
Copyright © 2018 www.massapi.com. 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.