Package org.apache.tapestry.engine

Examples of org.apache.tapestry.engine.ServiceEncoding


        expect(encoding.getServletPath()).andReturn(servletPath);
    }

    public void test_Encode()
    {
        ServiceEncoding encoding = newEncoding();
       
        trainGetParameterValue(encoding, ServiceConstants.SERVICE, Tapestry.ASSET_SERVICE);
        trainGetParameterValue(encoding, AssetService.PATH, "/foo/bar/Baz.gif");
        trainGetParameterValue(encoding, AssetService.DIGEST, "12345");
       
        encoding.setServletPath("/assets/12345/foo/bar/Baz.gif");
        encoding.setParameterValue(AssetService.PATH, null);
        encoding.setParameterValue(AssetService.DIGEST, null);
        encoding.setParameterValue(ServiceConstants.SERVICE, null);

        replay();

        AssetEncoder encoder = new AssetEncoder();
        encoder.setPath("/assets");
View Full Code Here


        verify();
    }

    public void test_Encode_Missing_Path()
    {
        ServiceEncoding encoding = newEncoding();
       
        trainGetParameterValue(encoding, ServiceConstants.SERVICE, Tapestry.ASSET_SERVICE);
        trainGetParameterValue(encoding, AssetService.PATH, "foo/bar/Baz.gif");
        trainGetParameterValue(encoding, AssetService.DIGEST, "12345");
       
        encoding.setServletPath("/assets/12345/foo/bar/Baz.gif");
        encoding.setParameterValue(AssetService.PATH, null);
        encoding.setParameterValue(AssetService.DIGEST, null);
        encoding.setParameterValue(ServiceConstants.SERVICE, null);
       
        replay();

        AssetEncoder encoder = new AssetEncoder();
        encoder.setPath("/assets");
View Full Code Here

        verify();
    }
   
    public void test_Decode()
    {
        ServiceEncoding encoding = newEncoding();

        trainGetServletPath(encoding, "/assets");
        trainGetPathInfo(encoding, "/12345/foo/bar/Baz.gif");

        encoding.setParameterValue(ServiceConstants.SERVICE, Tapestry.ASSET_SERVICE);
        encoding.setParameterValue(AssetService.DIGEST, "12345");
        encoding.setParameterValue(AssetService.PATH, "/foo/bar/Baz.gif");

        replay();

        AssetEncoder encoder = new AssetEncoder();
        encoder.setPath("/assets");
View Full Code Here

        expect(encoding.getPathInfo()).andReturn(pathInfo);
    }
   
    public void test_Encode_Unprotected()
    {
        ServiceEncoding encoding = newEncoding();

        trainGetParameterValue(encoding, ServiceConstants.SERVICE, Tapestry.ASSET_SERVICE);
        trainGetParameterValue(encoding, AssetService.PATH, "/foo/bar/Baz.gif");
        trainGetParameterValue(encoding, AssetService.DIGEST, null);
       
        encoding.setServletPath("/assets/" + AssetEncoder.DIGEST_STATIC + "/foo/bar/Baz.gif");
        encoding.setParameterValue(AssetService.PATH, null);
        encoding.setParameterValue(AssetService.DIGEST, null);
        encoding.setParameterValue(ServiceConstants.SERVICE, null);

        replay();

        AssetEncoder encoder = new AssetEncoder();
        encoder.setPath("/assets");
View Full Code Here

        _encoder.setUrl("/book");
    }

    public void testEncodeWrongService()
    {
        ServiceEncoding encoding = newEncoding();

        trainGetParameterValue(encoding, ServiceConstants.SERVICE, "wrong");

        replayControls();
View Full Code Here

        verifyControls();
    }

    public void testEncodeWrongPage()
    {
        ServiceEncoding encoding = newEncoding();

        trainGetParameterValue(encoding, ServiceConstants.SERVICE, Tapestry.EXTERNAL_SERVICE);
        trainGetParameterValue(encoding, ServiceConstants.PAGE, "Foo");

        replayControls();
View Full Code Here

        verify();
    }
   
    public void test_Decode_Unprotected()
    {
        ServiceEncoding encoding = newEncoding();
       
        trainGetServletPath(encoding, "/assets");
        trainGetPathInfo(encoding, "/" + AssetEncoder.DIGEST_STATIC + "/foo/bar/Baz.gif");
       
        encoding.setParameterValue(ServiceConstants.SERVICE, Tapestry.ASSET_SERVICE);
        encoding.setParameterValue(AssetService.DIGEST, AssetEncoder.DIGEST_STATIC);
        encoding.setParameterValue(AssetService.PATH, "/foo/bar/Baz.gif");

        replay();

        AssetEncoder encoder = new AssetEncoder();
        encoder.setPath("/assets");
View Full Code Here

        verifyControls();
    }

    public void testEncodeMatch()
    {
        ServiceEncoding encoding = newEncoding();

        trainGetParameterValue(encoding, ServiceConstants.SERVICE, Tapestry.EXTERNAL_SERVICE);
        trainGetParameterValue(encoding, ServiceConstants.PAGE, "ViewBook");
        trainGetParameterValues(encoding, ServiceConstants.PARAMETER, new String[]
        { "1234" });

        encoding.setServletPath("/book/1234");
        encoding.setParameterValue(ServiceConstants.SERVICE, null);
        encoding.setParameterValue(ServiceConstants.PAGE, null);
        encoding.setParameterValue(ServiceConstants.PARAMETER, null);

        replayControls();

        _encoder.encode(encoding);
View Full Code Here

        verifyControls();
    }

    public void testDecodeWrongURL()
    {
        ServiceEncoding encoding = newEncoding();

        trainGetServletPath(encoding, "/Home.html");

        replayControls();
View Full Code Here

        verifyControls();
    }

    public void testDecodeMatch()
    {
        ServiceEncoding encoding = newEncoding();

        trainGetServletPath(encoding, "/book");
        trainGetPathInfo(encoding, "/2001");

        encoding.setParameterValue(ServiceConstants.SERVICE, Tapestry.EXTERNAL_SERVICE);
        encoding.setParameterValue(ServiceConstants.PAGE, "ViewBook");
        encoding.setParameterValues(eq(ServiceConstants.PARAMETER), aryEq(new String[]
        { "2001" }));
       
        replayControls();

        _encoder.decode(encoding);
View Full Code Here

TOP

Related Classes of org.apache.tapestry.engine.ServiceEncoding

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.