为什么此代码会为每次通话打印不同的结果?
2016/11/21 11:22:29 INFO - jmeter.util.BeanShellTestElement: String to MD5 ->{"type":"StatsReq","msg":[{"symList":["AAPL.O","MFFT.O"],"startDate":"2015-01-03","endDate":"2015-01-03","dataType":"trade","assetClass":"tmx","analytics":["VWAP","TWAP"],"startTime":null,"endTime":null,"granularity":null,"granularityUnit":null,"fill":null,"timeZone":null,"inputTimeZone":null,"outputTimeZone":null,"temporality":null}],"id":"gevv4nfhbul0rrhlcco2as63to","date":"Mon, 21 Nov 2016 11:22:29 EST"}<-
2016/11/21 11:22:29 INFO - jmeter.util.BeanShellTestElement: MD5 Result 1 Apache->[B@49f63d7c<-
2016/11/21 11:22:29 INFO - jmeter.util.BeanShellTestElement: MD5 Result 2 Apache->[B@182c34a7<-
2016/11/21 11:22:29 INFO - jmeter.util.BeanShellTestElement: MD5 Result 3 Apache->[B@56b1896b<-
2016/11/21 11:22:29 INFO - jmeter.util.BeanShellTestElement: MD5 Result 4 Apache->[B@355dc639<-
结果如下:
ip_addresses = ['172.16.{}.{}'.format(rack, box) for box in box_numbers.split(', ')]
答案 0 :(得分:0)
你的问题是:
返回一个byte []
所以你在一个返回这个数组引用的数组上做一个toString(),所以即使数组内容相同,每次都会得到一个不同的Object引用值。
您应该显示org.apache.commons.codec.digest.DigestUtils.md5Hex(),它将为您提供相同的值,并且是一个字符串。