Commit 9737f259 authored by Adam Knapp's avatar Adam Knapp

Documenting titan_java_start.sh and correcting the script name in the

help text

Change-Id: Ifc2efad467373f8d10b020bb409d76c43df51176
Signed-off-by: Adam Knapp's avatarAdam Knapp <adam.knapp@ericsson.com>
parent cfa5e3e2
......@@ -34,7 +34,7 @@ public final class CliScriptGenerator {
private static final String SHELL_SCRIPT_HEADER = "#!/usr/bin/env sh\n";
private static final String SHELL_SCRIPT_TEXT =
"function help() {\n"
+ "\techo \"usage: ttcn3_java_start executable.jar config.cfg [-m|--mode execution_mode] [-p|--project project_name]\"\n"
+ "\techo \"usage: " + SHELL_SCRIPT_NAME + " executable.jar config.cfg [-m|--mode execution_mode] [-p|--project project_name]\"\n"
+ "\techo \" -m|--mode [hc|host_controller|mc|main_controller|p|parallel|s|single]\"\n"
+ "}\n\n"
+ "function proc_mode() {\n"
......
......@@ -137,9 +137,9 @@ Then, the default target has to be set and the path of the JAR file has to be sp
[[Figure-7-automated_jar_export]]
image::images/7_automated_jar_export.png[title="Turning on automated JAR export"]
As a result, 'jarbuild.xml' ANT build script will appear in the project's root and a new ANT builder is specified for the project.
As a result, `jarbuild.xml` ANT build script will appear in the project's root and a new ANT builder is specified for the project.
To build the JAR file, the project has to be built as usual (Right click on the project/Build Project).
At the end of the build process, the ANT will create the executable JAR according to the 'jarbuild.xml'.
At the end of the build process, the ANT will create the executable JAR according to the `jarbuild.xml`.
[NOTE]
====
......@@ -150,6 +150,7 @@ The automated JAR build procedure can be customized on demand. The generated ANT
To turn off the automated JAR export, just set the default target to *Class files*.
[[jar-execution-single]]
==== Executing with JAR files in single mode
The Java side of the TITAN Test Executor, in the case of the exported JAR files, follows the same procedures as the C side does described in the User Guide for TITAN TTCN-3 Test Executor<<8-references.adoc#_3, [3]>>.
......@@ -183,21 +184,42 @@ For example:
java -cp helloWorld.jar org.eclipse.titan.helloWorld.generated.Single_main config.cfg
----
NOTE: During the JAR export process, the selected launch configuration determines the default entry point of the executable JAR file, i.e. either single or parallel execution mode will be started by the 'java -jar' command.
NOTE: During the JAR export process, the selected launch configuration determines the default entry point of the executable JAR file, i.e. either single or parallel execution mode will be started by the `java -jar` command.
[[jar-execution-parallel]]
==== Executing with JAR files in parallel mode
The Java side of the TITAN Test Executor, in the case of the exported JAR files, follows the same procedures as the C side does described in the User Guide for TITAN TTCN-3 Test Executor<<8-references.adoc#_3, [3]>>.
With differences related to executing Java files.
To execute test suites in parallel mode first the Main Controller needs to be started:
To execute test suites in parallel mode first the Main Controller needs to be started.
It is possible to use the Main Controller provided by the TITAN TTCN-3 Test Executor:
[source]
----
$ ./mctr_cli.exe config.cfg
*************************************************************************
* TTCN-3 Test Executor - Main Controller 2 *
* Version: 7.2.1 *
* Version: 7.2.1 *
* Copyright (c) 2000-2021 Ericsson Telecom AB *
* All rights reserved. This program and the accompanying materials *
* are made available under the terms of the Eclipse Public License v2.0 *
* which accompanies this distribution, and is available at *
* https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html *
*************************************************************************
Using configuration file: config.cfg
MC@HU-00000227: Listening on TCP port 7339.
MC2>
----
But for TITAN Java projects it is recommended to use the Java implementation of the Main Controller that is available in the exported JAR file:
----
$ java -cp jar_file.jar org.eclipse.titan.runtime.core.mctr.CliMain config.cfg
*************************************************************************
* TTCN-3 Test Executor - Main Controller 2 *
* Version: 7.2.1 *
* Copyright (c) 2000-2021 Ericsson Telecom AB *
* All rights reserved. This program and the accompanying materials *
* are made available under the terms of the Eclipse Public License v2.0 *
......@@ -244,7 +266,7 @@ java -cp helloWorld.jar org.eclipse.titan.helloWorld.generated.Parallel_main loc
====
The automated JAR export feature builds JAR files in parallel execution mode by default.
Alternatively, the Java based host controller can be started using the 'ttcn3_start' script in parallel mode.
Alternatively, the Java based host controller can be started using the `ttcn3_start` script in parallel mode.
It works the same way as starting an executable generated by the C side of the TITAN Test Executor.
For example:
[source]
......@@ -255,9 +277,38 @@ For example:
==== Tips
It is possible to provide Java VM arguments when executing exported jar files.
It is possible to provide Java VM arguments when executing exported JAR files.
For example:
[source]
----
java -Xmx1024m -jar helloWorld.jar config.cfg
----
==== Executing with `titan_java_start` script
Upon configuring the automated JAR export in the *TITAN Project Property (Java)* page, it is possible to generate a shell script called `titan_java_start.sh` to simplify the start, as well as to support the integration of JAR-based execution in CLI environment (see <<Figure-7-automated_jar_export,Figure 46>>). The name of this script is not configurable and it is created beside the JAR file on request.
The `titan_java_start.sh` script is generated with default values according to the project, however these default values can be be overwritten by using command line options. Therefore, the script can be used to start arbitrary executable JAR package of TITAN Java project. The following arguments and options are supported by the script:
* `configuration_file.cfg`
+
It is *mandatory* to specify a configuration file optionally with its path. The accepted file extension is `.cfg`.
* `executable_JAR.jar`
+
By default the exported JAR file in the same directory is used for this value. It can be overwritten by simply specifying another executable JAR file optionally with its path. This might be necessary, if the script and the JAR file are not located in the same directory. The accepted file extensions for executable JAR files are `.jar` or `.zip`.
* `-m|--mode [hc|host_controller|mc|main_controller|p|parallel|s|single]`
+
By this option the execution mode can be configured. By default the automatic execution in parallel mode is used by utilizing the `ttcn3_start` script, thus installing and configuring the TITAN C/C++ Compiler and Test Executor is required for this mode. Further options are:
** parallel execution mode (default): `p|parallel`
** single execution mode: `s|single`
** host controller only: `hc|host_controller`
** main controller only: `mc|main_controller`
+
The latter two option might be necessary, if a distributed and/or parallel test execution is desired. In this case the same JAR file can be populated and used on separate machines along with the same `titan_java_start.sh` script.
* `-p|--project project_name`
+
By this option the project name contained by the executable JAR file can be overwritten (see section <<jar-execution-single,Executing with JAR files in single mode>> and <<jar-execution-parallel,Executing with JAR files in parallel mode>>). The default project name is determined during the generation of the `titan_java_start.sh` script (see <<Figure-7-automated_jar_export,Figure 46>>).
The order of the listed arguments and options is arbitrary.
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment