Skip to content

Commit

Permalink
TCK Tracking: Jakarta EE 10 Core Profile helidon-io#6799
Browse files Browse the repository at this point in the history
Signed-off-by: Jorge Bescos Gascon <[email protected]>
  • Loading branch information
jbescos committed Jun 5, 2023
1 parent 036d073 commit 2d434af
Show file tree
Hide file tree
Showing 46 changed files with 1,446 additions and 40 deletions.
18 changes: 18 additions & 0 deletions dependencies/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,9 @@
<version.lib.micronaut.sql>4.4.0</version.lib.micronaut.sql>
<!-- FIXME upgrade to 3.1 when it is released in Maven -->
<version.lib.microprofile-config>3.0.1</version.lib.microprofile-config>
<version.lib.microprofile-core-profile>10.0.1</version.lib.microprofile-core-profile>
<version.lib.microprofile-cdi-tck>4.1.0.Alpha3</version.lib.microprofile-cdi-tck>
<version.lib.microprofile-restfull-tck>3.1.2</version.lib.microprofile-restfull-tck>
<!-- FIXME upgrade to 4.1 when it is released in Maven -->
<version.lib.microprofile-fault-tolerance-api>4.0</version.lib.microprofile-fault-tolerance-api>
<version.lib.microprofile-graphql>2.0</version.lib.microprofile-graphql>
Expand Down Expand Up @@ -680,6 +683,21 @@
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>jakarta.ee.tck.coreprofile</groupId>
<artifactId>core-profile-tck-impl</artifactId>
<version>${version.lib.microprofile-core-profile}</version>
</dependency>
<dependency>
<groupId>jakarta.enterprise</groupId>
<artifactId>cdi-tck-core-impl</artifactId>
<version>${version.lib.microprofile-cdi-tck}</version>
</dependency>
<dependency>
<groupId>jakarta.ws.rs</groupId>
<artifactId>jakarta-restful-ws-tck</artifactId>
<version>${version.lib.microprofile-restfull-tck}</version>
</dependency>
<dependency>
<groupId>org.eclipse.microprofile.opentracing</groupId>
<artifactId>microprofile-opentracing-api</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
* <li>A temporary directory is created</li>
* <li>The WebArchive contents are written to the temporary directory</li>
* <li>beans.xml is created in WEB-INF/classes if not present</li>
* <li>WEB-INF/beans.xml will be moved to WEB-INF/classes/META-INF if present</li>
* <li>The server is started with WEB-INF/classes and all libraries in WEB-INF/libon the classpath.</li>
* </ol>
*
Expand Down Expand Up @@ -180,14 +181,14 @@ public ProtocolMetaData deploy(Archive<?> archive) throws DeploymentException {

Path rootDir = context.deployDir.resolve("");
if (isJavaArchive) {
ensureBeansXml(rootDir);
ensureBeansXml(rootDir, null);
classPath.add(rootDir);
} else {
// Prepare the launcher files
Path webInfDir = context.deployDir.resolve("WEB-INF");
Path classesDir = webInfDir.resolve("classes");
Path libDir = webInfDir.resolve("lib");
ensureBeansXml(classesDir);
ensureBeansXml(classesDir, webInfDir);
addServerClasspath(classPath, classesDir, libDir, rootDir);
}

Expand Down Expand Up @@ -376,7 +377,15 @@ void addServerClasspath(List<Path> classpath, Path classesDir, Path libDir, Path
classpath.add(rootDir);
}

private void ensureBeansXml(Path classesDir) throws IOException {
private void ensureBeansXml(Path classesDir, Path webinfDir) throws IOException {
if (webinfDir != null) {
// In case exists WEB-INF/beans.xml, then move it to classes/META-INF/beans.xml
Path beansPath = webinfDir.resolve("beans.xml");
if (Files.exists(beansPath)) {
Files.move(beansPath, classesDir.resolve("META-INF/beans.xml"));
return;
}
}
Path beansPath = classesDir.resolve("META-INF/beans.xml");
if (Files.exists(beansPath)) {
return;
Expand Down Expand Up @@ -576,8 +585,10 @@ public Enumeration<URL> getResources(String name) throws IOException {
}
}
}

return Collections.enumeration(result);
// Give priority to WebApp resources (for example ServiceLoader provided by WebApp)
List<URL> toRevert = new ArrayList<URL>(result);
Collections.reverse(toRevert);
return Collections.enumeration(toRevert);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2018, 2022 Oracle and/or its affiliates.
Copyright (c) 2018, 2023 Oracle and/or its affiliates.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand All @@ -19,8 +19,8 @@
<beans xmlns="https://jakarta.ee/xml/ns/jakartaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee
https://jakarta.ee/xml/ns/jakartaee/beans_3_0.xsd"
version="3.0"
https://jakarta.ee/xml/ns/jakartaee/beans_4_0.xsd"
version="4.0"
bean-discovery-mode="all">
</beans>

36 changes: 6 additions & 30 deletions microprofile/tests/tck/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@
<module>tck-reactive-operators</module>
<module>tck-lra</module>
<module>tck-telemetry</module>
<module>tck-core-profile</module>
<module>tck-cdi</module>
<module>tck-restfull</module>
<module>tck-jsonb</module>
<module>tck-jsonp</module>
<module>tck-inject</module>
</modules>

<properties>
Expand All @@ -53,36 +59,6 @@
</properties>



<dependencies>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<argLine>--enable-preview</argLine>
</configuration>
<dependencies>
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-testng</artifactId>
<version>${version.plugin.surefire}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</pluginManagement>
</build>

<profiles>
<profile>
<id>tck-ft</id>
Expand Down
63 changes: 63 additions & 0 deletions microprofile/tests/tck/tck-cdi/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2023 Oracle and/or its affiliates.
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.
-->

<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>tck-project</artifactId>
<groupId>io.helidon.microprofile.tests</groupId>
<version>4.0.0-SNAPSHOT</version>
</parent>
<artifactId>tck-cdi</artifactId>
<name>Helidon Microprofile Tests TCK CDI</name>

<dependencies>
<dependency>
<groupId>io.helidon.microprofile.tests</groupId>
<artifactId>helidon-arquillian</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>jakarta.enterprise</groupId>
<artifactId>cdi-tck-core-impl</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<forkCount>1</forkCount>
<suiteXmlFiles>
<suiteXmlFile>tck-suite.xml</suiteXmlFile>
</suiteXmlFiles>
</configuration>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
* Copyright (c) 2023 Oracle and/or its affiliates.
*
* 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 io.helidon.microprofile.cdi.tck;

import org.jboss.arquillian.container.test.impl.enricher.resource.URLResourceProvider;
import org.jboss.arquillian.core.spi.LoadableExtension;
import org.jboss.arquillian.test.spi.enricher.resource.ResourceProvider;

/**
* LoadableExtension tht will load UrlResourceProvider.
*/
public class UrlLoaderExtension implements LoadableExtension {
@Override
public void register(ExtensionBuilder extensionBuilder) {
extensionBuilder.override(ResourceProvider.class, URLResourceProvider.class, UrlResourceProvider.class);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
* Copyright (c) 2023 Oracle and/or its affiliates.
*
* 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 io.helidon.microprofile.cdi.tck;

import java.lang.annotation.Annotation;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URL;

import org.jboss.arquillian.test.api.ArquillianResource;
import org.jboss.arquillian.test.spi.enricher.resource.ResourceProvider;

/**
* TCKs use addition when creating URL for a client. The default Arquillian implementation returns url without the trailing
* /.
*/
public class UrlResourceProvider implements ResourceProvider {
@Override
public Object lookup(ArquillianResource arquillianResource, Annotation... annotations) {
try {
return URI.create("http://localhost:8080/").toURL();
} catch (MalformedURLException e) {
return null;
}
}

@Override
public boolean canProvide(Class<?> type) {
return URL.class.isAssignableFrom(type);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2023 Oracle and/or its affiliates.
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.
-->
<beans xmlns="https://jakarta.ee/xml/ns/jakartaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee
https://jakarta.ee/xml/ns/jakartaee/beans_4_0.xsd"
version="4.0"
bean-discovery-mode="annotated">
</beans>
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#
# Copyright (c) 2023 Oracle and/or its affiliates.
#
# 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.
#

io.helidon.microprofile.cdi.tck.UrlLoaderExtension

19 changes: 19 additions & 0 deletions microprofile/tests/tck/tck-cdi/src/test/resources/application.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#
# Copyright (c) 2023 Oracle and/or its affiliates.
#
# 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.
#

mp:
initializer:
allow: true
29 changes: 29 additions & 0 deletions microprofile/tests/tck/tck-cdi/src/test/resources/arquillian.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2023 Oracle and/or its affiliates.
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.
-->
<arquillian xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://jboss.org/schema/arquillian"
xsi:schemaLocation="
http://jboss.org/schema/arquillian
http://jboss.org/schema/arquillian/arquillian_1_0.xsd">

<engine>
<property name="deploymentExportPath">target/deployments</property>
<property name="port">8080</property>
</engine>
</arquillian>
Loading

0 comments on commit 2d434af

Please sign in to comment.