diff --git a/dependencies/pom.xml b/dependencies/pom.xml index daf44905686..dfa7d950662 100644 --- a/dependencies/pom.xml +++ b/dependencies/pom.xml @@ -105,6 +105,9 @@ 4.4.0 3.0.1 + 10.0.1 + 4.1.0.Alpha3 + 3.1.2 4.0 2.0 @@ -680,6 +683,21 @@ + + jakarta.ee.tck.coreprofile + core-profile-tck-impl + ${version.lib.microprofile-core-profile} + + + jakarta.enterprise + cdi-tck-core-impl + ${version.lib.microprofile-cdi-tck} + + + jakarta.ws.rs + jakarta-restful-ws-tck + ${version.lib.microprofile-restfull-tck} + org.eclipse.microprofile.opentracing microprofile-opentracing-api diff --git a/microprofile/tests/arquillian/src/main/java/io/helidon/microprofile/arquillian/HelidonDeployableContainer.java b/microprofile/tests/arquillian/src/main/java/io/helidon/microprofile/arquillian/HelidonDeployableContainer.java index 4bf4dfd2788..d758717e98d 100644 --- a/microprofile/tests/arquillian/src/main/java/io/helidon/microprofile/arquillian/HelidonDeployableContainer.java +++ b/microprofile/tests/arquillian/src/main/java/io/helidon/microprofile/arquillian/HelidonDeployableContainer.java @@ -576,8 +576,10 @@ public Enumeration getResources(String name) throws IOException { } } } - - return Collections.enumeration(result); + // Give priority to WebApp resources (for example ServiceLoader provided by WebApp) + List toRevert = new ArrayList(result); + Collections.reverse(toRevert); + return Collections.enumeration(toRevert); } @Override diff --git a/microprofile/tests/arquillian/src/main/resources/templates/beans.xml b/microprofile/tests/arquillian/src/main/resources/templates/beans.xml index 08e4a6696fb..7a12579eb75 100644 --- a/microprofile/tests/arquillian/src/main/resources/templates/beans.xml +++ b/microprofile/tests/arquillian/src/main/resources/templates/beans.xml @@ -1,7 +1,7 @@ + + + 4.0.0 + + tck-project + io.helidon.microprofile.tests + 4.0.0-SNAPSHOT + + tck-cdi + Helidon Microprofile Tests TCK CDI + + + + io.helidon.microprofile.tests + helidon-arquillian + ${project.version} + test + + + jakarta.enterprise + cdi-tck-core-impl + test + + + org.testng + testng + test + + + + + + + org.apache.maven.plugins + maven-surefire-plugin + + 1 + + tck-suite.xml + + + + + + diff --git a/microprofile/tests/tck/tck-cdi/src/test/java/io/helidon/microprofile/cdi/tck/UrlLoaderExtension.java b/microprofile/tests/tck/tck-cdi/src/test/java/io/helidon/microprofile/cdi/tck/UrlLoaderExtension.java new file mode 100644 index 00000000000..39105a3bc5e --- /dev/null +++ b/microprofile/tests/tck/tck-cdi/src/test/java/io/helidon/microprofile/cdi/tck/UrlLoaderExtension.java @@ -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); + } +} diff --git a/microprofile/tests/tck/tck-cdi/src/test/java/io/helidon/microprofile/cdi/tck/UrlResourceProvider.java b/microprofile/tests/tck/tck-cdi/src/test/java/io/helidon/microprofile/cdi/tck/UrlResourceProvider.java new file mode 100644 index 00000000000..dbd9834999c --- /dev/null +++ b/microprofile/tests/tck/tck-cdi/src/test/java/io/helidon/microprofile/cdi/tck/UrlResourceProvider.java @@ -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); + } +} diff --git a/microprofile/tests/tck/tck-cdi/src/test/resources/META-INF/beans.xml b/microprofile/tests/tck/tck-cdi/src/test/resources/META-INF/beans.xml new file mode 100644 index 00000000000..8b91810cea1 --- /dev/null +++ b/microprofile/tests/tck/tck-cdi/src/test/resources/META-INF/beans.xml @@ -0,0 +1,25 @@ + + + + diff --git a/microprofile/tests/tck/tck-cdi/src/test/resources/META-INF/services/org.jboss.arquillian.core.spi.LoadableExtension b/microprofile/tests/tck/tck-cdi/src/test/resources/META-INF/services/org.jboss.arquillian.core.spi.LoadableExtension new file mode 100644 index 00000000000..910053e9d23 --- /dev/null +++ b/microprofile/tests/tck/tck-cdi/src/test/resources/META-INF/services/org.jboss.arquillian.core.spi.LoadableExtension @@ -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 + diff --git a/microprofile/tests/tck/tck-cdi/src/test/resources/application.yaml b/microprofile/tests/tck/tck-cdi/src/test/resources/application.yaml new file mode 100644 index 00000000000..27189276ed8 --- /dev/null +++ b/microprofile/tests/tck/tck-cdi/src/test/resources/application.yaml @@ -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 diff --git a/microprofile/tests/tck/tck-cdi/src/test/resources/arquillian.xml b/microprofile/tests/tck/tck-cdi/src/test/resources/arquillian.xml new file mode 100644 index 00000000000..aa97a9f3e63 --- /dev/null +++ b/microprofile/tests/tck/tck-cdi/src/test/resources/arquillian.xml @@ -0,0 +1,29 @@ + + + + + + target/deployments + 8080 + + \ No newline at end of file diff --git a/microprofile/tests/tck/tck-cdi/tck-suite.xml b/microprofile/tests/tck/tck-cdi/tck-suite.xml new file mode 100644 index 00000000000..31ee46d557e --- /dev/null +++ b/microprofile/tests/tck/tck-cdi/tck-suite.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/microprofile/tests/tck/tck-core-profile/pom.xml b/microprofile/tests/tck/tck-core-profile/pom.xml new file mode 100644 index 00000000000..f876ec376f7 --- /dev/null +++ b/microprofile/tests/tck/tck-core-profile/pom.xml @@ -0,0 +1,72 @@ + + + + + 4.0.0 + + io.helidon.microprofile.tests + tck-project + 4.0.0-SNAPSHOT + + tck-core-profile + Helidon Microprofile Tests TCK Core Profile + + + + io.helidon.microprofile.tests + helidon-arquillian + ${project.version} + test + + + org.jboss.arquillian.junit + arquillian-junit-container + test + + + jakarta.ee.tck.coreprofile + core-profile-tck-impl + test + + + org.junit.jupiter + junit-jupiter-engine + test + + + + + + + org.apache.maven.plugins + maven-surefire-plugin + + + jakarta.ee.tck.coreprofile:core-profile-tck-impl + + + *IT.java + + + + + + diff --git a/microprofile/tests/tck/tck-core-profile/src/test/java/io/helidon/microprofile/coreprofile/tck/UrlLoaderExtension.java b/microprofile/tests/tck/tck-core-profile/src/test/java/io/helidon/microprofile/coreprofile/tck/UrlLoaderExtension.java new file mode 100644 index 00000000000..da589938f7c --- /dev/null +++ b/microprofile/tests/tck/tck-core-profile/src/test/java/io/helidon/microprofile/coreprofile/tck/UrlLoaderExtension.java @@ -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.coreprofile.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); + } +} diff --git a/microprofile/tests/tck/tck-core-profile/src/test/java/io/helidon/microprofile/coreprofile/tck/UrlResourceProvider.java b/microprofile/tests/tck/tck-core-profile/src/test/java/io/helidon/microprofile/coreprofile/tck/UrlResourceProvider.java new file mode 100644 index 00000000000..caa6063da0c --- /dev/null +++ b/microprofile/tests/tck/tck-core-profile/src/test/java/io/helidon/microprofile/coreprofile/tck/UrlResourceProvider.java @@ -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.coreprofile.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); + } +} diff --git a/microprofile/tests/tck/tck-core-profile/src/test/resources/META-INF/services/org.jboss.arquillian.core.spi.LoadableExtension b/microprofile/tests/tck/tck-core-profile/src/test/resources/META-INF/services/org.jboss.arquillian.core.spi.LoadableExtension new file mode 100644 index 00000000000..1f291ae7977 --- /dev/null +++ b/microprofile/tests/tck/tck-core-profile/src/test/resources/META-INF/services/org.jboss.arquillian.core.spi.LoadableExtension @@ -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.coreprofile.tck.UrlLoaderExtension + diff --git a/microprofile/tests/tck/tck-core-profile/src/test/resources/arquillian.xml b/microprofile/tests/tck/tck-core-profile/src/test/resources/arquillian.xml new file mode 100644 index 00000000000..6f8e7919098 --- /dev/null +++ b/microprofile/tests/tck/tck-core-profile/src/test/resources/arquillian.xml @@ -0,0 +1,28 @@ + + + + + + target/deployments + + \ No newline at end of file diff --git a/microprofile/tests/tck/tck-core-profile/src/test/resources/logging-test.properties b/microprofile/tests/tck/tck-core-profile/src/test/resources/logging-test.properties new file mode 100644 index 00000000000..15b033aaa6e --- /dev/null +++ b/microprofile/tests/tck/tck-core-profile/src/test/resources/logging-test.properties @@ -0,0 +1,24 @@ +# +# 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. +# +handlers=java.util.logging.ConsoleHandler +java.util.logging.ConsoleHandler.level=FINEST +java.util.logging.ConsoleHandler.formatter=java.util.logging.SimpleFormatter +java.util.logging.SimpleFormatter.format=%1$tH:%1$tM:%1$tS %4$s %3$s %5$s%6$s%n +# Global logging level. Can be overridden by specific loggers +.level=INFO +io.helidon.nima.level=INFO +io.helidon.nima.webserver.http.Http1Connection.level=INFO +io.helidon.nima.webserver.http.HttpRouting.level=INFO diff --git a/microprofile/tests/tck/tck-graphql/pom.xml b/microprofile/tests/tck/tck-graphql/pom.xml index 5d45a9caccd..65c11d7d434 100644 --- a/microprofile/tests/tck/tck-graphql/pom.xml +++ b/microprofile/tests/tck/tck-graphql/pom.xml @@ -62,6 +62,11 @@ jakarta.xml.bind-api test + + org.testng + testng + test + diff --git a/microprofile/tests/tck/tck-health/pom.xml b/microprofile/tests/tck/tck-health/pom.xml index cf950bf802b..d015c632c6d 100644 --- a/microprofile/tests/tck/tck-health/pom.xml +++ b/microprofile/tests/tck/tck-health/pom.xml @@ -56,6 +56,11 @@ com.google.guava guava + + org.testng + testng + test + diff --git a/microprofile/tests/tck/tck-inject/artifact-install.sh b/microprofile/tests/tck/tck-inject/artifact-install.sh new file mode 100755 index 00000000000..0642943fb3b --- /dev/null +++ b/microprofile/tests/tck/tck-inject/artifact-install.sh @@ -0,0 +1,25 @@ +#!/usr/bin/env bash +# +# Copyright (c) 2023 Oracle and/or its affiliates. All rights reserved. +# +# 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 +# + +##script to install the artifact directory contents into a local maven repository + +VERSION="$1" + +# jar +mvn org.apache.maven.plugins:maven-install-plugin:3.0.0-M1:install-file \ +-Dfile=target/jakarta.inject-tck-${VERSION}/jakarta.inject-tck-${VERSION}.jar -DgroupId=jakarta.inject \ +-DartifactId=jakarta.inject-tck -Dversion="$VERSION" -Dpackaging=jar diff --git a/microprofile/tests/tck/tck-inject/pom.xml b/microprofile/tests/tck/tck-inject/pom.xml new file mode 100644 index 00000000000..1467afddd8f --- /dev/null +++ b/microprofile/tests/tck/tck-inject/pom.xml @@ -0,0 +1,63 @@ + + + + + 4.0.0 + + io.helidon.microprofile.tests + tck-project + 4.0.0-SNAPSHOT + + pom + tck-inject + Helidon Microprofile Tests TCK Inject + + + tck-inject-test + + + + + + maven-antrun-plugin + + + validate + + run + + + + + + + + + + + + + + + + + + diff --git a/microprofile/tests/tck/tck-inject/tck-inject-test/pom.xml b/microprofile/tests/tck/tck-inject/tck-inject-test/pom.xml new file mode 100644 index 00000000000..a3568c7d1ea --- /dev/null +++ b/microprofile/tests/tck/tck-inject/tck-inject-test/pom.xml @@ -0,0 +1,70 @@ + + + + + 4.0.0 + + io.helidon.microprofile.tests + tck-inject + 4.0.0-SNAPSHOT + + tck-inject-tests + Helidon Microprofile Tests TCK Inject + + + + org.junit.jupiter + junit-jupiter-engine + test + + + io.helidon.microprofile.weld + weld-se-core + test + + + io.helidon.microprofile.bundles + helidon-microprofile + test + + + jakarta.inject + jakarta.inject-tck + 2.0.2 + test + + + + + + + maven-antrun-plugin + + true + + + + org.apache.maven.plugins + maven-surefire-plugin + + + + diff --git a/microprofile/tests/tck/tck-inject/tck-inject-test/src/test/java/io/helidon/microprofile/tests/inject/AtInjectTCKExtension.java b/microprofile/tests/tck/tck-inject/tck-inject-test/src/test/java/io/helidon/microprofile/tests/inject/AtInjectTCKExtension.java new file mode 100644 index 00000000000..d915c4b92c6 --- /dev/null +++ b/microprofile/tests/tck/tck-inject/tck-inject-test/src/test/java/io/helidon/microprofile/tests/inject/AtInjectTCKExtension.java @@ -0,0 +1,72 @@ +/* + * Copyright 2021, Red Hat, Inc., and individual contributors + * by the @authors tag. See the copyright.txt in the distribution for a + * full listing of 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 io.helidon.microprofile.tests.inject; + +import org.atinject.tck.auto.Convertible; +import org.atinject.tck.auto.Drivers; +import org.atinject.tck.auto.DriversSeat; +import org.atinject.tck.auto.accessories.SpareTire; +import org.jboss.weld.literal.NamedLiteral; + +import jakarta.enterprise.event.Observes; +import jakarta.enterprise.inject.spi.Extension; +import jakarta.enterprise.inject.spi.ProcessAnnotatedType; +import jakarta.enterprise.util.AnnotationLiteral; +import jakarta.inject.Qualifier; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; + +public class AtInjectTCKExtension implements Extension { + public void convertible(@Observes ProcessAnnotatedType pat) { + pat.configureAnnotatedType() + .filterFields(field -> "spareTire".equals(field.getJavaMember().getName())) + // add @Spare to the injection point, because the bean doesn't have @Default; see also below + .forEach(field -> {field.add(SpareLiteral.INSTANCE); System.out.printf("Added @Spare to %s\n", field.getAnnotated());}); + } + + public void driversSeat(@Observes ProcessAnnotatedType pat) { + pat.configureAnnotatedType() + .add(DriversLiteral.INSTANCE); + System.out.printf("Added @Drivers to: %s\n", pat.getAnnotatedType()); + } + + public void spareTire(@Observes ProcessAnnotatedType pat) { + pat.configureAnnotatedType() + .add(new NamedLiteral("spare")) + // add @Spare to prevent adding @Default, otherwise there would be 2 beans for the Tire type + .add(SpareLiteral.INSTANCE); + System.out.printf("Added @Named('spare') to: %s\n", pat.getAnnotatedType()); + } + + static final class DriversLiteral extends AnnotationLiteral implements Drivers { + static final DriversLiteral INSTANCE = new DriversLiteral(); + + private DriversLiteral() { + } + } + + @Qualifier + @Retention(RetentionPolicy.RUNTIME) + @interface Spare { + } + + static final class SpareLiteral extends AnnotationLiteral implements Spare { + static final SpareLiteral INSTANCE = new SpareLiteral(); + + private SpareLiteral() { + } + } +} diff --git a/microprofile/tests/tck/tck-inject/tck-inject-test/src/test/java/io/helidon/microprofile/tests/inject/InjectTest.java b/microprofile/tests/tck/tck-inject/tck-inject-test/src/test/java/io/helidon/microprofile/tests/inject/InjectTest.java new file mode 100644 index 00000000000..d097c0abe73 --- /dev/null +++ b/microprofile/tests/tck/tck-inject/tck-inject-test/src/test/java/io/helidon/microprofile/tests/inject/InjectTest.java @@ -0,0 +1,28 @@ +/* + * 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.tests.inject; + +import org.junit.jupiter.api.Test; + +class InjectTest { + + @Test + public void test() { + junit.framework.Test test = SampleBootstrapTCK.suite(); + } + +} diff --git a/microprofile/tests/tck/tck-inject/tck-inject-test/src/test/java/io/helidon/microprofile/tests/inject/SampleBootstrapTCK.java b/microprofile/tests/tck/tck-inject/tck-inject-test/src/test/java/io/helidon/microprofile/tests/inject/SampleBootstrapTCK.java new file mode 100644 index 00000000000..274ae805431 --- /dev/null +++ b/microprofile/tests/tck/tck-inject/tck-inject-test/src/test/java/io/helidon/microprofile/tests/inject/SampleBootstrapTCK.java @@ -0,0 +1,37 @@ +/* + * Copyright 2021, Red Hat, Inc., and individual contributors + * by the @authors tag. See the copyright.txt in the distribution for a + * full listing of 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 io.helidon.microprofile.tests.inject; + +import junit.framework.Test; +import org.atinject.tck.Tck; +import org.atinject.tck.auto.Car; + +import jakarta.enterprise.inject.se.SeContainer; +import jakarta.enterprise.inject.se.SeContainerInitializer; + +public class SampleBootstrapTCK { + + public static Test suite() { + + SeContainer container = SeContainerInitializer + .newInstance() + .addExtensions(AtInjectTCKExtension.class) + .addPackages(true, Tck.class) + .initialize(); + Car tckCar = container.select(Car.class).get(); + return Tck.testsFor(tckCar, false, true); + } +} diff --git a/microprofile/tests/tck/tck-inject/tck-inject-test/src/test/resources/META-INF/services/jakarta.enterprise.inject.se.SeContainerInitializer b/microprofile/tests/tck/tck-inject/tck-inject-test/src/test/resources/META-INF/services/jakarta.enterprise.inject.se.SeContainerInitializer new file mode 100644 index 00000000000..7cc1fef67c7 --- /dev/null +++ b/microprofile/tests/tck/tck-inject/tck-inject-test/src/test/resources/META-INF/services/jakarta.enterprise.inject.se.SeContainerInitializer @@ -0,0 +1 @@ +io.helidon.microprofile.cdi.HelidonContainerInitializer \ No newline at end of file diff --git a/microprofile/tests/tck/tck-inject/tck-inject-test/src/test/resources/application.yaml b/microprofile/tests/tck/tck-inject/tck-inject-test/src/test/resources/application.yaml new file mode 100644 index 00000000000..17e1772976b --- /dev/null +++ b/microprofile/tests/tck/tck-inject/tck-inject-test/src/test/resources/application.yaml @@ -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 \ No newline at end of file diff --git a/microprofile/tests/tck/tck-jsonb/pom.xml b/microprofile/tests/tck/tck-jsonb/pom.xml new file mode 100644 index 00000000000..c82a720d356 --- /dev/null +++ b/microprofile/tests/tck/tck-jsonb/pom.xml @@ -0,0 +1,63 @@ + + + + + 4.0.0 + + io.helidon.microprofile.tests + tck-project + 4.0.0-SNAPSHOT + + pom + tck-jsonb + Helidon Microprofile Tests TCK JSONB + + + tck-jsonb-test + + + + + + maven-antrun-plugin + + + validate + + run + + + + + + + + + + + + + + + + + + diff --git a/microprofile/tests/tck/tck-jsonb/tck-jsonb-test/pom.xml b/microprofile/tests/tck/tck-jsonb/tck-jsonb-test/pom.xml new file mode 100644 index 00000000000..2fdb06b9046 --- /dev/null +++ b/microprofile/tests/tck/tck-jsonb/tck-jsonb-test/pom.xml @@ -0,0 +1,73 @@ + + + + + 4.0.0 + + io.helidon.microprofile.tests + tck-jsonb + 4.0.0-SNAPSHOT + + tck-jsonb-tests + Helidon Microprofile Tests TCK JSONB + + + + org.junit.jupiter + junit-jupiter-engine + test + + + io.helidon.microprofile.bundles + helidon-microprofile + test + + + jakarta.json.bind + jakarta.json.bind-tck + 3.0.0 + test + + + + + + + maven-antrun-plugin + + true + + + + org.apache.maven.plugins + maven-surefire-plugin + + + jakarta.json.bind:jakarta.json.bind-tck + + + *Test.java + + + + + + diff --git a/microprofile/tests/tck/tck-jsonp/artifact-install.sh b/microprofile/tests/tck/tck-jsonp/artifact-install.sh new file mode 100755 index 00000000000..5646df0b9ab --- /dev/null +++ b/microprofile/tests/tck/tck-jsonp/artifact-install.sh @@ -0,0 +1,70 @@ +#!/usr/bin/env bash +# +# Copyright (c) 2023 Oracle and/or its affiliates. All rights reserved. +# +# 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 +# + +##script to install the artifact directory contents into a local maven repository + +VERSION="$1" + +# Parent pom +mvn org.apache.maven.plugins:maven-install-plugin:3.0.0-M1:install-file \ +-Dfile=jakarta.json-tck-"$VERSION".pom -DgroupId=jakarta.json \ +-DartifactId=jakarta.json-tck -Dversion="$VERSION" -Dpackaging=pom + +# pom +mvn org.apache.maven.plugins:maven-install-plugin:3.0.0-M1:install-file \ +-Dfile=jakarta.json-tck-common-"$VERSION".pom -DgroupId=jakarta.json \ +-DartifactId=jakarta.json-tck-common -Dversion="$VERSION" -Dpackaging=pom + +# jar +mvn org.apache.maven.plugins:maven-install-plugin:3.0.0-M1:install-file \ +-Dfile=jakarta.json-tck-common-"$VERSION".jar -DgroupId=jakarta.json \ +-DartifactId=jakarta.json-tck-common -Dversion="$VERSION" -Dpackaging=jar + +# sources jar +mvn org.apache.maven.plugins:maven-install-plugin:3.0.0-M1:install-file \ +-Dfile=jakarta.json-tck-common-"$VERSION"-sources.jar -DgroupId=jakarta.json \ +-DartifactId=jakarta.json-tck-common-sources -Dversion="$VERSION" -Dpackaging=jar + +# pom +mvn org.apache.maven.plugins:maven-install-plugin:3.0.0-M1:install-file \ +-Dfile=jakarta.json-tck-tests-"$VERSION".pom -DgroupId=jakarta.json \ +-DartifactId=jakarta.json-tck-tests -Dversion="$VERSION" -Dpackaging=pom + +# jar +mvn org.apache.maven.plugins:maven-install-plugin:3.0.0-M1:install-file \ +-Dfile=jakarta.json-tck-tests-"$VERSION".jar -DgroupId=jakarta.json \ +-DartifactId=jakarta.json-tck-tests -Dversion="$VERSION" -Dpackaging=jar + +# sources jar +mvn org.apache.maven.plugins:maven-install-plugin:3.0.0-M1:install-file \ +-Dfile=jakarta.json-tck-tests-"$VERSION"-sources.jar -DgroupId=jakarta.json \ +-DartifactId=jakarta.json-tck-tests-sources -Dversion="$VERSION" -Dpackaging=jar + +# pom +mvn org.apache.maven.plugins:maven-install-plugin:3.0.0-M1:install-file \ +-Dfile=jakarta.json-tck-tests-pluggability-"$VERSION".pom -DgroupId=jakarta.json \ +-DartifactId=jakarta.json-tck-tests-pluggability -Dversion="$VERSION" -Dpackaging=pom + +# jar +mvn org.apache.maven.plugins:maven-install-plugin:3.0.0-M1:install-file \ +-Dfile=jakarta.json-tck-tests-pluggability-"$VERSION".jar -DgroupId=jakarta.json \ +-DartifactId=jakarta.json-tck-tests-pluggability -Dversion="$VERSION" -Dpackaging=jar + +# sources jar +mvn org.apache.maven.plugins:maven-install-plugin:3.0.0-M1:install-file \ +-Dfile=jakarta.json-tck-tests-pluggability-"$VERSION"-sources.jar -DgroupId=jakarta.json \ +-DartifactId=jakarta.json-tck-tests-pluggability-sources -Dversion="$VERSION" -Dpackaging=jar diff --git a/microprofile/tests/tck/tck-jsonp/pom.xml b/microprofile/tests/tck/tck-jsonp/pom.xml new file mode 100644 index 00000000000..be25bd2d05f --- /dev/null +++ b/microprofile/tests/tck/tck-jsonp/pom.xml @@ -0,0 +1,64 @@ + + + + + 4.0.0 + + io.helidon.microprofile.tests + tck-project + 4.0.0-SNAPSHOT + + pom + tck-jsonp + Helidon Microprofile Tests TCK JSONP + + + tck-jsonp-test + + + + + + maven-antrun-plugin + + + validate + + run + + + + + + + + + + + + + + + + + + + diff --git a/microprofile/tests/tck/tck-jsonp/tck-jsonp-test/pom.xml b/microprofile/tests/tck/tck-jsonp/tck-jsonp-test/pom.xml new file mode 100644 index 00000000000..0884df0f240 --- /dev/null +++ b/microprofile/tests/tck/tck-jsonp/tck-jsonp-test/pom.xml @@ -0,0 +1,81 @@ + + + + + 4.0.0 + + io.helidon.microprofile.tests + tck-jsonp + 4.0.0-SNAPSHOT + + tck-jsonp-test + Helidon Microprofile Tests TCK JSONP + + + + org.junit.jupiter + junit-jupiter-engine + test + + + io.helidon.microprofile.bundles + helidon-microprofile + test + + + + jakarta.json + jakarta.json-tck-tests + 2.1.0 + test + + + jakarta.json + jakarta.json-tck-tests-pluggability + 2.1.0 + test + + + + + + + maven-antrun-plugin + + true + + + + org.apache.maven.plugins + maven-surefire-plugin + + + jakarta.json:jakarta.json-tck-tests + jakarta.json:jakarta.json-tck-tests-pluggability + + + *Tests.java + + + + + + diff --git a/microprofile/tests/tck/tck-jwt-auth/pom.xml b/microprofile/tests/tck/tck-jwt-auth/pom.xml index 0e5be254168..3651c252990 100644 --- a/microprofile/tests/tck/tck-jwt-auth/pom.xml +++ b/microprofile/tests/tck/tck-jwt-auth/pom.xml @@ -62,6 +62,11 @@ arquillian-container-test-spi test + + org.testng + testng + test + diff --git a/microprofile/tests/tck/tck-openapi/pom.xml b/microprofile/tests/tck/tck-openapi/pom.xml index f5cb6d53773..00c50132502 100644 --- a/microprofile/tests/tck/tck-openapi/pom.xml +++ b/microprofile/tests/tck/tck-openapi/pom.xml @@ -96,6 +96,11 @@ 2.3.2 test + + org.testng + testng + test + diff --git a/microprofile/tests/tck/tck-opentracing/pom.xml b/microprofile/tests/tck/tck-opentracing/pom.xml index 45d1562c76c..49e8b259652 100644 --- a/microprofile/tests/tck/tck-opentracing/pom.xml +++ b/microprofile/tests/tck/tck-opentracing/pom.xml @@ -61,6 +61,11 @@ helidon-microprofile-tracing test + + org.testng + testng + test + diff --git a/microprofile/tests/tck/tck-reactive-operators/pom.xml b/microprofile/tests/tck/tck-reactive-operators/pom.xml index 5ca386e407d..27278a486c2 100644 --- a/microprofile/tests/tck/tck-reactive-operators/pom.xml +++ b/microprofile/tests/tck/tck-reactive-operators/pom.xml @@ -51,6 +51,11 @@ org.eclipse.microprofile.reactive-streams-operators microprofile-reactive-streams-operators-tck + + org.testng + testng + test + diff --git a/microprofile/tests/tck/tck-rest-client/pom.xml b/microprofile/tests/tck/tck-rest-client/pom.xml index 6eefae06dae..8afdafe14ae 100644 --- a/microprofile/tests/tck/tck-rest-client/pom.xml +++ b/microprofile/tests/tck/tck-rest-client/pom.xml @@ -50,6 +50,11 @@ commons-lang3 test + + org.testng + testng + test + diff --git a/microprofile/tests/tck/tck-restfull/pom.xml b/microprofile/tests/tck/tck-restfull/pom.xml new file mode 100644 index 00000000000..453eaec7d6c --- /dev/null +++ b/microprofile/tests/tck/tck-restfull/pom.xml @@ -0,0 +1,72 @@ + + + + + 4.0.0 + + io.helidon.microprofile.tests + tck-project + 4.0.0-SNAPSHOT + + tck-restfull + Helidon Microprofile Tests TCK Restfull + + + + io.helidon.microprofile.tests + helidon-arquillian + ${project.version} + test + + + org.jboss.arquillian.junit + arquillian-junit-container + test + + + jakarta.ws.rs + jakarta-restful-ws-tck + test + + + org.junit.jupiter + junit-jupiter-engine + test + + + + + + + org.apache.maven.plugins + maven-surefire-plugin + + + jakarta.ws.rs:jakarta-restful-ws-tck + + + *IT.java + + + + + + diff --git a/microprofile/tests/tck/tck-restfull/src/test/java/io/helidon/microprofile/restfull/tck/UrlLoaderExtension.java b/microprofile/tests/tck/tck-restfull/src/test/java/io/helidon/microprofile/restfull/tck/UrlLoaderExtension.java new file mode 100644 index 00000000000..f060ea6edb1 --- /dev/null +++ b/microprofile/tests/tck/tck-restfull/src/test/java/io/helidon/microprofile/restfull/tck/UrlLoaderExtension.java @@ -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.restfull.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); + } +} diff --git a/microprofile/tests/tck/tck-restfull/src/test/java/io/helidon/microprofile/restfull/tck/UrlResourceProvider.java b/microprofile/tests/tck/tck-restfull/src/test/java/io/helidon/microprofile/restfull/tck/UrlResourceProvider.java new file mode 100644 index 00000000000..9972bdc80be --- /dev/null +++ b/microprofile/tests/tck/tck-restfull/src/test/java/io/helidon/microprofile/restfull/tck/UrlResourceProvider.java @@ -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.restfull.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); + } +} diff --git a/microprofile/tests/tck/tck-restfull/src/test/resources/META-INF/services/org.jboss.arquillian.core.spi.LoadableExtension b/microprofile/tests/tck/tck-restfull/src/test/resources/META-INF/services/org.jboss.arquillian.core.spi.LoadableExtension new file mode 100644 index 00000000000..a9f56c581b4 --- /dev/null +++ b/microprofile/tests/tck/tck-restfull/src/test/resources/META-INF/services/org.jboss.arquillian.core.spi.LoadableExtension @@ -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.restfull.tck.UrlLoaderExtension + diff --git a/microprofile/tests/tck/tck-restfull/src/test/resources/arquillian.xml b/microprofile/tests/tck/tck-restfull/src/test/resources/arquillian.xml new file mode 100644 index 00000000000..6f8e7919098 --- /dev/null +++ b/microprofile/tests/tck/tck-restfull/src/test/resources/arquillian.xml @@ -0,0 +1,28 @@ + + + + + + target/deployments + + \ No newline at end of file diff --git a/microprofile/tests/tck/tck-restfull/src/test/resources/logging-test.properties b/microprofile/tests/tck/tck-restfull/src/test/resources/logging-test.properties new file mode 100644 index 00000000000..15b033aaa6e --- /dev/null +++ b/microprofile/tests/tck/tck-restfull/src/test/resources/logging-test.properties @@ -0,0 +1,24 @@ +# +# 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. +# +handlers=java.util.logging.ConsoleHandler +java.util.logging.ConsoleHandler.level=FINEST +java.util.logging.ConsoleHandler.formatter=java.util.logging.SimpleFormatter +java.util.logging.SimpleFormatter.format=%1$tH:%1$tM:%1$tS %4$s %3$s %5$s%6$s%n +# Global logging level. Can be overridden by specific loggers +.level=INFO +io.helidon.nima.level=INFO +io.helidon.nima.webserver.http.Http1Connection.level=INFO +io.helidon.nima.webserver.http.HttpRouting.level=INFO diff --git a/microprofile/tests/tck/tck-telemetry/pom.xml b/microprofile/tests/tck/tck-telemetry/pom.xml index 76fe30f5bdc..e1c7a7afd84 100644 --- a/microprofile/tests/tck/tck-telemetry/pom.xml +++ b/microprofile/tests/tck/tck-telemetry/pom.xml @@ -1,6 +1,6 @@ - 1.7.0.Alpha10 + 1.7.0.Final 9.4 9.1 2.11.0 @@ -93,6 +93,7 @@ 3.1.2 3.1.2 + 3.1.0 1.12 3.1.2 3.10.1 @@ -771,6 +772,10 @@ fail + + maven-antrun-plugin + ${version.plugin.ant} +