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

Jakarta Data recreates for Eclipselink issues #29132

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
f2903bd
Setup Jakarta Data recreates for Eclipselink
KyleAure Jul 19, 2024
8ede48f
Recreate https://github.com/OpenLiberty/open-liberty/issues/28912
KyleAure Jul 19, 2024
152f15d
Recreate https://github.com/OpenLiberty/open-liberty/issues/28913
KyleAure Jul 19, 2024
4535029
Recreate https://github.com/OpenLiberty/open-liberty/issues/28908
KyleAure Jul 19, 2024
31ee7b2
Recreate https://github.com/OpenLiberty/open-liberty/issues/28874
KyleAure Jul 19, 2024
1f247d5
Recreate https://github.com/OpenLiberty/open-liberty/issues/28920
KyleAure Jul 22, 2024
fb4dc37
Recreate https://github.com/OpenLiberty/open-liberty/issues/28909
KyleAure Jul 22, 2024
8f08689
Recreate https://github.com/OpenLiberty/open-liberty/issues/28931
KyleAure Jul 22, 2024
aaa483c
Recreate https://github.com/OpenLiberty/open-liberty/issues/28925
KyleAure Jul 22, 2024
e69e82c
recreate https://github.com/OpenLiberty/open-liberty/issues/29117
KyleAure Jul 23, 2024
099ef64
Recreate https://github.com/OpenLiberty/open-liberty/issues/28545
KyleAure Jul 23, 2024
29a9403
Recreate https://github.com/OpenLiberty/open-liberty/issues/29073
KyleAure Jul 23, 2024
1febfef
recreate https://github.com/OpenLiberty/open-liberty/issues/28368
KyleAure Jul 24, 2024
c272791
Recrate https://github.com/OpenLiberty/open-liberty/issues/28813
KyleAure Jul 24, 2024
e4ef7e8
recreate https://github.com/OpenLiberty/open-liberty/issues/28928
KyleAure Jul 24, 2024
fcdc04f
recreate https://github.com/OpenLiberty/open-liberty/issues/28589
KyleAure Jul 24, 2024
e24dcc8
recreate https://github.com/OpenLiberty/open-liberty/issues/24926
KyleAure Jul 24, 2024
0c501ce
Recreate https://github.com/OpenLiberty/open-liberty/issues/28737
KyleAure Jul 25, 2024
df7879a
Recreate https://github.com/OpenLiberty/open-liberty/issues/28289
KyleAure Jul 25, 2024
1483d53
Recreate https://github.com/OpenLiberty/open-liberty/issues/28078
KyleAure Jul 25, 2024
9e985f8
Recreate https://github.com/OpenLiberty/open-liberty/issues/27696
KyleAure Jul 25, 2024
7c7a3fe
Recreate https://github.com/OpenLiberty/open-liberty/issues/28905
KyleAure Jul 25, 2024
5a535f1
Recreate https://github.com/OpenLiberty/open-liberty/issues/28898
KyleAure Jul 25, 2024
e1df58c
recreate https://github.com/OpenLiberty/open-liberty/issues/28895
KyleAure Jul 25, 2024
3b02d05
Fixes
KyleAure Jul 25, 2024
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
1 change: 1 addition & 0 deletions dev/com.ibm.ws.jpa.tests.jpa_32_fat/.classpath
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<classpathentry kind="src" path="fat/src"/>
<classpathentry kind="src" path="test-applications/jpabootstrap/src"/>
<classpathentry kind="src" path="test-applications/helpers/DatabaseManagement/src"/>
<classpathentry kind="src" path="test-applications/jakartadata/src"/>
<classpathentry kind="con" path="aQute.bnd.classpath.container"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-17">
<attributes>
Expand Down
3 changes: 2 additions & 1 deletion dev/com.ibm.ws.jpa.tests.jpa_32_fat/bnd.bnd
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ bVersion=1.0
src: \
fat/src,\
test-applications/helpers/DatabaseManagement/src,\
test-applications/jpabootstrap/src
test-applications/jpabootstrap/src,\
test-applications/jakartadata/src

fat.project: true
tested.features: databaseRotation, persistence-3.2, persistencecontainer-3.2, servlet-6.1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import org.testcontainers.containers.JdbcDatabaseContainer;

import com.ibm.ws.jpa.jpa32.JPABootstrapTest;
import com.ibm.ws.jpa.jpa32.JakartaDataRecreateTest;

import componenttest.containers.TestContainerSuite;
import componenttest.rules.repeater.RepeatTests;
Expand All @@ -28,6 +29,7 @@
@RunWith(Suite.class)
@SuiteClasses({
JPABootstrapTest.class,
JakartaDataRecreateTest.class,
componenttest.custom.junit.runner.AlwaysPassesTest.class
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.testcontainers.containers.JdbcDatabaseContainer;

Expand Down Expand Up @@ -91,14 +90,4 @@ public static void tearDown() throws Exception {
server1.stopServer("CWWJP9991W",
"Missing PostgreSQL10JsonPlatform"); // Generated with postgres db, since we don't include the postgres plugin);
}

@Test
public void testJPA32Bootstrap() throws Exception {
runTest(SPECLEVEL);
}

private void runTest(String spec) throws Exception {
FATServletClient.runTest(server1, APP_NAME + "_" + spec + "/TestJPABootstrap", "testPersistenceUnitBootstrap");

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
/*******************************************************************************
* Copyright (c) 2024 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*******************************************************************************/
package com.ibm.ws.jpa.jpa32;

import org.jboss.shrinkwrap.api.Filters;
import org.jboss.shrinkwrap.api.GenericArchive;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.importer.ExplodedImporter;
import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.runner.RunWith;
import org.testcontainers.containers.JdbcDatabaseContainer;

import com.ibm.websphere.simplicity.ShrinkHelper;
import com.ibm.ws.jpa.FATSuite;

import componenttest.annotation.MinimumJavaLevel;
import componenttest.annotation.Server;
import componenttest.annotation.TestServlet;
import componenttest.custom.junit.runner.FATRunner;
import componenttest.topology.database.container.DatabaseContainerType;
import componenttest.topology.database.container.DatabaseContainerUtil;
import componenttest.topology.impl.LibertyServer;
import componenttest.topology.utils.PrivHelper;
import io.openliberty.jpa.data.tests.web.JakartaDataRecreateServlet;

/**
* Recreate issues found during development of Jakarta Data with EclipseLink
* using pure Jakarta Persistence.
*
* These tests should be contributed back to EclipseLink as these issues are resovled.
*/
@RunWith(FATRunner.class)
@MinimumJavaLevel(javaLevel = 17)
public class JakartaDataRecreateTest {
public static final String APP_NAME = "jakartadata";
public static final String SERVLET = "JakartaDataRecreate";
public static final String SPECLEVEL = "3.2";

@Server("JakartaDataRecreateServer")
@TestServlet(servlet = JakartaDataRecreateServlet.class, path = APP_NAME + "_" + SPECLEVEL + "/" + SERVLET)
public static LibertyServer server;

public static final JdbcDatabaseContainer<?> testContainer = FATSuite.testContainer;

@BeforeClass
public static void setUp() throws Exception {
PrivHelper.generateCustomPolicy(server, PrivHelper.JAXB_PERMISSION);

//Get driver name
server.addEnvVar("DB_DRIVER", DatabaseContainerType.valueOf(testContainer).getDriverName());

//Setup server DataSource properties
DatabaseContainerUtil.setupDataSourceProperties(server, testContainer);

createApplication(SPECLEVEL);
server.startServer();
}

private static void createApplication(String specLevel) throws Exception {
final String resPath = "test-applications/" + APP_NAME + "/resources/jpa-" + specLevel + "/web/";

WebArchive app = ShrinkWrap.create(WebArchive.class, APP_NAME + "_" + specLevel + ".war");
app.addPackage("io.openliberty.jpa.data.tests.models");
app.addPackage("io.openliberty.jpa.data.tests.web");
app.merge(ShrinkWrap.create(GenericArchive.class).as(ExplodedImporter.class).importDirectory(resPath).as(GenericArchive.class),
"/",
Filters.includeAll());
ShrinkHelper.exportDropinAppToServer(server, app);
}

@AfterClass
public static void tearDown() throws Exception {
server.stopServer("CWWJP9991W",
"WTRN0074E: Exception caught from before_completion synchronization operation", // RuntimeException test, expected
"Missing PostgreSQL10JsonPlatform"); // Generated with postgres db, since we don't include the postgres plugin);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
###############################################################################
bootstrap.include=../testports.properties
# Test requires JPA trace to be enabled, do not disable!
traceSpecification=JPA=all
com.ibm.ws.logging.trace.specification==JPA=all
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
###############################################################################
# Copyright (c) 2024 IBM Corporation and others.
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License 2.0
# which accompanies this distribution, and is available at
# http://www.eclipse.org/legal/epl-2.0/
#
# SPDX-License-Identifier: EPL-2.0
#
# Contributors:
# IBM Corporation - initial API and implementation
###############################################################################
bootstrap.include=../testports.properties
# Test requires JPA trace to be enabled, do not disable!
com.ibm.ws.logging.trace.specification=*=info:JPA=all:eclipselink=all
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<!--
Copyright (c) 2024 IBM Corporation and others.
All rights reserved. This program and the accompanying materials
are made available under the terms of the Eclipse Public License 2.0
which accompanies this distribution, and is available at
http://www.eclipse.org/legal/epl-2.0/

SPDX-License-Identifier: EPL-2.0
-->
<server description="new server">

<featureManager>
<feature>persistence-3.2</feature>
<feature>servlet-6.1</feature>
<!-- DO NOT ADD data-1.0 feature -->
<feature>componenttest-2.0</feature>
</featureManager>

<include location="../fatTestPorts.xml"/>
<dataSource id="DefaultDataSource" fat.modify="true">
<jdbcDriver libraryRef="JDBCLib"/>
<properties.derby.embedded databaseName="memory:ds1" createDatabase="create" user="dbuser1" password="{xor}Oz0vKDtu" />
</dataSource>

<library id="JDBCLib">
<fileset dir="${shared.resource.dir}/jdbc" includes="${env.DB_DRIVER}"/>
</library>

<!-- JDBC driver -->
<javaPermission codebase="${shared.resource.dir}/jdbc/${env.DB_DRIVER}" className="java.security.AllPermission"/>

<!-- Permission needed for Postgres driver -->
<javaPermission className="java.util.PropertyPermission" name="org.postgresql.forceBinary" actions="read"/>

<!-- Permission needed for SQLServer driver -->
<javaPermission className="java.net.SocketPermission" name="*" actions="connect,resolve"/>

<!-- Permission needed for Oracle driver -->
<javaPermission className="java.lang.RuntimePermission" name="accessDeclaredMembers" />

<!-- File read write permissions -->
<javaPermission className="java.util.PropertyPermission" name="user.dir" actions="read"/>
<javaPermission className="java.io.FilePermission" name="files/timertestoutput.txt" actions="read,write"/>
<javaPermission className="java.io.FilePermission" name="files" actions="write"/>

</server>
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/*******************************************************************************
* Copyright (c) 2024 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
-->
<persistence xmlns="https://jakarta.ee/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://jakarta.ee/xml/ns/persistence https://jakarta.ee/xml/ns/persistence/persistence_3_2.xsd"
version="3.2">

<persistence-unit name="RecreatePersistenceUnit">
<properties>
<!-- EclipseLink should create the database schema automatically -->
<property name="jakarta.persistence.schema-generation.database.action" value="create" />
<property name="eclipselink.logging.parameters" value="true"/>
</properties>
</persistence-unit>
</persistence>
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*******************************************************************************
* Copyright (c) 2024 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*******************************************************************************/
package io.openliberty.jpa.data.tests.models;

import jakarta.persistence.EmbeddedId;
import jakarta.persistence.Entity;

/**
* Recreate from io.openliberty.data.internal_fat_jpa
*/
@Entity
public class Account {

@EmbeddedId
public AccountId accountId;

public double balance;

public String bankName;

public boolean checking;

public String owner;

public static Account of(long accountNum, long routingNum, String bankName, boolean checking, double balance, String owner) {
Account inst = new Account();
inst.accountId = AccountId.of(accountNum, routingNum);
inst.bankName = bankName;
inst.checking = checking;
inst.balance = balance;
inst.owner = owner;
return inst;
}

@Override
public String toString() {
return bankName + ' ' + accountId + " $" + balance + " owned by " + owner + (checking ? " with checking" : "");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*******************************************************************************
* Copyright (c) 2024 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*******************************************************************************/
package io.openliberty.jpa.data.tests.models;

import jakarta.persistence.Embeddable;

@Embeddable
public class AccountId {

public long accountNum;
public long routingNum;

public AccountId() {
}

public AccountId(long accountNum, long routingNum) {
this.accountNum = accountNum;
this.routingNum = routingNum;
}

public static AccountId of(long accountNum, long routingNum) {
return new AccountId(accountNum, routingNum);
}

@Override
public String toString() {
return "AccountId:" + accountNum + ":" + routingNum;
}
}
Loading