@@ -421,6 +421,33 @@ private void checkIdentifiableAttributes(List<IdentifiableAttributes> identifiab
421
421
}
422
422
}
423
423
424
+ @ Test
425
+ public void testEvaluateFilters () throws Exception {
426
+ UUID filterId = UUID .randomUUID ();
427
+ ArrayList <AbstractExpertRule > rules = new ArrayList <>();
428
+ EnumExpertRule country1Filter = EnumExpertRule .builder ().field (FieldType .COUNTRY_1 ).operator (OperatorType .IN )
429
+ .values (new TreeSet <>(Set .of ("FR" ))).build ();
430
+ rules .add (country1Filter );
431
+ CombinatorExpertRule parentRule = CombinatorExpertRule .builder ().combinator (CombinatorType .AND ).rules (rules ).build ();
432
+ ExpertFilter lineFilter = new ExpertFilter (filterId , new Date (), EquipmentType .LINE , parentRule );
433
+ insertFilter (filterId , lineFilter );
434
+
435
+ // Apply filter by calling endPoint
436
+ List <String > filterIds = List .of (filterId .toString ());
437
+ MultiValueMap <String , String > params = new LinkedMultiValueMap <>();
438
+ params .addAll ("ids" , filterIds );
439
+ params .add ("networkUuid" , NETWORK_UUID .toString ());
440
+ List <IdentifiableAttributes > result = objectMapper .readValue (mvc .perform (get (URL_TEMPLATE + "/evaluate/identifiables" )
441
+ .params (params ).contentType (APPLICATION_JSON )).andExpect (status ().isOk ())
442
+ .andReturn ().getResponse ().getContentAsString (), new TypeReference <>() {});
443
+
444
+ List <IdentifiableAttributes > expected = new ArrayList <>();
445
+ expected .add (new IdentifiableAttributes ("NHV1_NHV2_1" , IdentifiableType .LINE , null ));
446
+ expected .add (new IdentifiableAttributes ("NHV1_NHV2_2" , IdentifiableType .LINE , null ));
447
+
448
+ assertTrue (expected .size () == result .size () && result .containsAll (expected ) && expected .containsAll (result ));
449
+ }
450
+
424
451
@ Test
425
452
public void testExportFilters () throws Exception {
426
453
UUID filterId = UUID .randomUUID ();
0 commit comments