package org.apache.sshd.fs.test;

import org.junit.jupiter.api.Test;
import org.xbib.files.FileService;

import java.io.IOException;
import java.security.Provider;
import java.security.Security;
import java.util.Map;
import java.util.ServiceLoader;
import java.util.logging.Logger;

public class FileServiceProviderTest {

    static {
        // load bouncy castle provider (and other security providers)
        for (Provider p : ServiceLoader.load(Provider.class)) {
            if (Security.getProvider(p.getName()) == null) {
                Security.addProvider(p);
            }
        }
    }

    @Test
    public void testSFTP() throws IOException {
        Map<String, ?> env = Map.of("username", "joerg");
        FileService fs = FileService.newInstance("sftp://alkmene:22", env);
        fs.list(".").forEach(p -> Logger.getAnonymousLogger().info(p.toString()));
    }
}
