Some demos deleted
diff --git a/demo/SpecExplorer/Project/MBT_SIP.sln b/demo/SpecExplorer/Project/MBT_SIP.sln
deleted file mode 100644
index 739f237..0000000
--- a/demo/SpecExplorer/Project/MBT_SIP.sln
+++ /dev/null
@@ -1,35 +0,0 @@
-
-Microsoft Visual Studio Solution File, Format Version 11.00
-# Visual Studio 2010
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestSuite", "MBT_SIP\TestSuite\TestSuite.csproj", "{30090E84-4B5F-4E61-B57C-D7E9A3EC999D}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Model", "MBT_SIP\Model\Model.csproj", "{A62A6869-D02F-4A7D-B41E-0C1E2A1DD4C9}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Adapter", "MBT_SIP\Implementation\Adapter.csproj", "{E9DBC668-9BC2-4650-A70E-AE9A8F293E8F}"
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|Any CPU = Debug|Any CPU
- Release|Any CPU = Release|Any CPU
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {30090E84-4B5F-4E61-B57C-D7E9A3EC999D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {30090E84-4B5F-4E61-B57C-D7E9A3EC999D}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {30090E84-4B5F-4E61-B57C-D7E9A3EC999D}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {30090E84-4B5F-4E61-B57C-D7E9A3EC999D}.Release|Any CPU.Build.0 = Release|Any CPU
- {A62A6869-D02F-4A7D-B41E-0C1E2A1DD4C9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {A62A6869-D02F-4A7D-B41E-0C1E2A1DD4C9}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {A62A6869-D02F-4A7D-B41E-0C1E2A1DD4C9}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {A62A6869-D02F-4A7D-B41E-0C1E2A1DD4C9}.Release|Any CPU.Build.0 = Release|Any CPU
- {E9DBC668-9BC2-4650-A70E-AE9A8F293E8F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {E9DBC668-9BC2-4650-A70E-AE9A8F293E8F}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {E9DBC668-9BC2-4650-A70E-AE9A8F293E8F}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {E9DBC668-9BC2-4650-A70E-AE9A8F293E8F}.Release|Any CPU.Build.0 = Release|Any CPU
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
- GlobalSection(SpecExplorer.ActivityCompletionStatus) = preSolution
- SpecExplorer.ActivityCompletionStatus =
- EndGlobalSection
-EndGlobal
diff --git a/demo/SpecExplorer/Project/MBT_SIP.suo b/demo/SpecExplorer/Project/MBT_SIP.suo
deleted file mode 100644
index 27b6b2d..0000000
--- a/demo/SpecExplorer/Project/MBT_SIP.suo
+++ /dev/null
Binary files differ
diff --git a/demo/SpecExplorer/Project/MBT_SIP/Implementation/Adapter.cs b/demo/SpecExplorer/Project/MBT_SIP/Implementation/Adapter.cs
deleted file mode 100644
index 5552754..0000000
--- a/demo/SpecExplorer/Project/MBT_SIP/Implementation/Adapter.cs
+++ /dev/null
@@ -1,271 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-using Export2TTCN;
-
-namespace MBT.Adapter
-{
- public class NewExporter : TTCNExporter
- {
- public NewExporter(string p_modulename,string p_path) : base(p_modulename,p_path)
- {
- }
-
- protected override void write_imports()
- {
- if (!is_started()) return;
- write("import from MBT_SpecExpl_Demo all;");
- write("import from EPTF_MBT_LGen_Definitions all;");
- }
-
- protected override void write_types()
- {
- if (!is_started()) return;
-
-
- write("type port netInPort message\n {\n inout SIPResp;\n inout SIPReq;\n } with { extension \"internal\" }\n");
- write("type port userInPort message\n {\n inout UserInput;\n } with { extension \"internal\" }\n");
- write("type port netOutPort message\n {\n inout SIPResp;\n inout SIPReq;\n } with { extension \"internal\" }\n");
- write("type port userOutPort message\n {\n inout TimeOutIndication;\n } with { extension \"internal\" }\n");
-
- write("type record SIPReq\n {\n charstring op,\n charstring param_\n }\n");
- write("type record SIPResp\n {\n integer status,\n charstring cseq\n }\n");
- write("type record UserInput\n {\n charstring input1,\n charstring input2\n }\n");
- write("type record TimeOutIndication\n {\n\n }\n");
-
- write("type component SpecExpl_CT extends MBT_SpecExpl_Demo_Main_CT\n {\n port netInPort netIn;\n port userInPort userIn;\n port netOutPort netOut;\n port userOutPort userOut;\n timer harnessTimer := 0.0;\n }\n");
- }
-
- protected override void write_altsteps()
- {
- if (!is_started()) return;
- write("altstep SpecExplDefaultAlt() runs on SpecExpl_CT\n {");
- ind_p();
- write("[] any port.receive\n {\n harnessTimer.stop;\n setverdict(fail);\n f_MBT_SpecExpl_Demo_endTestCase();\n stop;\n }");
- write("[] harnessTimer.timeout\n {\n setverdict(fail);\n f_MBT_SpecExpl_Demo_endTestCase();\n stop;\n }");
- ind_n();
- write("}");
- }
-
- protected override void write_else()
- {
- if (!is_started()) return;
- write("function specexpl_send_SIPResp_to_netIn(template SIPResp msgToSend) runs on SpecExpl_CT");
- write("{");
- ind_p();
- write("netIn.send(msgToSend);");
- ind_n();
- write("}\n");
-
- write("function specexpl_send_SIPReq_to_netIn(template SIPReq msgToSend) runs on SpecExpl_CT");
- write("{");
- ind_p();
- write("netIn.send(msgToSend);");
- ind_n();
- write("}\n");
-
- write("function specexpl_send_UserInput_to_userIn(template UserInput msgToSend) runs on SpecExpl_CT");
- write("{");
- ind_p();
- write("userIn.send(msgToSend);");
- ind_n();
- write("}\n");
-
- write("function specexpl_receive_SIPResp_from_netOut(template SIPResp tmplToMatch) runs on SpecExpl_CT");
- write("{");
- ind_p();
- write("netOut.receive(tmplToMatch);");
- ind_n();
- write("}\n");
-
- write("function specexpl_receive_SIPReq_from_netOut(template SIPReq tmplToMatch) runs on SpecExpl_CT");
- write("{");
- ind_p();
- write("netOut.receive(tmplToMatch);");
- ind_n();
- write("}\n");
-
- write("function specexpl_receive_TimeOutIndication_from_userOut(template TimeOutIndication tmplToMatch) runs on SpecExpl_CT");
- write("{");
- ind_p();
- write("userOut.receive(tmplToMatch);");
- ind_n();
- write("}\n");
- }
-
- public void send(string command, string message)
- {
- write_tc(command + "(" + message + ");");
- //write_tc("oldtimer := 0.0;");
- }
-
- public void receive(string command, string message, double wait)
- {
- write_tc("harnessTimer.start(" + wait.ToString("F2") + " + SLACK);");
- //write_tc("log(\"Waiting for: " + message + "\");");
- write_tc(command + "(" + message + ");");
- write_tc("harnessTimer.stop;");
- //write_tc("oldtimer := 0.0;");
- }
-
- protected override void beginning_tc()
- {
- write_tc("var float oldtimer := 0.0;");
- write_tc("var float SLACK := 10.0;");
- write_tc("var default default_behaviour_ref;");
- write_tc("f_MBT_SpecExpl_Demo_beginTestCase();");
- write_tc("default_behaviour_ref := activate(SpecExplDefaultAlt());");
- }
-
- protected override void ending_tc()
- {
- write_tc("setverdict(pass);");
- write_tc("deactivate(default_behaviour_ref);");
- write_tc("f_MBT_SpecExpl_Demo_endTestCase();");
- }
-
- }
-
- public static class Adapter
- {
- private static NewExporter exporter = new NewExporter("MBT_SpecExpl_Testcases", "C:/Users/eolicze/Documents/Visual Studio 2010/Projects/MBT_SIP/");
- private static double[] timeouts = {0.0, 0.5, 1.0, 2.0, 4.0};
-
- public static void start()
- {
- /**/
- exporter.start();
- }
-
- public static void end()
- {
- exporter.end();
- }
-
- private static string getmessage_UserInput(string input1, string input2)
- {
- return "{" +
- "input1 := \"" + input1 + "\", " +
- "input2 := \"" + input2 + "\"}";
- }
-
- private static string getmessage_SIPReq(string op, string param_)
- {
- return "{" +
- "op := \"" + op + "\", " +
- "param_ := \"" + param_ + "\"}";
- }
-
- private static string getmessage_SIPResp(int status, string cseq)
- {
- return "{" +
- "status := " + status + ", " +
- "cseq := \"" + cseq + "\"}";
- }
-
- public static void Init_Calling()
- {
- exporter.write_tc("//Init_Calling");
- exporter.write_tc("log(\"Init_Calling\");");
- exporter.send("specexpl_send_UserInput_to_userIn", getmessage_UserInput("invite", "sip:127.0.0.1:5061"));
- exporter.receive("specexpl_receive_SIPReq_from_netOut", getmessage_SIPReq("INVITE", "sip:127.0.0.1:5061"),0.0);
- }
-
- public static void Calling_Ringing()
- {
- exporter.write_tc("//Calling_Ringing");
- exporter.write_tc("log(\"Calling_Ringing\");");
- exporter.send("specexpl_send_SIPResp_to_netIn",getmessage_SIPResp(180,""));
- }
-
- public static void Calling_Timeout()
- {
- exporter.write_tc("//Calling_Timeout");
- exporter.write_tc("log(\"Calling_Timeout\");");
- exporter.send("specexpl_send_UserInput_to_userIn", getmessage_UserInput("invite", "sip:127.0.0.1:5061"));
- foreach (double timeout in timeouts)
- { exporter.receive("specexpl_receive_SIPReq_from_netOut", getmessage_SIPReq("INVITE", "sip:127.0.0.1:5061"), timeout); }
- }
-
- public static void Ringing_Canceling()
- {
- exporter.write_tc("//Ringing_Canceling");
- exporter.write_tc("log(\"Ringing_Canceling\");");
- exporter.send("specexpl_send_UserInput_to_userIn",getmessage_UserInput("cancel",""));
- exporter.receive("specexpl_receive_SIPReq_from_netOut", getmessage_SIPReq("CANCEL", "sip:127.0.0.1:5061"),0.0);
- }
-
- public static void Ringing_Ready()
- {
- exporter.write_tc("//Ringing_Ready");
- exporter.write_tc("log(\"Ringing_Ready\");");
- exporter.send("specexpl_send_SIPResp_to_netIn", getmessage_SIPResp(200, "INVITE"));
- exporter.receive("specexpl_receive_SIPReq_from_netOut", getmessage_SIPReq("ACK", "sip:127.0.0.1:5061"),0.0);
- }
-
- public static void Ringing_Reject()
- {
- exporter.write_tc("//Ringing_Reject");
- exporter.write_tc("log(\"Ringing_Reject\");");
- exporter.send("specexpl_send_SIPResp_to_netIn", getmessage_SIPResp(486, "INVITE"));
- exporter.receive("specexpl_receive_SIPReq_from_netOut", getmessage_SIPReq("ACK", "sip:127.0.0.1:5061"),0.0);
- }
-
- public static void Canceling_WaitingResponse()
- {
- exporter.write_tc("//Canceling_WaitingResponse");
- exporter.write_tc("log(\"Canceling_WaitingResponse\");");
- exporter.send("specexpl_send_SIPResp_to_netIn", getmessage_SIPResp(200, "CANCEL"));
- }
-
- public static void Canceling_Timeout()
- {
- exporter.write_tc("//Canceling_Timeout");
- exporter.write_tc("log(\"Canceling_Timeout\");");
- exporter.send("specexpl_send_UserInput_to_userIn", getmessage_UserInput("cancel", ""));
- foreach (double timeout in timeouts)
- { exporter.receive("specexpl_receive_SIPReq_from_netOut", getmessage_SIPReq("CANCEL", "sip:127.0.0.1:5061"), timeout); }
- }
-
- public static void WaitingResponse_Terminate()
- {
- exporter.write_tc("//WaitingResponse_Terminate");
- exporter.write_tc("log(\"WaitingResponse_Terminate\");");
- exporter.send("specexpl_send_SIPResp_to_netIn", getmessage_SIPResp(487, "INVITE"));
- exporter.receive("specexpl_receive_SIPReq_from_netOut", getmessage_SIPReq("ACK", "sip:127.0.0.1:5061"),0.0);
- }
-
- public static void Ready_Terminating()
- {
- exporter.write_tc("//Ready_Terminating");
- exporter.write_tc("log(\"Ready_Terminating\");");
- exporter.send("specexpl_send_UserInput_to_userIn", getmessage_UserInput("bye", ""));
- exporter.receive("specexpl_receive_SIPReq_from_netOut", getmessage_SIPReq("BYE", "sip:127.0.0.1:5061"), 0.0);
- }
-
- public static void Ready_End()
- {
- exporter.write_tc("//Ready_End");
- exporter.write_tc("log(\"Ready_End\");");
- exporter.send("specexpl_send_SIPReq_to_netIn", getmessage_SIPReq("BYE", "sip:127.0.0.1"));
- exporter.receive("specexpl_receive_SIPResp_from_netOut", getmessage_SIPResp(200, "BYE"),0.0);
- }
-
- public static void Terminating_OK()
- {
- exporter.write_tc("//Terminating_OK");
- exporter.write_tc("log(\"Terminating_OK\");");
- exporter.send("specexpl_send_SIPResp_to_netIn", getmessage_SIPResp(200, ""));
- }
-
- public static void Terminating_Timeout()
- {
- exporter.write_tc("//Terminating_Timeout");
- exporter.write_tc("log(\"Terminating_Timeout\");");
- exporter.send("specexpl_send_UserInput_to_userIn", getmessage_UserInput("bye", ""));
- foreach (double timeout in timeouts)
- { exporter.receive("specexpl_receive_SIPReq_from_netOut", getmessage_SIPReq("BYE", "sip:127.0.0.1:5061"), timeout); }
- }
-
- }
-}
diff --git a/demo/SpecExplorer/Project/MBT_SIP/Implementation/Adapter.csproj b/demo/SpecExplorer/Project/MBT_SIP/Implementation/Adapter.csproj
deleted file mode 100644
index 14173f7..0000000
--- a/demo/SpecExplorer/Project/MBT_SIP/Implementation/Adapter.csproj
+++ /dev/null
@@ -1,53 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <ProductVersion>10.0.20714</ProductVersion>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{E9DBC668-9BC2-4650-A70E-AE9A8F293E8F}</ProjectGuid>
- <OutputType>Library</OutputType>
- <AppDesignerFolder>Properties</AppDesignerFolder>
- <RootNamespace>MBT.Implementation</RootNamespace>
- <AssemblyName>TCP_MBT.Implementation</AssemblyName>
- <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
- <DebugSymbols>true</DebugSymbols>
- <DebugType>full</DebugType>
- <Optimize>false</Optimize>
- <OutputPath>bin\Debug\</OutputPath>
- <DefineConstants>DEBUG;TRACE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
- <DebugType>pdbonly</DebugType>
- <Optimize>true</Optimize>
- <OutputPath>bin\Release\</OutputPath>
- <DefineConstants>TRACE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
- </PropertyGroup>
- <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
- <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
- Other similar extension points exist, see Microsoft.Common.targets.
- <Target Name="BeforeBuild">
- </Target>
- <Target Name="AfterBuild">
- </Target>
- -->
- <ItemGroup>
- <Compile Include="Adapter.cs">
- <SubType>Code</SubType>
- </Compile>
- <Compile Include="Export2TTCN.cs" />
- </ItemGroup>
- <ItemGroup>
- <Reference Include="System" />
- <Reference Include="System.Data" />
- <Reference Include="System.Xml" />
- </ItemGroup>
-</Project>
\ No newline at end of file
diff --git a/demo/SpecExplorer/Project/MBT_SIP/Implementation/Export2TTCN.cs b/demo/SpecExplorer/Project/MBT_SIP/Implementation/Export2TTCN.cs
deleted file mode 100644
index c78c456..0000000
--- a/demo/SpecExplorer/Project/MBT_SIP/Implementation/Export2TTCN.cs
+++ /dev/null
@@ -1,185 +0,0 @@
-using System.IO;
-
-namespace Export2TTCN
-{
-
- public class FileExport
- {
- private string[] fileBuffer;
- private int rowNumber;
- private string filename;
- private const int indent = 2;
- private int act_indent = 0;
-
- public void ind_p()
- {
- act_indent += indent;
- }
-
- public void ind_n()
- {
- if (act_indent == 0) return;
- act_indent -= indent;
- }
-
- private string getindented(string row)
- {
- for (int i = 0; i < act_indent; i++)
- {
- row = row.Insert(0, " ");
- }
- return row;
- }
-
- public FileExport(string filename)
- {
- this.filename = filename;
- fileBuffer = new string[128];
- rowNumber = 0;
- File.Delete(filename);
- }
-
- public void write(string row)
- {
- fileBuffer[rowNumber++] = getindented(row);
- if (rowNumber == 128)
- {
- dump();
- }
- }
-
- public void dump()
- {
- FileStream writer;
- writer = new FileStream(filename, FileMode.OpenOrCreate);
- writer.Seek(0, SeekOrigin.End);
- for (int i = 0; i < rowNumber; i++)
- {
- writer.Write(System.Text.ASCIIEncoding.ASCII.GetBytes(fileBuffer[i]), 0, fileBuffer[i].Length);
- writer.WriteByte(10);
- }
- writer.Close();
- rowNumber = 0;
- }
-
- public void write_tc(string row) //write testcase rows
- {
- fileBuffer[rowNumber++] = getindented(row);
- if (rowNumber == 128)
- {
- dump_tc();
- }
- }
-
- public void dump_tc() //dump testcase rows
- {
- FileStream writer;
- writer = new FileStream(filename, FileMode.OpenOrCreate);
- writer.Seek(-3, SeekOrigin.End);
- for (int i = 0; i < rowNumber; i++)
- {
- writer.Write(System.Text.ASCIIEncoding.ASCII.GetBytes(fileBuffer[i]), 0, fileBuffer[i].Length);
- writer.WriteByte(10);
- }
- writer.Close();
- rowNumber = 0;
- }
-
- }
-
- public abstract class TTCNExporter
- {
- private FileExport file;
- private bool started = true;
- private int nof_testcases = 0;
- private string modulename;
- private string filename;
-
- public bool is_started() { return !started; }
-
- protected TTCNExporter(string p_modulename, string p_path)
- {
- modulename = p_modulename;
- filename = p_path + p_modulename + ".ttcn";
- }
-
- protected abstract void write_imports();
-
- protected abstract void write_types();
-
- protected abstract void write_altsteps();
-
- protected abstract void write_else();
-
- protected abstract void beginning_tc();
-
- protected abstract void ending_tc();
-
- private void start_testcase()
- {
- nof_testcases++;
- file.ind_p();
- file.write_tc("\n");
- file.write_tc("testcase Testcase_" + nof_testcases + "() runs on SpecExpl_CT");
- file.write_tc("{");
- file.ind_p();
-
- beginning_tc();
-
- file.write_tc("log(\"START TESTCASE: Testcase_" + nof_testcases + "\");");
- }
-
- public void start()
- {
- if (started)
- {
- file = new FileExport(filename);
- started = file == null;
- file.write("module " + modulename);
- file.write("{");
- file.ind_p();
- write_imports();
- write_types();
- write_altsteps();
- write_else();
- file.ind_n();
- file.write("}");
- file.dump();
- }
- start_testcase();
- }
-
- public void end()
- {
- file.write_tc("log(\"THE END\");");
-
- ending_tc();
-
- file.ind_n();
- file.write_tc("}");
- file.ind_n();
- file.write_tc("}");
- file.dump_tc();
- }
-
- protected void write(string row)
- {
- file.write(row);
- }
-
- public void write_tc(string row)
- {
- file.write_tc(row);
- }
-
- public void ind_p()
- {
- file.ind_p();
- }
-
- public void ind_n()
- {
- file.ind_n();
- }
- }
-}
\ No newline at end of file
diff --git a/demo/SpecExplorer/Project/MBT_SIP/Model/Config.cord b/demo/SpecExplorer/Project/MBT_SIP/Model/Config.cord
deleted file mode 100644
index a29b3ab..0000000
--- a/demo/SpecExplorer/Project/MBT_SIP/Model/Config.cord
+++ /dev/null
@@ -1,98 +0,0 @@
-// This is a Spec Explorer coordination script (Cord version 1.0).
-// Here is where you define configurations and machines describing the
-// exploration to be performed.
-
-using MBT.Adapter;
-
-/// Contains actions of the model, bounds, and switches.
-config Main
-{
- action abstract static void Adapter.start();
- action abstract static void Adapter.end();
- action abstract static void Adapter.Init_Calling();
- action abstract static void Adapter.Calling_Ringing();
- action abstract static void Adapter.Calling_Timeout();
- action abstract static void Adapter.Ringing_Canceling();
- action abstract static void Adapter.Ringing_Ready();
- action abstract static void Adapter.Ringing_Reject();
- action abstract static void Adapter.Canceling_WaitingResponse();
- action abstract static void Adapter.Canceling_Timeout();
- action abstract static void Adapter.WaitingResponse_Terminate();
- action abstract static void Adapter.Ready_Terminating();
- action abstract static void Adapter.Ready_End();
- action abstract static void Adapter.Terminating_OK();
- action abstract static void Adapter.Terminating_Timeout();
-
- switch StepBound = 1024;
- switch PathDepthBound = 1024;
- switch StateBound = 1024;
- switch TestClassBase = "vs";
- switch GeneratedTestPath = "..\\TestSuite";
- switch GeneratedTestNamespace = "MBT.TestSuite";
- switch TestEnabled = false;
- switch ForExploration = false;
-}
-
-machine Model() : Main where ForExploration = true
-{
- Model_CLOSED_START()*
-}
-
-machine Model_CLOSED_START() : Main
-{
- start() ; (( Init_Calling() ; Model_Calling() ) | ( Calling_Timeout() ; Model_CLOSED_END() ) )
-}
-
-machine Model_Calling() : Main
-{
- ( Calling_Ringing() ; Model_Ringing() )
-}
-
-machine Model_Ringing() : Main
-{
- ( Ringing_Canceling() ; Model_Canceling() ) | ( Ringing_Ready() ; Model_Ready() ) | ( Ringing_Reject() ; Model_CLOSED_END() ) | ( Canceling_Timeout() ; Model_CLOSED_END() )
-}
-
-machine Model_Canceling() : Main
-{
- ( Canceling_WaitingResponse() ; Model_WaitingResponse() )
-}
-
-machine Model_Ready() : Main
-{
- ( Ready_Terminating() ; Model_Terminating() ) | ( Ready_End() ; Model_CLOSED_END() ) | ( Terminating_Timeout() ; Model_CLOSED_END() )
-}
-
-machine Model_Terminating() : Main
-{
- ( Terminating_OK() ; Model_CLOSED_END() )
-}
-
-machine Model_WaitingResponse() : Main
-{
- ( WaitingResponse_Terminate() ; Model_CLOSED_END() )
-}
-
-
-machine Model_CLOSED_END() : Main
-{
- end()
-}
-
-machine ModelProgram() : Main
-{
- construct model program from Main
- where namespace = "MBT.Model"
-}
-
-machine Model_Sync() : Main where ForExploration = true
-{
- Model || ModelProgram
-}
-
-machine Testsuite() : Main where ForExploration = true, TestEnabled = true
-{
- construct test cases
- where AllowUndeterminedCoverage = true
- for Model_Sync
-}
diff --git a/demo/SpecExplorer/Project/MBT_SIP/Model/Model.cs b/demo/SpecExplorer/Project/MBT_SIP/Model/Model.cs
deleted file mode 100644
index 84cac67..0000000
--- a/demo/SpecExplorer/Project/MBT_SIP/Model/Model.cs
+++ /dev/null
@@ -1,65 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-using System.Linq;
-
-using Microsoft.Modeling;
-
-namespace MBT.Model
-{
- /// <summary>
- /// An example model program.
- /// </summary>
- static class ModelProgram
- {
- [Action]
- static void start()
- {
- }
-
- [Action]
- static void Init_Calling() { }
-
- [Action]
- static void Calling_Ringing() { }
-
- [Action]
- static void Calling_Timeout() { }
-
- [Action]
- static void Ringing_Canceling() { }
-
- [Action]
- static void Ringing_Ready() { }
-
- [Action]
- static void Ringing_Reject() { }
-
- [Action]
- static void Canceling_WaitingResponse() { }
-
- [Action]
- static void Canceling_Timeout() { }
-
- [Action]
- static void WaitingResponse_Terminate() { }
-
- [Action]
- static void Ready_Terminating() { }
-
- [Action]
- static void Ready_End() { }
-
- [Action]
- static void Terminating_OK() { }
-
- [Action]
- static void Terminating_Timeout() { }
-
- [Action]
- static void end()
- {
- }
-
- }
-}
diff --git a/demo/SpecExplorer/Project/MBT_SIP/Model/Model.csproj b/demo/SpecExplorer/Project/MBT_SIP/Model/Model.csproj
deleted file mode 100644
index 066ea0b..0000000
--- a/demo/SpecExplorer/Project/MBT_SIP/Model/Model.csproj
+++ /dev/null
@@ -1,65 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <ProductVersion>10.0.20714</ProductVersion>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{A62A6869-D02F-4A7D-B41E-0C1E2A1DD4C9}</ProjectGuid>
- <OutputType>Library</OutputType>
- <AppDesignerFolder>Properties</AppDesignerFolder>
- <RootNamespace>MBT.Model</RootNamespace>
- <AssemblyName>TCP_MBT.Model</AssemblyName>
- <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
- <DebugSymbols>true</DebugSymbols>
- <DebugType>full</DebugType>
- <Optimize>false</Optimize>
- <OutputPath>bin\Debug\</OutputPath>
- <DefineConstants>DEBUG;TRACE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
- <DebugType>pdbonly</DebugType>
- <Optimize>true</Optimize>
- <OutputPath>bin\Release\</OutputPath>
- <DefineConstants>TRACE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
- </PropertyGroup>
- <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
- <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
- Other similar extension points exist, see Microsoft.Common.targets.
- <Target Name="BeforeBuild">
- </Target>
- <Target Name="AfterBuild">
- </Target>
- -->
- <ItemGroup>
- <None Include="Config.cord">
- </None>
- </ItemGroup>
- <ItemGroup>
- <Compile Include="Model.cs" />
- </ItemGroup>
- <ItemGroup>
- <Reference Include="Microsoft.Xrt.Runtime, Version=2.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
- <SpecificVersion>True</SpecificVersion>
- <Private>False</Private>
- </Reference>
- <Reference Include="System" />
- <Reference Include="System.Core" />
- <Reference Include="System.Data" />
- <Reference Include="System.Xml" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\Implementation\Adapter.csproj">
- <Project>{E9DBC668-9BC2-4650-A70E-AE9A8F293E8F}</Project>
- <Name>Adapter</Name>
- </ProjectReference>
- </ItemGroup>
-</Project>
\ No newline at end of file
diff --git a/demo/SpecExplorer/Project/MBT_SIP/TestSuite/TestSuite.csproj b/demo/SpecExplorer/Project/MBT_SIP/TestSuite/TestSuite.csproj
deleted file mode 100644
index 6db62f6..0000000
--- a/demo/SpecExplorer/Project/MBT_SIP/TestSuite/TestSuite.csproj
+++ /dev/null
@@ -1,69 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <ProductVersion>10.0.20714</ProductVersion>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{30090E84-4B5F-4E61-B57C-D7E9A3EC999D}</ProjectGuid>
- <OutputType>Library</OutputType>
- <AppDesignerFolder>Properties</AppDesignerFolder>
- <RootNamespace>MBT.TestSuite</RootNamespace>
- <AssemblyName>TCP_MBT.TestSuite</AssemblyName>
- <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
- <ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
- <DebugSymbols>true</DebugSymbols>
- <DebugType>full</DebugType>
- <Optimize>false</Optimize>
- <OutputPath>bin\Debug\</OutputPath>
- <DefineConstants>DEBUG;TRACE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
- <DebugType>pdbonly</DebugType>
- <Optimize>true</Optimize>
- <OutputPath>bin\Release\</OutputPath>
- <DefineConstants>TRACE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
- </PropertyGroup>
- <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
- <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
- Other similar extension points exist, see Microsoft.Common.targets.
- <Target Name="BeforeBuild">
- </Target>
- <Target Name="AfterBuild">
- </Target>
- -->
- <ItemGroup>
- <Reference Include="Microsoft.SpecExplorer.Runtime, Version=2.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
- <SpecificVersion>True</SpecificVersion>
- <Private>False</Private>
- </Reference>
- <Reference Include="Microsoft.SpecExplorer.Runtime.VisualStudio, Version=2.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35,
 processorArchitecture=MSIL">
- <SpecificVersion>True</SpecificVersion>
- <Private>False</Private>
- </Reference>
- <Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
- <Reference Include="System" />
- <Reference Include="System.Data" />
- <Reference Include="System.Xml" />
- </ItemGroup>
- <ItemGroup>
- <Service Include="{B4F97281-0DBD-4835-9ED8-7DFB966E87FF}" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\Implementation\Adapter.csproj">
- <Project>{E9DBC668-9BC2-4650-A70E-AE9A8F293E8F}</Project>
- <Name>Adapter</Name>
- </ProjectReference>
- </ItemGroup>
- <ItemGroup>
- <Compile Include="Testsuite.cs" />
- </ItemGroup>
-</Project>
\ No newline at end of file
diff --git a/demo/SpecExplorer/Project/MBT_SIP/TestSuite/Testsuite.cs b/demo/SpecExplorer/Project/MBT_SIP/TestSuite/Testsuite.cs
deleted file mode 100644
index e6d6f6f..0000000
--- a/demo/SpecExplorer/Project/MBT_SIP/TestSuite/Testsuite.cs
+++ /dev/null
@@ -1,305 +0,0 @@
-//------------------------------------------------------------------------------
-// <auto-generated>
-// This code was generated by a tool.
-// Runtime Version:4.0.21006.1
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-// </auto-generated>
-//------------------------------------------------------------------------------
-
-namespace MBT.TestSuite {
- using System;
- using System.Collections.Generic;
- using System.Text;
- using System.Reflection;
- using Microsoft.SpecExplorer.Runtime.Testing;
-
-
- [System.CodeDom.Compiler.GeneratedCodeAttribute("Spec Explorer", "3.0.2167.0")]
- [Microsoft.VisualStudio.TestTools.UnitTesting.TestClassAttribute()]
- public partial class Testsuite : VsTestClassBase {
-
- public Testsuite() {
- this.SetSwitch("ProceedControlTimeout", "100");
- this.SetSwitch("QuiescenceTimeout", "2000");
- }
-
- #region Test Initialization and Cleanup
- [Microsoft.VisualStudio.TestTools.UnitTesting.TestInitializeAttribute()]
- public virtual void TestInitialize() {
- this.InitializeTestManager();
- }
-
- [Microsoft.VisualStudio.TestTools.UnitTesting.TestCleanupAttribute()]
- public virtual void TestCleanup() {
- this.CleanupTestManager();
- }
- #endregion
-
- #region Test Starting in S0
- [Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()]
- [Microsoft.VisualStudio.TestTools.UnitTesting.TestPropertyAttribute("TestID", "0x01afa11b37bc675d097fe4a5530ea6a8c9")]
- public virtual void TestsuiteS0() {
- this.Manager.BeginTest("TestsuiteS0");
- this.Manager.Comment("reaching state \'S0\'");
- this.Manager.Comment("executing step \'call start()\'");
- MBT.Adapter.Adapter.start();
- this.Manager.Comment("reaching state \'S1\'");
- this.Manager.Comment("checking step \'return start\'");
- this.Manager.Comment("reaching state \'S14\'");
- this.Manager.Comment("executing step \'call Init_Calling()\'");
- MBT.Adapter.Adapter.Init_Calling();
- this.Manager.Comment("reaching state \'S21\'");
- this.Manager.Comment("checking step \'return Init_Calling\'");
- this.Manager.Comment("reaching state \'S28\'");
- this.Manager.Comment("executing step \'call Calling_Ringing()\'");
- MBT.Adapter.Adapter.Calling_Ringing();
- this.Manager.Comment("reaching state \'S35\'");
- this.Manager.Comment("checking step \'return Calling_Ringing\'");
- this.Manager.Comment("reaching state \'S42\'");
- this.Manager.Comment("executing step \'call Ringing_Canceling()\'");
- MBT.Adapter.Adapter.Ringing_Canceling();
- this.Manager.Comment("reaching state \'S49\'");
- this.Manager.Comment("checking step \'return Ringing_Canceling\'");
- this.Manager.Comment("reaching state \'S55\'");
- this.Manager.Comment("executing step \'call Canceling_WaitingResponse()\'");
- MBT.Adapter.Adapter.Canceling_WaitingResponse();
- this.Manager.Comment("reaching state \'S61\'");
- this.Manager.Comment("checking step \'return Canceling_WaitingResponse\'");
- this.Manager.Comment("reaching state \'S67\'");
- this.Manager.Comment("executing step \'call WaitingResponse_Terminate()\'");
- MBT.Adapter.Adapter.WaitingResponse_Terminate();
- this.Manager.Comment("reaching state \'S73\'");
- this.Manager.Comment("checking step \'return WaitingResponse_Terminate\'");
- this.Manager.Comment("reaching state \'S77\'");
- this.Manager.Comment("executing step \'call end()\'");
- MBT.Adapter.Adapter.end();
- this.Manager.Comment("reaching state \'S81\'");
- this.Manager.Comment("checking step \'return end\'");
- this.Manager.Comment("reaching state \'S83\'");
- this.Manager.EndTest();
- }
- #endregion
-
- #region Test Starting in S10
- [Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()]
- [Microsoft.VisualStudio.TestTools.UnitTesting.TestPropertyAttribute("TestID", "0x017ff0fce7268e7de05fa2a0fba546b497")]
- public virtual void TestsuiteS10() {
- this.Manager.BeginTest("TestsuiteS10");
- this.Manager.Comment("reaching state \'S10\'");
- this.Manager.Comment("executing step \'call start()\'");
- MBT.Adapter.Adapter.start();
- this.Manager.Comment("reaching state \'S11\'");
- this.Manager.Comment("checking step \'return start\'");
- this.Manager.Comment("reaching state \'S19\'");
- this.Manager.Comment("executing step \'call Init_Calling()\'");
- MBT.Adapter.Adapter.Init_Calling();
- this.Manager.Comment("reaching state \'S26\'");
- this.Manager.Comment("checking step \'return Init_Calling\'");
- this.Manager.Comment("reaching state \'S33\'");
- this.Manager.Comment("executing step \'call Calling_Ringing()\'");
- MBT.Adapter.Adapter.Calling_Ringing();
- this.Manager.Comment("reaching state \'S40\'");
- this.Manager.Comment("checking step \'return Calling_Ringing\'");
- this.Manager.Comment("reaching state \'S47\'");
- this.Manager.Comment("executing step \'call Canceling_Timeout()\'");
- MBT.Adapter.Adapter.Canceling_Timeout();
- this.Manager.Comment("reaching state \'S54\'");
- this.Manager.Comment("checking step \'return Canceling_Timeout\'");
- this.Manager.Comment("reaching state \'S60\'");
- this.Manager.Comment("executing step \'call end()\'");
- MBT.Adapter.Adapter.end();
- this.Manager.Comment("reaching state \'S66\'");
- this.Manager.Comment("checking step \'return end\'");
- this.Manager.Comment("reaching state \'S72\'");
- this.Manager.EndTest();
- }
- #endregion
-
- #region Test Starting in S12
- [Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()]
- [Microsoft.VisualStudio.TestTools.UnitTesting.TestPropertyAttribute("TestID", "0x016815222e0a5f5da29344dcbed7345e1f")]
- public virtual void TestsuiteS12() {
- this.Manager.BeginTest("TestsuiteS12");
- this.Manager.Comment("reaching state \'S12\'");
- this.Manager.Comment("executing step \'call start()\'");
- MBT.Adapter.Adapter.start();
- this.Manager.Comment("reaching state \'S13\'");
- this.Manager.Comment("checking step \'return start\'");
- this.Manager.Comment("reaching state \'S20\'");
- this.Manager.Comment("executing step \'call Calling_Timeout()\'");
- MBT.Adapter.Adapter.Calling_Timeout();
- this.Manager.Comment("reaching state \'S27\'");
- this.Manager.Comment("checking step \'return Calling_Timeout\'");
- this.Manager.Comment("reaching state \'S34\'");
- this.Manager.Comment("executing step \'call end()\'");
- MBT.Adapter.Adapter.end();
- this.Manager.Comment("reaching state \'S41\'");
- this.Manager.Comment("checking step \'return end\'");
- this.Manager.Comment("reaching state \'S48\'");
- this.Manager.EndTest();
- }
- #endregion
-
- #region Test Starting in S2
- [Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()]
- [Microsoft.VisualStudio.TestTools.UnitTesting.TestPropertyAttribute("TestID", "0x01d417f2842cdb81a2e516c5142757acd4")]
- public virtual void TestsuiteS2() {
- this.Manager.BeginTest("TestsuiteS2");
- this.Manager.Comment("reaching state \'S2\'");
- this.Manager.Comment("executing step \'call start()\'");
- MBT.Adapter.Adapter.start();
- this.Manager.Comment("reaching state \'S3\'");
- this.Manager.Comment("checking step \'return start\'");
- this.Manager.Comment("reaching state \'S15\'");
- this.Manager.Comment("executing step \'call Init_Calling()\'");
- MBT.Adapter.Adapter.Init_Calling();
- this.Manager.Comment("reaching state \'S22\'");
- this.Manager.Comment("checking step \'return Init_Calling\'");
- this.Manager.Comment("reaching state \'S29\'");
- this.Manager.Comment("executing step \'call Calling_Ringing()\'");
- MBT.Adapter.Adapter.Calling_Ringing();
- this.Manager.Comment("reaching state \'S36\'");
- this.Manager.Comment("checking step \'return Calling_Ringing\'");
- this.Manager.Comment("reaching state \'S43\'");
- this.Manager.Comment("executing step \'call Ringing_Ready()\'");
- MBT.Adapter.Adapter.Ringing_Ready();
- this.Manager.Comment("reaching state \'S50\'");
- this.Manager.Comment("checking step \'return Ringing_Ready\'");
- this.Manager.Comment("reaching state \'S56\'");
- this.Manager.Comment("executing step \'call Ready_Terminating()\'");
- MBT.Adapter.Adapter.Ready_Terminating();
- this.Manager.Comment("reaching state \'S62\'");
- this.Manager.Comment("checking step \'return Ready_Terminating\'");
- this.Manager.Comment("reaching state \'S68\'");
- this.Manager.Comment("executing step \'call Terminating_OK()\'");
- MBT.Adapter.Adapter.Terminating_OK();
- this.Manager.Comment("reaching state \'S74\'");
- this.Manager.Comment("checking step \'return Terminating_OK\'");
- this.Manager.Comment("reaching state \'S78\'");
- this.Manager.Comment("executing step \'call end()\'");
- MBT.Adapter.Adapter.end();
- this.Manager.Comment("reaching state \'S82\'");
- this.Manager.Comment("checking step \'return end\'");
- this.Manager.Comment("reaching state \'S84\'");
- this.Manager.EndTest();
- }
- #endregion
-
- #region Test Starting in S4
- [Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()]
- [Microsoft.VisualStudio.TestTools.UnitTesting.TestPropertyAttribute("TestID", "0x01a1fff5e0b6582382edb5a5cc5393de78")]
- public virtual void TestsuiteS4() {
- this.Manager.BeginTest("TestsuiteS4");
- this.Manager.Comment("reaching state \'S4\'");
- this.Manager.Comment("executing step \'call start()\'");
- MBT.Adapter.Adapter.start();
- this.Manager.Comment("reaching state \'S5\'");
- this.Manager.Comment("checking step \'return start\'");
- this.Manager.Comment("reaching state \'S16\'");
- this.Manager.Comment("executing step \'call Init_Calling()\'");
- MBT.Adapter.Adapter.Init_Calling();
- this.Manager.Comment("reaching state \'S23\'");
- this.Manager.Comment("checking step \'return Init_Calling\'");
- this.Manager.Comment("reaching state \'S30\'");
- this.Manager.Comment("executing step \'call Calling_Ringing()\'");
- MBT.Adapter.Adapter.Calling_Ringing();
- this.Manager.Comment("reaching state \'S37\'");
- this.Manager.Comment("checking step \'return Calling_Ringing\'");
- this.Manager.Comment("reaching state \'S44\'");
- this.Manager.Comment("executing step \'call Ringing_Ready()\'");
- MBT.Adapter.Adapter.Ringing_Ready();
- this.Manager.Comment("reaching state \'S51\'");
- this.Manager.Comment("checking step \'return Ringing_Ready\'");
- this.Manager.Comment("reaching state \'S57\'");
- this.Manager.Comment("executing step \'call Ready_End()\'");
- MBT.Adapter.Adapter.Ready_End();
- this.Manager.Comment("reaching state \'S63\'");
- this.Manager.Comment("checking step \'return Ready_End\'");
- this.Manager.Comment("reaching state \'S69\'");
- this.Manager.Comment("executing step \'call end()\'");
- MBT.Adapter.Adapter.end();
- this.Manager.Comment("reaching state \'S75\'");
- this.Manager.Comment("checking step \'return end\'");
- this.Manager.Comment("reaching state \'S79\'");
- this.Manager.EndTest();
- }
- #endregion
-
- #region Test Starting in S6
- [Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()]
- [Microsoft.VisualStudio.TestTools.UnitTesting.TestPropertyAttribute("TestID", "0x01d513f2fed3847551573ca8967f84031f")]
- public virtual void TestsuiteS6() {
- this.Manager.BeginTest("TestsuiteS6");
- this.Manager.Comment("reaching state \'S6\'");
- this.Manager.Comment("executing step \'call start()\'");
- MBT.Adapter.Adapter.start();
- this.Manager.Comment("reaching state \'S7\'");
- this.Manager.Comment("checking step \'return start\'");
- this.Manager.Comment("reaching state \'S17\'");
- this.Manager.Comment("executing step \'call Init_Calling()\'");
- MBT.Adapter.Adapter.Init_Calling();
- this.Manager.Comment("reaching state \'S24\'");
- this.Manager.Comment("checking step \'return Init_Calling\'");
- this.Manager.Comment("reaching state \'S31\'");
- this.Manager.Comment("executing step \'call Calling_Ringing()\'");
- MBT.Adapter.Adapter.Calling_Ringing();
- this.Manager.Comment("reaching state \'S38\'");
- this.Manager.Comment("checking step \'return Calling_Ringing\'");
- this.Manager.Comment("reaching state \'S45\'");
- this.Manager.Comment("executing step \'call Ringing_Ready()\'");
- MBT.Adapter.Adapter.Ringing_Ready();
- this.Manager.Comment("reaching state \'S52\'");
- this.Manager.Comment("checking step \'return Ringing_Ready\'");
- this.Manager.Comment("reaching state \'S58\'");
- this.Manager.Comment("executing step \'call Terminating_Timeout()\'");
- MBT.Adapter.Adapter.Terminating_Timeout();
- this.Manager.Comment("reaching state \'S64\'");
- this.Manager.Comment("checking step \'return Terminating_Timeout\'");
- this.Manager.Comment("reaching state \'S70\'");
- this.Manager.Comment("executing step \'call end()\'");
- MBT.Adapter.Adapter.end();
- this.Manager.Comment("reaching state \'S76\'");
- this.Manager.Comment("checking step \'return end\'");
- this.Manager.Comment("reaching state \'S80\'");
- this.Manager.EndTest();
- }
- #endregion
-
- #region Test Starting in S8
- [Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()]
- [Microsoft.VisualStudio.TestTools.UnitTesting.TestPropertyAttribute("TestID", "0x01be85886e5b722402381661d4ae68e15b")]
- public virtual void TestsuiteS8() {
- this.Manager.BeginTest("TestsuiteS8");
- this.Manager.Comment("reaching state \'S8\'");
- this.Manager.Comment("executing step \'call start()\'");
- MBT.Adapter.Adapter.start();
- this.Manager.Comment("reaching state \'S9\'");
- this.Manager.Comment("checking step \'return start\'");
- this.Manager.Comment("reaching state \'S18\'");
- this.Manager.Comment("executing step \'call Init_Calling()\'");
- MBT.Adapter.Adapter.Init_Calling();
- this.Manager.Comment("reaching state \'S25\'");
- this.Manager.Comment("checking step \'return Init_Calling\'");
- this.Manager.Comment("reaching state \'S32\'");
- this.Manager.Comment("executing step \'call Calling_Ringing()\'");
- MBT.Adapter.Adapter.Calling_Ringing();
- this.Manager.Comment("reaching state \'S39\'");
- this.Manager.Comment("checking step \'return Calling_Ringing\'");
- this.Manager.Comment("reaching state \'S46\'");
- this.Manager.Comment("executing step \'call Ringing_Reject()\'");
- MBT.Adapter.Adapter.Ringing_Reject();
- this.Manager.Comment("reaching state \'S53\'");
- this.Manager.Comment("checking step \'return Ringing_Reject\'");
- this.Manager.Comment("reaching state \'S59\'");
- this.Manager.Comment("executing step \'call end()\'");
- MBT.Adapter.Adapter.end();
- this.Manager.Comment("reaching state \'S65\'");
- this.Manager.Comment("checking step \'return end\'");
- this.Manager.Comment("reaching state \'S71\'");
- this.Manager.EndTest();
- }
- #endregion
- }
-}
diff --git a/demo/SpecExplorer/TTCN/MBT_SUT_SIP_Phone.ttcn b/demo/SpecExplorer/TTCN/MBT_SUT_SIP_Phone.ttcn
deleted file mode 100644
index e4e36f2..0000000
--- a/demo/SpecExplorer/TTCN/MBT_SUT_SIP_Phone.ttcn
+++ /dev/null
@@ -1,401 +0,0 @@
-///////////////////////////////////////////////////////////////////////////////
-//
-// Copyright (c) 2000-2018 Ericsson Telecom AB
-//
-// All rights reserved. This program and the accompanying materials
-// are made available under the terms of the Eclipse Public License v1.0
-// which accompanies this distribution, and is available at
-// http://www.eclipse.org/legal/epl-v10.html
-///////////////////////////////////////////////////////////////////////////////
-//
-// File: MBT_SUT_SIP_Phone.ttcn
-// Rev: <RnXnn>
-// Prodnr: CNL 113 659
-// Updated: 2009-10-01
-// Contact: http://ttcn.ericsson.se
-///////////////////////////////////////////////////////////////////////////////
-
-module MBT_SUT_SIP_Phone
-{
-import from MBT_SpecExpl_Testcases all;
-
-import from EPTF_CLL_Common_Definitions all;
-import from EPTF_CLL_Base_Functions all;
-import from EPTF_CLL_RBTScheduler_Functions all;
-import from EPTF_CLL_LGenBase_Definitions all;
-import from EPTF_CLL_LGenBase_ConfigFunctions all;
-import from EPTF_CLL_LGenBase_EventHandlingFunctions all;
-
-import from EPTF_MBT_LGen_Definitions all;
-import from EPTF_MBT_LGen_Functions all;
-
-import from EPTF_SIP_LGen_Definitions all;
-import from EPTF_SIP_LGen_Functions all;
-import from EPTF_SIP_Common_Functions all;
-import from EPTF_SIP_UserDatabase_Functions all;
-import from EPTF_SIP_Transport_Definitions all;
-import from EPTF_SIP_Transport_Functions all;
-import from EPTF_SIP_MessageHandler_Functions all;
-
-import from EPTF_SIP_TestSteps all;
-import from EPTF_SIP_Templates all;
-import from EPTF_SIP_Events all;
-
-modulepar
-{
- charstring tsp_MBT_SUT_LocalIP := "159.107.193.33";
- integer tsp_MBT_SUT_LocalPort := 20000;
- charstring tsp_MBT_SUT_RemoteIP := "159.107.193.33";
- integer tsp_MBT_SUT_RemotePort := 15000;
-
- charstring tsp_MBT_SUT_SIP_Transport := "udp";
-}
-
-type component MBT_SpecExpl_Demo_SUT_CT
- extends
- EPTF_MBT_LGen_CT,
- EPTF_SIP_LGen_CT, EPTF_SIP_LocalTransport_CT
-{
- port userInPort userIn;
- port userOutPort userOut;
-
- var integer v_SUT_myBIdx := -1;
-}
-
-function f_MBT_SpecExpl_Demo_SUT_behavior() runs on MBT_SpecExpl_Demo_SUT_CT
-{
- // map(self:IPL4_PCO, system:IPL4_PCO);
-
- activate(as_MBT_SpecExpl_Demo_SUT_userMessageHandler());
-
- f_EPTF_MBT_init("MBT_Demo_SUT",0, "MBT_")
-
- f_SIP_applibInit("MBT_Demo_SUT");
-
- f_EPTF_SIP_LocalTransport_init(tsp_MBT_SUT_SIP_Transport);
- vf_EPTF_SIP_LocalTransport_receive := refers(f_EPTF_SIP_Message_MsgHandler); //receive callback function on LocalTransport
- vf_EPTF_SIP_LGen_msgSender := refers(f_EPTF_SIP_LocalTransport_sendSIPMessage); //send callback function on LGen
- v_removeUAS := refers(fcb_EPTF_SIP_LocalTransport_removeUAS);
-
- v_SUT_myBIdx := f_EPTF_LGenBase_declareBehaviorType("SUT_Behavior", -1, null, null, null);
-
- var integer vl_temp := -1;
- vl_temp := f_EPTF_LGenBase_declareFsmEvent("SUT_Behavior", "SUT_INVITE");
- f_EPTF_Base_assert(%definitionId&": Error during registration of SUT_INVITE", vl_temp == c_MBT_SpecExpl_Demo_SUT_Event_invite);
- vl_temp := f_EPTF_LGenBase_declareFsmEvent("SUT_Behavior", "SUT_CANCEL");
- f_EPTF_Base_assert(%definitionId&": Error during registration of SUT_CANCEL", vl_temp == c_MBT_SpecExpl_Demo_SUT_Event_cancel);
- vl_temp := f_EPTF_LGenBase_declareFsmEvent("SUT_Behavior", "SUT_BYE");
- f_EPTF_Base_assert(%definitionId&": Error during registration of SUT_BYE", vl_temp == c_MBT_SpecExpl_Demo_SUT_Event_bye);
-
-
- f_EPTF_LGenBase_declareCompactFsmTable(f_IMBT_SpecExpl_Demo_SUT_getFSM());
-
- f_EPTF_MBT_initLGenFsm
- (
- refers(f_MBT_SpecExpl_Demo_SUT_createUserMessage),
- refers(f_MBT_SpecExpl_Demo_SUT_fillInDB)
- );
-
- EPTF_MBT_PCO.send(EPTF_MBT_CommandResponse:{ ready := {}}) to mtc;
-
- f_EPTF_Base_wait4Shutdown();
-}
-
-altstep as_MBT_SpecExpl_Demo_SUT_userMessageHandler()
-runs on MBT_SpecExpl_Demo_SUT_CT
-{
- var UserInput vl_UserInput;
-
- [] userIn.receive(UserInput:?) -> value vl_UserInput
- {
- f_EPTF_SchedulerComp_refreshSnapshotTime();
- action(%definitionId, " incoming: ", vl_UserInput);
-
- if (vl_UserInput.input1 == "invite")
- {
- f_EPTF_LGenBase_dispatchEvent({{v_SUT_myBIdx, c_MBT_SpecExpl_Demo_SUT_Event_invite,{ 0, 0}, omit},{}});
- }
- else if (vl_UserInput.input1 == "cancel")
- {
- f_EPTF_LGenBase_dispatchEvent({{v_SUT_myBIdx, c_MBT_SpecExpl_Demo_SUT_Event_cancel,{ 0, 0}, omit},{}});
- }
- else if (vl_UserInput.input1 == "bye")
- {
- f_EPTF_LGenBase_dispatchEvent({{v_SUT_myBIdx, c_MBT_SpecExpl_Demo_SUT_Event_bye,{ 0, 0}, omit},{}});
- }
- else
- {
- action(%definitionId & "(): UserInput not recognized: ", vl_UserInput);
- }
-
- repeat;
- }
-}
-
-function f_MBT_SpecExpl_Demo_SUT_createUserMessage(in EPTF_LGenBase_TestStepArgs pl_ptr)
-runs on MBT_SpecExpl_Demo_SUT_CT
-{
- action(%definitionId & "(): creating message for: ", pl_ptr, "\n", pl_ptr.reportedEvent);
-}
-
-function f_MBT_SpecExpl_Demo_SUT_stepSendTimeoutIndication(in EPTF_LGenBase_TestStepArgs pl_ptr)
-runs on MBT_SpecExpl_Demo_SUT_CT
-{
- userOut.send(TimeOutIndication:{});
-}
-
-function f_MBT_SpecExpl_Demo_SUT_fillInDB(in EPTF_MBT_ConfigRequest p_req) runs on MBT_SpecExpl_Demo_SUT_CT
-{
- var integer vl_grpIdx := f_EPTF_LGenBase_entityGrpNameIndex(p_req.entityGroupName);
- var integer vl_entityIdx := f_EPTF_LGenBase_getEGrpBaseOffset(vl_grpIdx);
-
- for (var integer i:=0; i<p_req.noEntities; i:=i+1)
- {
- var EPTF_IntegerList vl_bCtx := f_EPTF_LGenBase_getBehaviorCtx(i + vl_entityIdx, v_SIP_myBIdx);
- f_EPTF_SIP_IPL4asp_SetUserData
- (
- vl_bCtx[0],
- tsp_MBT_SUT_LocalIP, // local IP
- {tsp_MBT_SUT_LocalPort, tsp_MBT_SUT_LocalPort+1},
- tsp_MBT_SUT_SIP_Transport,
- tsp_MBT_SUT_RemoteIP, // proxy ip
- tsp_MBT_SUT_RemotePort // proxy port
- );
-
- f_EPTF_SIP_User_SetUserData(
- vl_bCtx[0],
- {
- {
- addr := {
- nameAddr := {
- displayName := "titansim_user_7465001",
- addrSpec := {
- scheme := "sip",
- userInfo := {
- userOrTelephoneSubscriber := "titansim_user_7465001",
- password := omit
- },
- hostPort := {
- host := "tcj.ics.se",
- portField := tsp_MBT_SUT_LocalPort
- },
- urlParameters := omit,
- headers := omit
- }
- }
- },
- password := "pass2ICS"
- }
- },
- tsp_MBT_SUT_LocalIP,
- {tsp_MBT_SUT_LocalPort, tsp_MBT_SUT_LocalPort+1},
- i + vl_entityIdx //entity index
- );
-
- f_EPTF_SIP_Session_AddData(vl_bCtx[0], f_EPTF_SIP_getTransport(tsp_MBT_SUT_SIP_Transport),345600);
-
- f_EPTF_SIP_Session_addCalledUser(
- i,
- {
- nameAddr := {
- displayName := "titansim_user_7465000",
- addrSpec := {
- scheme := "sip",
- userInfo := {
- userOrTelephoneSubscriber := "titansim_user_7465000",
- password := omit
- },
- hostPort := {
- host := "tcj.ics.se",
- portField := tsp_MBT_SUT_RemotePort
- },
- urlParameters := omit,
- headers := omit
- }
- }
- }
- );
-
- f_EPTF_SIP_IPL4asp_startListening(vl_bCtx[0], true); // Both UDP and TCP
- }
-}
-
-const integer c_MBT_SpecExpl_Demo_SUT_Event_invite := 0;
-const integer c_MBT_SpecExpl_Demo_SUT_Event_cancel := 1;
-const integer c_MBT_SpecExpl_Demo_SUT_Event_bye := 2;
-
-const integer c_MBT_SpecExpl_Demo_SUT_State_idle := 0;
-const integer c_MBT_SpecExpl_Demo_SUT_State_initiated := 1;
-const integer c_MBT_SpecExpl_Demo_SUT_State_canceling := 2;
-const integer c_MBT_SpecExpl_Demo_SUT_State_established := 3;
-const integer c_MBT_SpecExpl_Demo_SUT_State_closing := 4;
-
-function f_IMBT_SpecExpl_Demo_SUT_getFSM()
- runs on MBT_SpecExpl_Demo_SUT_CT
- return EPTF_LGenBase_CompactFsmTable
-{
- return
- {
- //DOT: digraph c_MBT_SpecExpl_Demo_SUT_FSM {
- name := "MBT_SpecExpl_Demo_SUT_FSM",
- stateList := {"idle", "initiated", "canceling", "established", "closing"},
- timerList := {},
- table :=
- {
- {eventToListen := {v_SUT_myBIdx, c_MBT_SpecExpl_Demo_SUT_Event_invite, entity},
- cellRow := {
- //state=idle
- { {
- //DOT: idle -> initiated [label="i:invite\n o:INVITE"]
- {refers(f_SIP_step_init), {}},
- {refers(f_SIP_step_createINVITE),{0,0}}
- },omit, c_MBT_SpecExpl_Demo_SUT_State_initiated},
- //state=initiated
- { omit, omit, omit },
- //state=canceling
- { omit, omit, omit },
- //state=established
- { omit, omit, omit },
- //state=closing
- { omit, omit, omit }
- }
- },
- {eventToListen := {v_SUT_myBIdx, c_MBT_SpecExpl_Demo_SUT_Event_cancel, entity},
- cellRow := {
- //state=idle
- { omit, omit, omit },
- //state=initiated
- { {
- //DOT: initiated -> canceling [label="i:cancel\n o:CANCEL"]
- {refers(f_SIP_step_createCANCEL),{}}
- },omit, c_MBT_SpecExpl_Demo_SUT_State_canceling},
- //state=canceling
- { omit, omit, omit },
- //state=established
- { omit, omit, omit },
- //state=closing
- { omit, omit, omit }
- }
- },
- {eventToListen := {v_SUT_myBIdx, c_MBT_SpecExpl_Demo_SUT_Event_bye, entity},
- cellRow := {
- //state=idle
- { omit, omit, omit },
- //state=initiated
- { omit, omit, omit },
- //state=canceling
- { omit, omit, omit },
- //state=established
- { {
- //DOT: established -> closing [label="i:bye\n o:BYE"]
- {refers(f_SIP_step_createBYE),{}}
- },omit, c_MBT_SpecExpl_Demo_SUT_State_closing},
- //state=closing
- { omit, omit, omit }
- }
- },
- {eventToListen := {v_SIP_myBIdx, 200, fsm},
- cellRow := {
- //state=idle
- { omit, omit, omit },
- //state=initiated
- { {
- //DOT: initiated -> established [label="i:200\n o:ACK"]
- {refers(f_SIP_step_createACK),{}}
- },omit, c_MBT_SpecExpl_Demo_SUT_State_established},
- //state=canceling
- { omit, omit, omit },
- //state=established
- { omit, omit, omit },
- //state=closing
- { {
- //DOT: closing -> idle [label="i:200"]
- },omit, c_MBT_SpecExpl_Demo_SUT_State_idle }
- }
- },
- {eventToListen := {v_SIP_myBIdx, 486, fsm},
- cellRow := {
- //state=idle
- { omit, omit, omit },
- //state=initiated
- { {
- //DOT: initiated -> idle [label="i:486\n o:ACK"]
- {refers(f_SIP_step_createACK),{}}
- },omit, c_MBT_SpecExpl_Demo_SUT_State_idle},
- //state=canceling
- { omit, omit, omit },
- //state=established
- { omit, omit, omit },
- //state=closing
- { omit, omit, omit }
- }
- },
- {eventToListen := {v_SIP_myBIdx, 487, fsm},
- cellRow := {
- //state=idle
- { omit, omit, omit },
- //state=initiated
- { omit, omit, omit },
- //state=canceling
- { {
- //DOT: canceling -> idle [label="i:487\n o:ACK"]
- {refers(f_SIP_step_createACK),{}}
- },omit, c_MBT_SpecExpl_Demo_SUT_State_idle},
- //state=established
- { omit, omit, omit },
- //state=closing
- { omit, omit, omit }
- }
- },
- {eventToListen := {v_SIP_myBIdx, c_SIP_eventIdx_BYE, fsm},
- cellRow := {
- //state=idle
- { omit, omit, omit },
- //state=initiated
- { omit, omit, omit },
- //state=canceling
- { omit, omit, omit },
- //state=established
- { {
- //DOT: canceling -> idle [label="i:487\n o:ACK"]
- {refers(f_SIP_step_handleBYE), {}},
- {refers(f_SIP_step_createResponse),{c_status_200OK_idx}}
- },omit, c_MBT_SpecExpl_Demo_SUT_State_idle},
- //state=closing
- { omit, omit, omit }
- }
- },
- {eventToListen := {v_SIP_myBIdx, c_SIP_eventIdx_UACTransactionTimeout, fsm},
- cellRow := {
- //state=idle
- { { {refers(f_MBT_SpecExpl_Demo_SUT_stepSendTimeoutIndication), {}} }, omit, omit },
- //state=initiated
- { { {refers(f_MBT_SpecExpl_Demo_SUT_stepSendTimeoutIndication), {}} }, omit, omit },
- //state=canceling
- { { {refers(f_MBT_SpecExpl_Demo_SUT_stepSendTimeoutIndication), {}} }, omit, omit },
- //state=established
- { { {refers(f_MBT_SpecExpl_Demo_SUT_stepSendTimeoutIndication), {}} }, omit, omit },
- //state=closing
- { { {refers(f_MBT_SpecExpl_Demo_SUT_stepSendTimeoutIndication), {}} }, omit, omit }
- }
- },
- {eventToListen := {v_SIP_myBIdx, c_SIP_eventIdx_UASTransactionTimeout, fsm},
- cellRow := {
- //state=idle
- { { {refers(f_MBT_SpecExpl_Demo_SUT_stepSendTimeoutIndication), {}} }, omit, omit },
- //state=initiated
- { { {refers(f_MBT_SpecExpl_Demo_SUT_stepSendTimeoutIndication), {}} }, omit, omit },
- //state=canceling
- { { {refers(f_MBT_SpecExpl_Demo_SUT_stepSendTimeoutIndication), {}} }, omit, omit },
- //state=established
- { { {refers(f_MBT_SpecExpl_Demo_SUT_stepSendTimeoutIndication), {}} }, omit, omit },
- //state=closing
- { { {refers(f_MBT_SpecExpl_Demo_SUT_stepSendTimeoutIndication), {}} }, omit, omit }
- }
- }//row
- }//table
- }//fsm
- //DOT: }
-}
-
-}
diff --git a/demo/SpecExplorer/TTCN/MBT_SpecExpl_Demo.cfg b/demo/SpecExplorer/TTCN/MBT_SpecExpl_Demo.cfg
deleted file mode 100644
index 00e35d7..0000000
--- a/demo/SpecExplorer/TTCN/MBT_SpecExpl_Demo.cfg
+++ /dev/null
@@ -1,62 +0,0 @@
-///////////////////////////////////////////////////////////////////////////////
-// //
-// Copyright Test Competence Center (TCC) ETH 2009 //
-// //
-// The copyright to the computer program(s) herein is the property of TCC. //
-// The program(s) may be used and/or copied only with the written permission //
-// of TCC or in accordance with the terms and conditions stipulated in the //
-// agreement/contract under which the program(s) have been supplied //
-///////////////////////////////////////////////////////////////////////////////
-//
-// File: MBT_Qtronic_Demo.cfg
-// Rev: <RnXnn>
-// Prodnr: CNL 113 522
-// Updated: 2009-04-20
-// Contact: http://ttcn.ericsson.se
-///////////////////////////////////////////////////////////////////////////////
-
-[LOGGING]
-ConsoleMask := ERROR | STATISTICS | ACTION | USER | WARNING | VERDICTOP
-#FileMask := LOG_ALL | DEBUG
-FileMask := LOG_ALL| ERROR | STATISTICS | PARALLEL | ACTION | WARNING
-#LogFile := "%l/%e.%h-%t%r.%s"
-LogEntityName := Yes
-LogEventTypes := Yes//Subcategories;
-SourceInfoFormat := Stack
-
-[MODULE_PARAMETERS]
-
-tsp_debug_EPTF_SchedulerFunctions := false
-tsp_debugVerbose_EPTF_SchedulerFunctions := false
-tsp_EPTF_LGenBaseDebugTraffic := false
-tsp_EPTF_LGenBaseDebug := false
-
-tsp_SIP_TransactionTimerValues :=
-{
- 0.5,//T1
- 0.0,//no max
- 8.0,//64*T1
- 8.0,//Timer D, >= 32.0
- 0.5,//T1
- 4.0,//T2
- 8.0,//64*T1
- 5.0,//T4
- 0.5,//T1
- 4.0,//T2,
- 8.0,//64*T1
- 5.0,//T4
- 8.0//64*T1
-};
-
-[EXECUTE]
-MBT_SpecExpl_Testcases.Testcase_1
-//MBT_SpecExpl_Testcases.Testcase_2
-//MBT_SpecExpl_Testcases.Testcase_3
-//MBT_SpecExpl_Testcases.Testcase_4
-//MBT_SpecExpl_Testcases.Testcase_5
-//MBT_SpecExpl_Testcases.Testcase_6
-//MBT_SpecExpl_Testcases.Testcase_7
-
-
-[TESTPORT_PARAMETERS]
-*.IPL4_PCO.debug := "NO"
diff --git a/demo/SpecExplorer/TTCN/MBT_SpecExpl_Demo.prj b/demo/SpecExplorer/TTCN/MBT_SpecExpl_Demo.prj
deleted file mode 100644
index ea341e1..0000000
--- a/demo/SpecExplorer/TTCN/MBT_SpecExpl_Demo.prj
+++ /dev/null
@@ -1,142 +0,0 @@
-<!DOCTYPE TITAN_GUI_project_file>
-<Project TITAN_version="1.8.pl1" >
- <General>
- <Project_Name>MBT_SpecExpl_Demo</Project_Name>
- <Executable_Path>MBT_SpecExpl_Demo</Executable_Path>
- <Working_Dir>bin</Working_Dir>
- <Build_Host>alpha</Build_Host>
- <Execution_Mode>Parallel</Execution_Mode>
- <ScriptFile_AfterMake>../../makefile_patch.sh</ScriptFile_AfterMake>
- <Log_Format>yes</Log_Format>
- <Update_Symlinks>yes</Update_Symlinks>
- <Create_Absolute_Symlinks>no</Create_Absolute_Symlinks>
- <Update_Makefile>yes</Update_Makefile>
- <Localhost_Execute>yes</Localhost_Execute>
- <Execute_Command>rsh %host "cd %project_working_dir ; "%executable" %localhost %mctr_port"</Execute_Command>
- <Execute_Hosts>alfa, beta, gamma</Execute_Hosts>
- <UnUsed_List></UnUsed_List>
- </General>
- <Modules>
- <Module>MBT_SUT_SIP_Phone.ttcn</Module>
- <Module>MBT_SpecExpl_Demo.ttcn</Module>
- <Module>MBT_SpecExpl_Testcases.ttcn</Module>
- </Modules>
- <Configs>
- <Config>MBT_SpecExpl_Demo.cfg</Config>
- </Configs>
- <Test_Cases>
- <Test_Case>MBT_SpecExpl_Testcases.Testcase_1</Test_Case>
- <Test_Case>MBT_SpecExpl_Testcases.Testcase_2</Test_Case>
- <Test_Case>MBT_SpecExpl_Testcases.Testcase_3</Test_Case>
- <Test_Case>MBT_SpecExpl_Testcases.Testcase_4</Test_Case>
- <Test_Case>MBT_SpecExpl_Testcases.Testcase_5</Test_Case>
- <Test_Case>MBT_SpecExpl_Testcases.Testcase_6</Test_Case>
- <Test_Case>MBT_SpecExpl_Testcases.Testcase_7</Test_Case>
- </Test_Cases>
- <File_Group name="MainFileGroup" >
- <File_Groups>
- <File_Group name="EPTF_Applib_MBT_CNL113659" >
- <File path="../../../src/LoadGen/EPTF_MBT_LGen_Definitions.ttcn" />
- <File path="../../../src/LoadGen/EPTF_MBT_LGen_Functions.ttcn" />
- </File_Group>
- <File_Group name="EPTF_Applib_SIP_CNL113522" >
- <File_Groups>
- <File_Group path="../../../../EPTF_Applib_SIP_CNL113522/src/LoadGen/EPTF_SIP_LoadGen.grp" />
- <File_Group path="../../../../EPTF_Applib_SIP_CNL113522/src/Logger/EPTF_SIP_Logger.grp" />
- <File_Group path="../../../../EPTF_Applib_SIP_CNL113522/src/Transport/EPTF_SIP_Transport.grp" />
- </File_Groups>
- </File_Group>
- <File_Group name="TCCUsefulFunctions_CNL113472" >
- <File path="../../../../TCCUsefulFunctions_CNL113472/src/digcalc.c" />
- <File path="../../../../TCCUsefulFunctions_CNL113472/src/digcalc.h" />
- <File path="../../../../TCCUsefulFunctions_CNL113472/src/TCCInterface.cc" />
- <File path="../../../../TCCUsefulFunctions_CNL113472/src/TCCInterface_Functions.ttcn" />
- <File path="../../../../TCCUsefulFunctions_CNL113472/src/TCCMessageHandling.cc" />
- <File path="../../../../TCCUsefulFunctions_CNL113472/src/TCCMessageHandling_Functions.ttcn" />
- <File path="../../../../TCCUsefulFunctions_CNL113472/src/TCCSecurity.cc" />
- <File path="../../../../TCCUsefulFunctions_CNL113472/src/TCCSecurity_Functions.ttcn" />
- <File path="../../../../TCCUsefulFunctions_CNL113472/src/TCCIPsec.cc" />
- <File path="../../../../TCCUsefulFunctions_CNL113472/src/TCCIPsec_Definitions.ttcn" />
- <File path="../../../../TCCUsefulFunctions_CNL113472/src/TCCIPsec_Functions.ttcn" />
- <File path="../../../../TCCUsefulFunctions_CNL113472/src/TCCEncoding.cc" />
- <File path="../../../../TCCUsefulFunctions_CNL113472/src/TCCEncoding_Functions.ttcn" />
- <File path="../../../../TCCUsefulFunctions_CNL113472/src/aka_algorythm_set.c" />
- <File path="../../../../TCCUsefulFunctions_CNL113472/src/aka_algorythm_set.h" />
- <File path="../../../../TCCUsefulFunctions_CNL113472/src/TCCFileIO.cc" />
- <File path="../../../../TCCUsefulFunctions_CNL113472/src/TCCFileIO_Functions.ttcn" />
- <File path="../../../../TCCUsefulFunctions_CNL113472/src/TCCDateTime.cc" />
- <File path="../../../../TCCUsefulFunctions_CNL113472/src/TCCDateTime_Functions.ttcn" />
- <File path="../../../../TCCUsefulFunctions_CNL113472/src/TCCMaths.cc" />
- <File path="../../../../TCCUsefulFunctions_CNL113472/src/TCCMaths_Functions.ttcn" />
- <File path="../../../../TCCUsefulFunctions_CNL113472/src/TCCMaths_GenericTypes.ttcn" />
- <File path="../../../../TCCUsefulFunctions_CNL113472/src/TCCInterface_ip.h" />
- <File path="../../../../TCCUsefulFunctions_CNL113472/src/TCCConversion.cc" />
- <File path="../../../../TCCUsefulFunctions_CNL113472/src/TCCConversion_Functions.ttcn" />
- <File path="../../../../TCCUsefulFunctions_CNL113472/src/TCCTemplate_Functions.ttcn" />
- </File_Group>
- <File_Group name="SIPmsg_CNL113319" >
- <File path="../../../../../TestPorts/SIPmsg_CNL113319/src/lex.SIP_parse_.c" />
- <File path="../../../../../TestPorts/SIPmsg_CNL113319/src/SIP_parse.h" />
- <File path="../../../../../TestPorts/SIPmsg_CNL113319/src/SIP_parse_.tab.c" />
- <File path="../../../../../TestPorts/SIPmsg_CNL113319/src/SIP_parse_.tab.h" />
- <File path="../../../../../TestPorts/SIPmsg_CNL113319/src/SIPmsg_PortType.ttcn" />
- <File path="../../../../../TestPorts/SIPmsg_CNL113319/src/SIPmsg_PT.cc" />
- <File path="../../../../../TestPorts/SIPmsg_CNL113319/src/SIPmsg_PT.hh" />
- <File path="../../../../../TestPorts/SIPmsg_CNL113319/src/SIPmsg_Types.ttcn" />
- </File_Group>
- <File_Group name="UDPasp_CNL113346" >
- <File path="../../../../../TestPorts/UDPasp_CNL113346/src/UDPasp_PortType.ttcn" />
- <File path="../../../../../TestPorts/UDPasp_CNL113346/src/UDPasp_PT.cc" />
- <File path="../../../../../TestPorts/UDPasp_CNL113346/src/UDPasp_PT.hh" />
- <File path="../../../../../TestPorts/UDPasp_CNL113346/src/UDPasp_Types.ttcn" />
- </File_Group>
- <File_Group name="XTDPasp_CNL113494" >
- <File path="../../../../../TestPorts/XTDPasp_CNL113494/src/lex.xtdp.c" />
- <File path="../../../../../TestPorts/XTDPasp_CNL113494/src/XTDP-EXER-EncDec.cc" />
- <File path="../../../../../TestPorts/XTDPasp_CNL113494/src/XTDP_Images.ttcn" />
- <File path="../../../../../TestPorts/XTDPasp_CNL113494/src/XTDP_PDU_Defs.asn" />
- <File path="../../../../../TestPorts/XTDPasp_CNL113494/src/XTDPasp_PortType.ttcn" />
- <File path="../../../../../TestPorts/XTDPasp_CNL113494/src/XTDPasp_PT.cc" />
- <File path="../../../../../TestPorts/XTDPasp_CNL113494/src/XTDPasp_PT.hh" />
- <File path="../../../../../TestPorts/XTDPasp_CNL113494/src/XTDPasp_Types.ttcn" />
- <File path="../../../../../TestPorts/XTDPasp_CNL113494/src/XUL_XTDL.asn" />
- </File_Group>
- <File_Group name="XSDASN_CNL113474" >
- <File path="../../../../../ProtocolModules/XSDASN_CNL113474/src/XSD.asn" />
- </File_Group>
- <File_Group name="IPL4asp_CNL113531" >
- <File path="../../../../../TestPorts/IPL4asp_CNL113531/src/IPL4asp_discovery.cc" />
- <File path="../../../../../TestPorts/IPL4asp_CNL113531/src/IPL4asp_Functions.ttcn" />
- <File path="../../../../../TestPorts/IPL4asp_CNL113531/src/IPL4asp_PortType.ttcn" />
- <File path="../../../../../TestPorts/IPL4asp_CNL113531/src/IPL4asp_protocol_L234.hh" />
- <File path="../../../../../TestPorts/IPL4asp_CNL113531/src/IPL4asp_PT.cc" />
- <File path="../../../../../TestPorts/IPL4asp_CNL113531/src/IPL4asp_PT.hh" />
- <File path="../../../../../TestPorts/IPL4asp_CNL113531/src/IPL4asp_Types.ttcn" />
- </File_Group>
- <File_Group name="Abstract_Socket_CNL113384" >
- <File path="../../../../../TestPorts/Common_Components/Abstract_Socket_CNL113384/src/Abstract_Socket.cc" />
- <File path="../../../../../TestPorts/Common_Components/Abstract_Socket_CNL113384/src/Abstract_Socket.hh" />
- </File_Group>
- <File_Group name="EPTF_Core_Library_CNL113512" >
- <File_Groups>
- <File_Group path="../../../../EPTF_Core_Library_CNL113512/src/Base/EPTF_CLL_Base.grp" />
- <File_Group path="../../../../EPTF_Core_Library_CNL113512/src/Common/EPTF_CLL_Common.grp" />
- <File_Group path="../../../../EPTF_Core_Library_CNL113512/src/FreeBusyQueue/EPTF_CLL_FreeBusyQueue.grp" />
- <File_Group path="../../../../EPTF_Core_Library_CNL113512/src/HashMap/EPTF_CLL_HashMap.grp" />
- <File_Group path="../../../../EPTF_Core_Library_CNL113512/src/Logging/EPTF_CLL_Logging.grp" />
- <File_Group path="../../../../EPTF_Core_Library_CNL113512/src/RedBlackTree/EPTF_CLL_RBtree_Float.grp" />
- <File_Group path="../../../../EPTF_Core_Library_CNL113512/src/Scheduler/EPTF_CLL_Scheduler_RBT.grp" />
- <File_Group path="../../../../EPTF_Core_Library_CNL113512/src/Variable/EPTF_CLL_Variable.grp" />
- <File_Group path="../../../../EPTF_Core_Library_CNL113512/src/StatMeasure/EPTF_CLL_StatMeasure.grp" />
- <File_Group path="../../../../EPTF_Core_Library_CNL113512/src/Transport/EPTF_CLL_TransportCommPortIPL4.grp" />
- <File_Group path="../../../../EPTF_Core_Library_CNL113512/src/Transport/EPTF_CLL_TransportMessageBufferManager.grp" />
- <File_Group path="../../../../EPTF_Core_Library_CNL113512/src/Transport/EPTF_CLL_TransportRouting.grp" />
- <File_Group path="../../../../EPTF_Core_Library_CNL113512/src/RandomNArray/EPTF_CLL_RNA.grp" />
- <File_Group path="../../../../EPTF_Core_Library_CNL113512/src/Semaphore/EPTF_CLL_Semaphore.grp" />
- <File_Group path="../../../../EPTF_Core_Library_CNL113512/src/StatHandler/EPTF_CLL_StatHandler.grp" />
- <File_Group path="../../../../EPTF_Core_Library_CNL113512/src/LGenBase/EPTF_CLL_LGenBase.grp" />
- </File_Groups>
- </File_Group>
- </File_Groups>
- </File_Group>
-</Project>
diff --git a/demo/SpecExplorer/TTCN/MBT_SpecExpl_Demo.ttcn b/demo/SpecExplorer/TTCN/MBT_SpecExpl_Demo.ttcn
deleted file mode 100644
index 3100c16..0000000
--- a/demo/SpecExplorer/TTCN/MBT_SpecExpl_Demo.ttcn
+++ /dev/null
@@ -1,721 +0,0 @@
-///////////////////////////////////////////////////////////////////////////////
-//
-// Copyright (c) 2000-2018 Ericsson Telecom AB
-//
-// All rights reserved. This program and the accompanying materials
-// are made available under the terms of the Eclipse Public License v1.0
-// which accompanies this distribution, and is available at
-// http://www.eclipse.org/legal/epl-v10.html
-///////////////////////////////////////////////////////////////////////////////
-//
-// File: MBT_SpecExpl_Demo.ttcn
-// Rev: <RnXnn>
-// Prodnr: CNL 113 659
-// Updated: 2009-10-01
-// Contact: http://ttcn.ericsson.se
-///////////////////////////////////////////////////////////////////////////////
-module MBT_SpecExpl_Demo
-{
-
-import from MBT_SpecExpl_Testcases all;
-
-import from MBT_SUT_SIP_Phone all;
-
-import from EPTF_CLL_Common_Definitions all;
-import from EPTF_CLL_Base_Definitions all;
-import from EPTF_CLL_Base_Functions all;
-import from EPTF_CLL_RBTScheduler_Functions all;
-import from EPTF_CLL_LGenBase_Definitions all;
-import from EPTF_CLL_LGenBase_ConfigFunctions all;
-import from EPTF_CLL_LGenBase_EventHandlingFunctions all;
-
-import from EPTF_MBT_LGen_Definitions all;
-import from EPTF_MBT_LGen_Functions all;
-
-import from EPTF_SIP_LGen_Definitions all;
-import from EPTF_SIP_LGen_Functions all;
-import from EPTF_SIP_Common_Functions all;
-import from EPTF_SIP_UserDatabase_Functions all;
-import from EPTF_SIP_Transport_Definitions all;
-import from EPTF_SIP_Transport_Functions all;
-import from EPTF_SIP_MessageHandler_Functions all;
-
-import from EPTF_SIP_TestSteps all;
-import from EPTF_SIP_Templates all;
-import from EPTF_SIP_Events all;
-import from EPTF_SIP_Transaction_Definitions all;
-
-import from TCCFileIO_Functions all;
-import from TCCDateTime_Functions all;
-
-modulepar
-{
- charstring tsp_MBT_Tester_LocalIP := "159.107.193.33";
- integer tsp_MBT_Tester_LocalPort := 15000;
- charstring tsp_MBT_Tester_RemoteIP := "159.107.193.33";
- integer tsp_MBT_Tester_RemotePort := 20000;
-
- charstring tsp_MBT_SIP_Transport := "udp";
-}
-
-type component MBT_SpecExpl_Demo_Main_CT
- extends
- EPTF_Base_CT,
- EPTF_MBT_Tester_CT
-{}
-
-type record Message
-{
- charstring name,
- boolean type_in,
- record of record
- {
- charstring paramName,
- charstring paramValue
- } params
-}
-type record of Message Messages;
-type record ExportData
-{
- charstring tcName,
- verdicttype verdict,
- Messages messages,
- record of charstring states
-}
-type record of ExportData ExportDatas;
-
-function f_MBT_SpecExpl_Demo_beginTestCase() runs on SpecExpl_CT
-{
- log(%definitionId, " started");
-
- f_EPTF_Base_init_CT("mtc");
-
- log(%definitionId, " Creating SUT");
- var MBT_SpecExpl_Demo_SUT_CT vc_sut := MBT_SpecExpl_Demo_SUT_CT.create;
- connect(self:userIn, vc_sut:userIn);
- connect(self:userOut, vc_sut:userOut);
- connect(self:EPTF_MBT_PCO,vc_sut:EPTF_MBT_PCO);
- vc_sut.start(f_MBT_SpecExpl_Demo_SUT_behavior());
-
- EPTF_MBT_PCO.receive(EPTF_MBT_CommandResponse:?) from vc_sut;
-
- EPTF_MBT_PCO.send(EPTF_MBT_ConfigRequest:
- {
- entityGroupName := "SUT_EntityType",
- noEntities := 1,
- behaviors := {"MBT_behavior", "Behavior_SIP", "SUT_Behavior"},
- fsmName := "MBT_SpecExpl_Demo_SUT_FSM"
- }
- ) to vc_sut;
- EPTF_MBT_PCO.receive(EPTF_MBT_ConfigResponse:?) from vc_sut;
- log(%definitionId, " SUT ready");
-
- log(%definitionId, " Creating LGen");
- var MBT_SpecExpl_Demo_LGen_CT vc_lgen := MBT_SpecExpl_Demo_LGen_CT.create;
- connect(self:netIn, vc_lgen:netOut);
- connect(self:netOut, vc_lgen:netIn);
- connect(self:EPTF_MBT_PCO,vc_lgen:EPTF_MBT_PCO);
- vc_lgen.start(f_MBT_SpecExpl_Demo_LGen_behavior());
-
- EPTF_MBT_PCO.receive(EPTF_MBT_CommandResponse:?) from vc_lgen;
-
- EPTF_MBT_PCO.send(EPTF_MBT_ConfigRequest:
- {
- entityGroupName := "MBT_EntityType",
- noEntities := 1,
- behaviors := {"MBT_behavior", "Behavior_SIP"},
- fsmName := "FSM_MBT"
- }
- ) to vc_lgen;
- EPTF_MBT_PCO.receive(EPTF_MBT_ConfigResponse:?) from vc_lgen;
-
- log(%definitionId, " LGen ready");
-
- log(%definitionId, " finished");
-}
-
-
-function f_MBT_SpecExpl_Demo_endTestCase() runs on SpecExpl_CT
-{
- log("### MAIN: END TESTCASE started");
-
- f_EPTF_Base_stopAll(none, true);
-
- log("### MAIN: END TESTCASE finished");
-}
-
-/////////////////////////////////////////////////////////////////////////
-//
-// M B T Applib
-//
-/////////////////////////////////////////////////////////////////////////
-
-type component MBT_SpecExpl_Demo_LGen_CT
- extends
- EPTF_MBT_LGen_CT,
- EPTF_SIP_LGen_CT, EPTF_SIP_LocalTransport_CT
-{
- port netInPort netIn;
- port netOutPort netOut;
-}
-
-function f_MBT_SpecExpl_Demo_LGen_behavior() runs on MBT_SpecExpl_Demo_LGen_CT
-{
- //map(self:IPL4_PCO, system:IPL4_PCO);
-
- activate(as_MBT_SpecExpl_Demo_LGen_userMessageHandler());
-
- f_EPTF_MBT_init("MBT_Demo_LGen",0, "MBT_")
-
- f_SIP_applibInit("MBT_Demo_LGen");
-
- f_EPTF_SIP_LocalTransport_init(tsp_MBT_SIP_Transport);
- vf_EPTF_SIP_LocalTransport_receive := refers(f_EPTF_SIP_Message_MsgHandler); //receive callback function on LocalTransport
- vf_EPTF_SIP_LGen_msgSender := refers(f_EPTF_SIP_LocalTransport_sendSIPMessage); //send callback function on LGen
- v_removeUAS := refers(fcb_EPTF_SIP_LocalTransport_removeUAS);
-
- f_EPTF_MBT_initLGenFsm
- (
- refers(f_MBT_SpecExpl_Demo_LGen_createUserMessage),
- refers(f_MBT_SpecExpl_Demo_LGen_fillInDB)
- );
-
- EPTF_MBT_PCO.send(EPTF_MBT_CommandResponse:{ ready := {}}) to mtc;
-
- f_EPTF_Base_wait4Shutdown();
-}
-
-altstep as_MBT_SpecExpl_Demo_LGen_userMessageHandler()
-runs on MBT_SpecExpl_Demo_LGen_CT
-{
- var SIPResp vl_SIPResp;
- var SIPReq vl_SIPReq;
-
- var EPTF_LGenBase_TestStepArgs vl_stepArgs :=
- { eIdx := 0, refContext := { fCtxIdx := 0, fRefArgs := { } }, stepArgs := { } };
-
- [] netOut.receive(SIPResp:?) -> value vl_SIPResp
- {
- f_EPTF_SchedulerComp_refreshSnapshotTime();
- log(%definitionId & "(): incoming ", vl_SIPResp);
-
- if (vl_SIPResp.status == 180)
- {
- vl_stepArgs.refContext.fRefArgs := {c_status_180Ringing_idx};
- f_SIP_step_createResponse(vl_stepArgs);
- }
- else if (vl_SIPResp.status == 200)
- {
- if (vl_SIPResp.cseq == "INVITE")
- {
- vl_stepArgs.refContext.fRefArgs := {c_status_200OK_idx, c_SIP_Method_INVITE};
- f_SIP_step_createResponse(vl_stepArgs);
- }
- else if (vl_SIPResp.cseq == "CANCEL")
- {
- vl_stepArgs.refContext.fRefArgs := {c_status_200OK_idx, c_SIP_Method_CANCEL};
- f_SIP_step_createResponse(vl_stepArgs);
- }
- }
- else if (vl_SIPResp.status == 486)
- {
- vl_stepArgs.refContext.fRefArgs := {c_status_486BusyHere_idx};
- f_SIP_step_createResponse(vl_stepArgs);
- }
- else if (vl_SIPResp.status == 487)
- {
- vl_stepArgs.refContext.fRefArgs := {c_status_487RequestTerminated_idx, c_SIP_Method_INVITE};
- f_SIP_step_createResponse(vl_stepArgs);
- }
- else
- {
- log(%definitionId & "(): unhandled SIPResp");
- }
-
- repeat;
- }
- [] netOut.receive(SIPReq:?) -> value vl_SIPReq
- {
- f_EPTF_SchedulerComp_refreshSnapshotTime();
- log(%definitionId & "(): incoming ", vl_SIPReq);
-
- if (vl_SIPReq.op == "BYE")
- {
- f_SIP_step_createBYE(vl_stepArgs);
- }
- else
- {
- log(%definitionId & "(): unhandled SIPResp");
- }
- repeat;
- }
-}
-
-function f_MBT_SpecExpl_Demo_LGen_createUserMessage(in EPTF_LGenBase_TestStepArgs pl_ptr)
-runs on MBT_SpecExpl_Demo_LGen_CT
-{
- log(%definitionId & " creating message for:\n", pl_ptr, "\n", pl_ptr.reportedEvent);
-
- var charstring vl_param := "sip:127.0.0.1:5061";
-
- if (pl_ptr.reportedEvent.event.bIdx == v_SIP_myBIdx and pl_ptr.reportedEvent.event.iIdx == c_SIP_eventIdx_INVITE)
- {
- var integer vl_FSMIdx := -1;
- pl_ptr.refContext.fCtxIdx := 0;
-
- if (not f_EPTF_SIP_FSMInitialized(pl_ptr.eIdx, pl_ptr.refContext.fCtxIdx, vl_FSMIdx))
- {
- f_SIP_step_init(pl_ptr);
- f_SIP_step_handleINVITE(pl_ptr);
- }
- netIn.send(SIPReq:{"INVITE", vl_param});
- }
- else if (pl_ptr.reportedEvent.event.bIdx == v_SIP_myBIdx and pl_ptr.reportedEvent.event.iIdx == c_SIP_eventIdx_ACK)
- {
- netIn.send(SIPReq:{"ACK", vl_param});
- }
- else if (pl_ptr.reportedEvent.event.bIdx == v_SIP_myBIdx and pl_ptr.reportedEvent.event.iIdx == c_SIP_eventIdx_BYE)
- {
- netIn.send(SIPReq:{"BYE", vl_param});
- }
- else if (pl_ptr.reportedEvent.event.bIdx == v_SIP_myBIdx and pl_ptr.reportedEvent.event.iIdx == c_SIP_eventIdx_CANCEL)
- {
- netIn.send(SIPReq:{"CANCEL", vl_param});
- }
- else if (pl_ptr.reportedEvent.event.bIdx == v_SIP_myBIdx and pl_ptr.reportedEvent.event.iIdx == 200)
- {
- netIn.send(SIPResp:{200, v_msgToProcess.response.msgHeader.cSeq.method});
- }
- else if (pl_ptr.reportedEvent.event.bIdx == v_SIP_myBIdx and pl_ptr.reportedEvent.event.iIdx == c_SIP_eventIdx_retransmittedRequest)
- {
- netIn.send(SIPReq:{v_msgToProcess.request.msgHeader.cSeq.method, vl_param});
- }
- else
- {
- log(%definitionId & "(): unhandled incoming message");
- }
-}
-
-function f_MBT_SpecExpl_Demo_LGen_fillInDB(in EPTF_MBT_ConfigRequest p_req) runs on MBT_SpecExpl_Demo_LGen_CT
-{
- var integer vl_grpIdx := f_EPTF_LGenBase_entityGrpNameIndex(p_req.entityGroupName);
- var integer vl_entityIdx := f_EPTF_LGenBase_getEGrpBaseOffset(vl_grpIdx);
-
- for (var integer i:=0; i<p_req.noEntities; i:=i+1)
- {
- var EPTF_IntegerList vl_bCtx := f_EPTF_LGenBase_getBehaviorCtx(i + vl_entityIdx, v_SIP_myBIdx);
- f_EPTF_SIP_IPL4asp_SetUserData
- (
- vl_bCtx[0],
- tsp_MBT_Tester_LocalIP, // local IP
- {tsp_MBT_Tester_LocalPort, tsp_MBT_Tester_LocalPort+1},
- tsp_MBT_SIP_Transport,
- tsp_MBT_Tester_RemoteIP, // proxy ip
- tsp_MBT_Tester_RemotePort // proxy port
- );
-
- f_EPTF_SIP_User_SetUserData(
- vl_bCtx[0],
- {
- {
- addr := {
- nameAddr := {
- displayName := "titansim_user_7465000",
- addrSpec := {
- scheme := "sip",
- userInfo := {
- userOrTelephoneSubscriber := "titansim_user_7465000",
- password := omit
- },
- hostPort := {
- host := "tcj.ics.se",
- portField := tsp_MBT_Tester_LocalPort
- },
- urlParameters := omit,
- headers := omit
- }
- }
- },
- password := "pass2ICS"
- }
- },
- tsp_MBT_Tester_LocalIP,
- {tsp_MBT_Tester_LocalPort, tsp_MBT_Tester_LocalPort+1},
- i + vl_entityIdx //entity index
- );
-
- f_EPTF_SIP_Session_AddData(vl_bCtx[0], f_EPTF_SIP_getTransport(tsp_MBT_SIP_Transport),345600);
-
- f_EPTF_SIP_IPL4asp_startListening(vl_bCtx[0], true); // Both UDP and TCP
- }
-}
-
-function f_exportHTML(in ExportDatas db)
-{
- var charstring vl_datetime := f_getTimeFormatted(f_time(),"%A %d %B %Y %H:%M:%S");
- var integer vl_write;
- var charstring vl_html_start :=
-"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">
-<html>
-<head>
-<title>Test results html export " & vl_datetime & "</title>
-<meta http-equiv=\"Content-Type\" content=\"text/html; charset=windows-1252\">
-<script language=\"JavaScript\" type=\"text/javascript\">
-
-$pass = '#99FF99';
-$fail = '#FF9999';
-$inconc = '#FFFF99';
-$selected = '#9999FF';
-
-function mouseover(row) {row.style.background=$selected;};
-function mouseout(row) {if(row.getAttribute(\"verdicttype\")==\"pass\")row.style.background=$pass;
- else if(row.getAttribute(\"verdicttype\")==\"fail\")row.style.background=$fail;
- else if(row.getAttribute(\"verdicttype\")==\"inconc\")row.style.background=$inconc;};
-function mouseclick(tcnum) {window.location = \"#testcase\"+tcnum;}
-
-</script>
-
-<style type=\"text/css\">
-
- body { margin: 0px;
- background-color: #CCCCCC;
- text-align: center; }
-
- .header { background-color: #DDDDDD; }
-
- .c1 { text-align: left;
- vertical-align: top;
- width: 120px;}
- .c2 { text-align: left;
- vertical-align: top;
- width: 80px;}
- .c3 { text-align: left;
- vertical-align: top;
- width: 250px;}
- .c4 { text-align: left;
- vertical-align: top;
- width: 300px;}
-
- .r1 {background-color: #99FF99;}
- .r2 {background-color: #FF9999;}
- .r3 {background-color: #FFFF99;}
-
- .table1 { border: 2px solid black;
- border-collapse: collapse;
- border-spacing: 0px;
- padding: 0px; }
-
- .table1 td{ border: 1px solid black;
- border-collapse: collapse; }
-
- .sumtable { border: 2px solid black;
- border-collapse: collapse;
- border-spacing: 0px;
- padding: 0px; }
-
- .maintable { border: 0px solid black;}
-
- .innertable { border: 0px solid black;
- width: 100%;
- height: 100%;}
-
- #wrapper { position: relative;
- top: 36px;
- display: inline-block; }
-
- .dtitle { background-color: #DDDDDD;
- font-size: 24px;
- white-space: pre; }
-
- .dt {background-color: transparent;
- font-size: 1px; }
-
- .ds {background-color: #222222;
- font-size: 1px;
- filter:alpha(opacity=90);
- -moz-opacity: 0.9;
- opacity: 0.9; }
-
-</style>
-</head>
-<body>
-<div align=\"center\" id=\"wrapper\">
-
-<table align=\"center\" class=\"maintable\" cellpadding=\"0px\" cellspacing=\"0px\">
- <tr>
- <td>
- <table class=\"table1\" cellpadding=\"5px\" cellspacing=\"0px\">
- <tr class=\"dtitle\">
- <td>" & vl_datetime & "</td>
- </tr>
- </table>
- </td>
- <td width=\"10px\" height=\"100%\">
- <table class=\"innertable\" cellpadding=\"0px\" cellspacing=\"0px\">
- <tr height=\"10px\"><td class=\"dt\"> </td></tr>
- <tr><td class=\"ds\"> </td></tr>
- </table>
- </td>
- </tr>
- <tr>
- <td height=\"10px\">
- <table class=\"innertable\" cellpadding=\"0px\" cellspacing=\"0px\">
- <tr><td width=\"10px\" class=\"dt\"> </td><td class=\"ds\"> </td></tr>
- </table>
- </td>
- <td class=\"ds\"> </td>
- </tr>
-</table>
-
-<br>
-<table align=\"center\" class=\"maintable\" cellpadding=\"0px\" cellspacing=\"0px\">
- <tr>
- <td>
- <table class=\"table1\" cellpadding=\"5px\">
- <tr class=\"header\">
- <th class=\"c1\">TC Name</th><th class=\"c2\">Verdict</th>
- </tr>
-";
-
- var integer vl_nof_pass := 0;
- var integer vl_nof_fail := 0;
- var integer vl_nof_inconc := 0;
- var integer vl_fd;
- var charstring vl_text_out;
- vl_fd := f_FIO_open_append_wronly ("exportHTML_"&f_getTimeFormatted(f_time(),"%d_%m_%Y__%H_%M_%S")&".html");
- if (vl_fd < 0)
- {
- log(f_FIO_get_error_string ());
- return;
- }
- vl_write := f_FIO_write_text (vl_fd, vl_html_start);
-
- for(var integer i := 0; i < sizeof(db) ; i:= i+1)
- {
- //new row
- if (db[i].verdict == pass)
- {
- vl_text_out := " <tr class=\"r1\" verdicttype=\"pass\" onmouseover=\"mouseover(this);\" onmouseout=\"mouseout(this);\" onclick=\"mouseclick(" & int2str(i) & ");\" style=\"cursor: pointer\">\n";
- vl_nof_pass := vl_nof_pass +1;
- }
- else if (db[i].verdict == fail)
- {
- vl_text_out := " <tr class=\"r2\" verdicttype=\"fail\" onmouseover=\"mouseover(this);\" onmouseout=\"mouseout(this);\" onclick=\"mouseclick(" & int2str(i) & ");\" style=\"cursor: pointer\">\n";
- vl_nof_fail := vl_nof_fail +1;
- }
- else if (db[i].verdict == inconc)
- {
- vl_text_out := " <tr class=\"r3\" verdicttype=\"inconc\" onmouseover=\"mouseover(this);\" onmouseout=\"mouseout(this);\" onclick=\"mouseclick(" & int2str(i) & ");\" style=\"cursor: pointer\">\n";
- vl_nof_inconc := vl_nof_inconc +1;
- }
- vl_write := f_FIO_write_text (vl_fd,vl_text_out);
-
- //new cell - tcName
- vl_text_out := " <td class=\"c1\">\n";
- vl_write := f_FIO_write_text (vl_fd,vl_text_out);
- //cell content
- vl_text_out := " "&db[i].tcName&"\n";
- vl_write := f_FIO_write_text (vl_fd,vl_text_out);
- //end of cell
- vl_text_out := " </td>\n";
- vl_write := f_FIO_write_text (vl_fd,vl_text_out);
-
- //new cell - Verdict
- vl_text_out := " <td class=\"c2\">\n";
- vl_write := f_FIO_write_text (vl_fd,vl_text_out);
- //cell content
- if (db[i].verdict == pass)
- {
- vl_text_out := " pass\n";
- }
- else if (db[i].verdict == fail)
- {
- vl_text_out := " fail\n";
- }
- else if (db[i].verdict == inconc)
- {
- vl_text_out := " error\n";
- }
-
- vl_write := f_FIO_write_text (vl_fd,vl_text_out);
- //end of cell
- vl_text_out := " </td>\n";
- vl_write := f_FIO_write_text (vl_fd,vl_text_out);
- }
-
- vl_text_out :=
-" </table>
- </td>
- <td width=\"10px\" height=\"100%\">
- <table class=\"innertable\" cellpadding=\"0px\" cellspacing=\"0px\">
- <tr height=\"10px\"><td class=\"dt\"> </td></tr>
- <tr><td class=\"ds\"> </td></tr>
- </table>
- </td>
- </tr>
- <tr>
- <td height=\"10px\">
- <table class=\"innertable\" cellpadding=\"0px\" cellspacing=\"0px\">
- <tr><td width=\"10px\" class=\"dt\"> </td><td class=\"ds\"> </td></tr>
- </table>
- </td>
- <td class=\"ds\"> </td>
- </tr>
-</table>
-<br>
-
-<table align=\"center\" class=\"maintable\" cellpadding=\"0px\" cellspacing=\"0px\">
- <tr>
- <td>
- <table class=\"sumtable\" cellpadding=\"5px\">
- <tr>
- <td class=\"r1\" style=\"border-left: 1px solid black\">Passed: </td><td class=\"r1\">" & int2str(vl_nof_pass) & "</td>
- <td class=\"r2\" style=\"border-left: 1px solid black\">Failed: </td><td class=\"r2\">" & int2str(vl_nof_fail) & "</td>
- <td class=\"r3\" style=\"border-left: 1px solid black\">Error: </td><td class=\"r3\">" & int2str(vl_nof_inconc) & "</td>
- </tr>
- </table>
- </td>
- <td width=\"10px\" height=\"100%\">
- <table class=\"innertable\" cellpadding=\"0px\" cellspacing=\"0px\">
- <tr height=\"10px\"><td class=\"dt\"> </td></tr>
- <tr><td class=\"ds\"> </td></tr>
- </table>
- </td>
- </tr>
- <tr>
- <td height=\"10px\">
- <table class=\"innertable\" cellpadding=\"0px\" cellspacing=\"0px\">
- <tr><td width=\"10px\" class=\"dt\"> </td><td class=\"ds\"> </td></tr>
- </table>
- </td>
- <td class=\"ds\"> </td>
- </tr>
-</table>
-<br><br><br>
-<table align=\"center\" class=\"maintable\" cellpadding=\"0px\" cellspacing=\"0px\">
- <tr>
- <td>
- <table class=\"table1\" cellpadding=\"5px\" cellspacing=\"0px\">
- <tr class=\"header\">
- <th class=\"c1\">TC Name</th><th class=\"c2\">Verdict</th><th class=\"c3\">Messages</th><th class=\"c4\">States</th>
- </tr>
-";
- vl_write := f_FIO_write_text (vl_fd, vl_text_out);
-
- for(var integer i := 0; i < sizeof(db) ; i:= i+1)
- {
- //new row
- if (db[i].verdict == pass)
- {
- vl_text_out := " <tr class=\"r1\">\n";
- }
- else if (db[i].verdict == fail)
- {
- vl_text_out := " <tr class=\"r2\">\n";
- }
- else if (db[i].verdict == inconc)
- {
- vl_text_out := " <tr class=\"r3\">\n";
- }
- vl_write := f_FIO_write_text (vl_fd,vl_text_out);
-
- //new cell - tcName
- vl_text_out := " <td class=\"c1\">\n";
- vl_write := f_FIO_write_text (vl_fd,vl_text_out);
- //cell content
- vl_text_out := " <a name=\"testcase" & int2str(i) & "\">"&db[i].tcName&"</a>\n";
- vl_write := f_FIO_write_text (vl_fd,vl_text_out);
- //end of cell
- vl_text_out := " </td>\n";
- vl_write := f_FIO_write_text (vl_fd,vl_text_out);
-
- //new cell - Verdict
- vl_text_out := " <td class=\"c2\">\n";
- vl_write := f_FIO_write_text (vl_fd,vl_text_out);
- //cell content
- if (db[i].verdict == pass)
- {
- vl_text_out := " pass\n";
- }
- else if (db[i].verdict == fail)
- {
- vl_text_out := " fail\n";
- }
- else if (db[i].verdict == inconc)
- {
- vl_text_out := " error\n";
- }
-
- vl_write := f_FIO_write_text (vl_fd,vl_text_out);
- //end of cell
- vl_text_out := " </td>\n";
- vl_write := f_FIO_write_text (vl_fd,vl_text_out);
-
- //new cell - Messages
- vl_text_out := " <td class=\"c3\">\n";
- vl_write := f_FIO_write_text (vl_fd,vl_text_out);
- //cell content
- for(var integer j := 0; j < sizeof(db[i].messages); j := j+1)
- {
- if (db[i].messages[j].type_in) {vl_text_out := "<------- ";} else {vl_text_out := "-------- ";}
- vl_text_out := vl_text_out & db[i].messages[j].name;
- if (db[i].messages[j].type_in) {vl_text_out := vl_text_out & " --------<br>\n";} else {vl_text_out := vl_text_out & " -------><br>\n";}
- vl_write := f_FIO_write_text (vl_fd,vl_text_out);
- for(var integer k := 0; k < sizeof(db[i].messages[j].params); k := k+1)
- {
- vl_text_out := " - " & db[i].messages[j].params[k].paramName & ": \"" & db[i].messages[j].params[k].paramValue & "\"<br>\n";
- vl_write := f_FIO_write_text (vl_fd,vl_text_out);
- }
- }
- //end of cell
- vl_text_out := " </td>\n";
- vl_write := f_FIO_write_text (vl_fd,vl_text_out);
-
- //new cell - States
- vl_text_out := " <td class=\"c4\">\n";
- vl_write := f_FIO_write_text (vl_fd,vl_text_out);
- //cell content
- for(var integer j := 0; j < sizeof(db[i].states); j := j+1)
- {
- vl_text_out := db[i].states[j] & "<br>\n";
- vl_write := f_FIO_write_text (vl_fd,vl_text_out);
- }
- //end of cell
- vl_text_out := " </td>\n";
- vl_write := f_FIO_write_text (vl_fd,vl_text_out);
-
- //end of row
- vl_text_out := " </tr>\n";
- vl_write := f_FIO_write_text (vl_fd,vl_text_out);
- }
-
- var charstring vl_html_end :=
-" </table>
- </td>
- <td width=\"10px\" height=\"100%\">
- <table class=\"innertable\" cellpadding=\"0px\" cellspacing=\"0px\">
- <tr height=\"10px\"><td class=\"dt\"> </td></tr>
- <tr><td class=\"ds\"> </td></tr>
- </table>
- </td>
- </tr>
- <tr>
- <td height=\"10px\">
- <table class=\"innertable\" cellpadding=\"0px\" cellspacing=\"0px\">
- <tr><td width=\"10px\" class=\"dt\"> </td><td class=\"ds\"> </td></tr>
- </table>
- </td>
- <td class=\"ds\"> </td>
- </tr>
-</table>
-<br>
-</div>
-</body>
-</html>";
-
- vl_write := f_FIO_write_text (vl_fd, vl_html_end);
- f_FIO_flush (vl_fd);
- f_FIO_close (vl_fd);
-}
-
-}
diff --git a/demo/SpecExplorer/TTCN/MBT_SpecExpl_Testcases.ttcn b/demo/SpecExplorer/TTCN/MBT_SpecExpl_Testcases.ttcn
deleted file mode 100644
index 93a3b0a..0000000
--- a/demo/SpecExplorer/TTCN/MBT_SpecExpl_Testcases.ttcn
+++ /dev/null
@@ -1,381 +0,0 @@
-///////////////////////////////////////////////////////////////////////////////
-//
-// Copyright (c) 2000-2018 Ericsson Telecom AB
-//
-// All rights reserved. This program and the accompanying materials
-// are made available under the terms of the Eclipse Public License v1.0
-// which accompanies this distribution, and is available at
-// http://www.eclipse.org/legal/epl-v10.html
-///////////////////////////////////////////////////////////////////////////////
-//
-// File: MBT_SpecExpMBT_SpecExpl_Testcasesl_Demo.ttcn
-// Rev: <RnXnn>
-// Prodnr: CNL 113 659
-// Updated: 2009-10-01
-// Contact: http://ttcn.ericsson.se
-///////////////////////////////////////////////////////////////////////////////
-module MBT_SpecExpl_Testcases
-{
- import from MBT_SpecExpl_Demo all;
- import from EPTF_MBT_LGen_Definitions all;
- type port netInPort message
- {
- inout SIPResp;
- inout SIPReq;
- } with { extension "internal" }
-
- type port userInPort message
- {
- inout UserInput;
- } with { extension "internal" }
-
- type port netOutPort message
- {
- inout SIPResp;
- inout SIPReq;
- } with { extension "internal" }
-
- type port userOutPort message
- {
- inout TimeOutIndication;
- } with { extension "internal" }
-
- type record SIPReq
- {
- charstring op,
- charstring param_
- }
-
- type record SIPResp
- {
- integer status,
- charstring cseq
- }
-
- type record UserInput
- {
- charstring input1,
- charstring input2
- }
-
- type record TimeOutIndication
- {
-
- }
-
- type component SpecExpl_CT extends MBT_SpecExpl_Demo_Main_CT
- {
- port netInPort netIn;
- port userInPort userIn;
- port netOutPort netOut;
- port userOutPort userOut;
- timer harnessTimer := 0.0;
- }
-
- altstep SpecExplDefaultAlt() runs on SpecExpl_CT
- {
- [] any port.receive
- {
- harnessTimer.stop;
- setverdict(fail);
- f_MBT_SpecExpl_Demo_endTestCase();
- stop;
- }
- [] harnessTimer.timeout
- {
- setverdict(fail);
- f_MBT_SpecExpl_Demo_endTestCase();
- stop;
- }
- }
- function specexpl_send_SIPResp_to_netIn(template SIPResp msgToSend) runs on SpecExpl_CT
- {
- netIn.send(msgToSend);
- }
-
- function specexpl_send_SIPReq_to_netIn(template SIPReq msgToSend) runs on SpecExpl_CT
- {
- netIn.send(msgToSend);
- }
-
- function specexpl_send_UserInput_to_userIn(template UserInput msgToSend) runs on SpecExpl_CT
- {
- userIn.send(msgToSend);
- }
-
- function specexpl_receive_SIPResp_from_netOut(template SIPResp tmplToMatch) runs on SpecExpl_CT
- {
- netOut.receive(tmplToMatch);
- }
-
- function specexpl_receive_SIPReq_from_netOut(template SIPReq tmplToMatch) runs on SpecExpl_CT
- {
- netOut.receive(tmplToMatch);
- }
-
- function specexpl_receive_TimeOutIndication_from_userOut(template TimeOutIndication tmplToMatch) runs on SpecExpl_CT
- {
- userOut.receive(tmplToMatch);
- }
-
-
- testcase Testcase_1() runs on SpecExpl_CT
- {
- var float oldtimer := 0.0;
- var float SLACK := 10.0;
- var default default_behaviour_ref;
- f_MBT_SpecExpl_Demo_beginTestCase();
- default_behaviour_ref := activate(SpecExplDefaultAlt());
- log("START TESTCASE: Testcase_1");
- //Init_Calling
- log("Init_Calling");
- specexpl_send_UserInput_to_userIn({input1 := "invite", input2 := "sip:127.0.0.1:5061"});
- harnessTimer.start(0.00 + SLACK);
- specexpl_receive_SIPReq_from_netOut({op := "INVITE", param_ := "sip:127.0.0.1:5061"});
- harnessTimer.stop;
- //Calling_Ringing
- log("Calling_Ringing");
- specexpl_send_SIPResp_to_netIn({status := 180, cseq := ""});
- //Ringing_Ready
- log("Ringing_Ready");
- specexpl_send_SIPResp_to_netIn({status := 200, cseq := "INVITE"});
- harnessTimer.start(0.00 + SLACK);
- specexpl_receive_SIPReq_from_netOut({op := "ACK", param_ := "sip:127.0.0.1:5061"});
- harnessTimer.stop;
- //Ready_End
- log("Ready_End");
- specexpl_send_SIPReq_to_netIn({op := "BYE", param_ := "sip:127.0.0.1"});
- harnessTimer.start(0.00 + SLACK);
- specexpl_receive_SIPResp_from_netOut({status := 200, cseq := "BYE"});
- harnessTimer.stop;
- log("THE END");
- setverdict(pass);
- deactivate(default_behaviour_ref);
- f_MBT_SpecExpl_Demo_endTestCase();
- }
-
- testcase Testcase_2() runs on SpecExpl_CT
- {
- var float oldtimer := 0.0;
- var float SLACK := 10.0;
- var default default_behaviour_ref;
- f_MBT_SpecExpl_Demo_beginTestCase();
- default_behaviour_ref := activate(SpecExplDefaultAlt());
- log("START TESTCASE: Testcase_2");
- //Init_Calling
- log("Init_Calling");
- specexpl_send_UserInput_to_userIn({input1 := "invite", input2 := "sip:127.0.0.1:5061"});
- harnessTimer.start(0.00 + SLACK);
- specexpl_receive_SIPReq_from_netOut({op := "INVITE", param_ := "sip:127.0.0.1:5061"});
- harnessTimer.stop;
- //Calling_Ringing
- log("Calling_Ringing");
- specexpl_send_SIPResp_to_netIn({status := 180, cseq := ""});
- //Ringing_Ready
- log("Ringing_Ready");
- specexpl_send_SIPResp_to_netIn({status := 200, cseq := "INVITE"});
- harnessTimer.start(0.00 + SLACK);
- specexpl_receive_SIPReq_from_netOut({op := "ACK", param_ := "sip:127.0.0.1:5061"});
- harnessTimer.stop;
- //Ready_Terminating
- log("Ready_Terminating");
- specexpl_send_UserInput_to_userIn({input1 := "bye", input2 := ""});
- harnessTimer.start(0.00 + SLACK);
- specexpl_receive_SIPReq_from_netOut({op := "BYE", param_ := "sip:127.0.0.1:5061"});
- harnessTimer.stop;
- //Terminating_OK
- log("Terminating_OK");
- specexpl_send_SIPResp_to_netIn({status := 200, cseq := ""});
- log("THE END");
- setverdict(pass);
- deactivate(default_behaviour_ref);
- f_MBT_SpecExpl_Demo_endTestCase();
- }
-
- testcase Testcase_3() runs on SpecExpl_CT
- {
- var float oldtimer := 0.0;
- var float SLACK := 10.0;
- var default default_behaviour_ref;
- f_MBT_SpecExpl_Demo_beginTestCase();
- default_behaviour_ref := activate(SpecExplDefaultAlt());
- log("START TESTCASE: Testcase_3");
- //Init_Calling
- log("Init_Calling");
- specexpl_send_UserInput_to_userIn({input1 := "invite", input2 := "sip:127.0.0.1:5061"});
- harnessTimer.start(0.00 + SLACK);
- specexpl_receive_SIPReq_from_netOut({op := "INVITE", param_ := "sip:127.0.0.1:5061"});
- harnessTimer.stop;
- //Calling_Ringing
- log("Calling_Ringing");
- specexpl_send_SIPResp_to_netIn({status := 180, cseq := ""});
- //Ringing_Reject
- log("Ringing_Reject");
- specexpl_send_SIPResp_to_netIn({status := 486, cseq := "INVITE"});
- harnessTimer.start(0.00 + SLACK);
- specexpl_receive_SIPReq_from_netOut({op := "ACK", param_ := "sip:127.0.0.1:5061"});
- harnessTimer.stop;
- log("THE END");
- setverdict(pass);
- deactivate(default_behaviour_ref);
- f_MBT_SpecExpl_Demo_endTestCase();
- }
-
- testcase Testcase_4() runs on SpecExpl_CT
- {
- var float oldtimer := 0.0;
- var float SLACK := 10.0;
- var default default_behaviour_ref;
- f_MBT_SpecExpl_Demo_beginTestCase();
- default_behaviour_ref := activate(SpecExplDefaultAlt());
- log("START TESTCASE: Testcase_4");
- //Init_Calling
- log("Init_Calling");
- specexpl_send_UserInput_to_userIn({input1 := "invite", input2 := "sip:127.0.0.1:5061"});
- harnessTimer.start(0.00 + SLACK);
- specexpl_receive_SIPReq_from_netOut({op := "INVITE", param_ := "sip:127.0.0.1:5061"});
- harnessTimer.stop;
- //Calling_Ringing
- log("Calling_Ringing");
- specexpl_send_SIPResp_to_netIn({status := 180, cseq := ""});
- //Ringing_Canceling
- log("Ringing_Canceling");
- specexpl_send_UserInput_to_userIn({input1 := "cancel", input2 := ""});
- harnessTimer.start(0.00 + SLACK);
- specexpl_receive_SIPReq_from_netOut({op := "CANCEL", param_ := "sip:127.0.0.1:5061"});
- harnessTimer.stop;
- //Canceling_WaitingResponse
- log("Canceling_WaitingResponse");
- specexpl_send_SIPResp_to_netIn({status := 200, cseq := "CANCEL"});
- //WaitingResponse_Terminate
- log("WaitingResponse_Terminate");
- specexpl_send_SIPResp_to_netIn({status := 487, cseq := "INVITE"});
- harnessTimer.start(0.00 + SLACK);
- specexpl_receive_SIPReq_from_netOut({op := "ACK", param_ := "sip:127.0.0.1:5061"});
- harnessTimer.stop;
- log("THE END");
- setverdict(pass);
- deactivate(default_behaviour_ref);
- f_MBT_SpecExpl_Demo_endTestCase();
- }
-
- testcase Testcase_5() runs on SpecExpl_CT
- {
- var float oldtimer := 0.0;
- var float SLACK := 10.0;
- var default default_behaviour_ref;
- f_MBT_SpecExpl_Demo_beginTestCase();
- default_behaviour_ref := activate(SpecExplDefaultAlt());
- log("START TESTCASE: Testcase_5");
- //Init_Calling
- log("Init_Calling");
- specexpl_send_UserInput_to_userIn({input1 := "invite", input2 := "sip:127.0.0.1:5061"});
- harnessTimer.start(0.00 + SLACK);
- specexpl_receive_SIPReq_from_netOut({op := "INVITE", param_ := "sip:127.0.0.1:5061"});
- harnessTimer.stop;
- //Calling_Ringing
- log("Calling_Ringing");
- specexpl_send_SIPResp_to_netIn({status := 180, cseq := ""});
- //Canceling_Timeout
- log("Canceling_Timeout");
- specexpl_send_UserInput_to_userIn({input1 := "cancel", input2 := ""});
- harnessTimer.start(0.00 + SLACK);
- specexpl_receive_SIPReq_from_netOut({op := "CANCEL", param_ := "sip:127.0.0.1:5061"});
- harnessTimer.stop;
- harnessTimer.start(0.50 + SLACK);
- specexpl_receive_SIPReq_from_netOut({op := "CANCEL", param_ := "sip:127.0.0.1:5061"});
- harnessTimer.stop;
- harnessTimer.start(1.00 + SLACK);
- specexpl_receive_SIPReq_from_netOut({op := "CANCEL", param_ := "sip:127.0.0.1:5061"});
- harnessTimer.stop;
- harnessTimer.start(2.00 + SLACK);
- specexpl_receive_SIPReq_from_netOut({op := "CANCEL", param_ := "sip:127.0.0.1:5061"});
- harnessTimer.stop;
- harnessTimer.start(4.00 + SLACK);
- specexpl_receive_SIPReq_from_netOut({op := "CANCEL", param_ := "sip:127.0.0.1:5061"});
- harnessTimer.stop;
- log("THE END");
- setverdict(pass);
- deactivate(default_behaviour_ref);
- f_MBT_SpecExpl_Demo_endTestCase();
- }
-
- testcase Testcase_6() runs on SpecExpl_CT
- {
- var float oldtimer := 0.0;
- var float SLACK := 10.0;
- var default default_behaviour_ref;
- f_MBT_SpecExpl_Demo_beginTestCase();
- default_behaviour_ref := activate(SpecExplDefaultAlt());
- log("START TESTCASE: Testcase_6");
- //Calling_Timeout
- log("Calling_Timeout");
- specexpl_send_UserInput_to_userIn({input1 := "invite", input2 := "sip:127.0.0.1:5061"});
- harnessTimer.start(0.00 + SLACK);
- specexpl_receive_SIPReq_from_netOut({op := "INVITE", param_ := "sip:127.0.0.1:5061"});
- harnessTimer.stop;
- harnessTimer.start(0.50 + SLACK);
- specexpl_receive_SIPReq_from_netOut({op := "INVITE", param_ := "sip:127.0.0.1:5061"});
- harnessTimer.stop;
- harnessTimer.start(1.00 + SLACK);
- specexpl_receive_SIPReq_from_netOut({op := "INVITE", param_ := "sip:127.0.0.1:5061"});
- harnessTimer.stop;
- harnessTimer.start(2.00 + SLACK);
- specexpl_receive_SIPReq_from_netOut({op := "INVITE", param_ := "sip:127.0.0.1:5061"});
- harnessTimer.stop;
- harnessTimer.start(4.00 + SLACK);
- specexpl_receive_SIPReq_from_netOut({op := "INVITE", param_ := "sip:127.0.0.1:5061"});
- harnessTimer.stop;
- log("THE END");
- setverdict(pass);
- deactivate(default_behaviour_ref);
- f_MBT_SpecExpl_Demo_endTestCase();
- }
-
- testcase Testcase_7() runs on SpecExpl_CT
- {
- var float oldtimer := 0.0;
- var float SLACK := 10.0;
- var default default_behaviour_ref;
- f_MBT_SpecExpl_Demo_beginTestCase();
- default_behaviour_ref := activate(SpecExplDefaultAlt());
- log("START TESTCASE: Testcase_7");
- //Init_Calling
- log("Init_Calling");
- specexpl_send_UserInput_to_userIn({input1 := "invite", input2 := "sip:127.0.0.1:5061"});
- harnessTimer.start(0.00 + SLACK);
- specexpl_receive_SIPReq_from_netOut({op := "INVITE", param_ := "sip:127.0.0.1:5061"});
- harnessTimer.stop;
- //Calling_Ringing
- log("Calling_Ringing");
- specexpl_send_SIPResp_to_netIn({status := 180, cseq := ""});
- //Ringing_Ready
- log("Ringing_Ready");
- specexpl_send_SIPResp_to_netIn({status := 200, cseq := "INVITE"});
- harnessTimer.start(0.00 + SLACK);
- specexpl_receive_SIPReq_from_netOut({op := "ACK", param_ := "sip:127.0.0.1:5061"});
- harnessTimer.stop;
- //Terminating_Timeout
- log("Terminating_Timeout");
- specexpl_send_UserInput_to_userIn({input1 := "bye", input2 := ""});
- harnessTimer.start(0.00 + SLACK);
- specexpl_receive_SIPReq_from_netOut({op := "BYE", param_ := "sip:127.0.0.1:5061"});
- harnessTimer.stop;
- harnessTimer.start(0.50 + SLACK);
- specexpl_receive_SIPReq_from_netOut({op := "BYE", param_ := "sip:127.0.0.1:5061"});
- harnessTimer.stop;
- harnessTimer.start(1.00 + SLACK);
- specexpl_receive_SIPReq_from_netOut({op := "BYE", param_ := "sip:127.0.0.1:5061"});
- harnessTimer.stop;
- harnessTimer.start(2.00 + SLACK);
- specexpl_receive_SIPReq_from_netOut({op := "BYE", param_ := "sip:127.0.0.1:5061"});
- harnessTimer.stop;
- harnessTimer.start(4.00 + SLACK);
- specexpl_receive_SIPReq_from_netOut({op := "BYE", param_ := "sip:127.0.0.1:5061"});
- harnessTimer.stop;
- log("THE END");
- setverdict(pass);
- deactivate(default_behaviour_ref);
- f_MBT_SpecExpl_Demo_endTestCase();
- }
-}
diff --git a/demo/TTCNScripter/TTCNScripter_v211.jar b/demo/TTCNScripter/TTCNScripter_v211.jar
deleted file mode 100644
index 497b2d7..0000000
--- a/demo/TTCNScripter/TTCNScripter_v211.jar
+++ /dev/null
Binary files differ
diff --git a/demo/TTCNScripter/TTCNScripter_v421.jar b/demo/TTCNScripter/TTCNScripter_v421.jar
deleted file mode 100644
index 4b87429..0000000
--- a/demo/TTCNScripter/TTCNScripter_v421.jar
+++ /dev/null
Binary files differ
diff --git a/src/Qtronic/TTCNScripter_v211/PrettyPrinter.java b/src/Qtronic/TTCNScripter_v211/PrettyPrinter.java
deleted file mode 100644
index 49cefeb..0000000
--- a/src/Qtronic/TTCNScripter_v211/PrettyPrinter.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/** Copyright (C) Conformiq Software Oy, Ltd.
- * All rights reserved.
- *
- * Created Wed Aug 27 17:13:05 2008.
- *
- * @file
- *
- * @author Tommi Vainikainen
- *
- *
- */
-package com.conformiq.adaptation.ttcn;
-
-import java.io.PrintWriter;
-import java.io.Writer;
-import java.util.List;
-import java.util.Vector;
-
-class PrettyPrinter extends PrintWriter {
- private List<String> stack;
- private String header;
- private boolean headerPrinted;
-
- public PrettyPrinter(Writer out) {
- super(out);
- this.stack = new Vector<String>();
- this.header = "";
- this.headerPrinted = true;
- }
-
- private void printHeader() {
- if (headerPrinted)
- return;
-
- for (int i = 0; i < this.stack.size(); i++) {
- super.print(this.stack.get(i));
- }
- this.headerPrinted = true;
- }
-
- public void print(String s) {
- printHeader();
- this.header = this.header.concat(s);
- super.print(s);
- }
-
- // Start a new block
- public void block() {
- this.stack.add(header);
- this.header = "";
- }
-
- // Resume to previous state
- public void resume() {
- // remove last
- this.stack.remove(this.stack.size() - 1);
- }
-
- // Print EOL char
- public void endl() {
- if (this.headerPrinted) { // suppress double empty lines
- println();
- this.header = "";
- this.headerPrinted = false;
- }
- }
-
- public void emptyline() {
- println();
- this.header = "";
- this.headerPrinted = false;
- }
-
- public void ws() {
- print(" ");
- }
-}
diff --git a/src/Qtronic/TTCNScripter_v211/TTCNScripter.java b/src/Qtronic/TTCNScripter_v211/TTCNScripter.java
deleted file mode 100644
index 29167b8..0000000
--- a/src/Qtronic/TTCNScripter_v211/TTCNScripter.java
+++ /dev/null
@@ -1,1910 +0,0 @@
-/** Copyright (C) Conformiq Software Oy, Ltd.
- * All rights reserved.
- *
- * Created Wed Aug 27 16:49:21 2008.
- *
- * @file
- *
- * @author Tommi Vainikainen
- *
- *
- */
-package com.conformiq.adaptation.ttcn;
-
-import java.io.BufferedWriter;
-import java.io.FileNotFoundException;
-import java.io.FileReader;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.Vector;
-
-import com.conformiq.qtronic2.Checkpoint;
-import com.conformiq.qtronic2.MetaDataDictionary;
-import com.conformiq.qtronic2.NotificationSink;
-import com.conformiq.qtronic2.QMLArray;
-import com.conformiq.qtronic2.QMLBoolean;
-import com.conformiq.qtronic2.QMLNumber;
-import com.conformiq.qtronic2.QMLOptional;
-import com.conformiq.qtronic2.QMLRecord;
-import com.conformiq.qtronic2.QMLRecordType;
-import com.conformiq.qtronic2.QMLRecordTypeField;
-import com.conformiq.qtronic2.QMLString;
-import com.conformiq.qtronic2.QMLValue;
-import com.conformiq.qtronic2.QMLValueVisitor;
-import com.conformiq.qtronic2.ScriptBackend;
-import com.conformiq.qtronic2.TimeStamp;
-import com.conformiq.qtronic2.Checkpoint.CheckpointStatus;
-import com.conformiq.qtronic2.Checkpoint.CheckpointType;
-
-public class TTCNScripter extends ScriptBackend
-{
- class TemplateDefinition
- {
- public TemplateDefinition(final String type, final String templatename,
- QMLRecord record)
- {
- this.typeName = type;
- this.templateName = templatename;
- this.record = record;
- }
-
- private String typeName;
- private String templateName;
-
- public String getTypeName()
- {
- return typeName;
- }
-
- public String getTemplateName()
- {
- return templateName;
- }
-
- private QMLRecord record;
-
- public QMLRecord getRecord()
- {
- return record;
- }
- }
-
- /** Convert adapter datums into TTCN3 code. */
- class TTCN3PortVisitor implements QMLValueVisitor
- {
- public TTCN3PortVisitor(PrettyPrinter pp, boolean isInbound)
- {
- this.out = pp;
- this.isInbound = isInbound;
-
- assert (out != null);
-
- typeNameMap = new HashMap<String, String>();
-
- /* Booleans */
- typeNameMap.put("boolean", "boolean");
- /* Integers. */
- typeNameMap.put("int", "integer");
- typeNameMap.put("byte", "integer");
- typeNameMap.put("char", "integer");
- typeNameMap.put("short", "integer");
- typeNameMap.put("long", "integer");
- /* Floating point. */
- typeNameMap.put("float", "float");
- typeNameMap.put("double", "float");
- /* Strinags. */
- typeNameMap.put("String", "charstring");
- }
-
- protected PrettyPrinter out;
- protected final boolean isInbound;
- protected Map<String, String> typeNameMap;
-
- @Override
- public void visit(QMLArray x)
- {
- /*
- * Port types are tuples with just Strings inside referring to
- * types.
- */
- assert (x != null);
- final int size = x.getNumberOfElements();
-
- for (int i = 0; i < size; i++)
- {
- QMLString portname = (QMLString) x.getValue(i);
- if (portname != null)
- {
- final String origname = portname.getValue();
- final String name = TTCNScripter
- .makeValidTTCN3Identifier(origname);
-
- /* Skip AnyRecord.. */
- if (name.equals("AnyRecord"))
- {
- continue;
- }
- /*
- * It seems that record fields are separated using commas
- * but ports are separated using semicolons in TTCN3..?
- */
- if (eptfBidirectionalPort)
- out.print("inout");
- else
- out.print(isInbound ? "in" : "out");
- out.print(" ");
- out.print(name);
- out.print(";");
- out.endl();
- }
- }
- }
-
- @Override
- public void visit(QMLBoolean b)
- {
- }
-
- @Override
- public void visit(QMLNumber n)
- {
- }
-
- @Override
- public void visit(QMLRecord r)
- {
- }
-
- @Override
- public void visit(QMLString s)
- {
- }
-
- @Override
- public void visit(QMLOptional p)
- {
- }
- }
-
- // My port visitor
- class MyTTCN3PortVisitor implements QMLValueVisitor
- {
- public MyTTCN3PortVisitor(PrettyPrinter pp, boolean isInbound,
- String port, String indent)
- {
- this.out = pp;
- this.isInbound = isInbound;
- this.port = port;
- this.indent = indent;
-
- assert (out != null);
-
- typeNameMap = new HashMap<String, String>();
-
- /* Booleans */
- typeNameMap.put("boolean", "boolean");
- /* Integers. */
- typeNameMap.put("int", "integer");
- typeNameMap.put("byte", "integer");
- typeNameMap.put("char", "integer");
- typeNameMap.put("short", "integer");
- typeNameMap.put("long", "integer");
- /* Floating point. */
- typeNameMap.put("float", "float");
- typeNameMap.put("double", "float");
- /* Strinags. */
- typeNameMap.put("String", "charstring");
- }
-
- protected PrettyPrinter out;
- protected final boolean isInbound;
- protected Map<String, String> typeNameMap;
- private String port;
- private String indent;
-
- @Override
- public void visit(QMLArray x)
- {
- /*
- * Port types are tuples with just Strings inside referring to
- * types.
- */
- assert (x != null);
- final int size = x.getNumberOfElements();
-
- for (int i = 0; i < size; i++)
- {
- QMLString portname = (QMLString) x.getValue(i);
-
- if (portname != null)
- {
- final String origname = portname.getValue();
- final String name = TTCNScripter
- .makeValidTTCN3Identifier(origname);
-
- /* Skip AnyRecord.. */
- if (name.equals("AnyRecord"))
- {
- continue;
- }
- // Harness generation
- out.print(indent + "function qtronic");
- out.print(isInbound ? "_receive_" : "_send_");
- out.print(name);
- out.print(isInbound ? "_from_" : "_to_");
- out.print(this.port);
- out.print("(template " + name + " ");
- out.print((isInbound ? "tmplToMatch" : "msgToSend")
- + ") runs on " + runsOnName);
- out.endl();
- out.print(indent + "{");
- out.endl();
- out.print(indent + indent
- + "// Do whatever manipulation is needed to '");
- out.print((isInbound ? "tmplToMatch" : "msgToSend"));
- out.print("'");
- out.endl();
- if (isInbound)
- {
- out
- .print(indent
- + indent
- + "// before matching it against the expected value template.");
- out.endl();
- out
- .print(indent
- + indent
- + "// This manipulation typically means removing fields not present");
- out.endl();
- out.print(indent + indent
- + "// in the abstract model system interface.");
- out.endl();
-
- if (eptfEnable)
- {
- if (this.port.equals(eptfInboundPort)
- || this.port.equals(eptfOutboundPort))
- {
- out
- .print(indent
- + indent
- + "EPTF_MBT_TESTER_PCO.receive(tmplToMatch) from vc_lgen;");
- out.endl();
- }
- else
- {
- out.print(indent + indent + this.port
- + ".receive(tmplToMatch);");
- out.endl();
- }
-
- }
- }
- else
- {
- out
- .print(indent
- + indent
- + "// before it is delivered to the SUT through the real test interface.");
- out.endl();
- out
- .print(indent
- + indent
- + "// This can include addition of fields not present in the model or");
- out.endl();
- out
- .print(indent
- + indent
- + "// manipulation of unique identifiers in the messages that Qtronic");
- out.endl();
- out
- .print(indent
- + indent
- + "// cannot possible know at the time of test generation.");
- out.endl();
-
- if (eptfEnable)
- {
- if (this.port.equals(eptfInboundPort)
- || this.port.equals(eptfOutboundPort))
- {
- out
- .print(indent
- + indent
- + "EPTF_MBT_TESTER_PCO.send(msgToSend) to vc_lgen;");
- out.endl();
- }
- else
- {
- out.print(indent + indent + this.port
- + ".send(msgToSend);");
- out.endl();
- }
- }
- }
- out.print(indent + "}");
- out.endl();
- }
- }
- }
-
- @Override
- public void visit(QMLBoolean b)
- {
- }
-
- @Override
- public void visit(QMLNumber n)
- {
- }
-
- @Override
- public void visit(QMLRecord r)
- {
- }
-
- @Override
- public void visit(QMLString s)
- {
- }
-
- @Override
- public void visit(QMLOptional p)
- {
- }
- }
-
- private PrettyPrinter out;
- private NotificationSink notifications;
- private MetaDataDictionary metadata;
- private int testCaseIndex;
- private int templateIndex;
- private boolean isCompact;
- private TimeStamp timeStamp;
- private String logCommand;
- private boolean generateTypes;
- private boolean generateTestComponent;
- private String filename;
- private String timerName;
- private String defaultName;
- private String startHook;
- private String commSlack;
- private String extraImports;
- private String runsOnName;
- private String systemTypeName;
- private String endHook;
- private String portExtensions;
- private String moduleName;
- private String dataTypesFile;
- private String testHarnessFile;
- private boolean generateTestHarness;
- private boolean firstStep;
- private Map<QMLRecord, Integer> generatedTemplates;
- private Vector<TemplateDefinition> postponedTemplates;
- private Vector<String> testCaseNames;
- private String extendsComponent;
- private boolean eptfEnable;
- private String eptfInboundPort;
- private String eptfOutboundPort;
- private boolean eptfBidirectionalPort;
-
- static private String SCRIPTER_NAME = "TTCN-3 scripter 0.1";
-
- public TTCNScripter()
- {
- this.testCaseIndex = 0;
- this.templateIndex = 0;
- this.isCompact = false;
- this.timeStamp = new TimeStamp();
- this.timeStamp.seconds = 0;
- this.timeStamp.nanoseconds = 0;
- this.logCommand = "log";
- this.generateTypes = true;
- this.generateTestComponent = true;
-
- this.filename = "";
- this.timerName = "";
- this.defaultName = "";
- this.startHook = "";
- this.commSlack = "";
- this.extraImports = "";
- this.runsOnName = "";
- this.systemTypeName = "";
- this.endHook = "";
- this.portExtensions = "";
- this.moduleName = "";
- this.dataTypesFile = "";
- this.testHarnessFile = "";
- this.generateTestHarness = true;
- this.firstStep = false;
- this.generatedTemplates = new HashMap<QMLRecord, Integer>();
- this.postponedTemplates = new Vector<TemplateDefinition>();
- this.testCaseNames = new Vector<String>();
-
- this.extendsComponent = "";
- this.eptfEnable = false;
- this.eptfInboundPort = "";
- this.eptfOutboundPort = "";
- this.eptfBidirectionalPort = false;
- }
-
- @Override
- public void setNotificationSink(NotificationSink sink)
- {
- notifications = sink;
- }
-
- @Override
- public boolean setMetaData(MetaDataDictionary dict)
- {
- metadata = dict;
- return true;
- }
-
- @Override
- public boolean setConfigurationOption(java.lang.String property,
- java.lang.String value)
- {
- if (property.equals("Main.Generated TTCN-3 file"))
- {
- filename = value;
- moduleName = getModuleName(filename);
- }
- else if (property.equals("Main.Generated types and test component"))
- {
- dataTypesFile = value;
- }
- else if (property.equals("Main.Generated harness template file"))
- {
- testHarnessFile = value;
- }
- else if (property.equals("Main.Generate types"))
- {
- generateTypes = value.equals("true");
- }
- else if (property.equals("Main.Generate ports and test component"))
- {
- generateTestComponent = value.equals("true");
- }
- else if (property.equals("Main.Test component extension"))
- {
- extendsComponent = value;
- }
- else if (property.equals("Main.Generate test harness template"))
- {
- generateTestHarness = value.equals("true");
- }
- else if (property.equals("Logging.Name of the 'log' command"))
- {
- logCommand = value;
- }
- else if (property.equals("Customization.Global timer name"))
- {
- timerName = value;
- }
- else if (property.equals("Customization.Activated default"))
- {
- defaultName = value;
- }
- else if (property.equals("Customization.Start test case hook call"))
- {
- startHook = value;
- }
- else if (property.equals("Timing.Communications slack limit"))
- {
- commSlack = value;
- }
- else if (property.equals("Customization.Extra import statements"))
- {
- extraImports = value;
- }
- else if (property.equals("Customization.Runs on type name"))
- {
- runsOnName = value;
- }
- else if (property.equals("Customization.System type name"))
- {
- systemTypeName = value;
- }
- else if (property.equals("Customization.End test case hook call"))
- {
- endHook = value;
- }
- else if (property.equals("Extensions.Use port type extension"))
- {
- portExtensions = value;
- }
- else if (property.equals("Logging.Log checkpoints"))
- {
- isCompact = !value.equals("true");
- }
- else if (property.equals("EPTF_MBT_Applib.Enable"))
- {
- eptfEnable = value.equals("true");
- }
- else if (property.equals("EPTF_MBT_Applib.Inbound Port"))
- {
- eptfInboundPort = value;
- }
- else if (property.equals("EPTF_MBT_Applib.Outbound Port"))
- {
- eptfOutboundPort = value;
- }
- else if (property.equals("EPTF_MBT_Applib.Bidirectional Ports"))
- {
- eptfBidirectionalPort = value.equals("true");
- }
- return true;
- }
-
- private String getModuleName(String path)
- {
- int slash = path.lastIndexOf("/");
- int backslash = path.lastIndexOf("\\");
- String module;
- if (slash != -1 && backslash != -1)
- {
- module = path
- .substring((slash > backslash ? slash : backslash) + 1);
- }
- else if (slash != -1)
- {
- module = path.substring(slash + 1);
- }
- else if (backslash != -1)
- {
- module = path.substring(backslash + 1);
- }
- else
- {
- module = path;
- }
- int size = module.length();
- String upper = module.toUpperCase();
-
- if (upper.lastIndexOf(".TTCN3") == (size - 6))
- {
- return module.substring(0, size - 6);
- }
- if (upper.lastIndexOf(".TTCN") == (size - 5))
- {
- return module.substring(0, size - 5);
- }
- if (upper.lastIndexOf(".3MP") == (size - 4))
- {
- return module.substring(0, size - 4);
- }
- return "QtronicTest";
- }
-
- @Override
- public boolean beginScript(String testsuiteName)
- {
- if (notifications != null)
- {
- notifications.notify("info", SCRIPTER_NAME
- + ": Export test cases for test " + "design configuration "
- + testsuiteName);
- }
- String msg = null;
- if (filename.equals(""))
- {
- msg = "TTCN-3 backend must be configured with a file name.";
- }
- else
- {
- try
- {
- out = new PrettyPrinter(new BufferedWriter(new FileWriter(
- filename)));
- } catch (IOException e)
- {
- StringBuffer msgbuf = new StringBuffer();
- msgbuf.append("Failed to open file '");
- msgbuf.append(filename);
- msgbuf.append("' for writing TTCN-3 script.");
- msg = msgbuf.toString();
- }
- }
- if (msg != null)
- {
- if (notifications != null)
- {
- notifications.notify("error", SCRIPTER_NAME + ": " + msg);
- }
- else
- {
- System.err.println(msg);
- }
- return false;
- }
-
- dumpHeader(filename);
- out.print("module ");
- out.print(moduleName);
- out.endl();
- out.print("{");
- out.endl();
- out.print(" ");
- out.block();
-
- out.print("import from ");
- out.print(getModuleName(dataTypesFile));
- out.print(" all;");
- out.endl();
-
- // import generated test harness
- if (eptfEnable && generateTestHarness && !testHarnessFile.equals(""))
- {
- out.print("import from ");
- out.print(getModuleName(testHarnessFile));
- out.print(" all;");
- out.endl();
- }
-
- out.print("/* User provided imports begin */");
- out.endl();
- out.print(extraImports);
- out.endl();
- out.print("/* User provided imports end */");
- out.endl();
-
- // print out the test harness template
- try
- {
- // should the harness template be written
- if (generateTestHarness)
- {
-
- // check if file already exists. If it does ask user
- // to remove it first
- try
- {
- new FileReader(testHarnessFile);
- if (notifications != null)
- {
- notifications.notify("info", SCRIPTER_NAME + ": File "
- + testHarnessFile + " exists, NOT overwriting it.");
- }
- return true;
- } catch (FileNotFoundException not_found)
- {
- // create the template file
- dumpTestHarness();
- if (notifications != null)
- {
- notifications.notify("info", SCRIPTER_NAME
- + ": Generated TTCN-3 test harness template to "
- + "<hyperlink=\"" + testHarnessFile + "\">"
- + testHarnessFile + "</hyperlink>.");
- }
- }
- }
- } catch (Exception e)
- {
- out.print("/* EXCEPTION CAUGHT */");
- out.endl();
- if (notifications != null)
- {
- notifications
- .notify(
- "error",
- SCRIPTER_NAME
- + ": Caught exception while "
- + "rendering TTCN test harness template. Please reload model "
- + "and try again (" + e.getMessage() + ")");
- }
- return false;
- }
-
- if (generateTypes)
- {
- // out.print("/* Qtronic generated data types begin */");
- // out.endl();
- /* First dump all the types used in the module. */
- try
- {
- dumpTypes();
- dumpTemplates();
- // out.print("/* Qtronic generated data types end */");
- // out.endl();
- } catch (Exception e)
- {
- out.print("/* EXCEPTION CAUGHT */");
- out.endl();
- if (notifications != null)
- {
- notifications
- .notify(
- "error",
- SCRIPTER_NAME
- + ": Caught exception while "
- + "rendering TTCN type definitions. Please reload model "
- + "and try again (" + e.getMessage()
- + ")");
- }
- return false;
- }
- }
-
- out.print("/* Qtronic generated alt step */");
- out.endl();
- /*
- * The GENERATED default is always called QtronicDefaultAlt(), but the
- * user can use alternative default by changing configuration option. In
- * this case the user provides the default.
- */
- out.print("altstep QtronicDefaultAlt() runs on ");
- out.print(runsOnName);
- out.endl();
- out.print("{");
- out.endl();
- out.print(" ");
-
- printAltStepBody();
-
- deleteCopies();
- templateIndex = 0;
- testCaseIndex = 0;
-
- firstStep = false;
-
- return true;
- }
-
- private void printAltStepBody()
- {
- printAltStepBody("");
- }
-
- private void printAltStepBody(String indent)
- {
- out.print(indent);
- out.block();
- out.print("[] any port.receive");
- out.endl();
- out.print("{");
- out.endl();
- out.print(" ");
- out.block();
- out.print(timerName);
- out.print(".stop;");
- out.endl();
- out.print("setverdict(fail);");
- out.endl();
-
- if (!endHook.equals(""))
- {
- out.print(endHook);
- out.print(";");
- out.endl();
- }
-
- out.print("stop;");
- out.endl();
- out.resume();
- out.print("}");
- out.endl();
- out.print("[] ");
- out.print(timerName);
- out.print(".timeout");
- out.endl();
- out.print("{");
- out.endl();
- out.print(" ");
- out.block();
- out.print("setverdict(fail);");
- out.endl();
-
- if (!endHook.equals(""))
- {
- out.print(endHook);
- out.print(";");
- out.endl();
- }
-
- out.print("stop;");
- out.endl();
- out.resume();
- out.print("}");
- out.endl();
- out.resume();
- out.print("}");
- out.endl();
- }
-
- private void dumpType(final QMLRecordType type, Set<String> arrays)
- {
- out.print("type record ");
- out.print(makeValidTTCN3Identifier(type.getTypeName()));
- out.endl();
- out.print("{");
- out.endl();
- out.print(" ");
- out.block();
- for (int i = 0; i < type.getNumberOfFields(); i++)
- {
- final QMLRecordTypeField field = type.getField(i);
- TTCNTypeName v = new TTCNTypeName(arrays);
- field.getType().accept(v);
- assert (!v.getName().equals(""));
- if (i != 0)
- {
- out.print(",");
- out.endl();
- }
- out.print(v.getName());
- out.print(" ");
- out.print(makeValidTTCN3Identifier(field.getFieldName()));
- if (v.getOptional())
- {
- out.print(" optional");
- }
- }
- out.endl();
- out.resume();
- out.print("}");
- out.endl();
- for (int i = 0; i < type.getNumberOfInnerRecords(); i++)
- {
- dumpType(type.getInnerType(i), arrays);
- }
- }
-
- private void dumpTypes() throws Exception
- {
- assert (metadata != null);
-
- Set<String> arrays = new HashSet<String>();
-
- List<String> ports = new Vector<String>();
-
- PrettyPrinter oldOut = out;
- String msg = null;
- Exception rethrowMe = null;
-
- if (dataTypesFile.equals(""))
- {
- msg = "TTCN-3 backend must be configured with a data type file "
- + "name.";
- }
- else
- {
- try
- {
- out = new PrettyPrinter(new BufferedWriter(new FileWriter(
- dataTypesFile)));
- } catch (IOException e)
- {
- StringBuffer msgbuf = new StringBuffer();
- msgbuf.append("Failed to open file '");
- msgbuf.append(dataTypesFile);
- msgbuf.append("' for writing data types.");
- msg = msgbuf.toString();
- rethrowMe = e;
- }
- }
- if (msg != null)
- {
- if (notifications != null)
- {
- notifications.notify("error", msg);
- }
- else
- {
- System.err.println(msg);
- }
- out = oldOut;
- // Pass the exception forward for proper error handling further
- // up the call stack.
- throw (rethrowMe);
- }
-
- dumpHeader(dataTypesFile);
- out.print("module ");
- out.print(getModuleName(dataTypesFile));
- out.endl();
- out.print("{");
- out.endl();
- out.print(" ");
- out.block();
-
- out.print("/* User provided imports begin */");
- out.endl();
- out.print(extraImports);
- out.endl();
- out.print("/* User provided imports end */");
- out.endl();
-
- try
- {
- if (generateTestComponent)
- {
- final String portinfo = "portinfo:";
- String key = metadata.getNextKey(portinfo);
- while (key != null)
- {
- String data = key;
- if (data.indexOf(portinfo) != 0)
- {
- break;
- }
-
- final QMLValue definition = metadata.get(key);
- assert (definition != null);
-
- QMLArray tuple = (QMLArray) definition;
- if (tuple != null)
- {
- String origname;
- boolean inbound = false;
- int pos = data.indexOf(":inbound:");
- inbound = (pos != -1);
- origname = data.substring(portinfo.length()
- + (inbound ? "inbound:".length() : "outbound:"
- .length()));
-
- if (eptfEnable
- && (origname.equals(eptfInboundPort) || origname
- .equals(eptfOutboundPort)))
- { // Port definitions is not generated for the MBT port
- System.err.print("//Skipping port"
- + makeValidTTCN3Identifier(origname) + "\n");
- }
- else
- {
- String name = makeValidTTCN3Identifier(origname);
- out.print("type port ");
- out.print(name);
- out.print("Port message");
- ports.add(name);
- out.endl();
- out.print("{");
- out.endl();
- out.print(" ");
- out.block();
-
- TTCN3PortVisitor converter = new TTCN3PortVisitor(
- out, !inbound);
- tuple.accept(converter);
-
- // if (converter.hasArrays()) {
- // Iterator<String> it =
- // converter.getArrays().keySet()
- // .iterator();
- // while (it.hasNext()) {
- // arrays.add(it.next());
- // }
- // }
-
- out.resume();
- out.print("}");
- if (!portExtensions.equals(""))
- {
- out.print(" with {extension \"");
- out.print(portExtensions);
- out.print("\"}");
- }
- out.endl();
- }
- }
- key = metadata.getNextKey(key);
- }
- }
-
- if (generateTypes)
- {
- Vector<QMLRecordType> types = metadata.getTypes();
- Iterator<QMLRecordType> rit = types.iterator();
- while (rit.hasNext())
- {
- QMLRecordType type = rit.next();
-
- if (eptfEnable && type.getTypeName().length() >= 5
- && type.getTypeName().substring(0, 5).equals("EPTF_"))
- { // Do not generate type definitions for EPTF modules
- }
- else
- {
- dumpType(type, arrays);
- }
- }
-
- Iterator<String> it = arrays.iterator();
- while (it.hasNext())
- {
- String x = it.next();
- // TODO: reconsider changing this because now both
- // TTCNTypeName class and this piece of code here has
- // to know how array names are constructed.
- out.print("type record of ");
- out.print(x);
- out.print(" ");
- out.print(x);
- out.print("Array;");
- out.endl();
- }
- }
-
- if (generateTestComponent)
- {
- out.endl();
- out.print("type component ");
- out.print(runsOnName);
- if (!extendsComponent.equals(""))
- {
- out.print(" extends ");
- out.print(extendsComponent);
- }
- out.endl();
- out.print("{");
- out.endl();
- out.print(" ");
- out.block();
- Iterator<String> it = ports.iterator();
- while (it.hasNext())
- {
- String x = it.next();
- out.print("port ");
- out.print(x);
- out.print("Port ");
- out.print(x);
- out.print(";");
- out.endl();
- }
- out.print("timer ");
- out.print(timerName);
- out.print(" := 0.0;");
- out.endl();
- out.resume();
- out.print("}");
- out.endl();
- }
-
- /*
- * altstep QtronicDefaultAlt() runs on SystemType { [] any
- * port.receive { mytimer.stop; setverdict(fail); stop; } []
- * mytimer.timeout { setverdict(fail); stop; } }
- */
- // Must close the module block.
- out.resume();
- out.print("}");
- out.endl();
- out.flush();
- out.close();
- out = oldOut;
- } catch (Exception e)
- {
- out.flush();
- out.close();
- out = oldOut;
- }
- }
-
- private void dumpTemplates()
- {
- Iterator<TemplateDefinition> it = postponedTemplates.iterator();
- while (it.hasNext())
- {
- final TemplateDefinition def = it.next();
- out.print("template ");
- out.print(makeValidTTCN3Identifier(def.getTypeName()));
- out.print(" ");
- out.print(def.getTemplateName());
- out.ws();
- out.print(":=");
- out.endl();
- QMLRecord r = def.getRecord();
-
- TemplateDumper t = new TemplateDumper(out);
- r.accept(t);
-
- out.endl();
- }
- }
-
- /**
- * prints out the test harness template, that contains:
- *
- * - import from QtronicTypes;
- *
- * - type component for the harness system
- *
- * - MTC component the tests should run on
- *
- * - harness alt step
- *
- * - start and end test hook calls
- *
- * - port and message mapping functions
- */
- private void dumpTestHarness() throws Exception
- {
- assert (metadata != null);
-
- PrettyPrinter oldOut = out;
- String msg = null;
- Exception rethrowMe = null;
- if (testHarnessFile.equals(""))
- {
- msg = "TTCN-3 backend must be configured with a test harness "
- + " file name.";
- }
- else
- {
- try
- {
- out = new PrettyPrinter(new BufferedWriter(new FileWriter(
- testHarnessFile)));
- } catch (IOException e)
- {
- StringBuffer msgbuf = new StringBuffer();
- msgbuf.append("Failed to open file '");
- msgbuf.append(testHarnessFile);
- msgbuf.append("' for writing test harness template.");
- msg = msgbuf.toString();
- rethrowMe = e;
- }
- }
- if (msg != null)
- {
- if (notifications != null)
- {
- notifications.notify("error", msg);
- }
- else
- {
- System.err.println(msg);
- }
- out = oldOut;
- // Pass the exception forward for proper error handling further
- // up the call stack.
- throw (rethrowMe);
- }
-
- String indent = " ";
-
- dumpHeader(testHarnessFile);
- out.print("module ");
- out.print(getModuleName(testHarnessFile));
- out.endl();
- out.print("{");
- out.endl();
- out.block();
-
- // import all data types
- out.print(indent);
- out.print("import from ");
- out.print(getModuleName(dataTypesFile));
- out.print(" all;");
- out.endl();
-
- out.print("/* User provided imports begin */");
- out.endl();
- out.print(extraImports);
- out.endl();
- out.print("/* User provided imports end */");
- out.endl();
-
- out.block();
-
- // system mapping
- if (!systemTypeName.equals("") && !eptfEnable)
- {
- out.print(indent + "type component ");
- out.print(systemTypeName);
- out.endl();
- out.print(indent + "{");
- out.endl();
- out.print(indent + indent
- + "// Add port definitions for your system here");
- out.endl();
- out.print(indent + "}");
- out.endl();
- out.block();
- }
-
- // MTC port definitions
- if (!runsOnName.equals(""))
- {
- // The component type should be already generated in the type
- // definitions module.
- if (!eptfEnable)
- {
- out.print(indent);
- out.print("type component ");
- out.print(runsOnName);
- out.endl();
- out.print(indent + "{");
- out.endl();
- out.print(indent + indent
- + "// Add port definitions for your MTC here");
- out.endl();
- out.print(indent + indent + "timer ");
- out.print(timerName);
- out.print(" := 0.0;");
- out.endl();
- out.print(indent + "}");
- out.endl();
- }
-
- // alt step
- String moduleName = getModuleName(dataTypesFile);
- if (!moduleName.equals(""))
- {
- out.print(indent);
- out.print("altstep ");
- out.print(defaultName);
- out.print(" runs on ");
- out.print(runsOnName);
- out.endl();
- out.block();
- out.print(indent + "{");
- out.endl();
- out.print(indent);
- out.block();
- printAltStepBody(indent);
- out.resume();
- out.resume();
- }
-
- // default start and stop functions
- if (!startHook.equals("") && !eptfEnable)
- {
- out.print(indent);
- out.print("function ");
- out.print(startHook);
- out.print(" runs on ");
- out.print(runsOnName);
- out.endl();
- out.print(indent + "{");
- out.endl();
- out.print(indent + indent
- + "// Do port mapping between MTC and abstract"
- + " test system interface");
- out.endl();
- out.print(indent + indent
- + "// map(mtc:<someport>, system:<someport>);");
- out.endl();
- out.print(indent + "}");
- out.endl();
- out.block();
- }
- if (!endHook.equals("") && !eptfEnable)
- {
- out.print(indent);
- out.print("function ");
- out.print(endHook);
- out.print(" runs on ");
- out.print(runsOnName);
- out.endl();
- out.print(indent + "{");
- out.endl();
- out.print(indent + indent + "// Do port unmapping e.g.");
- out.endl();
- out.print(indent + indent
- + "// map(mtc:<someport>, system:<someport>);");
- out.endl();
- out.print(indent + "}");
- out.endl();
- out.block();
- }
-
- // port mapping
- try
- {
- final String portinfo = "portinfo:";
- String key = metadata.getNextKey(portinfo);
- while (key != null)
- {
- String data = key;
- if (data.indexOf(portinfo) != 0)
- {
- break;
- }
-
- final QMLValue definition = metadata.get(key);
- assert (definition != null);
-
- boolean inbound = false;
- int pos = data.indexOf(":inbound:");
- inbound = (pos != -1);
- String origname = data
- .substring(portinfo.length()
- + (inbound ? "inbound:".length() : "outbound:"
- .length()));
-
- String port = makeValidTTCN3Identifier(origname);
-
- QMLArray tuple = (QMLArray) definition;
- if (tuple != null)
- {
- MyTTCN3PortVisitor converter = new MyTTCN3PortVisitor(
- out, !inbound, port, indent);
- tuple.accept(converter);
- }
- key = metadata.getNextKey(key);
- }
- } catch (Exception e)
- {
- out.print("/* EXCEPTION CAUGHT in dumpTestHarness */");
- out.flush();
- out.close();
- out = oldOut;
- throw e;
- }
- }
- // Must close the module block.
- out.resume();
- out.print("}");
- out.endl();
- out.flush();
- out.close();
- out = oldOut;
- }
-
- private void dumpHeader(String filename)
- {
- assert (out != null);
-
- out.print("/* -*- ttcn3 -*- */");
- out.endl();
- out.emptyline();
- out.print("/** ");
- out.print("@file ");
- out.print(filename);
- out.endl();
- out.print(" *");
- out.block();
- out.endl();
- out.print(" @author Conformiq TTCN3 Script Backend 0.1");
- out.endl();
- out.print(" @date ");
- out.print(new Date().toString());
- out.endl();
- out.print("");
- out.endl();
- out.print(" WARNING! This file has been automatically generated using");
- out.endl();
- out
- .print(" Ericsson Qtronic TTCN3 Script Backend (based on the original Conformiq Backend).");
- out.print("DO NOT EDIT.");
- out.endl();
- out.resume();
- out.print(" */");
- out.endl();
- out.emptyline();
- }
-
- private void deleteCopies()
- {
- generatedTemplates.clear();
- }
-
- @Override
- public boolean beginCase(String testcaseName)
- {
- firstStep = true;
- testCaseIndex++;
- out.print("/* Generated test case #");
- out.print(testCaseIndex);
- out.print(" */");
- out.endl();
- out.print("testcase ");
- out.print(recordAndRenderTestCaseName(testcaseName));
- out.print("() runs on ");
- out.print(runsOnName);
- if (systemTypeName != null && !systemTypeName.equals(""))
- {
- out.print(" system ");
- out.print(systemTypeName);
- }
- out.endl();
- out.print("{");
- out.endl();
- out.print(" ");
- out.block();
- out.print("var float oldtimer := 0.0;");
- out.endl();
- out.print("var float SLACK := ");
- out.print(commSlack);
- out.print(";");
- out.endl();
-
- if (!defaultName.equals(""))
- {
- out.print("var default default_behaviour_ref;");
- out.endl();
- }
-
- if (!startHook.equals(""))
- {
- out.print(startHook);
- out.print(";");
- out.endl();
- }
-
- if (!defaultName.equals(""))
- {
- out.print("default_behaviour_ref := activate(");
- out.print(defaultName);
- out.print(");");
- out.endl();
- }
-
- return true;
- }
-
- // @Override
- public void caseProbability(double probability)
- {
- }
-
- final private String escapeString(String s)
- {
- // Checkpoint strings from the model must be escaped by "backslashing"
- // double quotations and backslashes themselves.
- StringBuffer escaped = new StringBuffer();
- final int size = s.length();
- if (size == 0)
- return s;
- for (int i = 0; i < size; i++)
- {
- if (s.charAt(i) == '\\')
- {
- escaped.append("\\\\");
- }
- else if (s.charAt(i) == '"')
- {
- escaped.append("\\\"");
- }
- else
- {
- escaped.append(s.charAt(i));
- }
- }
- return escaped.toString();
- }
-
- @Override
- public boolean checkpointInfo(Checkpoint checkpoint, int status,
- TimeStamp ts)
- {
- if (isCompact || !firstStep || status == CheckpointStatus.UNCOVERED
- || status == CheckpointStatus.MAYBE_COVERED)
- {
- return true;
- }
-
- if (checkpoint.getType() == CheckpointType.USUAL_CHECKPOINT)
- {
- // TODO: we might want to have something configurable here or
- // maybe something based on which CPs are selected as targets;
- // now we just include methods, states and transtions into
- // reports CPs to avoid "CP-bloat".
- String cp = checkpoint.getName();
- String method = new String("method:");
- String transition = new String("transition:");
- String state = new String("state:");
- if ((cp.length() > method.length() && cp.substring(0,
- method.length()).equals(method))
- || (cp.length() > transition.length() && cp.substring(0,
- transition.length()).equals(transition))
- || (cp.length() > state.length() && cp.substring(0,
- state.length()).equals(state)))
- {
- out.print(logCommand);
- out.print("(\"Structural feature: ");
- out.print(escapeString(cp));
- out.print("\");");
- out.endl();
- }
- }
- else if (checkpoint.getType() == CheckpointType.REQUIREMENT)
- {
- out.print(logCommand);
- out.print("(\"Requirement: ");
- out.print(escapeString(checkpoint.getName()));
- out.print("\");");
- out.endl();
- }
- return true;
- }
-
- @Override
- public boolean endCase()
- {
- out.print("setverdict(pass);");
- out.endl();
-
- /*
- * Default is used only if the provided name is different from "", so if
- * the default is not used let's not deactivate it either.
- */
- if (!defaultName.equals(""))
- {
- out.print("deactivate(default_behaviour_ref);");
- out.endl();
- }
-
- if (!endHook.equals(""))
- {
- out.print(endHook);
- out.print(";");
- out.endl();
- }
-
- out.resume();
- out.print("}");
- out.endl();
-
- /* Generate templates out of the datums stored in the TestStep. */
- dumpTemplates();
-
- postponedTemplates.clear();
- return true;
- }
-
- @Override
- public boolean endScript()
- {
- out.print("control");
- out.endl();
- out.print("{");
- out.endl();
- out.print(" ");
- out.block();
- for (int i = 1; i <= testCaseIndex; i++)
- {
- out.print("execute(");
- out.print(getTestCaseName(i));
- out.print("());");
- out.endl();
- }
- out.resume();
- out.print("}");
- out.endl();
- out.resume();
- out.print("}");
- out.endl();
-
- try
- {
- out.flush();
- out.close();
- } catch (Exception e)
- {
- if (notifications != null)
- {
- notifications.notify("error", SCRIPTER_NAME + ": "
- + e.toString());
- }
- }
- out = null;
-
- StringBuffer ss = new StringBuffer();
- ss.append("Generated TTCN-3 script to <hyperlink=\"");
- ss.append(filename);
- ss.append("\">");
- ss.append(filename);
- ss.append("</hyperlink>.");
- if (notifications != null)
- {
- notifications.notify("info", SCRIPTER_NAME + ": " + ss.toString());
- }
- else
- {
- System.out.println(ss.toString());
- }
- testCaseNames.clear();
- return true;
- }
-
- @Override
- public boolean testStep(QMLRecord r, String thread, String port,
- boolean isFromTester, TimeStamp ts)
- {
- /*
- * We have an altstep defined:
- *
- * altstep QtronicDefaultAlt() runs on SystemType { [] any port.receive
- * { mytimer.stop; setverdict(fail); stop; } [] mytimer.timeout {
- * setverdict(fail); stop; } }
- *
- * which removes the need for "[] any port.receive" and timeout from alt
- * statements.
- */
-
- // Remember the datum so that we can generate a template out of it.
- // Generate a new template only if it has not been generated before.
- String name;
- Integer idx = generatedTemplates.get(r);
-
- if (idx != null)
- {
- StringBuffer ss = new StringBuffer();
- ss.append(r.getName());
- ss.append("Template");
- ss.append(idx);
- name = ss.toString();
- }
- else
- {
- ++templateIndex;
-
- StringBuffer ss = new StringBuffer();
- ss.append(r.getName());
- ss.append("Template");
- ss.append(templateIndex);
- name = ss.toString();
-
- postponedTemplates
- .add(new TemplateDefinition(r.getName(), name, r));
-
- generatedTemplates.put(r, templateIndex);
- }
-
- if (isFromTester)
- {
- /*
- * Send datum to SUT. Generate:
- *
- * mytimer.start(<send time>); alt { [] mytimer.timeout { // OK } }
- * <port>.send(template_<index>);
- */
- if (ts.seconds > timeStamp.seconds
- || ts.nanoseconds > timeStamp.nanoseconds)
- {
- out.print(timerName);
- out.print(".start(");
- out.print(ts.seconds);
- out.print(".");
- out.print(ts.nanoseconds);
- out.print(" - oldtimer);");
- out.endl();
- out.print("alt");
- out.endl();
- out.print("{");
- out.endl();
- out.print(" ");
- out.block();
- out.print("[] ");
- out.print(timerName);
- out.print(".timeout");
- out.endl();
- out.print("{");
- out.endl();
- out.print("}");
- out.endl();
- out.resume();
- out.print("}");
- out.endl();
- ;
-
- out.print(timerName);
- out.print(".stop;");
- out.endl();
- }
- out.print("qtronic_send_");
- out.print(r.getName());
- out.print("_to_");
- out.print(port);
- out.print("(");
- out.print(name);
- out.print(");");
- out.endl();
- }
- else
- {
- out.print(timerName);
- out.print(".start((");
- out.print(ts.seconds);
- out.print(".");
- out.print(ts.nanoseconds);
- out.print(" - oldtimer) + SLACK);");
- out.endl();
- out.print("qtronic_receive_");
- out.print(r.getName());
- out.print("_from_");
- out.print(port);
- out.print("(");
- out.print(name);
- out.print(");");
- out.endl();
- out.print(timerName);
- out.print(".stop;");
- out.endl();
- }
-
- out.print("oldtimer := ");
- out.print(ts.seconds);
- out.print(".");
- out.print(ts.nanoseconds);
- out.print(";");
- out.endl();
-
- this.timeStamp.seconds = ts.seconds;
- this.timeStamp.nanoseconds = ts.nanoseconds;
- return true;
- }
-
- private String recordAndRenderTestCaseName(String testCaseName)
- {
- // Remove whitespace
- StringBuffer rendered = new StringBuffer();
- for (int i = 0; i < testCaseName.length(); i++)
- {
- // Inverted the logic here to be safer by replacing everything
- // but valid identifier chars with an underscore. According to the
- // spec: "TTCN-3 identifiers are case sensitive and may
- // only contain lowercase letters (a-z) uppercase letters
- // (A-Z) and numeric digits (0-9). Use of the underscore (
- // _ ) symbol is also allowed. An identifier shall begin
- // with a letter (i.e., not a number and not an
- // underscore)."
- char c = testCaseName.substring(i, i + 1).charAt(0);
- // If the original test case name starts with a digit, we want
- // to preserve that but need to prefix the test case name with
- // an underscore.
- if (c >= '0' && c <= '9' && i == 0)
- rendered.append('_');
- if ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z')
- || (c >= '0' && c <= '9') || c == '_')
- rendered.append(c);
- else
- rendered.append('_');
- }
- // Put into test case name list
- testCaseNames.add(rendered.toString());
- return rendered.toString();
- }
-
- private String getTestCaseName(int i)
- {
- // Get test case name at index i of the test case list
- return testCaseNames.get(i - 1);
- }
-
- @Override
- public boolean internalCommunicationsInfo(QMLRecord datum, String sender,
- String receiver, String port, TimeStamp time)
- {
- return true;
- }
-
- @Override
- public boolean trace(String message, TimeStamp time)
- {
- return true;
- }
-
- private static boolean isalpha(char c)
- {
- return (('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z'));
- }
-
- private static boolean isalnum(char c)
- {
- return (isalpha(c) || ('0' <= c && c <= '9'));
- }
-
- public static String makeValidTTCN3Identifier(String id)
- {
- /* "Identifier ::= <alpha> (<alnum> | <underscore>)*" */
- StringBuffer valid_ = new StringBuffer();
- final int size = id.length();
- if (size == 0)
- {
- System.err
- .println("Warning: Empty string is not a valid TTCN3 identifier.");
- return id;
- }
- if (isalpha(id.charAt(0)))
- {
- valid_.append(id.substring(0, 1));
- }
- else
- {
- valid_.append("X" + id.substring(0, 1));
- }
- for (int i = 1; i < size; i++)
- {
- if (!isalnum(id.charAt(i)) && id.charAt(i) != '_')
- {
- valid_.append("_");
- }
- else
- {
- valid_.append(id.charAt(i));
- }
- }
- /* Postfix TTCN3 reserved words with '_' */
- String valid = valid_.toString();
- if (valid.equals("action") || valid.equals("fail")
- || valid.equals("named") || valid.equals("self")
- || valid.equals("activate") || valid.equals("false")
- || valid.equals("none") || valid.equals("send")
- || valid.equals("address") || valid.equals("float")
- || valid.equals("nonrecursive") || valid.equals("sender")
- || valid.equals("all") || valid.equals("for")
- || valid.equals("not") || valid.equals("set")
- || valid.equals("alt") || valid.equals("from")
- || valid.equals("not4b") || valid.equals("signature")
- || valid.equals("and") || valid.equals("function")
- || valid.equals("nowait") || valid.equals("start")
- || valid.equals("and4b") || valid.equals("null")
- || valid.equals("stop") || valid.equals("any")
- || valid.equals("get") || valid.equals("sut")
- || valid.equals("getcall") || valid.equals("objid")
- || valid.equals("system") || valid.equals("bitstring")
- || valid.equals("getreply") || valid.equals("octetstring")
- || valid.equals("boolean") || valid.equals("goto")
- || valid.equals("of") || valid.equals("template")
- || valid.equals("group") || valid.equals("omit")
- || valid.equals("testcase") || valid.equals("call")
- || valid.equals("on") || valid.equals("timeout")
- || valid.equals("catch") || valid.equals("hexstring")
- || valid.equals("optional") || valid.equals("timer")
- || valid.equals("char") || valid.equals("or") || valid.equals("to")
- || valid.equals("charstring") || valid.equals("if")
- || valid.equals("or4b") || valid.equals("trigger")
- || valid.equals("check") || valid.equals("ifpresent")
- || valid.equals("out") || valid.equals("true")
- || valid.equals("clear") || valid.equals("import")
- || valid.equals("override") || valid.equals("type")
- || valid.equals("complement") || valid.equals("in")
- || valid.equals("component") || valid.equals("inconc")
- || valid.equals("param") || valid.equals("union")
- || valid.equals("connect") || valid.equals("infinity")
- || valid.equals("pass") || valid.equals("universal")
- || valid.equals("const") || valid.equals("inout")
- || valid.equals("pattern") || valid.equals("unmap")
- || valid.equals("control") || valid.equals("integer")
- || valid.equals("port") || valid.equals("create")
- || valid.equals("interleave") || valid.equals("procedure")
- || valid.equals("value") || valid.equals("valueof")
- || valid.equals("deactivate") || valid.equals("label")
- || valid.equals("raise") || valid.equals("var")
- || valid.equals("disconnect") || valid.equals("language")
- || valid.equals("read") || valid.equals("verdict")
- || valid.equals("display") || valid.equals("length")
- || valid.equals("receive") || valid.equals("verdicttype")
- || valid.equals("do") || valid.equals("log")
- || valid.equals("record") || valid.equals("done")
- || valid.equals("rem") || valid.equals("while")
- || valid.equals("map") || valid.equals("repeat")
- || valid.equals("with") || valid.equals("else")
- || valid.equals("match") || valid.equals("reply")
- || valid.equals("encode") || valid.equals("message")
- || valid.equals("return") || valid.equals("xor")
- || valid.equals("enumerated") || valid.equals("mixed")
- || valid.equals("running") || valid.equals("xor4b")
- || valid.equals("error") || valid.equals("mod")
- || valid.equals("runs") || valid.equals("exception")
- || valid.equals("modifies") || valid.equals("execute")
- || valid.equals("module") || valid.equals("expand")
- || valid.equals("mtc") || valid.equals("extension")
- || valid.equals("external") ||
-
- /* special identifiers reserved for the predefined functions */
- valid.equals("int2char") || valid.equals("char2int")
- || valid.equals("int2unichar") || valid.equals("unichar2int")
- || valid.equals("bit2int") || valid.equals("hex2int")
- || valid.equals("int2bit") || valid.equals("int2hex")
- || valid.equals("int2oct") || valid.equals("int2str")
- || valid.equals("oct2int") || valid.equals("str2int")
- || valid.equals("lengthof") || valid.equals("sizeof")
- || valid.equals("ischosen") || valid.equals("ispresent"))
- {
- return valid + "_";
- }
- return valid;
- }
-}
diff --git a/src/Qtronic/TTCNScripter_v211/TTCNTypeName.java b/src/Qtronic/TTCNScripter_v211/TTCNTypeName.java
deleted file mode 100644
index 61c00b1..0000000
--- a/src/Qtronic/TTCNScripter_v211/TTCNTypeName.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/** Copyright (C) Conformiq Software Oy, Ltd.
- * All rights reserved.
- *
- * Created Thu Aug 28 11:18:26 2008.
- *
- * @file
- *
- * @author Tommi Vainikainen
- *
- *
- */
-package com.conformiq.adaptation.ttcn;
-
-import java.util.Set;
-
-import com.conformiq.qtronic2.QMLArrayType;
-import com.conformiq.qtronic2.QMLBooleanType;
-import com.conformiq.qtronic2.QMLNumberType;
-import com.conformiq.qtronic2.QMLOptionalType;
-import com.conformiq.qtronic2.QMLRecordType;
-import com.conformiq.qtronic2.QMLStringType;
-import com.conformiq.qtronic2.QMLTypeVisitor;
-
-class TTCNTypeName implements QMLTypeVisitor {
- public TTCNTypeName(Set<String> arrays) {
- this.arrays = arrays;
- optional = false;
- name = "";
- }
-
- public void visit(QMLArrayType a) {
- // We first visit the element type to get the correct name
- // for it.
- a.getType().accept(this);
- //arrays.add(a.getType().getTypeName());
- arrays.add(name);
-
- optional = false;
- name += "Array";
- }
-
- public void visit(QMLBooleanType b) {
- name = "boolean";
- }
-
- public void visit(QMLNumberType n) {
- if (n.isFloat() || n.isDouble()) {
- name = "float";
- } else {
- name = "integer";
- }
- }
-
- public void visit(QMLRecordType r) {
- name = TTCNScripter.makeValidTTCN3Identifier(r.getTypeName());
- }
-
- public void visit(QMLStringType s) {
- name = "charstring";
- }
-
- public void visit(QMLOptionalType p) {
- p.getType().accept(this);
- optional = true;
- }
-
- private boolean optional;
-
- public boolean getOptional() {
- return optional;
- }
-
- private String name;
-
- public String getName() {
- return name;
- }
-
- protected Set<String> arrays;
-};
diff --git a/src/Qtronic/TTCNScripter_v211/TemplateDumper.java b/src/Qtronic/TTCNScripter_v211/TemplateDumper.java
deleted file mode 100644
index ae9420e..0000000
--- a/src/Qtronic/TTCNScripter_v211/TemplateDumper.java
+++ /dev/null
@@ -1,150 +0,0 @@
-/** Copyright (C) Conformiq Software Oy, Ltd.
- * All rights reserved.
- *
- * Created Wed Aug 27 16:48:45 2008.
- *
- * @file
- *
- * @author Tommi Vainikainen
- *
- *
- */
-package com.conformiq.adaptation.ttcn;
-
-import com.conformiq.qtronic2.QMLArray;
-import com.conformiq.qtronic2.QMLBoolean;
-import com.conformiq.qtronic2.QMLNumber;
-import com.conformiq.qtronic2.QMLOptional;
-import com.conformiq.qtronic2.QMLRecord;
-import com.conformiq.qtronic2.QMLRecordField;
-import com.conformiq.qtronic2.QMLString;
-import com.conformiq.qtronic2.QMLValue;
-import com.conformiq.qtronic2.QMLValueVisitor;
-
-import java.math.BigDecimal;
-
-public class TemplateDumper implements QMLValueVisitor {
- private PrettyPrinter out;
-
- public TemplateDumper(PrettyPrinter out) {
- this.out = out;
- }
-
- @Override
- public void visit(QMLRecord r) {
- if (r == null) {
- out.print("{ /* null record */ }");
- return;
- }
-
- out.print("{");
- out.endl();
- out.print(" ");
- out.block();
- for (int i = 0; i < r.getNumberOfFields(); i++) {
- if (i > 0) {
- out.print(",");
- out.endl();
- }
- QMLRecordField f = r.getField(i);
- out.print(TTCNScripter.makeValidTTCN3Identifier(f.getName()));
- out.print(" := ");
- QMLValue v = f.getValue();
- if (v != null)
- v.accept(this);
- else
- out.print("{ /* NULL */ }");
- }
-
- out.endl();
- out.resume();
- out.print("}");
- }
-
- @Override
- public void visit(QMLString x) {
- assert (x != null);
- String v = x.getValue();
- out.print("\"");
- for (int i = 0; i < v.length(); i++) {
- switch (v.charAt(i)) {
- case '\n':
- out.print("\\n");
- break;
- case '\r':
- out.print("\\r");
- break;
- case '\t':
- out.print("\\t");
- break;
- case '\"':
- case '\\':
- out.print("\\");
- // PASS THROUGH
- default:
- out.print(v.charAt(i));
- break;
- }
- }
- out.print("\"");
- }
-
- @Override
- public void visit(QMLBoolean x) {
- assert (x != null);
- out.print((x.getValue() ? "true" : "false"));
- }
-
- @Override
- public void visit(QMLNumber x) {
- assert (x != null);
- if (x.isBigInteger())
- {
- out.print(x.getBigInteger());
- }
- else
- {
- BigDecimal num = new BigDecimal(x.getNumerator()).setScale(20);
- BigDecimal den = new BigDecimal(x.getDenominator());
- out.print(num.divide(den, BigDecimal.ROUND_UP));
- }
- }
-
- @Override
- public void visit(QMLArray array) {
- if (array == null) {
- out.print("{ /* null */ }");
- return;
- }
-
- out.print("{");
- out.endl();
- out.print(" ");
- out.block();
- for (int i = 0; i < array.getNumberOfElements(); i++) {
- if (i > 0) {
- out.print(",");
- out.endl();
- }
- QMLValue v = array.getValue(i);
- if (v != null)
- v.accept(this);
- else
- out.print("{ /* null */ }");
- }
-
- out.endl();
- out.resume();
- out.print("}");
- }
-
- @Override
- public void visit(QMLOptional o) {
- QMLValue v = o.getValue();
- if (v == null) {
- out.print("omit");
- } else {
- v.accept(this);
- }
- }
-}
diff --git a/src/Qtronic/TTCNScripter_v421/Configuration.java b/src/Qtronic/TTCNScripter_v421/Configuration.java
deleted file mode 100644
index 89e28f0..0000000
--- a/src/Qtronic/TTCNScripter_v421/Configuration.java
+++ /dev/null
@@ -1,379 +0,0 @@
-/** Copyright (C) Conformiq Software Ltd.
- * All rights reserved.
- *
- * Created Wed Aug 27 16:49:21 2008.
- *
- * @file Configuration.java
- *
- * @author Conformiq Software Ltd.
- *
- *
- */
-
-package com.conformiq.adaptation.ttcn;
-
-import java.io.File;
-
-public class Configuration
-{
- public boolean setConfigurationOption(String property, String value)
- {
- if (property.equals("Main.Test suite file"))
- {
- mSuiteFile = new File(value);
- mSuiteModuleName = Utils.buildModuleNameFromFileName(mSuiteFile);
- }
- if (property.equals("Project"))
- {
- this.mProjectName = value;
- }
- else if (property.equals("Main.Import from or generate to data types "
- + "file"))
- {
- mDataTypesFile = new File(value);
- mDataTypesModuleName =
- Utils.buildModuleNameFromFileName(mDataTypesFile);
- }
- else if (property.equals("Main.Import from or generate to test system " +
- "file"))
- {
- mTestSystemFile = new File(value);
- mTestSystemModuleName =
- Utils.buildModuleNameFromFileName(mTestSystemFile);
- }
- else if (property.equals("Main.Generate test system information "
- + "(component and port types)"))
- {
- mGenerateTestSystemFile = value.equals("true");
- }
- else if (property.equals("Main.Import from or generate to harness " +
- "template file"))
- {
- mTestHarnessFile = new File(value);
- mTestHarnessModuleName =
- Utils.buildModuleNameFromFileName(mTestHarnessFile);
- }
- else if (property.equals("Main.Generate protocol data types"))
- {
- mGenerateDataTypes = value.equals("true");
- }
- else if (property.equals("Main.Generate test harness function stubs"))
- {
- mGenerateTestHarness = value.equals("true");
- }
- else if (property.equals("Logging.Log function name"))
- {
- mLogCommand = value;
- }
- else if (property.equals("Customization.Component timer name"))
- {
- mTimerName = value;
- }
- else if (property.equals("Customization.Generated functions prefix"))
- {
- mFunctionsPrefix = value;
- }
- else if (property.equals("Customization.Default altstep name"))
- {
- mDefaultName = value;
- }
- else if (property.equals("Customization.Default variable name"))
- {
- mDefaultRefName = value;
- }
- else if (property.equals("Customization.Start test case hook function "
- + "name"))
- {
- mStartHook = value;
- }
- else if (property.equals("Timing.Maximum SUT response time"))
- {
- mCommSlack = value;
- }
- else if (property.equals("Customization.Extra import statements"))
- {
- mExtraImports = value;
- }
- else if (property.equals("Customization.MTC type name"))
- {
- mRunsOnName = value;
- }
- else if (property.equals("Customization.System component type name"))
- {
- mSystemTypeName = value;
- }
- else if (property.equals("Customization.End test case hook function "
- + "name"))
- {
- mEndHook = value;
- }
- else if (property.equals("Extensions.Use port type extension"))
- {
- mPortExtensions = value;
- }
- else if (property.equals("Logging.Log CQ debug messages"))
- {
- mDoLogCQDEbugMessages = value.equals("true");
- }
- else if (property.equals("Logging.Log CQ info messages"))
- {
- mDoLogCQInfoMessages = value.equals("true");
- }
- else if (property.equals("Customization.Generate fractions for float "
- + "numbers"))
- {
- mUseFractions = value.equals("true");
- }
- else if (property.equals("EPTF_MBT_Applib.Enable"))
- {
- setEptfEnable(value.equals("true"));
- }
- else if (property.equals("EPTF_MBT_Applib.Test component extension"))
- {
- setExtendsComponent(value);
- }
- else if (property.equals("EPTF_MBT_Applib.Inbound Port"))
- {
- setEptfInboundPort(value);
- }
- else if (property.equals("EPTF_MBT_Applib.Outbound Port"))
- {
- setEptfOutboundPort(value);
- }
- else if (property.equals("EPTF_MBT_Applib.Bidirectional Ports"))
- {
- setEptfBidirectionalPort(value.equals("true"));
- }
- else
- {
- for (DebugMessageType t : DebugMessageType.values())
- {
- if (property.equals(t.XMLPropertyName))
- {
- t.enabled = value.equals("true");
- return true;
- }
-
- }
- }
- return true;
- }
-
- public File getSuiteFile()
- {
- return mSuiteFile;
- }
-
- public String getSuiteModuleName()
- {
- return mSuiteModuleName;
- }
-
- public File getDataTypesFile()
- {
- return mDataTypesFile;
- }
-
- public String getDataTypesModuleName()
- {
- return mDataTypesModuleName;
- }
-
- public File getTestHarnessFile()
- {
- return mTestHarnessFile;
- }
-
- public String getTestHarnessModuleName()
- {
- return mTestHarnessModuleName;
- }
-
- public File getTestSystemFile()
- {
- return mTestSystemFile;
- }
-
- public String getTestSystemModuleName()
- {
- return mTestSystemModuleName;
- }
-
- public String getProjectName()
- {
- return mProjectName;
- }
-
- public boolean isGenerateDataTypes()
- {
- return mGenerateDataTypes;
- }
-
- public boolean isGenerateTestHarness()
- {
- return mGenerateTestHarness;
- }
-
- public String getLogCommand()
- {
- return mLogCommand;
- }
-
- public String getTimerName()
- {
- return mTimerName;
- }
-
- public String getFunctionsPrefix()
- {
- return mFunctionsPrefix;
- }
-
- public String getDefaultName()
- {
- return mDefaultName;
- }
-
- public String getDefaultRefName()
- {
- return mDefaultRefName;
- }
-
- public String getStartHook()
- {
- return mStartHook;
- }
-
- public String getCommSlack()
- {
- return mCommSlack;
- }
-
- public String getExtraImports()
- {
- return mExtraImports;
- }
-
- public String getRunsOnName()
- {
- return mRunsOnName;
- }
-
- public String getSystemTypeName()
- {
- return mSystemTypeName;
- }
-
- public String getEndHook()
- {
- return mEndHook;
- }
-
- public String getPortExtensions()
- {
- return mPortExtensions;
- }
-
- public boolean isDoLogCQDEbugMessages()
- {
- return mDoLogCQDEbugMessages;
- }
-
- public boolean isUseFractions()
- {
- return mUseFractions;
- }
-
- public boolean isDoLogCQInfoMessages()
- {
- return mDoLogCQInfoMessages;
- }
-
- public boolean isGenerateTestSystemFile()
- {
- return mGenerateTestSystemFile;
- }
-
- public void setExtendsComponent(String extendsComponent)
- {
- this.extendsComponent = extendsComponent;
- }
-
- public String getExtendsComponent()
- {
- return extendsComponent;
- }
-
- public void setEptfEnable(boolean eptfEnable)
- {
- this.eptfEnable = eptfEnable;
- }
-
- public boolean isEptfEnable()
- {
- return eptfEnable;
- }
-
- public void setEptfInboundPort(String eptfInboundPort)
- {
- this.eptfInboundPort = eptfInboundPort;
- }
-
- public String getEptfInboundPort()
- {
- return eptfInboundPort;
- }
-
- public void setEptfOutboundPort(String eptfOutboundPort)
- {
- this.eptfOutboundPort = eptfOutboundPort;
- }
-
- public String getEptfOutboundPort()
- {
- return eptfOutboundPort;
- }
-
- public void setEptfBidirectionalPort(boolean eptfBidirectionalPort)
- {
- this.eptfBidirectionalPort = eptfBidirectionalPort;
- }
-
- public boolean isEptfBidirectionalPort()
- {
- return eptfBidirectionalPort;
- }
-
- private File mSuiteFile;
- private String mSuiteModuleName;
- private File mDataTypesFile;
- private String mDataTypesModuleName;
- private File mTestHarnessFile;
- private String mTestHarnessModuleName;
- private File mTestSystemFile;
- private String mTestSystemModuleName;
- private String mProjectName;
- private boolean mGenerateDataTypes;
- private boolean mGenerateTestSystemFile;
- private boolean mGenerateTestHarness;
- private String mLogCommand;
- private String mTimerName;
- private String mFunctionsPrefix;
- private String mDefaultName;
- private String mDefaultRefName;
- private String mStartHook;
- private String mCommSlack;
- private String mExtraImports;
- private String mRunsOnName;
- private String mSystemTypeName;
- private String mEndHook;
- private String mPortExtensions;
- private boolean mDoLogCQDEbugMessages;
- private boolean mDoLogCQInfoMessages;
- private boolean mUseFractions;
- private String extendsComponent = "";
- private boolean eptfEnable = false;
- private String eptfInboundPort = "";
- private String eptfOutboundPort = "";
- private boolean eptfBidirectionalPort = false;
-}
diff --git a/src/Qtronic/TTCNScripter_v421/DebugMessageType.java b/src/Qtronic/TTCNScripter_v421/DebugMessageType.java
deleted file mode 100644
index 6cc8771..0000000
--- a/src/Qtronic/TTCNScripter_v421/DebugMessageType.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/** Copyright (C) Conformiq Software Ltd.
- * All rights reserved.
- *
- * Created Wed Aug 27 16:49:21 2008.
- *
- * @file DebugMessageType.java
- *
- * @author Conformiq Software Ltd.
- *
- *
- */
-package com.conformiq.adaptation.ttcn;
-
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Set;
-
-enum DebugMessageType {
-
- Requirement("Logging.Log targeted Requirements",
- "mp_log_targeted_requirements", "requirement",
- new String[] {
- "When this module parameter value is set to true all "
- + "requirements",
- "targeted in each test case will be logged.",
- "The default value of this module parameter is true." },
- new String[] { "requirement:" }, true),
-
- StateOrTransition("Logging.Log targeted States and Transitions",
- "mp_log_targeted_states_and_transitions", "state_or_transition",
- new String[] {
- "When this module parameter value is set to true all states &",
- "transitions targeted in each test case will be logged.",
- "The default value of this module parameter is true." },
- new String[] { "state:", "transition:", "2-transition:" }, true),
-
- Branch("Logging.Log targeted Conditional and Atomic Branches",
- "mp_log_targeted_conditional_and_atomic_branches", "branch",
- new String[] {
- "When this module parameter value is set to true all "
- + "conditional",
- "and atomic branches targeted in each test case will be "
- + "logged.",
- "The default value of this module parameter is true." },
- new String[] { "branch:", "condition:" }, true),
-
- BoundaryValueAnaysis("Logging.Log targeted Boundary Value Analysis",
- "mp_log_targeted_boundary_value_analysis", "boundary_value",
- new String[] {
- "When this module parameter value is set to true all boundary",
- "values targeted in each test case will be logged.",
- "The default value of this module parameter is true." },
- new String[] { "boundary:" }, true),
-
- Method("Logging.Log targeted Methods", "mp_log_targeted_methods", "method",
- new String[] { "When this module parameter value is set to true",
- "all methods targeted in each test case will be logged.",
- "The default value of this module parameter is true." },
- new String[] { "method:" }, true);
-
- public static DebugMessageType[] enabledValues()
- {
- List<DebugMessageType> ret = new LinkedList<DebugMessageType>();
- for (DebugMessageType t : values())
- {
- if (t.enabled)
- {
- ret.add(t);
- }
- }
- return ret.toArray(new DebugMessageType[0]);
- }
-
- DebugMessageType(String XMLPropertyName, String enablingFlag,
- String dispatchingEnumItemName, String[] modeuleparComment,
- String[] checkpointPrefixes, boolean defaultFlagState)
- {
- this.XMLPropertyName = XMLPropertyName;
- this.enablingFlag = enablingFlag;
- this.dispatchingEnumItemName = "e_" + dispatchingEnumItemName;
- this.modeuleparComment = modeuleparComment;
- this.checkpointPrefixes = new HashSet<String>();
- this.defaultFlagState = defaultFlagState;
- this.checkpointPrefixes.addAll(Arrays.asList(checkpointPrefixes));
- }
-
- public final String XMLPropertyName;
- public final String enablingFlag;
- public final String dispatchingEnumItemName;
- public final String[] modeuleparComment;
- public final Set<String> checkpointPrefixes;
- public final boolean defaultFlagState;
- boolean enabled;
-
-}
diff --git a/src/Qtronic/TTCNScripter_v421/PrettyPrinter.java b/src/Qtronic/TTCNScripter_v421/PrettyPrinter.java
deleted file mode 100644
index 76b7570..0000000
--- a/src/Qtronic/TTCNScripter_v421/PrettyPrinter.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/** Copyright (C) Conformiq Software Ltd.
- * All rights reserved.
- *
- * Created Wed Aug 27 16:49:21 2008.
- *
- * @file PrettyPrinter.java
- *
- * @author Conformiq Software Ltd.
- *
- *
- */
-package com.conformiq.adaptation.ttcn;
-
-import java.io.PrintWriter;
-import java.io.Writer;
-import java.math.BigInteger;
-import java.util.List;
-import java.util.Vector;
-
-class PrettyPrinter extends PrintWriter
-{
- private List<String> stack;
- private String header;
- private boolean headerPrinted;
-
- public PrettyPrinter(Writer writer)
- {
- super(writer);
- this.stack = new Vector<String>();
- this.header = "";
- this.headerPrinted = true;
- }
-
- private void printHeader()
- {
- if (headerPrinted)
- return;
-
- for (int i = 0; i < this.stack.size(); i++)
- {
- super.print(this.stack.get(i));
- }
- this.headerPrinted = true;
- }
-
- public void print(String s)
- {
- printHeader();
- this.header = this.header.concat(s);
- super.print(s);
- }
-
- public void println(String s)
- {
- print(s);
- endl();
- }
-
- // Start a new block
- public void block()
- {
- this.stack.add(header);
- this.header = "";
- }
-
- // Resume to previous state
- public void resume()
- {
- // remove last
- this.stack.remove(this.stack.size() - 1);
- }
-
- // Print EOL char
- public void endl()
- {
- if (this.headerPrinted)
- { // suppress double empty lines
- println();
- this.header = "";
- this.headerPrinted = false;
- }
- }
-
- public void emptyline()
- {
- println();
- this.header = "";
- this.headerPrinted = false;
- }
-
- public void print(BigInteger bi)
- {
- print("" + bi.toString());
- }
-
- public void ws()
- {
- print(" ");
- }
-}
diff --git a/src/Qtronic/TTCNScripter_v421/TTCNScripter.java b/src/Qtronic/TTCNScripter_v421/TTCNScripter.java
deleted file mode 100644
index ad35fb2..0000000
--- a/src/Qtronic/TTCNScripter_v421/TTCNScripter.java
+++ /dev/null
@@ -1,1875 +0,0 @@
-/** Copyright (C) Conformiq Software Ltd.
- * All rights reserved.
- *
- * Created Wed Aug 27 16:49:21 2008.
- *
- * @file TTCNScripter.java
- *
- * @author Conformiq Software Ltd.
- *
- *
- */
-package com.conformiq.adaptation.ttcn;
-
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Queue;
-import java.util.Set;
-import java.util.StringTokenizer;
-import java.util.Vector;
-
-import com.conformiq.adaptation.ttcn.Utils.Banner;
-import com.conformiq.adaptation.ttcn.Utils.CheckPointInfo;
-import com.conformiq.adaptation.ttcn.Utils.TemplateDefinition;
-import com.conformiq.qtronic2.Checkpoint;
-import com.conformiq.qtronic2.MetaDataDictionary;
-import com.conformiq.qtronic2.NotificationSink;
-import com.conformiq.qtronic2.QMLArray;
-import com.conformiq.qtronic2.QMLBoolean;
-import com.conformiq.qtronic2.QMLNumber;
-import com.conformiq.qtronic2.QMLOptional;
-import com.conformiq.qtronic2.QMLRecord;
-import com.conformiq.qtronic2.QMLRecordType;
-import com.conformiq.qtronic2.QMLRecordTypeField;
-import com.conformiq.qtronic2.QMLString;
-import com.conformiq.qtronic2.QMLUnionType;
-import com.conformiq.qtronic2.QMLValue;
-import com.conformiq.qtronic2.QMLValueVisitor;
-import com.conformiq.qtronic2.ScriptBackend;
-import com.conformiq.qtronic2.TimeStamp;
-import com.conformiq.qtronic2.Checkpoint.CheckpointStatus;
-
-public class TTCNScripter extends ScriptBackend
-{
- public TTCNScripter()
- {
- this.mTestCaseIndex = 0;
- this.mTemplateIndex = 0;
- this.mTimeStamp = new TimeStamp();
- this.mTimeStamp.seconds = 0;
- this.mTimeStamp.nanoseconds = 0;
- this.mIsFirstStep = false;
- this.mGeneratedTemplates = new HashMap<QMLRecord, Integer>();
- this.mPostponedTemplates = new Vector<TemplateDefinition>();
- this.mTestCaseNames = new Vector<String>();
- this.collectedCheckpoints = null;
- }
-
- @Override
- public void setNotificationSink(NotificationSink sink)
- {
- mNotifications = sink;
- }
-
- @Override
- public boolean setMetaData(MetaDataDictionary dict)
- {
- mMetadata = dict;
- extractPortsMetaData();
- return true;
- }
-
- @Override
- public boolean setConfigurationOption(java.lang.String property,
- java.lang.String value)
- {
- return mConfiguration.setConfigurationOption(property, value);
- }
-
- @Override
- public boolean beginScript(String testsuiteName)
- {
- this.mTestsuiteName = testsuiteName;
- if (mNotifications != null)
- {
- mNotifications.notify("info", mScripterName
- + ": Export test cases for test design configuration "
- + testsuiteName);
- }
- String msg = null;
- if (mConfiguration.getSuiteFile().getAbsolutePath().equals(""))
- {
- msg = "TTCN-3 backend must be configured with a file name.";
- }
- else
- {
- try
- {
- mOut = new PrettyPrinter(new BufferedWriter(new FileWriter(
- mConfiguration.getSuiteFile())));
- } catch (IOException e)
- {
- StringBuffer msgbuf = new StringBuffer();
- msgbuf.append("Failed to open file '");
- msgbuf.append(mConfiguration.getSuiteFile());
- msgbuf.append("' for writing TTCN-3 script.");
- msg = msgbuf.toString();
- }
- }
- if (msg != null)
- {
- if (mNotifications != null)
- {
- mNotifications.notify("error", mScripterName + ": " + msg);
- }
- else
- {
- System.err.println(msg);
- }
- return false;
- }
- {
- String[] desc = {
- "This file contains all test cases generated from the "
- + "Conformiq '" + mConfiguration.getProjectName()
- + "' project",
- "with '" + testsuiteName + "' design configuration." };
- String[] remark = {
- "WARNING! This file has been automatically generated using the",
- "Conformiq TTCN-3 scripting backend. DO NOT EDIT." };
- printHeader(mConfiguration.getSuiteFile(), desc, remark);
- }
- mOut.print("module ");
- mOut.print(mConfiguration.getSuiteModuleName());
- mOut.endl();
- mOut.print("{");
- mOut.endl();
- mOut.print(mIndent);
- mOut.block();
-
- if (mConfiguration.getTestSystemModuleName() != null)
- {
- mOut.print("import from ");
- mOut.print(mConfiguration.getTestSystemModuleName());
- mOut.print(" all;");
- mOut.endl();
- }
-
- if (mConfiguration.getDataTypesModuleName() != null)
- {
- mOut.print("import from ");
- mOut.print(mConfiguration.getDataTypesModuleName());
- mOut.print(" all;");
- mOut.endl();
- }
-
- mOut.print("/* Customized imports begin */");
- mOut.endl();
- mOut.print(mConfiguration.getExtraImports());
- mOut.endl();
- mOut.println("/* Customized imports end */");
- mOut.emptyline();
-
- mOut.print("modulepar float " + mSlackVarName + " := ");
- mOut.print(mConfiguration.getCommSlack());
- mOut.println(";");
- mOut.emptyline();
-
- printDebugModulepars();
-
- mOut.emptyline();
- // print out the test harness template
- try
- {
- // should the harness template be written
- if (mConfiguration.isGenerateTestHarness())
- {
- PrettyPrinter harness = buildPrettyPrinter(mConfiguration
- .getTestHarnessFile(), "harness template", false);
- if (harness != null)
- {
- dumpTestHarness(harness);
- if (mNotifications != null)
- {
- mNotifications.notify("info", mScripterName
- + ": Generated TTCN-3 test harness template to "
- + "<hyperlink=\""
- + mConfiguration.getTestHarnessFile()
- .getAbsolutePath()
- + "\">"
- + mConfiguration.getTestHarnessFile()
- .getAbsolutePath() + "</hyperlink>.");
- }
- }
- }
- } catch (Exception e)
- {
- mOut.print("/* EXCEPTION CAUGHT */");
- mOut.endl();
- if (mNotifications != null)
- {
- mNotifications.notify("error", mScripterName
- + ": Caught exception while rendering TTCN test harness"
- + " template. Please reload model and try again ("
- + e.getMessage() + ")");
- }
- return false;
- }
-
- if (mConfiguration.isGenerateDataTypes())
- {
- /* First dump all the types used in the module. */
- try
- {
- dumpDataTypes();
- } catch (Exception e)
- {
- mOut.print("/* EXCEPTION CAUGHT */");
- mOut.endl();
- if (mNotifications != null)
- {
- mNotifications.notify("error", mScripterName
- + ": Caught exception while "
- + "rendering TTCN type definitions. Please reload "
- + "model and try again (" + e.getMessage() + ")");
- }
- return false;
- }
- }
-
- if (mConfiguration.isGenerateTestSystemFile())
- {
- /* First dump all the types used in the module. */
- try
- {
- dumpTestComponentFile();
- } catch (Exception e)
- {
- mOut.print("/* EXCEPTION CAUGHT */");
- mOut.endl();
- if (mNotifications != null)
- {
- mNotifications.notify("error", mScripterName
- + ": Caught exception while "
- + "rendering TTCN type definitions. Please reload "
- + "model and try again (" + e.getMessage() + ")");
- }
- return false;
- }
- }
-
- deleteCopies();
- mTemplateIndex = 0;
- mTestCaseIndex = 0;
- mIsFirstStep = false;
- return true;
- }
-
- @Override
- public boolean beginCase(String testcaseName)
- {
- collectedCheckpoints = new LinkedList<CheckPointInfo>();
- mCaseStepIndex = 0;
- mIsFirstStep = true;
- mTestCaseIndex++;
-
- Banner banner = new Banner();
- banner.addTag("desc", "Generated test case #" + mTestCaseIndex);
- banner.print(mOut);
- mOut.print("testcase ");
- mCrrentTestCaseName = recordAndRenderTestCaseName(testcaseName);
- mOut.print(mCrrentTestCaseName);
- mOut.println("()");
- mOut.print("runs on ");
- mOut.print(mConfiguration.getRunsOnName());
- if (mConfiguration.getSystemTypeName() != null
- && !mConfiguration.getSystemTypeName().equals(""))
- {
- mOut.print(" system ");
- mOut.print(mConfiguration.getSystemTypeName());
- }
- mOut.endl();
- mOut.print("{");
- mOut.endl();
-
- mOut.print(mIndent);
- mOut.block();
- printLog(LogMessageType.DEBUG, "Starting execution of test case: '"
- + mCrrentTestCaseName + "'");
-
- mOut.print("var float " + mOldTimerName + " := "
- + Utils.TimeStampToString(mTimeStamp) + ";");
- mOut.endl();
-
- if (!mConfiguration.getDefaultName().equals(""))
- {
- mOut.print("var default " + mConfiguration.getDefaultRefName()
- + ";");
- mOut.endl();
- }
-
- if (!mConfiguration.getStartHook().equals(""))
- {
- mOut.emptyline();
- mOut.print("/***** set up test configuration, TTCN-3 harness, "
- + "and adapter *****/");
- mOut.endl();
- mOut.print(mConfiguration.getFunctionsPrefix()
- + mConfiguration.getStartHook());
- mOut.print(";");
- mOut.endl();
- }
-
- if (!mConfiguration.getDefaultName().equals(""))
- {
- mOut.println("// default handles waiting beyond maximum response "
- + "time and reception of any");
- mOut.println("// other than the expected message with setting a"
- + " fail verdict and stopping the test");
- mOut.print(mConfiguration.getDefaultRefName() + " := activate(");
- mOut.print(mConfiguration.getDefaultName());
- mOut.print(");");
- mOut.endl();
- }
-
- return true;
- }
-
- // @Override
- public void caseProbability(double probability)
- {
- }
-
- @Override
- public boolean checkpointInfo(Checkpoint checkpoint, int status,
- TimeStamp ts)
- {
- if (!mIsFirstStep || status == CheckpointStatus.UNCOVERED
- || status == CheckpointStatus.MAYBE_COVERED)
- {
- return true;
- }
- collectedCheckpoints.offer(new CheckPointInfo(checkpoint, status, ts));
- return true;
- }
-
- @Override
- public boolean endCase()
- {
- printCheckpoints();
- mOut.emptyline();
- mOut.println("setverdict(pass);");
-
- /*
- * Default is used only if the provided name is different from "", so if
- * the default is not used let's not deactivate it either.
- */
- if (!mConfiguration.getDefaultName().equals(""))
- {
- mOut.print("deactivate(" + mConfiguration.getDefaultRefName()
- + ");");
- mOut.endl();
- }
-
- if (!mConfiguration.getEndHook().equals(""))
- {
- mOut.emptyline();
- mOut.print("/***** "
- + "tear down test configuration, TTCN-3 harness, and adapter"
- + " *****/");
- mOut.endl();
- mOut.print(mConfiguration.getFunctionsPrefix()
- + mConfiguration.getEndHook());
- mOut.print(";");
- mOut.endl();
- }
- mOut.emptyline();
- printLog(LogMessageType.DEBUG, "Ending execution of "
- + mCrrentTestCaseName);
- mOut.resume();
- mOut.print("}");
- mOut.endl();
-
- /* Generate templates out of the datums stored in the TestStep. */
- printTemplates();
-
- mPostponedTemplates.clear();
- return true;
- }
-
- @Override
- public boolean endScript()
- {
- prindAltstepDefaultDecl();
- printSleepFunction();
- mOut.emptyline();
- printDebugMessageTypeEnum();
- mOut.emptyline();
- printDebugFunctionDecl();
- printControl();
- mOut.resume();
- mOut.print("}");
- mOut.endl();
- try
- {
- mOut.flush();
- mOut.close();
- } catch (Exception e)
- {
- if (mNotifications != null)
- {
- mNotifications.notify("error", mScripterName + ": "
- + e.toString());
- }
- }
- mOut = null;
-
- StringBuffer ss = new StringBuffer();
- ss.append("Generated TTCN-3 script to <hyperlink=\"");
- ss.append(mConfiguration.getSuiteFile().getAbsolutePath());
- ss.append("\">");
- ss.append(mConfiguration.getSuiteFile().getAbsolutePath());
- ss.append("</hyperlink>.");
- if (mNotifications != null)
- {
- mNotifications.notify("info", mScripterName + ": " + ss.toString());
- }
- else
- {
- System.out.println(ss.toString());
- }
- mTestCaseNames.clear();
- return true;
- }
-
- @Override
- public boolean testStep(QMLRecord r, String thread, String port,
- boolean isFromTester, TimeStamp ts)
- {
- /*
- * We have an altstep defined:
- *
- * altstep CQDefaultAlt() runs on SystemType { [] any port.receive {
- * mytimer.stop; setverdict(fail); stop; } [] mytimer.timeout {
- * setverdict(fail); stop; } }
- *
- * which removes the need for "[] any port.receive" and timeout from alt
- * statements.
- */
- mCaseStepIndex++;
- mOut.endl();
- mOut.emptyline();
- mOut.println("/***** Step " + mCaseStepIndex + "; t = "
- + Utils.TimeStampToString(ts) + " *****/");
- mOut.endl();
-
- printLog(LogMessageType.DEBUG, mCrrentTestCaseName + ": Step "
- + mCaseStepIndex);
- printCheckpoints();
-
- // Remember the datum so that we can generate a template out of it.
- // Generate a new template only if it has not been generated before.
- String name;
- Integer idx = mGeneratedTemplates.get(r);
- if (idx != null)
- {
- StringBuffer ss = new StringBuffer();
- ss.append(r.getName());
- ss.append("Template");
- ss.append(idx);
- name = ss.toString();
- }
- else
- {
- ++mTemplateIndex;
- StringBuffer ss = new StringBuffer();
- ss.append(r.getName());
- ss.append("Template");
- ss.append(mTemplateIndex);
- name = ss.toString();
-
- if (!isFromTester)
- {
- name = "expected" + name;
- }
- mPostponedTemplates.add(
- new TemplateDefinition(r.getName(), name, r));
- mGeneratedTemplates.put(r, mTemplateIndex);
- }
-
- if (isFromTester)
- {
- /*
- * Send datum to SUT. Generate:
- *
- * mytimer.start(<send time>); alt { [] mytimer.timeout { // OK } }
- * <port>.send(template_<index>);
- */
- if (ts.seconds > mTimeStamp.seconds
- || ts.nanoseconds > mTimeStamp.nanoseconds)
- {
- mOut.print(mConfiguration.getTimerName());
- mOut.print(".start(");
- mOut.print(ts.seconds);
- mOut.print(".");
- mOut.print(ts.nanoseconds);
- mOut.print(" - " + mOldTimerName + ");");
- mOut.endl();
- mOut.print("alt");
- mOut.endl();
- mOut.print("{");
- mOut.endl();
- mOut.print(mIndent);
- mOut.block();
- mOut.print("[] ");
- mOut.print(mConfiguration.getTimerName());
- mOut.print(".timeout");
- mOut.endl();
- mOut.print("{");
- mOut.endl();
- mOut.print("}");
- mOut.endl();
- mOut.resume();
- mOut.print("}");
- mOut.endl();
- mOut.print(mConfiguration.getTimerName());
- mOut.print(".stop;");
- mOut.endl();
- }
- mOut.endl();
- mOut.print(mConfiguration.getFunctionsPrefix() + "send_");
- mOut.print(r.getName());
- mOut.print("_to_");
- mOut.print(Utils.makeValidTTCN3Identifier(port));
- mOut.print("(");
- mOut.print("m_" + name);
- mOut.print(");");
- mOut.endl();
- }
- else
- {
- final String timeStamp = "" + ts.seconds + "." + ts.nanoseconds;
- if (!Utils.EqualTimeStamps(this.mTimeStamp, ts))
- {
- mOut.println(mConfiguration.getFunctionsPrefix()
- + mSleepFunctionName + "(" + timeStamp + " - "
- + mOldTimerName + ");");
- }
- mOut.println(mConfiguration.getTimerName() + ".start("
- + mSlackVarName + ");");
- mOut.println("// Note: In below receive "
- + mConfiguration.getDefaultRefName() + "() is active!");
- mOut.print(mConfiguration.getFunctionsPrefix() + "receive_");
- mOut.print(r.getName());
- mOut.print("_from_");
- mOut.print(Utils.makeValidTTCN3Identifier(port));
- mOut.print("(");
- mOut.print("m_" + name);
- mOut.print(");");
- mOut.endl();
- mOut.print(mConfiguration.getTimerName());
- mOut.print(".stop;");
- mOut.endl();
- }
-
- if (!Utils.EqualTimeStamps(this.mTimeStamp, ts))
- {
- mOut.print(mOldTimerName + " := ");
- mOut.print(ts.seconds);
- mOut.print(".");
- mOut.print(ts.nanoseconds);
- mOut.println(";");
- }
-
- this.mTimeStamp.seconds = ts.seconds;
- this.mTimeStamp.nanoseconds = ts.nanoseconds;
- this.collectedCheckpoints = new LinkedList<CheckPointInfo>();
- return true;
- }
-
- @Override
- public boolean internalCommunicationsInfo(QMLRecord datum, String sender,
- String receiver, String port, TimeStamp time)
- {
- return true;
- }
-
- @Override
- public boolean trace(String message, TimeStamp time)
- {
- return true;
- }
-
- private PrettyPrinter buildPrettyPrinter(final File f, final String desc,
- final boolean overWrite)
- {
- String name = f.getAbsolutePath();
- if (f.exists() && !f.isDirectory() && !overWrite)
- {
- if (mNotifications != null)
- {
- mNotifications.notify("info", mScripterName + ": File "
- + "<hyperlink=\"" + name + "\">" + name + "</hyperlink>."
- + " exists, NOT overwriting it.");
- }
- return null;
- }
- if (name.equals("") || f.isDirectory())
- {
- mNotifications.notify("error",
- "TTCN-3 backend must be configured with a valid " + desc
- + " file name.");
- return null;
- }
- try
- {
- return new PrettyPrinter(new BufferedWriter(new FileWriter(f)));
- } catch (IOException e)
- {
- mNotifications.notify("error", "Failed to open file '" + name
- + "' for writing" + desc + ".");
- return null;
- }
- }
-
- private void dumpTestComponentFile() throws Exception
- {
- String msg = null;
- Exception rethrowMe = null;
- PrettyPrinter oldOut = mOut;
- if (mConfiguration.getTestSystemFile().getAbsolutePath().equals(""))
- {
- msg = "TTCN-3 backend must be configured with a test system file "
- + "name.";
- }
- else
- {
- try
- {
- mOut = new PrettyPrinter(new BufferedWriter(new FileWriter(
- mConfiguration.getTestSystemFile())));
- } catch (IOException e)
- {
- StringBuffer msgbuf = new StringBuffer();
- msgbuf.append("Failed to open file '");
- msgbuf.append(
- mConfiguration.getTestSystemFile().getAbsolutePath());
- msgbuf.append("' for writing test system information.");
- msg = msgbuf.toString();
- rethrowMe = e;
- }
- }
- if (msg != null)
- {
- if (mNotifications != null)
- {
- mNotifications.notify("error", msg);
- }
- else
- {
- System.err.println(msg);
- }
- mOut = oldOut;
- // Pass the exception forward for proper error handling further
- // up the call stack.
- throw (rethrowMe);
- }
- {
- String[] desc = {
- "This file contains port type definitions and test component "
- + "generated by Conformiq",
- "with '" + mTestsuiteName + "' design configuration for '"
- + mConfiguration.getProjectName() + "' project." };
- String[] remark = {
- "WARNING! This file has been automatically generated using the",
- "Conformiq TTCN-3 scripting backend. DO NOT EDIT." };
- printHeader(mConfiguration.getDataTypesFile(), desc, remark);
- }
- mOut.print("module ");
- mOut.print(mConfiguration.getTestSystemModuleName());
- mOut.endl();
- mOut.print("{");
- mOut.endl();
- mOut.print(mIndent);
- mOut.block();
-
- if (mConfiguration.getDataTypesModuleName() != null)
- {
- mOut.println("import from "
- + mConfiguration.getDataTypesModuleName() + " all;");
- mOut.emptyline();
- }
-
- // system mapping
- if (!mConfiguration.getSystemTypeName().equals("") && !mConfiguration.isEptfEnable())
- {
- mOut.emptyline();
- Banner banner = new Banner();
- banner.addTag("desc", new String[] {
- "This TTCN-3 component type specifies the interface of the",
- "test cases towards the SUT more specifically the SUT "
- + "adapter." });
- banner.print(mOut);
-
- mOut.print("type component ");
- mOut.print(mConfiguration.getSystemTypeName());
- mOut.endl();
- mOut.println("{");
- mOut.print(mIndent);
- mOut.block();
- mOut.println("// Add all port instances here");
- mOut.resume();
- mOut.println("}");
- }
-
- try
- {
- if (mConfiguration.isGenerateTestSystemFile())
- {
- for (Port p : externalPorts)
- {
- if (mConfiguration.isEptfEnable() &&
- (p.name.equals(mConfiguration.getEptfInboundPort()) ||
- p.name.equals(mConfiguration.getEptfOutboundPort()))
- )
- {
- }
- else
- {
- mOut.print("type port ");
- mOut.print(p.name);
- mOut.print("Port message");
- mOut.endl();
- mOut.print("{");
- mOut.endl();
- mOut.print(mIndent);
- mOut.block();
- for (QMLRecordType record : p.records)
- {
- String dir = p.isInbound ? "in" : "out";
- if (mConfiguration.isEptfBidirectionalPort())
- dir = "inout";
- mOut.println(dir + " " + record.getTypeName() + ";");
- }
- mOut.resume();
- mOut.print("}");
- if (!mConfiguration.getPortExtensions().equals(""))
- {
- mOut.print(" with {extension \"");
- mOut.print(mConfiguration.getPortExtensions());
- mOut.print("\"}");
- }
- mOut.emptyline();
- }
- }
- }
- mOut.emptyline();
- Banner banner = new Banner();
- banner.addTag("desc", "The test component (MTC) on which all "
- + "generated test cases run on");
- banner.print(mOut);
- mOut.print("type component ");
- mOut.print(mConfiguration.getRunsOnName());
- if (!mConfiguration.getExtendsComponent().equals(""))
- {
- mOut.print(" extends ");
- mOut.print(mConfiguration.getExtendsComponent());
- }
-
- mOut.endl();
- mOut.print("{");
- mOut.endl();
- mOut.print(mIndent);
- mOut.block();
- for (Port p : externalPorts)
- {
- mOut.print("port ");
- mOut.print(p.name);
- mOut.print("Port ");
- mOut.print(p.name);
- mOut.print(";");
- mOut.endl();
-
- }
- mOut.print("timer ");
- mOut.print(mConfiguration.getTimerName());
- mOut.print(" := 0.0;");
- mOut.endl();
- mOut.resume();
- mOut.print("}");
- mOut.endl();
- mOut.resume();
-
- mOut.print("}");
- mOut.endl();
- mOut.flush();
- mOut.close();
- mOut = oldOut;
- } catch (Exception e)
- {
- mOut.flush();
- mOut.close();
- mOut = oldOut;
- }
- mNotifications.notify("info", mScripterName
- + ": Generated TTCN-3 port and component types file "
- + "<hyperlink=\""
- + mConfiguration.getTestSystemFile().getAbsolutePath() + "\">"
- + mConfiguration.getTestSystemFile().getAbsolutePath()
- + "</hyperlink>.");
- }
-
- /**
- * prints out the test harness template, that contains:
- *
- * - import from CQTypes;
- *
- * - type component for the harness system
- *
- * - MTC component the tests should run on
- *
- * - harness alt step
- *
- * - start and end test hook calls
- *
- * - port and message mapping functions
- */
- private void dumpTestHarness(final PrettyPrinter pp) throws Exception
- {
- assert (mMetadata != null);
-
- PrettyPrinter oldOut = this.mOut;
- this.mOut = pp;
- {
-
- String[] desc = {
- "This is a template file with TTCN-3 function stubs for the "
- + "implementation ",
- "of test harness code for the test suites generated from the "
- + "Conformiq '",
- mConfiguration.getProjectName() + "' project." };
- String[] remark = {
- "All function definitions must be edited as instructed in "
- + "their comments in",
- " order for the test suite to execute properly." };
- printHeader(mConfiguration.getTestHarnessFile(), desc, remark);
- }
- mOut.print("module ");
- mOut.print(Utils.buildModuleNameFromFileName(
- mConfiguration.getTestHarnessFile()));
- mOut.endl();
- mOut.print("{");
- mOut.endl();
-
- // import all data types
- if (mConfiguration.getDataTypesModuleName() != null)
- {
- mOut.print(mIndent);
- mOut.print("import from ");
- mOut.print(mConfiguration.getDataTypesModuleName());
- mOut.print(" all;");
- mOut.endl();
- }
-
- if (mConfiguration.getTestSystemModuleName() != null)
- {
- mOut.print(mIndent);
- mOut.print("import from ");
- mOut.print(mConfiguration.getTestSystemModuleName());
- mOut.print(" all;");
- mOut.endl();
- }
- mOut.emptyline();
- // debug function
- mOut.print(mIndent);
- mOut.block();
-
- // MTC port definitions
- if (!mConfiguration.getRunsOnName().equals(""))
- {
- mOut.resume();
- // default start and stop functions
- mOut.print(mIndent);
- mOut.block();
- if (!mConfiguration.getStartHook().equals("") && !mConfiguration.isEptfEnable())
- {
- mOut.emptyline();
- Banner banner = new Banner();
- banner.addTag("desc", new String[] {
- "This function sets up the test configuration, maps all "
- + "mtc",
- "to system component ports, and configures (if needed)",
- "TTCN-3 harness and test system adapter" });
- banner.print(mOut);
- mOut.print("function ");
- mOut.print(mConfiguration.getFunctionsPrefix()
- + mConfiguration.getStartHook());
- mOut.print(" runs on ");
- mOut.print(mConfiguration.getRunsOnName());
- mOut.endl();
- mOut.print("{");
- mOut.endl();
- mOut.print(mIndent);
- mOut.block();
- mOut.println("// Specify here map operations between MTC and "
- + "abstract test");
- mOut.println("// system interface or update and uncomment "
- + "generated code below");
- for (Port p : externalPorts)
- {
- mOut.println("// map(" + mConfiguration.getRunsOnName()
- + ": " + p.name + ", system: <some port>);");
- }
- if (mConfiguration.isDoLogCQInfoMessages())
- {
- mOut.println("// Remove or comment the following generated "
- + "code");
- }
- printLog(LogMessageType.INFO, "Warning: "
- + mConfiguration.getFunctionsPrefix()
- + mConfiguration.getStartHook() + ": "
- + "function is not implemented");
- mOut.resume();
- mOut.println("}");
- }
- if (!mConfiguration.getEndHook().equals("") && !mConfiguration.isEptfEnable())
- {
-
- Banner banner = new Banner();
- banner.addTag("desc", new String[] {
- "This function tears down the test configuration",
- "and unmaps all mtc to system component ports" });
- banner.print(mOut);
- mOut.print("function ");
- mOut.print(mConfiguration.getFunctionsPrefix()
- + mConfiguration.getEndHook());
- mOut.print(" runs on ");
- mOut.println(mConfiguration.getRunsOnName());
- mOut.println("{");
- mOut.print(mIndent);
- mOut.block();
- mOut.println("//Specify here unmap operations between MTC and"
- + " abstract test");
- mOut.println("// system interface or update and uncomment"
- + " generated code below");
-
- for (Port p : externalPorts)
- {
- mOut.println("// unmap(" + mConfiguration.getRunsOnName()
- + ": " + p.name + ", system: <some port>);");
- }
- if (mConfiguration.isDoLogCQInfoMessages())
- {
- mOut.println("// Remove or comment the following generated "
- + "code");
- }
- printLog(LogMessageType.INFO, "Warning: "
- + mConfiguration.getFunctionsPrefix()
- + mConfiguration.getEndHook() + ": "
- + "function is not implemented");
- mOut.resume();
- mOut.println("}");
- }
- mOut.resume();
- // port mapping
- try
- {
- mOut.print(mIndent);
- mOut.block();
-
- for (Port p : externalPorts)
- {
- for (QMLRecordType type : p.records)
- {
- String record = type.getTypeName();
- String argName = null;
- if (p.isInbound)
- {
- argName = "p_" + "expected" + record;
- }
- else
- {
- argName = "p_" + record;
- }
- // (p.isInbound ? "tmplToMatch" : "msgToSend");
- String functionName =
- mConfiguration.getFunctionsPrefix()
- + (p.isInbound ? "receive_" : "send_")
- + record
- + (p.isInbound ? "_from_" : "_to_") + p.name;
- String functionDecl = "function " + functionName
- + "(template " + record + " " + argName + ")";
- mOut.emptyline();
- Banner banner = new Banner();
- if (p.isInbound)
- {
- banner.addTag("desc", new String[] {
- "This function receives a TTCN-3 value "
- + "corresponding to a " + record,
- "via the abstract test system interface from "
- + "the SUT, performs any",
- "manipulation and transformation needed to "
- + "convert it to a " + record,
- "value, and then attempts to match it to the "
- + argName + " generated by CQ Designer" });
- banner.addTag("param", new String[] { argName
- + "Expected data generated by CQ Designer" });
- // * from the SUT to */
- }
- else
- {
- banner.addTag("desc", new String[] {
- "This function performs manipulation needed"
- + " and" + " sends a " + argName,
- "via the abstract test interface to the"
- + " SUT." });
- banner.addTag("param", argName
- + " Message data generated by CQ Designer"
- + "to be sent to the SUT");
- }
- banner.print(mOut);
- mOut.println(functionDecl + " runs on "
- + mConfiguration.getRunsOnName());
- mOut.println("{");
- mOut.print(mIndent);
- mOut.block();
-
- if (p.isInbound)
- {
- mOut.println("//Steps that need to be implemented"
- + " here are:");
- mOut.println("//1. receive and store (any) TTCN-3"
- + " data value via TTCN-3 port which "
- + "corresponds to the " + p.name + " model "
- + "port");
- mOut.println("// var <T3_" + record
- + "Type> v_recvT3" + record + ";");
- mOut.println("// " + p.name + ".receive(<T3_"
- + record + "Type>:?) -> value v_recvT3"
- + record + ";");
- mOut.println("// 2. replace real with symbolic "
- + "values (if any) in the received TTCN-3 data"
- + " value");
- mOut.println("// 3. transform data from a TTCN-3 "
- + "to " + record + " data value (if needed)");
- mOut.println("// var" + record + "v_recv" + record
- + " = " + "f_transform" + record
- + "T3toCQ(v_recvT3" + record + ");");
- mOut.println("// 4. set the verdict to fail if if"
- + " there is a mismatch of the "
- + "transformed value and " + argName);
- mOut.println("// if ( !match( v_recv" + record
- + " " + argName + ") {");
- mOut.println("// log(CQ_INFO: " + functionName
- + ": FAIL: Mismatch in received and expected "
- + record + " values. Stopping test case.�);");
- mOut.println("// setverdict(fail);");
- mOut.println("// "
- + mConfiguration.getFunctionsPrefix()
- + mConfiguration.getEndHook()
- + ";");
- mOut.println("// stop; }");
- if (mConfiguration.isEptfEnable())
- {
- if (p.name.equals(mConfiguration.getEptfInboundPort())
- || p.name.equals(mConfiguration.getEptfOutboundPort()))
- {
- mOut.println(" EPTF_MBT_TESTER_PCO.receive("+argName+") from vc_lgen;");
- }
- else
- {
- mOut.println(" " + p.name + ".receive("+argName+");");
- }
- }
-
- }
- else
- {
- mOut.println("// Steps that need to be implemented"
- + " here are:");
- mOut.println("// (modify and uncomment example "
- + "code as needed)");
- mOut.println("// 1. transform data from a "
- + record + " to the TTCN-3 data value"
- + " used by the test harness (if needed)");
- mOut.println("// var <T3" + record + "Type> v_T3"
- + record + " := " + "f_transform" + record
- + "CQtoT3(" + argName + ");");
- mOut.println("// 2. replace symbolic values "
- + "(if any) with real values in TTCN-3"
- + " data value");
- mOut.println("// 3. send TTCN-3 data value via "
- + "TTCN-3 port which corresponds to" + p.name
- + "model port");
- mOut.println("// " + p.name + ".send(v_T3" + record
- + ");");
- if (mConfiguration.isEptfEnable())
- {
- if (p.name.equals(mConfiguration.getEptfInboundPort())
- || p.name.equals(mConfiguration.getEptfOutboundPort()))
- {
- mOut.println(" EPTF_MBT_TESTER_PCO.send("+argName+") to vc_lgen;");
- }
- else
- {
- mOut.println(" " + p.name + ".send("+argName+");");
- }
- }
- }
- if (mConfiguration.isDoLogCQInfoMessages())
- {
- mOut.println("// Remove or comment the following "
- + "generated code");
- }
- printLog(LogMessageType.INFO, "Warning: "
- + functionName + ": "
- + "function is not implemented)");
- mOut.resume();
- mOut.println("}");
- }
- }
- mOut.resume();
- } catch (Exception e)
- {
- mOut.print("/* EXCEPTION CAUGHT in dumpTestHarness */");
- mOut.flush();
- mOut.close();
- this.mOut = oldOut;
- throw e;
- }
- }
- // Must close the module block.
- mOut.print("}");
- mOut.endl();
- mOut.flush();
- mOut.close();
- this.mOut = oldOut;
- }
-
- private void dumpDataTypes() throws Exception
- {
- assert (mMetadata != null);
-
- PrettyPrinter oldOut = mOut;
- String msg = null;
- Exception rethrowMe = null;
- if (mConfiguration.getDataTypesFile().getAbsolutePath().equals(""))
- {
- msg = "TTCN-3 backend must be configured with a data type file "
- + "name.";
- }
- else
- {
- try
- {
- mOut = new PrettyPrinter(new BufferedWriter(new FileWriter(
- mConfiguration.getDataTypesFile())));
- } catch (IOException e)
- {
- StringBuffer msgbuf = new StringBuffer();
- msgbuf.append("Failed to open file '");
- msgbuf.append(mConfiguration.getDataTypesFile()
- .getAbsolutePath());
- msgbuf.append("' for writing data types.");
- msg = msgbuf.toString();
- rethrowMe = e;
- }
- }
- if (msg != null)
- {
- if (mNotifications != null)
- {
- mNotifications.notify("error", msg);
- }
- else
- {
- System.err.println(msg);
- }
- mOut = oldOut;
- // Pass the exception forward for proper error handling further
- // up the call stack.
- throw (rethrowMe);
- }
- {
- String[] desc = {
- "This file contains all data type definitions exported from "
- + "the Conformiq " + mConfiguration.getProjectName()
- + "' project.",
- "with '" + mTestsuiteName + "' design configuration.'"};
- String[] remark = {
- "WARNING! This file has been automatically generated using the",
- "Conformiq TTCN-3 scripting backend. DO NOT EDIT." };
- printHeader(mConfiguration.getDataTypesFile(), desc, remark);
- }
- mOut.print("module ");
- mOut.print(Utils.buildModuleNameFromFileName(mConfiguration
- .getDataTypesFile()));
- mOut.endl();
- mOut.print("{");
- mOut.endl();
- mOut.print(mIndent);
- mOut.block();
- try
- {
- if (mConfiguration.isGenerateDataTypes())
- {
- final Set<QMLRecordType> alreadyDumped =
- new HashSet<QMLRecordType>();
- final Queue<QMLRecordType> workList =
- new LinkedList<QMLRecordType>();
- final Set<String> arrays = new HashSet<String>();
-
- for (Port p : externalPorts)
- {
- for (QMLRecordType t : p.records)
- {
- workList.offer(t);
- }
- }
- while (!workList.isEmpty())
- {
- QMLRecordType type = workList.poll();
- if (alreadyDumped.contains(type) ||
- (
- mConfiguration.isEptfEnable() &&
- type.getTypeName().length() >= 5 &&
- type.getTypeName().substring(0, 5).equals("EPTF_")
- )
- )
- {
- // Skipping type generation
- }
- else
- {
- alreadyDumped.add(type);
- if (type instanceof QMLUnionType)
- {
- mOut.print("type union ");
- }
- else
- {
- mOut.print("type record ");
- }
- mOut.println(type.getTypeName());
- mOut.println("{");
- mOut.print(mIndent);
- mOut.block();
- for (int i = 0; i < type.getNumberOfFields(); i++)
- {
- QMLRecordTypeField field = type.getField(i);
- TTCNTypeName v = new TTCNTypeName(workList,
- alreadyDumped, arrays);
- field.getType().accept(v);
- if (field.getType() instanceof QMLRecordType)
- {
- String fieldType =
- Utils.makeValidTTCN3Identifier(
- field.getType().getTypeName());
- if (!alreadyDumped.contains(fieldType))
- {
- workList.offer(
- (QMLRecordType)field.getType());
- }
- }
- assert (!v.getName().equals(""));
- if (i != 0)
- {
- mOut.print(",");
- mOut.endl();
- }
- mOut.print(v.getName());
- mOut.print(" ");
- mOut.print(Utils.makeValidTTCN3Identifier(
- field.getFieldName()));
- if (v.getOptional())
- {
- mOut.print(" optional");
- }
- }
- mOut.resume();
- mOut.endl();
- mOut.print("}");
- mOut.endl();
- }
-
- }
- Iterator<String> it = arrays.iterator();
- while (it.hasNext())
- {
- String x = it.next();
- // TODO: reconsider changing this because now both
- // TTCNTypeName class and this piece of code here has
- // to know how array names are constructed.
- mOut.print("type record of ");
- mOut.print(x);
- mOut.print(" ");
- mOut.print(x);
- mOut.print("Array;");
- mOut.endl();
- }
- }
- /*
- * altstep CQDefaultAlt() runs on SystemType { [] any port.receive {
- * mytimer.stop; setverdict(fail); stop; } [] mytimer.timeout {
- * setverdict(fail); stop; } }
- */
- // Must close the module block.
- mOut.resume();
- mOut.print("}");
- mOut.endl();
- mOut.flush();
- mOut.close();
- mOut = oldOut;
- } catch (Exception e)
- {
- mOut.flush();
- mOut.close();
- mOut = oldOut;
- }
- mNotifications.notify("info", mScripterName
- + ": Generated TTCN-3 type definitions " + "<hyperlink=\""
- + mConfiguration.getDataTypesFile() + "\">"
- + mConfiguration.getDataTypesFile() + "</hyperlink>.");
- }
-
- private void printControl()
- {
- mOut.print("control");
- mOut.endl();
- mOut.print("{");
- mOut.endl();
- mOut.print(mIndent);
- mOut.block();
- for (int i = 1; i <= mTestCaseIndex; i++)
- {
- mOut.print("execute(");
- mOut.print(getTestCaseName(i));
- mOut.print("());");
- mOut.endl();
- }
- mOut.resume();
- mOut.print("}");
- mOut.endl();
- mOut.emptyline();
- }
-
- public void reportError(String msg)
- {
- mNotifications.notify("error", mScripterName + ": " + msg);
- }
-
- public void reportInfo(String msg)
- {
- mNotifications.notify("info", mScripterName + ": " + msg);
- }
-
- private void extractPortsMetaData()
- {
- final String portinfo = "portinfo:";
- String key = mMetadata.getNextKey(portinfo);
- externalPorts = new LinkedList<Port>();
- while (key != null)
- {
- String data = key;
- if (!data.startsWith(portinfo))
- {
- break;
- }
-
- final QMLValue definition = mMetadata.get(key);
- assert (definition != null);
- QMLArray tuple = (QMLArray) definition;
- if (tuple != null)
- {
- Port port = new Port(key, tuple);
- externalPorts.add(port);
- }
- key = mMetadata.getNextKey(key);
- }
- }
-
- private void printSleepFunction()
- {
- Banner banner = new Banner();
- banner.addTag("desc",
- "This function blocks the execution for the specified time");
- banner.addTag("param", "p_duration The specified time in seconds");
- banner.print(mOut);
- mOut.println("function " + mConfiguration.getFunctionsPrefix()
- + mSleepFunctionName + "(float p_duration)");
- mOut.println("{");
- mOut.print(mIndent);
- mOut.block();
- mOut.println("timer t;");
- mOut.println("t.start(p_duration);");
- mOut.println("t.timeout; // Note that any active default behavior "
- + "may interrupt this waiting!");
- mOut.endl();
- mOut.resume();
- mOut.print("}");
- mOut.endl();
- }
-
- private void printAltStepBody()
- {
- mOut.print(mIndent);
- mOut.block();
- if (!mConfiguration.isEptfEnable())
- {
- mOut.print("[] any port.receive");
- mOut.endl();
- mOut.print("{");
- mOut.endl();
- mOut.print(mIndent);
- mOut.block();
- mOut.print(mConfiguration.getTimerName());
- mOut.print(".stop;");
- mOut.endl();
- mOut.print("setverdict(fail);");
- mOut.endl();
- printLog(LogMessageType.DEBUG, mConfiguration.getDefaultName()
- + ": FAIL: Stopping test case after receiving unexpected "
- + "message in default: " + mConfiguration.getDefaultName() + "!");
- if (!mConfiguration.getEndHook().equals(""))
- {
- mOut.print(mConfiguration.getFunctionsPrefix()
- + mConfiguration.getEndHook());
- mOut.print(";");
- mOut.endl();
- }
- mOut.print("stop;");
- mOut.endl();
- mOut.resume();
- mOut.print("}");
- mOut.endl();
- }
- mOut.print("[] ");
- mOut.print(mConfiguration.getTimerName());
- mOut.print(".timeout");
- mOut.endl();
- mOut.print("{");
- mOut.endl();
- mOut.print(mIndent);
- mOut.block();
- mOut.print("setverdict(fail);");
- mOut.endl();
- printLog(LogMessageType.DEBUG, mConfiguration.getDefaultName()
- + ": FAIL: Stopping test case after " + "time out of timer: "
- + mConfiguration.getTimerName() + "!");
- if (!mConfiguration.getEndHook().equals(""))
- {
- mOut.print(mConfiguration.getFunctionsPrefix()
- + mConfiguration.getEndHook());
- mOut.print(";");
- mOut.endl();
- }
-
- mOut.print("stop;");
- mOut.endl();
- mOut.resume();
- mOut.print("}");
- mOut.endl();
- mOut.resume();
- mOut.endl();
- }
-
- private void printTemplates()
- {
- if (!mPostponedTemplates.isEmpty())
- {
- mOut.println("/***** Template definitions generated for "
- + mCrrentTestCaseName + "*****/");
- Iterator<TemplateDefinition> it = mPostponedTemplates.iterator();
- while (it.hasNext())
- {
- final TemplateDefinition def = it.next();
- mOut.print("template ");
- mOut.print(Utils.makeValidTTCN3Identifier(def.getTypeName()));
- mOut.print(" ");
- mOut.print("m_" + def.getTemplateName());
- mOut.ws();
- mOut.print(":=");
- mOut.endl();
- QMLRecord r = def.getRecord();
-
- TemplateDumper t = new TemplateDumper(mOut, mConfiguration
- .isUseFractions());
- r.accept(t);
- mOut.endl();
- mOut.emptyline();
- }
- }
- }
-
- private void prindAltstepDefaultDecl()
- {
- mOut.emptyline();
- Banner banner = new Banner();
- banner.addTag("desc", new String[] {
- "This altstep handles terminating after waiting up to",
- "the maximum response time and receiving any other",
- "than the expected message with setting a fail ",
- "verdict and stopping the test" });
- banner.print(mOut);
- mOut.print("altstep ");
- mOut.print(mConfiguration.getDefaultName());
- mOut.print(" runs on ");
- mOut.print(mConfiguration.getRunsOnName());
- mOut.endl();
- mOut.print("{");
- mOut.endl();
- mOut.print(mIndent);
- mOut.block();
- printAltStepBody();
- mOut.resume();
- mOut.println("}");
- }
-
- private void printDebugModulepars()
- {
- mOut.println("/***** Logging verbosity flags *****/");
- for (DebugMessageType t : DebugMessageType.enabledValues())
- {
- Banner banner = new Banner();
- banner.addTag("desc", t.modeuleparComment);
- banner.print(mOut);
- printModulepar("boolean", t.enablingFlag, "" + t.defaultFlagState);
- }
- }
-
- private void printModulepar(final String type, final String name,
- final String init)
- {
- mOut.println("modulepar " + type + " " + name + " := " + init + ";");
- }
-
- private void printDebugMessageTypeEnum()
- {
- mOut.println("type enumerated " + mDebugMessageTypeEnumName);
- mOut.println("{");
- mOut.print(mIndent);
- mOut.block();
- DebugMessageType[] debugMessageTypes = DebugMessageType.enabledValues();
- for (int i = 0; i < debugMessageTypes.length; i++)
- {
- mOut.print(debugMessageTypes[i].dispatchingEnumItemName);
- if (i != debugMessageTypes.length - 1)
- {
- mOut.print(",");
- }
- mOut.endl();
- }
- mOut.resume();
- mOut.endl();
- mOut.print("}");
- mOut.endl();
- }
-
- private void printDebugFunctionDecl()
- {
- String firstArg = "p_description";
- String secondArg = "p_" + mDebugMessageTypeEnumName;
-
- Banner banner = new Banner();
- List<String> descBody = new LinkedList<String>();
- descBody.add("This function logs target description if the module"
- + " parameter");
- descBody.add("related to the target type is set to true.");
- descBody.add("Module parameters and target type dependencies are"
- + " as follows:");
-
- for (DebugMessageType t : DebugMessageType.enabledValues())
- {
- descBody.add(mIndent + t.enablingFlag
- + " controls logging of targets type "
- + t.dispatchingEnumItemName);
- }
-
- banner.addTag("desc", descBody.toArray(new String[0]));
- banner.addTag("param", new String[] { firstArg
- + " The textual target description to be logged" });
-
- banner.addTag("param ", new String[] { secondArg
- + " The type of target covered by a test" });
- banner.print(mOut);
- mOut.print("function " + mConfiguration.getFunctionsPrefix()
- + mSmartLogCommand + " (");
- mOut.print("charstring " + firstArg + ", " + mDebugMessageTypeEnumName
- + " " + secondArg);
- mOut.print(") runs on " + mConfiguration.getRunsOnName());
- mOut.endl();
- mOut.println("{");
- mOut.print(mIndent);
- mOut.block();
-
- DebugMessageType types[] = DebugMessageType.enabledValues();
- for (int i = 0; i < types.length; i++)
- {
- DebugMessageType t = types[i];
- mOut.print("if ((" + secondArg + " == " + t.dispatchingEnumItemName
- + ")");
- mOut.print(" and ");
- mOut.print(t.enablingFlag + ")");
- mOut.endl();
- mOut.println("{");
- mOut.print(mIndent);
- mOut.block();
- printLogVar(firstArg);
- mOut.resume();
- mOut.println("}");
- if (i != types.length - 1)
- {
- mOut.println("else");
- }
- }
- mOut.resume();
- mOut.print("}");
- mOut.endl();
- }
-
- private void printLog(LogMessageType type, String msg)
- {
- String messageHeader;
- switch (type) {
- case DEBUG:
- if (!mConfiguration.isDoLogCQDEbugMessages())
- {
- return;
- }
- messageHeader = "DEBUG";
- break;
-
- case INFO:
- if (!mConfiguration.isDoLogCQInfoMessages())
- {
- return;
- }
- messageHeader = "INFO";
- break;
- default:
- return;
- }
- mOut.print("log");
- mOut.print("(\"CQ_" + messageHeader + ": " + msg + "\");");
- mOut.endl();
-
- }
-
- private void printLogVar(String varName)
- {
- mOut.print("log");
- mOut.print("(\"CQ_INFO: \" & " + varName + ");");
- mOut.endl();
- }
-
- private void printHeader(File file, String[] desc, String[] remark)
- {
- assert (mOut != null);
-
- mOut.print("/* -*- ttcn-3 -*- */");
- mOut.endl();
- mOut.emptyline();
-
- Banner banner = new Banner();
-
- banner.addTag("file", file.getAbsolutePath());
- banner.addTag("author", "Conformiq TTCN-3 scripting backend");
- banner.addTag("version", new Date().toString());
-
- if (desc != null)
- {
- banner.addTag("desc", desc);
- }
-
- if (remark != null)
- {
- banner.addTag("remark", remark);
- }
- banner.print(mOut);
- }
-
- private void deleteCopies()
- {
- mGeneratedTemplates.clear();
- }
-
- private void printCheckpoints()
- {
- for (CheckPointInfo cp : collectedCheckpoints)
- {
- printCheckPoint(cp);
- }
- }
-
- private void printCheckPoint(CheckPointInfo cp)
- {
- String name = cp.checkpoint.getName();
- for (DebugMessageType t : DebugMessageType.values())
- {
- for (String p : t.checkpointPrefixes)
- {
- if (name.startsWith(p) && t.enabled)
- {
- mOut.print(mConfiguration.getFunctionsPrefix() +
- mSmartLogCommand);
- mOut.print("(\"Covered ");
- mOut.print(Utils.escapeString(name));
- mOut.print("\"");
- mOut.print(", ");
- mOut.print(t.dispatchingEnumItemName);
- mOut.print(");");
- mOut.endl();
- return;
- }
- }
- }
- }
-
- private String recordAndRenderTestCaseName(String testCaseName)
- {
- // Remove whitespace
- StringBuffer rendered = new StringBuffer("tc_");
- for (int i = 0; i < testCaseName.length(); i++)
- {
- // Inverted the logic here to be safer by replacing everything
- // but valid identifier chars with an underscore. According to the
- // spec: "TTCN-3 identifiers are case sensitive and may
- // only contain lowercase letters (a-z) uppercase letters
- // (A-Z) and numeric digits (0-9). Use of the underscore (
- // _ ) symbol is also allowed. An identifier shall begin
- // with a letter (i.e., not a number and not an
- // underscore)."
- char c = testCaseName.substring(i, i + 1).charAt(0);
- // If the original test case name starts with a digit, we want
- // to preserve that but need to prefix the test case name with
- // an underscore.
- if (c >= '0' && c <= '9' && i == 0)
- rendered.append('_');
- if ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z')
- || (c >= '0' && c <= '9') || c == '_')
- rendered.append(c);
- else
- rendered.append('_');
- }
- // Put into test case name list
- mTestCaseNames.add(rendered.toString());
- return rendered.toString();
- }
-
- private String getTestCaseName(int i)
- {
- // Get test case name at index i of the test case list
- return mTestCaseNames.get(i - 1);
- }
-
- private static final String mIndent = " ";
- private static final String mDebugMessageTypeEnumName = "target_type";
- private static final String mSmartLogCommand = "log_target";
- static public final String mScripterName = "TTCN-3 scripter";
- static private final String mSlackVarName = "mp_max_response_time";
- static private final String mOldTimerName = "v_last_wait_timeout";
- static private final String mSleepFunctionName = "sleep";
- private PrettyPrinter mOut;
- private NotificationSink mNotifications;
- private MetaDataDictionary mMetadata;
- private int mTestCaseIndex;
- private int mTemplateIndex;
- private String mCrrentTestCaseName;
- private int mCaseStepIndex;
-
- private TimeStamp mTimeStamp;
- private boolean mIsFirstStep;
- private Map<QMLRecord, Integer> mGeneratedTemplates;
- private Vector<TemplateDefinition> mPostponedTemplates;
- private Vector<String> mTestCaseNames;
-
- private Configuration mConfiguration = new Configuration();
-
- private String mTestsuiteName;
-
- private Queue<Utils.CheckPointInfo> collectedCheckpoints;
-
- enum LogMessageType {
- DEBUG, INFO
- }
-
- public class Port
- {
- public Port(final String key, final QMLArray tuple)
- {
- final StringTokenizer tokenizer = new StringTokenizer(key, ":");
- final String potinfo = tokenizer.nextToken();
- assert potinfo == "portinfo";
- final String dir = tokenizer.nextToken();
- isInbound = !dir.equals("inbound");
- final boolean isOutbound = !dir.equals("outbound");
- assert isInbound != isOutbound;
- final String origname = tokenizer.nextToken();
- name = Utils.makeValidTTCN3Identifier(origname);
- assert !tokenizer.hasMoreElements();
-
- this.records = new LinkedList<QMLRecordType>();
- tuple.accept(new PortDataExtractor());
- }
-
- final List<QMLRecordType> records;
- final boolean isInbound;
- final String name;
-
- private class PortDataExtractor implements QMLValueVisitor
- {
- public PortDataExtractor()
- {
-
- }
-
- @Override
- public void visit(QMLArray x)
- {
- final int size = x.getNumberOfElements();
- for (int i = 0; i < size; i++)
- {
- QMLString portname = (QMLString) x.getValue(i);
- if (portname != null)
- {
- final String origname = portname.getValue();
- QMLRecordType type = mMetadata.getType(origname);
- if (type == null)
- {
- mNotifications.notify("info", "Warning: Nested r" +
- "records in port declarations types are " +
- "not yet supported by the scripter");
- continue;
- }
- records.add(type);
- }
- }
- }
-
- @Override
- public void visit(QMLBoolean b)
- {
- }
-
- @Override
- public void visit(QMLNumber n)
- {
- }
-
- @Override
- public void visit(QMLRecord r)
- {
- }
-
- @Override
- public void visit(QMLString s)
- {
- }
-
- @Override
- public void visit(QMLOptional p)
- {
- }
- }
- }
- private List<Port> externalPorts;
-}
diff --git a/src/Qtronic/TTCNScripter_v421/TTCNTypeName.java b/src/Qtronic/TTCNScripter_v421/TTCNTypeName.java
deleted file mode 100644
index b1c95f6..0000000
--- a/src/Qtronic/TTCNScripter_v421/TTCNTypeName.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/** Copyright (C) Conformiq Software Ltd.
- * All rights reserved.
- *
- * Created Wed Aug 27 16:49:21 2008.
- *
- * @file TTCNTypeName.java
- *
- * @author Conformiq Software Ltd.
- *
- *
- */
-package com.conformiq.adaptation.ttcn;
-
-import java.util.Queue;
-import java.util.Set;
-
-import com.conformiq.qtronic2.QMLArrayType;
-import com.conformiq.qtronic2.QMLBooleanType;
-import com.conformiq.qtronic2.QMLNumberType;
-import com.conformiq.qtronic2.QMLOptionalType;
-import com.conformiq.qtronic2.QMLRecordType;
-import com.conformiq.qtronic2.QMLStringType;
-import com.conformiq.qtronic2.QMLTypeVisitor;
-
-class TTCNTypeName implements QMLTypeVisitor
-{
- public TTCNTypeName(final Queue<QMLRecordType> workList,
- final Set<QMLRecordType> alreadyDumped, final Set<String> arrays)
- {
- this.workList = workList;
- this.alreadyDumped = alreadyDumped;
- this.arrays = arrays;
- optional = false;
- }
-
- public void visit(QMLArrayType a)
- {
- // We first visit the element type to get the correct name
- // for it.
- a.getType().accept(this);
- // arrays.add(a.getType().getTypeName());
- arrays.add(name);
-
- optional = false;
- name += "Array";
- }
-
- public void visit(QMLBooleanType b)
- {
- name = "boolean";
- }
-
- public void visit(QMLNumberType n)
- {
- if (n.isFloat() || n.isDouble())
- {
- name = "float";
- }
- else
- {
- name = "integer";
- }
- }
-
- public void visit(QMLRecordType r)
- {
- if (!alreadyDumped.contains(r))
- {
- workList.offer(r);
- }
- name = r.getTypeName();
- }
-
- public void visit(QMLStringType s)
- {
- name = "charstring";
- }
-
- public void visit(QMLOptionalType p)
- {
- p.getType().accept(this);
- optional = true;
- }
-
- private boolean optional;
-
- public boolean getOptional()
- {
- return optional;
- }
-
- private String name = "";
-
- public String getName()
- {
- return name;
- }
-
- protected Set<String> arrays;
- private final Queue<QMLRecordType> workList;
- private final Set<QMLRecordType> alreadyDumped;
-};
diff --git a/src/Qtronic/TTCNScripter_v421/TemplateDumper.java b/src/Qtronic/TTCNScripter_v421/TemplateDumper.java
deleted file mode 100644
index 5d21e37..0000000
--- a/src/Qtronic/TTCNScripter_v421/TemplateDumper.java
+++ /dev/null
@@ -1,309 +0,0 @@
-/** Copyright (C) Conformiq Software Ltd.
- * All rights reserved.
- *
- * Created Wed Aug 27 16:49:21 2008.
- *
- * @file TemplateDumper.java
- *
- * @author Conformiq Software Ltd.
- *
- *
- */
-package com.conformiq.adaptation.ttcn;
-
-import java.math.BigDecimal;
-
-import com.conformiq.qtronic2.QMLArray;
-import com.conformiq.qtronic2.QMLArrayType;
-import com.conformiq.qtronic2.QMLBoolean;
-import com.conformiq.qtronic2.QMLBooleanType;
-import com.conformiq.qtronic2.QMLNumber;
-import com.conformiq.qtronic2.QMLNumberType;
-import com.conformiq.qtronic2.QMLOptional;
-import com.conformiq.qtronic2.QMLOptionalType;
-import com.conformiq.qtronic2.QMLRecord;
-import com.conformiq.qtronic2.QMLRecordField;
-import com.conformiq.qtronic2.QMLRecordType;
-import com.conformiq.qtronic2.QMLString;
-import com.conformiq.qtronic2.QMLStringType;
-import com.conformiq.qtronic2.QMLType;
-import com.conformiq.qtronic2.QMLTypeVisitor;
-import com.conformiq.qtronic2.QMLUnion;
-import com.conformiq.qtronic2.QMLValue;
-import com.conformiq.qtronic2.QMLValueVisitor;
-
-public class TemplateDumper implements QMLValueVisitor
-{
- private PrettyPrinter out;
- private boolean mUseFractions;
- private boolean mEsxpectFloat;
-
- public TemplateDumper(PrettyPrinter out, boolean isUseFractions)
- {
- this.out = out;
- this.mUseFractions = isUseFractions;
- }
-
- @Override
- public void visit(QMLRecord r)
- {
- if (r == null)
- {
- out.print("{ /* null record */ }");
- return;
- }
- /*
- * TODO make a dedicated method in the visitor interface for QMLUnion
- */
- if (r instanceof QMLUnion)
- {
- QMLUnion u = (QMLUnion) r;
- visit(u);
- return;
- }
- out.print("{");
- out.endl();
- out.print(" ");
- out.block();
- for (int i = 0; i < r.getNumberOfFields(); i++)
- {
- if (i > 0)
- {
- out.print(",");
- out.endl();
- }
- QMLRecordField f = r.getField(i);
- out.print(Utils.makeValidTTCN3Identifier(f.getName()));
- out.print(" := ");
- QMLValue v = f.getValue();
- if (v != null)
- {
- mEsxpectFloat =
- FloatTypeDetector.isFloatType(f.getFieldType().getType());
- v.accept(this);
- }
- else
- out.print("{ /* NULL */ }");
- }
-
- out.endl();
- out.resume();
- out.print("}");
- }
-
- public void visit(QMLUnion u)
- {
- if (u == null)
- {
- out.print("{ /* null union */ }");
- return;
- }
-
- out.print("{");
- out.endl();
- out.print(" ");
- out.block();
- for (int i = 0; i < u.getNumberOfFields(); i++)
- {
- if (i > 0)
- {
- out.print(",");
- out.endl();
- }
- QMLRecordField f = u.getField(i);
- out.print(Utils.makeValidTTCN3Identifier(f.getName()));
- out.print(" := ");
- QMLValue v = f.getValue();
- if (v != null)
- {
- mEsxpectFloat =
- FloatTypeDetector.isFloatType(f.getFieldType().getType());
- v.accept(this);
- }
- else
- out.print("{ /* NULL */ }");
- }
-
- out.endl();
- out.resume();
- out.print("}");
- }
-
- @Override
- public void visit(QMLString x)
- {
- assert (x != null);
- String v = x.getValue();
- out.print("\"");
- for (int i = 0; i < v.length(); i++)
- {
- switch (v.charAt(i)) {
- case '\n':
- out.print("\\n");
- break;
- case '\r':
- out.print("\\r");
- break;
- case '\t':
- out.print("\\t");
- break;
- case '\"':
- out.print("\"\"");
- break;
- case '\\':
- if ( i + 1 < v.length() && v.charAt(i + 1) != '"')
- {
- out.print("\\");
- }
- // PASS THROUGH
- default:
- out.print(v.charAt(i));
- break;
- }
- }
- out.print("\"");
- }
-
- @Override
- public void visit(QMLBoolean x)
- {
- assert (x != null);
- out.print((x.getValue() ? "true" : "false"));
- }
-
- @Override
- public void visit(QMLNumber x)
- {
- assert (x != null);
- if (x.isBigInteger())
- {
- out.print(x.getBigInteger());
- if (mEsxpectFloat)
- {
- out.print(".0");
- }
- }
- else
- {
-
- if (!mUseFractions)
- {
- BigDecimal num = new BigDecimal(x.getNumerator()).setScale(20);
- BigDecimal den = new BigDecimal(x.getDenominator());
- out.print("" + num.divide(den, BigDecimal.ROUND_UP));
- }
- else
- {
- BigDecimal num = new BigDecimal(x.getNumerator());
- BigDecimal den = new BigDecimal(x.getDenominator());
- out.print("" + num + ".0 / " + den + ".0");
- }
- }
- }
-
- @Override
- public void visit(QMLArray array)
- {
- if (array == null)
- {
- out.print("{ /* null */ }");
- return;
- }
-
- out.print("{");
- out.endl();
- out.print(" ");
- out.block();
- QMLArrayType arrayType= (QMLArrayType)array.getType();
- mEsxpectFloat = FloatTypeDetector.isFloatType(arrayType.getType());
- for (int i = 0; i < array.getNumberOfElements(); i++)
- {
- if (i > 0)
- {
- out.print(",");
- out.endl();
- }
- QMLValue v = array.getValue(i);
- if (v != null)
- v.accept(this);
- else
- out.print("{ /* null */ }");
- }
-
- out.endl();
- out.resume();
- out.print("}");
- }
-
- @Override
- public void visit(QMLOptional o)
- {
- QMLValue v = o.getValue();
- if (v == null)
- {
- out.print("omit");
- }
- else
- {
- v.accept(this);
- }
- }
-
- private static class FloatTypeDetector implements QMLTypeVisitor
- {
- private boolean mREsult;
-
- public static boolean isFloatType(QMLType type)
- {
- FloatTypeDetector dtector = new FloatTypeDetector();
- type.accept(dtector);
- return dtector.mREsult;
- }
-
- @Override
- public void visit(QMLArrayType arg0) {
- mREsult = false;
-
- }
-
- @Override
- public void visit(QMLBooleanType arg0) {
- mREsult = false;
-
- }
-
- @Override
- public void visit(QMLNumberType arg0) {
- if (arg0.isFloat())
- {
- mREsult = true;
- }
- else
- {
- mREsult = false;
- }
-
- }
-
- @Override
- public void visit(QMLRecordType arg0) {
- mREsult = false;
-
- }
-
- @Override
- public void visit(QMLStringType arg0) {
- mREsult = false;
-
- }
-
- @Override
- public void visit(QMLOptionalType arg0) {
- mREsult = isFloatType(arg0.getType());
-
- }
-
- }
-
-
-}
diff --git a/src/Qtronic/TTCNScripter_v421/Utils.java b/src/Qtronic/TTCNScripter_v421/Utils.java
deleted file mode 100644
index fc3dc7f..0000000
--- a/src/Qtronic/TTCNScripter_v421/Utils.java
+++ /dev/null
@@ -1,312 +0,0 @@
-/** Copyright (C) Conformiq Software Ltd.
- * All rights reserved.
- *
- * Created Wed Aug 27 16:49:21 2008.
- *
- * @file Utils.java
- *
- * @author Conformiq Software Ltd.
- *
- *
- */
-package com.conformiq.adaptation.ttcn;
-
-import java.io.File;
-import java.util.LinkedList;
-import java.util.List;
-
-import com.conformiq.qtronic2.Checkpoint;
-import com.conformiq.qtronic2.QMLRecord;
-import com.conformiq.qtronic2.TimeStamp;
-
-public class Utils
-{
-
- static class TemplateDefinition
- {
- public TemplateDefinition(final String type, final String templatename,
- QMLRecord record)
- {
- this.typeName = type;
- this.templateName = templatename;
- this.record = record;
- }
-
- private String typeName;
- private String templateName;
-
- public String getTypeName()
- {
- return typeName;
- }
-
- public String getTemplateName()
- {
- return templateName;
- }
-
- private QMLRecord record;
-
- public QMLRecord getRecord()
- {
- return record;
- }
- }
-
- static class CheckPointInfo
- {
- public CheckPointInfo(final Checkpoint checkpoint, final int status,
- final TimeStamp ts)
- {
- this.checkpoint = checkpoint;
- this.status = status;
- this.ts = ts;
- }
-
- public final Checkpoint checkpoint;
- public final int status;
- public final TimeStamp ts;
- }
-
- public static String buildModuleNameFromFileName(File file)
- {
- if (file.isDirectory())
- {
- return null;
- }
- String fileName = file.getName();
- int dot = fileName.lastIndexOf(".");
- if (dot > -1)
- {
- fileName = fileName.substring(0, dot);
- }
- if (fileName.length() == 0)
- {
- return null;
- }
- return makeValidTTCN3Identifier(fileName);
- }
-
- public static String makeValidTTCN3Identifier(String id)
- {
- /* "Identifier ::= <alpha> (<alnum> | <underscore>)*" */
- StringBuffer valid_ = new StringBuffer();
- final int size = id.length();
- if (size == 0)
- {
- System.err
- .println("Warning: Empty string is not a valid TTCN3 identifier.");
- return id;
- }
- if (isalpha(id.charAt(0)))
- {
- valid_.append(id.substring(0, 1));
- }
- else
- {
- valid_.append("X" + id.substring(0, 1));
- }
- for (int i = 1; i < size; i++)
- {
- if (!isalnum(id.charAt(i)) && id.charAt(i) != '_')
- {
- valid_.append("_");
- }
- else
- {
- valid_.append(id.charAt(i));
- }
- }
- /* Postfix TTCN3 reserved words with '_' */
- String valid = valid_.toString();
- if (valid.equals("action") || valid.equals("fail")
- || valid.equals("named") || valid.equals("self")
- || valid.equals("activate") || valid.equals("false")
- || valid.equals("none") || valid.equals("send")
- || valid.equals("address") || valid.equals("float")
- || valid.equals("nonrecursive") || valid.equals("sender")
- || valid.equals("all") || valid.equals("for")
- || valid.equals("not") || valid.equals("set")
- || valid.equals("alt") || valid.equals("from")
- || valid.equals("not4b") || valid.equals("signature")
- || valid.equals("and") || valid.equals("function")
- || valid.equals("nowait") || valid.equals("start")
- || valid.equals("and4b") || valid.equals("null")
- || valid.equals("stop") || valid.equals("any")
- || valid.equals("get") || valid.equals("sut")
- || valid.equals("getcall") || valid.equals("objid")
- || valid.equals("system") || valid.equals("bitstring")
- || valid.equals("getreply") || valid.equals("octetstring")
- || valid.equals("boolean") || valid.equals("goto")
- || valid.equals("of") || valid.equals("template")
- || valid.equals("group") || valid.equals("omit")
- || valid.equals("testcase") || valid.equals("call")
- || valid.equals("on") || valid.equals("timeout")
- || valid.equals("catch") || valid.equals("hexstring")
- || valid.equals("optional") || valid.equals("timer")
- || valid.equals("char") || valid.equals("or") || valid.equals("to")
- || valid.equals("charstring") || valid.equals("if")
- || valid.equals("or4b") || valid.equals("trigger")
- || valid.equals("check") || valid.equals("ifpresent")
- || valid.equals("out") || valid.equals("true")
- || valid.equals("clear") || valid.equals("import")
- || valid.equals("override") || valid.equals("type")
- || valid.equals("complement") || valid.equals("in")
- || valid.equals("component") || valid.equals("inconc")
- || valid.equals("param") || valid.equals("union")
- || valid.equals("connect") || valid.equals("infinity")
- || valid.equals("pass") || valid.equals("universal")
- || valid.equals("const") || valid.equals("inout")
- || valid.equals("pattern") || valid.equals("unmap")
- || valid.equals("control") || valid.equals("integer")
- || valid.equals("port") || valid.equals("create")
- || valid.equals("interleave") || valid.equals("procedure")
- || valid.equals("value") || valid.equals("valueof")
- || valid.equals("deactivate") || valid.equals("label")
- || valid.equals("raise") || valid.equals("var")
- || valid.equals("disconnect") || valid.equals("language")
- || valid.equals("read") || valid.equals("verdict")
- || valid.equals("display") || valid.equals("length")
- || valid.equals("receive") || valid.equals("verdicttype")
- || valid.equals("do") || valid.equals("log")
- || valid.equals("record") || valid.equals("done")
- || valid.equals("rem") || valid.equals("while")
- || valid.equals("map") || valid.equals("repeat")
- || valid.equals("with") || valid.equals("else")
- || valid.equals("match") || valid.equals("reply")
- || valid.equals("encode") || valid.equals("message")
- || valid.equals("return") || valid.equals("xor")
- || valid.equals("enumerated") || valid.equals("mixed")
- || valid.equals("running") || valid.equals("xor4b")
- || valid.equals("error") || valid.equals("mod")
- || valid.equals("runs") || valid.equals("exception")
- || valid.equals("modifies") || valid.equals("execute")
- || valid.equals("module") || valid.equals("expand")
- || valid.equals("mtc") || valid.equals("extension")
- || valid.equals("external") ||
-
- /* special identifiers reserved for the predefined functions */
- valid.equals("int2char") || valid.equals("char2int")
- || valid.equals("int2unichar") || valid.equals("unichar2int")
- || valid.equals("bit2int") || valid.equals("hex2int")
- || valid.equals("int2bit") || valid.equals("int2hex")
- || valid.equals("int2oct") || valid.equals("int2str")
- || valid.equals("oct2int") || valid.equals("str2int")
- || valid.equals("lengthof") || valid.equals("sizeof")
- || valid.equals("ischosen") || valid.equals("ispresent"))
- {
- return valid + "_";
- }
- return valid;
- }
-
- private static boolean isalpha(char c)
- {
- return (('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z'));
- }
-
- private static boolean isalnum(char c)
- {
- return (isalpha(c) || ('0' <= c && c <= '9'));
- }
-
- static public String escapeString(String s)
- {
- // Checkpoint strings from the model must be escaped by "backslashing"
- // double quotations and backslashes themselves.
- StringBuffer escaped = new StringBuffer();
- final int size = s.length();
- if (size == 0)
- return s;
- for (int i = 0; i < size; i++)
- {
- if (s.charAt(i) == '\\')
- {
- escaped.append("\\\\");
- }
- else if (s.charAt(i) == '"')
- {
- escaped.append("\\\"");
- }
- else
- {
- escaped.append(s.charAt(i));
- }
- }
- return escaped.toString();
- }
-
- public static boolean EqualTimeStamps(TimeStamp ts1, TimeStamp ts2)
- {
- return (ts1.seconds == ts2.seconds)
- & (ts1.nanoseconds == ts2.nanoseconds);
- }
-
- public static String TimeStampToString(TimeStamp ts)
- {
- return ts.seconds + "." + ts.nanoseconds;
- }
-
- public static class Tag
- {
- public String getmTagName()
- {
- return mTagName;
- }
-
- public String[] getmBody()
- {
- return mBody;
- }
-
- private final String mTagName;
- private final String[] mBody;
-
- Tag (String tagName, String[] body)
- {
- this.mTagName = tagName;
- this.mBody = body;
- }
- }
-
- public static class Banner
- {
- private List<Tag> mLines;
- Banner()
- {
- mLines = new LinkedList<Tag>();
- }
- public void addTag(String tagName, String[] tagBody)
- {
- mLines.add(new Tag(tagName, tagBody));
- }
-
- public void addTag(String tagName, String tagBody)
- {
- this.addTag(tagName, new String[] {tagBody});
- }
-
- void print (PrettyPrinter out)
- {
- out.println("/**");
- out.print("*");
- out.block();
- for (Tag t : mLines)
- {
- out.println(" @" + t.getmTagName());
- out.print(" ");
- out.block();
- for (String line : t.mBody)
- {
- out.println(line);
- }
- out.resume();
- }
- out.resume();
- out.println("*/");
- }
-
- }
-
-
-}
diff --git a/src/Qtronic/model/EPTF_MBT_Framework.java b/src/Qtronic/model/EPTF_MBT_Framework.java
deleted file mode 100644
index bd2b266..0000000
--- a/src/Qtronic/model/EPTF_MBT_Framework.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/* ====================================================
- * MBT Applib API
- */
-
-record EPTF_MBT_TestStepRequest
-{
- public String stepName;
- int[] stepArgs;
- EPTF_FsmAddr addr;
- int lock;
-}
-
-EPTF_MBT_TestStepRequest c_EPTF_MBT_TestStepRequest_empty()
-{
- EPTF_MBT_TestStepRequest ret;
- ret.stepName = "";
- ret.stepArgs = {};
- ret.addr = c_EPTF_FsmAddr_empty();
- ret.lock = -1;
- return ret;
-};
-
-record EPTF_MBT_TestStepResponse
-{
- public String bName;
- public String iName;
- EPTF_FsmAddr addr;
-}
-
-EPTF_MBT_TestStepResponse c_EPTF_MBT_TestStepResponse_empty()
-{
- EPTF_MBT_TestStepResponse ret;
- ret.bName = "";
- ret.iName = "";
- ret.addr = c_EPTF_FsmAddr_empty();
- return ret;
-};
-
-record EPTF_FsmAddr
-{
- public String entityGroupName;
- public int eIdx;
- public int fIdx;
-}
-
-EPTF_FsmAddr c_EPTF_FsmAddr_empty()
-{
- EPTF_FsmAddr ret;
- ret.entityGroupName = "MBT_EntityType";
- ret.eIdx = 0;
- ret.fIdx = 0;
- return ret;
-};
-
-record EPTF_IntegerList {}
diff --git a/src/Qtronic/model/EPTF_MBT_SIP_Applib.java b/src/Qtronic/model/EPTF_MBT_SIP_Applib.java
deleted file mode 100644
index 8df3b39..0000000
--- a/src/Qtronic/model/EPTF_MBT_SIP_Applib.java
+++ /dev/null
@@ -1,30 +0,0 @@
-String c_SIP_Behavior = "Behavior_SIP";
-
-// Events
-String c_SIP_eventName_INVITE = "INVITE";
-String c_SIP_eventName_CANCEL = "CANCEL";
-String c_SIP_eventName_ACK = "ACK";
-String c_SIP_eventName_BYE = "BYE";
-String c_SIP_eventName_RetransmittedRequest = "Retransmitted request";
-
-// TestSteps
-String c_SIP_stepFunction_createResponse = "SIPAppLib: StepFunction_createResponse";
-String c_SIP_stepFunction_createBYE = "SIPAppLib: StepFunction_createBYE";
-String c_SIP_stepFunction_init = "SIPAppLib: StepFunction_init";
-String c_SIP_stepFunction_handleINVITE = "SIPAppLib: StepFunction_handleINVITE";
-
-// Methods
-int c_SIP_Method_CANCEL = 2;
-int c_SIP_Method_INVITE = 4;
-
-int f_EPTF_SIP_mapAnswerCode2SipTemplateCode(int p_answerCode)
-{
- if (p_answerCode == 180)
- return 1;
- else if (p_answerCode == 486)
- return 37;
- else if (p_answerCode == 200)
- return 5;
- else if (p_answerCode == 487)
- return 38;
-}
\ No newline at end of file