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

Fix jpa tests missing setup calls #1706

Merged
merged 5 commits into from
Dec 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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") })
Expand Down Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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}

Expand Down
3 changes: 2 additions & 1 deletion glassfish-runner/persistence-platform-tck/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,8 @@
</goals>
<configuration>
<includes>
<include>ee/jakarta/tck/persistence/**/*Test.java</include>

<include>ee/jakarta/tck/persistence/core/types/generator/Client1PmservletTest.java</include>
</includes>
<!-- Select the @Tag("tck-javatest") tests -->
<groups>tck-javatest</groups>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,10 @@ public void setup(String[] args, Properties p) throws Exception {
if (JAKARTA_EE.equalsIgnoreCase(mode)) {
logTrace(MODE_PROP + " is set to " + mode
+ ", so tests are running in JakartaEE environment.");
// Propagate all properties to the system properties
for (String name : p.stringPropertyNames()) {
System.setProperty(name, p.getProperty(name));
}
} else if (STANDALONE_MODE.equalsIgnoreCase(mode)) {
logTrace(MODE_PROP + " is set to " + mode
+ ", so tests are running in J2SE environment standalone mode."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public class PersistenceProvider
protected TSLogger logger;

public PersistenceProvider() {
// logger = TSLogger.getInstance();
callLogger("PersistenceProvider.ctor");
}

private void callLogger(String s) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,6 @@ public static EnterpriseArchive createDeploymentVehicle(@ArquillianResource Test
if(warResURL != null) {
jpa_core_annotations_version_pmservlet_vehicle_web.addAsWebInfResource(warResURL, "web.xml");
}
// The sun-web.xml descriptor
warResURL = Client1.class.getResource("//com/sun/ts/tests/common/vehicle/pmservlet/pmservlet_vehicle_web.war.sun-web.xml");
if(warResURL != null) {
jpa_core_annotations_version_pmservlet_vehicle_web.addAsWebInfResource(warResURL, "sun-web.xml");
}

// Any libraries added to the war

Expand All @@ -103,10 +98,6 @@ public static EnterpriseArchive createDeploymentVehicle(@ArquillianResource Test
if(warResURL != null) {
jpa_core_annotations_version_pmservlet_vehicle_web.addAsWebResource(warResURL, "/WEB-INF/lib/jpa_core_annotations_version.jar");
}
warResURL = Client1.class.getResource("/com/sun/ts/tests/common/vehicle/pmservlet/pmservlet_vehicle_web.xml");
if(warResURL != null) {
jpa_core_annotations_version_pmservlet_vehicle_web.addAsWebResource(warResURL, "/WEB-INF/pmservlet_vehicle_web.xml");
}

// Call the archive processor
archiveProcessor.processWebArchive(jpa_core_annotations_version_pmservlet_vehicle_web, Client1.class, warResURL);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
package ee.jakarta.tck.persistence.core.types.generator;

import ee.jakarta.tck.persistence.core.types.generator.Client1;
import java.net.URL;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.container.test.api.OperateOnDeployment;
import org.jboss.arquillian.container.test.api.OverProtocol;
import org.jboss.arquillian.container.test.api.TargetsContainer;
import org.jboss.arquillian.junit5.ArquillianExtension;
import org.jboss.arquillian.test.api.ArquillianResource;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.asset.StringAsset;
import org.jboss.shrinkwrap.api.exporter.ZipExporter;
import org.jboss.shrinkwrap.api.spec.EnterpriseArchive;
import org.jboss.shrinkwrap.api.spec.JavaArchive;
import org.jboss.shrinkwrap.api.spec.WebArchive;
Expand Down Expand Up @@ -90,28 +86,12 @@ public static EnterpriseArchive createDeploymentVehicle(@ArquillianResource Test
if(warResURL != null) {
jpa_core_types_generator_pmservlet_vehicle_web.addAsWebInfResource(warResURL, "web.xml");
}
// The sun-web.xml descriptor
warResURL = Client1.class.getResource("//com/sun/ts/tests/common/vehicle/pmservlet/pmservlet_vehicle_web.war.sun-web.xml");
if(warResURL != null) {
jpa_core_types_generator_pmservlet_vehicle_web.addAsWebInfResource(warResURL, "sun-web.xml");
}

// Any libraries added to the war

// Web content
warResURL = Client1.class.getResource("/com/sun/ts/tests/jpa/core/types/generator/jpa_core_types_generator.jar");
if(warResURL != null) {
jpa_core_types_generator_pmservlet_vehicle_web.addAsWebResource(warResURL, "/WEB-INF/lib/jpa_core_types_generator.jar");
}
warResURL = Client1.class.getResource("/com/sun/ts/tests/common/vehicle/pmservlet/pmservlet_vehicle_web.xml");
if(warResURL != null) {
jpa_core_types_generator_pmservlet_vehicle_web.addAsWebResource(warResURL, "/WEB-INF/pmservlet_vehicle_web.xml");
}

// Call the archive processor
archiveProcessor.processWebArchive(jpa_core_types_generator_pmservlet_vehicle_web, Client1.class, warResURL);


// Par
// the jar with the correct archive name
JavaArchive jpa_core_types_generator = ShrinkWrap.create(JavaArchive.class, "jpa_core_types_generator.jar");
Expand All @@ -123,29 +103,11 @@ public static EnterpriseArchive createDeploymentVehicle(@ArquillianResource Test
ee.jakarta.tck.persistence.core.types.generator.DataTypes4.class
);
// The persistence.xml descriptor
URL parURL = Client1.class.getResource("persistence.xml");
URL parURL = Client1.class.getResource("/ee/jakarta/tck/persistence/common/template/persistence.xml");
if(parURL != null) {
jpa_core_types_generator.addAsManifestResource(parURL, "persistence.xml");
}
// Add the Persistence mapping-file
URL mappingURL = Client1.class.getResource("myMappingFile.xml");
if(mappingURL != null) {
jpa_core_types_generator.addAsResource(mappingURL, "myMappingFile.xml");
}
mappingURL = Client1.class.getResource("myMappingFile1.xml");
if(mappingURL != null) {
jpa_core_types_generator.addAsResource(mappingURL, "myMappingFile1.xml");
}
mappingURL = Client1.class.getResource("myMappingFile2.xml");
if(mappingURL != null) {
jpa_core_types_generator.addAsResource(mappingURL, "myMappingFile2.xml");
}
// Call the archive processor
archiveProcessor.processParArchive(jpa_core_types_generator, Client1.class, parURL);
parURL = Client1.class.getResource("orm.xml");
if(parURL != null) {
jpa_core_types_generator.addAsManifestResource(parURL, "orm.xml");
}


// Ear
EnterpriseArchive jpa_core_types_generator_vehicles_ear = ShrinkWrap.create(EnterpriseArchive.class, "jpa_core_types_generator_vehicles.ear");
Expand All @@ -161,11 +123,6 @@ public static EnterpriseArchive createDeploymentVehicle(@ArquillianResource Test

// The application.xml descriptor
URL earResURL = null;
// The sun-application.xml descriptor
earResURL = Client1.class.getResource("/.ear.sun-application.xml");
if(earResURL != null) {
jpa_core_types_generator_vehicles_ear.addAsManifestResource(earResURL, "sun-application.xml");
}
// Call the archive processor
archiveProcessor.processEarArchive(jpa_core_types_generator_vehicles_ear, Client1.class, earResURL);
return jpa_core_types_generator_vehicles_ear;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,14 @@ public static EnterpriseArchive createDeploymentVehicle(@ArquillianResource Test
}
// Call the archive processor
archiveProcessor.processParArchive(jpa_ee_pluggability_contracts_jta, Client.class, parURL);
// The orm.xml file
// The orm.xml and mapping files
parURL = Client.class.getResource("orm.xml");
if(parURL != null) {
jpa_ee_pluggability_contracts_jta.addAsManifestResource(parURL, "orm.xml");
}
jpa_ee_pluggability_contracts_jta.addAsManifestResource(parURL, "orm.xml");
parURL = Client.class.getResource("myMappingFile1.xml");
jpa_ee_pluggability_contracts_jta.addAsManifestResource(parURL, "myMappingFile1.xml");
parURL = Client.class.getResource("myMappingFile2.xml");
jpa_ee_pluggability_contracts_jta.addAsManifestResource(parURL, "myMappingFile2.xml");

JavaArchive jpa_alternate_provider = ShrinkWrap.create(JavaArchive.class,"jpa_alternate_provider.jar");
jpa_alternate_provider.addClasses(
ee.jakarta.tck.persistence.common.pluggability.altprovider.implementation.CacheImpl.class,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public Client2() {
}


public void setupData(String[] args, Properties p) throws Exception {
public void setup(String[] args, Properties p) throws Exception {
logTrace( "setupData");
try {
super.setup(args,p);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public static void main(String[] args) {
s.exit();
}

public void setupShortData(String[] args, Properties p) throws Exception {
public void setup(String[] args, Properties p) throws Exception {
logTrace( "setupShortData");
try {
super.setup(args,p);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public static void main(String[] args) {
s.exit();
}

public void setupLongData(String[] args, Properties p) throws Exception {
public void setup(String[] args, Properties p) throws Exception {
logTrace( "setupLongData");
try {
super.setup(args,p);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ public static void main(String[] args) {
s.exit();
}


public void setupTimestampData(String[] args, Properties p) throws Exception {
public void setup(String[] args, Properties p) throws Exception {
logTrace( "setupTimestampData");
try {
super.setup(args,p);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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[];
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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[];

Expand Down Expand Up @@ -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[];

Expand Down Expand Up @@ -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[];

Expand Down Expand Up @@ -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";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -47,6 +48,7 @@ public static void main(String[] args) {
*
* @test_Strategy:
*/
@SetupMethod(name = "setupProductData")
public void secondaryTablesValueTest() throws Exception {
boolean pass = false;

Expand Down
Loading
Loading