Class TestClient

java.lang.Object
ee.jakarta.tck.concurrent.framework.TestClient
Direct Known Subclasses:
AnnotationFullTests, AnnotationWebTests, ContextFullTests, ContextPropagationFullTests, ContextPropagationServletTests, ContextPropagationWebTests, ContextWebTests, DeploymentDescriptorFullTests, DeploymentDescriptorWebTests, ManagedExecutorDefinitionFullTests, ManagedExecutorDefinitionWebTests, ManagedScheduledExecutorDefinitionFullTests, ManagedScheduledExecutorDefinitionWebTests, ManagedThreadFactoryDefinitionFullTests, ManagedThreadFactoryDefinitionWebTests, ManagedThreadFactoryTests, SecurityFullTests, SecurityFullTests, SecurityWebTests, SecurityWebTests, TransactionTests, TransactionTests, TransactionTests, TransactionTests, VirtualFullTests, VirtualWebTests

public abstract class TestClient extends Object
This class is intended to be used in conjunction with TestServlet. TestServlets are deployed to the application server and has custom doGet/doPost methods that will return a successful or failure message depending on the test outcome. The TestClient class has runTest methods that will create an HTTP connection to the TestServlet and provide the TestServlet with the method name it needs to test. The TestClient class will then confirm that it recieved a successful outcome from the test.
  • Field Details

  • Constructor Details

    • TestClient

      public TestClient()
  • Method Details

    • runTest

      public void runTest(URL baseURL, String testName)
      Runs test against servlet at baseURL, and will run against a specified testName.
    • runTest

      public void runTest(URLBuilder builder)
      Runs test against servlet using a URLBuilder. This is useful for complicated testing situations.
    • runTestWithResponse

      public String runTestWithResponse(URL baseURL, String testName, Properties props)
      Runs test against servlet at baseURL, and will run against a specified testName. Provide properties if you want them included in a POST request, otherwise pass in null.
    • runTestWithResponse

      public String runTestWithResponse(URLBuilder builder, Properties props)
      Runs test against servlet using a URLBuilder. This is useful for complicated testing situations. Provide properties if you want them included in a POST request, otherwise pass in null.
    • getServletPath

      protected String getServletPath()
      Override this method to return the servlet path for the suite of tests. Used for the runTest() methods.
    • assertStringInResponse

      protected void assertStringInResponse(String message, String expected, String resp)
      Asserts that the response from a runTestWithResponse method contains a specific string.
      Parameters:
      message - - message to display if test fails
      expected - - the expected string to find in the response
      resp - - the response you received from the servlet