Generic Channel API Test Client v.2

Differences from the previous version:
1. The properties file is reloaded before executing a command.
2. Some commands update the properties file.
3. The properties do not have default values.
4. It does not query a token at startup. Instead, there is the getToken command which saves the token to the properties file.
5. No -D option due to (1).
6. The 'login' and 'logout' commands removed.
7. The 'events' command and the event listener added.

This has been tested successfully with Java 1.8
To build, run mvn clean package.

----------------------------------------------------------------------------------------------------------
How to launch

1. The tool uses the External Authorization Client Helper library, so prior to launch you should prepare .jks files
according to the "Setting up certificates and environment" section of the integration manual for the library (integration.pdf).

2. Fill the properties file. See the example test.properties.

3. Create a firewall rule to allow java.exe to listen to the eventCallbackPort port.

4. Launch the test client.

    test-client.bat -p <properties_file>
    or
    test-client.bat <properties_file>

----------------------------------------------------------------------------------------------------------
How to use

Adjust the properties, run a command, adjust the properties, run the next command, and so on.
Use Notepad++ reload alerts or something like that in order to see properties updates immediately.

It is generally OK to run 2 copies of the test client on one properties file.
For example, the first copy for creating/dropping contacts and the second copy for listening to events.
But concurrent execution of 2 commands that modify the properties file can produce an unexpected result.

Commands:
status      - print the current configuration
getToken    - acquire an access token from Authorization Service and save it in the ssoToken property.
getBearerToken - acquire an access token with token-type part (<token-type>+< >+<access_token>) from Authorization Service and save it in the ssoToken property.
create      - send requests to /createcontact
drop        - send request to /dropcontact
attributes  - send request to /getlistofattributes
routePoints - send request to /getlistofroutepoints
events      - event subscription control and event listening
createcontext - send requests to /data/context/schema 
quit        - exit the tool

The 'create', 'drop', and 'events' commands have arguments. The rest of the commands have no arguments.

----------------------------------------------------------------------------------------------------------
The 'create' and 'drop' commands syntax


(create | drop) contactId
    Creates or drops a contact with the specified contactId

(create | drop) [-r rate_in_contacts_per_second] << file

    Takes the contactId list from a plain file.
    contactId0
    contactId1
    ...
    If the optional -r argument is omitted, the rate is defaulted to 1 per second.

create -n number_of_contacts [-r rate_in_contacts_per_second] [(>|>>) file]

    The contact ID is the contactIDPrefix property value plus the timestamp.
    The contact ID list is written (>) or appended (>>) to the file.
    The file can then be used for "drop << file".
	
create -c contextID -i contactID
	Creates a contact with the specified contactId and contextID (a same as workRequestId)

----------------------------------------------------------------------------------------------------------
The 'events' command syntax

The properties eventConnectorHost, eventFamily, eventTypes, eventCallbackHost, eventCallbackPort are used only to create new subscription.
Subsequent calls to 'events *' read from the eventSubscription property.
One subscription per test client instance can be created.

There is a built-in event listener. It listens to the port where the events are expected to arrive.
Once started, the listener continues working in the background until the port changed or the test client terminated.
The events are actually displayed only under the 'events' (without arguments) command.

events -s new
    Starts the event listener on the eventCallbackPort so that EventingConnector can send a test event.
    Creates new subscription and initializes the eventSubscription property.

events -s del
    Deletes the subscription and clears the eventSubscription property.

events -s query
    Queries the info about the subscription.

events -s renew
    Renews the subscription.

events [(>|>>) file]
    Starts the event listener on the port saved in the eventSubscription property.
    Shows the events and optionally writes (>) or appends (>>) them to a file.
	
	----------------------------------------------------------------------------------------------------------
The 'createcontext' command syntax

createcontext testcontext2
	create context with contextID "testcontext2" on the CoreDataService
