Package org.apache.jetspeed.mockobjects.request

Examples of org.apache.jetspeed.mockobjects.request.MockRequestContext


    public void testPage() throws Exception
    {
        assertNotNull("profiler service is null", profiler);

        RequestContext request = new MockRequestContext();

        request.setSubject(JetspeedSubjectFactory.createSubject(new UserImpl("anon"), null, null, null));
        request.setLocale(new Locale("en", "US"));
        request.setMediaType("HTML");
        request.setMimeType("text/html");

        ProfileLocator locator = profiler.getProfile(request, ProfileLocator.PAGE_LOCATOR);
        assertNotNull("rule test on getProfile returned null", locator);
        System.out.println("page = " + locator.getValue("page"));
    }
View Full Code Here


    public void testPath() throws Exception
    {
        assertNotNull("profiler service is null", profiler);

        RequestContext request = new MockRequestContext("/football/nfl/chiefs");
        ProfilingRule rule = profiler.getRule("path");
        ProfileLocator locator = profiler.getProfile(request, rule);
        assertNotNull("rule test on getProfile returned null", locator);
        String path = locator.getLocatorPath();
        System.out.println("locator = " + path);
View Full Code Here

       
        // create the mock request context
        MockHttpServletRequest request = new MockHttpServletRequest();      
        MockHttpServletResponse response = new MockHttpServletResponse();
        request.setUserPrincipal(new MockPrincipal("david"));
        MockRequestContext context = new MockRequestContext(request, response);
       
        // create a simple key
        String window1 = "/default-page.psml";
        ContentCacheKey cckey1 = contentCache.createCacheKey(context, window1);
        assertEquals(cckey1.getKey(), "david/portal//default-page.psml");

        // create a another key for desktop
        String window2 = "/about.psml";
        context.getParameterMap().put("encoder", "desktop");
        ContentCacheKey cckey2 = contentCache.createCacheKey(context, window2);
        assertEquals(cckey2.getKey(), "david/desktop//about.psml");
       
        // create some PortletContent mock objects
        MockTheme theme1 = new MockTheme("/default-page.psml");
View Full Code Here

        request.setUserPrincipal(new MockPrincipal("david"));
        MockHttpSession session = new MockHttpSession();
        request.setSession(session);
        String sessionId = session.getId();

        MockRequestContext context = new MockRequestContext(request, response);
       
        // create a simple key
        String window1 = "/default-page.psml";
        ContentCacheKey cckey1 = contentCache.createCacheKey(context, window1);
        assertEquals(cckey1.getKey(), sessionId + "/portal//default-page.psml");

        // create a another key for desktop
        String window2 = "/about.psml";
        context.getParameterMap().put("encoder", "desktop");
        ContentCacheKey cckey2 = contentCache.createCacheKey(context, window2);
        assertEquals(cckey2.getKey(), sessionId + "/desktop//about.psml");
       
        // create some MockTheme objects
        MockTheme theme1 = new MockTheme("/default-page.psml");
View Full Code Here

        request.setContextPath("/jetspeed");
        request.setServletPath("/portal");
        request.setPathInfo("/news/default-page.psml");
        request.setRequestURI("/jetspeed/portal/news/default-page.psml");
        request.setMethod("GET");
        RequestContext rc = new MockRequestContext(request, response);
        return rc;
    }
View Full Code Here

       
        // create the mock request context
        MockHttpServletRequest request = new MockHttpServletRequest();      
        MockHttpServletResponse response = new MockHttpServletResponse();
        request.setUserPrincipal(new MockPrincipal("david"));
        MockRequestContext context = new MockRequestContext(request, response);
       
        // create a simple key
        String window1 = "555-01";
        ContentCacheKey cckey1 = contentCache.createCacheKey(context, window1);
        assertEquals(cckey1.getKey(), "david/portal/555-01");

        // create a another key for desktop
        String window2 = "555-02";
        context.getParameterMap().put("encoder", "desktop");
        ContentCacheKey cckey2 = contentCache.createCacheKey(context, window2);
        assertEquals(cckey2.getKey(), "david/desktop/555-02");
       
        // create some PortletContent mock objects
        PortletContent content1 = new MockPortletContent(cckey1, 100, "ContentOne", "content1content1content1content1");
View Full Code Here

        request.setUserPrincipal(new MockPrincipal("david"));
        MockHttpSession session = new MockHttpSession();
        request.setSession(session);
        String sessionId = session.getId();

        MockRequestContext context = new MockRequestContext(request, response);
       
        // create a simple key
        String window1 = "555-01";
        ContentCacheKey cckey1 = contentCache.createCacheKey(context, window1);
        assertEquals(cckey1.getKey(), sessionId + "/portal/555-01");

        // create a another key for desktop
        String window2 = "555-02";
        context.getParameterMap().put("encoder", "desktop");
        ContentCacheKey cckey2 = contentCache.createCacheKey(context, window2);
        assertEquals(cckey2.getKey(), sessionId + "/desktop/555-02");
       
        // create some PortletContent mock objects
        PortletContent content1 = new MockPortletContent(cckey1, 100, "ContentOne", "content1content1content1content1");
View Full Code Here

            System.out.println(rc.getType());
            ix++;
        }
       
        // test applying it
        RequestContext context = new MockRequestContext();
        Subject subject = createSubject();
        context.setPath("/homepage.psml");       
        context.setSubject(subject);
        ProfileLocator locator = rule.apply(context, profiler);
        System.out.println("locator = " + locator);
        assertTrue("locator string " + locator.toString(), locator.toString().equals("/homepage.psml:user:david:navigation:/:role:ATP:role:NB:role:ATP-NB:page:/homepage.psml"));
       
        System.out.println("COMPLETED: running test user role fallback.");
View Full Code Here

            System.out.println(rc.getType());
            ix++;
        }
       
        // test applying it
        RequestContext context = new MockRequestContext();
        Subject subject = createSubject2();
        context.setPath("/homepage.psml");       
        context.setSubject(subject);
        ProfileLocator locator = rule.apply(context, profiler);
        System.out.println("locator = " + locator);                            //     /homepage.psml:user:david:navigation:/:role:ATP:role:NB:page:/homepage.psml
        assertTrue("locator string " + locator.toString(), locator.toString().equals("/homepage.psml:user:david:navigation:/:role:ATP-NB:page:/homepage.psml"));
       
        System.out.println("COMPLETED: running test user role fallback.");
View Full Code Here

            System.out.println(rc.getType());
            ix++;
        }
       
        // test applying it
        RequestContext context = new MockRequestContext();
        Subject subject = createSubject();
        context.setPath("/homepage.psml");       
        context.setSubject(subject);
        ProfileLocator locator = rule.apply(context, profiler);
        System.out.println("locator = " + locator);
        assertTrue("locator string " + locator.toString(), locator.toString().equals("/homepage.psml:user:david:navigation:/:role:ATP:role:NB:role:ATP-NB:page:/homepage.psml"));
       
        System.out.println("COMPLETED: running test user role fallback.");
View Full Code Here

TOP

Related Classes of org.apache.jetspeed.mockobjects.request.MockRequestContext

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.