38
38
import java .security .cert .X509Certificate ;
39
39
import java .util .*;
40
40
41
+ import static org .junit .jupiter .api .Assertions .fail ;
42
+
41
43
public abstract class ConnectedRESTQA {
42
44
43
45
private static Properties testProperties = null ;
@@ -348,10 +350,15 @@ public static void setDatabaseProperties(String dbName, String prop, boolean pro
348
350
* root property name else if it has an existing sub property name then it
349
351
* adds elements to that array
350
352
*/
351
- private static void setDatabaseProperties (String dbName , String propName , ObjectNode objNode ) throws IOException {
353
+ private static void setDatabaseProperties (String dbName , String propName , ObjectNode objNode ) {
352
354
ManageClient client = newManageClient ();
353
355
String databaseProperties = new DatabaseManager (client ).getPropertiesAsJson (dbName );
354
- JsonNode jnode = new ObjectMapper ().readTree (databaseProperties );
356
+ JsonNode jnode = null ;
357
+ try {
358
+ jnode = new ObjectMapper ().readTree (databaseProperties );
359
+ } catch (JsonProcessingException e ) {
360
+ fail ("Could not parse database-properties: " + databaseProperties + "; cause: " + e .getMessage ());
361
+ }
355
362
356
363
if (!jnode .has (propName )) {
357
364
((ObjectNode ) jnode ).putArray (propName ).addAll (objNode .withArray (propName ));
@@ -374,7 +381,7 @@ public static void enableCollectionLexicon(String dbName) {
374
381
setDatabaseProperties (dbName , "collection-lexicon" , true );
375
382
}
376
383
377
- public static void enableWordLexicon (String dbName ) throws Exception {
384
+ public static void enableWordLexicon (String dbName ) {
378
385
ObjectMapper mapper = new ObjectMapper ();
379
386
ObjectNode childNode = mapper .createObjectNode ();
380
387
ArrayNode childArray = mapper .createArrayNode ();
@@ -395,13 +402,11 @@ public static void setMaintainLastModified(String dbName, boolean opt) {
395
402
* This function constructs a range element index with default
396
403
* collation,range-value-positions and invalid values
397
404
*/
398
- public static void addRangeElementIndex (String dbName , String type , String namespace , String localname )
399
- throws Exception {
405
+ public static void addRangeElementIndex (String dbName , String type , String namespace , String localname ) {
400
406
addRangeElementIndex (dbName , type , namespace , localname , false );
401
407
}
402
408
403
- public static void addRangeElementIndex (String dbName , String type , String namespace , String localname ,
404
- boolean positions ) throws Exception {
409
+ public static void addRangeElementIndex (String dbName , String type , String namespace , String localname , boolean positions ) {
405
410
ObjectMapper mapper = new ObjectMapper ();
406
411
ObjectNode mainNode = mapper .createObjectNode ();
407
412
@@ -419,7 +424,7 @@ public static void addRangeElementIndex(String dbName, String type, String names
419
424
setDatabaseProperties (dbName , "range-element-index" , mainNode );
420
425
}
421
426
422
- public static void addRangeElementIndex (String dbName , String [][] rangeElements ) throws Exception {
427
+ public static void addRangeElementIndex (String dbName , String [][] rangeElements ) {
423
428
ObjectMapper mapper = new ObjectMapper ();
424
429
ObjectNode mainNode = mapper .createObjectNode ();
425
430
@@ -530,7 +535,7 @@ public static void addRangePathIndex(String dbName, String type, String pathexpr
530
535
setDatabaseProperties (dbName , "range-path-index" , childNode );
531
536
}
532
537
533
- public static void addRangePathIndex (String dbName , String [][] rangePaths ) throws Exception {
538
+ public static void addRangePathIndex (String dbName , String [][] rangePaths ) {
534
539
ObjectMapper mapper = new ObjectMapper ();
535
540
ObjectNode childNode = mapper .createObjectNode ();
536
541
ArrayNode childArray = mapper .createArrayNode ();
@@ -585,7 +590,7 @@ public static void addPathNamespace(String dbName, String[][] pathNamespace) thr
585
590
setDatabaseProperties (dbName , "path-namespace" , childNode );
586
591
}
587
592
588
- public static void setupAppServicesConstraint (String dbName ) throws Exception {
593
+ public static void setupAppServicesConstraint (String dbName ) {
589
594
// Add new range elements into this array
590
595
String [][] rangeElements = {
591
596
// { scalar-type, namespace-uri, localname, collation,
0 commit comments