Uploaded image for project: 'WildFly'
  1. WildFly
  2. WFLY-20694

Packaging tests for our Jakarta Data integration -- EAR deployments

XMLWordPrintable

      We currently don't have any tests of our Jakarta Data integration in our test suite. We test out Jakarta Data integration by running the Jakarta Data TCK. We need basic tests of our Jakarta Data integration, and a useful way to do that while covering things not necessarily covered in the Jakarta Data TCK is to do some testing involving different packaging/classloading options. In this case, Jakarta EE ear archives.

      The tests will require creation of a deployment. https://docs.wildfly.org/36/Developer_Guide.html#Jakarta_Data_Reference covers how to use Hibernate Data Repositories to generate classes for a Jakarta Data deployment.

      An OOTB WildFly server does not have Jakarta Data enabled. https://docs.wildfly.org/36/Admin_Guide.html#Jakarta_Data discusses how to enable Jakarta Data.

      For further reference, see:

      https://jakarta.ee/specifications/data/1.0/jakarta-data-1.0
      https://docs.jboss.org/hibernate/orm/6.6/repositories/html_single/Hibernate_Data_Repositories.html
      https://github.com/jakartaee/data (note its 'tck' module, where the TCK code is. Of course how our testsuite does things differs from the TCK, but it's a good source of info on using Jakarta Data in test deployments.)

      Requirements:

      1) The test should be placed in the testsuite/integration/basic maven module.
      2) The test should use @ServerSetup and a ServerSetupTask to switch the server to 'preview' stability and add the Jakarta Data extension and subsystem to the config, cleaning up in teardown.
      3) The test's @Deployment method should:
      a) create a jar that includes
      i) two JPA entities, 'Book' and 'Author'. An Author has a name; a Book has a name and a reference to an Author.
      ii) a @Repository annotated interface that does CRUD operations on 'Author'
      b) create a war that includes
      i) a @Repository annotated interface that does CRUD operations on 'Book'
      ii) a Jakarta REST resource that exposes @POST methods to create Books and Authors and @GET methods to read the ids of Authors and Books and other @GET methods to read the name of a given Author or Book.
      c) return an ear that packages the jar in the ear's lib folder and includes the war as a subdeployment.
      d) The ear should also package a persistence.xml for use in persisting Book and Author. It should use the server's OOTB ExampleDS.
      4) The test should be an @RunAsClient Arquillian test that uses HTTP posts and gets to add an Author and then a Book written by that author and then read the data for that author and book, confirming that each has the correct name.

              bstansbe@redhat.com Brian Stansberry
              bstansbe@redhat.com Brian Stansberry
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: