Package org.apache.sling.engine.impl.request

Examples of org.apache.sling.engine.impl.request.SlingRequestPathInfo


       
        final ResourceMetadata metadata = new ResourceMetadata();
        final Resource r = new SyntheticResource(null, metadata, null);
        metadata.setResolutionPath(firstDot < 0 ? fullPath : fullPath.substring(0, firstDot));
        metadata.setResolutionPathInfo(firstDot < 0 ? null : fullPath.substring(firstDot));
        requestPathInfo = new SlingRequestPathInfo(r);
    }
View Full Code Here


/** Test the SlingRequestPathInfo class */
public class SlingRequestPathInfoTest extends TestCase {

    public void testNullResource() {
        try {
            new SlingRequestPathInfo(null, "dontcare");
            fail("Expected NullPointerException");
        } catch (NullPointerException npe) {
            // required for a null resource
        }
    }
View Full Code Here

            // required for a null resource
        }
    }

    public void testTrailingDot() {
        RequestPathInfo p = new SlingRequestPathInfo(
            new MockResource("/some/path"), "/some/path.");
        assertEquals("/some/path", p.getResourcePath());
        assertNull(p.getSelectorString());
        assertEquals(0, p.getSelectors().length);
        assertNull(p.getExtension());
        assertNull(p.getSuffix());
    }
View Full Code Here

        assertNull(p.getExtension());
        assertNull(p.getSuffix());
    }

    public void testTrailingDotWithSuffix() {
        RequestPathInfo p = new SlingRequestPathInfo(
            new MockResource("/some/path"), "/some/path./suffix");
        assertEquals("/some/path", p.getResourcePath());
        assertNull(p.getSelectorString());
        assertEquals(0, p.getSelectors().length);
        assertNull(p.getExtension());
        assertEquals("/suffix", p.getSuffix());
    }
View Full Code Here

        assertNull(p.getExtension());
        assertEquals("/suffix", p.getSuffix());
    }

    public void testTrailingDotDot() {
        RequestPathInfo p = new SlingRequestPathInfo(
            new MockResource("/some/path"), "/some/path..");
        assertEquals("/some/path", p.getResourcePath());
        assertNull(p.getSelectorString());
        assertEquals(0, p.getSelectors().length);
        assertNull(p.getExtension());
        assertNull(p.getSuffix());
    }
View Full Code Here

        assertNull(p.getExtension());
        assertNull(p.getSuffix());
    }

    public void testTrailingDotDotWithSuffix() {
        RequestPathInfo p = new SlingRequestPathInfo(
            new MockResource("/some/path"), "/some/path../suffix");
        assertEquals("/some/path", p.getResourcePath());
        assertNull(p.getSelectorString());
        assertEquals(0, p.getSelectors().length);
        assertNull(p.getExtension());
        assertEquals("/suffix", p.getSuffix());
    }
View Full Code Here

        assertNull(p.getExtension());
        assertEquals("/suffix", p.getSuffix());
    }

    public void testTrailingDotDotDot() {
        RequestPathInfo p = new SlingRequestPathInfo(
            new MockResource("/some/path"), "/some/path...");
        assertEquals("/some/path", p.getResourcePath());
        assertNull(p.getSelectorString());
        assertEquals(0, p.getSelectors().length);
        assertNull(p.getExtension());
        assertNull(p.getSuffix());
    }
View Full Code Here

        assertNull(p.getExtension());
        assertNull(p.getSuffix());
    }

    public void testTrailingDotDotDotWithSuffix() {
        RequestPathInfo p = new SlingRequestPathInfo(
            new MockResource("/some/path"), "/some/path.../suffix");
        assertEquals("/some/path", p.getResourcePath());
        assertNull(p.getSelectorString());
        assertEquals(0, p.getSelectors().length);
        assertNull(p.getExtension());
        assertEquals("/suffix", p.getSuffix());
    }
View Full Code Here

        assertNull(p.getExtension());
        assertEquals("/suffix", p.getSuffix());
    }

    public void testAllOptions() {
        RequestPathInfo p = new SlingRequestPathInfo(
            new MockResource("/some/path"), "/some/path.print.a4.html/some/suffix");
        assertEquals("/some/path", p.getResourcePath());
        assertEquals("print.a4", p.getSelectorString());
        assertEquals(2, p.getSelectors().length);
        assertEquals("print", p.getSelectors()[0]);
        assertEquals("a4", p.getSelectors()[1]);
        assertEquals("html", p.getExtension());
        assertEquals("/some/suffix", p.getSuffix());
    }
View Full Code Here

        assertEquals("html", p.getExtension());
        assertEquals("/some/suffix", p.getSuffix());
    }

    public void testAllEmpty() {
        RequestPathInfo p = new SlingRequestPathInfo(
            new MockResource("/"), null);
        assertEquals("/", p.getResourcePath());
        assertNull(p.getSelectorString());
        assertEquals(0, p.getSelectors().length);
        assertNull(p.getExtension());
        assertNull(p.getSuffix());
    }
View Full Code Here

TOP

Related Classes of org.apache.sling.engine.impl.request.SlingRequestPathInfo

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.