@@ -1159,17 +1159,20 @@ public void testSessionAttributes() throws Exception {
11591159 userAttributes .clear ();
11601160 userAttributes .put ("key1" , "value1" );
11611161
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 );
11661168
11671169 userAttributes .put ("key2" , "value2" );
11681170
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 );
11731176
11741177 // TSFR4/TSFR5/TSFR6 Create a Session without xdevapi.connection-attributes in the connection string, verify that all predefined attributes
11751178 // 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 {
11841187 // xdevapi.connection-attributes=_key1=value1
11851188 // xdevapi.connection-attributes=key1=value1,_key2=value2
11861189 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 ));
11881191 return null ;
11891192 });
11901193 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 ());
11921195 cli1 .getSession ();
11931196 return null ;
11941197 });
11951198
11961199 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 ));
11981201 return null ;
11991202 });
12001203 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 ());
12021205 cli1 .getSession ();
12031206 return null ;
12041207 });
12051208
12061209 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 ));
12081211 return null ;
12091212 });
12101213 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 ());
12121215 cli1 .getSession ();
12131216 return null ;
12141217 });
12151218
12161219 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 ));
12181221 return null ;
12191222 });
12201223 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 ());
12221225 cli1 .getSession ();
12231226 return null ;
12241227 });
@@ -1236,34 +1239,34 @@ public void testSessionAttributes() throws Exception {
12361239 userAttributes .clear ();
12371240 userAttributes .put ("key1" , "" );
12381241
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 );
12471250
12481251 userAttributes .put ("key2" , "value2" );
12491252
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 );
12581261
12591262 // TSFR10 Create a Session with xdevapi.connection-attributes=false in the connection string, verify
12601263 // 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 ));
12621265 SqlResult res = s10 .sql ("SELECT * FROM performance_schema.session_connect_attrs WHERE processlist_id = CONNECTION_ID()" ).execute ();
12631266 assertFalse ("Expected no connection attributes." , res .hasNext ());
12641267 s10 .close ();
12651268
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 ());
12671270 s10 = c10 .getSession ();
12681271 res = s10 .sql ("SELECT * FROM performance_schema.session_connect_attrs WHERE processlist_id = CONNECTION_ID()" ).execute ();
12691272 assertFalse ("Expected no connection attributes." , res .hasNext ());
@@ -1278,23 +1281,23 @@ public void testSessionAttributes() throws Exception {
12781281 // xdevapi.connection-attributes=[]
12791282 userAttributes .clear ();
12801283
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 );
12891292
12901293 // TSFR13 Create a Session with xdevapi.connection-attributes=[key1=value1,key1=value2] in the connection string, verify that
12911294 // a WrongArgumentException exception is thrown with the message Duplicate key "key1" used in "xdevapi.connection-attributes".
12921295 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 ));
12941297 return null ;
12951298 });
12961299 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 ());
12981301 cli1 .getSession ();
12991302 return null ;
13001303 });
0 commit comments