Forum Discussion

NaveenKumar11's avatar
NaveenKumar11
Occasional Contributor
8 years ago

Groovy script to compare two text files

Hi,

 

Please share me the groovy script.

 

  • to read two text files
  • compare the above text files and print the difference

 

Thanks

Naveen

  • nmrao's avatar
    nmrao
    Champion Level 3
    It would be good if you can show your data, need not be the actual, at least to resembling your data.
    • NaveenKumar11's avatar
      NaveenKumar11
      Occasional Contributor

      Thanks for your response.

       

      Actually there will be some upgrade in the server.

       

      Before upgrade, i need to run my request against the server and  i ll capture response and store in my drive. 

      After upgrade i need to hit the same server with the same request. At that time i need to compare the current response with the already stored response dynamically using groovy.

       

      test data is normal xml response.

       

      <?xml version="1.0" ?>
      <Process>
      <Execution>
      <Execution_Date>2015/11/16 15:58:05</Execution_Date>
      <Process_File>Sample_2015-11-16_153023.xml</Process_File>
      <Client>IBLLC</Client>
      <Client_Master_Acct>FXXXXXXX</Client_Master_Acct>
      </Execution>
      <Applications>
      <Application External_ID="ABCD1002" Status="Success">
      <Customer>Joseph Clientman</Customer>
      <Users>
      <User external_id="ABCD1002USR" password="xxxxxxxx">jocmn841</User>
      </Users>
      <Accounts>
      <Account external_id="ABCD1002AC">UXXXXXXX</Account>
      </Accounts>
      <Entities>
      <Entity external_id="ABCD1002AH">20951330</Entity>
      </Entities>
      <Pending_Tasks>
      <Task Task_Number="87745956" Form_Number="1005" Form_Name="Margin Agreement" Action="to sign" Is_Required_For_Approval="true" Is_Required_For_Trading="false" Is_Online_Task="true"></Task>
      <Task Task_Number="87745947" Form_Number="2192" Form_Name="Privacy Statement" Action="to sign" Is_Required_For_Approval="true" Is_Required_For_Trading="false" Is_Online_Task="true"></Task>
      <Task Task_Number="87745948" Form_Number="3007" Form_Name="Customer Agreement (v2)" Action="to sign" Is_Required_For_Approval="true" Is_Required_For_Trading="false" Is_Online_Task="true"></Task>
      <Task Task_Number="87745949" Form_Number="3024" Form_Name="Forex and Multi-Currency Risk Disclosure" Action="to sign" Is_Required_For_Approval="true" Is_Required_For_Trading="false" Is_Online_Task="true"></Task>
      <Task Task_Number="87745955" Form_Number="3044" Form_Name="US Bond Risk Disclosure" Action="to sign" Is_Required_For_Approval="true" Is_Required_For_Trading="false" Is_Online_Task="true"></Task>
      <Task Task_Number="87745950" Form_Number="3070" Form_Name="Business Continuity Plan Disclosure" Action="to sign" Is_Required_For_Approval="true" Is_Required_For_Trading="false" Is_Online_Task="true"></Task>
      <Task Task_Number="87745951" Form_Number="3071" Form_Name="Day Trading Risk Disclosure" Action="to sign" Is_Required_For_Approval="true" Is_Required_For_Trading="false" Is_Online_Task="true"></Task>
      <Task Task_Number="87745952" Form_Number="3074" Form_Name="Order Routing and Payment for Order Flow Disclosure" Action="to sign" Is_Required_For_Approval="true" Is_Required_For_Trading="false" Is_Online_Task="true"></Task>
      <Task Task_Number="87745963" Form_Number="3076" Form_Name="ISE Disclosure for Option Orders Over 500 Contracts" Action="to sign" Is_Required_For_Approval="true" Is_Required_For_Trading="false" Is_Online_Task="true"></Task>
      <Task Task_Number="87745964" Form_Number="3077" Form_Name="Municipal Bond Risk Disclosure" Action="to sign" Is_Required_For_Approval="true" Is_Required_For_Trading="false" Is_Online_Task="true"></Task>
      <Task Task_Number="87745968" Form_Number="4003" Form_Name="OCC Risk Disclosure" Action="to sign" Is_Required_For_Approval="true" Is_Required_For_Trading="false" Is_Online_Task="true"></Task>
      <Task Task_Number="87745953" Form_Number="4016" Form_Name="After-hours Trading Risk Disclosure" Action="to sign" Is_Required_For_Approval="true" Is_Required_For_Trading="false" Is_Online_Task="true"></Task>
      <Task Task_Number="87745941" Form_Number="4035" Form_Name="Mutual Fund Agreement" Action="to sign" Is_Required_For_Approval="true" Is_Required_For_Trading="false" Is_Online_Task="true"></Task>
      <Task Task_Number="87745973" Form_Number="4036" Form_Name="Mutual Fund Disclosure" Action="to sign" Is_Required_For_Approval="true" Is_Required_For_Trading="false" Is_Online_Task="true"></Task>
      <Task Task_Number="87745936" Form_Number="6105" Form_Name="Client FA Agreement" Action="to sign" Is_Required_For_Approval="true" Is_Required_For_Trading="false" Is_Online_Task="true"></Task>
      <Task Task_Number="87745937" Form_Number="6108" Form_Name="Agreement Limiting Interactive Brokers Liability" Action="to sign" Is_Required_For_Approval="true" Is_Required_For_Trading="false" Is_Online_Task="true"></Task>
      <Task Task_Number="87745981" Form_Number="9130" Form_Name="US Stock Stop Order Disclosure" Action="to sign" Is_Required_For_Approval="true" Is_Required_For_Trading="false" Is_Online_Task="true"></Task>
      </Pending_Tasks>
      </Application>
      </Applications>
      </Process>

       

      • radhika1's avatar
        radhika1
        Contributor

        Hi Team,

         

        Could you please let me know the solution for the same.