@Test public void testParseProfile() throws Exception { final ProtocolFactory factory = new ProtocolFactory(new HashSet<>(Collections.singleton(new SwiftProtocol()))); final ProfilePlistReader reader = new ProfilePlistReader(factory, new DeserializerFactory()); final Profile profile = reader.read( this.getClass().getResourceAsStream("/Rackspace US.cyberduckprofile") ); assertNotNull(profile); factory.register(profile); final CommandLineParser parser = new PosixParser(); final CommandLine input = parser.parse(new Options(), new String[]{}); assertEquals(new Path("/cdn.cyberduck.ch", EnumSet.of(Path.Type.directory, Path.Type.volume)), new CommandLinePathParser(input, factory).parse("rackspace: assertEquals(new Path("/", EnumSet.of(Path.Type.directory, Path.Type.volume)), new CommandLinePathParser(input, factory).parse("rackspace: }
public Path parse(final String uri) throws HostParserException { final Host host = new HostParser(factory).get(uri); if(StringUtils.isBlank(host.getDefaultPath())) { return new Path(String.valueOf(Path.DELIMITER), EnumSet.of((Path.Type.directory))); } return new Path(PathNormalizer.normalize(host.getDefaultPath()), EnumSet.of(detector.detect(host.getDefaultPath()))); }
CommandLinePathParser { public Path parse(final String uri) throws HostParserException { final Host host = new HostParser(factory).get(uri); if(StringUtils.isBlank(host.getDefaultPath())) { return new Path(String.valueOf(Path.DELIMITER), EnumSet.of((Path.Type.directory))); } return new Path(PathNormalizer.normalize(host.getDefaultPath()), EnumSet.of(detector.detect(host.getDefaultPath()))); } }
CommandLinePathParser { public Path parse(final String uri) throws HostParserException { final Host host = new HostParser(factory).get(uri); if(StringUtils.isBlank(host.getDefaultPath())) { return new Path(String.valueOf(Path.DELIMITER), EnumSet.of((Path.Type.directory))); } return new Path(PathNormalizer.normalize(host.getDefaultPath()), EnumSet.of(detector.detect(host.getDefaultPath()))); } CommandLinePathParser(final CommandLine input);  CommandLinePathParser(final CommandLine input, final ProtocolFactory factory); }
CommandLinePathParser { public Path parse(final String uri) throws HostParserException { final Host host = new HostParser(factory).get(uri); if(StringUtils.isBlank(host.getDefaultPath())) { return new Path(String.valueOf(Path.DELIMITER), EnumSet.of((Path.Type.directory))); } return new Path(PathNormalizer.normalize(host.getDefaultPath()), EnumSet.of(detector.detect(host.getDefaultPath()))); } CommandLinePathParser(final CommandLine input);  CommandLinePathParser(final CommandLine input, final ProtocolFactory factory); Path parse(final String uri); }
CommandLinePathParser { public Path parse(final String uri) throws HostParserException { final Host host = new HostParser(factory).get(uri); if(StringUtils.isBlank(host.getDefaultPath())) { return new Path(String.valueOf(Path.DELIMITER), EnumSet.of((Path.Type.directory))); } return new Path(PathNormalizer.normalize(host.getDefaultPath()), EnumSet.of(detector.detect(host.getDefaultPath()))); } CommandLinePathParser(final CommandLine input);  CommandLinePathParser(final CommandLine input, final ProtocolFactory factory); Path parse(final String uri);  }