Search in sources :

Example 1 with Profile

use of ch.cyberduck.core.Profile 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 2 with Profile

use of ch.cyberduck.core.Profile 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 3 with Profile

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

the class ProfileDictionary method deserialize.

public Profile deserialize(Object serialized) {
    final Deserializer<String> dict = deserializer.create(serialized);
    final String protocol = dict.stringForKey("Protocol");
    if (StringUtils.isNotBlank(protocol)) {
        final Protocol parent = protocols.forName(protocols.find(new Predicate<Protocol>() {

            @Override
            public boolean test(final Protocol protocol) {
                // Return default registered protocol specification as parent but not other profile
                return !(protocol.isEnabled() || protocol.isBundled());
            }
        }), protocol, null);
        if (null == parent) {
            log.error(String.format("Unknown protocol %s in profile", protocol));
            return null;
        }
        return new Profile(parent, dict);
    }
    log.error("Missing protocol in profile");
    return null;
}
Also used : Protocol(ch.cyberduck.core.Protocol) Profile(ch.cyberduck.core.Profile) Predicate(java.util.function.Predicate)

Example 4 with Profile

use of ch.cyberduck.core.Profile 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)

Example 5 with Profile

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

the class DropboxProtocolTest method testDefaultProfile.

@Test
public void testDefaultProfile() throws Exception {
    final ProtocolFactory factory = new ProtocolFactory(new HashSet<>(Collections.singleton(new DropboxProtocol())));
    final Profile profile = new ProfilePlistReader(factory).read(this.getClass().getResourceAsStream("/Dropbox.cyberduckprofile"));
    assertFalse(profile.isHostnameConfigurable());
    assertFalse(profile.isPortConfigurable());
    assertFalse(profile.isUsernameConfigurable());
    assertFalse(profile.isPasswordConfigurable());
}
Also used : ProtocolFactory(ch.cyberduck.core.ProtocolFactory) ProfilePlistReader(ch.cyberduck.core.serializer.impl.dd.ProfilePlistReader) Profile(ch.cyberduck.core.Profile) Test(org.junit.Test)

Aggregations

Profile (ch.cyberduck.core.Profile)77 ProtocolFactory (ch.cyberduck.core.ProtocolFactory)75 ProfilePlistReader (ch.cyberduck.core.serializer.impl.dd.ProfilePlistReader)68 Test (org.junit.Test)60 Host (ch.cyberduck.core.Host)56 Credentials (ch.cyberduck.core.Credentials)50 DisabledLoginCallback (ch.cyberduck.core.DisabledLoginCallback)50 DisabledCancelCallback (ch.cyberduck.core.DisabledCancelCallback)49 DisabledHostKeyCallback (ch.cyberduck.core.DisabledHostKeyCallback)48 Local (ch.cyberduck.core.Local)46 IntegrationTest (ch.cyberduck.test.IntegrationTest)36 Path (ch.cyberduck.core.Path)27 DefaultX509KeyManager (ch.cyberduck.core.ssl.DefaultX509KeyManager)22 TransferStatus (ch.cyberduck.core.transfer.TransferStatus)19 LoginOptions (ch.cyberduck.core.LoginOptions)17 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 Before (org.junit.Before)16