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());
}
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"));
}
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());
}
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());
}
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());
}
Aggregations