You've already forked lazarus-ccr
xsd generator
wsdl generator xsd & wsdl parser test : embedded record git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@269 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -7,12 +7,9 @@
|
||||
targetNamespace="urn:wst-test">
|
||||
|
||||
<types>
|
||||
<xsd:schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:wst-test">
|
||||
<xsd:schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:wst-test" xmlns:n="urn:wst-test" >
|
||||
|
||||
<xsd:complexType name="TRecordSampleType">
|
||||
<xsd:annotation>
|
||||
<xsd:appinfo record="true"/>
|
||||
</xsd:annotation>
|
||||
<xsd:complexType name="TRecordSampleType" wst_record="true">
|
||||
<xsd:sequence>
|
||||
<xsd:element name="intField" type="xsd:int" />
|
||||
<xsd:element name="strField" type="xsd:string" minOccurs="1" maxOccurs="1"/>
|
||||
@ -27,10 +24,7 @@
|
||||
|
||||
<xsd:element name="TRecordSample" type="n:TRecordSampleType"/>
|
||||
|
||||
<xsd:complexType name="TRecordSampleTypeAll">
|
||||
<xsd:annotation>
|
||||
<xsd:appinfo record="true"/>
|
||||
</xsd:annotation>
|
||||
<xsd:complexType name="TRecordSampleTypeAll" wst_record="true">
|
||||
<xsd:all>
|
||||
<xsd:element name="intField" type="xsd:int" />
|
||||
<xsd:element name="strField" type="xsd:string" minOccurs="1" maxOccurs="1"/>
|
||||
|
@ -3,8 +3,7 @@
|
||||
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
|
||||
targetNamespace="urn:wst-test">
|
||||
|
||||
<xsd:complexType name="TRecordSampleType">
|
||||
<xsd:annotation><xsd:appinfo record="true"/></xsd:annotation>
|
||||
<xsd:complexType name="TRecordSampleType" wst_record="true">
|
||||
<xsd:sequence>
|
||||
<xsd:element name="intField" type="xsd:int" />
|
||||
<xsd:element name="strField" type="xsd:string" minOccurs="1" maxOccurs="1"/>
|
||||
@ -19,8 +18,7 @@
|
||||
|
||||
<xsd:element name="TRecordSample" type="n:TRecordSampleType"/>
|
||||
|
||||
<xsd:complexType name="TRecordSampleTypeAll">
|
||||
<xsd:annotation><xsd:appinfo record="true"/></xsd:annotation>
|
||||
<xsd:complexType name="TRecordSampleTypeAll" wst_record="true">
|
||||
<xsd:all>
|
||||
<xsd:element name="intField" type="xsd:int" />
|
||||
<xsd:element name="strField" type="xsd:string" minOccurs="1" maxOccurs="1"/>
|
||||
@ -29,7 +27,7 @@
|
||||
<xsd:element name="charField" type="xsd:char" minOccurs="1"/>
|
||||
<xsd:element name="longField" type="xsd:long" minOccurs="0"/>
|
||||
</xsd:all>
|
||||
<xsd:attribute name="strAtt" type="xsd:string"/>
|
||||
<xsd:attribute name="strAtt" type="xsd:string" use="required"/>
|
||||
<xsd:attribute name="intAtt" type="xsd:int"/>
|
||||
</xsd:complexType>
|
||||
|
||||
|
@ -0,0 +1,46 @@
|
||||
<?xml version="1.0"?>
|
||||
<definitions name="wst_test"
|
||||
xmlns="http://schemas.xmlsoap.org/wsdl/"
|
||||
xmlns:tns="library1"
|
||||
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
|
||||
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
|
||||
targetNamespace="urn:wst-test">
|
||||
|
||||
<types>
|
||||
<xsd:schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:wst-test" xmlns:n="urn:wst-test" >
|
||||
|
||||
<xsd:element name="TRecordSampleType">
|
||||
<xsd:complexType wst_record="true">
|
||||
<xsd:sequence>
|
||||
<xsd:element name="intField" type="xsd:int" />
|
||||
<xsd:element name="strField" type="xsd:string" minOccurs="1" maxOccurs="1"/>
|
||||
<xsd:element name="floatField" type="xsd:float" minOccurs="0" maxOccurs="1"/>
|
||||
<xsd:element name="byteField" type="xsd:byte" maxOccurs="1"/>
|
||||
<xsd:element name="charField" type="xsd:char" minOccurs="1"/>
|
||||
<xsd:element name="longField" type="xsd:long" minOccurs="0"/>
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="strAtt" type="xsd:string"/>
|
||||
<xsd:attribute name="intAtt" type="xsd:int"/>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
|
||||
<xsd:element name="TRecordSampleTypeAll">
|
||||
<xsd:complexType wst_record="true">
|
||||
<xsd:all>
|
||||
<xsd:element name="intField" type="xsd:int" />
|
||||
<xsd:element name="strField" type="xsd:string" minOccurs="1" maxOccurs="1"/>
|
||||
<xsd:element name="floatField" type="xsd:float" minOccurs="0" maxOccurs="1"/>
|
||||
<xsd:element name="byteField" type="xsd:byte" maxOccurs="1"/>
|
||||
<xsd:element name="charField" type="xsd:char" minOccurs="1"/>
|
||||
<xsd:element name="longField" type="xsd:long" minOccurs="0"/>
|
||||
</xsd:all>
|
||||
<xsd:attribute name="strAtt" type="xsd:string"/>
|
||||
<xsd:attribute name="intAtt" type="xsd:int"/>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
|
||||
</xsd:schema>
|
||||
</types>
|
||||
|
||||
|
||||
</definitions>
|
36
wst/trunk/tests/test_suite/files/complex_record_embedded.xsd
Normal file
36
wst/trunk/tests/test_suite/files/complex_record_embedded.xsd
Normal file
@ -0,0 +1,36 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<xsd:schema xmlns:n="urn:wst-test"
|
||||
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
|
||||
targetNamespace="urn:wst-test">
|
||||
|
||||
<xsd:element name="TRecordSampleType">
|
||||
<xsd:complexType wst_record="true">
|
||||
<xsd:sequence>
|
||||
<xsd:element name="intField" type="xsd:int" />
|
||||
<xsd:element name="strField" type="xsd:string" minOccurs="1" maxOccurs="1"/>
|
||||
<xsd:element name="floatField" type="xsd:float" minOccurs="0" maxOccurs="1"/>
|
||||
<xsd:element name="byteField" type="xsd:byte" maxOccurs="1"/>
|
||||
<xsd:element name="charField" type="xsd:char" minOccurs="1"/>
|
||||
<xsd:element name="longField" type="xsd:long" minOccurs="0"/>
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="strAtt" type="xsd:string"/>
|
||||
<xsd:attribute name="intAtt" type="xsd:int"/>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
|
||||
<xsd:element name="TRecordSampleTypeAll">
|
||||
<xsd:complexType wst_record="true">
|
||||
<xsd:all>
|
||||
<xsd:element name="intField" type="xsd:int" />
|
||||
<xsd:element name="strField" type="xsd:string" minOccurs="1" maxOccurs="1"/>
|
||||
<xsd:element name="floatField" type="xsd:float" minOccurs="0" maxOccurs="1"/>
|
||||
<xsd:element name="byteField" type="xsd:byte" maxOccurs="1"/>
|
||||
<xsd:element name="charField" type="xsd:char" minOccurs="1"/>
|
||||
<xsd:element name="longField" type="xsd:long" minOccurs="0"/>
|
||||
</xsd:all>
|
||||
<xsd:attribute name="strAtt" type="xsd:string"/>
|
||||
<xsd:attribute name="intAtt" type="xsd:int"/>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
|
||||
</xsd:schema>
|
@ -37,6 +37,7 @@ type
|
||||
function LoadComplexType_Class_Embedded_Schema() : TwstPasTreeContainer;virtual;abstract;
|
||||
|
||||
function LoadComplexType_Record_Schema() : TwstPasTreeContainer;virtual;abstract;
|
||||
function LoadComplexType_Record_Embedded_Schema() : TwstPasTreeContainer;virtual;abstract;
|
||||
|
||||
function LoadComplexType_ArraySequence_Schema() : TwstPasTreeContainer;virtual;abstract;
|
||||
function LoadComplexType_ArraySequence_Embedded_Schema() : TwstPasTreeContainer;virtual;abstract;
|
||||
@ -50,6 +51,7 @@ type
|
||||
procedure ComplexType_Class_Embedded();
|
||||
|
||||
procedure ComplexType_Record();
|
||||
procedure ComplexType_Record_Embedded();
|
||||
|
||||
procedure ComplexType_ArraySequence();
|
||||
procedure ComplexType_ArraySequence_Embedded();
|
||||
@ -70,6 +72,7 @@ type
|
||||
function LoadComplexType_Class_Embedded_Schema() : TwstPasTreeContainer;override;
|
||||
|
||||
function LoadComplexType_Record_Schema() : TwstPasTreeContainer;override;
|
||||
function LoadComplexType_Record_Embedded_Schema() : TwstPasTreeContainer;override;
|
||||
|
||||
function LoadComplexType_ArraySequence_Schema() : TwstPasTreeContainer;override;
|
||||
function LoadComplexType_ArraySequence_Embedded_Schema() : TwstPasTreeContainer;override;
|
||||
@ -90,6 +93,7 @@ type
|
||||
function LoadComplexType_Class_Embedded_Schema() : TwstPasTreeContainer;override;
|
||||
|
||||
function LoadComplexType_Record_Schema() : TwstPasTreeContainer;override;
|
||||
function LoadComplexType_Record_Embedded_Schema() : TwstPasTreeContainer;override;
|
||||
|
||||
function LoadComplexType_ArraySequence_Schema() : TwstPasTreeContainer;override;
|
||||
function LoadComplexType_ArraySequence_Embedded_Schema() : TwstPasTreeContainer;override;
|
||||
@ -510,7 +514,7 @@ var
|
||||
CheckEquals(AName,tr.GetExternalName(prp));
|
||||
CheckNotNull(prp.VarType);
|
||||
CheckEquals(ATypeName,tr.GetExternalName(prp.VarType));
|
||||
CheckEquals(PropertyType_Att[AFieldType],tr.IsAttributeProperty(prp));
|
||||
CheckEquals(PropertyType_Att[AFieldType],tr.IsAttributeProperty(prp),Format('IsAttributeProperty("%s.%s")',[recType.Name, AName]));
|
||||
end;
|
||||
|
||||
var
|
||||
@ -588,6 +592,90 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TTest_CustomXsdParser.ComplexType_Record_Embedded();
|
||||
var
|
||||
tr : TwstPasTreeContainer;
|
||||
recType : TPasRecordType;
|
||||
|
||||
procedure CheckProperty(const AName,ATypeName : string; const AFieldType : TPropertyType);
|
||||
var
|
||||
prp : TPasVariable;
|
||||
begin
|
||||
prp := FindMember(recType,AName) as TPasVariable;
|
||||
CheckNotNull(prp);
|
||||
CheckEquals(AName,prp.Name);
|
||||
CheckEquals(AName,tr.GetExternalName(prp));
|
||||
CheckNotNull(prp.VarType);
|
||||
CheckEquals(ATypeName,tr.GetExternalName(prp.VarType));
|
||||
CheckEquals(PropertyType_Att[AFieldType],tr.IsAttributeProperty(prp),Format('IsAttributeProperty("%s.%s")',[recType.Name, AName]));
|
||||
end;
|
||||
|
||||
var
|
||||
mdl : TPasModule;
|
||||
ls : TList;
|
||||
elt : TPasElement;
|
||||
aliasType : TPasAliasType;
|
||||
i : Integer;
|
||||
prpLs : TList;
|
||||
begin
|
||||
prpLs := TList.Create();
|
||||
try
|
||||
tr := LoadComplexType_Record_Embedded_Schema();
|
||||
|
||||
mdl := tr.FindModule(x_targetNamespace);
|
||||
CheckNotNull(mdl);
|
||||
CheckEquals(x_complexType_record_embedded,mdl.Name);
|
||||
CheckEquals(x_targetNamespace,tr.GetExternalName(mdl));
|
||||
ls := mdl.InterfaceSection.Declarations;
|
||||
CheckEquals(2,ls.Count);
|
||||
elt := tr.FindElement(x_complexType_SampleRecordType);
|
||||
CheckNotNull(elt,x_complexType_SampleRecordType);
|
||||
CheckEquals(x_complexType_SampleRecordType,elt.Name);
|
||||
CheckEquals(x_complexType_SampleRecordType,tr.GetExternalName(elt));
|
||||
CheckIs(elt,TPasRecordType,'Element Type');
|
||||
recType := elt as TPasRecordType;
|
||||
prpLs.Clear();
|
||||
for i := 0 to Pred(recType.Members.Count) do begin
|
||||
if TPasElement(recType.Members[i]).InheritsFrom(TPasVariable) then
|
||||
prpLs.Add(recType.Members[i]);
|
||||
end;
|
||||
CheckEquals(8,prpLs.Count);
|
||||
CheckProperty(x_intField,'int',ptField);
|
||||
CheckProperty(x_strField,'string',ptField);
|
||||
CheckProperty(x_floatField,'float',ptField);
|
||||
CheckProperty(x_byteField,'byte',ptField);
|
||||
CheckProperty(x_charField,'char',ptField);
|
||||
CheckProperty(x_longField,'long',ptField);
|
||||
CheckProperty(x_strAtt,'string',ptAttribute);
|
||||
CheckProperty(x_intAtt,'int',ptAttribute);
|
||||
|
||||
|
||||
elt := tr.FindElement(x_complexType_SampleRecordTypeAll);
|
||||
CheckNotNull(elt,x_complexType_SampleRecordTypeAll);
|
||||
CheckEquals(x_complexType_SampleRecordTypeAll,elt.Name);
|
||||
CheckEquals(x_complexType_SampleRecordTypeAll,tr.GetExternalName(elt));
|
||||
CheckIs(elt,TPasRecordType,'Element type');
|
||||
recType := elt as TPasRecordType;
|
||||
prpLs.Clear();
|
||||
for i := 0 to Pred(recType.Members.Count) do begin
|
||||
if TPasElement(recType.Members[i]).InheritsFrom(TPasVariable) then
|
||||
prpLs.Add(recType.Members[i]);
|
||||
end;
|
||||
CheckEquals(8,prpLs.Count);
|
||||
CheckProperty(x_intField,'int',ptField);
|
||||
CheckProperty(x_strField,'string',ptField);
|
||||
CheckProperty(x_floatField,'float',ptField);
|
||||
CheckProperty(x_byteField,'byte',ptField);
|
||||
CheckProperty(x_charField,'char',ptField);
|
||||
CheckProperty(x_longField,'long',ptField);
|
||||
CheckProperty(x_strAtt,'string',ptAttribute);
|
||||
CheckProperty(x_intAtt,'int',ptAttribute);
|
||||
|
||||
finally
|
||||
FreeAndNil(prpLs);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TTest_CustomXsdParser.ComplexType_ArraySequence();
|
||||
var
|
||||
tr : TwstPasTreeContainer;
|
||||
@ -817,6 +905,11 @@ begin
|
||||
Result := ParseDoc(x_complexType_record);
|
||||
end;
|
||||
|
||||
function TTest_XsdParser.LoadComplexType_Record_Embedded_Schema(): TwstPasTreeContainer;
|
||||
begin
|
||||
Result := ParseDoc(x_complexType_record_embedded);
|
||||
end;
|
||||
|
||||
function TTest_XsdParser.LoadComplexType_ArraySequence_Schema(): TwstPasTreeContainer;
|
||||
begin
|
||||
Result := ParseDoc(x_complexType_array_sequence);
|
||||
@ -880,6 +973,11 @@ begin
|
||||
Result := ParseDoc(x_complexType_record);
|
||||
end;
|
||||
|
||||
function TTest_WsdlParser.LoadComplexType_Record_Embedded_Schema(): TwstPasTreeContainer;
|
||||
begin
|
||||
Result := ParseDoc(x_complexType_record_embedded);
|
||||
end;
|
||||
|
||||
function TTest_WsdlParser.LoadComplexType_ArraySequence_Schema(): TwstPasTreeContainer;
|
||||
begin
|
||||
Result := ParseDoc(x_complexType_array_sequence);
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -16,7 +16,8 @@ uses
|
||||
server_binary_formatter, metadata_repository,
|
||||
metadata_generator, parserdefs, server_service_intf, metadata_wsdl,
|
||||
test_parserdef, base_xmlrpc_formatter, wst_fpc_xml, test_utilities,
|
||||
server_service_xmlrpc, test_parsers, wsdl_generator;
|
||||
server_service_xmlrpc, test_parsers, wsdl_generator, xsd_generator,
|
||||
xsd_consts;
|
||||
|
||||
Const
|
||||
ShortOpts = 'alh';
|
||||
|
Reference in New Issue
Block a user