Closed scottmarlow closed 1 month ago
Many other test sources handle ear lib correctly for example from platform-tests/src/main/java/ee/jakarta/tck/persistence/jpa22/repeatable/namedstoredprocedurequery/ClientStateful3Test.java:
// Par
// the jar with the correct archive name
JavaArchive jpa_jpa22_repeatable_namedstoredprocedure = ShrinkWrap.create(JavaArchive.class, "jpa_jpa22_repeatable_namedstoredprocedure.jar");
// The class files
jpa_jpa22_repeatable_namedstoredprocedure.addClasses(
ee.jakarta.tck.persistence.jpa22.repeatable.namedstoredprocedurequery.Employee.class
);
// The persistence.xml descriptor
URL parURL = Client.class.getResource("/com/sun/ts/tests/jpa/common/template/modified.persistence.xml");
if(parURL != null) {
jpa_jpa22_repeatable_namedstoredprocedure.addAsManifestResource(parURL, "persistence.xml");
}
archiveProcessor.processParArchive(jpa_jpa22_repeatable_namedstoredprocedure, Client.class, parURL);
// The orm.xml file
parURL = Client.class.getResource("orm.xml");
if(parURL != null) {
jpa_jpa22_repeatable_namedstoredprocedure.addAsManifestResource(parURL, "orm.xml");
}
// Ear
EnterpriseArchive jpa_jpa22_repeatable_namedstoredprocedure_vehicles_ear = ShrinkWrap.create(EnterpriseArchive.class, "jpa_jpa22_repeatable_namedstoredprocedure_vehicles.ear");
// Any libraries added to the ear
// The component jars built by the package target
jpa_jpa22_repeatable_namedstoredprocedure_vehicles_ear.addAsModule(jpa_jpa22_repeatable_namedstoredprocedure_stateful3_vehicle_ejb);
jpa_jpa22_repeatable_namedstoredprocedure_vehicles_ear.addAsModule(jpa_jpa22_repeatable_namedstoredprocedure_stateful3_vehicle_client);
jpa_jpa22_repeatable_namedstoredprocedure_vehicles_ear.addAsLibrary(jpa_jpa22_repeatable_namedstoredprocedure);
I'm not sure if we have a stg
template file for processing the ear lib jars that may or may not have a persistence.xml. For this issue, we are dealing with a test that expects an ear lib jar with a peristence.xml and an (persistence) entity class.
The EE 10 TCK dist/com/sun/ts/tests/jpa/ee/propagation/cm/extended/jpa_ee_propagation_cm_ext.ear contains the test.
@starksm64 which tck-rewrite-ant stg template file should handle an ear lib jar that contains a persistence.xml + some entity classes? Would it be TsEar.stg?
It seems like we are missing adding the code to generate the jar that should of been added to the ear lib. Other tests seem to handle adding the ear lib jar (e.g. platform-tests/src/main/java/ee/jakarta/tck/persistence/jpa22/repeatable/namedstoredprocedurequery/ClientStateful3Test.java was correctly generated I think).
How do we debug or investigate why the code for adding the persistence.xml/entity classes was not generated? We should of created a jpa_ee_propagation_cm_ext
JavaArchive but that code didn't get added.
How it is supposed to be handled is that libs are collected in the tck.jakarta.platform.ant.Ear POJO associated with the ts.ear task and src/main/resources/TsEar.stg has a genLibJars template that writes out the jar generation. The capture of libs is a little sketchy because it happens outside of the ts.* task usually, and we try to capture them by looking at the actual jar task calls. I'll take a look at this particular jpa case and add a testcase for it.
How it is supposed to be handled is that libs are collected in the tck.jakarta.platform.ant.Ear POJO associated with the ts.ear task and src/main/resources/TsEar.stg has a genLibJars template that writes out the jar generation. The capture of libs is a little sketchy because it happens outside of the ts.* task usually, and we try to capture them by looking at the actual jar task calls. I'll take a look at this particular jpa case and add a testcase for it.
Thanks, I'll try debugging tck.jakarta.platform.ant.Ear with the test case you added.
I probably missed seeing compile errors for the below generated code that references unknown variable
jpa_ee_propagation_cm_ext
. The variable name happens to match the deployment name but otherwise isn't used elsewhere in the generated code. I suspect thatjpa_ee_propagation_cm_ext
is related to the lib/jpa_ee_propagation_cm_ext.jar entry in the EE 10 binary.The EE 10 TCK jpa_ee_propagation_cm_ext.ear has contents:
The EE 10 jpa_ee_propagation_cm_ext.jar contents: