Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Core profile CDI tests use archive without beans.xml #603

Closed
arjantijms opened this issue Sep 12, 2024 · 3 comments
Closed

Core profile CDI tests use archive without beans.xml #603

arjantijms opened this issue Sep 12, 2024 · 3 comments

Comments

@arjantijms
Copy link

The test ee.jakarta.tck.core.rest.jsonb.cdi.CustomJsonbSerializationIT in the 10.0.3 core profile TCK creates the following archive:

test archive: CustomJsonbSerializationIT.war:
/WEB-INF/
/WEB-INF/classes/
/WEB-INF/classes/ee/
/WEB-INF/classes/ee/jakarta/
/WEB-INF/classes/ee/jakarta/tck/
/WEB-INF/classes/ee/jakarta/tck/core/
/WEB-INF/classes/ee/jakarta/tck/core/rest/
/WEB-INF/classes/ee/jakarta/tck/core/rest/jsonb/
/WEB-INF/classes/ee/jakarta/tck/core/rest/jsonb/cdi/
/WEB-INF/classes/ee/jakarta/tck/core/rest/jsonb/cdi/ApplicationResource.class
/WEB-INF/classes/ee/jakarta/tck/core/rest/jsonb/cdi/CustomJsonbResolver.class
/WEB-INF/classes/ee/jakarta/tck/core/rest/jsonb/cdi/CustomJsonbResolver$CustomSerializer.class
/WEB-INF/classes/ee/jakarta/tck/core/rest/jsonb/cdi/CustomJsonbResolver$CustomDeserializer.class
/WEB-INF/classes/ee/jakarta/tck/core/rest/jsonb/cdi/KeysProducer.class
/WEB-INF/classes/ee/jakarta/tck/core/rest/jsonb/cdi/SomeMessage.class
/WEB-INF/classes/ee/jakarta/tck/core/rest/jsonb/cdi/Utils.class
/WEB-INF/classes/ee/jakarta/tck/core/rest/JaxRsActivator.class
/WEB-INF/classes/key.pub

According to https://jakarta.ee/specifications/cdi/4.0/jakarta-cdi-spec-4.0#bean_archive the beans.xml file is required.

Specifically, Weld Servlet in org.jboss.weld.environment.deployment.discovery.AbstractDiscoveryStrategy.performDiscovery() skips scanning completely if there is no beans.xml present as per the following code:

for (ScanResult scanResult : scanner.scan()) { // scanResult is beansXmlResult really
            final String ref = scanResult.getBeanArchiveRef();
            if (processedRefs.contains(ref)) {
                throw CommonLogger.LOG.invalidScanningResult(ref);
            }
            CommonLogger.LOG.processingBeanArchiveReference(ref);
            processedRefs.add(ref);
            BeanArchiveBuilder builder = null;
            for (BeanArchiveHandler handler : beanArchiveHandlers) {
                builder = handler.handle(ref);
                if (builder != null) {
                    CommonLogger.LOG.beanArchiveReferenceHandled(ref, handler);
                    builder.setId(scanResult.getBeanArchiveId());
                    builder.setBeansXml(scanResult.getBeansXml());
                    beanArchiveBuilders.add(builder);
                    break;
                }
            }
            if (builder == null) {
                CommonLogger.LOG.beanArchiveReferenceCannotBeHandled(ref, beanArchiveHandlers);
            }
        }

How are we supposed to pass this?

@manovotn
Copy link
Contributor

manovotn commented Sep 12, 2024

Shouldn't this issue/challenge be under the Jakarta TCK repo instead of here?

According to https://jakarta.ee/specifications/cdi/4.0/jakarta-cdi-spec-4.0#bean_archive the beans.xml file is required.

In CDI Lite, that is correct.

How are we supposed to pass this?

I'd say add beans.xml to the test. Is that a problem?

@Ladicek
Copy link
Contributor

Ladicek commented Sep 12, 2024

There's jakartaee/platform-tck#1526 already, so it seems to me this issue should just be closed.

@manovotn
Copy link
Contributor

There's jakartaee/platform-tck#1526 already, so it seems to me this issue should just be closed.

I agree, I've added my comment there and we can continue the discussion there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants