Skip to content

Commit

Permalink
OLGH20804: Update, fixes for persistence service for JPA 3.1, adding …
Browse files Browse the repository at this point in the history
…JPA 3.1 to persistence service fat.

Signed-off-by: Joe Grassel <jgrassel@us.ibm.com>
  • Loading branch information
jgrassel committed Apr 13, 2022
1 parent fadba93 commit 18b1e32
Show file tree
Hide file tree
Showing 7 changed files with 135 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ IBM-Process-Types: server, \
client
-features=io.openliberty.jakarta.persistence.base-3.1, \
com.ibm.websphere.appserver.eeCompatible-10.0
-bundles=io.openliberty.persistence.3.0.thirdparty; apiJar=false; location:=dev/api/third-party/; mavenCoordinates="org.eclipse.persistence:eclipselink:3.0.0"
-bundles=io.openliberty.persistence.3.1.thirdparty; apiJar=false; location:=dev/api/third-party/; mavenCoordinates="org.eclipse.persistence:eclipselink:3.1.0"
kind=noship
edition=full
WLP-Activation-Type: parallel
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
/*******************************************************************************
* Copyright (c) 2022 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/

package com.ibm.ws.persistence.fat;

import java.io.File;
import java.nio.file.Path;
import java.nio.file.Paths;

import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.runner.RunWith;

import com.ibm.websphere.simplicity.ShrinkHelper;

//import componenttest.custom.junit.runner.OnlyRunInJava7Rule;
import componenttest.annotation.Server;
import componenttest.annotation.TestServlet;
import componenttest.custom.junit.runner.FATRunner;
import componenttest.rules.repeater.JakartaEE9Action;
import componenttest.topology.impl.LibertyServer;
import componenttest.topology.utils.FATServletClient;
import persistence_fat.consumer.web.ConsumerServlet;

@RunWith(FATRunner.class)
public class ConsumerTest_JPA31 extends FATServletClient {
private static final String APP_NAME = "consumer";

private static final String FEATURE_NAME = "com.ibm.ws.persistence.consumer.jakarta-1.0";
private static final String BUNDLE_NAME = "com.ibm.ws.persistence.consumer.jakarta_1.0.0";

@Server("com.ibm.ws.persistence.consumer.jpa31")
@TestServlet(servlet = ConsumerServlet.class, path = APP_NAME)
public static LibertyServer server;

@BeforeClass
public static void beforeClass() throws Exception {
server.installSystemFeature(FEATURE_NAME);
server.copyFileToLibertyInstallRoot("lib/", "bundles/com.ibm.ws.persistence.consumer.jar");
Assert.assertTrue(server.fileExistsInLibertyInstallRoot("lib/com.ibm.ws.persistence.consumer.jar"));

Path someArchive = Paths.get(server.getInstallRoot() + File.separatorChar + "lib" + File.separatorChar + "com.ibm.ws.persistence.consumer.jar");
JakartaEE9Action.transformApp(someArchive);

ShrinkHelper.defaultDropinApp(server, APP_NAME, "persistence_fat.consumer.ejb", "persistence_fat.consumer.model",
"persistence_fat.consumer.web");

Path warArchive = Paths.get(server.getServerRoot() + File.separatorChar + "dropins" + File.separatorChar + APP_NAME + ".war");
JakartaEE9Action.transformApp(warArchive);

server.startServer();
}

@AfterClass
public static void afterClass() throws Exception {
server.stopServer("WTRN0074E");
server.deleteFileFromLibertyInstallRoot("lib/com.ibm.ws.persistence.consumer.jar");
server.uninstallSystemFeature(FEATURE_NAME);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
ConsumerTest_JPA21.class,
ConsumerTest_JPA22.class,
ConsumerTest_JPA30.class,
ConsumerTest_JPA31.class,
})
public class FATSuite {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
bootstrap.include=../testports.properties

com.ibm.ws.logging.trace.specification=persistenceService=all
websphere.java.security.exempt=true
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<entity-mappings xmlns="http://java.sun.com/xml/ns/persistence/orm" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm http://java.sun.com/xml/ns/persistence/orm_2_0.xsd"
version="2.0">

<entity class="persistence_fat.consumer.internal.model.Person">
<table name="PERSON_ORM"/>
</entity>
</entity-mappings>
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<server>
<include location="../fatTestPorts.xml" />

<featureManager>
<feature>servlet-6.0</feature>
<feature>persistence-3.1</feature>
<feature>enterpriseBeansLite-4.0</feature>
<feature>consumer.jakarta-1.0</feature>
<feature>componenttest-2.0</feature>
</featureManager>


<jpa defaultJtaDataSourceJndiName="consumerdsNonTxDs"
defaultNonJtaDataSourceJndiName="consumerdsNonTxDs" />

<jdbcDriver id="derby">
<library>
<fileset dir="${shared.resource.dir}/derby" includes="derby.jar" />
</library>
</jdbcDriver>

<javaPermission codebase="${shared.resource.dir}/derby/derby.jar" className="java.security.AllPermission"/>

<dataSource id="consumerJtaDs" jndiName="consumerJtaDs" jdbcDriverRef="derby">
<properties databaseName="memory:consumer" createDatabase="create" />
</dataSource>
<dataSource id="consumerdsNonTxDs" jndiName="consumerdsNonTxDs" jdbcDriverRef="derby" transactional="false">
<properties databaseName="memory:consumer" createDatabase="create" />
</dataSource>
<dataSource id="privDs" jndiName="privDs" jdbcDriverRef="derby" transactional="false">
<properties databaseName="memory:consumer" createDatabase="create" />
</dataSource>

<consumer inmemMappingFile="inmem-orm.xml" staticMappingFile="static-orm.xml" createTables="true"/>
</server>
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<entity-mappings xmlns="http://java.sun.com/xml/ns/persistence/orm" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm http://java.sun.com/xml/ns/persistence/orm_2_0.xsd"
version="2.0">

<entity class="persistence_fat.consumer.internal.model.Person">
<attributes>
<basic name="firstName">
<column name="FIRST_NAME" />
</basic>
<basic name="lastName">
<column name="LAST_NAME" />
</basic>
</attributes>
</entity>
</entity-mappings>

0 comments on commit 18b1e32

Please sign in to comment.