@@ -213,4 +213,48 @@ public void testValidateWorkflowForOptionalIterationParam() {
213213 1 ,
214214 validationErrors .size ()); // validation error raised for functionref not for iterationParam
215215 }
216+
217+ @ Test
218+ public void testMissingFunctionRefForCallbackState () {
219+ WorkflowValidator workflowValidator = new WorkflowValidatorImpl ();
220+ List <ValidationError > validationErrors =
221+ workflowValidator
222+ .setSource (
223+ "{\n "
224+ + " \" id\" : \" callbackstatemissingfuncref\" ,\n "
225+ + " \" version\" : \" 1.0\" ,\n "
226+ + " \" specVersion\" : \" 0.8\" ,\n "
227+ + " \" name\" : \" Callback State Test\" ,\n "
228+ + " \" start\" : \" CheckCredit\" ,\n "
229+ + " \" states\" : [\n "
230+ + " {\n "
231+ + " \" name\" : \" CheckCredit\" ,\n "
232+ + " \" type\" : \" callback\" ,\n "
233+ + " \" action\" : {\n "
234+ + " \" functionRef\" : {\n "
235+ + " \" refName\" : \" callCreditCheckMicroservice\" ,\n "
236+ + " \" arguments\" : {\n "
237+ + " \" customer\" : \" ${ .customer }\" \n "
238+ + " }\n "
239+ + " }\n "
240+ + " },\n "
241+ + " \" eventRef\" : \" CreditCheckCompletedEvent\" ,\n "
242+ + " \" timeouts\" : {\n "
243+ + " \" stateExecTimeout\" : \" PT15M\" \n "
244+ + " },\n "
245+ + " \" end\" : true\n "
246+ + " }\n "
247+ + " ]\n "
248+ + "}" )
249+ .validate ();
250+
251+ Assertions .assertNotNull (validationErrors );
252+ Assertions .assertEquals (2 , validationErrors .size ());
253+ Assertions .assertEquals (
254+ "CallbackState event ref does not reference a defined workflow event definition" ,
255+ validationErrors .get (0 ).getMessage ());
256+ Assertions .assertEquals (
257+ "CallbackState action function ref does not reference a defined workflow function definition" ,
258+ validationErrors .get (1 ).getMessage ());
259+ }
216260}
0 commit comments