diff options
Diffstat (limited to 'tools')
5 files changed, 0 insertions, 353 deletions
diff --git a/tools/simple-wsclient/src/site-docs/adoc/fragments/clients.adoc b/tools/simple-wsclient/src/site-docs/adoc/fragments/clients.adoc deleted file mode 100644 index e1531bf79..000000000 --- a/tools/simple-wsclient/src/site-docs/adoc/fragments/clients.adoc +++ /dev/null @@ -1,22 +0,0 @@ -// -// ============LICENSE_START======================================================= -// Copyright (C) 2016-2018 Ericsson. All rights reserved. -// ================================================================================ -// This file is licensed under the CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE -// Full license text at https://creativecommons.org/licenses/by/4.0/legalcode -// -// SPDX-License-Identifier: CC-BY-4.0 -// ============LICENSE_END========================================================= -// -// @author Sven van der Meer (sven.van.der.meer@ericsson.com) -// - -== Simple Websocket Clients - -In a full installation, the APEX applications provide two demo Websocket clients: echo and console. -The __echo__ client connects to a Websocket server and prints all events it receives (reading text/string from Websocket). -The __console__ client connects to a Websocket server, takes strings from the console (multi-line JSON encoded string starting with ‘{‘ and ending with ‘}’) and sends them as text via a Websocket. - -Both demo clients use `Java-WebSocket` and have no further dependency on APEX: - -- link:https://search.maven.org/#artifactdetails%7Corg.java-websocket%7CJava-WebSocket%7C1.3.4%7Cjar[Websocket implementation] diff --git a/tools/simple-wsclient/src/site-docs/adoc/fragments/run-console.adoc b/tools/simple-wsclient/src/site-docs/adoc/fragments/run-console.adoc deleted file mode 100644 index 04d37613a..000000000 --- a/tools/simple-wsclient/src/site-docs/adoc/fragments/run-console.adoc +++ /dev/null @@ -1,77 +0,0 @@ -// -// ============LICENSE_START======================================================= -// Copyright (C) 2016-2018 Ericsson. All rights reserved. -// ================================================================================ -// This file is licensed under the CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE -// Full license text at https://creativecommons.org/licenses/by/4.0/legalcode -// -// SPDX-License-Identifier: CC-BY-4.0 -// ============LICENSE_END========================================================= -// -// @author Sven van der Meer (sven.van.der.meer@ericsson.com) -// - -== Run the Websocket Console Client - -The console client is included in an APEX full installation. -To run the client, open a new shell (Unix, Cygwin) or command prompt (`cmd` on Windows). -Then use the APEX application launcher to start the client. - -[IMPORTANT] -.APEX engine needs to run first -==== -The example assumes that an APEX engine configured for __consume__ carrier technology Websocket and __JSON__ event protocol is executed first. -==== - - -[width="100%",options="header",cols="5a,5a"] -|==================== -| Unix, Cygwin | Windows -| -[source%nowrap,sh] ----- -# $APEX_HOME/bin/apexApps.sh ws-console [args] ----- -| -[source%nowrap,bat] ----- -> %APEX_HOME%\bin\apexApps.bat ws-console [args] ----- -|==================== - -Use the following command line arguments for server and port of the Websocket server. -The port should be the same as configured in the APEX engine. -The server host should be the host on which the APEX engine is running - -- `-p` defines the Websocket port to connect to (defaults to `8887`) -- `-s` defines the host on which a Websocket server is running (defaults to `localhost`) - -Let's assume that there is an APEX engine running, configured for consume Websocket carrier technology, as server, for port 42450, with consume event protocol JSON,. -If we start the console client on the same host, we can omit the `-s` options. -We start the console client as: - -[source%nowrap,bat] ----- -# $APEX_HOME/bin/apexApps.sh ws-console -p 42450 <1> -> %APEX_HOME%\bin\apexApps.sh ws-console -p 42450 <2> ----- -<1> Start client on Unix or Cygwin -<2> Start client on Windows - -Once started successfully, the client will produce the following messages (assuming we used `-p 42450` and an APEX engine is running on `localhost` with the same port: - -[source%nowrap,bat] ----- - -ws-simple-console: starting simple event console - --> server: localhost - --> port: 42450 - - - terminate the application typing 'exit<enter>' or using 'CTRL+C' - - events are created by a non-blank starting line and terminated by a blank line - - -ws-simple-console: opened connection to APEX (Web Socket Protocol Handshake) - ----- - diff --git a/tools/simple-wsclient/src/site-docs/adoc/fragments/run-echo.adoc b/tools/simple-wsclient/src/site-docs/adoc/fragments/run-echo.adoc deleted file mode 100644 index 213b4acbc..000000000 --- a/tools/simple-wsclient/src/site-docs/adoc/fragments/run-echo.adoc +++ /dev/null @@ -1,79 +0,0 @@ -// -// ============LICENSE_START======================================================= -// Copyright (C) 2016-2018 Ericsson. All rights reserved. -// ================================================================================ -// This file is licensed under the CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE -// Full license text at https://creativecommons.org/licenses/by/4.0/legalcode -// -// SPDX-License-Identifier: CC-BY-4.0 -// ============LICENSE_END========================================================= -// -// @author Sven van der Meer (sven.van.der.meer@ericsson.com) -// - -== Run the Websocket Echo Client - -The echo client is included in an APEX full installation. -To run the client, open a new shell (Unix, Cygwin) or command prompt (`cmd` on Windows). -Then use the APEX application launcher to start the client. - -[IMPORTANT] -.APEX engine needs to run first -==== -The example assumes that an APEX engine configured for __produce__ carrier technology Websocket and __JSON__ event protocol is executed first. -==== - - -[width="100%",options="header",cols="5a,5a"] -|==================== -| Unix, Cygwin | Windows -| -[source%nowrap,sh] ----- -# $APEX_HOME/bin/apexApps.sh ws-echo [args] ----- -| -[source%nowrap,bat] ----- -> %APEX_HOME%\bin\apexApps.bat ws-echo [args] ----- -|==================== - -Use the following command line arguments for server and port of the Websocket server. -The port should be the same as configured in the APEX engine. -The server host should be the host on which the APEX engine is running - -- `-p` defines the Websocket port to connect to (defaults to `8887`) -- `-s` defines the host on which a Websocket server is running (defaults to `localhost`) - -Let's assume that there is an APEX engine running, configured for produce Websocket carrier technology, as server, for port 42452, with produce event protocol JSON,. -If we start the console client on the same host, we can omit the `-s` options. -We start the console client as: - -[source%nowrap,bat] ----- -# $APEX_HOME/bin/apexApps.sh ws-echo -p 42452 <1> -> %APEX_HOME%\bin\apexApps.bat ws-echo -p 42452 <2> ----- -<1> Start client on Unix or Cygwin -<2> Start client on Windows - -Once started successfully, the client will produce the following messages (assuming we used `-p 42452` and an APEX engine is running on `localhost` with the same port: - -[source%nowrap,bat] ----- - - -ws-simple-echo: starting simple event echo - --> server: localhost - --> port: 42452 - -Once started, the application will simply print out all received events to standard out. -Each received event will be prefixed by '---' and suffixed by '====' - - -ws-simple-echo: opened connection to APEX (Web Socket Protocol Handshake) - - ----- - diff --git a/tools/tools-common/src/site-docs/adoc/fragments/example-cli-version.adoc b/tools/tools-common/src/site-docs/adoc/fragments/example-cli-version.adoc deleted file mode 100644 index 178799c44..000000000 --- a/tools/tools-common/src/site-docs/adoc/fragments/example-cli-version.adoc +++ /dev/null @@ -1,50 +0,0 @@ -// -// ============LICENSE_START======================================================= -// Copyright (C) 2016-2018 Ericsson. All rights reserved. -// ================================================================================ -// This file is licensed under the CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE -// Full license text at https://creativecommons.org/licenses/by/4.0/legalcode -// -// SPDX-License-Identifier: CC-BY-4.0 -// ============LICENSE_END========================================================= -// -// @author Sven van der Meer (sven.van.der.meer@ericsson.com) -// - -== Autoversioning an Application - -The APEX utilities project provides means to versioning an application automatically towards the APEX version it is written for. -This is realized by generating a file called `app-version.txt` that includes the Maven project version. -This file is then automatically deployed in the folder `etc` of a full APEX distribution. -The CLI Parser here provides a mthod to access this version for an application. - -First, create a new CLI Parser object, add some options (in the example an option for version, but any options will do), then parse the command line: - -[source,java,linenums,subs="attributes+"] ----- -include::{adsite-tools-common-dir}/test/java/org/onap/policy/apex/tools/common/docs/ExampleAppVersionTest.java[tags=setupParser,indent=0] ----- - -Next, we check if the version option was used in the command line and print application name and version if it was used: - -[source,java,linenums,subs="attributes+"] ----- -include::{adsite-tools-common-dir}/test/java/org/onap/policy/apex/tools/common/docs/ExampleAppVersionTest.java[tags=processCliVersion,indent=0] ----- - -The output will be: - -[source,sh,subs="attributes+"] ----- -myApp {release-version} ----- - -The auto-version information comes from the method call `cli.getAppVersion()` in line 2 in the example above. -The method is defined in the `CliParser` class as: - -[source,java,linenums,subs="attributes+"] ----- -include::{adsite-tools-common-dir}/main/java/org/onap/policy/apex/tools/common/CliParser.java[tags=cliParserVersion,indent=0] ----- - -The file `app-version.txt` is automatically added to an APEX full distribution, as described above (for details on this see the POM files in the APEX application packaging projects). diff --git a/tools/tools-common/src/site-docs/adoc/fragments/example-cli.adoc b/tools/tools-common/src/site-docs/adoc/fragments/example-cli.adoc deleted file mode 100644 index d2edc446d..000000000 --- a/tools/tools-common/src/site-docs/adoc/fragments/example-cli.adoc +++ /dev/null @@ -1,125 +0,0 @@ -// -// ============LICENSE_START======================================================= -// Copyright (C) 2016-2018 Ericsson. All rights reserved. -// ================================================================================ -// This file is licensed under the CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE -// Full license text at https://creativecommons.org/licenses/by/4.0/legalcode -// -// SPDX-License-Identifier: CC-BY-4.0 -// ============LICENSE_END========================================================= -// -// @author Sven van der Meer (sven.van.der.meer@ericsson.com) -// - -== CLI Example - -Using the APEX CLI utilities can be done as follows. -First, add the dependency of the utility project to your POM file. - -[source,xml,subs="attributes+"] ----- -<dependency> - <groupId>org.onap.policy.apex-pdp.tools</groupId> - <artifactId>tools-common</artifactId> - <version>{release-version}</version> -</dependency> ----- - -Now, create a new application project, for instance `MyApp`. -In this project, create a new main application class as `Application.java`. -In this class, create a new main method as `public static void main(String[] args)`. - -No use the provided `CliOptions` and `CliParser`. -Manually importing means to add the following lines to the start of your application (in Eclipse this import will be done automatically): - -[source,java, linenums,subs="attributes+"] ----- -include::{adsite-tools-common-dir}/test/java/org/onap/policy/apex/tools/common/docs/ExampleCliParserTest.java[tags=import,indent=0] ----- - -Now, inside your `main()` method, start setting some general application properties. -Important are the application name and some description of your application. -For instance: - -[source,java,linenums,subs="attributes+"] ----- -include::{adsite-tools-common-dir}/test/java/org/onap/policy/apex/tools/common/docs/ExampleCliParserTest.java[tags=setApp,indent=0] ----- - -Next, create a new CLI Parser and add a few CLI options from the standard `CliOptions`. -The following example adds options for help, version, and a model file: - -[source,java,linenums,subs="attributes+"] ----- -include::{adsite-tools-common-dir}/test/java/org/onap/policy/apex/tools/common/docs/ExampleCliParserTest.java[tags=setCli,indent=0] ----- - -Next, parse the given CLI arguments: - -[source,java,linenums,subs="attributes+"] ----- -include::{adsite-tools-common-dir}/test/java/org/onap/policy/apex/tools/common/docs/ExampleCliParserTest.java[tags=parseCli,indent=0] ----- - -Once the command line is parsed, we can look into the individual options, check if they are set, and then act accordingly. -We start with the option for __help__. -If the option is present, we print a help screen and return: - -[source,java,linenums,subs="attributes+"] ----- -include::{adsite-tools-common-dir}/test/java/org/onap/policy/apex/tools/common/docs/ExampleCliParserTest.java[tags=processCliHelp,indent=0] ----- - -Next, we process the option for __version__. -Here, we want to print a version for our application and return. -The CLI Parser already provides a method to obtain the correct version for an APEX build, so we use that: - -[source,java,linenums,subs="attributes+"] ----- -include::{adsite-tools-common-dir}/test/java/org/onap/policy/apex/tools/common/docs/ExampleCliParserTest.java[tags=processCliVersion,indent=0] ----- - -Once help and version arguments are processed, we can proceed to look at all other options. -We have added an option for a model file, so check this option and test if we can actually load a model file with the given argument. -If we can load a model, everything is ok. -If we cannot load a model, we print an error and return. - -[source,java,linenums,subs="attributes+"] ----- -include::{adsite-tools-common-dir}/test/java/org/onap/policy/apex/tools/common/docs/ExampleCliParserTest.java[tags=processCliModel,indent=0] ----- - -With a model file being loadable, we finish parsing command line arguments. -We also print some status messages to note that the application now is ready to start: - -[source,java,linenums,subs="attributes+"] ----- -include::{adsite-tools-common-dir}/test/java/org/onap/policy/apex/tools/common/docs/ExampleCliParserTest.java[tags=someStartPrint,indent=0] ----- - -The last action now is to run the actual application. -The example below is taken from a version of the `Model2Cli` application, which creates a new object and runs it in a `try` block, since exceptions might be thrown by the object: - -[source,java,linenums,subs="attributes+"] ----- -include::{adsite-tools-common-dir}/test/java/org/onap/policy/apex/tools/common/docs/ExampleCliParserTest.java[tags=yourApp,indent=0] ----- - -If this new application is now called with the command line `-h` or `--help` it will print the following help screen: - -[source,sh,subs="attributes+"] ----- -test-app v{release-version} - a test app for documenting how to use the CLI utilities -usage: test-app - -h,--help prints this help and usage screen - -m,--model <MODEL-FILE> set the input policy model file - -v,--version prints the application version ----- - -If this new application is called with the option `-v` or `--version` it will print its version information as: - -[source,sh,subs="attributes+"] ----- -test-app {release-version} ----- - |