Nyzo techRelease notesNyzo 619: client utilities

Nyzo 619: client utilities

Nyzo version 619 (commit on GitHub) improves utility classes used by the client.

This version affects the client only.

A new class, ClientArgumentUtil, provides methods that assist in processing of arguments passed to client commands.

The ClientArgumentUtil.getInteger() methods process int arguments, providing a default value for unparsable inputs and optional range limits.

RN_619 image 0

The ClientArgumentUtil.getLong() methods process long arguments, providing the same options as the getInteger() methods.

RN_619 image 1

The ClientArgumentUtil.getSenderData() method processes sender-data inputs, handling both plain text and normalized sender-data strings.

RN_619 image 2

In ClientTransactionUtil.bytesFromNormalizedSenderDataString(), the underscoreIndex is now set to 66 when there are no underscores in the string. This allows 32-byte values to be decoded properly.

RN_619 image 3

The remaining changes in this version are testing code. The ClientArgumentUtilTest class ensures that the ClientArgumentUtil class interprets arguments as expected.

The ClientArgumentUtilTest.main() method allows this test to be run separately.

RN_619 image 4

The ClientArgumentUtilTest.run() method implements the top level of the test. Both pairs of numerical methods are tested. Then, the sender-data method is tested.

RN_619 image 5

The ClientArgumentUtilTest.testIntegerMethods() method tests both valid and invalid inputs, testing both the simple and range-limited ClientArgumentUtil.getInteger() overloads.

RN_619 image 6

The ClientArgumentUtilTest.testLongMethods() method parallels ClientArgumentUtilTest.testIntegerMethods().

RN_619 image 7

The ClientArgumentUtilTest.testSenderDataMethod() method examines the behavior of ClientArgumentUtil.getSenderData() with a variety of text and normalized sender-data string inputs. One of the test cases in this method revealed the inability of ClientTransactionUtil.bytesFromNormalizedSenderDataString() to process values of 32 bytes in length.

RN_619 image 8

The ClientArgumentUtilTest.array() method is a simple alias to ByteUtil.byteArrayFromHexString(). This method was added to make ClientArgumentUtilTest.testSenderDataMethod() more readable.

The ClientArgumentUtilTest.getFailureCause() exposes failureCause, as required by the NyzoTest interface.

RN_619 image 9

The CommandManagerTest ensures that no ambiguous command strings are present in CommandManager. A similar test is already completed on client initialization. The main() method, following NyzoTest convention, allows separate execution of this test class.

RN_619 image 10

The CommandManagerTest.run() method performs a simple check of the command strings specified by all commands in CommandManager.

RN_619 image 11

ClientArgumentUtilTest and CommandManagerTest were added to TestUtil.

RN_619 image 12