Package org.gatein.pc.test.unit.actions

Examples of org.gatein.pc.test.unit.actions.PortletRenderTestAction


public class PortletScopedAttributesAreApplicationScopedAttributes
{

   public PortletScopedAttributesAreApplicationScopedAttributes(PortletTestCase seq)
   {
      seq.bindAction(0, UTP1.RENDER_JOIN_POINT, new PortletRenderTestAction()
      {
         protected Response run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws PortletException, IOException
         {
            PortletSession session = request.getPortletSession();
            session.setAttribute("foo", "bar");
View Full Code Here


   })
public class ForwardFromRenderObjects
{
   public ForwardFromRenderObjects(final PortletTestCase seq)
   {
      seq.bindAction(0, UTP1.RENDER_JOIN_POINT, new PortletRenderTestAction()
      {
         protected Response run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context)
         {
            // Invoke render with header
            InvokeGetResponse render = new InvokeGetResponse(response.createRenderURL().toString());
            render.addHeader("myheader", "render-value");

            return render;
         }
      });

      seq.bindAction(1, UTP1.RENDER_JOIN_POINT, new PortletRenderTestAction()
      {
         protected Response run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
         {
            //we dispatch to servlet and assertions will be done there
            String queryString = "?key1=k1value1&key2=k2value1";
View Full Code Here

   })
public class ActionRequestUseForm
{
   public ActionRequestUseForm(PortletTestCase seq)
   {
      seq.bindAction(0, UTP1.RENDER_JOIN_POINT, new PortletRenderTestAction()
      {
         protected Response run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context)
         {
            PortletURL url = response.createActionURL();
            url.setParameter("g_foo1", "g_bar1_1");
            url.setParameter("g_foo2", new String[]{"g_bar2_1", "g_bar2_2"});
            url.setParameter("g_foo3", new String[]{"g_bar3_1"});
            InvokePostResponse iur = new InvokePostResponse(url.toString());
            Body.Form body = new Body.Form();
            body.addParameter("g_foo3", new String[]{"g_bar3_2"});
            body.addParameter("g_foo4", new String[]{"g_bar4_1"});
            body.addParameter("g_foo5", new String[]{"g_bar5_1", "g_bar5_2"});
            iur.setBody(body);
            iur.setContentType(InvokePostResponse.APPLICATION_X_WWW_FORM_URLENCODED);
            return iur;
         }
      });

      seq.bindAction(1, UTP1.ACTION_JOIN_POINT, new PortletActionTestAction()
      {
         protected void run(Portlet portlet, ActionRequest request, ActionResponse response, PortletTestContext context) throws IOException
         {
            assertEquals(new String[]{"g_bar1_1"}, request.getParameterValues("g_foo1"));
            assertEquals(new String[]{"g_bar2_1", "g_bar2_2"}, request.getParameterValues("g_foo2"));
            assertEquals(new String[]{"g_bar3_1", "g_bar3_2"}, request.getParameterValues("g_foo3"));
            assertEquals(new String[]{"g_bar4_1"}, request.getParameterValues("g_foo4"));
            assertEquals(new String[]{"g_bar5_1", "g_bar5_2"}, request.getParameterValues("g_foo5"));
            assertEquals(InvokePostResponse.APPLICATION_X_WWW_FORM_URLENCODED, request.getContentType());

            try
            {
               request.getPortletInputStream();
               fail("Should not get the input stream");
            }
            catch (IllegalStateException expected)
            {
               //expected
            }

            try
            {
               request.getReader();
               fail("Should not get the reader");
            }
            catch (IllegalStateException expected)
            {
               //expected
            }
         }
      });

      seq.bindAction(1, UTP1.RENDER_JOIN_POINT, new PortletRenderTestAction()
      {
         protected Response run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context)
         {
            return new EndTestResponse();
         }
View Full Code Here

   })
public class ResourceBundleCascade
{
   public ResourceBundleCascade(PortletTestCase seq)
   {
      seq.bindAction(0, ResourceBundleCascadePortlet.RENDER_JOIN_POINT, new PortletRenderTestAction()
      {
         protected Response run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context)
         {
            PortletConfig cfg = ((AbstractUniversalTestPortlet)portlet).getPortletConfig();
View Full Code Here

   })
public class States
{
   public States(PortletTestCase seq)
   {
      seq.bindAction(0, UTP1.RENDER_JOIN_POINT, new PortletRenderTestAction()
      {
         protected Response run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context)
         {
            assertEquals("minimized", "" + WindowState.MINIMIZED);
            assertEquals("maximized", "" + WindowState.MAXIMIZED);
View Full Code Here

public class HTTPSessionInvalidationInvalidesPortletSession
{

   public HTTPSessionInvalidationInvalidesPortletSession(PortletTestCase seq)
   {
      seq.bindAction(0, UTP1.RENDER_JOIN_POINT, new PortletRenderTestAction()
      {
         protected Response run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws PortletException, IOException
         {
            PortletSession session = request.getPortletSession();
View Full Code Here

@TestCase({Assertion.API286_WINDOW_STATE_5})
public class Equals
{
   public Equals(PortletTestCase seq)
   {
      seq.bindAction(0, UTP1.RENDER_JOIN_POINT, new PortletRenderTestAction()
      {
         protected Response run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context)
         {
            WindowState ws1 = new WindowState("TestState");
            WindowState ws2 = new WindowState("teststate");
View Full Code Here

   })
public class SessionDoesNotExistBeforeItIsRequested
{
   public SessionDoesNotExistBeforeItIsRequested(PortletTestCase seq)
   {
      seq.bindAction(0, UTP1.RENDER_JOIN_POINT, new PortletRenderTestAction()
      {
         protected Response run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context)
         {
            PortletSession session = request.getPortletSession(false);
            assertNull(session);
View Full Code Here

@TestCase({Assertion.API286_WINDOW_STATE_1})
public class Constructor
{
   public Constructor(PortletTestCase seq)
   {
      seq.bindAction(0, UTP1.RENDER_JOIN_POINT, new PortletRenderTestAction()
      {
         protected Response run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context)
         {
            assertEquals("teststate", "" + new WindowState("teststate"));
            assertEquals("teststate", "" + new WindowState("TESTSTATE"));
View Full Code Here

   })
public class RequestHeaderAccess
{
   public RequestHeaderAccess(PortletTestCase seq)
   {
      seq.bindAction(0, UTP1.RENDER_JOIN_POINT, new PortletRenderTestAction()
      {
         protected Response run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context)
         {
            // Test the value is not there yet
            Set propertyNames = Tools.toSet(request.getPropertyNames());
            assertFalse(propertyNames.contains("myheader"));
            assertNull(request.getProperty("myheader"));
            assertFalse(request.getProperties("myheader").hasMoreElements());

            // Invoke render with header
            InvokeGetResponse render = new InvokeGetResponse(response.createRenderURL().toString());
            render.addHeader("myheader", "render-value");
            return render;
         }
      });

      seq.bindAction(1, UTP1.RENDER_JOIN_POINT, new PortletRenderTestAction()
      {
         protected Response run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context)
         {
            // Test the header is here
            Set propertyNames = Tools.toSet(request.getPropertyNames());
            assertTrue(propertyNames.contains("myheader"));
            assertEquals("render-value", request.getProperty("myheader"));
            Enumeration values = request.getProperties("myheader");
            assertTrue(values.hasMoreElements());
            assertEquals("render-value", values.nextElement());
            assertFalse(values.hasMoreElements());

            // Invoke action with header
            InvokeGetResponse action = new InvokeGetResponse(response.createActionURL().toString());
            action.addHeader("myheader", "action-value");
            return action;
         }
      });

      seq.bindAction(2, UTP1.ACTION_JOIN_POINT, new PortletActionTestAction()
      {
         protected void run(Portlet portlet, ActionRequest request, ActionResponse response, PortletTestContext context)
         {
            // Test the header is here
            Set propertyNames = Tools.toSet(request.getPropertyNames());
            assertTrue(propertyNames.contains("myheader"));
            assertEquals("action-value", request.getProperty("myheader"));
            Enumeration values = request.getProperties("myheader");
            assertTrue(values.hasMoreElements());
            assertEquals("action-value", values.nextElement());
            assertFalse(values.hasMoreElements());
         }
      });

      seq.bindAction(2, UTP1.RENDER_JOIN_POINT, new PortletRenderTestAction()
      {
         protected Response run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context)
         {
            return new EndTestResponse();
         }
View Full Code Here

TOP

Related Classes of org.gatein.pc.test.unit.actions.PortletRenderTestAction

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.