From d93f123e13b9d42f455e09729a0c021664d96695 Mon Sep 17 00:00:00 2001 From: Scott M Stark Date: Tue, 10 Dec 2024 18:13:41 -0600 Subject: [PATCH] Some fixes for #1699 Signed-off-by: Scott M Stark --- .../vehicle/pmservlet/PMServletVehicle.java | 13 ++++++-- .../jakartaeetck/bin/ts.jte | 2 +- .../query/flushmode/Client2PmservletTest.java | 33 ++----------------- .../core/query/flushmode/Client1.java | 4 ++- .../core/query/flushmode/Client2.java | 17 +++++++--- .../core/query/flushmode/Client3.java | 2 ++ 6 files changed, 30 insertions(+), 41 deletions(-) diff --git a/common/src/main/java/com/sun/ts/tests/common/vehicle/pmservlet/PMServletVehicle.java b/common/src/main/java/com/sun/ts/tests/common/vehicle/pmservlet/PMServletVehicle.java index 7a6f271621..80ad7217d1 100644 --- a/common/src/main/java/com/sun/ts/tests/common/vehicle/pmservlet/PMServletVehicle.java +++ b/common/src/main/java/com/sun/ts/tests/common/vehicle/pmservlet/PMServletVehicle.java @@ -40,6 +40,9 @@ import jakarta.persistence.PersistenceUnit; import jakarta.transaction.UserTransaction; +import java.io.PrintWriter; +import java.io.StringWriter; + @PersistenceContexts({ @PersistenceContext(name = "persistence/CTS-EM", unitName = "CTS-EM"), @PersistenceContext(name = "persistence/CTS-EM2", unitName = "CTS-EM2") }) @@ -114,9 +117,13 @@ protected RemoteStatus runTest() { System.out.println("Test running in pmservlet vehicle failed"); } } catch (Throwable e) { - sTestStatus = new RemoteStatus( - Status.failed("Test running in pmservlet vehicle failed")); - e.printStackTrace(); + StringBuilder sb = new StringBuilder(); + sb.append("Test running in pmservlet vehicle failed: "); + StringWriter sw = new StringWriter(); + e.printStackTrace(new PrintWriter(sw)); + sb.append(sw.toString()); + sTestStatus = new RemoteStatus(Status.failed(sb.toString())); + TestUtil.logErr("Test running in pmservlet vehicle failed", e); } return sTestStatus; diff --git a/glassfish-runner/persistence-platform-tck/jakartaeetck/bin/ts.jte b/glassfish-runner/persistence-platform-tck/jakartaeetck/bin/ts.jte index 676e5b9057..83cec3950e 100644 --- a/glassfish-runner/persistence-platform-tck/jakartaeetck/bin/ts.jte +++ b/glassfish-runner/persistence-platform-tck/jakartaeetck/bin/ts.jte @@ -2097,7 +2097,7 @@ ts.standard.deployment.server.classpath=${ant.jars}:${pathsep}${ts.run.classpath harness.deployment.server.port=2002 -java.naming.factory.initial=foo +java.naming.factory.initial=com.sun.enterprise.naming.impl.SerialInitContextFactory org.omg.CORBA.ORBClass=foo undeploy_redeploy_apps=${UNDEPLOY_REDEPLOY_FLAG} diff --git a/jpa/platform-tests/src/main/java/ee/jakarta/tck/persistence/core/query/flushmode/Client2PmservletTest.java b/jpa/platform-tests/src/main/java/ee/jakarta/tck/persistence/core/query/flushmode/Client2PmservletTest.java index 259b90869f..4cc43dda55 100644 --- a/jpa/platform-tests/src/main/java/ee/jakarta/tck/persistence/core/query/flushmode/Client2PmservletTest.java +++ b/jpa/platform-tests/src/main/java/ee/jakarta/tck/persistence/core/query/flushmode/Client2PmservletTest.java @@ -86,23 +86,9 @@ public static EnterpriseArchive createDeploymentVehicle(@ArquillianResource Test if(warResURL != null) { jpa_core_query_flushmode_pmservlet_vehicle_web.addAsWebInfResource(warResURL, "web.xml"); } - // The sun-web.xml descriptor - warResURL = Client2.class.getResource("//com/sun/ts/tests/common/vehicle/pmservlet/pmservlet_vehicle_web.war.sun-web.xml"); - if(warResURL != null) { - jpa_core_query_flushmode_pmservlet_vehicle_web.addAsWebInfResource(warResURL, "sun-web.xml"); - } // Any libraries added to the war - // Web content - warResURL = Client2.class.getResource("/com/sun/ts/tests/jpa/core/query/flushmode/jpa_core_query_flushmode.jar"); - if(warResURL != null) { - jpa_core_query_flushmode_pmservlet_vehicle_web.addAsWebResource(warResURL, "/WEB-INF/lib/jpa_core_query_flushmode.jar"); - } - warResURL = Client2.class.getResource("/com/sun/ts/tests/common/vehicle/pmservlet/pmservlet_vehicle_web.xml"); - if(warResURL != null) { - jpa_core_query_flushmode_pmservlet_vehicle_web.addAsWebResource(warResURL, "/WEB-INF/pmservlet_vehicle_web.xml"); - } // Call the archive processor archiveProcessor.processWebArchive(jpa_core_query_flushmode_pmservlet_vehicle_web, Client2.class, warResURL); @@ -137,25 +123,10 @@ public static EnterpriseArchive createDeploymentVehicle(@ArquillianResource Test if(parURL != null) { jpa_core_query_flushmode.addAsManifestResource(parURL, "persistence.xml"); } - // Add the Persistence mapping-file - URL mappingURL = Client2.class.getResource("myMappingFile.xml"); - if(mappingURL != null) { - jpa_core_query_flushmode.addAsResource(mappingURL, "myMappingFile.xml"); - } - mappingURL = Client2.class.getResource("myMappingFile1.xml"); - if(mappingURL != null) { - jpa_core_query_flushmode.addAsResource(mappingURL, "myMappingFile1.xml"); - } - mappingURL = Client2.class.getResource("myMappingFile2.xml"); - if(mappingURL != null) { - jpa_core_query_flushmode.addAsResource(mappingURL, "myMappingFile2.xml"); - } // Call the archive processor archiveProcessor.processParArchive(jpa_core_query_flushmode, Client2.class, parURL); - parURL = Client2.class.getResource("orm.xml"); - if(parURL != null) { - jpa_core_query_flushmode.addAsManifestResource(parURL, "orm.xml"); - } + + jpa_core_query_flushmode_pmservlet_vehicle_web.addAsLibrary(jpa_core_query_flushmode); // Ear EnterpriseArchive jpa_core_query_flushmode_vehicles_ear = ShrinkWrap.create(EnterpriseArchive.class, "jpa_core_query_flushmode_vehicles.ear"); diff --git a/jpa/spec-tests/src/main/java/ee/jakarta/tck/persistence/core/query/flushmode/Client1.java b/jpa/spec-tests/src/main/java/ee/jakarta/tck/persistence/core/query/flushmode/Client1.java index 680303b867..6a8b85d35c 100644 --- a/jpa/spec-tests/src/main/java/ee/jakarta/tck/persistence/core/query/flushmode/Client1.java +++ b/jpa/spec-tests/src/main/java/ee/jakarta/tck/persistence/core/query/flushmode/Client1.java @@ -23,6 +23,7 @@ import java.util.List; +import com.sun.ts.lib.harness.SetupMethod; import com.sun.ts.lib.harness.Status; import ee.jakarta.tck.persistence.common.schema30.Util; @@ -60,7 +61,8 @@ public static void main(String[] args) { * updated name.* * */ - public void flushModeTest1() throws Exception { + @SetupMethod(name = "setupCustomerData") + public void flushModeTest1() throws Exception { boolean pass1 = false; boolean pass2 = false; boolean pass3 = false; diff --git a/jpa/spec-tests/src/main/java/ee/jakarta/tck/persistence/core/query/flushmode/Client2.java b/jpa/spec-tests/src/main/java/ee/jakarta/tck/persistence/core/query/flushmode/Client2.java index 68d4a0480e..782eb6f217 100644 --- a/jpa/spec-tests/src/main/java/ee/jakarta/tck/persistence/core/query/flushmode/Client2.java +++ b/jpa/spec-tests/src/main/java/ee/jakarta/tck/persistence/core/query/flushmode/Client2.java @@ -24,6 +24,7 @@ import java.util.List; import java.util.Vector; +import com.sun.ts.lib.harness.SetupMethod; import com.sun.ts.lib.harness.Status; import ee.jakarta.tck.persistence.common.schema30.Util; @@ -56,6 +57,7 @@ public static void main(String[] args) { * customer used in the setCustomer call. * */ + @SetupMethod(name = "setupOrderData") public void flushModeTest2() throws Exception { boolean pass = false; String expectedPKs[]; @@ -99,7 +101,8 @@ public void flushModeTest2() throws Exception { * updates the name of a customer. It then executes an EJBQL query selecting * orders where the related customer has the updated name. */ - public void flushModeTest3() throws Exception { + @SetupMethod(name = "setupOrderData") + public void flushModeTest3() throws Exception { boolean pass = false; String expectedPKs[]; List o; @@ -143,7 +146,8 @@ public void flushModeTest3() throws Exception { * name of the new spouse. * */ - public void flushModeTest4() throws Exception { + @SetupMethod(name = "setupOrderData") + public void flushModeTest4() throws Exception { boolean pass = false; String expectedPKs[]; @@ -190,7 +194,8 @@ public void flushModeTest4() throws Exception { * selecting orders where the related spouse of the related customer has the * updated name. */ - public void flushModeTest5() throws Exception { + @SetupMethod(name = "setupOrderData") + public void flushModeTest5() throws Exception { boolean pass = false; String expectedPKs[]; @@ -232,7 +237,8 @@ public void flushModeTest5() throws Exception { * executes an EJBQL query selecting customers having an order with the removed * number. */ - public void flushModeTest6() throws Exception { + @SetupMethod(name = "setupOrderData") + public void flushModeTest6() throws Exception { boolean pass = false; String expectedPKs[]; @@ -282,7 +288,8 @@ public void flushModeTest6() throws Exception { * executes an EJBQL query selecting a spouse whose customer has an order with * an credit card having the new number. */ - public void flushModeTest7() throws Exception { + @SetupMethod(name = "setupOrderData") + public void flushModeTest7() throws Exception { boolean pass = false; String[] expected = new String[1]; expected[0] = "2"; diff --git a/jpa/spec-tests/src/main/java/ee/jakarta/tck/persistence/core/query/flushmode/Client3.java b/jpa/spec-tests/src/main/java/ee/jakarta/tck/persistence/core/query/flushmode/Client3.java index ed9cccd551..2aa2838f74 100644 --- a/jpa/spec-tests/src/main/java/ee/jakarta/tck/persistence/core/query/flushmode/Client3.java +++ b/jpa/spec-tests/src/main/java/ee/jakarta/tck/persistence/core/query/flushmode/Client3.java @@ -23,6 +23,7 @@ import java.util.List; +import com.sun.ts.lib.harness.SetupMethod; import com.sun.ts.lib.harness.Status; import ee.jakarta.tck.persistence.common.schema30.Util; @@ -47,6 +48,7 @@ public static void main(String[] args) { * * @test_Strategy: */ + @SetupMethod(name = "setupProductData") public void secondaryTablesValueTest() throws Exception { boolean pass = false;