jungm commented on code in PR #1898: URL: https://github.com/apache/tomee/pull/1898#discussion_r2069308176
########## tck/microprofile-tck/metrics/src/test/java/org/apache/tomee/microprofile/tck/metrics/MicroProfileMetricsTCKDeploymentPackager.java: ########## @@ -38,9 +38,14 @@ public Archive<?> generateDeployment(final TestDeployment testDeployment, final Collection<ProtocolArchiveProcessor> processors) { final Archive<?> applicationArchive = testDeployment.getApplicationArchive(); final WebArchive wrapperWar = ShrinkWrap.create(WebArchive.class, "microprofile-metrics.war"); - if (applicationArchive instanceof JavaArchive) { - wrapperWar.addAsLibrary(applicationArchive); - return super.generateDeployment(new TestDeploymentDelegate(testDeployment, wrapperWar), processors); + + // Move microprofile-config.properties from /META-INF/ to /WEB-INF/classes/META-INF/ + // cf. https://github.com/microprofile/microprofile-config/issues/268 + // cf. https://github.com/microprofile/microprofile-config#design <- should be on the class path which is /WEB-INF/classes in a WAR file + if (applicationArchive.contains("META-INF/microprofile-config.properties")) { Review Comment: should we raise an issue in the metrics TCK for this? ########## tck/microprofile-tck/opentelemetry/src/test/java/org/apache/tomee/microprofile/tck/opentelemetry/OpenTelemetryTCKDeploymentProcessor.java: ########## @@ -0,0 +1,101 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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 org.apache.tomee.microprofile.tck.opentelemetry; + +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes; +import org.apache.xbean.asm9.ClassReader; +import org.apache.xbean.asm9.ClassVisitor; +import org.apache.xbean.asm9.ClassWriter; +import org.apache.xbean.asm9.MethodVisitor; +import org.apache.xbean.asm9.Opcodes; +import org.apache.ziplock.JarLocation; +import org.jboss.arquillian.container.spi.client.deployment.DeploymentDescription; +import org.jboss.arquillian.container.spi.event.container.BeforeDeploy; +import org.jboss.arquillian.core.api.annotation.Observes; +import org.jboss.shrinkwrap.api.Archive; +import org.jboss.shrinkwrap.api.asset.ByteArrayAsset; +import org.jboss.shrinkwrap.api.asset.EmptyAsset; +import org.jboss.shrinkwrap.api.spec.WebArchive; + +import java.io.InputStream; + +import static org.apache.xbean.asm9.Opcodes.ASM9; + +public class OpenTelemetryTCKDeploymentProcessor { + + public void observeDeployment(@Observes final BeforeDeploy beforeDeploy) { + DeploymentDescription deployment = beforeDeploy.getDeployment(); + Archive<?> testableArchive = deployment.getTestableArchive(); + if (testableArchive != null) { + process(testableArchive); + } else { + process(deployment.getArchive()); + } + } + + private void process(Archive<?> archive) { + if (archive instanceof WebArchive webapp) { + webapp.addAsLibrary(JarLocation.jarLocation(SemanticAttributes.class)) // required for some tck classes + .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml"); + + applyJaxRsClientAsyncTestVisibilityHack(webapp); + + } + } + + /* + * This test fails under Java 17+ because the @PostConstruct and @PreDestroy methods are declared 'private', + * and CXF's InjectionUtils cannot access them reflectively. To work around this, we modify the class on the fly, + * making these methods public. This is acceptable here, as it's not part of the core setup logic of the TCK test, + * which passes once the access issue is resolved. + */ + private void applyJaxRsClientAsyncTestVisibilityHack(WebArchive webapp) { Review Comment: IMO this should also be an issue we raise against the MP telemetry TCK -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@tomee.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org