Service Virtualization

  • 1.  Devtest - Polling a Folder/Constantly Reading Folder POC

    Posted Aug 21, 2017 03:05 PM

    Hi All,

     

    I've been asked to look into a Proof of Concept into whether we can use DevTest to make a virtual service that constantly polls/checks a folder and reads files that are suddenly dropped in. I'm aware this is very different from the normal services and use of Devtest where we have a listener receive requests and then return a response.

     

    The ultimate goal is to be able to read from a Receiving/Drop-off folder, process data or make alterations, and place files into a different folder. I would just like to know so far if the first part is possible, where instead of a web service listener, we can constantly poll a folder and read upon detecting new files dropped in (or any changes in general).

     

    Has anybody tried anything like this or know any possible useful features I can try?

     

    Thanks,



  • 2.  Re: Devtest - Polling a Folder/Constantly Reading Folder POC

    Posted Aug 21, 2017 11:05 PM

    Hello Paul,

     

    This is a valid use case and it is typically implemented with an S/FTP step to poll a directory and then make the appropriate subsequent actions, using assertions, based on the results from polling the directory. You can optionally use an "Execute script" step and write your own code to poll a directory in case it is on the localhost. 

     

    I'm not aware of a way to record this type of virtual service, so you'll need to create the VSM from scratch.

    Generally, your "listen" step (first step) in the model can be anything, such as an S/FTP step. Your last step should be a step that "sleeps" (for a period of time) and then have it loop back to your first step. I typically add an "Execute script" with the following line of code: Thread.sleep(1500);



  • 3.  Re: Devtest - Polling a Folder/Constantly Reading Folder POC

    Posted Jan 29, 2018 04:25 PM

    How and from where you use the FTP step that continuously listens on a server (ftp)? Can you pls help? Thanks.



  • 4.  Re: Devtest - Polling a Folder/Constantly Reading Folder POC

    Broadcom Employee
    Posted Aug 22, 2017 05:55 AM

    I need to do the same in an upcoming POC. In my case, it's a batch of transactions that need processing. This is a screenshot of the VSM I've created to accomplish it.

     

    It checks to make sure an input file exists (if it doesn't exist, it waits 60 seconds before looking again)

    It reads the file

    It splits the batch into each transaction

    It calls a HTTP virtual service with each transaction so I can use all the regular out-of-the-box DevTest VSI matching & processing facilities

    It combines all the responses into a batch

    It deletes the input file

    TODO: Write the response batch elsewhere (I don't yet know where to write the response)

    Rick



  • 5.  Re: Devtest - Polling a Folder/Constantly Reading Folder POC

    Posted Jan 29, 2018 04:21 PM

    Hi Rick,

     

    I am in need for a similar solution where I want to continuously poll for a file on a windows directory - and once it's available I want to FTP it over to a linux box. Will it possible for you to share the code of your solution? thanks.



  • 6.  Re: Devtest - Polling a Folder/Constantly Reading Folder POC

    Posted Aug 22, 2017 07:20 AM

    Paul,

    Did William's and Rick's recommendations help you out with this issue?



  • 7.  Re: Devtest - Polling a Folder/Constantly Reading Folder POC

    Posted Aug 22, 2017 10:03 AM

    So far yea! These are really helpful, thanks everybody. I'm going to experiment with the advice so far and probably reply with more questions over some time. If it is successful I'll make sure to mark the answers as correct. Thanks again.



  • 8.  Re: Devtest - Polling a Folder/Constantly Reading Folder POC

    Posted Aug 24, 2017 11:47 AM

    Hi All,

     

    I've been experimenting a bit so far using Devtest v9.5.1, and the External FTP Step isn't working so well. I've also downloaded some jar files for an Extension for SFTP Step I found on this link:

     

    https://communities.ca.com/thread/241773320-ftp-virtualization

     

    Now I've run into two different roadblocks:

     

    ===Using SFTP extensions===

     

    Now the SFTP Step Extension seems to pass a connection test to my desired remote server, and certain functions seem to work such as ls, create, or forcewrite when I choose the SFTP Protocol. However, I really desire the ability to "put" one file from local to remote server, which is unavailable unless I choose SCP protocol; and none of the SCP protocol works for me. 

     

     

    ===Using External FTP Step===

    The out of the box FTP Step (under External/Subprocess) won't seem to connect to the remote server even though I put the exact same host, port, username and password as the SFTP one. I get this error with Connection Reset:

     

    ============================================================================
    | Exception:
    ============================================================================
    | Message: Error executing FTP: Connection reset
    ----------------------------------------------------------------------------
    ============================================================================


    at com.itko.lisa.ftp.FTPStepEditor.execute(FTPStepEditor.java:232)
    at com.itko.lisa.ftp.FTPStepEditor.access$000(FTPStepEditor.java:47)
    at com.itko.lisa.ftp.FTPStepEditor$1.actionPerformed(FTPStepEditor.java:102)
    at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
    at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
    at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
    at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
    at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
    at java.awt.Component.processMouseEvent(Unknown Source)
    at javax.swing.JComponent.processMouseEvent(Unknown Source)
    at java.awt.Component.processEvent(Unknown Source)
    at java.awt.Container.processEvent(Unknown Source)
    at java.awt.Component.dispatchEventImpl(Unknown Source)
    at java.awt.Container.dispatchEventImpl(Unknown Source)
    at java.awt.Component.dispatchEvent(Unknown Source)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
    at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
    at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
    at java.awt.Container.dispatchEventImpl(Unknown Source)
    at java.awt.Window.dispatchEventImpl(Unknown Source)
    at java.awt.Component.dispatchEvent(Unknown Source)
    at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
    at java.awt.EventQueue.access$500(Unknown Source)
    at java.awt.EventQueue$3.run(Unknown Source)
    at java.awt.EventQueue$3.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
    at java.awt.EventQueue$4.run(Unknown Source)
    at java.awt.EventQueue$4.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
    at java.awt.EventQueue.dispatchEvent(Unknown Source)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.run(Unknown Source)

     

     

    I guess ultimately, is there a newer version of the SFTP Extension I can try that might have the Put options I need? If not, what's the best way to go about fixing this FTP Step?

     

    Thanks,



  • 9.  Re: Devtest - Polling a Folder/Constantly Reading Folder POC

    Broadcom Employee
    Posted Sep 07, 2017 09:51 AM

    Can you please try using these jars for SFTP Extension?

     

    Please remove old version of jars from hotdeploy folder.