docs.intersystems.com
Home  /  Application Development: Creating Productions  /  Testing Productions  /  Creating Tutorial.ExampleOperation


Testing Productions
Creating Tutorial.ExampleOperation
[Back] 
InterSystems: The power behind what matters   
Search:  


Here are the steps for creating Tutorial.ExampleOperation using Atelier:
  1. Create an Atelier project using a production-enabled namespace. Use the namespace in which you created Tutorial.ExampleProduction.
  2. Launch the new Business Operation Wizard: click File > New > Class File. Select the Business Operation template.
  3. Enter the following information into the wizard.
  4. Click Finish
  5. Add the following code to the Test method:
    Method Test(pInput As Ens.StringRequest, Output pOutput As Ens.StringResponse) As %Status{ 
        Set pResponse=##class(Ens.StringResponse).%New()
    
        if (pRequest.StringValue="")
        {
            Set pResponse.StringValue="ERROR"
            Set tSC=$$$ERROR($$$GeneralError, "Test error case")
        }
    
        else
        {
            Set pResponse.StringValue="OK"
            Set tSC=$$$OK
    
        $$$LOGINFO(pResponse.StringValue)
    
        Return tSC
        }
    }
    
  6. The complete code for Tutorial.ExampleOperation should look like the following:
    Class Tutorial.ExampleProduction extends Ens.BusinessOperation {
    
    Parameter INVOCATION = "Queue";
    
    Method Test(pInput As Ens.StringRequest, Output pOutput As Ens.StringResponse) As %Status
    {
        Set pResponse=##class(Ens.StringResponse).%New()
    
        if (pRequest.StringValue="")
        {
            Set pResponse.StringValue="ERROR"
            Set tSC=$$$ERROR($$$GeneralError, "Test error case")
        }
    
        else
        {
            Set pResponse.StringValue="OK"
            Set tSC=$$$OK
    
        $$$LOGINFO(pResponse.StringValue)
    
        Return tSC
        }
    }
    
    XData MessageMap {
    <MapItems>
        <MapItem MessageType="Ens.StringRequest">
            <Method>Test</Method>
        </MapItem>
    </MapItems>
    }
    
    }