@@ -112,7 +112,7 @@ class ExploreTest {
112
112
private static final String FILTER_CONTINGENCY_LIST = "filterContingencyList" ;
113
113
private static final String FILTER_CONTINGENCY_LIST_2 = "filterContingencyList2" ;
114
114
private static final String FILTER = "FILTER" ;
115
- private final Map <String , Object > specificMetadata = Map .of ("id" , FILTER_UUID );
115
+ private final Map <String , Object > specificMetadata = Map .of ("equipmentType" , "GENERATOR" , " id" , FILTER_UUID );
116
116
private final Map <String , Object > specificMetadata2 = Map .of ("equipmentType" , "LINE" , "id" , FILTER_UUID_2 );
117
117
private final Map <String , Object > caseSpecificMetadata = Map .of ("uuid" , CASE_UUID , "name" , TEST_FILE , "format" , "XIIDM" );
118
118
private final Map <String , Object > modificationSpecificMetadata = Map .of ("id" , MODIFICATION_UUID , "type" , "LOAD_MODIFICATION" );
@@ -272,6 +272,8 @@ public MockResponse dispatch(RecordedRequest request) {
272
272
return new MockResponse (200 , Headers .of (HttpHeaders .CONTENT_TYPE , MediaType .APPLICATION_JSON_VALUE ), parametersElementAttributesAsString );
273
273
} else if (path .matches ("/v1/elements\\ ?ids=" + FILTER_UUID + "," + FILTER_UUID_2 + "&elementTypes=FILTER" ) && "GET" .equals (request .getMethod ())) {
274
274
return new MockResponse (200 , Headers .of (HttpHeaders .CONTENT_TYPE , MediaType .APPLICATION_JSON_VALUE ), "[" + filterAttributesAsString + "," + filter2AttributesAsString + "]" );
275
+ } else if (path .matches ("/v1/elements\\ ?ids=" + FILTER_UUID + "," + FILTER_UUID_2 + "," + CASE_UUID + "&elementTypes=FILTER,CASE" ) && "GET" .equals (request .getMethod ())) {
276
+ return new MockResponse (200 , Headers .of (HttpHeaders .CONTENT_TYPE , MediaType .APPLICATION_JSON_VALUE ), "[" + filterAttributesAsString + "," + filter2AttributesAsString + "," + caseElementAttributesAsString + "]" );
275
277
} else if (path .matches ("/v1/elements\\ ?ids=" + CASE_UUID ) && "GET" .equals (request .getMethod ())) {
276
278
return new MockResponse (200 , Headers .of (HttpHeaders .CONTENT_TYPE , MediaType .APPLICATION_JSON_VALUE ), "[" + caseElementAttributesAsString + "]" );
277
279
} else if (path .matches ("/v1/elements\\ ?ids=" + MODIFICATION_UUID ) && "GET" .equals (request .getMethod ())) {
@@ -674,6 +676,7 @@ void testGetElementsMetadata() throws Exception {
674
676
675
677
ElementAttributes filter1 = new ElementAttributes (FILTER_UUID , FILTER_CONTINGENCY_LIST , FILTER , USER1 , 0L , null , specificMetadata );
676
678
ElementAttributes filter2 = new ElementAttributes (FILTER_UUID_2 , FILTER_CONTINGENCY_LIST_2 , FILTER , USER1 , 0L , null , specificMetadata2 );
679
+ ElementAttributes caseElement = new ElementAttributes (CASE_UUID , "case" , "CASE" , USER1 , 0L , null , caseSpecificMetadata );
677
680
678
681
mockMvc .perform (get ("/v1/explore/elements/metadata?ids=" + FILTER_UUID + "," + FILTER_UUID_2 + "&equipmentTypes=&elementTypes=FILTER" )
679
682
.header ("userId" , USER1 ))
@@ -686,7 +689,7 @@ void testGetElementsMetadata() throws Exception {
686
689
.header ("userId" , USER1 ))
687
690
.andExpectAll (
688
691
status ().isOk (),
689
- content ().string (mapper .writeValueAsString (List .of ()))
692
+ content ().string (mapper .writeValueAsString (List .of (filter1 )))
690
693
);
691
694
692
695
mockMvc .perform (get ("/v1/explore/elements/metadata?ids=" + FILTER_UUID + "," + FILTER_UUID_2 + "&equipmentTypes=LINE&elementTypes=FILTER" )
@@ -695,6 +698,20 @@ void testGetElementsMetadata() throws Exception {
695
698
status ().isOk (),
696
699
content ().string (mapper .writeValueAsString (List .of (filter2 )))
697
700
);
701
+
702
+ mockMvc .perform (get ("/v1/explore/elements/metadata?ids=" + FILTER_UUID + "," + FILTER_UUID_2 + "&equipmentTypes=GENERATOR,LINE&elementTypes=FILTER" )
703
+ .header ("userId" , USER1 ))
704
+ .andExpectAll (
705
+ status ().isOk (),
706
+ content ().string (mapper .writeValueAsString (List .of (filter1 , filter2 )))
707
+ );
708
+
709
+ mockMvc .perform (get ("/v1/explore/elements/metadata?ids=" + FILTER_UUID + "," + FILTER_UUID_2 + "," + CASE_UUID + "&equipmentTypes=GENERATOR&elementTypes=FILTER,CASE" )
710
+ .header ("userId" , USER1 ))
711
+ .andExpectAll (
712
+ status ().isOk (),
713
+ content ().string (mapper .writeValueAsString (List .of (filter1 , caseElement )))
714
+ );
698
715
}
699
716
700
717
@ Test
0 commit comments