@@ -1194,4 +1194,131 @@ private Index createIndex(String indexUid) throws Exception {
1194
1194
1195
1195
return index ;
1196
1196
}
1197
+
1198
+ /** Tests of the separator tokens setting methods */
1199
+ @ Test
1200
+ @ DisplayName ("Test get separator tokens settings by uid" )
1201
+ public void testGetSeparatorTokensSettings () throws Exception {
1202
+ Index index = createIndex ("testGetSeparatorTokensSettings" );
1203
+ Settings initialSettings = index .getSettings ();
1204
+ String [] initialSeparatorTokens = index .getSeparatorTokensSettings ();
1205
+
1206
+ assertThat (
1207
+ initialSeparatorTokens ,
1208
+ is (arrayWithSize (initialSettings .getSeparatorTokens ().length )));
1209
+ assertThat (initialSeparatorTokens , is (equalTo (initialSettings .getSeparatorTokens ())));
1210
+ }
1211
+
1212
+ @ Test
1213
+ @ DisplayName ("Test update separator tokens settings" )
1214
+ public void testUpdateSeparatorTokensSettings () throws Exception {
1215
+ Index index = createIndex ("testUpdateSeparatorTokensSettings" );
1216
+ String [] initialSeparatorTokens = index .getSeparatorTokensSettings ();
1217
+
1218
+ String [] newSeparatorTokens = {"|" , "…" };
1219
+
1220
+ index .waitForTask (index .updateSeparatorTokensSettings (newSeparatorTokens ).getTaskUid ());
1221
+ String [] updatedSeparatorTokens = index .getSeparatorTokensSettings ();
1222
+
1223
+ Arrays .sort (newSeparatorTokens );
1224
+ Arrays .sort (updatedSeparatorTokens );
1225
+
1226
+ assertThat (updatedSeparatorTokens , is (arrayWithSize (newSeparatorTokens .length )));
1227
+ assertThat (updatedSeparatorTokens , is (equalTo (newSeparatorTokens )));
1228
+ assertThat (updatedSeparatorTokens , is (not (arrayWithSize (initialSeparatorTokens .length ))));
1229
+ }
1230
+
1231
+ @ Test
1232
+ @ DisplayName ("Test reset separator tokens settings" )
1233
+ public void testResetSeparatorTokensSettings () throws Exception {
1234
+ Index index = createIndex ("testResetSeparatorTokensSettings" );
1235
+ String [] initialSeparatorTokens = index .getSeparatorTokensSettings ();
1236
+ String [] newSeparatorTokens = {"|" , "…" };
1237
+
1238
+ index .waitForTask (index .updateSeparatorTokensSettings (newSeparatorTokens ).getTaskUid ());
1239
+ String [] updatedSeparatorTokens = index .getSeparatorTokensSettings ();
1240
+
1241
+ index .waitForTask (index .resetSeparatorTokensSettings ().getTaskUid ());
1242
+ String [] separatorTokensAfterReset = index .getSeparatorTokensSettings ();
1243
+
1244
+ Arrays .sort (initialSeparatorTokens );
1245
+ Arrays .sort (newSeparatorTokens );
1246
+ Arrays .sort (updatedSeparatorTokens );
1247
+ Arrays .sort (separatorTokensAfterReset );
1248
+
1249
+ assertThat (updatedSeparatorTokens , is (arrayWithSize (newSeparatorTokens .length )));
1250
+ assertThat (updatedSeparatorTokens , is (equalTo (newSeparatorTokens )));
1251
+ assertThat (updatedSeparatorTokens , is (not (arrayWithSize (initialSeparatorTokens .length ))));
1252
+ assertThat (
1253
+ separatorTokensAfterReset , is (not (arrayWithSize (updatedSeparatorTokens .length ))));
1254
+ assertThat (separatorTokensAfterReset , is (arrayWithSize (initialSeparatorTokens .length )));
1255
+ assertThat (separatorTokensAfterReset , is (equalTo (initialSeparatorTokens )));
1256
+ }
1257
+
1258
+ /** Tests of the non-separator tokens setting methods */
1259
+ @ Test
1260
+ @ DisplayName ("Test get non-separator tokens settings by uid" )
1261
+ public void testGetNonSeparatorTokensSettings () throws Exception {
1262
+ Index index = createIndex ("testGetNonSeparatorTokensSettings" );
1263
+ Settings initialSettings = index .getSettings ();
1264
+ String [] initialNonSeparatorTokens = index .getNonSeparatorTokensSettings ();
1265
+
1266
+ assertThat (
1267
+ initialNonSeparatorTokens ,
1268
+ is (arrayWithSize (initialSettings .getNonSeparatorTokens ().length )));
1269
+ assertThat (initialNonSeparatorTokens , is (equalTo (initialSettings .getNonSeparatorTokens ())));
1270
+ }
1271
+
1272
+ @ Test
1273
+ @ DisplayName ("Test update non-separator tokens settings" )
1274
+ public void testUpdateNonSeparatorTokensSettings () throws Exception {
1275
+ Index index = createIndex ("testUpdateNonSeparatorTokensSettings" );
1276
+ String [] initialNonSeparatorTokens = index .getNonSeparatorTokensSettings ();
1277
+ String [] newNonSeparatorTokens = {"@" , "#" };
1278
+
1279
+ index .waitForTask (
1280
+ index .updateNonSeparatorTokensSettings (newNonSeparatorTokens ).getTaskUid ());
1281
+ String [] updatedNonSeparatorTokens = index .getNonSeparatorTokensSettings ();
1282
+
1283
+ Arrays .sort (newNonSeparatorTokens );
1284
+ Arrays .sort (updatedNonSeparatorTokens );
1285
+
1286
+ assertThat (updatedNonSeparatorTokens , is (arrayWithSize (newNonSeparatorTokens .length )));
1287
+ assertThat (updatedNonSeparatorTokens , is (equalTo (newNonSeparatorTokens )));
1288
+ assertThat (
1289
+ updatedNonSeparatorTokens ,
1290
+ is (not (arrayWithSize (initialNonSeparatorTokens .length ))));
1291
+ }
1292
+
1293
+ @ Test
1294
+ @ DisplayName ("Test reset non-separator tokens settings" )
1295
+ public void testResetNonSeparatorTokensSettings () throws Exception {
1296
+ Index index = createIndex ("testResetNonSeparatorTokensSettings" );
1297
+ String [] initialNonSeparatorTokens = index .getNonSeparatorTokensSettings ();
1298
+ String [] newNonSeparatorTokens = {"@" , "#" };
1299
+
1300
+ index .waitForTask (
1301
+ index .updateNonSeparatorTokensSettings (newNonSeparatorTokens ).getTaskUid ());
1302
+ String [] updatedNonSeparatorTokens = index .getNonSeparatorTokensSettings ();
1303
+
1304
+ index .waitForTask (index .resetNonSeparatorTokensSettings ().getTaskUid ());
1305
+ String [] nonSeparatorTokensAfterReset = index .getNonSeparatorTokensSettings ();
1306
+
1307
+ Arrays .sort (initialNonSeparatorTokens );
1308
+ Arrays .sort (newNonSeparatorTokens );
1309
+ Arrays .sort (updatedNonSeparatorTokens );
1310
+ Arrays .sort (nonSeparatorTokensAfterReset );
1311
+
1312
+ assertThat (updatedNonSeparatorTokens , is (arrayWithSize (newNonSeparatorTokens .length )));
1313
+ assertThat (updatedNonSeparatorTokens , is (equalTo (newNonSeparatorTokens )));
1314
+ assertThat (
1315
+ updatedNonSeparatorTokens ,
1316
+ is (not (arrayWithSize (initialNonSeparatorTokens .length ))));
1317
+ assertThat (
1318
+ nonSeparatorTokensAfterReset ,
1319
+ is (not (arrayWithSize (updatedNonSeparatorTokens .length ))));
1320
+ assertThat (
1321
+ nonSeparatorTokensAfterReset , is (arrayWithSize (initialNonSeparatorTokens .length )));
1322
+ assertThat (nonSeparatorTokensAfterReset , is (equalTo (initialNonSeparatorTokens )));
1323
+ }
1197
1324
}
0 commit comments