-
Notifications
You must be signed in to change notification settings - Fork 0
REST TCK separation from JakartaEE TCK repo
As we move on to JakartaEE 10 the requirement for the standalone TCKs is to exist in its own spec/API repository. The specification project should own the TCK source and produce the TCK artifacts. Here is the detailed TCK proposal for JakartaEE 10.
The legacy standalone TCKs generated out of the JakartaEE TCK repo uses JavaTest harness and ANT to build and run the tests. The JAXRS TCK sources that exist in https://github.com/eclipse-ee4j/jakartaee-tck will be moved to https://github.com/eclipse-ee4j/jaxrs-api. The proof of concept PR https://github.com/eclipse-ee4j/jaxrs-api/pull/1002 can migrate around 400 tests using Arquillian framework, Junit5 and Maven. The TCK is built as a jar archive and is run against jersey implementation. The jaxrs-api/jaxrs-tck/ module builds the jakarta.ws.rs-tck-3.1-SNAPSHOT.jar. This jar is used by jaxrs-api/jersey-tck/ module to run the TCK tests.
- Glassfish container is used to run the server tests against Jersey. The jersey jars within the downloaded glassfish bundle is replaced with the version of jersey that needs to be tested.
- The required sources along with its dependent files were moved from jakartaee-tck repo and they were modified to fix compilation errors and to execute the tests.
* jakartaee-tck/src/com/sun/ts/tests/jaxrs/api/rs/core/responsebuilder - > jaxrs-api/jaxrs-tck/src/main/java/jakarta/ws/rs/tck/api/rs/core/responsebuilder
* jakartaee-tck/src/com/sun/ts/tests/jaxrs/api/rs/core/responseclient - > jaxrs-api/jaxrs-tck/src/main/java/jakarta/ws/rs/tck/api/rs/core/responseclient
* jakartaee-tck/src/com/sun/ts/tests/jaxrs/api/rs/core/uribuilder/ -> jaxrs-api/jaxrs-tck/src/main/java/jakarta/ws/rs/tck/api/rs/core/uribuilder
* jakartaee-tck/src/com/sun/ts/tests/jaxrs/ee/rs/core/request/ -> jaxrs-api/jaxrs-tck/src/main/java/jakarta/ws/rs/tck/ee/rs/core/request
* jakartaee-tck/src/com/sun/ts/tests/jaxrs/ee/rs/client/asyncinvoker/ -> jaxrs-api/jaxrs-tck/src/main/java/jakarta/ws/rs/tck/ee/rs/client/asyncinvoker
* jakartaee-tck/src/com/sun/ts/tests/jaxrs/common -> jaxrs-api/jaxrs-tck/src/main/java/jakarta/ws/rs/tck/common
* jakartaee-tck/src/com/sun/ts/tests/jaxrs/common/util -> jaxrs-api/jaxrs-tck/src/main/java/jakarta/ws/rs/tck/common/util
* jakartaee-tck/src/com/sun/ts/tests/common/webclient - > jaxrs-api/jaxrs-tck/src/main/java/jakarta/ws/rs/tck/common/webclient
* jakartaee-tck/src/com/sun/ts/tests/common/provider - > jaxrs-api/jaxrs-tck/src/main/java/jakarta/ws/rs/tck/common/provider
* jakartaee-tck/src/com/sun/ts/tests/common/impl - > jaxrs-api/jaxrs-tck/src/main/java/jakarta/ws/rs/tck/common/impl
* jakartaee-tck/src/com/sun/ts/lib/porting -> jaxrs-api/jaxrs-tck/src/main/java/jakarta/ws/rs/tck/lib/porting/
* jakartaee-tck/src/com/sun/ts/lib/util -> jaxrs-api/jaxrs-tck/src/main/java/jakarta/ws/rs/tck/lib/util
* jakartaee-tck/src/com/sun/ts/lib/implementation -> jaxrs-api/jaxrs-tck/src/main/java/jakarta/ws/rs/tck/lib/implementation/
* jakartaee-tck/src/com/sun/ts/lib/deliverable -> jaxrs-api/jaxrs-tck/src/main/java/jakarta/ws/rs/tck/lib/deliverable
* jakartaee-tck/src/com/sun/ts/tests/servlet/common/util/Data.java -> jaxrs-api/jaxrs-tck/src/main/java/jakarta/ws/rs/tck/lib/util/Data.java
In the above folders, only the java files required to build the test code were moved.
The file jaxrs-tck/src/main/java/jakarta/ws/rs/tck/ee/rs/core/request/JAXRSClientIT.java in the PR has the code for creating and deploying the archives to container using org.jboss.shrinkwrap.api.ShrinkWrap in createDeployment() method.
The jaxrs-api/jersey-tck/pom.xml file provides the input values passed to the TCK jar jakarta.ws.rs-tck-3.1-SNAPSHOT.jar as system variables. For eg:
<GLASSFISH_HOME>${project.build.directory}/glassfish6</GLASSFISH_HOME>
<servlet_adaptor>org.glassfish.jersey.servlet.ServletContainer</servlet_adaptor>
<webServerHost>localhost</webServerHost>
<webServerPort>8080</webServerPort>
<junit.log.traceflag>true</junit.log.traceflag>
<porting.ts.url.class.1>jakarta.ws.rs.tck.lib.implementation.sun.common.SunRIURL</porting.ts.url.class.1>
The jaxrs-api/jersey-tck module is used to run the TCK using Jersey. The pom.xml is configured only for Jersey, using Glassfish 6.1 bundle to run the tests. Other implementations should have separate module to run the TCK.
Command to run the TCK from jersey-tck : mvn clean verify -Parq-glassfish-managed
This cannot be applied to signature tests.
-
The jaxrs tests at jakartaee-tck are present in https://github.com/eclipse-ee4j/jakartaee-tck/tree/master/src/com/sun/ts/tests/jaxrs. The folders are directly moved to jaxrs-api repo at jaxrs-api/jaxrs-tck/src/main/java/jakarta/ws/rs/tck.
-
Correct the package names used in the test module/folder sources to reflect the new location. For eg.
com.sun.ts.tests.jaxrs.ee.rs.client.asyncinvoker
to be replaced byjakarta.ws.rs.tck.ee.rs.client.asyncinvoker
. -
Append the test Java file name with 'IT'. For eg: JAXRSClient.java to be renamed as JAXRSClientIT.java.
-
Add below methods to each test file which logs the start and end of each test. eg. https://github.com/eclipse-ee4j/jaxrs-api/blob/b2f50fa2ed1cf1f84b4446af36db12a5041428da/jaxrs-tck/src/main/java/jakarta/ws/rs/tck/api/rs/core/responsebuilder/BuilderClientIT.java
@BeforeEach
void logStartTest(TestInfo testInfo) {
TestUtil.logMsg("STARTING TEST : "+testInfo.getDisplayName());
}
@AfterEach
void logFinishTest(TestInfo testInfo) {
TestUtil.logMsg("FINISHED TEST : "+testInfo.getDisplayName());
}
-
Add
@Test
annotation to each test in the test file. -
Check for compilation issues with mvn clean install at jaxrs-tck folder.
- New imports
import org.jboss.arquillian.junit5.ArquillianExtension;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.asset.StringAsset;
import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.jboss.shrinkwrap.api.exporter.ZipExporter;
import org.junit.jupiter.api.extension.ExtendWith;
import static org.junit.jupiter.api.Assertions.assertTrue;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInfo;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.AfterEach;
import java.io.InputStream;
import java.io.IOException;
-
Add test file annotaion to the test java file.
@ExtendWith(ArquillianExtension.class)
-
Move web.xml.template file to src/main/resources/ following in the same hierarchy. For eg: jakartaee-tck/src/com/sun/ts/tests/jaxrs/ws/rs/tck/ee/rs/client/asyncinvoker/web.xml.template will be moved to jaxrs-api/jaxrs-tck/src/main/resources/jakarta/ws/rs/tck/ee/rs/client/asyncinvoker/web.xml.template
-
Add the deployment method in the test file as in the example below for tests in jakarta/ws/rs/tck/ee/rs/client/asyncinvoker.
Please note the archive.addClasses should have the classes mentioned in the build.xml file in corresponding jakartaee-tck directory.
@Deployment(testable = false)
public static WebArchive createDeployment() throws IOException{
InputStream inStream = JAXRSClientIT.class.getClassLoader().getResourceAsStream("jakarta/ws/rs/tck/ee/rs/client/asyncinvoker/web.xml.template");
String webXml = editWebXmlString(inStream);
WebArchive archive = ShrinkWrap.create(WebArchive.class, "jaxrs_ee_rs_client_asyncinvoker_web.war");
archive.addClasses(TSAppConfig.class, Resource.class);
archive.setWebXML(new StringAsset(webXml));
return archive;
}
- New imports in the test file
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertTrue;
import org.junit.jupiter.api.TestInfo;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.AfterEach;
-
assertTrue method in the common client file JAXRSCommonClient is not used. Instead use the assertTrue method from junit. Correct the arguments of assert methods accordingly.
-
If any maven package is missing add it to jaxrs-tck/pom.xml dependencies.
-
If missing java file, look for the same in jakartaee-tck and make it available in the common folders.
Tracking issue is https://github.com/eclipse-ee4j/jaxrs-api/issues/1015
The PR https://github.com/eclipse-ee4j/jaxrs-api/pull/1002 migrated tests from below folders
- jakartaee-tck/src/com/sun/ts/tests/jaxrs/api/rs/core/responsebuilder (15)
- jakartaee-tck/src/com/sun/ts/tests/jaxrs/api/rs/core/responseclient (85)
- jakartaee-tck/src/com/sun/ts/tests/jaxrs/api/rs/core/uribuilder (128)
- jakartaee-tck/src/com/sun/ts/tests/jaxrs/ee/rs/core/request (28)
- jakartaee-tck/src/com/sun/ts/tests/jaxrs/ee/rs/client/asyncinvoker (147)
All the remaining tests in jakartaee-tck/src/com/sun/ts/tests/jaxrs & jakartaee-tck/src/com/sun/ts/tests/signaturetest/jaxrs need to be migrated except the below folders. They are part of platform tests and should ideally remain within platform TCK bundle only.
- jakartaee-tck/src/com/sun/ts/tests/jaxrs/jaxrs21/platform
- jakartaee-tck/src/com/sun/ts/tests/jaxrs/platform
-
There are sources that could be used across TCKs while separating them to respective repos. Those can be pulled as jars and used with a maven dependency. Reference comment. The jakartaee-tck project should build those jars and push them to maven for use by moving TCK projects.
-
Create common deployment as mentioned by Ondre in slack channel https://eclipsefoundationhq.slack.com/archives/C0131MLD538/p1627033972014200?thread_ts=1624542758.005000&cid=C0131MLD538. The deployment code need not be repeated for other sets of server tests.