Package org.jboss.unit.driver.response

Examples of org.jboss.unit.driver.response.FailureResponse


            return new EndTestResponse();
         }
      }

      //
      return new FailureResponse(Failure.createAssertionFailure(""));
   }
View Full Code Here


      if (getRequestCount() == -1)
      {
         container = DefaultServletContainerFactory.getInstance().getServletContainer();
         if (container == null)
         {
            return new FailureResponse(Failure.createAssertionFailure("No servlet container present"));
         }

         // Register and save the deployed web apps
         registry = new WebAppRegistry();
         container.addWebAppListener(registry);
         keys = new HashSet<String>(registry.getKeys());

         // Deploy the application web app
         return new DeployResponse("test-spi-app.war");
      }
      else if (getRequestCount() == 0)
      {
         // Compute the difference with the previous deployed web apps
         Set diff = new HashSet<String>(registry.getKeys());
         diff.removeAll(keys);

         // It should be 1
         if (diff.size() != 1)
         {
            return new FailureResponse(Failure.createAssertionFailure("The size of the new web application deployed should be 1, it is " + diff.size() + " instead." +
            "The previous set was " + keys + " and the new set is " + registry.getKeys()));
         }
         String key = (String)diff.iterator().next();
         if (!"/test-spi-app".equals(key))
         {
            return new FailureResponse(Failure.createAssertionFailure("The newly deployed web application should be /test-spi-war and it is " + key));
         }

         //
         WebApp webApp = registry.getWebApp("/test-spi-app");
         if (webApp == null)
         {
            return new FailureResponse(Failure.createAssertionFailure("The web app /test-spi-app was not found"));
         }
         if (!"/test-spi-app".equals(webApp.getContextPath()))
         {
            return new FailureResponse(Failure.createAssertionFailure("The web app context is not equals to the expected value but has the value " + webApp.getContextPath()));
         }

         //
         return new InvokeGetResponse("/test-spi-server");
      }
      else
      {
         return new FailureResponse(Failure.createAssertionFailure(""));
      }
   }
View Full Code Here

      try
      {
         dispatcher.include(target, this, null);

         //
         return new FailureResponse(Failure.createAssertionFailure("Got no throwable thrown was expecting " + expectedThrowable));
      }
      catch (Throwable throwable)
      {
         if (throwable instanceof ServletException)
         {
            throwable = throwable.getCause();
         }
         if (expectedThrowable != throwable)
         {
            return new FailureResponse(Failure.createAssertionFailure("Got throwable " + throwable + " instead of throwable " + expectedThrowable));
         }
      }

      //
      return null;
View Full Code Here

     private ServletContainer container;

     public DriverResponse service(TestServlet testServlet, WebRequest req, WebResponse resp) throws ServletException, IOException
     {
      // we shouldn't be calling service for these tests
        return new FailureResponse(Failure.createAssertionFailure("Service call should not be called"));
     }
View Full Code Here

        if (getRequestCount() == -1)
        {
           container = DefaultServletContainerFactory.getInstance().getServletContainer();
           if (container == null)
           {
              return new FailureResponse(Failure.createAssertionFailure("No servlet container present"));
           }

           // Register and save the deployed web apps
           registry = new WebAppRegistry();
           container.addWebAppListener(registry);
           keys = new HashSet<String>(registry.getKeys());

           // Deploy the application web app
           return new DeployResponse("test-spi-app.war");
        }
        else if (getRequestCount() == 0)
        {
          FailureResponse failureResponse = checkDeployments("/test-spi-app", 1);
          if (failureResponse != null)
          {
            return failureResponse;
          }
          else
          {
            // deploy test-generic-app.war
            return new DeployResponse("test-generic-app.war");
          }
        }
        else if (getRequestCount() == 1)
        {
          FailureResponse failureResponse = checkDeployments("/test-generic-app", 2);
          if (failureResponse != null)
          {
            return failureResponse;
          }
          else
          {
            return new DeployResponse("test-exo-app.war");
          }
        }
        else if (getRequestCount() == 2)
        { 
          FailureResponse failureResponse = checkDeployments("/test-exo-app", 3);
          if (failureResponse != null)
          {
            return failureResponse;
          }
          else
          {
            return new EndTestResponse();
          }
        }
        else
        {
           return new FailureResponse(Failure.createAssertionFailure(""));
        }
     }
View Full Code Here

           diff.removeAll(keys);

           // It should be 1
           if (diff.size() != count)
           {
              return new FailureResponse(Failure.createAssertionFailure("The size of the new web application deployed should be " + count + ", it is " + diff.size() + " instead." +
              "The previous set was " + keys + " and the new set is " + registry.getKeys()));
           }
           if (!diff.contains(appContext))
           {
             return new FailureResponse(Failure.createErrorFailure("Could not find the requested webapp [" + appContext + "] in the list of depoyed webapps."));
           }

           //
           WebApp webApp = registry.getWebApp(appContext);
           if (webApp == null)
           {
              return new FailureResponse(Failure.createAssertionFailure("The web app " + appContext + " was not found"));
           }
           if (!appContext.equals(webApp.getContextPath()))
           {
              return new FailureResponse(Failure.createAssertionFailure("The web app context is not equals to the expected value [" + appContext + "] but has the value " + webApp.getContextPath()));
           }
          
           return null;
     }
View Full Code Here

         Object returnedValue = dispatcher.include(expectedContext, this, expectedHandback);

         //
         if (!invoked)
         {
            return new FailureResponse(Failure.createAssertionFailure("The callback was not invoked"));
         }
         if (expectedHandback != handback)
         {
            return new FailureResponse(Failure.createAssertionFailure("The provided handback is not the same than the expected handback"));
         }
         if (expectedReturnedValue != returnedValue)
         {
            return new FailureResponse(Failure.createAssertionFailure("The returned value is not the same than the expected one"));
         }
         if (expectedThreadContextClassLoader != threadContextClassLoader)
         {
            return new FailureResponse(Failure.createAssertionFailure("The thread context class loader is not the same than the expected one"));
         }
      }
      catch (Exception e)
      {
         return new FailureResponse(Failure.createErrorFailure(e));
      }

      //
      return null;
   }
View Full Code Here

         assertEquals("/bar", req.getWebRequestPath());
         return new EndTestResponse();
      }

      //
      return new FailureResponse(Failure.createAssertionFailure(""));
   }
View Full Code Here

      {
         return new InvokeGetResponse(rewriteURL(testServlet, ""));
      }
      else
      {
         return new FailureResponse(Failure.createAssertionFailure(""));
      }
   }
View Full Code Here

            //
            response = ((PortletActionTestAction)action).execute(this, req, resp, ctx);
         }
         else
         {
            response = new FailureResponse(Failure.createAssertionFailure("Action for " + ctx.getRequestCount() +
               " " + NodeId.locate() + " " + actionJoinPoint + " does not have the right type but has the type " +
               action.getClass().getName()));
         }

         //
View Full Code Here

TOP

Related Classes of org.jboss.unit.driver.response.FailureResponse

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.