cleanup in LibvirtComputingResource

- minor resource leak cleaned up
- cpu-speed reading method extracted
- test added
- logging added in case of exception

Signed-off-by: Laszlo Hornyak <laszlo.hornyak@gmail.com>
removed unused variables

Signed-off-by: Laszlo Hornyak <laszlo.hornyak@gmail.com>
safely close resource with java 1.7 resource block

Signed-off-by: Laszlo Hornyak <laszlo.hornyak@gmail.com>
replaced Integer reference comparsion with .equals

By default only the Integers between -128..127 are cached (unless overridden by java.lang.Integer.IntegerCache.high system property)
If the inbound or outbound values are higher, the reference comparison won't work.

Signed-off-by: Laszlo Hornyak <laszlo.hornyak@gmail.com>
removed self-assignment

It must have been a copy-paste from the other constructor.

Signed-off-by: Laszlo Hornyak <laszlo.hornyak@gmail.com>
String concatenation cleanup

Replaced string concatenation in loop with StringBuilder

Signed-off-by: Laszlo Hornyak <laszlo.hornyak@gmail.com>
Minor Boolean expression simplification

Signed-off-by: Laszlo Hornyak <laszlo.hornyak@gmail.com>
Boolean expression simplification

Signed-off-by: Laszlo Hornyak <laszlo.hornyak@gmail.com>
Replaced String concatenation in loop

Replaced String concatenation in loop with StringBuilder
Unit test added

Signed-off-by: Laszlo Hornyak <laszlo.hornyak@gmail.com>
Cleanup in UriUtils.encodeURIComponent

- StringBuffer replaced with StringBuilder
- nullcheck of tokens array removed since String.split does not return null
- unit test added

Signed-off-by: Laszlo Hornyak <laszlo.hornyak@gmail.com>