Skip to content

Add persistence.xml 3.1 schema support #1490

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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 @@ -14,8 +14,8 @@

<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_0.xsd"
version="3.0">
xsi:schemaLocation="https://jakarta.ee/xml/ns/persistence https://jakarta.ee/xml/ns/persistence/persistence_3_1.xsd"
version="3.1">
<persistence-unit name="beanvalidation" transaction-type="RESOURCE_LOCAL">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
<class>org.eclipse.persistence.testing.models.jpa.beanvalidation.Employee</class>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@

<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_0.xsd"
version="3.0">
xsi:schemaLocation="https://jakarta.ee/xml/ns/persistence https://jakarta.ee/xml/ns/persistence/persistence_3_1.xsd"
version="3.1">
<persistence-unit name="@default@" transaction-type="@transaction-type@">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
<@datasource-type@>@data-source-name@</@datasource-type@>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,36 +65,40 @@ public static void prepare() throws IOException {
@Test
public void testProc() throws Exception {
testProc("testProc3030", PXML30, OXML30);
testProc("testProc3031", PXML30, OXML31);
testProc("testProc3131", PXML31, OXML31);
}

@Test
public void testGenerateComment() throws Exception {
testGenerateComment("testGenerateComment3030", PXML30, OXML30);
testGenerateComment("testGenerateComment3031", PXML30, OXML31);
testGenerateComment("testGenerateComment3131", PXML31, OXML31);
}

@Test
public void testGenerate() throws Exception {
testGenerate("testGenerate3030", PXML30, OXML30);
testGenerate("testGenerate3031", PXML30, OXML31);
testGenerate("testGenerate3131", PXML31, OXML31);
}

@Test
public void testTypeUse() throws Exception {
testTypeUse("testTypeUse3030", PXML30, OXML30);
testTypeUse("testTypeUse3031", PXML30, OXML31);
testTypeUse("testTypeUse3131", PXML31, OXML31);
}

@Test
public void testProcessorLoggingOffFromCmdLine() throws Exception {
verifyLogging("testProcessorLoggingOffFromCmdLine", PXML30, false,
verifyLogging("testProcessorLoggingOffFromCmdLine30", PXML30, false,
"-Aeclipselink.logging.level.processor=OFF");
verifyLogging("testProcessorLoggingOffFromCmdLine31", PXML31, false,
"-Aeclipselink.logging.level.processor=OFF");
}

@Test
public void testGlobalLoggingOffFromCmdLine() throws Exception {
verifyLogging("testGlobalLoggingOffFromCmdLine", PXML30, false,
verifyLogging("testGlobalLoggingOffFromCmdLine30", PXML30, false,
"-Aeclipselink.logging.level=OFF");
verifyLogging("testGlobalLoggingOffFromCmdLine31", PXML31, false,
"-Aeclipselink.logging.level=OFF");
}

Expand All @@ -116,13 +120,17 @@ public void testGlobalLoggingOffFromPU() throws Exception {

@Test
public void testProcessorLoggingFinestFromCmdLine() throws Exception {
verifyLogging("testProcessorLoggingFinestFromCmdLine", PXML30, true,
verifyLogging("testProcessorLoggingFinestFromCmdLine30", PXML30, true,
"-Aeclipselink.logging.level.processor=FINEST");
verifyLogging("testProcessorLoggingFinestFromCmdLine31", PXML31, true,
"-Aeclipselink.logging.level.processor=FINEST");
}

@Test
public void testGlobalLoggingFinestFromCmdLine() throws Exception {
verifyLogging("testGlobalLoggingFinestFromCmdLine", PXML30, true,
verifyLogging("testGlobalLoggingFinestFromCmdLine30", PXML30, true,
"-Aeclipselink.logging.level=FINEST");
verifyLogging("testGlobalLoggingFinestFromCmdLine31", PXML31, true,
"-Aeclipselink.logging.level=FINEST");
}

Expand Down Expand Up @@ -355,6 +363,19 @@ private static class Result {
" </persistence-unit>\n" +
"</persistence>";

private static final String PXML31 = "<persistence xmlns=\"https://jakarta.ee/xml/ns/persistence\"\n" +
" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n" +
" xsi:schemaLocation=\"https://jakarta.ee/xml/ns/persistence\n" +
" https://jakarta.ee/xml/ns/persistence/persistence_3_1.xsd\"\n" +
" version=\"3.1\">\n" +
" <persistence-unit name=\"sample-pu\" transaction-type=\"RESOURCE_LOCAL\">\n" +
" <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>\n" +
" <exclude-unlisted-classes>false</exclude-unlisted-classes>\n" +
" <properties>\n" +
" </properties>\n" +
" </persistence-unit>\n" +
"</persistence>";

private static final String OXML30 = "<entity-mappings xmlns=\"https://jakarta.ee/xml/ns/persistence/orm\"\n" +
" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n" +
" xsi:schemaLocation=\"https://jakarta.ee/xml/ns/persistence/orm https://jakarta.ee/xml/ns/persistence/orm/orm_3_0.xsd\"\n" +
Expand Down
Loading