Skip to content

Commit

Permalink
fix test failures, update tck bundle with pom. (jakartaee#1249)
Browse files Browse the repository at this point in the history
Signed-off-by: Gurunandan Rao <[email protected]>
  • Loading branch information
gurunrao authored Mar 11, 2024
1 parent 40d2ac2 commit 553a6ee
Show file tree
Hide file tree
Showing 13 changed files with 386 additions and 123 deletions.
138 changes: 97 additions & 41 deletions jpa/bin/pom.xml

Large diffs are not rendered by default.

12 changes: 12 additions & 0 deletions jpa/common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,18 @@
</parent>
<artifactId>persistence-tck-common</artifactId>
<packaging>jar</packaging>
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>runtime</artifactId>
<version>11.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>libutil</artifactId>
<version>11.0.0-SNAPSHOT</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
Expand Down
25 changes: 13 additions & 12 deletions jpa/docs/userguide/src/main/jbake/content/config.inc
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,12 @@ slashes as a path separator instead.
and `M2_HOME/bin`
2. set the following system properties:
a. Set `jpa.classes` to include all of the necessary JAR files that
pertain to your implementation.
pertain to your implementation using comma separator in the TCK runner.
b. Set `jdbc.lib.classpath` to the location where the JDBC drivers are
installed.
c. Set `jdbc.db` to the name of the database under test. Valid values
installed using comma separator in the TCK runner.
c. Set `jdbc.driver.classes` to the location where the JDBC drivers are
installed using CLASSPATH separator in the TCK runner.
d. Set `jdbc.db` to the name of the database under test. Valid values
include:
+
--
Expand All @@ -62,23 +64,23 @@ postgresql
----
--
+
d. Set `jakarta.persistence.provider`, `jakarta.persistence.jdbc.driver`,
e. Set `jakarta.persistence.provider`, `jakarta.persistence.jdbc.driver`,
`jakarta.persistence.jdbc.url`, `jakarta.persistence.jdbc.user`, and
`jakarta.persistence.jdbc.password` to the appropriate values for the
database and persistence provider under test. +
These properties are passed to the Persistence provider during the
creation of the `EntityManagerFactory`. Any additional values, for
example setting an implementation's logging level, must be set by
following the instructions in Step 2e.
e. Set the `jpa.provider.implementation.specific.properties` property
f. Set the `jpa.provider.implementation.specific.properties` property
to include any implementation-specific settings that need to be passed
to the provider when the `EntityManagerFactory` is created.
f. Set `sigTestClasspath` to include any additional classes not
g. Set `sigTestClasspath` to include any additional classes not
specified with the `jpa.classes` property.
g. Set db.supports.sequence to false if the database does not support
h. Set db.supports.sequence to false if the database does not support
the use of SEQUENCE. +
The default value is true.
h. Set `persistence.second.level.caching.supported` to false if your
i. Set `persistence.second.level.caching.supported` to false if your
persistence provider does not support second level caching. +
The default value is true.
+
Expand All @@ -89,10 +91,9 @@ postgresql
Considerations for MS SQL Server,"] and proceed to Step 4.
+
4. Start the database under test.
5. Initialize the database under test. +
Execute following SQL scripts for database initilization:
a. <db-name>.ddl.persistence.sql
b. <db-name>.ddl.persistence.sprocs.sql
5. Initialize the database under test. Execute following SQL scripts for database initilization:
a. <jdbc.db>.ddl.persistence.sql
b. <jdbc.db>.ddl.persistence.sprocs.sql


[[GCLHU]][[configuring-your-environment-to-repackage-and-run-the-tck-against-the-vendor-implementation]]
Expand Down
4 changes: 2 additions & 2 deletions jpa/docs/userguide/src/main/jbake/content/install.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ Download and install the Java SE {SEversion} software from
http://www.oracle.com/technetwork/java/javase/downloads/index.html.
Refer to the installation instructions that accompany the software for
additional information.
. Install the Apache Maven {MAvenVersion} software, if it is not already installed. +
Download and install Apache MAven {AntVersion} software from Apache Maven
. Install the Apache Maven {MavenVersion} software, if it is not already installed. +
Download and install Apache MAven {MavenVersion} software from Apache Maven
Project.
. Install the {TechnologyShortName} TCK {TechnologyVersion} software.
a. Copy or download the {TechnologyShortName} TCK software to your
Expand Down
7 changes: 3 additions & 4 deletions jpa/docs/userguide/src/main/jbake/content/tck-packages.inc
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
** JDOM 1.1.3
** dbprocedures

** Apache Commons HTTP Client 3.1
** persistence-tck-common

** Apache Commons Logging 1.1.3
** persistence-tck-spec-tests

** Apache Commons Codec 1.9
5 changes: 2 additions & 3 deletions jpa/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
<groupId>jakarta.tck</groupId>
<artifactId>project</artifactId>
<version>11.0.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>persistence-tck</artifactId>
<version>3.2.0</version>
Expand Down Expand Up @@ -51,12 +50,12 @@
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>libutil</artifactId>
<artifactId>runtime</artifactId>
<version>11.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>runtime</artifactId>
<artifactId>libutil</artifactId>
<version>11.0.0-SNAPSHOT</version>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
/*
* Copyright (c) 2007, 2023 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
* http://www.eclipse.org/legal/epl-2.0.
*
* This Source Code may also be made available under the following Secondary
* Licenses when the conditions for such availability set forth in the
* Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
* version 2 with the GNU Classpath Exception, which is available at
* https://www.gnu.org/software/classpath/license.html.
*
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
*/

package ee.jakarta.tck.persistence.se.entityManagerFactory;

import java.lang.System.Logger;
import java.util.Properties;

import org.jboss.shrinkwrap.api.spec.JavaArchive;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

import ee.jakarta.tck.persistence.common.PMClientBase;

import jakarta.persistence.EntityManager;
import jakarta.persistence.EntityManagerFactory;
import jakarta.persistence.Persistence;
import jakarta.persistence.PersistenceException;

public class Client1 extends PMClientBase {

private static final Logger logger = (Logger) System.getLogger(Client1.class.getName());

Properties props = null;

public Client1() {
}

public JavaArchive createDeployment() throws Exception {

String pkgNameWithoutSuffix = Client1.class.getPackageName();
String pkgName = pkgNameWithoutSuffix + ".";
String[] classes = { pkgName + "Member", pkgName + "Member_", pkgName + "Order", pkgName + "Order_" };
return createDeploymentJar("jpa_se_entityManagerFactory.jar", pkgNameWithoutSuffix, (String[]) classes);

}

@BeforeEach
public void setupNoData() throws Exception {
logger.log(Logger.Level.TRACE, "setupNoData");
try {
super.setup();
createDeployment();
} catch (Exception e) {
logger.log(Logger.Level.ERROR, "Exception: ", e);
throw new Exception("Setup failed:", e);
}
}

@AfterEach
public void cleanupNoData() throws Exception {
try {
super.cleanup();
} finally {
removeTestJarFromCP();
}
}

/*
* @testName: getMetamodelIllegalStateExceptionTest
*
* @assertion_ids: PERSISTENCE:JAVADOC:536;
*
* @test_Strategy: Close the EntityManagerFactory, then call emf.getMetaModel()
*/
@Test
public void getMetamodelIllegalStateExceptionTest() throws Exception {
boolean pass = false;
try {
EntityManagerFactory emf = getEntityManager().getEntityManagerFactory();
emf.close();
try {
emf.getMetamodel();
logger.log(Logger.Level.ERROR, "IllegalStateException not thrown");
} catch (IllegalStateException ise) {
logger.log(Logger.Level.TRACE, "Received expected IllegalStateException");
pass = true;
}

} catch (Exception e) {
logger.log(Logger.Level.ERROR, "Unexpected exception occurred", e);
}
if (!pass) {
throw new Exception("getMetamodelIllegalStateExceptionTest failed");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,18 @@
import jakarta.persistence.Persistence;
import jakarta.persistence.PersistenceException;

public class Client extends PMClientBase {
public class Client2 extends PMClientBase {

private static final Logger logger = (Logger) System.getLogger(Client.class.getName());
private static final Logger logger = (Logger) System.getLogger(Client2.class.getName());

Properties props = null;

public Client() {
public Client2() {
}

public JavaArchive createDeployment() throws Exception {

String pkgNameWithoutSuffix = Client.class.getPackageName();
String pkgNameWithoutSuffix = Client2.class.getPackageName();
String pkgName = pkgNameWithoutSuffix + ".";
String[] classes = { pkgName + "Member", pkgName + "Member_", pkgName + "Order", pkgName + "Order_" };
return createDeploymentJar("jpa_se_entityManagerFactory.jar", pkgNameWithoutSuffix, (String[]) classes);
Expand All @@ -62,43 +62,13 @@ public void setupNoData() throws Exception {
}

@AfterEach
public void cleanupNoData() throws Exception {
public void cleanup() throws Exception {
try {
super.cleanup();
} finally {
removeTestJarFromCP();
}
}

/*
* @testName: getMetamodelIllegalStateExceptionTest
*
* @assertion_ids: PERSISTENCE:JAVADOC:536;
*
* @test_Strategy: Close the EntityManagerFactory, then call emf.getMetaModel()
*/
@Test
public void getMetamodelIllegalStateExceptionTest() throws Exception {
boolean pass = false;
try {
EntityManagerFactory emf = getEntityManager().getEntityManagerFactory();
emf.close();
try {
emf.getMetamodel();
logger.log(Logger.Level.ERROR, "IllegalStateException not thrown");
} catch (IllegalStateException ise) {
logger.log(Logger.Level.TRACE, "Received expected IllegalStateException");
pass = true;
}

} catch (Exception e) {
logger.log(Logger.Level.ERROR, "Unexpected exception occurred", e);
}
if (!pass) {
throw new Exception("getMetamodelIllegalStateExceptionTest failed");
}
}

/*
* @testName: createEntityManagerFactoryNoBeanValidatorTest
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ protected String[] getPackages() {
/*
* @testName: signatureTest
*
* @assertion: An EL container must implement the required classes and APIs
* specified in the EL Specification.
* @assertion: An persistence container must implement the required classes and APIs
* specified in the persistence Specification.
*
* @test_Strategy: Using reflection, gather the implementation specific
* classes and APIs. Compare these results with the expected (required)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ meth public abstract !hasdefault boolean updatable()
meth public abstract !hasdefault int length()
meth public abstract !hasdefault int precision()
meth public abstract !hasdefault int scale()
meth public abstract !hasdefault int secondPrecision()
meth public abstract !hasdefault jakarta.persistence.CheckConstraint[] check()
meth public abstract !hasdefault java.lang.String columnDefinition()
meth public abstract !hasdefault java.lang.String comment()
Expand Down Expand Up @@ -376,10 +377,12 @@ meth public abstract java.lang.Class<?> entityClass()
CLSS public abstract interface jakarta.persistence.EntityTransaction
meth public abstract boolean getRollbackOnly()
meth public abstract boolean isActive()
meth public abstract java.lang.Integer getTimeout()
meth public abstract void begin()
meth public abstract void commit()
meth public abstract void rollback()
meth public abstract void setRollbackOnly()
meth public abstract void setTimeout(java.lang.Integer)

CLSS public final !enum jakarta.persistence.EnumType
fld public final static jakarta.persistence.EnumType ORDINAL
Expand Down Expand Up @@ -2157,9 +2160,11 @@ meth public abstract java.lang.ClassLoader getNewTempClassLoader()
meth public abstract java.lang.String getPersistenceProviderClassName()
meth public abstract java.lang.String getPersistenceUnitName()
meth public abstract java.lang.String getPersistenceXMLSchemaVersion()
meth public abstract java.lang.String getScopeAnnotationName()
meth public abstract java.net.URL getPersistenceUnitRootUrl()
meth public abstract java.util.List<java.lang.String> getManagedClassNames()
meth public abstract java.util.List<java.lang.String> getMappingFileNames()
meth public abstract java.util.List<java.lang.String> getQualifierAnnotationNames()
meth public abstract java.util.List<java.net.URL> getJarFileUrls()
meth public abstract java.util.Properties getProperties()
meth public abstract javax.sql.DataSource getJtaDataSource()
Expand Down
58 changes: 58 additions & 0 deletions jpa/tck-dist/artifact-install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
#!/usr/bin/env bash
#
# Copyright (c) 2024 Oracle and/or its affiliates. All rights reserved.
#
# This program and the accompanying materials are made available under the
# terms of the Eclipse Public License v. 2.0, which is available at
# http://www.eclipse.org/legal/epl-2.0.
#
# This Source Code may also be made available under the following Secondary
# Licenses when the conditions for such availability set forth in the
# Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
# version 2 with the GNU Classpath Exception, which is available at
# https://www.gnu.org/software/classpath/license.html.
#
# SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
#

##script to install the artifact directory contents into a local maven repository

if [[ $1 =~ ^[0-9]+\.[0-9]+\.[0-9]+.*$ ]]; then
VERSION="$1"
else
VERSION="3.2.0"
fi

JAKARTAEE_VERSION="11.0.0-SNAPSHOT"


# dbprocedures jar
mvn org.apache.maven.plugins:maven-install-plugin:3.1.1:install-file \
-Dfile=dbprocedures-$VERSION.jar -DgroupId=jakarta.tck -DartifactId=dbprocedures \
-Dversion=$VERSION -Dpackaging=jar

# persistence-tck pom
mvn org.apache.maven.plugins:maven-install-plugin:3.1.1:install-file \
-Dfile=persistence-tck-$VERSION.pom -DgroupId=jakarta.tck -DartifactId=persistence-tck \
-Dversion=$VERSION -Dpackaging=pom

# persistence-tck-common jar
mvn org.apache.maven.plugins:maven-install-plugin:3.1.1:install-file \
-Dfile=persistence-tck-common-$VERSION.jar -DgroupId=jakarta.tck -DartifactId=persistence-tck-common \
-Dversion=$VERSION -Dpackaging=jar

# persistence-tck-common pom
mvn org.apache.maven.plugins:maven-install-plugin:3.1.1:install-file \
-Dfile=persistence-tck-common-$VERSION.pom -DgroupId=jakarta.tck -DartifactId=persistence-tck-common \
-Dversion=$VERSION -Dpackaging=pom


# persistence-tck-spec-tests jar
mvn org.apache.maven.plugins:maven-install-plugin:3.1.1:install-file \
-Dfile=persistence-tck-spec-tests-$VERSION.jar -DgroupId=jakarta.tck -DartifactId=persistence-tck-spec-tests \
-Dversion=$VERSION -Dpackaging=jar

# persistence-tck-spec-tests pom
mvn org.apache.maven.plugins:maven-install-plugin:3.1.1:install-file \
-Dfile=persistence-tck-spec-tests-$VERSION.pom -DgroupId=jakarta.tck -DartifactId=persistence-tck-spec-tests \
-Dversion=$VERSION -Dpackaging=pom
Loading

0 comments on commit 553a6ee

Please sign in to comment.