Home Forums Development Unit test error in ActionItem'testEmails post-Jade upgrade

Viewing 3 reply threads
  • Author
    Posts
    • #6812
      Tommy ButtTommy Butt
      Participant

      Hi there,

      We have applied NexJ Finance 7.2.0.2 721.1305.146.46_jade upgrade followed by nexj_contact_jade_ga_sp1_7.2.1.1. Since the Jade upgrade the unit test ActionItem’testEmails have been failing with the following error:

      The error occurs when the test case executes the following line:

      – (emailActItemCommand’emailActItem)

      The test case testEmails has not been changed by Jade.

      emailActItemCommand is a non-customized class in our implementation. This has been modified by Jade.

      EmailActItem has a line to send email using SysMail’send

      After the Jade upgrade, the SysMail’send call is wrapped around by “orchestrator-dispatch” with a list of arguments passed into the dispatch. Downstream operations by orchestrator-dispatch attempts to retrieve a queue from the list of arguments. The ‘Invalid list passed to “assoc”‘ error happens when an assoc call was used to look for “queue”. Queue does not appear to be among the arguments passed by emailActItemCommand to orchestrator-dispatch.

      How could this error within the base modules be resolved?

      Thanks

      Tommy

      ANZ

      0
    • #7079
      Sam Marteysamuel.martey
      Participant

      You would have to do 2 things to ensure this works properly.

      1. Change the arguments passed to ‘orchestrator-dispatch’ to use an assoc list.

      ie: for something like:

      (orchestrator-dispatch this (lambda(this arg1 arg2 arg3…) (SysMail’send ….)) arg1Value arg2Value arg3Value…)

      You would need to convert that to use an assoc-list.

      (orchestrator-dispatch this (lambda(this . args) (SysMail’send ….)) (: arg1 arg1Value) (: arg2 arg2Value) (: arg3 arg3Value)…)

      2. The function executed by the ‘orchestrator-dispatch’ (ie: (lambda(this arg1 arg2 arg3…))) would have to be changed to (lambda(this . args)) and the appropriate assoc-value-for-keys would have to be used to retrieve the values of the arguments.

      The final call would look like (as also shown above)

      (orchestrator-dispatch this (lambda(this . args) (SysMail’send ….)) (: arg1 arg1Value) (: arg2 arg2Value) (: arg3 arg3Value)…)

       

      The Orchestrator code could also be changed to accommodate this. But it might be a slightly more involved change although simple as well.

      0
      • #7113
        Aleksandar.CosoAleksandar.Coso
        Participant

        Hi Samuel,

        Thanks for the suggestion. A member of our dev team tried it with following observations. I attached the modified file. It is part of Jade release and not customised by us.

        in EmailActItemCommand class emailActItem event main action

        (orchestrator-dispatch this

        (lambda (this .args)

        (SysMail’send

        ;to:

        emailToEdited

        ;from:

        (

        ,(cons

        (if (null? (this’emailBody))

        “”

        ;else

        (list (this’emailBody) (: Content-type “text/html”))

        )

        attachments

        )

        )

        ;properties:

        emailCCEdited

        )

        )

        (: emailToEdited emailToEdited)

        (: userEmail userEmail)

        (: userName userName)

        (: emailCCEdited emailCCEdited)

        (: attachments attachments)

        )

         

        The exception message box does not pop up now. But get the errors below in server console output:

        0
        Attachments:
        You must be logged in to view attached files.
    • #7128
      Sam Marteysamuel.martey
      Participant

      Hello Aleksander,

       

      I am not able to download the attached files. However, it would be nice to see a snippet of the line that calls ‘orchestrator-dispatch’ pasted here.

      It seems to be that whichever function you are calling does not support variable args/varargs.

      For your idea above to work, you need to use a function (anonymous/named) that takes in at least 2 arguments, ‘this’ and ‘. args’)

      Here is a way to do this with your current problem.

      (orchestrator-dispatch this

      (lambda (this . args)

      (let

      (

      (emailToEdited (assoc-value-for-key ’emailToEdited args))

      (userEmail (assoc-value-for-key ‘userEmail args))

      (userName (assoc-value-for-key ‘userName args))

      (emailCCEdited (assoc-value-for-key ’emailCCEdited args))

      (attachments (assoc-value-for-key ‘attachments args))

      )

      (SysMail’send

      ;to:

      emailToEdited

       

      ;from:

      (,userEmail . ,userName)

       

      ;subject:

      (this’emailSubject)

       

      ;body

      `

      (

      ,(cons

      (if (null? (this’emailBody))

      “”

      ;else

      (list (this’emailBody) (: Content-type “text/html”))

      )

      attachments

      )

      )

       

      ;properties:

      emailCCEdited

      )

      )

      )

      emailToEdited userEmail userName emailCCEdited attachments

      )

      0
    • #7136
      Sam Marteysamuel.martey
      Participant

      Further analysis show that you could probably fix this by changing code in the OrchestratorCommandMessage.meta to avoid the problem completely and keep the rest of the code the same. This should be tested thoroughly.

      in the invoke(object, method, args[]), change the variable to:

      (queueName (ifnull (when (every pair? args) (assoc-value-for-key 'queue args)) (@ DEFAULT_QUEUE_NAME)))

      Rather than:

      (queueName (ifnull (assoc-value-for-key 'queue args) (@ DEFAULT_QUEUE_NAME)))

      0
Viewing 3 reply threads
  • You must be logged in to reply to this topic.