Package org.apache.commons.vfs2.provider.smb

Examples of org.apache.commons.vfs2.provider.smb.SmbFileName


        providerConfig.prepare(manager);

        if (!manager.hasProvider("file"))
        {
            manager.addProvider("file", new DefaultLocalFileProvider());
        }

        manager.init();

        // Locate the base folders
View Full Code Here


    public void prepare(final DefaultFileSystemManager manager)
            throws Exception
    {
        try
        {
            manager.addProvider("ram", new RamFileProvider());
            manager.addProvider("file", new DefaultLocalFileProvider());
        }
        catch (Exception e)
        {
            log.error(e);
View Full Code Here

    protected void setUp() throws Exception
    {
        super.setUp();

        manager = new DefaultFileSystemManager();
        manager.addProvider("ram", new RamFileProvider());
        manager.init();

        // File Systems Options
        RamFileSystemConfigBuilder.getInstance().setMaxSize(zeroSized, 0);
        RamFileSystemConfigBuilder.getInstance().setMaxSize(smallSized, 10);
View Full Code Here

    {
        if (!inited)
        {
            // Import the test tree
            FileObject fo = manager.resolveFile("ram:/");
            RamFileSystem fs = (RamFileSystem) fo.getFileSystem();
            fs.importTree(new File(AbstractVfsTestCase.getTestDirectory()));
            fo.close();

            inited=true;
        }
View Full Code Here

     * Tests parsing a URI into its parts.
     */
    public void testParseUri() throws Exception
    {
        // Simple name
        SmbFileName name = (SmbFileName) SmbFileNameParser.getInstance().parseUri(null, null, "smb://hostname/share/file");
        assertEquals("smb", name.getScheme());
        assertNull(name.getUserName());
        assertNull(name.getPassword());
        assertEquals("hostname", name.getHostName());
        assertEquals(139, name.getPort());
        assertEquals(name.getDefaultPort(), name.getPort());
        assertEquals("share", name.getShare());
        assertEquals("/file", name.getPath());
        assertEquals("smb://hostname/share/", name.getRootURI());
        assertEquals("smb://hostname/share/file", name.getURI());

        // Name with port
        name = (SmbFileName) SmbFileNameParser.getInstance().parseUri(null, null, "smb://hostname:9090/share/file");
        assertEquals("smb", name.getScheme());
        assertNull(name.getUserName());
        assertNull(name.getPassword());
        assertEquals("hostname", name.getHostName());
        assertEquals(9090, name.getPort());
        assertEquals("share", name.getShare());
        assertEquals("/file", name.getPath());
        assertEquals("smb://hostname:9090/share/", name.getRootURI());
        assertEquals("smb://hostname:9090/share/file", name.getURI());

        // Name with no path
        name = (SmbFileName) SmbFileNameParser.getInstance().parseUri(null, null, "smb://hostname/share");
        assertEquals("smb", name.getScheme());
        assertNull(name.getUserName());
        assertNull(name.getPassword());
        assertEquals("hostname", name.getHostName());
        assertEquals(139, name.getPort());
        assertEquals("share", name.getShare());
        assertEquals("/", name.getPath());
        assertEquals("smb://hostname/share/", name.getRootURI());
        assertEquals("smb://hostname/share/", name.getURI());

        // Name with username
        name = (SmbFileName) SmbFileNameParser.getInstance().parseUri(null, null, "smb://user@hostname/share/file");
        assertEquals("smb", name.getScheme());
        assertEquals("user", name.getUserName());
        assertNull(name.getPassword());
        assertEquals("hostname", name.getHostName());
        assertEquals(139, name.getPort());
        assertEquals("share", name.getShare());
        assertEquals("/file", name.getPath());
        assertEquals("smb://user@hostname/share/", name.getRootURI());
        assertEquals("smb://user@hostname/share/file", name.getURI());

        // Name with extension
        name = (SmbFileName) SmbFileNameParser.getInstance().parseUri(null, null, "smb://user@hostname/share/file.txt");
        assertEquals("smb", name.getScheme());
        assertEquals("user", name.getUserName());
        assertNull(name.getPassword());
        assertEquals("hostname", name.getHostName());
        assertEquals(139, name.getPort());
        assertEquals("share", name.getShare());
        assertEquals("/file.txt", name.getPath());
        assertEquals("file.txt", name.getBaseName());
        assertEquals("txt", name.getExtension());
        assertEquals("smb://user@hostname/share/", name.getRootURI());
        assertEquals("smb://user@hostname/share/file.txt", name.getURI());

        // Name look likes extension, but isnt
        name = (SmbFileName) SmbFileNameParser.getInstance().parseUri(null, null, "smb://user@hostname/share/.bashrc");
        assertEquals("smb", name.getScheme());
        assertEquals("user", name.getUserName());
        assertNull(name.getPassword());
        assertEquals("hostname", name.getHostName());
        assertEquals(139, name.getPort());
        assertEquals("share", name.getShare());
        assertEquals("/.bashrc", name.getPath());
        assertEquals(".bashrc", name.getBaseName());
        assertEquals("", name.getExtension());
        assertEquals("smb://user@hostname/share/", name.getRootURI());
        assertEquals("smb://user@hostname/share/.bashrc", name.getURI());
    }
View Full Code Here

    extends AbstractProviderTestConfig
    implements ProviderTestConfig
{
    public static Test suite() throws Exception
    {
        CacheTestSuite suite = new CacheTestSuite(new org.apache.commons.vfs2.cache.NullFilesCacheTestCase());
        suite.addTests(NullFilesCacheTests.class);
        return suite;
    }
View Full Code Here

    extends AbstractProviderTestConfig
    implements ProviderTestConfig
{
    public static Test suite() throws Exception
    {
        CacheTestSuite suite = new CacheTestSuite(new LRUFilesCacheTestCase());
        suite.addTests(LRUFilesCacheTests.class);
        return suite;
    }
View Full Code Here

    /**
     * Creates the test suite for the ram file system.
     */
    public static Test suite() throws Exception
    {
        return new ProviderTestSuite(new RamProviderTestCase());
    }
View Full Code Here

    private static final String TEST_URI = "test.http.uri";
    public static Test suite() throws Exception
    {
        if (System.getProperty(TEST_URI) != null)
        {
            return new ProviderTestSuite(new HttpProviderTestCase());
        }
        else
        {
            return notConfigured(HttpProviderTestCase.class);
        }
View Full Code Here

    /**
     * Creates the test suite for the jar file system.
     */
    public static Test suite() throws Exception
    {
        return new ProviderTestSuite(new JarProviderTestCase(), true);
    }
View Full Code Here

TOP

Related Classes of org.apache.commons.vfs2.provider.smb.SmbFileName

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.