Skip to content

Commit

Permalink
More changes for Web JPA tests (#1748)
Browse files Browse the repository at this point in the history
* More changes for Web JPA tests

Signed-off-by: Scott M Stark <[email protected]>

* Update ClientPmservletTest.java

---------

Signed-off-by: Scott M Stark <[email protected]>
  • Loading branch information
starksm64 authored Jan 12, 2025
1 parent 2696d32 commit 202f4a1
Show file tree
Hide file tree
Showing 8 changed files with 88 additions and 360 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import org.jboss.arquillian.junit5.ArquillianExtension;
import org.jboss.arquillian.test.api.ArquillianResource;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.spec.EnterpriseArchive;
import org.jboss.shrinkwrap.api.spec.JavaArchive;
import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.junit.jupiter.api.MethodOrderer;
Expand All @@ -47,108 +46,74 @@ public class ClientPmservletTest extends Client {
private static final long serialVersionUID = 1L;
static final String VEHICLE_ARCHIVE = "jpa_core_entityManagerFactoryCloseException_pmservlet_vehicle";

/**
* EE10 Deployment Descriptors: jpa_core_entityManagerFactoryCloseException: META-INF/persistence.xml
* jpa_core_entityManagerFactoryCloseException_appmanaged_vehicle_client: META-INF/application-client.xml
* jpa_core_entityManagerFactoryCloseException_appmanaged_vehicle_ejb: jar.sun-ejb-jar.xml
* jpa_core_entityManagerFactoryCloseException_appmanagedNoTx_vehicle_client: META-INF/application-client.xml
* jpa_core_entityManagerFactoryCloseException_appmanagedNoTx_vehicle_ejb: jar.sun-ejb-jar.xml
* jpa_core_entityManagerFactoryCloseException_pmservlet_vehicle_web: WEB-INF/web.xml
* jpa_core_entityManagerFactoryCloseException_puservlet_vehicle_web: WEB-INF/web.xml
* jpa_core_entityManagerFactoryCloseException_stateful3_vehicle_client: META-INF/application-client.xml
* jpa_core_entityManagerFactoryCloseException_stateful3_vehicle_ejb: jar.sun-ejb-jar.xml
* jpa_core_entityManagerFactoryCloseException_stateless3_vehicle_client: META-INF/application-client.xml
* jpa_core_entityManagerFactoryCloseException_stateless3_vehicle_ejb: jar.sun-ejb-jar.xml
* jpa_core_entityManagerFactoryCloseException_vehicles:
*
* Found Descriptors: War:
*
* /com/sun/ts/tests/common/vehicle/pmservlet/pmservlet_vehicle_web.xml Ear:
*
*/
@TargetsContainer("tck-javatest")
@OverProtocol("javatest")
@Deployment(name = VEHICLE_ARCHIVE, order = 2)
public static EnterpriseArchive createDeploymentVehicle(@ArquillianResource TestArchiveProcessor archiveProcessor) {
/**
EE10 Deployment Descriptors:
jpa_core_entityManagerFactoryCloseException: META-INF/persistence.xml
jpa_core_entityManagerFactoryCloseException_appmanaged_vehicle_client: META-INF/application-client.xml
jpa_core_entityManagerFactoryCloseException_appmanaged_vehicle_ejb: jar.sun-ejb-jar.xml
jpa_core_entityManagerFactoryCloseException_appmanagedNoTx_vehicle_client: META-INF/application-client.xml
jpa_core_entityManagerFactoryCloseException_appmanagedNoTx_vehicle_ejb: jar.sun-ejb-jar.xml
jpa_core_entityManagerFactoryCloseException_pmservlet_vehicle_web: WEB-INF/web.xml
jpa_core_entityManagerFactoryCloseException_puservlet_vehicle_web: WEB-INF/web.xml
jpa_core_entityManagerFactoryCloseException_stateful3_vehicle_client: META-INF/application-client.xml
jpa_core_entityManagerFactoryCloseException_stateful3_vehicle_ejb: jar.sun-ejb-jar.xml
jpa_core_entityManagerFactoryCloseException_stateless3_vehicle_client: META-INF/application-client.xml
jpa_core_entityManagerFactoryCloseException_stateless3_vehicle_ejb: jar.sun-ejb-jar.xml
jpa_core_entityManagerFactoryCloseException_vehicles:
Found Descriptors:
War:
/com/sun/ts/tests/common/vehicle/pmservlet/pmservlet_vehicle_web.xml
Ear:
*/
@TargetsContainer("tck-javatest")
@OverProtocol("javatest")
@Deployment(name = VEHICLE_ARCHIVE, order = 2)
public static WebArchive createDeploymentVehicle(@ArquillianResource TestArchiveProcessor archiveProcessor) {
// War
// the war with the correct archive name
WebArchive jpa_core_entityManagerFactoryCloseException_pmservlet_vehicle_web =
ShrinkWrap.create(WebArchive.class, "jpa_core_entityManagerFactoryCloseException_pmservlet_vehicle_web.war");

// The class files
jpa_core_entityManagerFactoryCloseException_pmservlet_vehicle_web.addClasses(
EJB3ShareBaseBean.class,
VehicleRunnerFactory.class,
UseEntityManager.class,
EJB3ShareIF.class,
Fault.class,
UseEntityManagerFactory.class,
PMClientBase.class,
ServletVehicle.class,
VehicleRunnable.class,
UserTransactionWrapper.class,
EETest.class,
ServiceEETest.class,
EntityTransactionWrapper.class,
PMServletVehicle.class,
Client.class,
SetupException.class, VehicleClient.class,
NoopTransactionWrapper.class);

// The web.xml descriptor
URL warResURL = Client.class.getResource("/com/sun/ts/tests/common/vehicle/pmservlet/pmservlet_vehicle_web.xml");
if (warResURL != null) {
jpa_core_entityManagerFactoryCloseException_pmservlet_vehicle_web.addAsWebInfResource(warResURL, "web.xml");
}

// The sun-web.xml descriptor
warResURL = Client.class.getResource("/com/sun/ts/tests/common/vehicle/pmservlet/pmservlet_vehicle_web.war.sun-web.xml");
if (warResURL != null) {
jpa_core_entityManagerFactoryCloseException_pmservlet_vehicle_web.addAsWebInfResource(warResURL, "sun-web.xml");
}

// Any libraries added to the war
JavaArchive jpa_core_entityManagerFactoryCloseException_lib =
ShrinkWrap.create(JavaArchive.class, "jpa_core_entityManagerFactoryCloseException.jar");

// The resources
URL libURL = Client.class.getResource("persistence.xml");
jpa_core_entityManagerFactoryCloseException_lib.addAsManifestResource(libURL, "persistence.xml");

jpa_core_entityManagerFactoryCloseException_pmservlet_vehicle_web.addAsLibrary(jpa_core_entityManagerFactoryCloseException_lib);

// Web content
warResURL = Client.class.getResource("/com/sun/ts/tests/common/vehicle/pmservlet/pmservlet_vehicle_web.xml");
if (warResURL != null) {
jpa_core_entityManagerFactoryCloseException_pmservlet_vehicle_web.addAsWebResource(warResURL,
"/WEB-INF/pmservlet_vehicle_web.xml");
// the war with the correct archive name
WebArchive jpa_core_entityManagerFactoryCloseException_pmservlet_vehicle_web = ShrinkWrap.create(WebArchive.class, "jpa_core_entityManagerFactoryCloseException_pmservlet_vehicle_web.war");
// The class files
jpa_core_entityManagerFactoryCloseException_pmservlet_vehicle_web.addClasses(
com.sun.ts.tests.common.vehicle.ejb3share.EJB3ShareBaseBean.class,
com.sun.ts.tests.common.vehicle.VehicleRunnerFactory.class,
com.sun.ts.tests.common.vehicle.ejb3share.UseEntityManager.class,
com.sun.ts.tests.common.vehicle.ejb3share.EJB3ShareIF.class,
com.sun.ts.lib.harness.EETest.Fault.class,
com.sun.ts.tests.common.vehicle.ejb3share.UseEntityManagerFactory.class,
ee.jakarta.tck.persistence.common.PMClientBase.class,
com.sun.ts.tests.common.vehicle.servlet.ServletVehicle.class,
com.sun.ts.tests.common.vehicle.VehicleRunnable.class,
com.sun.ts.tests.common.vehicle.ejb3share.UserTransactionWrapper.class,
com.sun.ts.lib.harness.EETest.class,
com.sun.ts.lib.harness.ServiceEETest.class,
com.sun.ts.tests.common.vehicle.ejb3share.EntityTransactionWrapper.class,
com.sun.ts.tests.common.vehicle.pmservlet.PMServletVehicle.class,
ee.jakarta.tck.persistence.core.entityManagerFactoryCloseExceptions.Client.class,
com.sun.ts.lib.harness.EETest.SetupException.class,
com.sun.ts.tests.common.vehicle.VehicleClient.class,
com.sun.ts.tests.common.vehicle.ejb3share.NoopTransactionWrapper.class
);
// The web.xml descriptor
URL warResURL = Client.class.getResource("/com/sun/ts/tests/common/vehicle/pmservlet/pmservlet_vehicle_web.xml");
if(warResURL != null) {
jpa_core_entityManagerFactoryCloseException_pmservlet_vehicle_web.addAsWebInfResource(warResURL, "web.xml");
}

// Par
JavaArchive jpa_core_entityManagerFactoryCloseException_lib = ShrinkWrap.create(JavaArchive.class, "jpa_core_entityManagerFactoryCloseException.jar");
URL parURL = Client.class.getResource("/ee/jakarta/tck/persistence/common/template/persistence.xml");
jpa_core_entityManagerFactoryCloseException_lib.addAsManifestResource(parURL, "persistence.xml");
jpa_core_entityManagerFactoryCloseException_pmservlet_vehicle_web.addAsLibrary(jpa_core_entityManagerFactoryCloseException_lib);

// Call the archive processor
archiveProcessor.processWebArchive(jpa_core_entityManagerFactoryCloseException_pmservlet_vehicle_web, Client.class, warResURL);

return jpa_core_entityManagerFactoryCloseException_pmservlet_vehicle_web;
}

// Call the archive processor
archiveProcessor.processWebArchive(jpa_core_entityManagerFactoryCloseException_pmservlet_vehicle_web, Client.class, warResURL);

// Ear
EnterpriseArchive jpa_core_entityManagerFactoryCloseException_vehicles_ear =
ShrinkWrap.create(EnterpriseArchive.class, "jpa_core_entityManagerFactoryCloseException_vehicles.ear");

// Any libraries added to the ear

// The component jars built by the package target
jpa_core_entityManagerFactoryCloseException_vehicles_ear
.addAsModule(jpa_core_entityManagerFactoryCloseException_pmservlet_vehicle_web);

// The sun-application.xml descriptor
URL earResURL = Client.class.getResource("/.ear.sun-application.xml");
if (earResURL != null) {
jpa_core_entityManagerFactoryCloseException_vehicles_ear.addAsManifestResource(earResURL, "sun-application.xml");
}

// Call the archive processor
archiveProcessor.processEarArchive(jpa_core_entityManagerFactoryCloseException_vehicles_ear, Client.class, earResURL);

return jpa_core_entityManagerFactoryCloseException_vehicles_ear;
}

@Test
@Override
@TargetVehicle("pmservlet")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,12 @@ public class ClientPuservletTest extends ee.jakarta.tck.persistence.core.entityM
War:
/com/sun/ts/tests/common/vehicle/puservlet/puservlet_vehicle_web.xml
Ear:
*/
@TargetsContainer("tck-javatest")
@OverProtocol("javatest")
@Deployment(name = VEHICLE_ARCHIVE, order = 2)
public static EnterpriseArchive createDeploymentVehicle(@ArquillianResource TestArchiveProcessor archiveProcessor) {
public static WebArchive createDeploymentVehicle(@ArquillianResource TestArchiveProcessor archiveProcessor) {
// War
// the war with the correct archive name
WebArchive jpa_core_entityManagerFactoryCloseException_puservlet_vehicle_web = ShrinkWrap.create(WebArchive.class, "jpa_core_entityManagerFactoryCloseException_puservlet_vehicle_web.war");
Expand Down Expand Up @@ -89,53 +88,18 @@ public static EnterpriseArchive createDeploymentVehicle(@ArquillianResource Test
if(warResURL != null) {
jpa_core_entityManagerFactoryCloseException_puservlet_vehicle_web.addAsWebInfResource(warResURL, "web.xml");
}
// The sun-web.xml descriptor
warResURL = Client.class.getResource("/com/sun/ts/tests/common/vehicle/puservlet/puservlet_vehicle_web.war.sun-web.xml");
if(warResURL != null) {
jpa_core_entityManagerFactoryCloseException_puservlet_vehicle_web.addAsWebInfResource(warResURL, "sun-web.xml");
}

// Any libraries added to the war
URL libURL;
JavaArchive jpa_core_entityManagerFactoryCloseException_lib = ShrinkWrap.create(JavaArchive.class, "jpa_core_entityManagerFactoryCloseException.jar");

// The resources
libURL = Client.class.getResource("persistence.xml");
jpa_core_entityManagerFactoryCloseException_lib.addAsResource(libURL, "persistence.xml");

jpa_core_entityManagerFactoryCloseException_puservlet_vehicle_web.addAsLibrary(jpa_core_entityManagerFactoryCloseException_lib);
// Par
JavaArchive jpa_core_entityManagerFactoryCloseException_lib = ShrinkWrap.create(JavaArchive.class, "jpa_core_entityManagerFactoryCloseException.jar");
URL parURL = Client.class.getResource("/ee/jakarta/tck/persistence/common/template/persistence.xml");
jpa_core_entityManagerFactoryCloseException_lib.addAsManifestResource(parURL, "persistence.xml");
jpa_core_entityManagerFactoryCloseException_puservlet_vehicle_web.addAsLibrary(jpa_core_entityManagerFactoryCloseException_lib);


// Web content
warResURL = Client.class.getResource("/com/sun/ts/tests/common/vehicle/puservlet/puservlet_vehicle_web.xml");
if(warResURL != null) {
jpa_core_entityManagerFactoryCloseException_puservlet_vehicle_web.addAsWebResource(warResURL, "/WEB-INF/puservlet_vehicle_web.xml");
}

// Call the archive processor
archiveProcessor.processWebArchive(jpa_core_entityManagerFactoryCloseException_puservlet_vehicle_web, Client.class, warResURL);


// Ear
EnterpriseArchive jpa_core_entityManagerFactoryCloseException_vehicles_ear = ShrinkWrap.create(EnterpriseArchive.class, "jpa_core_entityManagerFactoryCloseException_vehicles.ear");

// Any libraries added to the ear

// The component jars built by the package target
jpa_core_entityManagerFactoryCloseException_vehicles_ear.addAsModule(jpa_core_entityManagerFactoryCloseException_puservlet_vehicle_web);



// The application.xml descriptor
URL earResURL = null;
// The sun-application.xml descriptor
earResURL = Client.class.getResource("/.ear.sun-application.xml");
if(earResURL != null) {
jpa_core_entityManagerFactoryCloseException_vehicles_ear.addAsManifestResource(earResURL, "sun-application.xml");
}
// Call the archive processor
archiveProcessor.processEarArchive(jpa_core_entityManagerFactoryCloseException_vehicles_ear, Client.class, earResURL);
return jpa_core_entityManagerFactoryCloseException_vehicles_ear;
return jpa_core_entityManagerFactoryCloseException_puservlet_vehicle_web;
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public class ClientPmservletTest extends ee.jakarta.tck.persistence.core.entityt
@TargetsContainer("tck-javatest")
@OverProtocol("javatest")
@Deployment(name = VEHICLE_ARCHIVE, order = 2)
public static EnterpriseArchive createDeploymentVehicle(@ArquillianResource TestArchiveProcessor archiveProcessor) {
public static WebArchive createDeploymentVehicle(@ArquillianResource TestArchiveProcessor archiveProcessor) {
// War
// the war with the correct archive name
WebArchive jpa_core_et_cascadeall_manyXmany_pmservlet_vehicle_web = ShrinkWrap.create(WebArchive.class, "jpa_core_et_cascadeall_manyXmany_pmservlet_vehicle_web.war");
Expand Down Expand Up @@ -95,18 +95,6 @@ public static EnterpriseArchive createDeploymentVehicle(@ArquillianResource Test
jpa_core_et_cascadeall_manyXmany_pmservlet_vehicle_web.addAsWebInfResource(warResURL, "sun-web.xml");
}

// Any libraries added to the war

// Web content
warResURL = Client.class.getResource("/com/sun/ts/tests/jpa/core/entitytest/cascadeall/manyXmany/jpa_core_et_cascadeall_manyXmany.jar");
if(warResURL != null) {
jpa_core_et_cascadeall_manyXmany_pmservlet_vehicle_web.addAsWebResource(warResURL, "/WEB-INF/lib/jpa_core_et_cascadeall_manyXmany.jar");
}
warResURL = Client.class.getResource("/com/sun/ts/tests/common/vehicle/pmservlet/pmservlet_vehicle_web.xml");
if(warResURL != null) {
jpa_core_et_cascadeall_manyXmany_pmservlet_vehicle_web.addAsWebResource(warResURL, "/WEB-INF/pmservlet_vehicle_web.xml");
}

// Call the archive processor
archiveProcessor.processWebArchive(jpa_core_et_cascadeall_manyXmany_pmservlet_vehicle_web, Client.class, warResURL);

Expand All @@ -121,51 +109,11 @@ public static EnterpriseArchive createDeploymentVehicle(@ArquillianResource Test
);
// The persistence.xml descriptor
URL parURL = Client.class.getResource("persistence.xml");
if(parURL != null) {
jpa_core_et_cascadeall_manyXmany.addAsManifestResource(parURL, "persistence.xml");
}
// Add the Persistence mapping-file
URL mappingURL = Client.class.getResource("myMappingFile.xml");
if(mappingURL != null) {
jpa_core_et_cascadeall_manyXmany.addAsResource(mappingURL, "myMappingFile.xml");
}
mappingURL = Client.class.getResource("myMappingFile1.xml");
if(mappingURL != null) {
jpa_core_et_cascadeall_manyXmany.addAsResource(mappingURL, "myMappingFile1.xml");
}
mappingURL = Client.class.getResource("myMappingFile2.xml");
if(mappingURL != null) {
jpa_core_et_cascadeall_manyXmany.addAsResource(mappingURL, "myMappingFile2.xml");
}
// Call the archive processor
jpa_core_et_cascadeall_manyXmany.addAsManifestResource(parURL, "persistence.xml");
archiveProcessor.processParArchive(jpa_core_et_cascadeall_manyXmany, Client.class, parURL);
parURL = Client.class.getResource("orm.xml");
if(parURL != null) {
jpa_core_et_cascadeall_manyXmany.addAsManifestResource(parURL, "orm.xml");
}

// Ear
EnterpriseArchive jpa_core_et_cascadeall_manyXmany_vehicles_ear = ShrinkWrap.create(EnterpriseArchive.class, "jpa_core_et_cascadeall_manyXmany_vehicles.ear");

// Any libraries added to the ear

// The component jars built by the package target
jpa_core_et_cascadeall_manyXmany_vehicles_ear.addAsModule(jpa_core_et_cascadeall_manyXmany_pmservlet_vehicle_web);
jpa_core_et_cascadeall_manyXmany_pmservlet_vehicle_web.addAsLibrary(jpa_core_et_cascadeall_manyXmany);

jpa_core_et_cascadeall_manyXmany_vehicles_ear.addAsLibrary(jpa_core_et_cascadeall_manyXmany);



// The application.xml descriptor
URL earResURL = null;
// The sun-application.xml descriptor
earResURL = Client.class.getResource("/.ear.sun-application.xml");
if(earResURL != null) {
jpa_core_et_cascadeall_manyXmany_vehicles_ear.addAsManifestResource(earResURL, "sun-application.xml");
}
// Call the archive processor
archiveProcessor.processEarArchive(jpa_core_et_cascadeall_manyXmany_vehicles_ear, Client.class, earResURL);
return jpa_core_et_cascadeall_manyXmany_vehicles_ear;
return jpa_core_et_cascadeall_manyXmany_pmservlet_vehicle_web;
}

@Test
Expand Down
Loading

0 comments on commit 202f4a1

Please sign in to comment.