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

Archive Name is incorrect for jpa tests #152

Closed
scottmarlow opened this issue Sep 30, 2024 · 4 comments
Closed

Archive Name is incorrect for jpa tests #152

scottmarlow opened this issue Sep 30, 2024 · 4 comments

Comments

@scottmarlow
Copy link
Member

The Arquillian TsTestPropsBuilder.vehicleArchiveName() is returning names like jpa_core_EntityGraph_vehicles since deployment.getDescription().getArchive().getName() is returning jpa_core_EntityGraph_vehicles.ear

^ seems to because of the JPA test ear names in use such as jakartaee/platform-tck@8176324#diff-d7378e1899f757a7c97b65acc9dc8dc4d7b727f6019e43b895fe7bfcc8aeb779R157:

EnterpriseArchive jpa_core_EntityGraph_vehicles_ear = ShrinkWrap.create(EnterpriseArchive.class, "jpa_core_EntityGraph_vehicles.ear");

^ leads to failures like:

&amp#27;[0m&amp#27;[31m10:50:32,968 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-8) MSC000001: Failed to start service jboss.deployment.unit."jpa_core_EntityGraph_vehicles.ear".STRUCTURE: org.jboss.msc.service.StartException in service jboss.deployment.unit."jpa_core_EntityGraph_vehicles.ear".STRUCTURE: WFLYSRV0153: Failed to process phase STRUCTURE of deployment "jpa_core_EntityGraph_vehicles.ear"
at org.jboss.as.server@26.0.0.Beta4//org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:172)
at org.jboss.msc@1.5.5.Final//org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1617)
at org.jboss.msc@1.5.5.Final//org.jboss.msc.service.ServiceControllerImpl$StartTask.execute(ServiceControllerImpl.java:1580)
at org.jboss.msc@1.5.5.Final//org.jboss.msc.service.ServiceControllerImpl$ControllerTask.run(ServiceControllerImpl.java:1438)
at org.jboss.threads@2.4.0.Final//org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
at org.jboss.threads@2.4.0.Final//org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1990)
at org.jboss.threads@2.4.0.Final//org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1486)
at org.jboss.threads@2.4.0.Final//org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1377)
at java.base/java.lang.Thread.run(Thread.java:1583)
Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: WFLYAC0007: Could not find application client jpa_core_EntityGraph_vehicles_client.jar
at org.jboss.as.appclient@34.0.0.Beta1-SNAPSHOT//org.jboss.as.appclient.deployment.ApplicationClientStructureProcessor.deploy(ApplicationClientStructureProcessor.java:69)
at org.jboss.as.server@26.0.0.Beta4//org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:165)
... 8 more

The workaround is :

git diff src/test/resources/javatest-appclient-arquillian.xml
diff --git a/src/test/resources/javatest-appclient-arquillian.xml b/src/test/resources/javatest-appclient-arquillian.xml
index e25d579..b3533d4 100644
--- a/src/test/resources/javatest-appclient-arquillian.xml
+++ b/src/test/resources/javatest-appclient-arquillian.xml
@@ -37,7 +37,7 @@
             <property name="runClient">true</property>
             <property name="runAsVehicle">true</property>
             <property name="clientEarDir">target/appclient</property>
-            <property name="clientCmdLineString">${jboss.home}/bin/appclient.sh;-y=${project.build.testOutputDirectory}/appclient.yml:${project.build.testOutputDirectory}/derby.yml;${clientEarDir}/${vehicleArchiveName}.ear#${vehicleArchiveName}_client.jar</property>
+            <property name="clientCmdLineString">${jboss.home}/bin/appclient.sh;-y=${project.build.testOutputDirectory}/appclient.yml:${project.build.testOutputDirectory}/derby.yml;${clientEarDir}/${vehicleArchiveName}.ear</property>
             <property name="clientEnvString">MY_EN=my-env-stting</property>
             <property name="clientDir">${project.basedir}</property>
             <property name="workDir">${ts.home}/tmp</property>

As far as I understand it, this is only a jpa test issue. Perhaps we can workaround it differently.

@scottmarlow scottmarlow changed the title Archive Name is incorreect for jpa tests Archive Name is incorrect for jpa tests Sep 30, 2024
@scottmarlow
Copy link
Member Author

I took another look at ^ and I don't think this issue is correct about the cause, so will look again.

@scottmarlow
Copy link
Member Author

The test pattern that seems to work is where the appclient archive has the same name as the ear except with _client added on:

             // the jar with the correct archive name
-            JavaArchive jpa_core_EntityGraph_appmanaged_vehicle_client = ShrinkWrap.create(JavaArchive.class, "jpa_core_EntityGraph_appmanaged_vehicle_client.jar");
+            JavaArchive jpa_core_EntityGraph_appmanaged_vehicle_client = ShrinkWrap.create(JavaArchive.class, "jpa_core_EntityGraph_appmanaged_vehicles_client.jar");
.
.
.
EnterpriseArchive jpa_core_EntityGraph_vehicles_ear = ShrinkWrap.create(EnterpriseArchive.class, "jpa_core_EntityGraph_appmanaged_vehicles.ear");

So we might need to update the jpa tests to only update the client jar name to match the ear.

@scottmarlow
Copy link
Member Author

scottmarlow commented Oct 4, 2024

Trying the following to update 900 JPA tests:

set -x 

function update_tests ()
{
  name=$1

    for updatefile in `find  -name "*$name*"`; do
        # echo "do something with file $updatefile"
        EAR_CLASS="$(grep "EnterpriseArchive.class" $updatefile | cut -d \" -f2 | cut -d'.' -f1)"
        # echo "class is $EAR_CLASS"
        # class is jpa_jpa22_repeatable_namedentitygraph_vehicles.ear
        # update line with JavaArchive jpa_core_annotations_access_field_appmanagedNoTx_vehicle_client = ShrinkWrap.create(JavaArchive.class, "jpa_core_annotations_access_field_appmanagedNoTx_vehicle_client.jar");
        # search pattern will be something like "JavaArchive.class.*_client.jar"
        # ^ will be updated to "$EAR_CLASS_client.jar"
        sed "s%JavaArchive.class.*_client.jar%JavaArchive.class, \"${EAR_CLASS}_client.jar%" -i $updatefile
    done
}

# covers both AppmanagedTest + Appmanagednotx
update_tests "*Appmanaged*.java"
update_tests "*Stateful3Test*.java"
update_tests "*Stateless3Test*.java"

set +x 

scottmarlow added a commit to scottmarlow/jakartaee-tck that referenced this issue Oct 4, 2024
… at end to address eclipse-ee4j/jakartaee-tck-tools#152

Signed-off-by: Scott Marlow <smarlow@redhat.com>
scottmarlow added a commit to scottmarlow/jakartaee-tck that referenced this issue Oct 4, 2024
… at end to address eclipse-ee4j/jakartaee-tck-tools#152

Signed-off-by: Scott Marlow <smarlow@redhat.com>
@scottmarlow
Copy link
Member Author

Closing as handled via ^

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

1 participant