Package org.apache.oodt.cas.protocol

Examples of org.apache.oodt.cas.protocol.ProtocolFile


  public void setSite(RemoteSite site) {
    this.site = site;
  }

  public RemoteSiteFile getRemoteParent() {
    ProtocolFile parent = super.getParent();
    return new RemoteSiteFile(parent.getPath(), parent.isDir(), this.site);
  }
View Full Code Here


    return new RemoteSiteFile(parent.getPath(), parent.isDir(), this.site);
  }

  @Override
public RemoteSiteFile getAbsoluteFile() {
    ProtocolFile parent = super.getAbsoluteFile();
    return new RemoteSiteFile(parent.getPath(), parent.isDir(), this.site);
  }
View Full Code Here

    }
  }

  public String getAbsPathFor(Protocol protocol, String path, boolean isDir) {
    try {
      protocol.cd(new ProtocolFile(path, isDir));
      return protocol.pwd().getAbsoluteFile().getPath();
    } catch (Exception e) {
      e.printStackTrace();
      return null;
    }
View Full Code Here

    assertEquals(0, ImapsProtocol.connectCalls);
  }
 
  public void testCDAndPWD() throws ProtocolException {
    assertEquals("", imapsProtocol.pwd().getPath());
    imapsProtocol.cd(new ProtocolFile("INBOX", true));
    assertEquals("/INBOX", imapsProtocol.pwd().getPath());
  }
View Full Code Here

    assertEquals("/INBOX", imapsProtocol.pwd().getPath());
  }
 
  public void testLSandGET() throws ProtocolException, IOException {
    GreenMailUtil.sendTextEmailSecureTest("bfoster@google.com", "tom@bumster.org", "Test Subject", "Test Body");
    imapsProtocol.cd(new ProtocolFile("INBOX", true));
    List<ProtocolFile> emails = imapsProtocol.ls();
    assertEquals(1, emails.size());
    File bogusFile = File.createTempFile("bogus", "bogus");
    File tmpDir = new File(bogusFile.getParentFile(), "TestImapsProtocol");
    bogusFile.delete();
View Full Code Here

    tmpDir.delete();
  }
 
  public void testDelete() throws ProtocolException {
    GreenMailUtil.sendTextEmailSecureTest("bfoster@google.com", "tom@bumster.org", "Test Subject", "Test Body");
    imapsProtocol.cd(new ProtocolFile("INBOX", true));
    List<ProtocolFile> emails = imapsProtocol.ls();
    assertEquals(1, emails.size());
    imapsProtocol.delete(emails.get(0));
    emails = imapsProtocol.ls();
    assertEquals(0, emails.size());
View Full Code Here

            // Test connectivity
            protocol.connect(site.getHost(), auth);
           
            // Test ls, cd, and pwd
            protocol.cdHome();
            ProtocolFile home = protocol.pwd();
            protocol.ls();
            if (uriTestCdMap.containsKey(site)) {
              protocol.cd(uriTestCdMap.get(site));
            } else {
              protocol.cdHome();
            }
            protocol.cdHome();
           
            // Verify again at home directory
            if (home == null || !home.equals(protocol.pwd()))
                throw new ProtocolException(
                        "Home directory not the same after cd");
        } catch (Exception e) {
            LOG.log(Level.SEVERE, "Protocol "
                    + protocol.getClass().getCanonicalName()
View Full Code Here

            throw new Exception("Failed to get protocol for 'to' URI '" + toUri
                  + "'");
         }

         fromProtocol
               .get(new ProtocolFile(fromUri.getPath(), false), localFile);
         toProtocol.put(localFile, new ProtocolFile(toUri.getPath(), false));
      } catch (Exception e) {
         throw new CmdLineActionException(
               "Failed to transfer between 2 protocols : " + e.getMessage(), e);
      }
   }
View Full Code Here

            }}).when(sftpProtocol).connect("localhost", new HostKeyAuthentication("bfoster", "",
                pubKeyFile.getAbsoluteFile().getAbsolutePath()));

        sftpProtocol.connect("localhost", new HostKeyAuthentication("bfoster", "",
                pubKeyFile.getAbsoluteFile().getAbsolutePath()));
    ProtocolFile homeDir = sftpProtocol.pwd();
    ProtocolFile testDir = new ProtocolFile(homeDir, "sshTestDir", true);
    sftpProtocol.cd(testDir);

        Mockito.when(sftpProtocol.pwd()).thenReturn(new ProtocolFile(homeDir, "sshTestDir", true));


    assertEquals(testDir, sftpProtocol.pwd());
    List<ProtocolFile> lsResults = new ArrayList<ProtocolFile>(
        sftpProtocol.ls(new ProtocolFileFilter() {
                    public boolean accept(ProtocolFile file) {
                        return file.getName().equals("sshTestFile");
                    }
                }));
    assertEquals(1, lsResults.size());
    ProtocolFile testFile = lsResults.get(0);
        ProtocolFile testnew = new ProtocolFile(testDir, "sshTestFile", false);
    assertEquals(new ProtocolFile(null, testDir.getPath()+"/sshTestFile", false), testFile);
  }
View Full Code Here

   }
  
   public void testCreateProtocolFile() throws URISyntaxException {
      DownloadCliAction da = new DownloadCliAction();
      da.setUrl("http://localhost/some/file");
      ProtocolFile file = da.createProtocolFile();
      assertNotNull(file);
      assertEquals("/some/file", file.getPath());
      assertFalse(file.isRelative());
      assertFalse(file.isDir());
   }
View Full Code Here

TOP

Related Classes of org.apache.oodt.cas.protocol.ProtocolFile

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.