0

I need to mock the salesforce endpoint. So I need to have a payload returned from the mock processor that's mocking the salesforce.

Currently I have written the MEL as follows :

[Arrays.asList((({AccountId='0012',FirstName=Martin},{AccountId='0014',FirstName=Dmitri}).asString().split(',')))]

This doesn't seem to work properly. I need to use a MEL to convert the payload to a Array list of hash maps. I also tried separating the string by some other character like '|' instead of ',', but it didn't work.

Please let me know if there's any change required in the MEL.

Thank you.

Community
  • 1
  • 1
  • please show your payload which needs to be converted ? – star Jul 04 '16 at 08:11
  • The payload from salesforce ideally would be : [{AccountId='00128xAAM',FirstName=Martin},{AccountId='0012xAAM',FirstName=Dmitri}] So when I am mocking the salesforce, I need to have this kind of payload returned from the mock processor. Hence I need to include some expression in MEL which would return arraylist of hashmaps. – Shivchetan Sambaragimath Jul 04 '16 at 09:04

1 Answers1

0

Please refer this link http://www.slideshare.net/prudhvivreddy/munit-junit-test-case and http://www.slideshare.net/krishananth/mule-esb-mocksalesforce. You need to create saleforce response payload and return as required type as mentioned here. Check slide number 18. Hope that helps .

star
  • 1,493
  • 1
  • 28
  • 61
  • Yes it did help . However when i run the java class as JUnit, it is not getting routed to the particular flow. I am unable to get the response from the flow. – Shivchetan Sambaragimath Jul 04 '16 at 12:46
  • I have used this code line : MuleEvent muleEvent=runFlow("Salesforce_Data_To_CSV",testEvent(listOfInputMap)); So basically how would i check if its running that particular flow. End result of flow is not logging when i use System.out.println("The response is "+muleEvent.getMessage().getPayloadAsString()); – Shivchetan Sambaragimath Jul 04 '16 at 12:47
  • Sice you are running Munit, Keep logger in Munit after the Mock service returned. Please check this site too http://www.slideshare.net/krishananth/mule-esb-mocksalesforce – star Jul 04 '16 at 22:52