Package org.apache.oodt.cas.protocol.auth

Examples of org.apache.oodt.cas.protocol.auth.NoAuthentication


   private Authentication getAuthentication(URI uri) {
      if (uri.getUserInfo() != null) {
         String[] userInfo = uri.getUserInfo().split("\\:");
         return new BasicAuthentication(userInfo[0], userInfo[1]);
      } else {
         return new NoAuthentication();
      }
   }
View Full Code Here


  public void testInitialState() {
    assertNotNull(protocolManager.getConfig());
  }
 
  public void testProtocolFactoryMapping() throws URISyntaxException {
    Protocol protocol = protocolManager.getProtocolBySite(new URI("ftp://localhost"), new NoAuthentication(), null);
    assertNotNull(protocol);
    assertTrue(protocol instanceof MockProtocol);
    MockProtocol mockProtocol = (MockProtocol) protocol;
    assertEquals("ftp1", mockProtocol.getFactoryId());
   
    //test that ftp1 was memorized and is returned again even though a Verifier was supplied this time that would return ftp3
    protocol = protocolManager.getProtocolBySite(new URI("ftp://localhost"), new NoAuthentication(), new ProtocolVerifier() {
      public boolean verify(Protocol protocol, URI site,
          Authentication auth) {
        if (protocol instanceof MockProtocol) {
          MockProtocol mockProtocol = (MockProtocol) protocol;
          return mockProtocol.getFactoryId().equals("ftp3");
View Full Code Here

    assertEquals("ftp1", mockProtocol.getFactoryId());

  }
 
  public void testVerifier() throws URISyntaxException {
    Protocol protocol = protocolManager.getProtocolBySite(new URI("ftp://localhost"), new NoAuthentication(), new ProtocolVerifier() {
      public boolean verify(Protocol protocol, URI site,
          Authentication auth) {
        if (protocol instanceof MockProtocol) {
          MockProtocol mockProtocol = (MockProtocol) protocol;
          return mockProtocol.getFactoryId().equals("ftp3");
View Full Code Here

public class TestHttpProtocol extends TestCase {
 
  public void testConnection() throws InstantiationException, ProtocolException {
    HttpProtocol httpProtocol = new HttpProtocol();
    assertFalse(httpProtocol.connected());
    httpProtocol.connect("svn.apache.org", new NoAuthentication());
    assertTrue(httpProtocol.connected());
  }
View Full Code Here

    assertTrue(httpProtocol.connected());
  }
 
  public void testLSandCD() throws ProtocolException, InstantiationException {
    HttpProtocol httpProtocol = new HttpProtocol();
    httpProtocol.connect("svn.apache.org", new NoAuthentication());
    assertTrue(httpProtocol.connected());
    httpProtocol.cd(new ProtocolFile("repos/asf/oodt/trunk/protocol/http/src/main/java/org/apache/oodt/cas/protocol/http", true));
    List<ProtocolFile> files = httpProtocol.ls();
    boolean foundFile = false;
    for (ProtocolFile file : files) {
View Full Code Here

    assertTrue(foundFile);
  }
 
  public void testPWD() throws ProtocolException {
    HttpProtocol httpProtocol = new HttpProtocol();
    httpProtocol.connect("svn.apache.org", new NoAuthentication());
    assertTrue(httpProtocol.connected());
    ProtocolFile gotoDir = new ProtocolFile(httpProtocol.pwd(), "repos/asf/oodt/trunk/protocol/http/src/test/org/apache/oodt/cas/protocol/http", true);
    httpProtocol.cd(gotoDir);
    ProtocolFile currentDir = httpProtocol.pwd();
    System.out.println(gotoDir.getAbsoluteFile());
View Full Code Here

    assertEquals(gotoDir, currentDir);
  }
 
  public void testGET() throws ProtocolException, IOException {
    HttpProtocol httpProtocol = new HttpProtocol();
    httpProtocol.connect("svn.apache.org", new NoAuthentication());
    assertTrue(httpProtocol.connected());
    httpProtocol.cd(new ProtocolFile("repos/asf/oodt/trunk/protocol/http/src/test/org/apache/oodt/cas/protocol/http", true));
    File bogus = File.createTempFile("bogus", "bogus");
    File tmpDir = new File(bogus.getParentFile(), "TestHttpProtocol");
    bogus.delete();
View Full Code Here

      return site != null ? new URI(site) : null;
   }

   public Authentication getAuthentication() {
      if (user == null || pass == null) {
         return new NoAuthentication();
      } else {
         return new BasicAuthentication(user, pass);
      }
   }
View Full Code Here

TOP

Related Classes of org.apache.oodt.cas.protocol.auth.NoAuthentication

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.