From 79300f55a5e04561204641653dc86fb8951cd187 Mon Sep 17 00:00:00 2001 From: Arjan Tijms Date: Fri, 14 Jun 2024 23:57:41 +0200 Subject: [PATCH 1/3] Updated CDI TCK runner to 4.1.0 Does not yet pass all tests Signed-off-by: Arjan Tijms --- appserver/tests/tck/cdi/cdi-full/pom.xml | 40 +++++----- .../glassfish/GlassFishContextualsImpl.java | 69 ++++++++++++++++ .../GlassFishCreationalContextsImpl.java | 80 +++++++++++++++++++ .../resources/META-INF/cdi-tck.properties | 2 + appserver/tests/tck/cdi/cdi-model/pom.xml | 12 +-- appserver/tests/tck/cdi/cdi-signature/pom.xml | 2 +- appserver/tests/tck/cdi/pom.xml | 2 +- 7 files changed, 180 insertions(+), 27 deletions(-) create mode 100644 appserver/tests/tck/cdi/cdi-full/src/test/java/org/jboss/weld/tck/glassfish/GlassFishContextualsImpl.java create mode 100644 appserver/tests/tck/cdi/cdi-full/src/test/java/org/jboss/weld/tck/glassfish/GlassFishCreationalContextsImpl.java diff --git a/appserver/tests/tck/cdi/cdi-full/pom.xml b/appserver/tests/tck/cdi/cdi-full/pom.xml index c2759c61868..675fe218930 100644 --- a/appserver/tests/tck/cdi/cdi-full/pom.xml +++ b/appserver/tests/tck/cdi/cdi-full/pom.xml @@ -27,7 +27,7 @@ glassfish-external-tck-cdi - CDI TCK Full runner 4.0 for Weld (GlassFish) + CDI TCK Full runner 4.1 for Weld (GlassFish) Aggregates dependencies and runs the CDI TCK on GlassFish @@ -38,6 +38,11 @@ jakarta.enterprise.cdi-api provided + + jakarta.enterprise + jakarta.enterprise.cdi-el-api + provided + jakarta.el jakarta.el-api @@ -134,7 +139,7 @@ jakarta.enterprise cdi-tck-api - ${cdi.tck-4-0.version} + ${cdi.tck-4-1.version} test @@ -151,7 +156,7 @@ jakarta.enterprise cdi-tck-core-impl - ${cdi.tck-4-0.version} + ${cdi.tck-4-1.version} test @@ -161,14 +166,12 @@ - jakarta.enterprise - cdi-tck-web-impl - ${cdi.tck-4-0.version} + cdi-tck-core-impl + ${cdi.tck-4-1.version} + xml + suite test @@ -178,7 +181,6 @@ - org.glassfish.expressly expressly @@ -226,7 +228,7 @@ org.omnifaces.arquillian arquillian-glassfish-server-managed - 1.4 + 1.5 test @@ -271,19 +273,19 @@ jakarta.enterprise - cdi-tck-web-impl - ${cdi.tck-4-0.version} + cdi-tck-core-impl + ${cdi.tck-4-1.version} xml suite - false - tck-web-suite.xml + false + tck-core-suite.xml target/suites @@ -313,7 +315,7 @@ - + install-cdi-tck-ext-lib pre-integration-test @@ -325,7 +327,7 @@ jakarta.enterprise cdi-tck-ext-lib - ${cdi.tck-4-0.version} + ${cdi.tck-4-1.version} jar true ${glassfish.root}/glassfish8/glassfish/domains/domain1/lib/applibs @@ -344,7 +346,7 @@ - target/suites/tck-web-suite.xml + target/suites/tck-core-suite.xml ${excluded.groups} diff --git a/appserver/tests/tck/cdi/cdi-full/src/test/java/org/jboss/weld/tck/glassfish/GlassFishContextualsImpl.java b/appserver/tests/tck/cdi/cdi-full/src/test/java/org/jboss/weld/tck/glassfish/GlassFishContextualsImpl.java new file mode 100644 index 00000000000..0c1ea19ae85 --- /dev/null +++ b/appserver/tests/tck/cdi/cdi-full/src/test/java/org/jboss/weld/tck/glassfish/GlassFishContextualsImpl.java @@ -0,0 +1,69 @@ +/* + * Copyright (c) 2024 Eclipse Foundation and/or its affiliates. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ +package org.jboss.weld.tck.glassfish; + +import jakarta.enterprise.context.spi.Context; +import jakarta.enterprise.context.spi.CreationalContext; +import org.jboss.cdi.tck.spi.Contextuals; + +public class GlassFishContextualsImpl implements Contextuals { + + @Override + public Inspectable create(T instance, Context context) { + return new InspectableContextual<>(instance); + } + + static class InspectableContextual implements Inspectable { + + private T instancePassedToConstructor; + private T instancePassedToDestroy; + + private CreationalContext creationalContextPassedToCreate; + private CreationalContext creationalContextPassedToDestroy; + + InspectableContextual(T instance) { + this.instancePassedToConstructor = instance; + } + + @Override + public T create(CreationalContext creationalContext) { + this.creationalContextPassedToCreate = creationalContext; + return instancePassedToConstructor; + } + + @Override + public void destroy(T instance, CreationalContext creationalContext) { + instancePassedToDestroy = instance; + creationalContextPassedToDestroy = creationalContext; + } + + @Override + public CreationalContext getCreationalContextPassedToCreate() { + return creationalContextPassedToCreate; + } + + @Override + public T getInstancePassedToDestroy() { + return instancePassedToDestroy; + } + + @Override + public CreationalContext getCreationalContextPassedToDestroy() { + return creationalContextPassedToDestroy; + } + } + +} diff --git a/appserver/tests/tck/cdi/cdi-full/src/test/java/org/jboss/weld/tck/glassfish/GlassFishCreationalContextsImpl.java b/appserver/tests/tck/cdi/cdi-full/src/test/java/org/jboss/weld/tck/glassfish/GlassFishCreationalContextsImpl.java new file mode 100644 index 00000000000..05f52b3c2e2 --- /dev/null +++ b/appserver/tests/tck/cdi/cdi-full/src/test/java/org/jboss/weld/tck/glassfish/GlassFishCreationalContextsImpl.java @@ -0,0 +1,80 @@ +/* + * Copyright (c) 2024 Contributors to the Eclipse Foundation. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ +package org.jboss.weld.tck.glassfish; + +import jakarta.enterprise.context.spi.Contextual; +import org.jboss.cdi.tck.spi.CreationalContexts; +import org.jboss.weld.contexts.CreationalContextImpl; + +/** + * This returns the Weld (and thus GlassFish) specific CreationalContextImpl with added methods + * for inspection. + */ +public class GlassFishCreationalContextsImpl implements CreationalContexts { + + @Override + public Inspectable create(Contextual contextual) { + return new InspectableCreationalContext<>(contextual); + } + + static class InspectableCreationalContext extends CreationalContextImpl implements Inspectable { + + private T lastBeanPushed; + private boolean pushCalled; + private boolean releaseCalled; + + public InspectableCreationalContext(Contextual contextual) { + super(contextual); + } + + @Override + public void push(T incompleteInstance) { + lastBeanPushed = incompleteInstance; + + pushCalled = true; + super.push(incompleteInstance); + } + + @Override + public Object getLastBeanPushed() { + return lastBeanPushed; + } + + @Override + public boolean isPushCalled() { + return pushCalled; + } + + @Override + public boolean isReleaseCalled() { + return releaseCalled; + } + + @Override + public void release(Contextual contextual, T instance) { + releaseCalled = true; + super.release(contextual, instance); + } + + @Override + public void release() { + releaseCalled = true; + super.release(); + } + + } + +} diff --git a/appserver/tests/tck/cdi/cdi-full/src/test/resources/META-INF/cdi-tck.properties b/appserver/tests/tck/cdi/cdi-full/src/test/resources/META-INF/cdi-tck.properties index ca7b589f170..d04503bf95e 100644 --- a/appserver/tests/tck/cdi/cdi-full/src/test/resources/META-INF/cdi-tck.properties +++ b/appserver/tests/tck/cdi/cdi-full/src/test/resources/META-INF/cdi-tck.properties @@ -1,5 +1,7 @@ org.jboss.cdi.tck.spi.Beans=org.jboss.weld.tck.glassfish.GlassFishBeansImpl +org.jboss.cdi.tck.spi.CreationalContexts=org.jboss.weld.tck.glassfish.GlassFishCreationalContextsImpl org.jboss.cdi.tck.spi.Contexts=org.jboss.weld.tck.glassfish.GlassFishContextImpl +org.jboss.cdi.tck.spi.Contextuals=org.jboss.weld.tck.glassfish.GlassFishContextualsImpl org.jboss.cdi.tck.spi.EL=org.jboss.weld.tck.glassfish.GlassFishELImpl org.jboss.cdi.tck.testDataSource=jdbc/__default org.jboss.cdi.tck.testJmsConnectionFactory=java:comp/DefaultJMSConnectionFactory diff --git a/appserver/tests/tck/cdi/cdi-model/pom.xml b/appserver/tests/tck/cdi/cdi-model/pom.xml index 9010eeb8033..15f3a2b7f2a 100644 --- a/appserver/tests/tck/cdi/cdi-model/pom.xml +++ b/appserver/tests/tck/cdi/cdi-model/pom.xml @@ -18,7 +18,7 @@ --> 4.0.0 - + org.glassfish.main.tests.tck glassfish-external-tck-cdi-parent @@ -46,7 +46,7 @@ jakarta.enterprise cdi-tck-lang-model - ${cdi.tck-4-0.version} + ${cdi.tck-4-1.version} test @@ -94,7 +94,7 @@ - + maven-dependency-plugin @@ -120,7 +120,7 @@ - + maven-surefire-plugin @@ -129,7 +129,7 @@ true - ${glassfish.root}/glassfish8 + ${glassfish.root}/glassfish7 :org.jboss.cdi... @@ -156,7 +156,7 @@ - + full diff --git a/appserver/tests/tck/cdi/cdi-signature/pom.xml b/appserver/tests/tck/cdi/cdi-signature/pom.xml index 34d16eca8a0..7b4aebc7673 100644 --- a/appserver/tests/tck/cdi/cdi-signature/pom.xml +++ b/appserver/tests/tck/cdi/cdi-signature/pom.xml @@ -48,7 +48,7 @@ jakarta.enterprise cdi-tck-core-impl - ${cdi.tck-4-0.version} + ${cdi.tck-4-1.version} sig sigtest-jdk11 ${project.build.directory}/sigtest diff --git a/appserver/tests/tck/cdi/pom.xml b/appserver/tests/tck/cdi/pom.xml index 011426a7cae..3e2209705c0 100644 --- a/appserver/tests/tck/cdi/pom.xml +++ b/appserver/tests/tck/cdi/pom.xml @@ -43,7 +43,7 @@ UTF-8 UTF-8 - 4.0.13 + 4.1.0 2.50.0 From 2f7ec7b07ee72fa970799a309da9f4993fe71958 Mon Sep 17 00:00:00 2001 From: Arjan Tijms Date: Sat, 15 Jun 2024 00:12:08 +0200 Subject: [PATCH 2/3] Update TestNg Signed-off-by: Arjan Tijms --- appserver/tests/tck/cdi/cdi-full/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appserver/tests/tck/cdi/cdi-full/pom.xml b/appserver/tests/tck/cdi/cdi-full/pom.xml index 675fe218930..dbbff5c736c 100644 --- a/appserver/tests/tck/cdi/cdi-full/pom.xml +++ b/appserver/tests/tck/cdi/cdi-full/pom.xml @@ -209,7 +209,7 @@ org.testng testng - 7.4.0 + 7.9.0 test From d7baeaa6eefbf8606aac327e27c2aa72a3b3c217 Mon Sep 17 00:00:00 2001 From: Arjan Tijms Date: Sat, 15 Jun 2024 13:49:46 +0200 Subject: [PATCH 3/3] Replace glassfish7 with glassfish8 Signed-off-by: Arjan Tijms --- appserver/tests/tck/cdi/cdi-model/pom.xml | 2 +- appserver/tests/tck/cdi/pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/appserver/tests/tck/cdi/cdi-model/pom.xml b/appserver/tests/tck/cdi/cdi-model/pom.xml index 15f3a2b7f2a..ed8de4d6ac7 100644 --- a/appserver/tests/tck/cdi/cdi-model/pom.xml +++ b/appserver/tests/tck/cdi/cdi-model/pom.xml @@ -129,7 +129,7 @@ true - ${glassfish.root}/glassfish7 + ${glassfish.root}/glassfish8 :org.jboss.cdi... diff --git a/appserver/tests/tck/cdi/pom.xml b/appserver/tests/tck/cdi/pom.xml index 3e2209705c0..50d753a84dd 100644 --- a/appserver/tests/tck/cdi/pom.xml +++ b/appserver/tests/tck/cdi/pom.xml @@ -51,7 +51,7 @@ ${project.version} ${project.build.directory} - ${glassfish.root}/glassfish7 + ${glassfish.root}/glassfish8