Eduard Lebedyuk · Aug 10, 2016

How do I invoke Ensemble testing service for requests with %ArrayOfDataTypes property from SMP

I have the following Ensemble request:

Class MyApp.MyRequest Extends (%Persistent, Ens.Request)
Property idToTokenArray As %ArrayOfDataTypes;

On SMP Testing service page it looks like this:

But my attempts to set idToTokenArray have not yielded any positive results so far. How do I need to fill it?

0 338
Discussion (2)0
Log in or sign up to continue

The testing form isn't smart enough to handle array or list properties.  The easiest way I've found to test these is to create a  file business service and add code to populate the array with some hard-coded values.  Then add that service to your production, set the file path, and copy any random file into the file path directory to trigger the service.  Here's an example file service to do this:

Class Community.TestArray Extends Ens.BusinessService

  Parameter ADAPTER = "EnsLib.File.InboundAdapter";

  Method OnProcessInput(pInput As %Stream.Object, Output pOutput As %RegisteredObject) As %Status
    set tTestMsg = ##class(MyApp.MyRequest).%New()
    do tTestMsg.idToTokenArray.Insert("One")
    do tTestMsg.idToTokenArray.Insert("Two")
    do tTestMsg.idToTokenArray.Insert("Three")
    quit ..SendRequestAsync("OperationToTest",tTestMsg)


See class method EnsLib.Testing.Service::SendTestRequest() that allows one to issue the test from terminal without having to add another component.

classmethod SendTestRequest(pTarget As %String, pRequest As Ens.Request, ByRef pResponse As Ens.Response, Output pSessionId As %String, pGetReply As %Boolean = 0) as %Status

    Send a test request to the specified target host (BusinessProcess or BusinessOperation).