7-launching_TITAN_Java_projects.adoc 8.64 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
= Launching TITAN Java Projects
:figure-number: 42

This chapter describes the launching modes of TITAN Java projects.

After building a TITAN Java project, it is ready to be launched as a Java project.
In Eclipse, every aspect of the launch can be configured, for example, different environmental settings can be created by creating different launch configurations, without modifying the system environment variables, so different test environments can be created.

NOTE: Right now the Java side of the TITAN Test Executor is supported as a Java application native to Eclipse. It as executed with the same limitations and benefits.

Adam Knapp's avatar
Adam Knapp committed
11
WARNING: The execution of TITAN Java projects (the Java side of the Test Executor) is done as Eclipse native Java applications. It is not yet fully integrated to the usual Interface elements like Views that support the execution of the binaries of the C side of the TITAN Test Executor.
12
13
14
15

[[launching-modes-supported-by-the-TITAN-Executor-plug-in-for-TITAN-Java-Projects]]
== The Launching Modes Supported by the TITAN Executor Plug-in for TITAN Java Projects

Adam Knapp's avatar
Adam Knapp committed
16
The TITAN Executor can operate in single or in parallel mode.
17

balaskoa's avatar
balaskoa committed
18
19
From the point of view there are 2 ways to execute TITAN Java projects: 
from Eclipse as Java projects and executing exported jar files.
20
21
22

=== Executing TITAN Java Projects from Eclipse

Adam Knapp's avatar
Adam Knapp committed
23
24
To execute TITAN Java projects inside Eclipse requires the creation of a Launch configuration. For TITAN Java Projects the TITAN Native Java launch configuration mode is necessary that supports both the single and parallel execution modes. Launch configurations can be created, modified and deleted in the *Create, manage, and run configuration* dialog window. It can be opened in numerous ways as detailed in <<creating-launch-configuration,Creating Launch Configuration>>:

Adam Knapp's avatar
Adam Knapp committed
25
* using the *Run as* option in pop-up menu of the *Project explorer* (<<Figure-4-F7,Figure 7>>),
Adam Knapp's avatar
Adam Knapp committed
26

Adam Knapp's avatar
Adam Knapp committed
27
* using the *Launch Commands* on the toolbar (<<Figure-4-F8,Figure 8>>).
28

Adam Knapp's avatar
Adam Knapp committed
29
Furthermore, a default launch configuration can be created using launch shortcuts. It works the same way as described in <<creating-launch-configuration,Creating Launch Configuration>>, however the TITAN Native Java launching mode requires less option, i.e.:
30

Adam Knapp's avatar
Adam Knapp committed
31
. A new launch configuration is made.
32

Adam Knapp's avatar
Adam Knapp committed
33
. The project and configuration file paths are initialized.
34

Adam Knapp's avatar
Adam Knapp committed
35
. Finally the newly created launch configuration is launched automatically in parallel execution mode.
36

Adam Knapp's avatar
Adam Knapp committed
37
The launch configuration created using launch shortcuts is automatically added to favorite list under the *Launch Commands* (<<Figure-4-F8,Figure 8>>).
38

Adam Knapp's avatar
Adam Knapp committed
39
NOTE: It is encouraged to use the launch shortcuts to reduce the number of possible mistakes. The generated launch configuration is still editable in the *Create, manage, and run configuration* dialog window (see below).
40

Adam Knapp's avatar
Adam Knapp committed
41
=== Basic Main Controller Options Page of the Launch Configuration
42

Adam Knapp's avatar
Adam Knapp committed
43
44
[[Figure-7-F43]]
image::images/7_F43.png[title="Basic Main Controller options page"]
45

Adam Knapp's avatar
Adam Knapp committed
46
On this page it is possible to set:
47

Adam Knapp's avatar
Adam Knapp committed
48
* The name of the project.
49
+
Adam Knapp's avatar
Adam Knapp committed
50
Filling this field is mandatory. The entered name is checked for validity. The project's root folder is used during the automatically filling of the other fields. The path variables are relative to the project's root supporting the portability of the project as whole. If you enter the name of a valid project with TITAN nature (or select one by browsing, as can be seen on <<Figure-13,Figure 13>>), the configuration file will be filled in automatically.
51

Adam Knapp's avatar
Adam Knapp committed
52
NOTE: It is encouraged to use the *Browse Workspace* button to select a valid project from the workspace that simplifies the filling of the other fields, as well as reduces the possible mistakes. 
53

Adam Knapp's avatar
Adam Knapp committed
54
* The path of the configuration file.
55
+
Adam Knapp's avatar
Adam Knapp committed
56
Please note that not only the existence but also the validity of the configuration file is evaluated here. If a problem was found while trying to process the configuration file, the launch process will be interrupted here. Please note that this evaluation is done every time this configuration page becomes active, meaning that switching to and from this page can take some time. The entered file path is checked for validity.
57

Adam Knapp's avatar
Adam Knapp committed
58
* Execute automatically
59
+
Adam Knapp's avatar
Adam Knapp committed
60
Whether the user wish to start executing the configuration file automatically when the launcher is started. Please note that this option is turned on by default.
61

Adam Knapp's avatar
Adam Knapp committed
62
63
64
* Execute in single mode
+
Whether the user wish to start executing the TITAN Java project in single or in parallel mode. Please note that this option is turned off by default.
65

Adam Knapp's avatar
Adam Knapp committed
66
All fields can be filled in either by entering the proper values, or via browsing for them.
67

Adam Knapp's avatar
Adam Knapp committed
68
If you press *Apply* some other launch configurations will appear automatically according to the filled values in the *Create, manage, and run configuration* dialog window.
69

Adam Knapp's avatar
Adam Knapp committed
70
71
72
[NOTE]
====
During the filling Eclipse might ask for saving the modification.
73

Adam Knapp's avatar
Adam Knapp committed
74
75
Sometimes Eclipse automatically switches to one of the additionally created launch configuration after saving the TITAN Native Java launch configuration.
====
76

Adam Knapp's avatar
Adam Knapp committed
77
The functionality of other tab pages of the TITAN Native Java launch configuration matches the ones for JNI launch mode, see <<creating-launch-configuration,Creating Launch Configuration>>.
78
79
80
81
82
83
84
85
86
87
88
89
90

=== Executing TITAN Java project via exported jar files.

==== Exporting the JAR files.

It is possible to export TITAN Java projects into a single jar file and use them as executables.

To export a .jar file from a TITAN Java project:

1. Select the project in the navigator/project explorer view.

2. In the right click menu, select *Export...*.

Adam Knapp's avatar
Adam Knapp committed
91
3. In the window appearing select *Java / Runnable JAR file* and than *Next* (see <<Figure-7-F46,below>>).
92
93
94
95
+
[[Figure-7-F46]]
image::images/7_F46.png[title="Export wizard"]

Adam Knapp's avatar
Adam Knapp committed
96
4. Configure the export (see <<Figure-7-F47,below>>).
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
+
[[Figure-7-F47]]
image::images/7_F47.png[title="Export wizard for JAR file"]
+
The following options are available:

* *Launch Configuration*: select the launch configuration that configures the execution for this jar file. This will set the class to be used for execution.

* *Export destination*: select the file into which the export should be done.

* *Library handling*: It is possible to configure how the libraries are handled in the resulting jar. We recommend selecting the *Package required libraries into generated JAR*

5. Select *Finish*.

==== 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]>>.
With differences related to executing Java files.

For example executing a generated executable, in single mode, on the C side:
[source]
----
./regressionTestSmall.exe minimal1.cfg
----

Executing an exported jar file, in single mode, on the Java side:
[source]
----
java -jar regressionTestSmall.jar minimal1.cfg
----

==== 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:
[source]
----
$ ./mctr_cli.exe Perf2.cfg

*************************************************************************
* TTCN-3 Test Executor - Main Controller 2                              *
Kristof Szabados's avatar
Kristof Szabados committed
140
* Version: 7/CAX 105 7730 R2A                                           *
Adam Knapp's avatar
Adam Knapp committed
141
* Copyright (c) 2000-2021 Ericsson Telecom AB                           *
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
* 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: Perf2.cfg
MC@HU-00000227: Listening on TCP port 7339.
MC2>
----

It will tell us, that it accepts connections on the localhost machine, on the port number 7339.

To connect to it, in parallel mode, on the C side:
[source]
----
./regressionTestSmall.exe localhost 7339
----

Executing an exported jar file, in single mode, on the Java side:
[source]
----
java -jar regressionTestSmall.jar localhost 7339
----

==== Tips

It is possible to provide Java VM arguments when executing exported jar files.
For example:
[source]
----
java -Xmx1024m -jar regressionTestSmall.jar minimal1.cfg
----