• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to compare two values using groovy scripting

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
1.Get the data from the LDAP based on account id example account status 'active'

2. Compare it with the Account tree structure account status is active

if both the status is same are same then it is passed

Below is my script to fetch the account details




OUTPUT RESPONSE {shawtelephonenumber=[403803105, 4037490355], accountnumber=124, accounttype=Residential, accountstatus=Active, dn=accountNumber=124,o=accounts,o=shawEnterprise, objectclass=[shawEnterpriseAccount, top], deviceid=[device1240, device1241, device1242], emailid=test124@gmail.com}

2. account tree structure --> enclosed screen shot
groovy.png
[Thumbnail for groovy.png]
 
Sheriff
Posts: 7125
184
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the Ranch.

Please UseCodeTags (←click) when you post code. I've done it for you this time. Also, indent your code correctly. This helps you determine if the flow control is correct and it helps others understand your code better.

Can you explain what values you want to compare? Are you trying to compare two LDAP objects? You'll probably need to write a method that does this by hand.
 
Gayathri sundari
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Iam new to Groovy scripting

1. Get the value of account status --------> active from the response panel

2. Compare it with account tree ----->attached in screen shot get the value from XML
 
Knute Snortum
Sheriff
Posts: 7125
184
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Gayathri sundari wrote:
1. Get the value of account status --------> active from the response panel



Do you mean o.accountstatus.equals('Active') or something else?


2. Compare it with account tree ----->attached in screen shot get the value from XML



Well, you'll need to parse the XML file. Start here.
 
Gayathri sundari
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes it is 'Active'
 
Knute Snortum
Sheriff
Posts: 7125
184
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So what does your code look like now? Do you have enough to go forward?
 
What are your superhero powers? Go ahead and try them on this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic