Examples of SearchPath


Examples of com.alibaba.citrus.service.resource.loader.FileResourceLoader.SearchPath

public class FileLoaderTests extends AbstractResourceLoaderTests<FileResourceLoader> {
    @Test
    public void searchPath_wrong() {
        try {
            new SearchPath(null, true);
            fail();
        } catch (IllegalArgumentException e) {
            assertThat(e, exception("path"));
        }

        // relpath.init(null)
        SearchPath path = new SearchPath("abc", true);

        try {
            path.init(null);
            fail();
        } catch (IllegalArgumentException e) {
            assertThat(
                    e,
                    exception("Could not get basedir for search path: ", "relpath=abc, basedir=null.  ",
View Full Code Here

Examples of com.alibaba.citrus.service.resource.loader.FileResourceLoader.SearchPath

    }

    @Test
    public void searchPath_toString() {
        // relpath without basedir
        SearchPath path = new SearchPath("abc", true);
        assertEquals("relpath=abc, basedir=null", path.toString());

        // relpath with basedir
        path.init(srcdir.getAbsolutePath());
        assertThat(path.toString(), containsAll("relpath=abc, basedir=", "config"));

        // abspath
        path = new SearchPath("abc", false);
        assertEquals("abspath=abc", path.toString());

        // abspath.init(srcdir) - no effect
        path.init(srcdir.getAbsolutePath());
        assertEquals("abspath=abc", path.toString());
    }
View Full Code Here

Examples of com.alibaba.citrus.service.resource.loader.FileResourceLoader.SearchPath

    @Test
    public void basedir_noConfigURL() throws Exception {
        createLoader(srcdir.getAbsolutePath(), // srcdir
                null, //
                new SearchPath("WEB-INF", true), // srcdir/WEB-INF
                new SearchPath(new File(srcdir, "aaa").getAbsolutePath(), false)); // srcdir/aaa

        assertEquals(2, loader.getPaths().length);
        assertThat(loader.getPaths()[0].toString(), containsAll("relpath=WEB-INF, basedir=", "config"));
        assertThat(loader.getPaths()[1].toString(), containsAll("abspath=", "config/aaa"));
    }
View Full Code Here

Examples of com.alibaba.citrus.service.resource.loader.FileResourceLoader.SearchPath

    @Test
    public void basedir_abs() throws Exception {
        createLoader(srcdir.getAbsolutePath(), // srcdir
                new File(srcdir, "aaa/config.xml").toURI().toURL(), // srcdir/aaa
                new SearchPath("WEB-INF", true), // srcdir/WEB-INF
                new SearchPath(new File(srcdir, "aaa").getAbsolutePath(), false)); // srcdir/aaa

        assertEquals(2, loader.getPaths().length);
        assertThat(loader.getPaths()[0].toString(), containsAll("relpath=WEB-INF, basedir=", "config"));
        assertThat(loader.getPaths()[1].toString(), containsAll("abspath=", "config/aaa"));
    }
View Full Code Here

Examples of com.alibaba.citrus.service.resource.loader.FileResourceLoader.SearchPath

    @Test
    public void basedir_rel() throws Exception {
        createLoader("..", // srcdir/aaa/..
                new File(srcdir, "aaa/config.xml").toURI().toURL(), // srcdir/aaa
                new SearchPath("WEB-INF", true), // srcdir/WEB-INF
                new SearchPath(new File(srcdir, "aaa").getAbsolutePath(), false)); // srcdir/aaa

        assertEquals(2, loader.getPaths().length);
        assertThat(loader.getPaths()[0].toString(), containsAll("relpath=WEB-INF, basedir=", "config"));
        assertThat(loader.getPaths()[1].toString(), containsAll("abspath=", "config/aaa"));
    }
View Full Code Here

Examples of com.alibaba.citrus.service.resource.loader.FileResourceLoader.SearchPath

    @Test
    public void basedir_configURLonly() throws Exception {
        createLoader(null, //
                new File(srcdir, "aaa/config.xml").toURI().toURL(), // basedir=srcdir/aaa
                new SearchPath("../WEB-INF", true), // srcdir/aaa/../WEB-INF
                new SearchPath(new File(srcdir, "aaa/bbb").getAbsolutePath(), false)); // srcdir/aaa/bbb

        assertEquals(2, loader.getPaths().length);
        assertThat(loader.getPaths()[0].toString(), containsAll("relpath=../WEB-INF, basedir=", "config/aaa"));
        assertThat(loader.getPaths()[1].toString(), containsAll("abspath=", "config/aaa/bbb"));
    }
View Full Code Here

Examples of com.alibaba.citrus.service.resource.loader.FileResourceLoader.SearchPath

    }

    @Test
    public void search() throws Exception {
        createLoader(srcdir.getAbsolutePath(), null, //
                new SearchPath("WEB-INF", true), // srcdir/WEB-INF
                new SearchPath(new File(srcdir, "WEB-INF/aaa").getAbsolutePath(), false)); // srcdir/aaa

        // getResource
        assertResourceLoader("/myapp/", "WEB-INF", true); // dir
        assertResourceLoader("/myapp/web.xml", "WEB-INF/web.xml", true);
        assertResourceLoader("/myapp/bbb/abc.txt", "WEB-INF/aaa/bbb/abc.txt", true);
View Full Code Here

Examples of com.alibaba.citrus.service.resource.loader.FileResourceLoader.SearchPath

    }

    @Test
    public void search2() throws Exception {
        createLoader(null, new File(srcdir, "aaa/config.xml").toURI().toURL(), // basedir=srcdir/aaa
                new SearchPath("../WEB-INF", true), // srcdir/aaa/../WEB-INF
                new SearchPath(new File(srcdir, "WEB-INF/aaa/bbb").getAbsolutePath(), false)); // srcdir/aaa/bbb

        // getResource
        assertResourceLoader("/myapp/", "WEB-INF", true); // dir
        assertResourceLoader("/myapp/web.xml", "WEB-INF/web.xml", true);
        assertResourceLoader("/myapp/abc.txt", "WEB-INF/aaa/bbb/abc.txt", true);
View Full Code Here

Examples of com.alibaba.citrus.service.resource.loader.FileResourceLoader.SearchPath

    }

    @Test
    public void search4() throws Exception {
        createLoader(srcdir.getAbsolutePath(), null, //
                new SearchPath("WEB-INF", true), // srcdir/WEB-INF
                new SearchPath(new File(srcdir, "WEB-INF/aaa").getAbsolutePath(), false), // srcdir/WEB-INF/aaa
                new SearchPath(new File(srcdir, "WEB-INF/aaa/ccc").getAbsolutePath(), false)); // srcdir/WEB-INF/aaa/ccc

        // getResource
        //----------------------------------------------------------------------------------
        // (1) without FOR_CREATE option
        assertResourceLoader("/myapp/def.txt", "WEB-INF/aaa/ccc/def.txt", true);
View Full Code Here

Examples of com.alibaba.citrus.service.resource.loader.FileResourceLoader.SearchPath

    }

    @Test
    public void _toString() {
        createLoader(srcdir.getAbsolutePath(), null, //
                new SearchPath("WEB-INF", true), // srcdir/WEB-INF
                new SearchPath(new File(srcdir, "aaa").getAbsolutePath(), false)); // srcdir/aaa

        assertThat(loader.toString(),
                containsAll("FileResourceLoader [", "relpath=WEB-INF, basedir=", "abspath=", "config/aaa", "]"));
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.