OTX-Runtime for Java  
Migration 6.x to 7.x

The OTX-Runtime API 7.x is a complete new implementation based at C++. It is independent from the former OTX-Runtime API 6.x (DotNet, Java). Applications which based at the OTX-Runtime API 6.x can be migrate to the OTX-Runtime API 7.x. The picture shows the main structure of the OTX-Runtime API 7.x.

Main Differences

The main differences between OTX-Runtime API 6.x and 7.x are listed in the following table.

Feature 6.x 7.x Description
OTX Runner Own process Own process or inside application process OTX Runner is the process where the OTX logic will be executed
IPC Between Runner and API Sockets Sockets, Pipe or Raw IPC means inter process communication. Raw do not need IPC.
Diagnostic Runtime System (MVCI) Inside Runner Outside Runner inside OTX-DiagManager API DiagManager can be run inside its own process and is stand-alone usable
IPC Between Runner and DiagManager - Sockets, Pipe or Raw IPC means inter process communication. Raw do not need IPC.
Configuration and start Diagnostic Runtime System Implicit inside Runner Explicit with DiagManager IPC means inter process communication. Raw do not need IPC.
Implementations for access to external systems Implicit inside Runner Explicit outside Runner inside so called Custom Implementations CustomImplementations can be changed by the user. A default custom implementation with the same functionality like in 6.x will delivered together with the OTX-Runtime API. Some custom implementations, e.g. DefaultCustomScreenImplementation must be set explicitly, see example below.
API entry point RuntimeManager RuntimeManagerFactory and IRuntimeManager The main structures of the APIs are very similar

7.x Sample Code

The basic proceeding how the OTX-Runtime API 7.x can be used is described in the following pseudo code example. The example executes the main procedure of a PTX file.

// Generally applicable Pseudo-Code example
// ========================================
// Please note that the exact syntax of C++, DotNet and Java is different!
void main()
{
// Release the license manager
// ===========================
OpenTestSystem.Otx.Runtime.Api.License.LicenseManager.SetLicenseKey("XXXXX-XXXXX-XXXXX-XXXXX-XXXXX");
// Create the RuntimeManager and connect it to DiagManager
// =======================================================
// Creates the RuntimeManager at automatic selected port connected with DiagManager at port 8888
// Please note that the DiagManager must be started, e.g. via DiagManagerSample.exe!
OpenTestSystem.Otx.Runtime.Api.IRuntimeManager runtimeManager = null;
// Create callbacks for RuntimeManager events
// ==========================================
runtimeManager.OnProcedureStarted += ProcedureStartedHandler(ProcedureStarted);
runtimeManager.OnProcedureFinished += ProcedureFinishedHandler(ProcedureFinished);
runtimeManager.OnProcedureStopped += ProcedureStoppedHandler(ProcedureStopped);
runtimeManager.OnProcedureAborted += ProcedureAbortedHandler(ProcedureAborted);
// Set trace folder and level
RuntimeConfig.Instance.TraceFolder = "C://");
RuntimeConfig.Instance.TraceLevel = TraceLevels.All;
// Set CustomScreen implementations
// ================================
// Create custom implementation and set to the RuntimeManager
CustomScreenImplementation customScreenImplementation = new CustomScreenImplementation();
runtimeManager.SetCustomImplementation(customScreenImplementation);
// Load PTX file and browse OTX data structure
// ===========================================
OpenTestSystem.Otx.Runtime.Api.Project.IProject project = runtimeManager.LoadPtx("C:\\HelloWorldSample1.ptx");
OpenTestSystem.Otx.Runtime.Api.Otx.IProcedure procedure = project.MainProcedure;
if (procedure != null)
{
if (procedure.Parameters.Size > 0)
{
// Assume the first parameter is an InParameter of data type String
OpenTestSystem.Otx.Runtime.Api.Otx.IProcedureParameter parameter = procedure.Parameters[0];
if (parameter.DataType == "String" && parameter is OpenTestSystem.Otx.Runtime.Api.Otx.IProcedureInParameter)
{
(OpenTestSystem.Otx.Runtime.Api.Otx.IProcedureInParameter) parameter.Value = "Hello World";
}
}
// Executes the procedure synchronous
// ==================================
OpenTestSystem.Otx.Runtime.Api.IRuntimeContext runtimeContext = runtimeManager.Execute(procedure);
if (runtimeContext.IsFinished)
{
// Procedure finished successfully
}
else if (runtimeContext.IsStopped)
{
// Procedure was stopped by the user
}
else if (runtimeContext.HasRuntimeException)
{
// Procedure was terminated by a runtime exception
}
else if (runtimeContext.HasOtxException)
{
// Procedure was terminated by an OTX exception
}
else
{
// Procedure was finished by another reason
}
}
}
Class to manage the OTX-Runtime API licenses.
Definition: LicenseManager.java:9
static void SetLicenseKey(String licenseKey)
Sets a valid license key to release the API.
Definition: LicenseManager.java:23
Factory class for creating runtime managers, see IRuntimeManager.
Definition: RuntimeManagerFactory.java:10
static IRuntimeManager CreateSocketRuntimeManager(int otxRunnerPort)
Creates SocketRuntimeManager without DiagManager.
Definition: RuntimeManagerFactory.java:32
Contains information of a Runner instance.
Definition: IRuntimeContext.java:14
Runs a PTX/PPX file directly.
Definition: IRuntimeManager.java:17
Represents an OTX Procedure.
Definition: IProcedure.java:6
Represents InParameter of a Procedure.
Definition: IProcedureInParameter.java:8
Represents base class for InParameter, OutParameter and InOutParameter of a Procedure.
Definition: IProcedureParameter.java:8
Contains Packages and settings.
Definition: IProject.java:15
Package containing all objects related to licensing.
Definition: IpcLicenseCheckerBase.java:1
Package for browsing at OTX data structure.
Definition: IContextVariable.java:1
Package containing main entries: IProject and IPlayerProject.
Definition: IPlayerProject.java:1
Package containing the programming interface for browsing and execution of OTX procedures in own appl...
Definition: ApiConstants.java:1
Package containing all objects for browsing and execution of OTX procedures.
Definition: opentestsystem.otx.runtime2.api/src/main/java/opentestsystem/otx/runtime/package-info.java:4
Package containing all objects which are standardized according to ISO 13209 (OTX)
Package containing all objects related to testing inside automotive industry.

OTX file related to the examples above.

<?xml version="1.0" encoding="utf-8"?>
<otx xmlns="http://iso.org/OTX/1.0.0" xmlns:hmi="http://iso.org/OTX/1.0.0/HMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="id_0a4aa7adb9484acd80fd9b8cc0889d1c" name="HelloWorldSampleDocument" package="HelloWorldSample1Package1" version="1.0.0.0" timestamp="2020-04-30T15:12:52.8454075+02:00">
<metaData>
<data key="MadeWith">Created by emotive Open Test Framework - www.emotive.de</data>
<data key="OtfVersion">6.3.0.35819</data>
</metaData>
<procedures>
<procedure id="id_9fd318a128cd4945aa7ed8d5cd57c0b8" name="main" visibility="PUBLIC">
<realisation>
<parameters>
<inParam name="Message" id="InParameterDeclaration_9d68143af6864f9b89691051826e9f9a">
<realisation>
<dataType xsi:type="String" />
</realisation>
</inParam>
</parameters>
<flow>
<action name="ConfirmDialog1" id="ConfirmDialog_9f6feabe81034ffab0d6113e65df827f">
<realisation xsi:type="hmi:ConfirmDialog">
<hmi:title xsi:type="StringLiteral" value="Hello World" />
<hmi:message xsi:type="StringValue" valueOf="Message" />
</realisation>
</action>
</flow>
</realisation>
</procedure>
</procedures>
</otx>