Package org.jboss.unit.remote.driver.handler.http.response

Examples of org.jboss.unit.remote.driver.handler.http.response.InvokePostResponse


         Body.Form form = Assert.assertInstanceOf(req.getBody(), Body.Form.class);
         Map<String, String[]> formParameters = form.getParameters();
         assertTrue(formParameters.isEmpty());

         //
         InvokePostResponse post = new InvokePostResponse(rewriteURL(testServlet, "?a=a_value_query"));
         post.setBody(new HttpRequest.Form());
         post.setContentType(InvokePostResponse.APPLICATION_X_WWW_FORM_URLENCODED);
         return post;
      }
      else if (getRequestCount() == 1)
      {
         Map<String, String[]> queryParameters = Assert.assertNotNull(req.getQueryParameterMap());
         assertEquals(1, queryParameters.size());
         assertEquals(new String[]{"a_value_query"}, queryParameters.get("a"));
         Body.Form form = Assert.assertInstanceOf(req.getBody(), Body.Form.class);
         Map<String, String[]> formParameters = form.getParameters();
         assertTrue(formParameters.isEmpty());

         //
         InvokePostResponse post = new InvokePostResponse(rewriteURL(testServlet, "/"));
         HttpRequest.Form requestForm = new HttpRequest.Form();
         requestForm.addParameter("a", new String[]{"a_value_body"});
         post.setBody(requestForm);
         post.setContentType(InvokePostResponse.APPLICATION_X_WWW_FORM_URLENCODED);
         return post;
      }
      else if (getRequestCount() == 2)
      {
         Map<String, String[]> queryParameters = Assert.assertNotNull(req.getQueryParameterMap());
         assertTrue(queryParameters.isEmpty());
         Body.Form form = Assert.assertInstanceOf(req.getBody(), Body.Form.class);
         Map<String, String[]> formParameters = form.getParameters();
         assertEquals(1, formParameters.size());
         assertEquals(new String[]{"a_value_body"}, formParameters.get("a"));

         //
         InvokePostResponse post = new InvokePostResponse(rewriteURL(testServlet, "?a=a_value_query"));
         post.setBody(new HttpRequest.Form());
         HttpRequest.Form requestForm = new HttpRequest.Form();
         requestForm.addParameter("a", new String[]{"a_value_form"});
         post.setBody(requestForm);
         post.setContentType(InvokePostResponse.APPLICATION_X_WWW_FORM_URLENCODED);
         return post;
      }
      else if (getRequestCount() == 3)
      {
         Map<String, String[]> queryParameters = Assert.assertNotNull(req.getQueryParameterMap());
         assertEquals(1, queryParameters.size());
         assertEquals(new String[]{"a_value_query"}, queryParameters.get("a"));
         Body.Form form = Assert.assertInstanceOf(req.getBody(), Body.Form.class);
         Map<String, String[]> formParameters = form.getParameters();
         assertEquals(1, formParameters.size());
         assertEquals(new String[]{"a_value_form"}, formParameters.get("a"));

         //
         InvokePostResponse post = new InvokePostResponse(rewriteURL(testServlet, "?a=" + encoder.encode(RANGE_0_255)));
         post.setBody(new HttpRequest.Form());
         HttpRequest.Form requestForm = new HttpRequest.Form();
         requestForm.addParameter("a", new String[]{RANGE_256_512});
         post.setBody(requestForm);
         post.setContentType(InvokePostResponse.APPLICATION_X_WWW_FORM_URLENCODED + "; charset=UTF-8");
         return post;
      }
      else if (getRequestCount() == 4)
      {
         Map<String, String[]> queryParameters = Assert.assertNotNull(req.getQueryParameterMap());
         assertEquals(1, queryParameters.size());
         assertNull(compareString(RANGE_0_255, queryParameters.get("a")[0]));
         Body.Form form = Assert.assertInstanceOf(req.getBody(), Body.Form.class);
         Map<String, String[]> formParameters = form.getParameters();
         assertEquals(1, formParameters.size());
         assertNull(compareString(RANGE_256_512, formParameters.get("a")[0]));

         //
         InvokePostResponse post = new InvokePostResponse(rewriteURL(testServlet, "?a=" + encoder.encode(RANGE_256_512)));
         post.setBody(new HttpRequest.Form());
         HttpRequest.Form requestForm = new HttpRequest.Form();
         requestForm.addParameter("a", new String[]{RANGE_0_255});
         post.setBody(requestForm);
         post.setContentType(InvokePostResponse.APPLICATION_X_WWW_FORM_URLENCODED + "; charset=UTF-8");
         return post;
      }
      else if (getRequestCount() == 5)
      {
         Map<String, String[]> queryParameters = Assert.assertNotNull(req.getQueryParameterMap());
View Full Code Here


   public DriverResponse invoke(TestServlet testServlet, DriverCommand driverCommand)
   {
      if (getRequestCount() == -1)
      {
         InvokePostResponse post = new InvokePostResponse(rewriteURL(testServlet, "/"));
         post.setBody(new HttpRequest.Form());
         post.setContentType(InvokePostResponse.APPLICATION_X_WWW_FORM_URLENCODED);
         return post;
      }
      else
      {
         return new FailureResponse(Failure.createAssertionFailure(""));
View Full Code Here

   public DriverResponse invoke(TestServlet testServlet, DriverCommand driverCommand)
   {
      if (getRequestCount() == -1)
      {
         InvokePostResponse post = new InvokePostResponse(rewriteURL(testServlet, "/"));
         HttpRequest.Raw raw = new HttpRequest.Raw();
         post.setBody(raw);
         raw.setBytes(new byte[]{0,1,1,2,3,5,8,13,21,34});
         post.setContentType(InvokePostResponse.MULTIPART_FORM_DATA);
         return post;
      }
      else
      {
         return new FailureResponse(Failure.createAssertionFailure(""));
View Full Code Here

TOP

Related Classes of org.jboss.unit.remote.driver.handler.http.response.InvokePostResponse

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.