Package org.apache.oodt.cas.protocol

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


 
  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");
        } else {
          return false;
        }
      }
    });
    assertNotNull(protocol);
    assertTrue(protocol instanceof MockProtocol);
    mockProtocol = (MockProtocol) protocol;
    assertEquals("ftp1", mockProtocol.getFactoryId());

  }
View Full Code Here


  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");
        } else {
          return false;
        }
      }
    });
    assertTrue(protocol instanceof MockProtocol);
    MockProtocol mockProtocol = (MockProtocol) protocol;
    assertEquals("ftp3", mockProtocol.getFactoryId());
  }
View Full Code Here

TOP

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

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.