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 #1526

Closed
arjantijms opened this issue Sep 12, 2024 · 7 comments · Fixed by #1625 or #1626
Closed

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

arjantijms opened this issue Sep 12, 2024 · 7 comments · Fixed by #1625 or #1626
Labels
10.0 Issues related to the Jakarta EE 10 Platform TCK release 11.0 Issues related to the Jakarta EE 11 Platform TCK release accepted TCK challenge accepted challenge TCK challenge

Comments

@arjantijms
Copy link
Contributor

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.

How are we supposed to pass this, or did I interpret something incorrectly? A number of products have already passed the Core TCK, so I'm not entirely sure what I'm missing, if anything.

@manovotn
Copy link
Contributor

How are we supposed to pass this, or did I interpret something incorrectly? A number of products have already passed the Core TCK, so I'm not entirely sure what I'm missing, if anything.

I don't know the precise reason why and how they passed but EE implementations can mark deployment as CDI ones (meaning they will trigger Weld startup) based on various other indicators than just beans.xml presence. But it is just a guess.

Either way, there should IMO be beans.xml in the test so long as you are supposed to pass this with CDI Lite.

@arjantijms
Copy link
Contributor Author

arjantijms commented Sep 12, 2024

How are we supposed to pass this?

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

@manovotn & @Ladicek
You mean the vendor has to do that, or that we update the test to contain beans.xml?

For now I've added the following to the test runner, but I guess you meant the latter option?

public class CustomJsonbSerializationITFix implements LoadableExtension {

    @Override
    public void register(ExtensionBuilder builder) {
        builder.observer(CustomJsonbSerializationITFix.class);
    }

    public void removeService(@Observes BeforeDeploy event) {
        Archive<?> archive = event.getDeployment().getArchive();
        if (archive instanceof WebArchive webArchive) {
            if (webArchive.getName().equals("CustomJsonbSerializationIT.war")) {
                webArchive.addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml");
            }
        }
    }

}

@manovotn
Copy link
Contributor

You mean the vendor has to do that, or that we update the test to contain beans.xml?

I mean I'd add beans.xml to the TCK test in this repo - I think this is a valid challenge.
Your workaround is also a viable option in the meantime 👍

@edburns edburns added the 11.0 Issues related to the Jakarta EE 11 Platform TCK release label Oct 30, 2024
@starksm64 starksm64 moved this to In progress in Jakarta EE11 TCK Release Oct 30, 2024
@edburns edburns assigned starksm64 and unassigned starksm64 Oct 30, 2024
@starksm64 starksm64 added the accepted TCK challenge accepted label Oct 30, 2024
@jhanders34
Copy link
Contributor

jhanders34 commented Oct 30, 2024

starksm64 added a commit that referenced this issue Oct 30, 2024
Fixes #1526

Signed-off-by: Scott M Stark <starksm@starkinternational.com>
starksm64 added a commit that referenced this issue Oct 30, 2024
#1625)

Fixes #1526

Signed-off-by: Scott M Stark <starksm@starkinternational.com>
@github-project-automation github-project-automation bot moved this from In progress to Done in Jakarta EE11 TCK Release Oct 30, 2024
@starksm64
Copy link
Contributor

Would https://github.com/jakartaee/platform-tck/blob/main/core-profile-tck/tck/src/main/java/ee/jakarta/tck/core/rest/context/app/ApplicationContextIT.java#L47 also need to be updated to include a beans.xml? That REST resource has an @Inject in it as well?

Yes, good point, every archive without an explicit beans.xml should have an empty one.

@starksm64 starksm64 reopened this Oct 30, 2024
starksm64 added a commit that referenced this issue Oct 30, 2024
…ionContextIT test archives.

Fixes #1526

Signed-off-by: Scott M Stark <starksm@starkinternational.com>
@jhanders34
Copy link
Contributor

To be clear, this is a Core Profile 10.x challenge. I assume the fixes done in the PRs associated with this issue also need to be ported to the Core Profile TCK version 10 branch and a 10.x service release created.

@starksm64 starksm64 added the 10.0 Issues related to the Jakarta EE 10 Platform TCK release label Oct 30, 2024
@starksm64 starksm64 reopened this Oct 30, 2024
@starksm64
Copy link
Contributor

Right, I'm just focused on the EE11 TCK currently.

starksm64 added a commit that referenced this issue Oct 30, 2024
…ionContextIT test archives.

This applies to the 10.0.x branch.
Fixes #1526

Signed-off-by: Scott M Stark <starksm@starkinternational.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
10.0 Issues related to the Jakarta EE 10 Platform TCK release 11.0 Issues related to the Jakarta EE 11 Platform TCK release accepted TCK challenge accepted challenge TCK challenge
Projects
Status: Done
5 participants