Service Virtualization

  • 1.  Virtualizing what my Java code is doing.

    Posted Apr 07, 2017 03:52 AM

    Hi All, I have a java class which requires around 100 jars to run and my next project requires me to imitate the functionality of this java code in DevTest.

     

    The java code takes JSON request and gives JSON response. 

     

    I tried the following approach :

    I pasted all my jars in the hotDeploy folder including my .class file which is using all the jars, and I created a Dynamic java step. This step asks me to put the class for which I want the object to be generated. 

    I have some doubts that I am listing down below :

    1. The Dynamic java Execution step asks to choose a class to create an object but in the list I am not able to find my ".class" file. Do I have to zip my .class file as well and have to put that jar in the hotDeploy folder?
    2. I am not very clear regarding the first question and I tried a lot of things and I was able to find my .class file in the list, still I would like someone to help me on the first question. After I selected my particular .class file. It automatically extracted the methods present in that class. But, when I executed the method I got an error saying:

     

    This call threw an exception:

    ============================================================================
    | Exception:
    ============================================================================
    | Step: n/a
    ----------------------------------------------------------------------------
    | Message: Invocation Exception on Dynamic Call/Ctor void testQuickCreditCheck( )
    ----------------------------------------------------------------------------
    | Trapped Exception: null
    | Trapped Message: java.lang.NullPointerException
    ----------------------------------------------------------------------------
    STACK TRACE
    java.lang.NullPointerException
    at com.wf.fxqtz.creditservice.client.api.FxCreditServiceClientFactory.closeContext(FxCreditServiceClientFactory.java:67)
    at APIContainingMethod.testQuickCreditCheck(APIContainingMethod.java:121)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at com.itko.lisa.dynexec.Call.execute(Call.java:910)
    at com.itko.lisa.dynexec.Call.execute(Call.java:558)
    at com.itko.lisa.dynexec.callparamtree.DTOServiceCallEditor.invoke(DTOServiceCallEditor.java:87)
    at com.itko.lisa.dynexec.ComplexObjEditor.execute(ComplexObjEditor.java:958)
    at com.itko.lisa.dynexec.ComplexObjEditor.access$1100(ComplexObjEditor.java:48)
    at com.itko.lisa.dynexec.ComplexObjEditor$15.actionPerformed(ComplexObjEditor.java:865)
    at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022)
    at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2348)
    at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
    at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
    at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252)
    at java.awt.Component.processMouseEvent(Component.java:6533)
    at javax.swing.JComponent.processMouseEvent(JComponent.java:3324)
    at java.awt.Component.processEvent(Component.java:6298)
    at java.awt.Container.processEvent(Container.java:2236)
    at java.awt.Component.dispatchEventImpl(Component.java:4889)
    at java.awt.Container.dispatchEventImpl(Container.java:2294)
    at java.awt.Component.dispatchEvent(Component.java:4711)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4888)
    at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4525)
    at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4466)
    at java.awt.Container.dispatchEventImpl(Container.java:2280)
    at java.awt.Window.dispatchEventImpl(Window.java:2746)
    at java.awt.Component.dispatchEvent(Component.java:4711)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758)
    at java.awt.EventQueue.access$500(EventQueue.java:97)
    at java.awt.EventQueue$3.run(EventQueue.java:709)
    at java.awt.EventQueue$3.run(EventQueue.java:703)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
    at java.awt.EventQueue$4.run(EventQueue.java:731)
    at java.awt.EventQueue$4.run(EventQueue.java:729)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:728)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
    ============================================================================

     

     

    The method does nothing but prints the data on the console. I am still unable to figure out what the problem is?

    Do I have to import some DevTest specific interfaces/classes in my java code, because this java code works perfectly well when I run it in Eclipse.

     

    Please Help.



  • 2.  Re: Virtualizing what my Java code is doing.

    Posted Jun 28, 2017 09:01 AM

    It is difficult to say what may be the issue here without seeing it - however, does the problem persist if you put all of the code in the lib/shared/ folder?



  • 3.  Re: Virtualizing what my Java code is doing.

    Posted Jun 29, 2017 11:42 AM

    Shubham,

    Can you respond to Dave's last response?



  • 4.  Re: Virtualizing what my Java code is doing.

    Posted Jul 10, 2017 11:09 AM

    Shubham,

    Can you respond to Dave's last response?