Package org.gatein.pc.test.unit.protocol.response

Examples of org.gatein.pc.test.unit.protocol.response.InvokeGetResponse


   {
      seq.bindAction(0, UTP3.RENDER_JOIN_POINT, new PortletRenderTestAction()
      {
         protected Response run(Portlet portlet, RenderRequest req, RenderResponse resp, PortletTestContext context) throws PortletException, IOException
         {
            return new InvokeGetResponse(resp.createActionURL().toString());
         }
      });
      seq.bindAction(1, UTP3.ACTION_JOIN_POINT, new PortletActionTestAction()
      {
         protected void run(Portlet portlet, ActionRequest req, ActionResponse resp, PortletTestContext context) throws PortletException, IOException
         {
            assertSame(PropagateDoFilterArgsFilter1.publishedActionRequest, PropagateDoFilterArgsFilter2.consumedActionRequest);
            assertSame(PropagateDoFilterArgsFilter1.publishedActionResponse, PropagateDoFilterArgsFilter2.consumedActionResponse);
            assertSame(PropagateDoFilterArgsFilter2.publishedActionRequest, req);
            assertSame(PropagateDoFilterArgsFilter2.publishedActionResponse, resp);

            //
            resp.setEvent("Event", null);
         }
      });
      seq.bindAction(1, UTP3.EVENT_JOIN_POINT, new PortletEventTestAction()
      {
         protected void run(Portlet portlet, EventRequest req, EventResponse resp, PortletTestContext context) throws PortletException, IOException
         {
            assertSame(PropagateDoFilterArgsFilter1.publishedEventRequest, PropagateDoFilterArgsFilter2.consumedEventRequest);
            assertSame(PropagateDoFilterArgsFilter1.publishedEventResponse, PropagateDoFilterArgsFilter2.consumedEventResponse);
            assertSame(PropagateDoFilterArgsFilter2.publishedEventRequest, req);
            assertSame(PropagateDoFilterArgsFilter2.publishedEventResponse, resp);
         }
      });
      seq.bindAction(1, UTP3.RENDER_JOIN_POINT, new PortletRenderTestAction()
      {
         protected Response run(Portlet portlet, RenderRequest req, RenderResponse resp, PortletTestContext context) throws PortletException, IOException
         {
            assertSame(PropagateDoFilterArgsFilter1.publishedRenderRequest, PropagateDoFilterArgsFilter2.consumedRenderRequest);
            assertSame(PropagateDoFilterArgsFilter1.publishedRenderResponse, PropagateDoFilterArgsFilter2.consumedRenderResponse);
            assertSame(PropagateDoFilterArgsFilter2.publishedRenderRequest, req);
            assertSame(PropagateDoFilterArgsFilter2.publishedRenderResponse, resp);

            //
            return new InvokeGetResponse(resp.createResourceURL().toString());
         }
      });
      seq.bindAction(2, UTP3.RESOURCE_JOIN_POINT, new PortletResourceTestAction()
      {
         protected Response run(Portlet portlet, ResourceRequest req, ResourceResponse resp, PortletTestContext context) throws PortletException, IOException
View Full Code Here


   {
      seq.bindAction(0, UTP1.RENDER_JOIN_POINT, new PortletRenderTestAction()
      {
         protected Response run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context)
         {
            return new InvokeGetResponse(response.createActionURL().toString());
         }
      });

      seq.bindAction(1, UTP1.ACTION_JOIN_POINT, new PortletActionTestAction()
      {
View Full Code Here

   {
      seq.bindAction(0, UTP1.RENDER_JOIN_POINT, new PortletRenderTestAction()
      {
         protected Response run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
         {
            return new InvokeGetResponse(response.createActionURL().toString());
         }
      });
      seq.bindAction(1, UTP1.ACTION_JOIN_POINT, new PortletActionTestAction()
      {
         protected void run(Portlet portlet, ActionRequest request, ActionResponse response, PortletTestContext context) throws PortletException, IOException
         {
            dispatch(portlet, request, response);

            //
            response.setEvent("Event", null);
         }
      });
      seq.bindAction(1, UTP1.EVENT_JOIN_POINT, new PortletEventTestAction()
      {
         protected void run(Portlet portlet, EventRequest request, EventResponse response, PortletTestContext context) throws PortletException, IOException
         {
            dispatch(portlet, request, response);
         }
      });
      seq.bindAction(1, UTP1.RENDER_JOIN_POINT, new PortletRenderTestAction()
      {
         protected Response run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
         {
            dispatch(portlet, request, response);

            //
            return new InvokeGetResponse(response.createResourceURL().toString());
         }
      });
      seq.bindAction(1, UTS1.SERVICE_JOIN_POINT, service);
      seq.bindAction(2, UTP1.RESOURCE_JOIN_POINT, new PortletResourceTestAction()
      {
View Full Code Here

   {
      seq.bindAction(0, UTP2.RENDER_JOIN_POINT, new PortletRenderTestAction()
      {
         protected Response run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context)
         {
            return new InvokeGetResponse(response.createActionURL().toString());
         }
      });
      seq.bindAction(1, UTP2.ACTION_JOIN_POINT, new PortletActionTestAction()
      {
         protected void run(Portlet portlet, ActionRequest request, ActionResponse response, PortletTestContext context) throws PortletException, IOException
View Full Code Here

            //
            url.setParameter("resource", new String[]{"resource_value"});

            //
            return new InvokeGetResponse(url.toString());
         }
      });
      seq.bindAction(1, UTP1.RESOURCE_JOIN_POINT, new PortletResourceTestAction()
      {
         protected Response run(Portlet portlet, ResourceRequest request, ResourceResponse response, PortletTestContext context) throws PortletException, IOException
         {
            Map<String, String[]> expectedParameters = Collections.singletonMap("resource", new String[]{"resource_value"});
            assertParameterMap(expectedParameters, request);
            assertParameterMap(expectedParameters, request.getPrivateParameterMap());
            assertParameterMap(new HashMap<String, String[]>(), request.getPrivateRenderParameterMap());
            assertParameterMap(new HashMap<String, String[]>(), request.getPublicParameterMap());

            //
            ResourceURL url = response.createResourceURL();

            //
            url.setParameter("resource", new String[]{"resource_value"});
            url.setParameter("resource_form", new String[]{"resource_form_value1"});

            //
            InvokePostResponse post = new InvokePostResponse(url.toString());
            post.setContentType(InvokePostResponse.APPLICATION_X_WWW_FORM_URLENCODED);
            Body.Form form = new Body.Form();
            form.addParameter("form", new String[]{"form_value"});
            form.addParameter("resource_form", new String[]{"resource_form_value2"});
            post.setBody(form);

            //
            return post;
         }
      });
      seq.bindAction(2, UTP1.RESOURCE_JOIN_POINT, new PortletResourceTestAction()
      {
         protected Response run(Portlet portlet, ResourceRequest request, ResourceResponse response, PortletTestContext context) throws PortletException, IOException
         {
            Map<String, String[]> expectedParameters = new HashMap<String, String[]>();
            expectedParameters.put("resource", new String[]{"resource_value"});
            expectedParameters.put("resource_form", new String[]{"resource_form_value1", "resource_form_value2"});
            expectedParameters.put("form", new String[]{"form_value"});
            assertParameterMap(expectedParameters, request);
            assertParameterMap(expectedParameters, request.getPrivateParameterMap());
            assertParameterMap(new HashMap<String, String[]>(), request.getPrivateRenderParameterMap());
            assertParameterMap(new HashMap<String, String[]>(), request.getPublicParameterMap());

            //
            PortletURL renderURL = response.createRenderURL();
            renderURL.setParameter("render", "render_value");
            renderURL.setParameter("resource_render", "resource_render_value2");
            renderURL.setParameter("form_render", "form_render_value2");
            renderURL.setParameter("resource_form_render", "resource_form_render_value3");

            //
            return new InvokeGetResponse(renderURL.toString());
         }
      });
      seq.bindAction(3, UTP1.RENDER_JOIN_POINT, new PortletRenderTestAction()
      {
         protected Response run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws PortletException, IOException
         {
            ResourceURL url = response.createResourceURL();

            //
            url.setParameter("resource", new String[]{"resource_value"});
            url.setParameter("resource_render", new String[]{"resource_render_value1"});

            //
            return new InvokeGetResponse(url.toString());
         }
      });
      seq.bindAction(4, UTP1.RESOURCE_JOIN_POINT, new PortletResourceTestAction()
      {
         protected Response run(Portlet portlet, ResourceRequest request, ResourceResponse response, PortletTestContext context) throws PortletException, IOException
         {
            Map<String, String[]> expectedParameters = new HashMap<String, String[]>();
            expectedParameters.put("resource", new String[]{"resource_value"});
            expectedParameters.put("resource_render", new String[]{"resource_render_value1","resource_render_value2"});
            expectedParameters.put("render", new String[]{"render_value"});
            expectedParameters.put("form_render", new String[]{"form_render_value2"});
            expectedParameters.put("resource_form_render", new String[]{"resource_form_render_value3"});
            Map<String, String[]> expectedPrivateRenderParameters = new HashMap<String, String[]>();
            expectedPrivateRenderParameters.put("render", new String[]{"render_value"});
            expectedPrivateRenderParameters.put("resource_render", new String[]{"resource_render_value2"});
            expectedPrivateRenderParameters.put("form_render", new String[]{"form_render_value2"});
            expectedPrivateRenderParameters.put("resource_form_render", new String[]{"resource_form_render_value3"});
            assertParameterMap(expectedParameters, request);
            assertParameterMap(expectedParameters, request.getPrivateParameterMap());
            assertParameterMap(expectedPrivateRenderParameters, request.getPrivateRenderParameterMap());
            assertParameterMap(new HashMap<String, String[]>(), request.getPublicParameterMap());

            //
            ResourceURL url = response.createResourceURL();

            //
            url.setParameter("resource", new String[]{"resource_value"});
            url.setParameter("resource_form", new String[]{"resource_form_value1"});
            url.setParameter("resource_render", new String[]{"resource_render_value1"});
            url.setParameter("resource_form_render", new String[]{"resource_form_render_value1"});

            //
            InvokePostResponse post = new InvokePostResponse(url.toString());
            post.setContentType(InvokePostResponse.APPLICATION_X_WWW_FORM_URLENCODED);
            Body.Form form = new Body.Form();
            form.addParameter("form", new String[]{"form_value"});
            form.addParameter("resource_form", new String[]{"resource_form_value2"});
            form.addParameter("form_render", new String[]{"form_render_value1"});
            form.addParameter("resource_form_render", new String[]{"resource_form_render_value2"});
            post.setBody(form);

            //
            return post;
         }
      });
      seq.bindAction(5, UTP1.RESOURCE_JOIN_POINT, new PortletResourceTestAction()
      {
         protected Response run(Portlet portlet, ResourceRequest request, ResourceResponse response, PortletTestContext context) throws PortletException, IOException
         {
            Map<String, String[]> expectedParameters = new HashMap<String, String[]>();
            expectedParameters.put("resource", new String[]{"resource_value"});
            expectedParameters.put("resource_form", new String[]{"resource_form_value1","resource_form_value2"});
            expectedParameters.put("resource_render", new String[]{"resource_render_value1","resource_render_value2"});
            expectedParameters.put("resource_form_render", new String[]{"resource_form_render_value1","resource_form_render_value2","resource_form_render_value3"});
            expectedParameters.put("form", new String[]{"form_value"});
            expectedParameters.put("form_render", new String[]{"form_render_value1","form_render_value2"});
            expectedParameters.put("render", new String[]{"render_value"});
            Map<String, String[]> expectedPrivateRenderParameters = new HashMap<String, String[]>();
            expectedPrivateRenderParameters.put("render", new String[]{"render_value"});
            expectedPrivateRenderParameters.put("resource_render", new String[]{"resource_render_value2"});
            expectedPrivateRenderParameters.put("form_render", new String[]{"form_render_value2"});
            expectedPrivateRenderParameters.put("resource_form_render", new String[]{"resource_form_render_value3"});
            assertParameterMap(expectedParameters, request);
            assertParameterMap(expectedParameters, request.getPrivateParameterMap());
            assertParameterMap(expectedPrivateRenderParameters, request.getPrivateRenderParameterMap());
            assertParameterMap(new HashMap<String, String[]>(), request.getPublicParameterMap());

            //
            PortletURL renderURL = response.createRenderURL();
            renderURL.setParameter("render", "render_value");
            renderURL.setParameter("resource_render", "resource_render_value2");
            renderURL.setParameter("form_render", "form_render_value2");
            renderURL.setParameter("resource_form_render", "resource_form_render_value3");
            renderURL.setParameter("public", "public_value");
            renderURL.setParameter("resource_public", "resource_public_value2");
            renderURL.setParameter("form_public", "form_public_value2");
            renderURL.setParameter("resource_form_public", "resource_form_public_value3");

            //
            return new InvokeGetResponse(renderURL.toString());
         }
      });
      seq.bindAction(6, UTP1.RENDER_JOIN_POINT, new PortletRenderTestAction()
      {
         protected Response run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws PortletException, IOException
View Full Code Here

   {
      seq.bindAction(0, UTP1.RENDER_JOIN_POINT, new PortletRenderTestAction()
      {
         protected Response run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context)
         {
            return new InvokeGetResponse(response.createActionURL().toString());
         }
      });
      seq.bindAction(1, UTP1.ACTION_JOIN_POINT, new PortletActionTestAction()
      {
         protected void run(Portlet portlet, ActionRequest request, ActionResponse response, PortletTestContext context) throws PortletException, IOException
         {
            response.setRenderParameter("foo", "fooaction1");
         }
      });
      seq.bindAction(1, UTP1.RENDER_JOIN_POINT, new PortletRenderTestAction()
      {
         protected Response run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context)
         {
            assertRenderParameter(request, "foo", "fooaction1");
            return new InvokeGetResponse(response.createActionURL().toString());
         }
      });

      //
      seq.bindAction(2, UTP1.ACTION_JOIN_POINT, new PortletActionTestAction()
      {
         protected void run(Portlet portlet, ActionRequest request, ActionResponse response, PortletTestContext context) throws PortletException, IOException
         {
            response.setRenderParameter("foo", "fooaction2");
            response.setEvent("Foo", null);
         }
      });
      seq.bindAction(2, UTP1.EVENT_JOIN_POINT, new PortletEventTestAction()
      {
         protected void run(Portlet portlet, EventRequest request, EventResponse response, PortletTestContext context) throws PortletException, IOException
         {
            if ("Foo".equals(request.getEvent().getName()))
            {
               assertRenderParameter(request, "foo", "fooaction2");
               response.setRenderParameter("foo", "fooevent1");
            }
            else
            {
               fail();
            }
         }
      });
      seq.bindAction(2, UTP1.RENDER_JOIN_POINT, new PortletRenderTestAction()
      {
         protected Response run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context)
         {
            assertRenderParameter(request, "foo", "fooevent1");
            return new InvokeGetResponse(response.createActionURL().toString());
         }
      });

      //
      seq.bindAction(3, UTP1.ACTION_JOIN_POINT, new PortletActionTestAction()
View Full Code Here

   {
      seq.bindAction(0, UTP1.RENDER_JOIN_POINT, new PortletRenderTestAction()
      {
         protected Response run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context)
         {
            return new InvokeGetResponse(response.createActionURL().toString());
         }
      });

      seq.bindAction(1, UTP1.ACTION_JOIN_POINT, new PortletActionTestAction()
      {
         protected void run(Portlet portlet, ActionRequest request, ActionResponse response, PortletTestContext context) throws ReadOnlyException, IOException, ValidatorException
         {
            // Get prefs
            PortletPreferences prefs = request.getPreferences();

            // Test the initial value is ok
            assertEquals("single_pref_value", prefs.getValue("single_pref", "other"));
            assertEquals(new String[]{"multi_pref_value_1", "multi_pref_value_2"},
               prefs.getValues("multi_pref", new String[]{"other"}));

            // Set with new values
            prefs.setValue("single_pref", "new_single_pref");
            prefs.setValues("multi_pref", new String[]{"new_multi_pref_value_1", "new_multi_pref_value_2"});

            // Test with new values
            assertEquals("new_single_pref", prefs.getValue("single_pref", "other"));
            assertEquals(new String[]{"new_multi_pref_value_1", "new_multi_pref_value_2"}, prefs.getValues("multi_pref", new String[]{"other"}));

            // Trigger store
            prefs.store();

            // Test with new values after store
            assertEquals("new_single_pref", prefs.getValue("single_pref", "other"));
            assertEquals(new String[]{"new_multi_pref_value_1", "new_multi_pref_value_2"}, prefs.getValues("multi_pref", new String[]{"other"}));
         }
      });

      seq.bindAction(1, UTP1.RENDER_JOIN_POINT, new PortletRenderTestAction()
      {
         protected Response run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context)
         {
            return new InvokeGetResponse(response.createActionURL().toString());
         }
      });

      seq.bindAction(2, UTP1.ACTION_JOIN_POINT, new PortletActionTestAction()
      {
View Full Code Here

   {
      seq.bindAction(0, UTP4.RENDER_JOIN_POINT, new PortletRenderTestAction()
      {
         protected Response run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context)
         {
            return new InvokeGetResponse(response.createActionURL().toString());
         }
      });
      seq.bindAction(1, UTP4.ACTION_JOIN_POINT, new PortletActionTestAction()
      {
         protected void run(Portlet portlet, ActionRequest request, ActionResponse response, PortletTestContext context) throws PortletException, IOException
View Full Code Here

   {
      seq.bindAction(0, UTP6.RENDER_JOIN_POINT, new PortletRenderTestAction()
      {
         protected Response run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context)
         {
            return new InvokeGetResponse(response.createActionURL().toString());
         }
      });
      seq.bindAction(1, UTP6.ACTION_JOIN_POINT, new PortletActionTestAction()
      {
         protected void run(Portlet portlet, ActionRequest request, ActionResponse response, PortletTestContext context) throws PortletException, IOException
View Full Code Here

   {
      seq.bindAction(0, UTP2.RENDER_JOIN_POINT, new PortletRenderTestAction()
      {
         protected Response run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context)
         {
            return new InvokeGetResponse(response.createActionURL().toString());
         }
      });

      seq.bindAction(1, UTP2.ACTION_JOIN_POINT, new PortletActionTestAction()
      {
         protected void run(Portlet portlet, ActionRequest request, ActionResponse response, PortletTestContext context) throws ReadOnlyException, IOException, ValidatorException
         {
            // Get prefs
            PortletPreferences prefs = request.getPreferences();

            // Test the initial value is ok
            assertEquals("action_single_pref_value", prefs.getValue("action_single_pref", "other"));
            assertEquals(new String[]{"action_multi_pref_value_1", "action_multi_pref_value_2"},
               prefs.getValues("action_multi_pref", new String[0]));

            // Set the values to null
            prefs.setValue("action_single_pref", null);
            prefs.setValues("action_multi_pref", null);

            // Test with new valus
            assertEquals(null, prefs.getValue("action_single_pref", "other"));
            assertEquals(null, prefs.getValue("action_multi_pref", "other"));

            // Trigger store
            prefs.store();

            // Test with new value after store
            assertEquals(null, prefs.getValue("action_single_pref", "other"));
            assertEquals(null, prefs.getValue("action_multi_pref", "other"));
         }
      });

      seq.bindAction(1, UTP2.RENDER_JOIN_POINT, new PortletRenderTestAction()
      {
         protected Response run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context)
         {
            return new InvokeGetResponse(response.createActionURL().toString());
         }
      });

      seq.bindAction(2, UTP2.ACTION_JOIN_POINT, new PortletActionTestAction()
      {
View Full Code Here

TOP

Related Classes of org.gatein.pc.test.unit.protocol.response.InvokeGetResponse

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.