@@ -1159,17 +1159,20 @@ public void testSessionAttributes() throws Exception {
1159
1159
userAttributes .clear ();
1160
1160
userAttributes .put ("key1" , "value1" );
1161
1161
1162
- testSessionAttributes_checkSession (this .baseUrl + makeParam (PropertyKey .xdevapiConnectionAttributes , "key1=value1" ), userAttributes );
1163
- testSessionAttributes_checkSession (this .baseUrl + makeParam (PropertyKey .xdevapiConnectionAttributes , "[key1=value1]" ), userAttributes );
1164
- testSessionAttributes_checkClient (this .baseUrl + makeParam (PropertyKey .xdevapiConnectionAttributes , "key1=value1" ), userAttributes );
1165
- testSessionAttributes_checkClient (this .baseUrl + makeParam (PropertyKey .xdevapiConnectionAttributes , "[key1=value1]" ), userAttributes );
1162
+ String baseUrlLocal = this .baseUrl + (this .baseUrl .contains ("?" ) ? "&" : "?" );
1163
+
1164
+ testSessionAttributes_checkSession (baseUrlLocal + makeParam (PropertyKey .xdevapiConnectionAttributes , "key1=value1" , true ), userAttributes );
1165
+ testSessionAttributes_checkSession (baseUrlLocal + makeParam (PropertyKey .xdevapiConnectionAttributes , "[key1=value1]" , true ), userAttributes );
1166
+ testSessionAttributes_checkClient (baseUrlLocal + makeParam (PropertyKey .xdevapiConnectionAttributes , "key1=value1" , true ), userAttributes );
1167
+ testSessionAttributes_checkClient (baseUrlLocal + makeParam (PropertyKey .xdevapiConnectionAttributes , "[key1=value1]" , true ), userAttributes );
1166
1168
1167
1169
userAttributes .put ("key2" , "value2" );
1168
1170
1169
- testSessionAttributes_checkSession (this .baseUrl + makeParam (PropertyKey .xdevapiConnectionAttributes , "key1=value1,key2=value2" ), userAttributes );
1170
- testSessionAttributes_checkSession (this .baseUrl + makeParam (PropertyKey .xdevapiConnectionAttributes , "[key1=value1,key2=value2]" ), userAttributes );
1171
- testSessionAttributes_checkClient (this .baseUrl + makeParam (PropertyKey .xdevapiConnectionAttributes , "key1=value1,key2=value2" ), userAttributes );
1172
- testSessionAttributes_checkClient (this .baseUrl + makeParam (PropertyKey .xdevapiConnectionAttributes , "[key1=value1,key2=value2]" ), userAttributes );
1171
+ testSessionAttributes_checkSession (baseUrlLocal + makeParam (PropertyKey .xdevapiConnectionAttributes , "key1=value1,key2=value2" , true ), userAttributes );
1172
+ testSessionAttributes_checkSession (baseUrlLocal + makeParam (PropertyKey .xdevapiConnectionAttributes , "[key1=value1,key2=value2]" , true ),
1173
+ userAttributes );
1174
+ testSessionAttributes_checkClient (baseUrlLocal + makeParam (PropertyKey .xdevapiConnectionAttributes , "key1=value1,key2=value2" , true ), userAttributes );
1175
+ testSessionAttributes_checkClient (baseUrlLocal + makeParam (PropertyKey .xdevapiConnectionAttributes , "[key1=value1,key2=value2]" , true ), userAttributes );
1173
1176
1174
1177
// TSFR4/TSFR5/TSFR6 Create a Session without xdevapi.connection-attributes in the connection string, verify that all predefined attributes
1175
1178
// exist and contain the correct values. Verify that only connection attributes starting with "_" were set for current session.
@@ -1184,41 +1187,41 @@ public void testSessionAttributes() throws Exception {
1184
1187
// xdevapi.connection-attributes=_key1=value1
1185
1188
// xdevapi.connection-attributes=key1=value1,_key2=value2
1186
1189
assertThrows (WrongArgumentException .class , "Key names in \" xdevapi.connection-attributes\" cannot start with \" _\" ." , () -> {
1187
- this .fact .getSession (this . baseUrl + makeParam (PropertyKey .xdevapiConnectionAttributes , "[_key1=value1]" ));
1190
+ this .fact .getSession (baseUrlLocal + makeParam (PropertyKey .xdevapiConnectionAttributes , "[_key1=value1]" , true ));
1188
1191
return null ;
1189
1192
});
1190
1193
assertThrows (WrongArgumentException .class , "Key names in \" xdevapi.connection-attributes\" cannot start with \" _\" ." , () -> {
1191
- Client cli1 = cf .getClient (this . baseUrl + makeParam (PropertyKey .xdevapiConnectionAttributes , "[_key1=value1]" ), new Properties ());
1194
+ Client cli1 = cf .getClient (baseUrlLocal + makeParam (PropertyKey .xdevapiConnectionAttributes , "[_key1=value1]" , true ), new Properties ());
1192
1195
cli1 .getSession ();
1193
1196
return null ;
1194
1197
});
1195
1198
1196
1199
assertThrows (WrongArgumentException .class , "Key names in \" xdevapi.connection-attributes\" cannot start with \" _\" ." , () -> {
1197
- this .fact .getSession (this . baseUrl + makeParam (PropertyKey .xdevapiConnectionAttributes , "[key1=value1,_key2=value2]" ));
1200
+ this .fact .getSession (baseUrlLocal + makeParam (PropertyKey .xdevapiConnectionAttributes , "[key1=value1,_key2=value2]" , true ));
1198
1201
return null ;
1199
1202
});
1200
1203
assertThrows (WrongArgumentException .class , "Key names in \" xdevapi.connection-attributes\" cannot start with \" _\" ." , () -> {
1201
- Client cli1 = cf .getClient (this . baseUrl + makeParam (PropertyKey .xdevapiConnectionAttributes , "[key1=value1,_key2=value2]" ), new Properties ());
1204
+ Client cli1 = cf .getClient (baseUrlLocal + makeParam (PropertyKey .xdevapiConnectionAttributes , "[key1=value1,_key2=value2]" , true ), new Properties ());
1202
1205
cli1 .getSession ();
1203
1206
return null ;
1204
1207
});
1205
1208
1206
1209
assertThrows (WrongArgumentException .class , "Key names in \" xdevapi.connection-attributes\" cannot start with \" _\" ." , () -> {
1207
- this .fact .getSession (this . baseUrl + makeParam (PropertyKey .xdevapiConnectionAttributes , "_key1=value1" ));
1210
+ this .fact .getSession (baseUrlLocal + makeParam (PropertyKey .xdevapiConnectionAttributes , "_key1=value1" , true ));
1208
1211
return null ;
1209
1212
});
1210
1213
assertThrows (WrongArgumentException .class , "Key names in \" xdevapi.connection-attributes\" cannot start with \" _\" ." , () -> {
1211
- Client cli1 = cf .getClient (this . baseUrl + makeParam (PropertyKey .xdevapiConnectionAttributes , "_key1=value1" ), new Properties ());
1214
+ Client cli1 = cf .getClient (baseUrlLocal + makeParam (PropertyKey .xdevapiConnectionAttributes , "_key1=value1" , true ), new Properties ());
1212
1215
cli1 .getSession ();
1213
1216
return null ;
1214
1217
});
1215
1218
1216
1219
assertThrows (WrongArgumentException .class , "Key names in \" xdevapi.connection-attributes\" cannot start with \" _\" ." , () -> {
1217
- this .fact .getSession (this . baseUrl + makeParam (PropertyKey .xdevapiConnectionAttributes , "key1=value1,_key2=value2" ));
1220
+ this .fact .getSession (baseUrlLocal + makeParam (PropertyKey .xdevapiConnectionAttributes , "key1=value1,_key2=value2" , true ));
1218
1221
return null ;
1219
1222
});
1220
1223
assertThrows (WrongArgumentException .class , "Key names in \" xdevapi.connection-attributes\" cannot start with \" _\" ." , () -> {
1221
- Client cli1 = cf .getClient (this . baseUrl + makeParam (PropertyKey .xdevapiConnectionAttributes , "key1=value1,_key2=value2" ), new Properties ());
1224
+ Client cli1 = cf .getClient (baseUrlLocal + makeParam (PropertyKey .xdevapiConnectionAttributes , "key1=value1,_key2=value2" , true ), new Properties ());
1222
1225
cli1 .getSession ();
1223
1226
return null ;
1224
1227
});
@@ -1236,34 +1239,34 @@ public void testSessionAttributes() throws Exception {
1236
1239
userAttributes .clear ();
1237
1240
userAttributes .put ("key1" , "" );
1238
1241
1239
- testSessionAttributes_checkSession (this . baseUrl + makeParam (PropertyKey .xdevapiConnectionAttributes , "[key1]" ), userAttributes );
1240
- testSessionAttributes_checkSession (this . baseUrl + makeParam (PropertyKey .xdevapiConnectionAttributes , "[key1=]" ), userAttributes );
1241
- testSessionAttributes_checkSession (this . baseUrl + makeParam (PropertyKey .xdevapiConnectionAttributes , "key1" ), userAttributes );
1242
- testSessionAttributes_checkSession (this . baseUrl + makeParam (PropertyKey .xdevapiConnectionAttributes , "key1=" ), userAttributes );
1243
- testSessionAttributes_checkClient (this . baseUrl + makeParam (PropertyKey .xdevapiConnectionAttributes , "[key1]" ), userAttributes );
1244
- testSessionAttributes_checkClient (this . baseUrl + makeParam (PropertyKey .xdevapiConnectionAttributes , "[key1=]" ), userAttributes );
1245
- testSessionAttributes_checkClient (this . baseUrl + makeParam (PropertyKey .xdevapiConnectionAttributes , "key1" ), userAttributes );
1246
- testSessionAttributes_checkClient (this . baseUrl + makeParam (PropertyKey .xdevapiConnectionAttributes , "key1=" ), userAttributes );
1242
+ testSessionAttributes_checkSession (baseUrlLocal + makeParam (PropertyKey .xdevapiConnectionAttributes , "[key1]" , true ), userAttributes );
1243
+ testSessionAttributes_checkSession (baseUrlLocal + makeParam (PropertyKey .xdevapiConnectionAttributes , "[key1=]" , true ), userAttributes );
1244
+ testSessionAttributes_checkSession (baseUrlLocal + makeParam (PropertyKey .xdevapiConnectionAttributes , "key1" , true ), userAttributes );
1245
+ testSessionAttributes_checkSession (baseUrlLocal + makeParam (PropertyKey .xdevapiConnectionAttributes , "key1=" , true ), userAttributes );
1246
+ testSessionAttributes_checkClient (baseUrlLocal + makeParam (PropertyKey .xdevapiConnectionAttributes , "[key1]" , true ), userAttributes );
1247
+ testSessionAttributes_checkClient (baseUrlLocal + makeParam (PropertyKey .xdevapiConnectionAttributes , "[key1=]" , true ), userAttributes );
1248
+ testSessionAttributes_checkClient (baseUrlLocal + makeParam (PropertyKey .xdevapiConnectionAttributes , "key1" , true ), userAttributes );
1249
+ testSessionAttributes_checkClient (baseUrlLocal + makeParam (PropertyKey .xdevapiConnectionAttributes , "key1=" , true ), userAttributes );
1247
1250
1248
1251
userAttributes .put ("key2" , "value2" );
1249
1252
1250
- testSessionAttributes_checkSession (this . baseUrl + makeParam (PropertyKey .xdevapiConnectionAttributes , "[key1,key2=value2]" ), userAttributes );
1251
- testSessionAttributes_checkSession (this . baseUrl + makeParam (PropertyKey .xdevapiConnectionAttributes , "[key1=,key2=value2]" ), userAttributes );
1252
- testSessionAttributes_checkSession (this . baseUrl + makeParam (PropertyKey .xdevapiConnectionAttributes , "key1,key2=value2" ), userAttributes );
1253
- testSessionAttributes_checkSession (this . baseUrl + makeParam (PropertyKey .xdevapiConnectionAttributes , "key1=,key2=value2" ), userAttributes );
1254
- testSessionAttributes_checkClient (this . baseUrl + makeParam (PropertyKey .xdevapiConnectionAttributes , "[key1,key2=value2]" ), userAttributes );
1255
- testSessionAttributes_checkClient (this . baseUrl + makeParam (PropertyKey .xdevapiConnectionAttributes , "[key1=,key2=value2]" ), userAttributes );
1256
- testSessionAttributes_checkClient (this . baseUrl + makeParam (PropertyKey .xdevapiConnectionAttributes , "key1,key2=value2" ), userAttributes );
1257
- testSessionAttributes_checkClient (this . baseUrl + makeParam (PropertyKey .xdevapiConnectionAttributes , "key1=,key2=value2" ), userAttributes );
1253
+ testSessionAttributes_checkSession (baseUrlLocal + makeParam (PropertyKey .xdevapiConnectionAttributes , "[key1,key2=value2]" , true ), userAttributes );
1254
+ testSessionAttributes_checkSession (baseUrlLocal + makeParam (PropertyKey .xdevapiConnectionAttributes , "[key1=,key2=value2]" , true ), userAttributes );
1255
+ testSessionAttributes_checkSession (baseUrlLocal + makeParam (PropertyKey .xdevapiConnectionAttributes , "key1,key2=value2" , true ), userAttributes );
1256
+ testSessionAttributes_checkSession (baseUrlLocal + makeParam (PropertyKey .xdevapiConnectionAttributes , "key1=,key2=value2" , true ), userAttributes );
1257
+ testSessionAttributes_checkClient (baseUrlLocal + makeParam (PropertyKey .xdevapiConnectionAttributes , "[key1,key2=value2]" , true ), userAttributes );
1258
+ testSessionAttributes_checkClient (baseUrlLocal + makeParam (PropertyKey .xdevapiConnectionAttributes , "[key1=,key2=value2]" , true ), userAttributes );
1259
+ testSessionAttributes_checkClient (baseUrlLocal + makeParam (PropertyKey .xdevapiConnectionAttributes , "key1,key2=value2" , true ), userAttributes );
1260
+ testSessionAttributes_checkClient (baseUrlLocal + makeParam (PropertyKey .xdevapiConnectionAttributes , "key1=,key2=value2" , true ), userAttributes );
1258
1261
1259
1262
// TSFR10 Create a Session with xdevapi.connection-attributes=false in the connection string, verify
1260
1263
// that no connection attribute was set for current session.
1261
- Session s10 = this .fact .getSession (this . baseUrl + makeParam (PropertyKey .xdevapiConnectionAttributes , "false" ));
1264
+ Session s10 = this .fact .getSession (baseUrlLocal + makeParam (PropertyKey .xdevapiConnectionAttributes , "false" , true ));
1262
1265
SqlResult res = s10 .sql ("SELECT * FROM performance_schema.session_connect_attrs WHERE processlist_id = CONNECTION_ID()" ).execute ();
1263
1266
assertFalse ("Expected no connection attributes." , res .hasNext ());
1264
1267
s10 .close ();
1265
1268
1266
- Client c10 = cf .getClient (this . baseUrl + makeParam (PropertyKey .xdevapiConnectionAttributes , "false" ), new Properties ());
1269
+ Client c10 = cf .getClient (baseUrlLocal + makeParam (PropertyKey .xdevapiConnectionAttributes , "false" , true ), new Properties ());
1267
1270
s10 = c10 .getSession ();
1268
1271
res = s10 .sql ("SELECT * FROM performance_schema.session_connect_attrs WHERE processlist_id = CONNECTION_ID()" ).execute ();
1269
1272
assertFalse ("Expected no connection attributes." , res .hasNext ());
@@ -1278,23 +1281,23 @@ public void testSessionAttributes() throws Exception {
1278
1281
// xdevapi.connection-attributes=[]
1279
1282
userAttributes .clear ();
1280
1283
1281
- testSessionAttributes_checkSession (this . baseUrl + "&" + PropertyKey .xdevapiConnectionAttributes .getKeyName (), userAttributes );
1282
- testSessionAttributes_checkSession (this . baseUrl + "&" + PropertyKey .xdevapiConnectionAttributes .getKeyName () + "=" , userAttributes );
1283
- testSessionAttributes_checkSession (this . baseUrl + makeParam (PropertyKey .xdevapiConnectionAttributes , "true" ), userAttributes );
1284
- testSessionAttributes_checkSession (this . baseUrl + makeParam (PropertyKey .xdevapiConnectionAttributes , "[]" ), userAttributes );
1285
- testSessionAttributes_checkClient (this . baseUrl + "&" + PropertyKey .xdevapiConnectionAttributes .getKeyName (), userAttributes );
1286
- testSessionAttributes_checkClient (this . baseUrl + "&" + PropertyKey .xdevapiConnectionAttributes .getKeyName () + "=" , userAttributes );
1287
- testSessionAttributes_checkClient (this . baseUrl + makeParam (PropertyKey .xdevapiConnectionAttributes , "true" ), userAttributes );
1288
- testSessionAttributes_checkClient (this . baseUrl + makeParam (PropertyKey .xdevapiConnectionAttributes , "[]" ), userAttributes );
1284
+ testSessionAttributes_checkSession (baseUrlLocal + PropertyKey .xdevapiConnectionAttributes .getKeyName (), userAttributes );
1285
+ testSessionAttributes_checkSession (baseUrlLocal + PropertyKey .xdevapiConnectionAttributes .getKeyName () + "=" , userAttributes );
1286
+ testSessionAttributes_checkSession (baseUrlLocal + makeParam (PropertyKey .xdevapiConnectionAttributes , "true" , true ), userAttributes );
1287
+ testSessionAttributes_checkSession (baseUrlLocal + makeParam (PropertyKey .xdevapiConnectionAttributes , "[]" , true ), userAttributes );
1288
+ testSessionAttributes_checkClient (baseUrlLocal + PropertyKey .xdevapiConnectionAttributes .getKeyName (), userAttributes );
1289
+ testSessionAttributes_checkClient (baseUrlLocal + PropertyKey .xdevapiConnectionAttributes .getKeyName () + "=" , userAttributes );
1290
+ testSessionAttributes_checkClient (baseUrlLocal + makeParam (PropertyKey .xdevapiConnectionAttributes , "true" , true ), userAttributes );
1291
+ testSessionAttributes_checkClient (baseUrlLocal + makeParam (PropertyKey .xdevapiConnectionAttributes , "[]" , true ), userAttributes );
1289
1292
1290
1293
// TSFR13 Create a Session with xdevapi.connection-attributes=[key1=value1,key1=value2] in the connection string, verify that
1291
1294
// a WrongArgumentException exception is thrown with the message Duplicate key "key1" used in "xdevapi.connection-attributes".
1292
1295
assertThrows (WrongArgumentException .class , "Duplicate key \" key1\" used in \" xdevapi.connection-attributes\" ." , () -> {
1293
- this .fact .getSession (this . baseUrl + makeParam (PropertyKey .xdevapiConnectionAttributes , "key1=value1,key1=value2" ));
1296
+ this .fact .getSession (baseUrlLocal + makeParam (PropertyKey .xdevapiConnectionAttributes , "key1=value1,key1=value2" , true ));
1294
1297
return null ;
1295
1298
});
1296
1299
assertThrows (WrongArgumentException .class , "Duplicate key \" key1\" used in \" xdevapi.connection-attributes\" ." , () -> {
1297
- Client cli1 = cf .getClient (this . baseUrl + makeParam (PropertyKey .xdevapiConnectionAttributes , "key1=value1,key1=value2" ), new Properties ());
1300
+ Client cli1 = cf .getClient (baseUrlLocal + makeParam (PropertyKey .xdevapiConnectionAttributes , "key1=value1,key1=value2" , true ), new Properties ());
1298
1301
cli1 .getSession ();
1299
1302
return null ;
1300
1303
});
0 commit comments