Re: [Dev] Best Way to find two files are equal in test cases.

2015-03-01 Thread Rasika Perera
Hi Tharindu, Noted. Nice to hear it is working. Need to look why digests of those two InputStreams are differed and will update here. Thanks. On Mon, Mar 2, 2015 at 11:22 AM, Tharindu Dharmarathna wrote: > adding rasika. > > On Mon, Mar 2, 2015 at 11:21 AM, Tharindu Dharmarathna > wrote: > >>

Re: [Dev] Best Way to find two files are equal in test cases.

2015-03-01 Thread Tharindu Dharmarathna
adding rasika. On Mon, Mar 2, 2015 at 11:21 AM, Tharindu Dharmarathna wrote: > Hi Sajith, > > Thank you for your response . As done offline chat with Rasika he come up > with a good one without using md5sum we can do same thing from > org.apache.commons.io.IOUtils class in apache, from there

Re: [Dev] Best Way to find two files are equal in test cases.

2015-03-01 Thread Tharindu Dharmarathna
Hi Sajith, Thank you for your response . As done offline chat with Rasika he come up with a good one without using md5sum we can do same thing from org.apache.commons.io.IOUtils class in apache, from there we can check two input streams are same by contentEquals method. Documentation for this

Re: [Dev] Best Way to find two files are equal in test cases.

2015-03-01 Thread Sajith Ariyarathna
Hi Tharindu, I think this is caused by "chunking" in input streams. It might happen because of HTTP protocol or a bug in Java, I'm not sure. As an alternative solution you can run the MD5 command and compare its output. Like this, public String getMd5Checksum(String filePath) throws IOException

Re: [Dev] Best Way to find two files are equal in test cases.

2015-03-01 Thread Tharindu Dharmarathna
Hi Iqbal, I checked those two files manually I got same hash value to two files. This happens in random manner when running the tests On Sun, Mar 1, 2015 at 1:48 PM, Rasika Perera wrote: > Hi Tharindu, > > I checked your `readMD5(InputStream inputStream)` method and it is working > as expected

Re: [Dev] Best Way to find two files are equal in test cases.

2015-03-01 Thread Rasika Perera
Hi Tharindu, I checked your `readMD5(InputStream inputStream)` method and it is working as expected. The problem is with the inputStream you are passing into the method. Please verify that you are not passing the *same inputStream* on the second time. Because once it is utilized pos has reached t

Re: [Dev] Best Way to find two files are equal in test cases.

2015-03-01 Thread Irham Iqbal
Hi Tharindu Did you try to hash those files manually ? If not try to hash those files manually(i.e *md5sum file.txt) *and check hash values are same Thanks, Iqbal On Sun, Mar 1, 2015 at 12:30 PM, Tharindu Dharmarathna wrote: > Hi all, > > I wrote test case on APIDocDownload for the API Manag

[Dev] Best Way to find two files are equal in test cases.

2015-02-28 Thread Tharindu Dharmarathna
Hi all, I wrote test case on APIDocDownload for the API Manager .When I Run the tests It gives me two md5sums for equal files . here's the code sample I write to get md5 value from the files private String readMD5(InputStream inputStream) throws > NoSuchAlgorithmException, IOException { > Messag