Service Virtualization

Expand all | Collapse all

Tutorial - How to Create a Custom Data Protocol Handler (Tech Tip)

  • 1.  Tutorial - How to Create a Custom Data Protocol Handler (Tech Tip)

    Posted 04-06-2016 08:58 AM
      |   view attached

    I posted this tutorial as an answer to a question, but there's been enough discussion that I'm separating it into a separate thread.

     

    Here are the basic instructions. Let me know if you have any questions.

     

    Step 1 – In your favourite java IDE, add the jar files from the bin directory in your DevTest (aka Service Virtualization or LISA) installation directory:

    • Lisa-core.jar
    • Lisa-virtualize.jar

     

    Step 2 – Create a new Java class that extends DataProtocol. It is recommended you extend ParameterListDataProtocol to make things easier, but not required.

     

    Step 3 – Override and implement “public void updateRequest(TestExec testExec, Request request)”

    This method is called to parse the request into readable data.

    Make sure to call request.setOperation(operationName) to set the operation name for the request

    Pull out the fields that are important for determining which fields you want to match on using request.getArguments().addParameter(new Parameter(“Name of Field”, “Value of field”));

     

    Step 4 – Override and implement “public void updateResponse(TestExec testExec, Response response)”

    This method is called to parse the response. It’s used only for displaying the response in a user friendly format. In playback mode this isn’t called

    Call response.setBody(xmlResults) to set the response after converting it into a user friendly format (XML is recommended)

     

    Step 5 – Override and implement “public void updateResponse(TestExec testExec, TransientResponse transientResponse)”

    This method is called in playback mode to generate the response (ie. converts the user friendly version of the response into the format required by the system)

    Call transientResponse.setBody(response) to set the response after converting it to the correct format

     

    Step 6 – Create a file in your project. The name can be anything, but the extension must be “.lisaextensions”. In the file you’ll specify the details of your new Data Protocol Handler:

    vseProtocols=com.example.MyNewDPH

    1. com.example.MyNewDPH =Data:req:resp,A Good Name For My Handler,A Description of What It Does

     

    Step 7 – Export the classes and lisaextensions file as a jar and place them in the hotdeploy directory in the DevTest (aka Service Virtualization or LISA) installation directory.

    Note if you make an update, close the workstation and reopen it to pick up the changes.

     

    Attached is a sample implementation of a DPH and the associated lisaextensions file. Let me know if you have any questions.

    Attachment(s)



  • 2.  Re: Tutorial - How to Create a Custom Data Protocol Handler (Tech Tip)

    Posted 09-21-2016 11:52 AM

    I have followed the example up to copying the generated jar into hotdeploy. After that, I open the workstation and where should I see the example DPH? Went to VSE Recorder but isn't there.



  • 3.  Re: Tutorial - How to Create a Custom Data Protocol Handler (Tech Tip)

    Posted 09-21-2016 04:53 PM

    Try restarting the Registry service....



  • 4.  Re: Tutorial - How to Create a Custom Data Protocol Handler (Tech Tip)

    Posted 09-22-2016 10:03 AM

    Same thing. I am running DevTest 9.0.0. I see in the logs that the hotDeploy folder is checked:

     

    2016-09-22 13:53:48,405Z (10:53) [Event Sink Thread Pool Thread 1] WARN  com.itko.util.DirectoryWatcher - File 'C:\Program Files\CA\DevTest\hotDeploy\TDI_ISO-8583.jar' has been touched. User: 'KRATOS$' Host Name: 'kratos'

     

    Then restart the Workstation:

     

    2016-09-22 13:54:31,672Z (10:54) [ServerRequestResponder 6] INFO  com.itko.lisa.coordinator.TestRegistryImpl - Asked to remove workstation null

    2016-09-22 13:54:58,183Z (10:54) [ServerRequestResponder 4] INFO  com.itko.lisa.coordinator.TestRegistryImpl - adding new live workstation

     

    Is there anything I could enable to see what's wrong? Like debug logs. Where should I see the deployed DPH if it's built exactly like the example.



  • 5.  Re: Tutorial - How to Create a Custom Data Protocol Handler (Tech Tip)

    Posted 05-10-2018 12:24 AM

    Koustubh.Warty  

    I tried implementing this using only Request (UpdateRequest) side for my testing and learning purpose. But faced an issue . Lisa is not able to create instance of that ProcyoclHandler Class . Error thorwn is Unsupported class version 52. 
    So what i probably interpret here is because of Jre versions because custom prortocol i have built is using JRE 1.8 however on my Server whrere i have workstation (Devetest 8.x) has JRE 1.6 installed . Is this because of this compatibility conflict ? 

    Also looks like Devetest 8.x supports Java 7 . Please advise further 



  • 6.  Re: Tutorial - How to Create a Custom Data Protocol Handler (Tech Tip)

    Posted 05-11-2018 12:14 AM

    Hi Kevin.Bowman can you please help me here