Search in sources :

Example 1 with ProtocolFactory

use of ch.cyberduck.core.ProtocolFactory in project cyberduck by iterate-ch.

the class RendezvousCollectionTest method testAdd.

@Test
public void testAdd() {
    final AbstractRendezvous bonjour = new AbstractRendezvous(new ProtocolFactory(Collections.singleton(new TestProtocol(Scheme.sftp)))) {
    };
    final RendezvousCollection c = new RendezvousCollection(bonjour);
    assertFalse(c.allowsAdd());
    assertFalse(c.allowsDelete());
    assertFalse(c.allowsEdit());
    bonjour.init();
    final Host h = new Host(new TestProtocol(Scheme.sftp), "h");
    h.setUuid("a");
    bonjour.add("h_sftp", h);
    assertEquals(h, c.lookup("a"));
    assertEquals(1, c.size());
    assertEquals(h, c.get(0));
    assertNotNull(c.get(0).getUuid());
    bonjour.remove("h_sftp");
    assertEquals(0, c.size());
    assertTrue(c.isEmpty());
}
Also used : ProtocolFactory(ch.cyberduck.core.ProtocolFactory) TestProtocol(ch.cyberduck.core.TestProtocol) Host(ch.cyberduck.core.Host) Test(org.junit.Test)

Example 2 with ProtocolFactory

use of ch.cyberduck.core.ProtocolFactory in project cyberduck by iterate-ch.

the class RendezvousResponderTest method testGetProtocol.

@Test
public void testGetProtocol() {
    final AbstractRendezvous r = new RendezvousResponder(new ProtocolFactory(new HashSet<>(Arrays.asList(new TestProtocol(Scheme.sftp), new TestProtocol(Scheme.ftp), new TestProtocol(Scheme.dav), new TestProtocol(Scheme.davs)))));
    assertEquals(new TestProtocol(Scheme.ftp), r.getProtocol("andaman._ftp._tcp.local."));
    assertEquals(new TestProtocol(Scheme.sftp), r.getProtocol("yuksom._sftp-ssh._tcp."));
    assertEquals(new TestProtocol(Scheme.dav), r.getProtocol("yuksom._webdav._tcp"));
    assertEquals(new TestProtocol(Scheme.davs), r.getProtocol("andaman._webdavs._tcp"));
    assertNull(r.getProtocol("andaman._g._tcp"));
}
Also used : ProtocolFactory(ch.cyberduck.core.ProtocolFactory) TestProtocol(ch.cyberduck.core.TestProtocol) HashSet(java.util.HashSet) Test(org.junit.Test)

Example 3 with ProtocolFactory

use of ch.cyberduck.core.ProtocolFactory in project cyberduck by iterate-ch.

the class AbstractBrickTest method setup.

@Before
public void setup() throws Exception {
    final ProtocolFactory factory = new ProtocolFactory(new HashSet<>(Collections.singleton(new BrickProtocol())));
    final Profile profile = new ProfilePlistReader(factory).read(this.getClass().getResourceAsStream("/Brick.cyberduckprofile"));
    final Host host = new Host(profile, "mountainduck.files.com", new Credentials(System.getProperties().getProperty("brick.user"), System.getProperties().getProperty("brick.password")));
    session = new BrickSession(host, new DefaultX509TrustManager(), new DefaultX509KeyManager());
    final LoginConnectionService login = new LoginConnectionService(new DisabledLoginCallback() {

        @Override
        public Credentials prompt(final Host bookmark, final String title, final String reason, final LoginOptions options) {
            fail(reason);
            return null;
        }
    }, new DisabledHostKeyCallback(), new DisabledPasswordStore(), new DisabledProgressListener());
    login.check(session, new DisabledCancelCallback());
}
Also used : DisabledProgressListener(ch.cyberduck.core.DisabledProgressListener) LoginConnectionService(ch.cyberduck.core.LoginConnectionService) Host(ch.cyberduck.core.Host) ProfilePlistReader(ch.cyberduck.core.serializer.impl.dd.ProfilePlistReader) Profile(ch.cyberduck.core.Profile) ProtocolFactory(ch.cyberduck.core.ProtocolFactory) LoginOptions(ch.cyberduck.core.LoginOptions) DisabledCancelCallback(ch.cyberduck.core.DisabledCancelCallback) DisabledHostKeyCallback(ch.cyberduck.core.DisabledHostKeyCallback) DisabledLoginCallback(ch.cyberduck.core.DisabledLoginCallback) DefaultX509KeyManager(ch.cyberduck.core.ssl.DefaultX509KeyManager) DisabledPasswordStore(ch.cyberduck.core.DisabledPasswordStore) Credentials(ch.cyberduck.core.Credentials) DefaultX509TrustManager(ch.cyberduck.core.ssl.DefaultX509TrustManager) Before(org.junit.Before)

Example 4 with ProtocolFactory

use of ch.cyberduck.core.ProtocolFactory in project cyberduck by iterate-ch.

the class AbtractBoxTest method setup.

@Before
public void setup() throws Exception {
    final ProtocolFactory factory = new ProtocolFactory(new HashSet<>(Collections.singleton(new BoxProtocol())));
    final Profile profile = new ProfilePlistReader(factory).read(this.getClass().getResourceAsStream("/Box.cyberduckprofile"));
    final Host host = new Host(profile, profile.getDefaultHostname(), new Credentials("cyberduck"));
    session = new BoxSession(host, new DefaultX509TrustManager(), new DefaultX509KeyManager());
    final LoginConnectionService login = new LoginConnectionService(new DisabledLoginCallback() {

        @Override
        public Credentials prompt(final Host bookmark, final String title, final String reason, final LoginOptions options) {
            fail(reason);
            return null;
        }
    }, new DisabledHostKeyCallback(), new TestPasswordStore(), new DisabledProgressListener());
    login.check(session, new DisabledCancelCallback());
}
Also used : DisabledProgressListener(ch.cyberduck.core.DisabledProgressListener) LoginConnectionService(ch.cyberduck.core.LoginConnectionService) Host(ch.cyberduck.core.Host) ProfilePlistReader(ch.cyberduck.core.serializer.impl.dd.ProfilePlistReader) Profile(ch.cyberduck.core.Profile) ProtocolFactory(ch.cyberduck.core.ProtocolFactory) LoginOptions(ch.cyberduck.core.LoginOptions) DisabledCancelCallback(ch.cyberduck.core.DisabledCancelCallback) DisabledHostKeyCallback(ch.cyberduck.core.DisabledHostKeyCallback) DisabledLoginCallback(ch.cyberduck.core.DisabledLoginCallback) DefaultX509KeyManager(ch.cyberduck.core.ssl.DefaultX509KeyManager) Credentials(ch.cyberduck.core.Credentials) DefaultX509TrustManager(ch.cyberduck.core.ssl.DefaultX509TrustManager) Before(org.junit.Before)

Example 5 with ProtocolFactory

use of ch.cyberduck.core.ProtocolFactory in project cyberduck by iterate-ch.

the class LocalProfilesFinderTest method find.

@Test
public void find() throws Exception {
    final ProfilePlistReader reader = new ProfilePlistReader(new ProtocolFactory(Collections.singleton(new TestProtocol() {

        @Override
        public Type getType() {
            return Type.s3;
        }

        @Override
        public boolean isEnabled() {
            return false;
        }
    })));
    final Profile profile = reader.read(new Local("src/test/resources/Test S3 (HTTP).cyberduckprofile"));
    final LocalProfilesFinder finder = new LocalProfilesFinder(ProtocolFactory.get(), new Local("src/test/resources/"));
    final Set<ProfileDescription> stream = finder.find();
    assertFalse(stream.isEmpty());
}
Also used : ProtocolFactory(ch.cyberduck.core.ProtocolFactory) TestProtocol(ch.cyberduck.core.TestProtocol) Local(ch.cyberduck.core.Local) ProfilePlistReader(ch.cyberduck.core.serializer.impl.dd.ProfilePlistReader) Profile(ch.cyberduck.core.Profile) Test(org.junit.Test)

Aggregations

ProtocolFactory (ch.cyberduck.core.ProtocolFactory)114 Test (org.junit.Test)95 ProfilePlistReader (ch.cyberduck.core.serializer.impl.dd.ProfilePlistReader)83 Profile (ch.cyberduck.core.Profile)75 Host (ch.cyberduck.core.Host)68 Local (ch.cyberduck.core.Local)68 Credentials (ch.cyberduck.core.Credentials)55 DisabledLoginCallback (ch.cyberduck.core.DisabledLoginCallback)55 DisabledCancelCallback (ch.cyberduck.core.DisabledCancelCallback)53 DisabledHostKeyCallback (ch.cyberduck.core.DisabledHostKeyCallback)52 IntegrationTest (ch.cyberduck.test.IntegrationTest)40 Path (ch.cyberduck.core.Path)29 TestProtocol (ch.cyberduck.core.TestProtocol)29 DefaultX509KeyManager (ch.cyberduck.core.ssl.DefaultX509KeyManager)25 TransferStatus (ch.cyberduck.core.transfer.TransferStatus)19 LoginOptions (ch.cyberduck.core.LoginOptions)18 DefaultX509TrustManager (ch.cyberduck.core.ssl.DefaultX509TrustManager)17 DisabledProgressListener (ch.cyberduck.core.DisabledProgressListener)16 LoginConnectionService (ch.cyberduck.core.LoginConnectionService)16 Delete (ch.cyberduck.core.features.Delete)16