Skip to content

Commit 0920483

Browse files
committed
Add persistence.xml 3.1 schema support
Signed-off-by: Will Dazey <[email protected]>
1 parent f772522 commit 0920483

File tree

4 files changed

+375
-12
lines changed

4 files changed

+375
-12
lines changed

jpa/eclipselink.jpa.test/src/it/resources/eclipselink-beanvalidation-model/persistence.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414

1515
<persistence xmlns="https://jakarta.ee/xml/ns/persistence"
1616
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
17-
xsi:schemaLocation="https://jakarta.ee/xml/ns/persistence https://jakarta.ee/xml/ns/persistence/persistence_3_0.xsd"
18-
version="3.0">
17+
xsi:schemaLocation="https://jakarta.ee/xml/ns/persistence https://jakarta.ee/xml/ns/persistence/persistence_3_1.xsd"
18+
version="3.1">
1919
<persistence-unit name="beanvalidation" transaction-type="RESOURCE_LOCAL">
2020
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
2121
<class>org.eclipse.persistence.testing.models.jpa.beanvalidation.Employee</class>

jpa/eclipselink.jpa.test/src/it/resources/eclipselink-beanvalidation-model/server/persistence.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414

1515
<persistence xmlns="https://jakarta.ee/xml/ns/persistence"
1616
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
17-
xsi:schemaLocation="https://jakarta.ee/xml/ns/persistence https://jakarta.ee/xml/ns/persistence/persistence_3_0.xsd"
18-
version="3.0">
17+
xsi:schemaLocation="https://jakarta.ee/xml/ns/persistence https://jakarta.ee/xml/ns/persistence/persistence_3_1.xsd"
18+
version="3.1">
1919
<persistence-unit name="@default@" transaction-type="@transaction-type@">
2020
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
2121
<@datasource-type@>@data-source-name@</@datasource-type@>

jpa/org.eclipse.persistence.jpa.modelgen/src/test/java/org/eclipse/persistence/jpa/test/modelgen/TestProcessor.java

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -65,36 +65,40 @@ public static void prepare() throws IOException {
6565
@Test
6666
public void testProc() throws Exception {
6767
testProc("testProc3030", PXML30, OXML30);
68-
testProc("testProc3031", PXML30, OXML31);
68+
testProc("testProc3131", PXML31, OXML31);
6969
}
7070

7171
@Test
7272
public void testGenerateComment() throws Exception {
7373
testGenerateComment("testGenerateComment3030", PXML30, OXML30);
74-
testGenerateComment("testGenerateComment3031", PXML30, OXML31);
74+
testGenerateComment("testGenerateComment3131", PXML31, OXML31);
7575
}
7676

7777
@Test
7878
public void testGenerate() throws Exception {
7979
testGenerate("testGenerate3030", PXML30, OXML30);
80-
testGenerate("testGenerate3031", PXML30, OXML31);
80+
testGenerate("testGenerate3131", PXML31, OXML31);
8181
}
8282

8383
@Test
8484
public void testTypeUse() throws Exception {
8585
testTypeUse("testTypeUse3030", PXML30, OXML30);
86-
testTypeUse("testTypeUse3031", PXML30, OXML31);
86+
testTypeUse("testTypeUse3131", PXML31, OXML31);
8787
}
8888

8989
@Test
9090
public void testProcessorLoggingOffFromCmdLine() throws Exception {
91-
verifyLogging("testProcessorLoggingOffFromCmdLine", PXML30, false,
91+
verifyLogging("testProcessorLoggingOffFromCmdLine30", PXML30, false,
92+
"-Aeclipselink.logging.level.processor=OFF");
93+
verifyLogging("testProcessorLoggingOffFromCmdLine31", PXML31, false,
9294
"-Aeclipselink.logging.level.processor=OFF");
9395
}
9496

9597
@Test
9698
public void testGlobalLoggingOffFromCmdLine() throws Exception {
97-
verifyLogging("testGlobalLoggingOffFromCmdLine", PXML30, false,
99+
verifyLogging("testGlobalLoggingOffFromCmdLine30", PXML30, false,
100+
"-Aeclipselink.logging.level=OFF");
101+
verifyLogging("testGlobalLoggingOffFromCmdLine31", PXML31, false,
98102
"-Aeclipselink.logging.level=OFF");
99103
}
100104

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

117121
@Test
118122
public void testProcessorLoggingFinestFromCmdLine() throws Exception {
119-
verifyLogging("testProcessorLoggingFinestFromCmdLine", PXML30, true,
123+
verifyLogging("testProcessorLoggingFinestFromCmdLine30", PXML30, true,
124+
"-Aeclipselink.logging.level.processor=FINEST");
125+
verifyLogging("testProcessorLoggingFinestFromCmdLine31", PXML31, true,
120126
"-Aeclipselink.logging.level.processor=FINEST");
121127
}
122128

123129
@Test
124130
public void testGlobalLoggingFinestFromCmdLine() throws Exception {
125-
verifyLogging("testGlobalLoggingFinestFromCmdLine", PXML30, true,
131+
verifyLogging("testGlobalLoggingFinestFromCmdLine30", PXML30, true,
132+
"-Aeclipselink.logging.level=FINEST");
133+
verifyLogging("testGlobalLoggingFinestFromCmdLine31", PXML31, true,
126134
"-Aeclipselink.logging.level=FINEST");
127135
}
128136

@@ -355,6 +363,19 @@ private static class Result {
355363
" </persistence-unit>\n" +
356364
"</persistence>";
357365

366+
private static final String PXML31 = "<persistence xmlns=\"https://jakarta.ee/xml/ns/persistence\"\n" +
367+
" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n" +
368+
" xsi:schemaLocation=\"https://jakarta.ee/xml/ns/persistence\n" +
369+
" https://jakarta.ee/xml/ns/persistence/persistence_3_1.xsd\"\n" +
370+
" version=\"3.1\">\n" +
371+
" <persistence-unit name=\"sample-pu\" transaction-type=\"RESOURCE_LOCAL\">\n" +
372+
" <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>\n" +
373+
" <exclude-unlisted-classes>false</exclude-unlisted-classes>\n" +
374+
" <properties>\n" +
375+
" </properties>\n" +
376+
" </persistence-unit>\n" +
377+
"</persistence>";
378+
358379
private static final String OXML30 = "<entity-mappings xmlns=\"https://jakarta.ee/xml/ns/persistence/orm\"\n" +
359380
" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n" +
360381
" xsi:schemaLocation=\"https://jakarta.ee/xml/ns/persistence/orm https://jakarta.ee/xml/ns/persistence/orm/orm_3_0.xsd\"\n" +

0 commit comments

Comments
 (0)