From 1658452e8c27c80109756be613c7c3b14bf4a337 Mon Sep 17 00:00:00 2001 From: Scott M Stark Date: Thu, 29 Feb 2024 02:34:56 -0600 Subject: [PATCH 1/8] - Drop the unused eclipse ide sections in doc - add logging to weld embedded profile of tck runner Signed-off-by: Scott M Stark --- dist-build/jboss-runner.pom | 15 +- .../src/test/resources/logging.properties | 36 +++++ doc/reference/pom.xml | 2 +- .../asciidoc/cdi-tck-reference-guide.asciidoc | 6 - .../main/asciidoc/eclipse-debugging.asciidoc | 47 ------ .../main/asciidoc/eclipse-running.asciidoc | 139 ------------------ .../src/main/asciidoc/installation.asciidoc | 35 ----- .../src/main/asciidoc/part2.asciidoc | 4 - 8 files changed, 46 insertions(+), 238 deletions(-) create mode 100644 dist-build/src/test/resources/logging.properties delete mode 100644 doc/reference/src/main/asciidoc/eclipse-debugging.asciidoc delete mode 100644 doc/reference/src/main/asciidoc/eclipse-running.asciidoc diff --git a/dist-build/jboss-runner.pom b/dist-build/jboss-runner.pom index 1b98477db6..b019c90762 100644 --- a/dist-build/jboss-runner.pom +++ b/dist-build/jboss-runner.pom @@ -319,6 +319,11 @@ org.wildfly.arquillian wildfly-arquillian-common + + org.jboss.logmanager + jboss-logmanager + 3.0.4.Final + @@ -336,12 +341,14 @@ weld weld-embedded-arquillian.xml + org.jboss.logmanager.LogManager target/dependency/lib java:jboss/datasources/ExampleDS - - ${travis.surefire.argLine} + java:/ConnectionFactory + java:/queue/test + java:/topic/test target/suites/tck-core-suite.xml @@ -472,10 +479,6 @@ ${arquillian.version} test - - log4j - log4j - diff --git a/dist-build/src/test/resources/logging.properties b/dist-build/src/test/resources/logging.properties new file mode 100644 index 0000000000..94068e59d1 --- /dev/null +++ b/dist-build/src/test/resources/logging.properties @@ -0,0 +1,36 @@ +# Additional loggers to configure (the root logger is always configured) +loggers=org.jboss.weld,org.jboss.weld.Bootstrap + +logger.level=INFO +logger.handlers=FILE,CONSOLE + +logger.org.jboss.weld.level=INFO +logger.org.jboss.weld.useParentHandlers=true + +logger.org.jboss.weld.Bootstrap.level=INFO +logger.org.jboss.weld.Bootstrap.useParentHandlers=true + +handler.CONSOLE=org.jboss.logmanager.handlers.ConsoleHandler +handler.CONSOLE.level=INFO +handler.CONSOLE.formatter=COLOR-PATTERN +handler.CONSOLE.properties=autoFlush,target +handler.CONSOLE.autoFlush=true +handler.CONSOLE.target=SYSTEM_OUT + +handler.FILE=org.jboss.logmanager.handlers.PeriodicRotatingFileHandler +handler.FILE.level=ALL +handler.FILE.formatter=PATTERN +handler.FILE.properties=autoFlush,append,fileName,suffix +handler.FILE.constructorProperties=fileName,append +handler.FILE.autoFlush=true +handler.FILE.append=true +handler.FILE.fileName=tck.log +handler.FILE.suffix=.yyyy-MM-dd + +formatter.PATTERN=org.jboss.logmanager.formatters.PatternFormatter +formatter.PATTERN.properties=pattern +formatter.PATTERN.pattern=%d{yyyy-MM-dd HH\:mm\:ss,SSS} %-5p [%c] (%t) %s%e%n + +formatter.COLOR-PATTERN=org.jboss.logmanager.formatters.PatternFormatter +formatter.COLOR-PATTERN.properties=pattern +formatter.COLOR-PATTERN.pattern=%K{level}%d{HH\:mm\:ss,SSS} %-5p [%c] (%t) %s%e%n \ No newline at end of file diff --git a/doc/reference/pom.xml b/doc/reference/pom.xml index 7d90f15c68..c6faeb1cd4 100644 --- a/doc/reference/pom.xml +++ b/doc/reference/pom.xml @@ -123,7 +123,7 @@ src/main/assembly/assembly.xml - cdi-tck-${cdi.tck.version} + cdi-tck-${project.version} diff --git a/doc/reference/src/main/asciidoc/cdi-tck-reference-guide.asciidoc b/doc/reference/src/main/asciidoc/cdi-tck-reference-guide.asciidoc index f25ff01a33..fd7ea318ce 100644 --- a/doc/reference/src/main/asciidoc/cdi-tck-reference-guide.asciidoc +++ b/doc/reference/src/main/asciidoc/cdi-tck-reference-guide.asciidoc @@ -54,12 +54,6 @@ If you are running the CDI TCK for the first time, read <> complet * <> documents how the TCK test suite is executed. It covers both modes supported by the TCK, standalone and in-container, and shows how to dump the generated test artifacts to disk. -* <> shows how to run individual tests in Eclipse and advises the best way to setup your Eclipse workspace for running the tests. - - -* <> builds on <> by detailing how to debug individual tests in Eclipse. - - :numbered: :sectanchors: diff --git a/doc/reference/src/main/asciidoc/eclipse-debugging.asciidoc b/doc/reference/src/main/asciidoc/eclipse-debugging.asciidoc deleted file mode 100644 index 81fdf4804d..0000000000 --- a/doc/reference/src/main/asciidoc/eclipse-debugging.asciidoc +++ /dev/null @@ -1,47 +0,0 @@ - -[[eclipse-debugging]] - -== Debugging Tests in Eclipse - -This chapter explains how to debug standalone and integration tests from the TCK test suite in Eclipse. You should be able to use the lessons learned here to debug tests in an alternate IDE as well. - -=== Debugging a standalone test - -There is almost no difference in how you debug a standalone test from how you run it. With the test class open in the Eclipse editor, simply right click in the editor view and select Debug As > TestNG Test. Eclipse will stop at any breakpoints you set just like it would with any other local debug process. - -If you plan to step into a class in the Weld implementation (or any other dependent library), you must ensure that the source is properly associated with the library. Below are the steps to follow to associate the source of Weld with the TestNG debug configuration: - -. Select the Run > Debug Configurations... menu from the main menubar -. Select the name of the test class in the TestNG category -. Select the Source tab -. Click the Add... button on the right -. Select Java Project -. Check the project that contains the class you want to debug (e.g., weld-core) -. Click OK on the Project Selection window -. Click Close on the Debug Configurations window - -You'll have to complete those steps for any test class you are debugging, though you only have to do it once (the debug configuration hangs around indefinitely). - -Again, running a test in standalone mode isn't enough to pass the TCK and cannot be used to run or debug an integration test. Let's look at how to debug a test running in the context of the container. - -=== Debugging an integration test - -In order to debug an integration test, or any test run using in-container mode, the test must be configured to run in-container, as described in <>, and you must attach the IDE debugger to the container. That puts the debugger on both sides of the fence, so to speak. - -Since setting up a test to run in-container has already been covered, we'll look at how to attach the IDE debugger to the container, and then move on launching the test in debug mode. - -==== Attaching the IDE debugger to the container - -There are two ways to attach the IDE debugger to the container. You can either start the container in debug mode from within the IDE, or you can attach the debugger over a socket connection to a standalone container running with JPDA enabled. - -The Eclipse Server Tools, a subproject of the Eclipse Web Tools Project (WTP), has support for launching most major application servers, including WildFly 22. However, if you are using WildFly, you should consider using JBoss Tools instead, which offers tighter integration with JBoss technologies. See either the link:$$http://www.eclipse.org/webtools/server/server.php$$[Server Tools documentation] or the link:$$http://docs.jboss.org/tools/$$[JBoss Tools documentation] for how to setup a container and start it in debug mode. - -See link:$$http://justinjohnson.org/java/configuring-remote-debugging-in-jboss-as-7-and-eclipse/$$[this blog entry] to learn how to start WildFly with JPDA enabled and how to get the Eclipse debugger to connect to the remote process. - -==== Launching the test in the debugger - -Once Eclipse is debugging the container, you can set a breakpoint in the test and debug it just like a standalone test. Let's give it a try. - -Open a test in the Eclipse editor, right click in the editor view, and select Debug As > TestNG Test (this works for the container started in debug mode from within the IDE) or run the TestNG test and debug Remote Java Application (remote debug configuration) in the same time (when attaching the debugger over a socket connection to a container). This time when the IDE hits the breakpoint, it halts the JVM thread of the container rather than the thread that launched the test. - -Remember that if you need to debug into dependent libraries, the source code for those libraries will need to be registered with the TestNG debug configuration as described in the first section in this chapter. \ No newline at end of file diff --git a/doc/reference/src/main/asciidoc/eclipse-running.asciidoc b/doc/reference/src/main/asciidoc/eclipse-running.asciidoc deleted file mode 100644 index cd8423cbc4..0000000000 --- a/doc/reference/src/main/asciidoc/eclipse-running.asciidoc +++ /dev/null @@ -1,139 +0,0 @@ -[[eclipse-running]] - -== Running Tests in Eclipse - -This chapter explains how to run individual tests using the Eclipse TestNG plugin. It covers running non-integration tests in standalone mode and integration tests (as well as non-integration tests) in in-container mode. You should be able to use the lessons learned here to debug tests in an alternate IDE as well. - -=== Leveraging Eclipse's plugin ecosystem - -Using an existing test harness (TestNG) allows the tests to be executed and debugged in an Integrated Development Environment (IDE) using available plugins. Using an IDE is also the easiest way to execute a test class in isolation. - -The TCK can be executed in any IDE for which there is a link:$$http://testng.org/doc/index.html$$[TestNG plugin] available. Running a test from the CDI TCK test suite using the Eclipse TestNG plugin is almost as simple as running any other TestNG test. You can also use the plugin to debug a test, which is described in the next chapter. - -Before running a test from the TCK test suite in Eclipse, you must have the Eclipse TestNG plugin and either the m2e plugin or an Eclipse project generated using the Maven 2 Eclipse plugin (maven-eclipse-plugin). Refer to <> for more information on these plugins. - -[NOTE] -==== -In order to run the TCK tests in Eclipse you must have CDI TCK and Weld JBoss TCK runner projects imported. Get the source from GitHub repositories https://github.com/eclipse-ee4j/cdi-tck and https://github.com/weld/core. - -==== - -With the m2e plugin installed, Eclipse should recognize the CDI TCK projects as valid Eclipse projects (or any Weld project for that matter). Import them into the Eclipse workspace at this time. You should also import the Weld projects if you want to debug into that code, which is covered later. - -[TIP] -==== -If you choose to use the Maven 2 Eclipse plugin (maven-eclipse-plugin), you should execute the plugin in both the tck and weld projects: - -[source, console] ----- -cd tck -mvn clean eclipse:clean eclipse:eclipse -DdownloadSources -DdownloadJavadocs -cd ../weld -mvn clean eclipse:clean eclipse:eclipse -DdownloadSources -DdownloadJavadocs ----- - -==== - - -=== Readying the Eclipse workspace - -When setting up your Eclipse workspace, we recommended creating three workings sets: - -Weld - Groups the CDI API and the Weld projects -CDI TCK - Groups the CDI TCK API and the test suite projects -Weld JBoss TCK Runner - Groups the porting package implementation and TCK runner projects -The dependencies between the projects will either be established automatically by the m2e plugin, based on the dependency information in the pom.xml files, or as generated by the mvn eclipse:eclipse command. - -Your workspace should appear as follows: - -[source, console] ----- -Weld - cdi-api - weld-core - ... -CDI TCK - cdi-tck-api - cdi-tck-impl - cdi-tck-parent -Weld JBoss TCK Runner - weld-jboss-runner-tck - weld-porting-package-tck - ----- - -The tests in the TCK test suite are located in the cdi-tck-impl project. You'll be working within this project in Eclipse when you are developing tests. However, as you learned earlier, there are no references to a CDI implementation in the TCK. So how can you execute an individual test in Eclipse? The secret is that you need to establish a link in Eclipse (not in Maven) between the cdi-tck-impl project and your TCK runner project, which in this case is weld-jboss-runner-tck (the project in the jboss-tck-runner directory). - -Here are the steps to establish the link: - -. Right click on the cdi-tck-impl project -. Select Build Path > Configure Build Path... -. Click on the Projects tab -. Click the Add... button on the right -. Check the TCK runner project (e.g., weld-jboss-runner-tck) -. Click the OK button on the Required Project Selection dialog window -. Click the OK button on the Java Build Path window - -Of course, the weld-jboss-runner-tck also depends on the cdi-tck-impl at runtime (so it can actually find the tests to execute). But m2e plugin doesn't distinguish between build-time and runtime dependencies. As a result, we've created a circular dependency between the projects. In all likelihood, Eclipse will struggle (if not fail) to compile one or more projects. How can we break this cycle? - -As it turns out, the TCK runner doesn't need to access the tests to build. It only needs its classes, configurations and other dependencies at runtime (when the TestNG plugin executes). Therefore, we can disable Resolve dependencies from workspace projects setting on weld-jboss-runner-tck project: - -. Right click on the weld-jboss-runner-tck project -. Select Maven -. Uncheck Resolve dependencies from workspace projects option -. Click the OK button on the Properties window - -As you have learned, the TCK determines how to behave based on the values of system properties or properties defined in META-INF/cdi-tck.properties classpath resources. In order to run the tests, you need to add a properties file to the classpath or define corresponding system properties. - -The CDI TCK project conveniently provides the properties file src/test/resources/META-INF/cdi-tck.properties that contains all of the necessary properties for testing in Eclipse. You have to tune the org.jboss.cdi.tck.libraryDirectory and org.jboss.cdi.tck.testDataSource properties to point to the relative location of the related projects and specify the name of test datasource. The properties should be defined as follows: - -org.jboss.cdi.tck.libraryDirectory - the path to the target/dependency/lib directory in the TCK runner project -org.jboss.cdi.tck.testDataSource - the JNDI name of the test datasource, e.g. WildFly 22: - -[source, console] ----- -org.jboss.cdi.tck.testDataSource=java:jboss/datasources/ExampleDS ----- - -You are now ready to execute an individual test class (or artifact). Let's start with a test artifact capable of running in standalone mode. - -=== Running a test in standalone mode - -Use weld-embedded Maven profile (active by default) in order to run a test in standalone mode. - -[TIP] -==== -If using m2e Eclipse plugin, you can activate/deactivate the profile in Maven section of project properties. -==== - -[NOTE] -==== -Note that all TestNG tests that are not included in integration and javaee-full test groups are considered to be standalone artifacts. -==== - -Select a test class containing standalone tests and open it in the Eclipse editor. Now right click in the editor view and select Run As > TestNG Test. The TestNG view should pop out and you should see all the tests in that artifact pass (if all goes well). - -[NOTE] -==== -If the TCK complains that there is a property missing, close all the projects, open them again, and rebuild. The m2e plugin can be finicky getting everything built correctly the first time. -==== - -So far you have executed a test in standalone mode. That's not sufficient to pass the TCK. The test must be executed using in-container mode. - -Let's see what has to be done to execute an integration test. This will result in the artifact being deployed to the container, which is WildFly if you are using the JBoss TCK runner. - -[[running-integration-tests]] - -=== Running integration tests - -In order to run a test in the container you must explicitly specify following active Maven profiles in JBoss TCK runner Eclipse project properties: incontainer,!weld-embedded. - -[NOTE] -==== -Note that all TestNG tests that are included in integration and javaee-full test groups are considered to be integration tests and must be run in in-container mode. javaee-full TestNG test group contains tests that require full Jakarta EE platform (EAR packaging, JAX-WS, EJB timers, etc.). -==== - -Select an integration test (a class that extends org.jboss.cdi.tck.AbstractTest and open it in your Eclipse editor. Right click in the editor view and select Run As > TestNG Test. - -You have now mastered running the CDI TCK against Weld using both Maven and within Eclipse. Now you're likely interested in how to debug a test so that you can efficiently investigate test failures. - diff --git a/doc/reference/src/main/asciidoc/installation.asciidoc b/doc/reference/src/main/asciidoc/installation.asciidoc index c5c0e55518..2e14c32c19 100644 --- a/doc/reference/src/main/asciidoc/installation.asciidoc +++ b/doc/reference/src/main/asciidoc/installation.asciidoc @@ -104,38 +104,3 @@ mvn test -Dincontainer -Dcdi.tck.version=4.1.1 * TestNG will report, via Maven, the outcome of the run, and report any failures on the console. Details can be found in target/surefire-reports/TestSuite.txt. ==== - - -[[eclipse-plugins]] - - -=== Eclipse Plugins - -Eclipse, or any other IDE, is not required to execute or pass the TCK. However an implementor may wish to execute tests in an IDE to aid debugging the tests. This section introduces two essential Eclipse plugins, TestNG and Maven, and points you to resources explaining how to install them. - -[[eclipse-testng-plugin]] - - -==== TestNG Plugin - -The TCK test suite is built on the TestNG. Therefore, having the TestNG plugin installed in Eclipse is essential. Instructions for using the TestNG update site to add the TestNG plugin to Eclipse are provided on the TestNG link:$$http://testng.org/doc/download.html$$[download page]. You can find a tutorial that explains how to use the TestNG plugin on the TestNG link:$$http://testng.org/doc/eclipse.html$$[Eclipse page]. - -[[m2e-plugin]] - - -==== Maven Plugin (m2e) - -Another useful plugin is m2e. The TCK project uses Maven. Therefore, to work with TCK in Eclipse, you may wish to have native support for Maven projects, which the m2e plugin provides. Instructions for using the m2e update site to add the m2e plugin to Eclipse are provided on the m2e link:$$http://eclipse.org/m2e/$$[home page]. - -You can alternatively use the Eclipse plugin for Maven to generate native Eclipse projects from Maven projects. - -If you have Maven installed, you have everything you need. Just execute the following command from any Maven project to produce the Eclipse project files. - - -[source, console] ----- -mvn eclipse:eclipse ----- - -Again, the Eclipse plugins are not required to execute the TCK, but can be very helpful when validating an implementation against the TCK test suite and especially when using the modules from the project. - diff --git a/doc/reference/src/main/asciidoc/part2.asciidoc b/doc/reference/src/main/asciidoc/part2.asciidoc index c6170d47f0..d22af0b4a2 100644 --- a/doc/reference/src/main/asciidoc/part2.asciidoc +++ b/doc/reference/src/main/asciidoc/part2.asciidoc @@ -13,7 +13,3 @@ Finally, you learn how to debug tests from the test suite in Eclipse. include::sigtest.asciidoc[] include::executing.asciidoc[] - -include::eclipse-running.asciidoc[] - -include::eclipse-debugging.asciidoc[] From 46cb61752950a14eff2616aebf91922b1f96fa2d Mon Sep 17 00:00:00 2001 From: Scott M Stark Date: Thu, 29 Feb 2024 03:20:58 -0600 Subject: [PATCH 2/8] Change ConstructorInvokerTest back to using an inner class for MyService Signed-off-by: Scott M Stark --- .../{ => ctor}/ConstructorInvokerTest.java | 12 +++++++--- .../invokers/invalid/ctor/MyService.java | 22 ------------------- .../invokers/invalid/ctor/TestExtension.java | 2 +- 3 files changed, 10 insertions(+), 26 deletions(-) rename impl/src/main/java/org/jboss/cdi/tck/tests/invokers/invalid/{ => ctor}/ConstructorInvokerTest.java (89%) delete mode 100644 impl/src/main/java/org/jboss/cdi/tck/tests/invokers/invalid/ctor/MyService.java diff --git a/impl/src/main/java/org/jboss/cdi/tck/tests/invokers/invalid/ConstructorInvokerTest.java b/impl/src/main/java/org/jboss/cdi/tck/tests/invokers/invalid/ctor/ConstructorInvokerTest.java similarity index 89% rename from impl/src/main/java/org/jboss/cdi/tck/tests/invokers/invalid/ConstructorInvokerTest.java rename to impl/src/main/java/org/jboss/cdi/tck/tests/invokers/invalid/ctor/ConstructorInvokerTest.java index 19d56b25e1..188f64150a 100644 --- a/impl/src/main/java/org/jboss/cdi/tck/tests/invokers/invalid/ConstructorInvokerTest.java +++ b/impl/src/main/java/org/jboss/cdi/tck/tests/invokers/invalid/ctor/ConstructorInvokerTest.java @@ -13,8 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.jboss.cdi.tck.tests.invokers.invalid; +package org.jboss.cdi.tck.tests.invokers.invalid.ctor; +import jakarta.enterprise.context.ApplicationScoped; import jakarta.enterprise.inject.spi.DeploymentException; import org.jboss.arquillian.container.test.api.Deployment; @@ -22,8 +23,6 @@ import org.jboss.cdi.tck.AbstractTest; import org.jboss.cdi.tck.cdi.Sections; import org.jboss.cdi.tck.shrinkwrap.WebArchiveBuilder; -import org.jboss.cdi.tck.tests.invokers.invalid.ctor.MyService; -import org.jboss.cdi.tck.tests.invokers.invalid.ctor.TestExtension; import org.jboss.shrinkwrap.api.spec.WebArchive; import org.jboss.test.audit.annotations.SpecAssertion; import org.jboss.test.audit.annotations.SpecVersion; @@ -45,4 +44,11 @@ public static WebArchive createTestArchive() { @SpecAssertion(section = Sections.BUILDING_INVOKER, id = "bb") public void trigger() { } + + @ApplicationScoped + static public class MyService { + public MyService() { + } + } + } diff --git a/impl/src/main/java/org/jboss/cdi/tck/tests/invokers/invalid/ctor/MyService.java b/impl/src/main/java/org/jboss/cdi/tck/tests/invokers/invalid/ctor/MyService.java deleted file mode 100644 index 19b7502573..0000000000 --- a/impl/src/main/java/org/jboss/cdi/tck/tests/invokers/invalid/ctor/MyService.java +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright 2024, Red Hat, Inc., and individual contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * http://www.apache.org/licenses/LICENSE-2.0 - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.jboss.cdi.tck.tests.invokers.invalid.ctor; - -import jakarta.enterprise.context.ApplicationScoped; - -@ApplicationScoped -public class MyService { - public MyService() { - } -} diff --git a/impl/src/main/java/org/jboss/cdi/tck/tests/invokers/invalid/ctor/TestExtension.java b/impl/src/main/java/org/jboss/cdi/tck/tests/invokers/invalid/ctor/TestExtension.java index 87ee520723..1db3eae598 100644 --- a/impl/src/main/java/org/jboss/cdi/tck/tests/invokers/invalid/ctor/TestExtension.java +++ b/impl/src/main/java/org/jboss/cdi/tck/tests/invokers/invalid/ctor/TestExtension.java @@ -20,7 +20,7 @@ import jakarta.enterprise.lang.model.declarations.MethodInfo; public class TestExtension implements BuildCompatibleExtension { - @Registration(types = MyService.class) + @Registration(types = ConstructorInvokerTest.MyService.class) public void myServiceRegistration(BeanInfo bean, InvokerFactory invokers) { for (MethodInfo ctor : bean.declaringClass().constructors()) { invokers.createInvoker(bean, ctor).build(); From 791ec0be4f98d00728ba4d1e71e9e689b680cebb Mon Sep 17 00:00:00 2001 From: Scott M Stark Date: Thu, 29 Feb 2024 04:39:40 -0600 Subject: [PATCH 3/8] Fix the wildfly updater pom Signed-off-by: Scott M Stark --- dist-build/jboss-as-updater.pom | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/dist-build/jboss-as-updater.pom b/dist-build/jboss-as-updater.pom index 5b3508c895..a4ce0c31f2 100644 --- a/dist-build/jboss-as-updater.pom +++ b/dist-build/jboss-as-updater.pom @@ -68,17 +68,17 @@ jakarta.enterprise jakarta.enterprise.cdi-api - ${cdi.tck.version} + ${cdi.api.version} jakarta.enterprise jakarta.enterprise.cdi-el-api - ${cdi.tck.version} + ${cdi.api.version} jakarta.enterprise jakarta.enterprise.lang-model - ${cdi.tck.version} + ${cdi.api.version} jakarta.interceptor @@ -233,7 +233,7 @@ Updating CDI module and Interceptors API module - CDI version: ${cdi.tck.version} + CDI version: ${cdi.api.version} Interceptors version: ${interceptors.api.version} JBOSS_HOME: ${jboss.home} @@ -248,9 +248,9 @@ - - - + + + From ad720db42debc9f86353bfa3cce1bd810462a9e1 Mon Sep 17 00:00:00 2001 From: Scott M Stark Date: Thu, 29 Feb 2024 12:09:56 -0600 Subject: [PATCH 4/8] Revert the change to ConstructorInvokerTest to use an inner class and move all tests to their own package for consistency Signed-off-by: Scott M Stark --- .../invalid/ctor/ConstructorInvokerTest.java | 7 ------ .../invokers/invalid/ctor/MyService.java | 22 +++++++++++++++++++ .../invokers/invalid/ctor/TestExtension.java | 2 +- .../InterceptorInvokerTest.java | 5 +---- .../MethodFromDifferentClassInvokerTest.java | 5 +---- ...ObjectMethodButNotToStringInvokerTest.java | 4 +--- .../PrivateMethodInvokerTest.java | 4 +--- .../ProducerFieldBeanInvokerTest.java | 5 +---- .../ProducerMethodBeanInvokerTest.java | 5 +---- 9 files changed, 29 insertions(+), 30 deletions(-) create mode 100644 impl/src/main/java/org/jboss/cdi/tck/tests/invokers/invalid/ctor/MyService.java rename impl/src/main/java/org/jboss/cdi/tck/tests/invokers/invalid/{ => interceptor}/InterceptorInvokerTest.java (86%) rename impl/src/main/java/org/jboss/cdi/tck/tests/invokers/invalid/{ => method}/MethodFromDifferentClassInvokerTest.java (88%) rename impl/src/main/java/org/jboss/cdi/tck/tests/invokers/invalid/{ => objmethod}/ObjectMethodButNotToStringInvokerTest.java (90%) rename impl/src/main/java/org/jboss/cdi/tck/tests/invokers/invalid/{ => privatemethod}/PrivateMethodInvokerTest.java (90%) rename impl/src/main/java/org/jboss/cdi/tck/tests/invokers/invalid/{ => prodfield}/ProducerFieldBeanInvokerTest.java (87%) rename impl/src/main/java/org/jboss/cdi/tck/tests/invokers/invalid/{ => prodmethod}/ProducerMethodBeanInvokerTest.java (87%) diff --git a/impl/src/main/java/org/jboss/cdi/tck/tests/invokers/invalid/ctor/ConstructorInvokerTest.java b/impl/src/main/java/org/jboss/cdi/tck/tests/invokers/invalid/ctor/ConstructorInvokerTest.java index 188f64150a..703001a13f 100644 --- a/impl/src/main/java/org/jboss/cdi/tck/tests/invokers/invalid/ctor/ConstructorInvokerTest.java +++ b/impl/src/main/java/org/jboss/cdi/tck/tests/invokers/invalid/ctor/ConstructorInvokerTest.java @@ -15,7 +15,6 @@ */ package org.jboss.cdi.tck.tests.invokers.invalid.ctor; -import jakarta.enterprise.context.ApplicationScoped; import jakarta.enterprise.inject.spi.DeploymentException; import org.jboss.arquillian.container.test.api.Deployment; @@ -45,10 +44,4 @@ public static WebArchive createTestArchive() { public void trigger() { } - @ApplicationScoped - static public class MyService { - public MyService() { - } - } - } diff --git a/impl/src/main/java/org/jboss/cdi/tck/tests/invokers/invalid/ctor/MyService.java b/impl/src/main/java/org/jboss/cdi/tck/tests/invokers/invalid/ctor/MyService.java new file mode 100644 index 0000000000..19b7502573 --- /dev/null +++ b/impl/src/main/java/org/jboss/cdi/tck/tests/invokers/invalid/ctor/MyService.java @@ -0,0 +1,22 @@ +/* + * Copyright 2024, Red Hat, Inc., and individual contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.jboss.cdi.tck.tests.invokers.invalid.ctor; + +import jakarta.enterprise.context.ApplicationScoped; + +@ApplicationScoped +public class MyService { + public MyService() { + } +} diff --git a/impl/src/main/java/org/jboss/cdi/tck/tests/invokers/invalid/ctor/TestExtension.java b/impl/src/main/java/org/jboss/cdi/tck/tests/invokers/invalid/ctor/TestExtension.java index 1db3eae598..87ee520723 100644 --- a/impl/src/main/java/org/jboss/cdi/tck/tests/invokers/invalid/ctor/TestExtension.java +++ b/impl/src/main/java/org/jboss/cdi/tck/tests/invokers/invalid/ctor/TestExtension.java @@ -20,7 +20,7 @@ import jakarta.enterprise.lang.model.declarations.MethodInfo; public class TestExtension implements BuildCompatibleExtension { - @Registration(types = ConstructorInvokerTest.MyService.class) + @Registration(types = MyService.class) public void myServiceRegistration(BeanInfo bean, InvokerFactory invokers) { for (MethodInfo ctor : bean.declaringClass().constructors()) { invokers.createInvoker(bean, ctor).build(); diff --git a/impl/src/main/java/org/jboss/cdi/tck/tests/invokers/invalid/InterceptorInvokerTest.java b/impl/src/main/java/org/jboss/cdi/tck/tests/invokers/invalid/interceptor/InterceptorInvokerTest.java similarity index 86% rename from impl/src/main/java/org/jboss/cdi/tck/tests/invokers/invalid/InterceptorInvokerTest.java rename to impl/src/main/java/org/jboss/cdi/tck/tests/invokers/invalid/interceptor/InterceptorInvokerTest.java index 009f98292c..b639642653 100644 --- a/impl/src/main/java/org/jboss/cdi/tck/tests/invokers/invalid/InterceptorInvokerTest.java +++ b/impl/src/main/java/org/jboss/cdi/tck/tests/invokers/invalid/interceptor/InterceptorInvokerTest.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.jboss.cdi.tck.tests.invokers.invalid; +package org.jboss.cdi.tck.tests.invokers.invalid.interceptor; import jakarta.enterprise.inject.spi.DeploymentException; @@ -22,9 +22,6 @@ import org.jboss.cdi.tck.AbstractTest; import org.jboss.cdi.tck.cdi.Sections; import org.jboss.cdi.tck.shrinkwrap.WebArchiveBuilder; -import org.jboss.cdi.tck.tests.invokers.invalid.interceptor.MyInterceptor; -import org.jboss.cdi.tck.tests.invokers.invalid.interceptor.MyInterceptorBinding; -import org.jboss.cdi.tck.tests.invokers.invalid.interceptor.TestExtension; import org.jboss.shrinkwrap.api.spec.WebArchive; import org.jboss.test.audit.annotations.SpecAssertion; import org.jboss.test.audit.annotations.SpecVersion; diff --git a/impl/src/main/java/org/jboss/cdi/tck/tests/invokers/invalid/MethodFromDifferentClassInvokerTest.java b/impl/src/main/java/org/jboss/cdi/tck/tests/invokers/invalid/method/MethodFromDifferentClassInvokerTest.java similarity index 88% rename from impl/src/main/java/org/jboss/cdi/tck/tests/invokers/invalid/MethodFromDifferentClassInvokerTest.java rename to impl/src/main/java/org/jboss/cdi/tck/tests/invokers/invalid/method/MethodFromDifferentClassInvokerTest.java index ed307263ea..2e1712a507 100644 --- a/impl/src/main/java/org/jboss/cdi/tck/tests/invokers/invalid/MethodFromDifferentClassInvokerTest.java +++ b/impl/src/main/java/org/jboss/cdi/tck/tests/invokers/invalid/method/MethodFromDifferentClassInvokerTest.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.jboss.cdi.tck.tests.invokers.invalid; +package org.jboss.cdi.tck.tests.invokers.invalid.method; import jakarta.enterprise.inject.spi.DeploymentException; @@ -22,9 +22,6 @@ import org.jboss.cdi.tck.AbstractTest; import org.jboss.cdi.tck.cdi.Sections; import org.jboss.cdi.tck.shrinkwrap.WebArchiveBuilder; -import org.jboss.cdi.tck.tests.invokers.invalid.method.MyOtherService; -import org.jboss.cdi.tck.tests.invokers.invalid.method.MyService; -import org.jboss.cdi.tck.tests.invokers.invalid.method.TestExtension; import org.jboss.shrinkwrap.api.spec.WebArchive; import org.jboss.test.audit.annotations.SpecAssertion; import org.jboss.test.audit.annotations.SpecVersion; diff --git a/impl/src/main/java/org/jboss/cdi/tck/tests/invokers/invalid/ObjectMethodButNotToStringInvokerTest.java b/impl/src/main/java/org/jboss/cdi/tck/tests/invokers/invalid/objmethod/ObjectMethodButNotToStringInvokerTest.java similarity index 90% rename from impl/src/main/java/org/jboss/cdi/tck/tests/invokers/invalid/ObjectMethodButNotToStringInvokerTest.java rename to impl/src/main/java/org/jboss/cdi/tck/tests/invokers/invalid/objmethod/ObjectMethodButNotToStringInvokerTest.java index 41117fabde..0106b42dbe 100644 --- a/impl/src/main/java/org/jboss/cdi/tck/tests/invokers/invalid/ObjectMethodButNotToStringInvokerTest.java +++ b/impl/src/main/java/org/jboss/cdi/tck/tests/invokers/invalid/objmethod/ObjectMethodButNotToStringInvokerTest.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.jboss.cdi.tck.tests.invokers.invalid; +package org.jboss.cdi.tck.tests.invokers.invalid.objmethod; import jakarta.enterprise.inject.spi.DeploymentException; @@ -22,8 +22,6 @@ import org.jboss.cdi.tck.AbstractTest; import org.jboss.cdi.tck.cdi.Sections; import org.jboss.cdi.tck.shrinkwrap.WebArchiveBuilder; -import org.jboss.cdi.tck.tests.invokers.invalid.objmethod.MyService; -import org.jboss.cdi.tck.tests.invokers.invalid.objmethod.TestExtension; import org.jboss.shrinkwrap.api.spec.WebArchive; import org.jboss.test.audit.annotations.SpecAssertion; import org.jboss.test.audit.annotations.SpecVersion; diff --git a/impl/src/main/java/org/jboss/cdi/tck/tests/invokers/invalid/PrivateMethodInvokerTest.java b/impl/src/main/java/org/jboss/cdi/tck/tests/invokers/invalid/privatemethod/PrivateMethodInvokerTest.java similarity index 90% rename from impl/src/main/java/org/jboss/cdi/tck/tests/invokers/invalid/PrivateMethodInvokerTest.java rename to impl/src/main/java/org/jboss/cdi/tck/tests/invokers/invalid/privatemethod/PrivateMethodInvokerTest.java index 828edbb8e4..38573c04de 100644 --- a/impl/src/main/java/org/jboss/cdi/tck/tests/invokers/invalid/PrivateMethodInvokerTest.java +++ b/impl/src/main/java/org/jboss/cdi/tck/tests/invokers/invalid/privatemethod/PrivateMethodInvokerTest.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.jboss.cdi.tck.tests.invokers.invalid; +package org.jboss.cdi.tck.tests.invokers.invalid.privatemethod; import jakarta.enterprise.inject.spi.DeploymentException; @@ -22,8 +22,6 @@ import org.jboss.cdi.tck.AbstractTest; import org.jboss.cdi.tck.cdi.Sections; import org.jboss.cdi.tck.shrinkwrap.WebArchiveBuilder; -import org.jboss.cdi.tck.tests.invokers.invalid.privatemethod.MyService; -import org.jboss.cdi.tck.tests.invokers.invalid.privatemethod.TestExtension; import org.jboss.shrinkwrap.api.spec.WebArchive; import org.jboss.test.audit.annotations.SpecAssertion; import org.jboss.test.audit.annotations.SpecVersion; diff --git a/impl/src/main/java/org/jboss/cdi/tck/tests/invokers/invalid/ProducerFieldBeanInvokerTest.java b/impl/src/main/java/org/jboss/cdi/tck/tests/invokers/invalid/prodfield/ProducerFieldBeanInvokerTest.java similarity index 87% rename from impl/src/main/java/org/jboss/cdi/tck/tests/invokers/invalid/ProducerFieldBeanInvokerTest.java rename to impl/src/main/java/org/jboss/cdi/tck/tests/invokers/invalid/prodfield/ProducerFieldBeanInvokerTest.java index 804eb77a63..0a488fb58b 100644 --- a/impl/src/main/java/org/jboss/cdi/tck/tests/invokers/invalid/ProducerFieldBeanInvokerTest.java +++ b/impl/src/main/java/org/jboss/cdi/tck/tests/invokers/invalid/prodfield/ProducerFieldBeanInvokerTest.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.jboss.cdi.tck.tests.invokers.invalid; +package org.jboss.cdi.tck.tests.invokers.invalid.prodfield; import jakarta.enterprise.inject.spi.DeploymentException; @@ -22,9 +22,6 @@ import org.jboss.cdi.tck.AbstractTest; import org.jboss.cdi.tck.cdi.Sections; import org.jboss.cdi.tck.shrinkwrap.WebArchiveBuilder; -import org.jboss.cdi.tck.tests.invokers.invalid.prodfield.MyProducer; -import org.jboss.cdi.tck.tests.invokers.invalid.prodfield.MyService; -import org.jboss.cdi.tck.tests.invokers.invalid.prodfield.TestExtension; import org.jboss.shrinkwrap.api.spec.WebArchive; import org.jboss.test.audit.annotations.SpecAssertion; import org.jboss.test.audit.annotations.SpecVersion; diff --git a/impl/src/main/java/org/jboss/cdi/tck/tests/invokers/invalid/ProducerMethodBeanInvokerTest.java b/impl/src/main/java/org/jboss/cdi/tck/tests/invokers/invalid/prodmethod/ProducerMethodBeanInvokerTest.java similarity index 87% rename from impl/src/main/java/org/jboss/cdi/tck/tests/invokers/invalid/ProducerMethodBeanInvokerTest.java rename to impl/src/main/java/org/jboss/cdi/tck/tests/invokers/invalid/prodmethod/ProducerMethodBeanInvokerTest.java index f21d838f85..17d1b5ba3f 100644 --- a/impl/src/main/java/org/jboss/cdi/tck/tests/invokers/invalid/ProducerMethodBeanInvokerTest.java +++ b/impl/src/main/java/org/jboss/cdi/tck/tests/invokers/invalid/prodmethod/ProducerMethodBeanInvokerTest.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.jboss.cdi.tck.tests.invokers.invalid; +package org.jboss.cdi.tck.tests.invokers.invalid.prodmethod; import jakarta.enterprise.inject.spi.DeploymentException; @@ -22,9 +22,6 @@ import org.jboss.cdi.tck.AbstractTest; import org.jboss.cdi.tck.cdi.Sections; import org.jboss.cdi.tck.shrinkwrap.WebArchiveBuilder; -import org.jboss.cdi.tck.tests.invokers.invalid.prodmethod.MyProducer; -import org.jboss.cdi.tck.tests.invokers.invalid.prodmethod.MyService; -import org.jboss.cdi.tck.tests.invokers.invalid.prodmethod.TestExtension; import org.jboss.shrinkwrap.api.spec.WebArchive; import org.jboss.test.audit.annotations.SpecAssertion; import org.jboss.test.audit.annotations.SpecVersion; From 0bb053dfa5147a6d94756d6bb1a9006b0c87f19f Mon Sep 17 00:00:00 2001 From: Scott M Stark Date: Thu, 29 Feb 2024 16:08:35 -0600 Subject: [PATCH 5/8] Towards RC1, updated dist build docs and cleaned up the TCK reference guide Signed-off-by: Scott M Stark --- dist-build/HOW-TO-BUILD.adoc | 21 +++++- dist-build/README.adoc | 12 ++-- dist-build/lang-model-tck-runner/pom.xml | 35 +--------- .../src/test/wildfly/arquillian.xml | 4 +- dist-build/pom.xml | 5 ++ dist-build/src/main/assembly/assembly.xml | 9 ++- doc/reference/pom.xml | 8 ++- .../src/main/asciidoc/executing.asciidoc | 68 ++++++++----------- .../src/main/asciidoc/installation.asciidoc | 50 +++++--------- 9 files changed, 93 insertions(+), 119 deletions(-) diff --git a/dist-build/HOW-TO-BUILD.adoc b/dist-build/HOW-TO-BUILD.adoc index 45b2c3c09a..c7599df93a 100644 --- a/dist-build/HOW-TO-BUILD.adoc +++ b/dist-build/HOW-TO-BUILD.adoc @@ -1,2 +1,21 @@ = Jakarta CDI TCK dist-build -This document describes how the dist-build functions to produce the CDI TCK distribution zip bundle. \ No newline at end of file +This document describes how the dist-build functions to produce the CDI TCK distribution zip bundle. In the description below, CDI_TCK_DIST refers to the root directory of the CDI TCK distribution zip after being unpacked. For example, for the 4.1.0 release it would be cdi-tck-4.1.0. + +== Files in dist-build +- The src/main/assembly/assembly.xml defines how the distribution zip is put together from contents in the CDI TCK repo, and the Weld artifacts +- The src/test/* tree is copied to the CDI_TCK_DIST/weld/jboss-tck-runner/src/test and is related to running the TCK against Weld and WildFly/Weld. +- artifact-install.pom is installed as CDI_TCK_DIST/artifacts/pom.xml along with the TCK artifacts and its dependencies to allow one to install the TCK into a local maven repository. +- jboss-as-updater.pom is bundled as CDI_TCK_DIST/weld/jboss-as/pom.xml and can be used to update a bare WildFly installation with the Weld version and Jakarta API artifacts that correspond to the versions used by the TCK. +- jboss-runner.pom is bundled as CDI_TCK_DIST/weld/jboss-tck-runner/pom.xml and contains the profiles used to run the TCK against, Weld in embedded and se modes as well as inside of the WildFly container. +- pom.xml - defines the distribution dependencies and the maven-assembly-plugin configuration +- README.adoc is the CDI_TCK_DIST top level readme file that describes the distribution contents + +== Running the build +To create the distribution, run the following from the project root: + +[source, console] +---- +mvn -Drelease install +---- + +The distribution zip file will be found in the dist-build/target directory. diff --git a/dist-build/README.adoc b/dist-build/README.adoc index 479722d8e0..30ee810095 100644 --- a/dist-build/README.adoc +++ b/dist-build/README.adoc @@ -3,9 +3,7 @@ Jakarta Contexts and Dependency Injection (CDI) is a Jakarta standard for dependency injection and contextual lifecycle management. This is the TCK for CDI. -This distribution, as a whole, is licensed under the terms of the Apache Public -License, while the final distribution used for compatibility testing is under the EFTL. The -bundled LICENSE file will dictate which license applies to the TCK distribution. +This distribution, as a whole, is licensed under the terms of the Apache Public License, while the final distribution used for compatibility testing is under the EFTL. The bundled LICENSE file will dictate which license applies to the TCK distribution. This distribution consists of: @@ -26,13 +24,13 @@ lib/ weld/ - – TCK runner for using Weld (the CDI RI) with JBoss AS + – subdirectory for the sample TCK runner for using Weld (the CDI ratifying compatible implementation) standalone and with WildFly -jboss-tck-runner/ +weld/jboss-tck-runner/ - – maven-based TCK runner for WildFly + – maven-based TCK runner for standalone Weld and with WildFly -lang-model-tck-runner/ +weld/lang-model-tck-runner/ - maven-based Language Model TCK runner for Weld and WildFly diff --git a/dist-build/lang-model-tck-runner/pom.xml b/dist-build/lang-model-tck-runner/pom.xml index 326b5816e9..1ea1084d0a 100644 --- a/dist-build/lang-model-tck-runner/pom.xml +++ b/dist-build/lang-model-tck-runner/pom.xml @@ -6,7 +6,7 @@ An example pom for running the lang model against Weld and WildFly org.jboss.weld lang-model-tck-runner - 4.0.5-SNAPSHOT + ${cdi.tck.version} 11 @@ -19,7 +19,7 @@ jakarta.enterprise cdi-tck-lang-model - ${project.version} + ${cdi.api.version} org.jboss.weld @@ -51,7 +51,7 @@ org.wildfly.arquillian wildfly-arquillian-container-managed - 5.0.0.Alpha3 + 5.0.1.Final org.jboss.arquillian.protocol @@ -83,7 +83,6 @@ org.jboss.arquillian.junit arquillian-junit-container - ${arquillian.version} test @@ -170,9 +169,6 @@ - - src/test/resources - src/test/wildfly @@ -216,7 +212,6 @@ - surefire.testng.verbose 0 @@ -241,30 +236,6 @@ - - org.apache.maven.plugins - maven-resources-plugin - - - copy-resources - - validate - - copy-resources - - - ${JBOSS_HOME}/standalone/configuration - - - ${JBOSS_HOME}/docs/examples/configs - standalone-activemq-embedded.xml - - - - - - - diff --git a/dist-build/lang-model-tck-runner/src/test/wildfly/arquillian.xml b/dist-build/lang-model-tck-runner/src/test/wildfly/arquillian.xml index d5ec7951bb..9e57f4731b 100644 --- a/dist-build/lang-model-tck-runner/src/test/wildfly/arquillian.xml +++ b/dist-build/lang-model-tck-runner/src/test/wildfly/arquillian.xml @@ -10,8 +10,8 @@ - - standalone-activemq-embedded.xml + + standalone-full.xml -Xms128m -Xmx1g -ea -DcdiTckExcludeDummy=true ${gc.args} ${additional.vm.args} ${jacoco.agent} false true diff --git a/dist-build/pom.xml b/dist-build/pom.xml index 42597d5c94..dd6e0e78ec 100644 --- a/dist-build/pom.xml +++ b/dist-build/pom.xml @@ -13,6 +13,11 @@ CDI TCK Distribution + cdi-tck-core-impl-${project.version}-sigtest-jdk17.sig diff --git a/dist-build/src/main/assembly/assembly.xml b/dist-build/src/main/assembly/assembly.xml index ac148f7603..4c00c43cf7 100644 --- a/dist-build/src/main/assembly/assembly.xml +++ b/dist-build/src/main/assembly/assembly.xml @@ -8,6 +8,7 @@ zip + @@ -23,12 +24,15 @@ pom.xml true + ${project.basedir}/../impl/src/main/resources/sigtest-weld-pom.xml artifacts true - jboss-runner.pom @@ -51,7 +55,9 @@ + + ${project.basedir} / @@ -59,6 +65,7 @@ README.adoc + ${project.basedir}/lang-model-tck-runner weld/lang-model-tck-runner diff --git a/doc/reference/pom.xml b/doc/reference/pom.xml index c6faeb1cd4..fac4637b5a 100644 --- a/doc/reference/pom.xml +++ b/doc/reference/pom.xml @@ -21,6 +21,10 @@ cdi-tck-reference-guide.pdf 4 4.1 + + 6.0 + + 31 @@ -50,8 +54,8 @@ ${arquillian.version} ${testng.version} - ${weld.version} - 31 + ${weld.stream} + ${wildfly.major.version}.x 7.0.x Jakarta EE 11 diff --git a/doc/reference/src/main/asciidoc/executing.asciidoc b/doc/reference/src/main/asciidoc/executing.asciidoc index e9d4e7632e..a7f33f6942 100644 --- a/doc/reference/src/main/asciidoc/executing.asciidoc +++ b/doc/reference/src/main/asciidoc/executing.asciidoc @@ -2,13 +2,12 @@ == Executing the Test Suite -This chapter explains how to run the TCK on Weld as well as your own implementation. The CDI TCK uses the Maven Surefire plugin and the Arquillian test platform to execute the test suite. Learning to execute the test suite from Maven is prerequisite knowledge for running the tests in an IDE, such as Eclipse. - +This chapter explains how to run the TCK on Weld as well as your own implementation. The CDI TCK uses the Maven Surefire plugin and the Arquillian test platform to execute the test suite. Learning to execute the test suite from Maven is prerequisite knowledge for running the tests in an IDE. === The Test Suite Runner -The test suite is executed by the Maven Surefire plugin during the test phase of the Maven life cycle. The execution happens within a TCK runner project (as opposed to the TCK project itself). Weld includes a TCK runner project that executes the CDI TCK on Weld in standalone mode. running inside WildFly 31.x. To execute the CDI TCK on your own CDI implementation, you could modify the TCK runner project included with Weld to use your CDI implementation. +The test suite is executed by the Maven Surefire plugin during the test phase of the Maven life cycle. The execution happens within a TCK runner project (as opposed to the TCK project itself). The TCK distribution includes a sample runner project that executes the CDI TCK on Weld in standalone mode as well as inside WildFly {wildfly-version}. To execute the CDI TCK on your own CDI implementation or server, you could modify the sample TCK runner project and change it to use your CDI implementation and/or Arquillian container configuration. @@ -40,9 +39,9 @@ Without any command-line flags, the test suite is run in standalone mode (activa -=== Running the Tests In the Container - Core and EE parts +=== Running the Core Tests In the Container -To execute tests within Core and EE parts of the specification you need to use in-container mode with the JBoss TCK runner, you first have to setup WildFly as described in the <> callout. +To execute tests within Core of the specification you need to use in-container mode with the JBoss TCK runner, you first have to configure WildFly as described in the <> section. Then, execute the TCK runner with Maven as follows: @@ -51,15 +50,9 @@ Then, execute the TCK runner with Maven as follows: mvn test -Dincontainer ---- -The presence of the +incontainer+ property activates an incontainer Maven profile. This time, all the tests except the tests within SE TestNG group are executed. - -In order to run tests appropriate to the Jakarta EE Web Profile execute: - -[source, console] ----- -mvn test -Dincontainer=webprofile ----- +The presence of the +incontainer+ property activates an incontainer Maven profile. This time, all the tests except the tests within SE and integration TestNG groups are executed. +For the release, the tests appropriate for the Jakarta EE Web Profile have moved to a separated standalone CDI EE TCK distributed by the EE Platform TCK. To specify particular TCK version: @@ -74,27 +67,18 @@ mvn test -Dincontainer -Dcdi.tck.version=4.1.0 ==== In order to run the TCK Test Suite in the container an Arquillian container adapter is required. See also link:$$https://docs.jboss.org/author/display/ARQ/Containers$$[Arqullian reference guide]. - ==== -The Arquillian will also start and stop the application server automatically (provided a managed Arqullian container adapter is used). - -Since Arquillian in-container tests are executed in a remote JVM, the results of the test must be communicated back to the runner over a container-supported protocol. The TCK utilizes servlet-based protocol (communication over HTTP). - - -[NOTE] -==== -Some implementations of Jakarta Faces use modern Javascript that is incompatible with the TCK's default test tooling. In order to test these implementations, specify the property -Drun.selenium=true. An installation of Chrome is required. - -==== +The Arquillian container adaptor will also start and stop the application server automatically (provided a managed Arqullian container adaptor is used). +Since Arquillian in-container tests are executed in a remote JVM, the results of the test must be communicated back to the runner over a container-supported protocol. The sample WildFly TCK runner utilizes servlet-based protocol (communication over HTTP). === Running the Tests In the Container - SE part -To execute full TCK testsuite you have to run tests within SE group as well. +To execute full TCK testsuite you have to run tests within SE group as well if your implementation supports that mode. SE tests make use of link:$$https://github.com/arquillian/arquillian-container-se$$[Arquillian container SE]. -This way the tests are executed in a separate JVM instance with isolated and configurable classpath. +The tests are executed in a separate JVM instance with an isolated and configurable classpath. The Arquillian container does not start CDI container in any way - this is still done directly in the tests using CDI SE bootstrap API and `jakarta.enterprise.inject.se.SeContainerInitializer`. In order to run SE TCK tests in Weld, you need to execute "weld-se" Maven profile from the JBoss TCK runner POM file as follows: @@ -103,43 +87,42 @@ In order to run SE TCK tests in Weld, you need to execute "weld-se" Maven profil mvn test -Dincontainer=se --- -The profile needs to provide RI dependencies as well as Arquillian settings (`arquillian.xml`). +The profile provides the Weld dependencies as well as Arquillian settings (`arquillian.xml`). These two need to be stored into a directory so that Arquillian container can then be instructed to pick them up. link:$$https://github.com/weld/core/blob/b530cf78275c618d9d866ee2d4a7fa81d59220e0/jboss-tck-runner/pom.xml#L561$$[In Weld], this orchestration is done using `maven-dependency-plugin` along with `maven-surefire-plugin`. +=== Exporting the Test Archives -=== Dumping the Test Archives - -As you have learned, when the test suite is executing using in-container mode, each test class is packaged as a deployable archive and deployed to the container. The test is then executed within the context of the deployed application. This leaves room for errors in packaging. When investigating a test failure, you may find it helpful to inspect the archive after it's generated. The TCK (or Arquillian respectively) can accommodate this type of inspection by "dumping" the generated archive to disk. +As you have learned, when the test suite is executing using in-container mode, each test class is packaged as a deployable archive and deployed to the container. The test is then executed within the context of the deployed application. This leaves room for errors in packaging. When investigating a test failure, you may find it helpful to inspect the archive after it's generated. The TCK (or Arquillian respectively) can accommodate this type of inspection by exporting the generated archive to disk. The feature just described is activated in the Arquillian configuration file (<>). In order to export the test archive you'll have to add the +deploymentExportPath+ property element inside +engine+ element and assign a relative or absolute directory where the test archive should be exported, e.g.: [source, xml] ---- - - target/ - - + + target/ + + ---- Arquillian will export the archive to that location for any test you run. -To enable the export for just a single test, use the VM argument +arquillian.deploymentExportPath+: +To enable the export for just a single test, use the VM argument +arquillian.deploymentExportPath+ when running the test(s): [source, console] ---- --Darquillian.deploymentExportPath=target/deployments/ +mvn -Darquillian.deploymentExportPath=target/deployments/ ... ---- +[[lang-model-tck]] == Executing the Lang Model Test Suite The Language Model TCK does not depend on any test framework or test runner. Assertions are made using Java `assert`. The tests are executed in an implementation-defined manner. To run the Language Model TCK, implementations must call the `org.jboss.cdi.lang.model.tck.LangModelVerifier#verify()` static method and pass it a `ClassInfo` object for the `LangModelVerifier` class. -The way how this method is called and how the `ClassInfo` object is obtained are not specified, so that implementations are free to use whatever works best for them. -Two conditions must be satisfied: +The way how this method is called and how the `ClassInfo` object is obtained are not specified, so that implementations are free to use whatever works best for them. Two conditions must be satisfied: - assertions are enabled; - the language model under test is configured to only return runtime-retained annotations. @@ -173,17 +156,20 @@ To execute the TCK test suite against Weld, first switch to the lang-model-tck-r cd core-tck-4.x.y/weld/lang-model-tck-runner ---- - [NOTE] ==== These instructions assume you have extracted the Jakarta CDI TCK software according to the recommendation given in <>. - ==== -Then, execute the TCK runner with Maven as follows: +Then, execute the TCK runner with Maven in the embedded Weld container as follows: [source, console] ---- mvn test ---- +To execute the TCK runner in WildFly use: +[source, console] +---- +mvn -Dincontainer test +---- diff --git a/doc/reference/src/main/asciidoc/installation.asciidoc b/doc/reference/src/main/asciidoc/installation.asciidoc index 2e14c32c19..ea8c8c24eb 100644 --- a/doc/reference/src/main/asciidoc/installation.asciidoc +++ b/doc/reference/src/main/asciidoc/installation.asciidoc @@ -12,9 +12,9 @@ You can obtain a release of the CDI TCK project from the link:$$https://download You can also download the current source code from link:$$https://github.com/eclipse-ee4j/cdi-tck$$[GitHub repository]. -Executing the TCK requires a {jakartaee-version} or better runtime environment (i.e., application server), to which the test artifacts are deployed and the individual tests are invoked. The TCK does not depend on any particular Jakarta EE implementation. +Executing the TCK requires a {jakartaee-version} or better runtime environment (i.e., application server), to which the test artifacts are deployed and the individual tests are invoked. The TCK tests do not depend on any particular Jakarta EE implementation. -A Jakarta Contexts and Dependency Injection compatible implementation project is named Weld. The release stream for Jakarta CDI {revnumber} TCK is named _{revnumber}.x_. You can obtain the latest release from the link:$$http://weld.cdi-spec.org/download/$$[download page] on the Weld website. +One Jakarta Contexts and Dependency Injection compatible implementation project is named Weld. The release stream for Jakarta CDI {revnumber} TCK is named _{revnumber}.x_. The compatible Weld release stream is _{weld-stream}_. You can obtain the latest release from the link:$$http://weld.cdi-spec.org/download/$$[download page] on the Weld website. [NOTE] @@ -28,11 +28,11 @@ Naturally, to execute Java programs, you must have a Java SE runtime environment === The TCK Environment -The TCK requires the following two Java runtime environments: +The TCK requires the following two runtime environments: -* Java SE 17 or better - -* {jakartaee-version} or better (e.g., WildFly {wildfly-version} or GlassFish {glassfish-version} +* Java SE 17 or better +* A Maven installation, version 3.9 or higher +* A {jakartaee-version} runtime (e.g., WildFly {wildfly-version} or GlassFish {glassfish-version} You should refer to vendor instructions for how to install the runtime environment. @@ -56,51 +56,35 @@ core-tck-4.x.y/ README.adoc ---- -Each test class is treated as an individual artifact. All test methods (i.e., methods annotated with +@Test+) in the test class are run in the application, meaning bean discovery occurs exactly once per artifact and the same BeanManager is used by each test method in the class. +Each test class is treated as an individual artifact. All test methods (i.e., methods annotated with +@Test+) in the test class are run in the application, meaning bean discovery occurs exactly once per artifact and the same BeanManager is used by each test method in the class. -[TIP] -==== -[[running-against-weld, Running the TCK against Weld and WildFly]] -Running the TCK against Weld and WildFly +[[running-against-wildfly]] -* First, you should download WildFly {wildfly-version} from the WildFly link:$$http://www.wildfly.org/downloads/$$[project page]. +==== Example of Setting up TCK to use WildFly -* Set the JBOSS_HOME environment variable to the location of the WildFly software. +* First, you should download WildFly {wildfly-version} from the WildFly link:$$http://www.wildfly.org/downloads/$$[project page]. -The CDI TCK distribution includes a TCK runner that executes the TCK using Weld as the CDI implementation and WildFly as the Jakarta EE runtime. To run the TCK: +* Set the JBOSS_HOME environment variable to the root directory path for the location where you have unpacked WildFly software. -* You need to install Maven. You can find documentation on how to install Maven in the link:$$http://books.sonatype.com/mvnref-book/reference/installation.html$$[Maven: The Definitive Guide] book published by Sonatype. +The CDI TCK distribution includes maven project that allows one to update a bare WildFly distribution to match the CDI API artifacts and Weld version references by the TCK. To update WildFly, run the following Maven commands from within the core-tck-4.x.y/weld/jboss-as directory: -* Next, integrate the Weld jars into WildFly: +* Integrate the Weld jars into WildFly: [source, console] ---- -cd core-tck-4.x.y/weld/jboss-as mvn -Pupdate-jboss-as package ---- -* Next, integrate the TCK ext jar into WildFly: - -[source, console] ----- -cd core-tck-4.x.y/weld/jboss-as -mvn -Dtck package ----- - -* Next, instruct Maven to run the TCK: +* Next, update the Jakarta API jars [source, console] ---- -cd core-tck-4.x.y/weld/jboss-tck-runner -mvn test -Dincontainer +mvn -Pupdate-jakarta-apis package ---- -* Use +cdi.tck.version+ system property to specify particular TCK version: +* Next, integrate the TCK ext jar into WildFly: [source, console] ---- -mvn test -Dincontainer -Dcdi.tck.version=4.1.1 +mvn -Dtck package ---- -* TestNG will report, via Maven, the outcome of the run, and report any failures on the console. Details can be found in target/surefire-reports/TestSuite.txt. - -==== From 493ee784a7308e708a53f312f54e8bb5fe90f50a Mon Sep 17 00:00:00 2001 From: Scott M Stark Date: Thu, 29 Feb 2024 16:39:43 -0600 Subject: [PATCH 6/8] Rename the Configuration CdiLiteMode to CoreMode Fixes #561 Signed-off-by: Scott M Stark --- .../java/org/jboss/cdi/tck/api/Configuration.java | 8 ++++---- dist-build/jboss-runner.pom | 8 -------- dist-build/lang-model-tck-runner/pom.xml | 1 - .../src/test/wildfly/arquillian.xml | 3 +-- .../src/test/resources/wildfly-arquillian.xml | 3 +-- .../src/main/asciidoc/configuration.asciidoc | 2 +- .../org/jboss/cdi/tck/impl/ConfigurationImpl.java | 14 +++++++------- .../impl/PropertiesBasedConfigurationBuilder.java | 4 ++-- 8 files changed, 16 insertions(+), 27 deletions(-) diff --git a/api/src/main/java/org/jboss/cdi/tck/api/Configuration.java b/api/src/main/java/org/jboss/cdi/tck/api/Configuration.java index 51e50a1376..620612790e 100644 --- a/api/src/main/java/org/jboss/cdi/tck/api/Configuration.java +++ b/api/src/main/java/org/jboss/cdi/tck/api/Configuration.java @@ -29,14 +29,14 @@ * Porting package property names are the FQCN of the SPI class. Other property names (one for each non-porting package SPI * configuration option) are specified here. * - * The TCK may also be configured programatically through this interface. + * The TCK may also be configured programmatically through this interface. * * @author Pete Muir * @author Martin Kouba */ public interface Configuration { - public static final String CDI_LITE_MODE = "org.jboss.cdi.tck.cdiLiteMode"; + public static final String CDI_CORE_MODE = "org.jboss.cdi.tck.cdiCoreMode"; public static final String LIBRARY_DIRECTORY_PROPERTY_NAME = "org.jboss.cdi.tck.libraryDirectory"; @@ -64,9 +64,9 @@ public interface Configuration { * * @return true if running in a CDI Lite environment */ - public Boolean getCdiLiteMode(); + public Boolean getCoreMode(); - public void setCdiLiteMode(Boolean cdiLiteMode); + public void setCoreMode(Boolean cdiLiteMode); /** * The implementation of {@link Beans} in use. diff --git a/dist-build/jboss-runner.pom b/dist-build/jboss-runner.pom index b019c90762..932151b0e1 100644 --- a/dist-build/jboss-runner.pom +++ b/dist-build/jboss-runner.pom @@ -345,10 +345,6 @@ target/dependency/lib - java:jboss/datasources/ExampleDS - java:/ConnectionFactory - java:/queue/test - java:/topic/test target/suites/tck-core-suite.xml @@ -543,10 +539,6 @@ target/dependency/lib - java:jboss/datasources/ExampleDS - java:/ConnectionFactory - java:/queue/test - java:/topic/test ${jacoco.agent} diff --git a/dist-build/lang-model-tck-runner/pom.xml b/dist-build/lang-model-tck-runner/pom.xml index 1ea1084d0a..388cba7a98 100644 --- a/dist-build/lang-model-tck-runner/pom.xml +++ b/dist-build/lang-model-tck-runner/pom.xml @@ -223,7 +223,6 @@ target/dependency/lib - java:jboss/datasources/ExampleDS ${jacoco.agent} diff --git a/dist-build/lang-model-tck-runner/src/test/wildfly/arquillian.xml b/dist-build/lang-model-tck-runner/src/test/wildfly/arquillian.xml index 9e57f4731b..22414e9b37 100644 --- a/dist-build/lang-model-tck-runner/src/test/wildfly/arquillian.xml +++ b/dist-build/lang-model-tck-runner/src/test/wildfly/arquillian.xml @@ -10,8 +10,7 @@ - - standalone-full.xml + standalone.xml -Xms128m -Xmx1g -ea -DcdiTckExcludeDummy=true ${gc.args} ${additional.vm.args} ${jacoco.agent} false true diff --git a/dist-build/src/test/resources/wildfly-arquillian.xml b/dist-build/src/test/resources/wildfly-arquillian.xml index eb52070063..406080303f 100644 --- a/dist-build/src/test/resources/wildfly-arquillian.xml +++ b/dist-build/src/test/resources/wildfly-arquillian.xml @@ -10,8 +10,7 @@ - - standalone-full.xml + standalone.xml -Xms128m -Xmx1g -ea -DcdiTckExcludeDummy=true ${gc.args} ${additional.vm.args} ${jacoco.agent} false true diff --git a/doc/reference/src/main/asciidoc/configuration.asciidoc b/doc/reference/src/main/asciidoc/configuration.asciidoc index 5bc24deb77..318684107f 100644 --- a/doc/reference/src/main/asciidoc/configuration.asciidoc +++ b/doc/reference/src/main/asciidoc/configuration.asciidoc @@ -21,7 +21,7 @@ You should set the following required properties: The directory containing extra JARs to be placed in the test archive library directory such as the porting package implementation. -|+org.jboss.cdi.tck.cdiLiteMode=true+| Enable the CDI Lite mode. When enabled, none of the org.jboss.cdi.tck.test* properties below related to Jakarta EE tests are required. +|+org.jboss.cdi.tck.cdiCoreMode=true+| Enable the CDI Core mode. When enabled, none of the org.jboss.cdi.tck.test* properties below related to Jakarta EE tests are required. |+org.jboss.cdi.tck.testDataSource=java:jboss/datasources/ExampleDS+| A few TCK tests work with Jakarta Persistence services and require a data source to be provided. This property defines JNDI name of such resource. Required for the tests within the _persistence_ test group. diff --git a/impl/src/main/java/org/jboss/cdi/tck/impl/ConfigurationImpl.java b/impl/src/main/java/org/jboss/cdi/tck/impl/ConfigurationImpl.java index dfd0e18112..8649fc6445 100644 --- a/impl/src/main/java/org/jboss/cdi/tck/impl/ConfigurationImpl.java +++ b/impl/src/main/java/org/jboss/cdi/tck/impl/ConfigurationImpl.java @@ -30,7 +30,7 @@ */ public class ConfigurationImpl implements Configuration { - private Boolean cdiLiteMode; + private Boolean coreMode = Boolean.TRUE; private Beans beans; private Contexts contexts; @@ -50,12 +50,12 @@ public class ConfigurationImpl implements Configuration { protected ConfigurationImpl() { } - public Boolean getCdiLiteMode() { - return cdiLiteMode; + public Boolean getCoreMode() { + return coreMode; } - public void setCdiLiteMode(Boolean cdiLiteMode) { - this.cdiLiteMode = cdiLiteMode; + public void setCoreMode(Boolean cdiLiteMode) { + this.coreMode = cdiLiteMode; } public Beans getBeans() { @@ -161,9 +161,9 @@ public void setTestTimeoutFactor(int timeoutFactor) { @Override public String toString() { StringBuilder configuration = new StringBuilder(); - configuration.append("Jakarta CDI 4.0 TCK Configuration\n"); + configuration.append("Jakarta CDI 4.1 TCK Configuration\n"); configuration.append("-----------------\n"); - configuration.append("\tCDI Lite mode: ").append(getCdiLiteMode()).append("\n"); + configuration.append("\tCDI Core mode: ").append(getCoreMode()).append("\n"); configuration.append("\tBeans: ").append(getBeans()).append("\n"); configuration.append("\tContexts: ").append(getContexts()).append("\n"); configuration.append("\tContextuals: ").append(getContextuals()).append("\n"); diff --git a/impl/src/main/java/org/jboss/cdi/tck/impl/PropertiesBasedConfigurationBuilder.java b/impl/src/main/java/org/jboss/cdi/tck/impl/PropertiesBasedConfigurationBuilder.java index e85293839e..dadc8e2704 100644 --- a/impl/src/main/java/org/jboss/cdi/tck/impl/PropertiesBasedConfigurationBuilder.java +++ b/impl/src/main/java/org/jboss/cdi/tck/impl/PropertiesBasedConfigurationBuilder.java @@ -60,7 +60,7 @@ public Configuration getConfiguration() { */ @SuppressWarnings("unchecked") public PropertiesBasedConfigurationBuilder init(boolean deploymentPhase) { - configuration.setCdiLiteMode(getBooleanValue(Configuration.CDI_LITE_MODE, Boolean.FALSE, false)); + configuration.setCoreMode(getBooleanValue(Configuration.CDI_CORE_MODE, Boolean.FALSE, false)); configuration.setBeans(getInstanceValue(Beans.PROPERTY_NAME, Beans.class, !deploymentPhase)); configuration.setEl(getInstanceValue(EL.PROPERTY_NAME, EL.class, !deploymentPhase)); @@ -71,7 +71,7 @@ public PropertiesBasedConfigurationBuilder init(boolean deploymentPhase) { configuration.setLibraryDirectory(getStringValue(Configuration.LIBRARY_DIRECTORY_PROPERTY_NAME, null, deploymentPhase)); - if (!configuration.getCdiLiteMode()) { + if (!configuration.getCoreMode()) { configuration.setTestDataSource(getStringValue(Configuration.TEST_DATASOURCE_PROPERTY_NAME, null, deploymentPhase)); configuration.setTestJmsConnectionFactory( getStringValue(Configuration.TEST_JMS_CONNECTION_FACTORY, null, deploymentPhase)); From f2c487aba2ffefe7775000f9a49e3883935c398a Mon Sep 17 00:00:00 2001 From: Scott M Stark Date: Thu, 29 Feb 2024 17:37:30 -0600 Subject: [PATCH 7/8] Allow the distribution license to be specified via license.file property Signed-off-by: Scott M Stark --- dist-build/pom.xml | 2 ++ dist-build/src/main/assembly/assembly.xml | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/dist-build/pom.xml b/dist-build/pom.xml index dd6e0e78ec..a475ff7ca3 100644 --- a/dist-build/pom.xml +++ b/dist-build/pom.xml @@ -19,6 +19,8 @@ match the sigtest-maven-plugin sigfile configuration value to the generated sigtest artifact. --> cdi-tck-core-impl-${project.version}-sigtest-jdk17.sig + + apl.txt diff --git a/dist-build/src/main/assembly/assembly.xml b/dist-build/src/main/assembly/assembly.xml index 4c00c43cf7..4786f6517b 100644 --- a/dist-build/src/main/assembly/assembly.xml +++ b/dist-build/src/main/assembly/assembly.xml @@ -10,9 +10,9 @@ - + - EFTL.txt + ${license.file} LICENSE diff --git a/pom.xml b/pom.xml index 5de225754d..9e2bf8a0dc 100644 --- a/pom.xml +++ b/pom.xml @@ -96,7 +96,7 @@ - 4.1.0.Beta2 + 4.1.0.RC1 11 3.0.0-M1