@@ -30,19 +30,26 @@ class PartitionedIdModeVerificationSvcTest {
30
30
31
31
private static final String MIGRATION_TABLE_NAME = "hapi_migrator" ;
32
32
33
- private DriverTypeEnum .ConnectionProperties myConnectionProperties = newConnection () ;
33
+ private DriverTypeEnum .ConnectionProperties myConnectionProperties ;
34
34
35
35
@ Mock
36
36
private HibernatePropertiesProvider myHibernatePropertiesProvider ;
37
37
38
38
@ ParameterizedTest
39
- @ CsvSource ({
40
- "true, true" ,
41
- "true, false" ,
42
- "false, true" ,
43
- "false, false"
44
- })
45
- void testPartitionedIdDatabase_WantPartitionedIdDatabase (boolean thePartitionedIdModeForSchema , boolean thePartitionedIdModeForSettings ) {
39
+ @ CsvSource (textBlock =
40
+ // Partitioned Schema, Partitioned Settings, Uppercase Identifiers
41
+ """
42
+ true, true, true
43
+ true, false, true
44
+ false, true, true
45
+ false, false, true
46
+ true, true, false
47
+ false, false, false
48
+ """
49
+ )
50
+ void testPartitionedIdDatabase_WantPartitionedIdDatabase (boolean thePartitionedIdModeForSchema , boolean thePartitionedIdModeForSettings , boolean theCapitalizedIdentifers ) {
51
+ myConnectionProperties = newConnection (theCapitalizedIdentifers );
52
+
46
53
Set <String > commandLineValue = thePartitionedIdModeForSchema ? Set .of (HapiFhirJpaMigrationTasks .FlagEnum .DB_PARTITION_MODE .getCommandLineValue ()) : Set .of ();
47
54
HapiFhirJpaMigrationTasks tasks = new HapiFhirJpaMigrationTasks (commandLineValue );
48
55
@@ -73,6 +80,8 @@ void testPartitionedIdDatabase_WantPartitionedIdDatabase(boolean thePartitionedI
73
80
*/
74
81
@ Test
75
82
void testEmptyDatabaseDoesNotFail () {
83
+ myConnectionProperties = newConnection (true );
84
+
76
85
PlatformTransactionManager txManager = new DataSourceTransactionManager (myConnectionProperties .getDataSource ());
77
86
when (myHibernatePropertiesProvider .getDataSource ()).thenReturn (myConnectionProperties .getDataSource ());
78
87
when (myHibernatePropertiesProvider .getDialect ()).thenReturn (new HapiFhirH2Dialect ());
@@ -86,8 +95,15 @@ void testEmptyDatabaseDoesNotFail() {
86
95
/**
87
96
* Create a new connection to a randomized H2 database for testing
88
97
*/
89
- private DriverTypeEnum .ConnectionProperties newConnection () {
90
- String url = "jdbc:h2:mem:test_migration-" + UUID .randomUUID () + ";CASE_INSENSITIVE_IDENTIFIERS=TRUE;" ;
98
+ private DriverTypeEnum .ConnectionProperties newConnection (boolean theCapitalizedIdentifiers ) {
99
+ String url = "jdbc:h2:mem:test_migration-" + UUID .randomUUID ();
100
+ if (theCapitalizedIdentifiers ) {
101
+ url += ";CASE_INSENSITIVE_IDENTIFIERS=TRUE;DATABASE_TO_UPPER=TRUE;DATABASE_TO_LOWER=FALSE;" ;
102
+ } else {
103
+ url += ";CASE_INSENSITIVE_IDENTIFIERS=TRUE;DATABASE_TO_LOWER=TRUE;DATABASE_TO_UPPER=FALSE;" ;
104
+ }
105
+
106
+ //+ ";CASE_INSENSITIVE_IDENTIFIERS=TRUE;";
91
107
return DriverTypeEnum .H2_EMBEDDED .newConnectionProperties (url , "SA" , "SA" );
92
108
}
93
109
}
0 commit comments