aspose file tools
The moose likes Testing and the fly likes how to test (junit4) this mysql funciton? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Engineering » Testing
Reply Bookmark "how to test (junit4) this mysql funciton?" Watch "how to test (junit4) this mysql funciton?" New topic
Author

how to test (junit4) this mysql funciton?

miguel lisboa
Ranch Hand

Joined: Feb 08, 2004
Posts: 1281
using eclipse, i'm testing encryption password input

my sql from eclipse:


the test:


what happens is that java complaints with:
SHA1(pp)

because if i use quotes, its a plain string, and if i dont, says method SHA1 isnt recognized

how can i solve this?


java amateur
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 26216
    
  66

Miguel,
It sounds like you are trying to run a database encryption method. Can you pass the value to the database and do the check there. For example:

SELECT count(*) FROM table where SHA1(xxxx) == SHA1(yyy)

Or whatever you are trying to assert?


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
miguel lisboa
Ranch Hand

Joined: Feb 08, 2004
Posts: 1281
Jeanne Boyarsky wrote:Miguel,
It sounds like you are trying to run a database encryption method. Can you pass the value to the database and do the check there. For example:

SELECT count(*) FROM table where SHA1(xxxx) == SHA1(yyy)

Or whatever you are trying to assert?


yes, i'm trying to do it

your idea sounds great indeed, but yet i'm quite puzzled with your sql:

lets suppose i call the plain password 123456

now, i can retrieve the SHA1 of that password from the database:


please help me now: how i write the sql you suggest, using my data?

note:i tried several combinations inspired on your sql but allways got a zero count

thanks in advance
miguel lisboa
Ranch Hand

Joined: Feb 08, 2004
Posts: 1281
i cleared this post, since i posted twice
miguel lisboa
Ranch Hand

Joined: Feb 08, 2004
Posts: 1281
case solved!

thanks, Jeanne

here“s what i did:


anyway i'm a tiny bit afraid i'm comparing one thing with the very same thing ...
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to test (junit4) this mysql funciton?
 
Similar Threads
MS Access Insert - last row missing
query select where
How to parse hyphen in form post?
user authentication
Equals e HashCode