throwableList = ExceptionUtils.getThrowableList(throwable);
+ if (throwableList.size() < 1)
+ return throwable;
+
+ Throwable root = null;
+
+ if (throwableList.size() == 1) {
+ root = throwable;
+ } else {
+ root = ExceptionUtils.getRootCause(throwable);
+ }
+
+ if (root instanceof DeploymentException || root instanceof DefinitionException) {
+ return root;
+ }
+ if (isFragmentFound(DEPLOYMENT_EXCEPTION_FRAGMENTS, root)) {
+ return new DeploymentException(root.getMessage());
+ }
+ if (isFragmentFound(DEFINITION_EXCEPTION_FRAGMENTS, root)) {
+ return new DefinitionException(root.getMessage());
+ }
+ return throwable;
+ }
+
+ private boolean isFragmentFound(String[] fragments, Throwable rootException) {
+ for (String fragment : fragments) {
+ if (rootException.getMessage().contains(fragment)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+}
diff --git a/external/webprofile-tck/cdi/runner/core/src/test/java/org/jboss/weld/tck/piranha/PiranhaExtension.java b/external/webprofile-tck/cdi/runner/core/src/test/java/org/jboss/weld/tck/piranha/PiranhaExtension.java
new file mode 100644
index 0000000000..1c9a897a01
--- /dev/null
+++ b/external/webprofile-tck/cdi/runner/core/src/test/java/org/jboss/weld/tck/piranha/PiranhaExtension.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2002-2024 Manorrock.com. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.jboss.weld.tck.piranha;
+
+import org.jboss.arquillian.container.spi.client.container.DeploymentExceptionTransformer;
+import org.jboss.arquillian.core.spi.LoadableExtension;
+
+/**
+ * Registers the exception transformer to properly identify deployment failures.
+ *
+ */
+public class PiranhaExtension implements LoadableExtension {
+
+ @Override
+ public void register(ExtensionBuilder builder) {
+ builder.service(DeploymentExceptionTransformer.class, PiranhaDeploymentExceptionTransformer.class);
+ }
+
+}
diff --git a/external/webprofile-tck/cdi/runner/core/src/test/java/org/jboss/weld/tck/piranha/WeldBeansImpl.java b/external/webprofile-tck/cdi/runner/core/src/test/java/org/jboss/weld/tck/piranha/WeldBeansImpl.java
new file mode 100644
index 0000000000..fff057443b
--- /dev/null
+++ b/external/webprofile-tck/cdi/runner/core/src/test/java/org/jboss/weld/tck/piranha/WeldBeansImpl.java
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 2024 Manorrock.com. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package org.jboss.weld.tck.piranha;
+
+import java.io.IOException;
+import java.util.Arrays;
+
+import org.jboss.cdi.tck.spi.Beans;
+
+/**
+ * CDI TCK tests use this class as an adapter between the test application and server container.
+ *
+ * Then its implementation can simplify the behavior, ie. explicit passivation, while
+ * in a real application the decision to passivate/activate some object is on the container
+ * and cannot be requested by the application.
+ *
+ * Until GlassFish provides standalone utility to do that, we have to fake
+ * the passivation/activation.
+ *
+ * @author David Matejcek
+ */
+public class WeldBeansImpl implements Beans {
+
+ private Object fakeSerialized;
+
+ @Override
+ public boolean isProxy(Object instance) {
+ return instance.getClass().getName().indexOf("_$$_Weld") > 0;
+ }
+
+ @Override
+ public byte[] passivate(Object instance) throws IOException {
+ fakeSerialized = instance;
+ return instance.toString().getBytes();
+ }
+
+
+ @Override
+ public Object activate(byte[] bytes) throws IOException, ClassNotFoundException {
+ if (Arrays.equals(fakeSerialized.toString().getBytes(), bytes)) {
+ Object result = fakeSerialized;
+ fakeSerialized = null;
+ return result;
+ }
+
+ return null;
+ }
+}
diff --git a/external/webprofile-tck/cdi/runner/core/src/test/java/org/jboss/weld/tck/piranha/WeldContextImpl.java b/external/webprofile-tck/cdi/runner/core/src/test/java/org/jboss/weld/tck/piranha/WeldContextImpl.java
new file mode 100644
index 0000000000..65b6fc1278
--- /dev/null
+++ b/external/webprofile-tck/cdi/runner/core/src/test/java/org/jboss/weld/tck/piranha/WeldContextImpl.java
@@ -0,0 +1,106 @@
+/*
+ * Copyright (c) 2024 Manorrock.com. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package org.jboss.weld.tck.piranha;
+
+import jakarta.enterprise.context.spi.Context;
+import jakarta.enterprise.inject.spi.CDI;
+import jakarta.servlet.ServletContext;
+
+import org.jboss.cdi.tck.spi.Contexts;
+import org.jboss.weld.Container;
+import org.jboss.weld.context.ApplicationContext;
+import org.jboss.weld.context.DependentContext;
+import org.jboss.weld.context.ManagedContext;
+import org.jboss.weld.context.RequestContext;
+import org.jboss.weld.context.http.HttpRequestContext;
+import org.jboss.weld.util.ForwardingContext;
+
+public class WeldContextImpl implements Contexts {
+
+ @Override
+ public void setActive(Context context) {
+ context = ForwardingContext.unwrap(context);
+ if (context instanceof ManagedContext managedContext) {
+ managedContext.activate();
+ } else if (context instanceof ApplicationContext) {
+ // No-op, always active
+ } else {
+ throw new UnsupportedOperationException();
+ }
+ }
+
+ @Override
+ public void setInactive(Context context) {
+ context = ForwardingContext.unwrap(context);
+ if (context instanceof ManagedContext managedContext) {
+ managedContext.deactivate();
+ } else {
+ throw new UnsupportedOperationException();
+ }
+ }
+
+ @Override
+ public RequestContext getRequestContext() {
+ return
+ Container.instance(getContextId())
+ .deploymentManager()
+ .instance()
+ .select(HttpRequestContext.class)
+ .get();
+ }
+
+ @Override
+ public DependentContext getDependentContext() {
+ return
+ Container.instance(getContextId())
+ .deploymentManager().instance()
+ .select(DependentContext.class)
+ .get();
+ }
+
+ @Override
+ public void destroyContext(Context context) {
+ context = ForwardingContext.unwrap(context);
+ if (context instanceof ManagedContext managedContext) {
+ managedContext.invalidate();
+ managedContext.deactivate();
+ managedContext.activate();
+ } else if (context instanceof ApplicationContext applicationContext) {
+ applicationContext.invalidate();
+ } else {
+ throw new UnsupportedOperationException();
+ }
+ }
+
+ private String getContextId() {
+ ServletContext servletContext = CDI.current().select(ServletContext.class).get();
+
+ return servletContext.getInitParameter("WELD_CONTEXT_ID_KEY");
+ }
+}
diff --git a/external/webprofile-tck/cdi/runner/core/src/test/java/org/jboss/weld/tck/piranha/WeldELImpl.java b/external/webprofile-tck/cdi/runner/core/src/test/java/org/jboss/weld/tck/piranha/WeldELImpl.java
new file mode 100644
index 0000000000..3eb86c119d
--- /dev/null
+++ b/external/webprofile-tck/cdi/runner/core/src/test/java/org/jboss/weld/tck/piranha/WeldELImpl.java
@@ -0,0 +1,129 @@
+/*
+ * Copyright (c) 2024 Manorrock.com. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package org.jboss.weld.tck.piranha;
+
+import jakarta.el.ArrayELResolver;
+import jakarta.el.BeanELResolver;
+import jakarta.el.CompositeELResolver;
+import jakarta.el.ELContext;
+import jakarta.el.ELContextEvent;
+import jakarta.el.ELContextListener;
+import jakarta.el.ELResolver;
+import jakarta.el.ExpressionFactory;
+import jakarta.el.FunctionMapper;
+import jakarta.el.ListELResolver;
+import jakarta.el.MapELResolver;
+import jakarta.el.ResourceBundleELResolver;
+import jakarta.el.VariableMapper;
+import jakarta.enterprise.inject.spi.BeanManager;
+
+import org.jboss.cdi.tck.spi.EL;
+import org.jboss.weld.bean.builtin.BeanManagerProxy;
+import org.jboss.weld.manager.BeanManagerImpl;
+import org.jboss.weld.module.web.el.WeldELContextListener;
+import org.jboss.weld.module.web.el.WeldExpressionFactory;
+
+public class WeldELImpl implements EL {
+
+ private static final ExpressionFactory EXPRESSION_FACTORY = new WeldExpressionFactory(ExpressionFactory.newInstance());
+
+ private static final ELContextListener[] EL_CONTEXT_LISTENERS = { new WeldELContextListener() };
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public T evaluateValueExpression(BeanManager beanManager, String expression, Class expectedType) {
+ ELContext elContext = createELContext(beanManager);
+ return (T) EXPRESSION_FACTORY.createValueExpression(elContext, expression, expectedType).getValue(elContext);
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public T evaluateMethodExpression(BeanManager beanManager, String expression, Class expectedType,
+ Class>[] expectedParamTypes, Object[] expectedParams) {
+ ELContext elContext = createELContext(beanManager);
+ return (T) EXPRESSION_FACTORY.createMethodExpression(elContext, expression, expectedType, expectedParamTypes).invoke(
+ elContext, expectedParams);
+ }
+
+ @Override
+ public ELContext createELContext(BeanManager beanManager) {
+ if (beanManager instanceof BeanManagerProxy) {
+ BeanManagerProxy proxy = (BeanManagerProxy) beanManager;
+ beanManager = proxy.delegate();
+ }
+ if (beanManager instanceof BeanManagerImpl) {
+ return createELContext((BeanManagerImpl) beanManager);
+ }
+ throw new IllegalStateException("Wrong manager");
+ }
+
+ private ELContext createELContext(BeanManagerImpl beanManagerImpl) {
+
+ final ELResolver resolver = createELResolver(beanManagerImpl);
+
+ ELContext context = new ELContext() {
+
+ @Override
+ public ELResolver getELResolver() {
+ return resolver;
+ }
+
+ @Override
+ public FunctionMapper getFunctionMapper() {
+ return null;
+ }
+
+ @Override
+ public VariableMapper getVariableMapper() {
+ return null;
+ }
+
+ };
+ callELContextListeners(context);
+ return context;
+ }
+
+ private ELResolver createELResolver(BeanManagerImpl beanManagerImpl) {
+ CompositeELResolver resolver = new CompositeELResolver();
+ resolver.add(beanManagerImpl.getELResolver());
+ resolver.add(new MapELResolver());
+ resolver.add(new ListELResolver());
+ resolver.add(new ArrayELResolver());
+ resolver.add(new ResourceBundleELResolver());
+ resolver.add(new BeanELResolver());
+ return resolver;
+ }
+
+ private void callELContextListeners(ELContext context) {
+ ELContextEvent event = new ELContextEvent(context);
+ for (ELContextListener listener : EL_CONTEXT_LISTENERS) {
+ listener.contextCreated(event);
+ }
+ }
+}
diff --git a/external/webprofile-tck/cdi/runner/core/src/test/resources/META-INF/cdi-tck.properties b/external/webprofile-tck/cdi/runner/core/src/test/resources/META-INF/cdi-tck.properties
new file mode 100644
index 0000000000..4833d3f258
--- /dev/null
+++ b/external/webprofile-tck/cdi/runner/core/src/test/resources/META-INF/cdi-tck.properties
@@ -0,0 +1,4 @@
+org.jboss.cdi.tck.cdiLiteMode=false
+org.jboss.cdi.tck.spi.Beans=org.jboss.weld.tck.piranha.WeldBeansImpl
+org.jboss.cdi.tck.spi.Contexts=org.jboss.weld.tck.piranha.WeldContextImpl
+org.jboss.cdi.tck.spi.EL=org.jboss.weld.tck.piranha.WeldELImpl
diff --git a/external/webprofile-tck/cdi/runner/core/src/test/resources/META-INF/services/org.jboss.arquillian.core.spi.LoadableExtension b/external/webprofile-tck/cdi/runner/core/src/test/resources/META-INF/services/org.jboss.arquillian.core.spi.LoadableExtension
new file mode 100644
index 0000000000..a1b1c306c5
--- /dev/null
+++ b/external/webprofile-tck/cdi/runner/core/src/test/resources/META-INF/services/org.jboss.arquillian.core.spi.LoadableExtension
@@ -0,0 +1 @@
+org.jboss.weld.tck.piranha.PiranhaExtension
\ No newline at end of file
diff --git a/external/webprofile-tck/cdi/runner/core/src/test/resources/arquillian.xml b/external/webprofile-tck/cdi/runner/core/src/test/resources/arquillian.xml
new file mode 100644
index 0000000000..16507cd026
--- /dev/null
+++ b/external/webprofile-tck/cdi/runner/core/src/test/resources/arquillian.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/external/webprofile-tck/cdi/runner/pom.xml b/external/webprofile-tck/cdi/runner/pom.xml
new file mode 100644
index 0000000000..0472f78d53
--- /dev/null
+++ b/external/webprofile-tck/cdi/runner/pom.xml
@@ -0,0 +1,22 @@
+
+
+
+ 4.0.0
+
+
+ cloud.piranha.external.webprofiletck.cditck
+ project
+ 24.10.0-SNAPSHOT
+
+
+ cloud.piranha.external.webprofiletck.cditck.runner
+ project
+ pom
+
+ Piranha Web Profile - CDI TCK - Runner - Project
+
+
+ core
+ signature
+
+
diff --git a/external/webprofile-tck/cdi/runner/signature/pom.xml b/external/webprofile-tck/cdi/runner/signature/pom.xml
new file mode 100644
index 0000000000..ad754535ea
--- /dev/null
+++ b/external/webprofile-tck/cdi/runner/signature/pom.xml
@@ -0,0 +1,111 @@
+
+
+
+ 4.0.0
+
+
+ cloud.piranha.external.webprofiletck.cditck.runner
+ project
+ 24.10.0-SNAPSHOT
+
+
+ signature
+
+ Piranha Web Profile - CDI TCK - Runner - Signature
+ Aggregates dependencies and runs the CDI Signature TCK on Piranha
+
+
+ ${project.version}
+ ${project.build.directory}/piranha
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-dependency-plugin
+
+
+ copy-cdi-sigtest
+ process-resources
+
+ copy
+
+
+
+
+
+ jakarta.enterprise
+ cdi-tck-core-impl
+ 4.0.13
+ sig
+ sigtest-jdk11
+ ${project.build.directory}/sigtest
+
+
+ true
+ true
+
+
+
+
+ unpack-piranha
+ process-test-resources
+
+ unpack
+
+
+ ${piranha.root}/dependency-maven-plugin-markers
+
+
+ cloud.piranha.dist
+ piranha-dist-webprofile
+ ${piranha.version}
+ jar
+ false
+ target/cdi-sigtest-classes
+
+
+
+
+
+
+
+
+ jakarta.tck
+ sigtest-maven-plugin
+
+
+ sigtest
+ verify
+
+ check
+
+
+
+
+ target/sigtest/cdi-tck-core-impl-sigtest-jdk11.sig
+ jakarta.decorator,jakarta.enterprise.**,jakarta.interceptor
+ target/cdi-sigtest-classes
+ target/cdi-sig-report.txt
+
+
+
+
+
diff --git a/external/webprofile-tck/pom.xml b/external/webprofile-tck/pom.xml
index 70bdbd0820..760a5f9501 100644
--- a/external/webprofile-tck/pom.xml
+++ b/external/webprofile-tck/pom.xml
@@ -17,9 +17,11 @@
Piranha - External - Web Profile TCK - Project
2.0.2
+ 4.0.13
atinject
+ cdi
jsonb
jsonp