Skip to content

Commit

Permalink
Merge pull request #24989 from arjantijms/8_0_cdi_4_1_0_tck
Browse files Browse the repository at this point in the history
8 0 cdi 4 1 0 tck
  • Loading branch information
arjantijms authored Jun 16, 2024
2 parents 055a7e3 + d7baeaa commit 7404c24
Show file tree
Hide file tree
Showing 7 changed files with 181 additions and 28 deletions.
42 changes: 22 additions & 20 deletions appserver/tests/tck/cdi/cdi-full/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

<artifactId>glassfish-external-tck-cdi</artifactId>

<name>CDI TCK Full runner 4.0 for Weld (GlassFish)</name>
<name>CDI TCK Full runner 4.1 for Weld (GlassFish)</name>
<description>Aggregates dependencies and runs the CDI TCK on GlassFish</description>

<dependencies>
Expand All @@ -38,6 +38,11 @@
<artifactId>jakarta.enterprise.cdi-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>jakarta.enterprise</groupId>
<artifactId>jakarta.enterprise.cdi-el-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>jakarta.el</groupId>
<artifactId>jakarta.el-api</artifactId>
Expand Down Expand Up @@ -134,7 +139,7 @@
<dependency>
<groupId>jakarta.enterprise</groupId>
<artifactId>cdi-tck-api</artifactId>
<version>${cdi.tck-4-0.version}</version>
<version>${cdi.tck-4-1.version}</version>
<scope>test</scope>
<exclusions>
<exclusion>
Expand All @@ -151,7 +156,7 @@
<dependency>
<groupId>jakarta.enterprise</groupId>
<artifactId>cdi-tck-core-impl</artifactId>
<version>${cdi.tck-4-0.version}</version>
<version>${cdi.tck-4-1.version}</version>
<scope>test</scope>
<exclusions>
<exclusion>
Expand All @@ -161,14 +166,12 @@
</exclusions>
</dependency>

<!--
The TCK Web implementation contains test helper code such as the WebArchiveBuilder,
as well as a large amount of additional tests.
-->
<dependency>
<groupId>jakarta.enterprise</groupId>
<artifactId>cdi-tck-web-impl</artifactId>
<version>${cdi.tck-4-0.version}</version>
<artifactId>cdi-tck-core-impl</artifactId>
<version>${cdi.tck-4-1.version}</version>
<type>xml</type>
<classifier>suite</classifier>
<scope>test</scope>
<exclusions>
<exclusion>
Expand All @@ -178,7 +181,6 @@
</exclusions>
</dependency>


<dependency>
<groupId>org.glassfish.expressly</groupId>
<artifactId>expressly</artifactId>
Expand Down Expand Up @@ -207,7 +209,7 @@
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>7.4.0</version>
<version>7.9.0</version>
<scope>test</scope>
</dependency>
<dependency>
Expand All @@ -226,7 +228,7 @@
<dependency>
<groupId>org.omnifaces.arquillian</groupId>
<artifactId>arquillian-glassfish-server-managed</artifactId>
<version>1.4</version>
<version>1.5</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down Expand Up @@ -271,19 +273,19 @@
<configuration>
<artifactItems>
<!--
Contains what becomes the tck-web-suite.xml; the TestNG suite file that dictates
Contains what becomes the tck-core-suite.xml; the TestNG suite file that dictates
which tests from the TCK Web implementation are executed and which are excluded.
Note that this file is essentially a superset of the suite file from the TCK Core,
so we don't need that one separately here.
-->
<artifactItem>
<groupId>jakarta.enterprise</groupId>
<artifactId>cdi-tck-web-impl</artifactId>
<version>${cdi.tck-4-0.version}</version>
<artifactId>cdi-tck-core-impl</artifactId>
<version>${cdi.tck-4-1.version}</version>
<type>xml</type>
<classifier>suite</classifier>
<overWrite>false</overWrite>
<destFileName>tck-web-suite.xml</destFileName>
<overWrite>false</overWrite>
<destFileName>tck-core-suite.xml</destFileName>
</artifactItem>
</artifactItems>
<outputDirectory>target/suites</outputDirectory>
Expand Down Expand Up @@ -313,7 +315,7 @@
</configuration>
</execution>

<!-- Install a jar with a few amount of test classes, for which some of the tests are looking -->
<!-- Install a jar with a few amount of test classes, for which some of the tests are looking -->
<execution>
<id>install-cdi-tck-ext-lib</id>
<phase>pre-integration-test</phase>
Expand All @@ -325,7 +327,7 @@
<artifactItem>
<groupId>jakarta.enterprise</groupId>
<artifactId>cdi-tck-ext-lib</artifactId>
<version>${cdi.tck-4-0.version}</version>
<version>${cdi.tck-4-1.version}</version>
<type>jar</type>
<overWrite>true</overWrite>
<outputDirectory>${glassfish.root}/glassfish8/glassfish/domains/domain1/lib/applibs</outputDirectory>
Expand All @@ -344,7 +346,7 @@
<!-- Surefire / TestNG Properties -->
<!-- The suite, the exclude and the test dependencies together determine which tests are being run -->
<suiteXmlFiles>
<suiteXmlFile>target/suites/tck-web-suite.xml</suiteXmlFile>
<suiteXmlFile>target/suites/tck-core-suite.xml</suiteXmlFile>
</suiteXmlFiles>
<excludedGroups>${excluded.groups}</excludedGroups>
<dependenciesToScan>
Expand Down
Original file line number Diff line number Diff line change
@@ -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 <T> Inspectable<T> create(T instance, Context context) {
return new InspectableContextual<>(instance);
}

static class InspectableContextual<T> implements Inspectable<T> {

private T instancePassedToConstructor;
private T instancePassedToDestroy;

private CreationalContext<T> creationalContextPassedToCreate;
private CreationalContext<T> creationalContextPassedToDestroy;

InspectableContextual(T instance) {
this.instancePassedToConstructor = instance;
}

@Override
public T create(CreationalContext<T> creationalContext) {
this.creationalContextPassedToCreate = creationalContext;
return instancePassedToConstructor;
}

@Override
public void destroy(T instance, CreationalContext<T> creationalContext) {
instancePassedToDestroy = instance;
creationalContextPassedToDestroy = creationalContext;
}

@Override
public CreationalContext<T> getCreationalContextPassedToCreate() {
return creationalContextPassedToCreate;
}

@Override
public T getInstancePassedToDestroy() {
return instancePassedToDestroy;
}

@Override
public CreationalContext<T> getCreationalContextPassedToDestroy() {
return creationalContextPassedToDestroy;
}
}

}
Original file line number Diff line number Diff line change
@@ -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 <T> Inspectable<T> create(Contextual<T> contextual) {
return new InspectableCreationalContext<>(contextual);
}

static class InspectableCreationalContext<T> extends CreationalContextImpl<T> implements Inspectable<T> {

private T lastBeanPushed;
private boolean pushCalled;
private boolean releaseCalled;

public InspectableCreationalContext(Contextual<T> 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<T> contextual, T instance) {
releaseCalled = true;
super.release(contextual, instance);
}

@Override
public void release() {
releaseCalled = true;
super.release();
}

}

}
Original file line number Diff line number Diff line change
@@ -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
Expand Down
10 changes: 5 additions & 5 deletions appserver/tests/tck/cdi/cdi-model/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.glassfish.main.tests.tck</groupId>
<artifactId>glassfish-external-tck-cdi-parent</artifactId>
Expand Down Expand Up @@ -46,7 +46,7 @@
<dependency>
<groupId>jakarta.enterprise</groupId>
<artifactId>cdi-tck-lang-model</artifactId>
<version>${cdi.tck-4-0.version}</version>
<version>${cdi.tck-4-1.version}</version>
<scope>test</scope>
</dependency>

Expand Down Expand Up @@ -94,7 +94,7 @@
</execution>
</executions>
</plugin>

<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
Expand All @@ -120,7 +120,7 @@
</execution>
</executions>
</plugin>

<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
Expand Down Expand Up @@ -156,7 +156,7 @@
</plugin>
</plugins>
</build>

<profiles>
<profile>
<id>full</id>
Expand Down
2 changes: 1 addition & 1 deletion appserver/tests/tck/cdi/cdi-signature/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
<artifactItem>
<groupId>jakarta.enterprise</groupId>
<artifactId>cdi-tck-core-impl</artifactId>
<version>${cdi.tck-4-0.version}</version>
<version>${cdi.tck-4-1.version}</version>
<type>sig</type>
<classifier>sigtest-jdk11</classifier>
<outputDirectory>${project.build.directory}/sigtest</outputDirectory>
Expand Down
4 changes: 2 additions & 2 deletions appserver/tests/tck/cdi/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,15 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

<cdi.tck-4-0.version>4.0.13</cdi.tck-4-0.version>
<cdi.tck-4-1.version>4.1.0</cdi.tck-4-1.version>

<!-- This matches the htmlunit version in TCK -->
<htmlunit.version>2.50.0</htmlunit.version>
<excluded.groups>se</excluded.groups>

<glassfish.version>${project.version}</glassfish.version>
<glassfish.root>${project.build.directory}</glassfish.root>
<glassfish.home>${glassfish.root}/glassfish7</glassfish.home>
<glassfish.home>${glassfish.root}/glassfish8</glassfish.home>
</properties>

<dependencyManagement>
Expand Down

0 comments on commit 7404c24

Please sign in to comment.