Commit fdb34e70 authored by BenceJanosSzabo's avatar BenceJanosSzabo
Browse files

xsd2ttcn: translation correction when minOccurs/maxOccurs and...


 xsd2ttcn: translation correction when minOccurs/maxOccurs and minLength/maxLength used to lists (Bug 507352)

Change-Id: Ib80e3174b2a42b57b736d416003a5bca0bc7878d
Signed-off-by: default avatarBenceJanosSzabo <bence.janos.szabo@ericsson.com>
parent 7f3b23c6
/*******************************************************************************
* Copyright (c) 2000-2016 Ericsson Telecom AB
*
* XSD to TTCN-3 Translator version: CRL 113 200/6 R0A
*
* 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
*
* Contributors:
* Szabo, Bence Janos
*
*******************************************************************************/
//
// File: http_www_example_org_list_minmaxoccurs_e.ttcn
// Description:
// References:
// Rev:
// Prodnr:
// Updated: Mon Nov 14 10:11:16 2014
// Contact: http://ttcn.ericsson.se
//
////////////////////////////////////////////////////////////////////////////////
// Generated from file(s):
// - listMinMaxOccurs_e.xsd
// /* xml version = "1.0" encoding = "UTF-8" */
// /* targetnamespace = "http://www.example.org/list/minmaxoccurs/e" */
////////////////////////////////////////////////////////////////////////////////
// Modification header(s):
//-----------------------------------------------------------------------------
// Modified by:
// Modification date:
// Description:
// Modification contact:
//------------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
module http_www_example_org_list_minmaxoccurs_e {
import from XSD all;
type record SequenceList
{
record length(1 .. infinity) of XSD.String element0,
record length(1 .. infinity) of XSD.String element1 optional,
record length(0 .. 2) of record length(1 .. infinity) of XSD.String element2_list,
record of record length(1 .. infinity) of XSD.String element3_list,
record of record of XSD.String element4_list
}
with {
variant "element";
variant (element0) "name as capitalized";
variant (element0) "list";
variant (element1) "name as capitalized";
variant (element1) "list";
variant (element2_list) "untagged";
variant (element2_list[-]) "name as 'Element2'";
variant (element2_list[-]) "list";
variant (element3_list) "untagged";
variant (element3_list[-]) "name as 'Element3'";
variant (element3_list[-]) "list";
variant (element4_list) "untagged";
variant (element4_list[-]) "name as 'Element4'";
variant (element4_list[-]) "list";
};
type record SequenceList2
{
record of XSD.String element0 length(4),
record of XSD.String element1 length(4) optional,
record length(0 .. 2) of record of XSD.String element2_list length(4),
record of record of XSD.String element3_list length(4)
}
with {
variant "element";
variant (element0) "name as capitalized";
variant (element0) "list";
variant (element1) "name as capitalized";
variant (element1) "list";
variant (element2_list) "untagged";
variant (element2_list[-]) "name as 'Element2'";
variant (element2_list[-]) "list";
variant (element3_list) "untagged";
variant (element3_list[-]) "name as 'Element3'";
variant (element3_list[-]) "list";
};
type record SequenceList3
{
record length(3) of XSD.String element0 length(4),
record length(3) of XSD.String element1 length(4) optional,
record length(0 .. 2) of record length(3) of XSD.String element2_list length(4),
record of record length(3) of XSD.String element3_list length(4)
}
with {
variant "element";
variant (element0) "name as capitalized";
variant (element0) "list";
variant (element1) "name as capitalized";
variant (element1) "list";
variant (element2_list) "untagged";
variant (element2_list[-]) "name as 'Element2'";
variant (element2_list[-]) "list";
variant (element3_list) "untagged";
variant (element3_list[-]) "name as 'Element3'";
variant (element3_list[-]) "list";
};
type record SequenceList4
{
record of record {
record length(3) of XSD.String element0 length(4),
record length(3) of XSD.String element1 length(4) optional,
record length(0 .. 2) of record length(3) of XSD.String element2_list length(4),
record of record length(3) of XSD.String element3_list length(4)
} sequence_list
}
with {
variant "element";
variant (sequence_list) "untagged";
variant (sequence_list[-]) "untagged";
variant (sequence_list[-].element0) "name as capitalized";
variant (sequence_list[-].element0) "list";
variant (sequence_list[-].element1) "name as capitalized";
variant (sequence_list[-].element1) "list";
variant (sequence_list[-].element2_list) "untagged";
variant (sequence_list[-].element2_list[-]) "name as 'Element2'";
variant (sequence_list[-].element2_list[-]) "list";
variant (sequence_list[-].element3_list) "untagged";
variant (sequence_list[-].element3_list[-]) "name as 'Element3'";
variant (sequence_list[-].element3_list[-]) "list";
};
type record ChoiceWithList
{
union {
record length(3) of XSD.String element0 length(4),
record length(0 .. 1) of record length(3) of XSD.String element1_list length(4),
record length(1) of record length(3) of XSD.String element2_list length(4),
record length(1 .. infinity) of record length(3) of XSD.String element3_list length(4),
record length(2 .. 3) of record length(3) of XSD.String element4_list,
record length(2 .. infinity) of record length(3) of XSD.String element5_list
} choice
}
with {
variant (choice) "untagged";
variant (choice.element0) "name as capitalized";
variant (choice.element0) "list";
variant (choice.element1_list) "untagged";
variant (choice.element1_list[-]) "name as 'Element1'";
variant (choice.element1_list[-]) "list";
variant (choice.element2_list) "untagged";
variant (choice.element2_list[-]) "name as 'Element2'";
variant (choice.element2_list[-]) "list";
variant (choice.element3_list) "untagged";
variant (choice.element3_list[-]) "name as 'Element3'";
variant (choice.element3_list[-]) "list";
variant (choice.element4_list) "untagged";
variant (choice.element4_list[-]) "name as 'Element4'";
variant (choice.element4_list[-]) "list";
variant (choice.element5_list) "untagged";
variant (choice.element5_list[-]) "name as 'Element5'";
variant (choice.element5_list[-]) "list";
};
type record ChoiceWithList2
{
union {
record of XSD.Float element0,
record length(0 .. 1) of record of XSD.Float element1_list,
record length(1) of record of XSD.Float element2_list,
record length(2 .. 3) of record of XSD.Float element3_list,
record length(1 .. infinity) of record of XSD.Float element4_list,
XSD.Integer element5
} choice
}
with {
variant (choice) "untagged";
variant (choice.element0) "name as capitalized";
variant (choice.element0) "list";
variant (choice.element1_list) "untagged";
variant (choice.element1_list[-]) "name as 'Element1'";
variant (choice.element1_list[-]) "list";
variant (choice.element2_list) "untagged";
variant (choice.element2_list[-]) "name as 'Element2'";
variant (choice.element2_list[-]) "list";
variant (choice.element3_list) "untagged";
variant (choice.element3_list[-]) "name as 'Element3'";
variant (choice.element3_list[-]) "list";
variant (choice.element4_list) "untagged";
variant (choice.element4_list[-]) "name as 'Element4'";
variant (choice.element4_list[-]) "list";
variant (choice.element5) "name as capitalized";
};
type record ChoiceWithList3
{
record of union {
record of XSD.Float element0,
record length(0 .. 1) of record of XSD.Float element1_list,
record length(1) of record of XSD.Float element2_list,
record length(2 .. 3) of record of XSD.Float element3_list,
record length(1 .. infinity) of record of XSD.Float element4_list,
XSD.Integer element5
} choice_list
}
with {
variant (choice_list) "untagged";
variant (choice_list[-]) "untagged";
variant (choice_list[-].element0) "name as capitalized";
variant (choice_list[-].element0) "list";
variant (choice_list[-].element1_list) "untagged";
variant (choice_list[-].element1_list[-]) "name as 'Element1'";
variant (choice_list[-].element1_list[-]) "list";
variant (choice_list[-].element2_list) "untagged";
variant (choice_list[-].element2_list[-]) "name as 'Element2'";
variant (choice_list[-].element2_list[-]) "list";
variant (choice_list[-].element3_list) "untagged";
variant (choice_list[-].element3_list[-]) "name as 'Element3'";
variant (choice_list[-].element3_list[-]) "list";
variant (choice_list[-].element4_list) "untagged";
variant (choice_list[-].element4_list[-]) "name as 'Element4'";
variant (choice_list[-].element4_list[-]) "list";
variant (choice_list[-].element5) "name as capitalized";
};
type record ChoiceWithList4
{
union {
record length(0 .. 1) of record of XSD.Float element0_list,
record length(1) of record of XSD.Float element1_list,
record length(1) of record length(3) of XSD.String element2_list,
record length(1) of record length(5) of XSD.String element3_list length(4),
record length(1) of record length(1 .. infinity) of XSD.String element4_list
} choice
}
with {
variant (choice) "untagged";
variant (choice.element0_list) "untagged";
variant (choice.element0_list[-]) "name as 'Element0'";
variant (choice.element0_list[-]) "list";
variant (choice.element1_list) "untagged";
variant (choice.element1_list[-]) "name as 'Element1'";
variant (choice.element1_list[-]) "list";
variant (choice.element2_list) "untagged";
variant (choice.element2_list[-]) "name as 'Element2'";
variant (choice.element2_list[-]) "list";
variant (choice.element3_list) "untagged";
variant (choice.element3_list[-]) "name as 'Element3'";
variant (choice.element3_list[-]) "list";
variant (choice.element4_list) "untagged";
variant (choice.element4_list[-]) "name as 'Element4'";
variant (choice.element4_list[-]) "list";
};
type record ChoiceWithList5
{
union {
record of record of XSD.Float element_list,
record length(1 .. infinity) of record of XSD.Float element1_list,
record length(1 .. infinity) of record length(3) of XSD.String element2_list,
record length(1 .. infinity) of record length(3) of XSD.String element3_list length(4),
record length(1 .. infinity) of record length(1 .. infinity) of XSD.String element4_list
} choice
}
with {
variant (choice) "untagged";
variant (choice.element_list) "untagged";
variant (choice.element_list[-]) "name as 'Element.'";
variant (choice.element_list[-]) "list";
variant (choice.element1_list) "untagged";
variant (choice.element1_list[-]) "name as 'Element1'";
variant (choice.element1_list[-]) "list";
variant (choice.element2_list) "untagged";
variant (choice.element2_list[-]) "name as 'Element2'";
variant (choice.element2_list[-]) "list";
variant (choice.element3_list) "untagged";
variant (choice.element3_list[-]) "name as 'Element3'";
variant (choice.element3_list[-]) "list";
variant (choice.element4_list) "untagged";
variant (choice.element4_list[-]) "name as 'Element4'";
variant (choice.element4_list[-]) "list";
};
}
with {
encode "XML";
variant "namespace as 'http://www.example.org/list/minmaxoccurs/e' prefix 'this'";
variant "controlNamespace 'http://www.w3.org/2001/XMLSchema-instance' prefix 'xsi'";
}
......@@ -121,8 +121,8 @@ type record A
record of record {
XSD.Integer e optional,
record {
record length(1 .. infinity) of Ipv4 ipv4addresses,
record length(1 .. infinity) of Ipv6 ipv6addresses
record length(1 .. infinity) of Ipv4 ipv4addresses optional,
record length(1 .. infinity) of Ipv6 ipv6addresses optional
} f optional,
XSD.String g optional
} d_list
......
......@@ -168,6 +168,7 @@
<File path="../xsd/www_example_org_pref1.xsd" />
<File path="../xsd/www_example_org_pref2.xsd" />
<File path="../xsd/www_example_org_pref3.xsd" />
<File path="../xsd/listMinMaxOccurs.xsd" />
</File_Group>
<File_Group name="XmlTest_xsds" >
<File path="../XmlTest_xsds/XmlTest_boolean.xsd" />
......@@ -406,6 +407,7 @@
<File path="../XmlTest_expectedTtcns/www_example_org_pref1_e.ttcn" />
<File path="../XmlTest_expectedTtcns/www_example_org_pref2_e.ttcn" />
<File path="../XmlTest_expectedTtcns/www_example_org_pref3_e.ttcn" />
<File path="../XmlTest_expectedTtcns/http_www_example_org_list_minmaxoccurs_e.ttcn" />
</File_Group>
<File_Group name="XmlTest_src" >
<File path="xmlTest_Shell.ttcn" />
......
......@@ -1083,6 +1083,17 @@ group ListTest {
}
}//tc_
testcase tc_list_minmaxoccurs() runs on xmlTest_CT {
f_shellCommandWithVerdict(xsd2ttcn_command & " listMinMaxOccurs.xsd","",c_shell_successWithoutWarningAndError)
if(getverdict==pass) {
f_compareFiles(
"http_www_example_org_list_minmaxoccurs_e.ttcn","http_www_example_org_list_minmaxoccurs.ttcn", c_numOfDiff_headerAndModuleName);
}
}//tc_
}//ListTest
group UnionTest {
......@@ -2622,6 +2633,7 @@ control {
execute(tc_integerList());//Passed
execute(tc_list_simpletype());//Passed
execute(tc_list_complextype());
execute(tc_list_minmaxoccurs());
//===Float===
execute(tc_float_not_a_number());
......
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2000-2016 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
Contributors:
Szabo, Bence Janos
-->
<xs:schema
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:this="http://www.example.org/list/minmaxoccurs"
targetNamespace="http://www.example.org/list/minmaxoccurs">
<xs:element name="SequenceList">
<xs:complexType>
<xs:sequence>
<xs:element name="Element0" minOccurs="1" maxOccurs="1">
<xs:simpleType>
<xs:restriction>
<xs:simpleType>
<xs:list itemType="xs:string" />
</xs:simpleType>
<xs:minLength value="1" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="Element1" minOccurs="0" maxOccurs="1">
<xs:simpleType>
<xs:restriction>
<xs:simpleType>
<xs:list itemType="xs:string" />
</xs:simpleType>
<xs:minLength value="1" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="Element2" minOccurs="0" maxOccurs="2">
<xs:simpleType>
<xs:restriction>
<xs:simpleType>
<xs:list itemType="xs:string" />
</xs:simpleType>
<xs:minLength value="1" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="Element3" minOccurs="0" maxOccurs="unbounded">
<xs:simpleType>
<xs:restriction>
<xs:simpleType>
<xs:list itemType="xs:string" />
</xs:simpleType>
<xs:minLength value="1" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="Element4" minOccurs="0" maxOccurs="unbounded">
<xs:simpleType>
<xs:restriction>
<xs:simpleType>
<xs:list itemType="xs:string" />
</xs:simpleType>
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="SequenceList2">
<xs:complexType>
<xs:sequence>
<xs:element name="Element0" minOccurs="1" maxOccurs="1">
<simpleType>
<restriction>
<simpleType>
<list>
<simpleType>
<restriction base="string">
<length value="4" />
</restriction>
</simpleType>
</list>
</simpleType>
</restriction>
</simpleType>
</xs:element>
<xs:element name="Element1" minOccurs="0" maxOccurs="1">
<simpleType>
<restriction>
<simpleType>
<list>
<simpleType>
<restriction base="string">
<length value="4" />
</restriction>
</simpleType>
</list>
</simpleType>
</restriction>
</simpleType>
</xs:element>
<xs:element name="Element2" minOccurs="0" maxOccurs="2">
<simpleType>
<restriction>
<simpleType>
<list>
<simpleType>
<restriction base="string">
<length value="4" />
</restriction>
</simpleType>
</list>
</simpleType>
</restriction>
</simpleType>
</xs:element>
<xs:element name="Element3" minOccurs="0" maxOccurs="unbounded">
<simpleType>
<restriction>
<simpleType>
<list>
<simpleType>
<restriction base="string">
<length value="4" />
</restriction>
</simpleType>
</list>
</simpleType>
</restriction>
</simpleType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="SequenceList3">
<xs:complexType>
<xs:sequence>
<xs:element name="Element0" minOccurs="1" maxOccurs="1">
<simpleType>
<restriction>
<simpleType>
<list>
<simpleType>
<restriction base="string">
<length value="4" />
</restriction>
</simpleType>
</list>
</simpleType>
<length value="3"/>
</restriction>
</simpleType>
</xs:element>
<xs:element name="Element1" minOccurs="0" maxOccurs="1">
<simpleType>
<restriction>
<simpleType>
<list>
<simpleType>
<restriction base="string">
<length value="4" />
</restriction>
</simpleType>
</list>
</simpleType>
<length value="3"/>
</restriction>
</simpleType>
</xs:element>
<xs:element name="Element2" minOccurs="0" maxOccurs="2">
<simpleType>
<restriction>
<simpleType>
<list>
<simpleType>
<restriction base="string">
<length value="4" />
</restriction>
</simpleType>
</list>
</simpleType>
<length value="3"/>
</restriction>
</simpleType>
</xs:element>
<xs:element name="Element3" minOccurs="0" maxOccurs="unbounded">
<simpleType>
<restriction>
<simpleType>
<list>
<simpleType>
<restriction base="string">
<length value="4" />
</restriction>
</simpleType>
</list>
</simpleType>
<length value="3"/>
</restriction>
</simpleType>
</xs:element>