4444import static org .hamcrest .Matchers .containsString ;
4545import static org .hamcrest .Matchers .equalTo ;
4646import static org .hamcrest .Matchers .nullValue ;
47+ import static org .mockito .ArgumentMatchers .any ;
48+ import static org .mockito .ArgumentMatchers .eq ;
4749import static org .mockito .Mockito .mock ;
4850import static org .mockito .Mockito .when ;
4951
@@ -61,7 +63,7 @@ public void init() throws IOException {
6163 (factories , tag , description , config ) -> processor
6264 );
6365 ingestService = mock (IngestService .class );
64- when (ingestService .getPipeline (SIMULATED_PIPELINE_ID )).thenReturn (pipeline );
66+ when (ingestService .getPipeline (any (), eq ( SIMULATED_PIPELINE_ID ) )).thenReturn (pipeline );
6567 when (ingestService .getProcessorFactories ()).thenReturn (registry );
6668 }
6769
@@ -89,7 +91,9 @@ public void testParseUsingPipelineStore() throws Exception {
8991 expectedDocs .add (expectedDoc );
9092 }
9193
94+ var projectId = randomProjectIdOrDefault ();
9295 SimulatePipelineRequest .Parsed actualRequest = SimulatePipelineRequest .parseWithPipelineId (
96+ projectId ,
9397 SIMULATED_PIPELINE_ID ,
9498 requestContent ,
9599 false ,
@@ -213,24 +217,40 @@ public void testParseWithProvidedPipeline() throws Exception {
213217 }
214218
215219 public void testNullPipelineId () {
220+ var projectId = randomProjectIdOrDefault ();
216221 Map <String , Object > requestContent = new HashMap <>();
217222 List <Map <String , Object >> docs = new ArrayList <>();
218223 requestContent .put (Fields .DOCS , docs );
219224 Exception e = expectThrows (
220225 IllegalArgumentException .class ,
221- () -> SimulatePipelineRequest .parseWithPipelineId (null , requestContent , false , ingestService , RestApiVersion .current ())
226+ () -> SimulatePipelineRequest .parseWithPipelineId (
227+ projectId ,
228+ null ,
229+ requestContent ,
230+ false ,
231+ ingestService ,
232+ RestApiVersion .current ()
233+ )
222234 );
223235 assertThat (e .getMessage (), equalTo ("param [pipeline] is null" ));
224236 }
225237
226238 public void testNonExistentPipelineId () {
239+ var projectId = randomProjectIdOrDefault ();
227240 String pipelineId = randomAlphaOfLengthBetween (1 , 10 );
228241 Map <String , Object > requestContent = new HashMap <>();
229242 List <Map <String , Object >> docs = new ArrayList <>();
230243 requestContent .put (Fields .DOCS , docs );
231244 Exception e = expectThrows (
232245 IllegalArgumentException .class ,
233- () -> SimulatePipelineRequest .parseWithPipelineId (pipelineId , requestContent , false , ingestService , RestApiVersion .current ())
246+ () -> SimulatePipelineRequest .parseWithPipelineId (
247+ projectId ,
248+ pipelineId ,
249+ requestContent ,
250+ false ,
251+ ingestService ,
252+ RestApiVersion .current ()
253+ )
234254 );
235255 assertThat (e .getMessage (), equalTo ("pipeline [" + pipelineId + "] does not exist" ));
236256 }
0 commit comments