2 Replies Latest reply: Mar 31, 2012 3:08 AM by Takayuki Konishi RSS

    How to test a WAR that redirects all GET request?

    Takayuki Konishi Newbie

      Hi forks,

       

      I'm trying to test OpemAM with Arquillian in EAP 5.1.2 just out of interest.

      Test code: [1]

       

      The problem is OpemAM seem to redirect all request, so arquillian test request [2] is redirected [3] and the test turns to error.

      When I modified web.xml of OpenAM, the test is succeeded but I don't think modifying one of test target is a good way.

       

      This test is just out of interest but would be important when adopting Arquillian to existing project.

      How should I avoid the redirect?

       

      Attached file: this test project except for openam_954.war.

       

      [1]

      EmailValidatorTest.java:

      @RunWith(Arquillian.class)
      public class EmailValidatorTest {
      
          @Deployment
          public static WebArchive createDeployment() {
              return ShrinkWrap.create(ZipImporter.class, "openam_954_test.war")
                      .importFrom(new File("sample/openam_954.war"))
                      .as(WebArchive.class).setWebXML(EmptyAsset.INSTANCE);
          }
      
          @Test
          public void validateShouldValidateAddress() throws Exception {
              EmailValidator ev = new EmailValidator();
              assertFalse(ev.validate("foo"));
              assertTrue(ev.validate("foo@example.com"));
          }
      }
      

       

      [2]

      GET /openam_954_test/ArquillianServletRunner?outputMode=serializedObject&className=org.arquillian.example.EmailValidatorTest&methodName=validateShouldValidateAddress

       

      [3]

      302 Moved Temporarily

      Location: http://0.0.0.0:8080/openam_954_test/config/options.htm