Skip to content
Snippets Groups Projects
Commit 86d98891 authored by Elemer Lelik's avatar Elemer Lelik
Browse files

First code commit

parent e3374a92
No related branches found
No related tags found
No related merge requests found
<?xml version="1.0"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<!-- The only two possible root elements are methodResponse and
methodCall so these are the only two I use a top-level
declaration for. -->
<xsd:element name="methodCall">
<xsd:complexType>
<xsd:all>
<xsd:element name="methodName">
<xsd:simpleType>
<xsd:restriction base="ASCIIString">
<xsd:pattern value="([A-Za-z0-9]|/|\.|:|_)*" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="params" minOccurs="0" maxOccurs="1">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="param" type="ParamType"
minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:all>
</xsd:complexType>
</xsd:element>
<xsd:element name="methodResponse">
<xsd:complexType>
<xsd:choice>
<xsd:element name="params">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="param" type="ParamType"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="fault">
<!-- What can appear inside a fault is very restricted -->
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="struct">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="member"
type="MemberType">
</xsd:element>
<xsd:element name="member"
type="MemberType">
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
<xsd:complexType name="ParamType">
<xsd:sequence>
<xsd:element name="value" type="ValueType"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="ValueType" mixed="true">
<!-- I need to figure out how to say that this
is either a simple xsd:string type or that
it contains one of these elements; but that otherwise
it does not have mixed content -->
<xsd:choice>
<xsd:element name="i4" type="xsd:int"/>
<xsd:element name="int" type="xsd:int"/>
<xsd:element name="string" type="ASCIIString"/>
<xsd:element name="double" type="xsd:decimal"/>
<xsd:element name="Base64" type="xsd:base64Binary"/>
<xsd:element name="boolean" type="NumericBoolean"/>
<xsd:element name="dateTime.iso8601" type="xsd:dateTime"/>
<xsd:element name="array" type="ArrayType"/>
<xsd:element name="struct" type="StructType"/>
</xsd:choice>
</xsd:complexType>
<xsd:complexType name="StructType">
<xsd:sequence>
<xsd:element name="member" type="MemberType"
maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="MemberType">
<xsd:sequence>
<xsd:element name="name" type="xsd:string" />
<xsd:element name="value" type="ValueType"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="ArrayType">
<xsd:sequence>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="ValueType"
minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
<xsd:simpleType name="ASCIIString">
<xsd:restriction base="xsd:string">
<xsd:pattern value="([ -~]|\n|\r|\t)*" />
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="NumericBoolean">
<xsd:restriction base="xsd:boolean">
<xsd:pattern value="0|1" />
</xsd:restriction>
</xsd:simpleType>
</xsd:schema>
/*******************************************************************************
* Copyright (c) 2000-2018 Ericsson Telecom AB
*
* XSD to TTCN-3 Translator version: CRL 113 200/6 R4B
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html
*******************************************************************************/
//
// File: XML_RPC.ttcn
// Description:
// References:
// Rev:
// Prodnr:
// Updated: Thu Aug 2 13:51:04 2018
// Contact: http://ttcn.ericsson.se
//
////////////////////////////////////////////////////////////////////////////////
// Generated from file(s):
// - XML-RPC.xsd
// /* xml version = "1.0" */
// /* targetnamespace = "NoTargetNamespace" */
////////////////////////////////////////////////////////////////////////////////
// Modification header(s):
//-----------------------------------------------------------------------------
// Modified by:
// Modification date:
// Description:
// Modification contact:
//------------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
module XML_RPC {
import from XSD all;
external function enc_MethodCall(in MethodCall pdu) return octetstring
with { extension "prototype (convert) encode(XER:XER_EXTENDED)" }
external function dec_MethodCall(in octetstring stream) return MethodCall
with { extension "prototype (convert) decode(XER:XER_EXTENDED)" }
external function enc_MethodResponse(in MethodResponse pdu) return octetstring
with { extension "prototype (convert) encode(XER:XER_EXTENDED)" }
external function dec_MethodResponse(in octetstring stream) return MethodResponse
with { extension "prototype (convert) decode(XER:XER_EXTENDED)" }
type record MethodCall
{
record of enumerated {
methodName,
params
} order,
XSD.String methodName (pattern "([A-Za-z0-9]|/|.|:|_)*"),
record {
record of ParamType param_list
} params optional
}
with {
variant "name as uncapitalized";
variant "useOrder";
variant "element";
variant (params.param_list) "untagged";
variant (params.param_list[-]) "name as 'param'";
};
type record MethodResponse
{
union {
record {
ParamType param_
} params,
/* What can appear inside a fault is very restricted */
record {
record {
record {
MemberType member,
MemberType member_1
} struct
} value_
} fault
} choice
}
with {
variant "name as uncapitalized";
variant "element";
variant (choice) "untagged";
variant (choice.params.param_) "name as 'param'";
variant (choice.fault.value_) "name as 'value'";
variant (choice.fault.value_.struct.member_1) "name as 'member'";
};
type record ParamType
{
ValueType value_
}
with {
variant (value_) "name as 'value'";
};
type record ValueType
{
record of XSD.String embed_values,
union {
XSD.Int i4,
// XSD.Int int,
ASCIIString string,
XSD.Decimal double,
XSD.Base64Binary base64,
NumericBoolean boolean_,
XSD.DateTime dateTime_iso8601,
ArrayType array,
StructType struct
} choice
}
with {
variant "embedValues";
variant (choice) "untagged";
variant (choice.base64) "name as capitalized";
variant (choice.boolean_) "name as 'boolean'";
variant (choice.dateTime_iso8601) "name as 'dateTime.iso8601'";
};
type record StructType
{
record length(1 .. infinity) of MemberType member_list
}
with {
variant (member_list) "untagged";
variant (member_list[-]) "name as 'member'";
};
type record MemberType
{
XSD.String name,
ValueType value_
}
with {
variant (value_) "name as 'value'";
};
type record ArrayType
{
record {
record of ValueType value_list
} data
}
with {
variant (data.value_list) "untagged";
variant (data.value_list[-]) "name as 'value'";
};
type XSD.String ASCIIString (pattern "([ -~]|\n|\r|\t)*");
type XSD.Boolean NumericBoolean;
//with {
//variant "text 'true' as '1'";
//variant "text 'false' as '0'";
//};
}
with {
encode "XML";
variant "controlNamespace 'http://www.w3.org/2001/XMLSchema-instance' prefix 'xsi'";
}
/*******************************************************************************
* Copyright (c) 2000-2018 Ericsson Telecom AB
*
* XSD to TTCN-3 Translator version: CRL 113 200/6 R4B
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html
*******************************************************************************/
//
// File: XML_RPC_test.ttcn
// Description: XML_RPC encoding-decoding test
// Rev: <RnXnn>
// Prodnr:
// Updated:
// Contact:
///////////////////////////////////////////////
module XML_RPC_test {
import from XML_RPC all;
type component Test_CT {
}
template MethodResponse t_GetVoucherHistoryResponse := {
choice := {
params := {
param_ := {
value_ := {
embed_values:={"",""},
choice := {
struct := {
member_list := {
{
name := "responseCode",
value_ := {
embed_values:={"",""},
choice := {
i4 := 0
}
}
},
{
name := "agent",
value_ := {
embed_values:={"",""},
choice := {
string := "BZ101"
}
}
},
{
name := "batchId",
value_ := {
embed_values:={"",""},
choice := {
string := "ABC1234"
}
}
},
{
name := "currency",
value_ := {
embed_values:={"",""},
choice := {
string := "EUR"
}
}
},
{
name := "expiryDate",
value_ := {
embed_values:={"",""},
choice := {
dateTime_iso8601 := "2003-07-17T00:00:00"
}
}
},
{
name := "voucherGroup",
value_ := {
embed_values:={"",""},
choice := {
string := "A1"
}
}
},
{
name := "state",
value_ := {
embed_values:={"",""},
choice := {
i4 := 2
}
}
},
{
name := "value",
value_ := {
embed_values:={"",""},
choice := {
string := "10000"
}
}
},
{
name := "extensionText1",
value_ := {
embed_values:={"",""},
choice := {
string := "VoucherType=1,Market=Europe"
}
}
},
{
name := "extensionText2",
value_ := {
embed_values:={"",""},
choice := {
string := "19990817T00:00:00"
}
}
},
{
name := "extensionText3",
value_ := {
embed_values:={"",""},
choice := {
string := "42"
}
}
},
{
name := "transactionRecords",
value_ := {
embed_values:={"",""},
choice := {
array := {
data := {
value_list := {
{
embed_values:={"",""},
choice := {
struct := {
member_list :=
{
{
name := "operatorId",
value_ := {
embed_values:={"",""},
choice := {
string := "administrator"
}
}
},
{
name := "newState",
value_ := {
embed_values:={"",""},
choice := {
i4 := 5
}
}
},
{
name := "timestamp",
value_ := {
embed_values:={"",""},
choice := {
dateTime_iso8601 := "2002-10-09T02:39:55"
}
}
}
}
}
}
},
{
embed_values:={"",""},
choice := {
struct := {
member_list :=
{
{
name := "operatorId",
value_ := {
embed_values:={"",""},
choice := {
string := "administrator"
}
}
},
{
name := "newState",
value_ := {
embed_values:={"",""},
choice := {
i4 := 0
}
}
},
{
name := "timestamp",
value_ := {
embed_values:={"",""},
choice := {
dateTime_iso8601 := "2002-10-10T01:39:54"
}
}
}
}
}
}}
,
{
embed_values:={"",""},
choice := {
struct := {
member_list :=
{
{
name := "subscriberId",
value_ := {
embed_values:={"",""},
choice := {
string := "706691616"
}
}
},
{
name := "timestamp",
value_ := {
embed_values:={"",""},
choice := {
dateTime_iso8601 := "2002-10-10T01:39:54"
}
}
},
{
name := "transactionId",
value_ := {
embed_values:={"",""},
choice := {
string := "123456"
}
}
},
{
name := "newState", // newState put at the end
value_ := {
embed_values:={"",""},
choice := {
// to test whether SET OF works
i4 := 1
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
template MethodResponse t_GetVoucherHistoryResponse1 := {
choice := {
params := {
param_ := {
value_ := {
embed_values:={"",""},
choice:= {
struct := {
member_list := {
{
name := "responseCode",
value_ := {
embed_values:={"",""},
choice:= {
i4 := 0
}
}
}
}
}
}
}
}
}
}
}
template MethodCall t_DeleteTask_SingleParam :=
{
order:={methodName, params},
methodName := "DeleteTask",
params := {
param_list := {{
value_ := {
embed_values:={"",""},
choice := {
struct := {
member_list := {
{
name := "taskId",
value_ := {
embed_values:={"",""},
choice:= {
i4 := 44
}
}
}}
}
}
}
}
}
}
}
template MethodCall/*_MultipleParams */ t_GetGenerateVoucherUsageReportTaskInfo :=
{
order:={methodName, params},
methodName := "GetGenerateVoucherUsageReportTaskInfo",
params := {
param_list := {
{
value_ := {
embed_values:={"",""},
choice := {
struct := {
member_list := { {
name := "originNodeType",
value_ := {
embed_values:={"",""},
choice:= {
string := "IVR"
}}
}}
}
}
}
}
}
}
}
template MethodCall t_GeneralUpdate_SingleParam := {
order:={methodName, params},
methodName := "GeneralUpdate",
params := {
param_list := { {
value_ := {
embed_values:={"",""},
choice := {
struct := {
member_list := {
{
name := "originNodeType",
value_ := {
embed_values:={"",""},
choice:= {
string := "IVR"
}}
},
{
name := "originHostName",
value_ := {
embed_values:={"",""},
choice:= {
string := "ws00824"
}}
},
{
name := "originTransactionID",
value_ := {
embed_values:={"",""},
choice:= {
string := "31349729532086766516"
}}
},
{
name := "originTimeStamp",
value_ := {
embed_values:={"",""},
choice:= {
dateTime_iso8601 := "2012-02-06T13:19:00"
}
}
},
{
name := "subscriberNumber",
value_ := {
embed_values:={"",""},
choice:= {
string := "4558024013"
}}
},
{
name := "transactionCurrency",
value_ := {
embed_values:={"",""},
choice:= {
string := "SEK"
}}
},
{
name := "offerUpdateInformationList",
value_ := {
embed_values:={"",""},
choice:= {
array := {
data := {
value_list := {
{
embed_values:={"",""},
choice:= {
struct := {
member_list := {
{
name := "offerID",
value_ := {
embed_values:={"",""},
choice:= {
i4 := 20// int := 20
}
}
},
{
name := "startDate",
value_ := {
embed_values:={"",""},
choice:= {
dateTime_iso8601 := "2012-02-07T12:00:00+00:00"
}
}
},
{
name := "expiryDate",
value_ := {
embed_values:={"",""},
choice:= {
dateTime_iso8601 := "2012-02-10T12:00:00+00:00"
}
}
},
{
name := "offerType",
value_ := {
embed_values:={"",""},
choice:= {
i4 := 0// int := 0
}
}
},
{
name := "dedicatedAccountUpdateInformation",
value_ := {
embed_values:={"",""},
choice:= {
array := {
data := {
value_list := {
{
embed_values:={"",""},
choice:= {
struct := {
member_list := {
{
name := "dedicatedAccountID",
value_ := {
embed_values:={"",""},
choice:= {
i4 := 1// int := 1
}
}
},
{
name := "dedicatedAccountValueNew",
value_ := {
embed_values:={"",""},
choice:= {
string := "100"
}
}
},
{
name := "dedicatedAccountUnitType",
value_ := {
embed_values:={"",""},
choice:= {
i4 := 1// int := 1
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
testcase tc_TestEncDec() runs on Test_CT {
log (t_GetVoucherHistoryResponse);
var MethodResponse pdu := valueof(t_GetVoucherHistoryResponse);
var octetstring encodedPdu;
encodedPdu := enc_MethodResponse(pdu);
log(encodedPdu);
log(dec_MethodResponse(encodedPdu))
if (match(dec_MethodResponse(encodedPdu), t_GetVoucherHistoryResponse)) {
setverdict(pass);
} else {
setverdict(fail);
}
log (t_DeleteTask_SingleParam);
var MethodCall pdu2 := valueof(t_DeleteTask_SingleParam);
var octetstring encodedPdu2;
encodedPdu2 := enc_MethodCall(pdu2);
log(encodedPdu2);
log(dec_MethodCall(encodedPdu2))
if (match(dec_MethodCall(encodedPdu2), t_DeleteTask_SingleParam)) {
setverdict(pass);
} else {
setverdict(fail);
}
log (t_GetGenerateVoucherUsageReportTaskInfo);
var MethodCall pdu3 := valueof(t_GetGenerateVoucherUsageReportTaskInfo);
var octetstring encodedPdu3;
encodedPdu3 := enc_MethodCall(pdu3);
log(encodedPdu3);
log(dec_MethodCall(encodedPdu3))
if (match(dec_MethodCall(encodedPdu3), t_GetGenerateVoucherUsageReportTaskInfo)) {
setverdict(pass);
} else {
setverdict(fail);
}
log (t_GeneralUpdate_SingleParam );
var MethodCall pdu4 := valueof(t_GeneralUpdate_SingleParam );
var octetstring encodedPdu4;
encodedPdu4 := enc_MethodCall(pdu4);
log(encodedPdu4);
log(dec_MethodCall(encodedPdu4))
if (match(dec_MethodCall(encodedPdu4), t_GeneralUpdate_SingleParam )) {
setverdict(pass);
} else {
setverdict(fail);
}
}
control {
execute(tc_TestEncDec())
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment