Commit ebb5927a authored by stancakapost's avatar stancakapost
Browse files

new ATS version

parent a852e696
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -27,3 +27,4 @@
/tools/XmlDiff/xerces
/tools/XmlDiff/xmldiff.jar
/tools/XmlDiff/lib/xmlunit-1.5-src.zip
tools/TestMacroProcessor/bin
+1 −1
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<MyType>4</MyType>
<MyType xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">4</MyType>
+2 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<MyType xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">4</MyType>
+80 −0
Original line number Diff line number Diff line
/***************************************************
 ** @author   STF 487
 ** @version  0.0.1
 ** @purpose  9:5.2.3, Asure that namespaces are ordered lexically
 ** @verdict  pass accept, ttcn3verdict:pass
 ***************************************************/
module Pos_050203_order_of_the_mapping_004 {

    import from schema_Pos_050203_order_of_the_mapping_004 language "XSD" all;

    template MyType m_msg := {f1 := {a:= 1}, f2 := {a:= 2}}



    /**
     * @desc The timeout given in seconds after which the test case will be stopped.
     */
    modulepar float PX_TC_EXECUTION_TIMEOUT := 5.0;

    type universal charstring Raw;

    type universal charstring File;
    type record of File FileList;

    type port P message {
        inout all;
    }
    type component C {
        port P p;
    }

    /**
     * @desc lexical compare the charstring p_textToMatch with the contents of the reference XML file and returns true if they represent the same XML structure
     * @param p_textToMatch text to be compared with the UTF-8 contents of the XML file
     * @param p_referenceXmlFile the XML file
     * @param p_xsdFileList the list of XSD files
     * @param p_matchError the error result in case it did not match
     * @param p_referenceTTCN3File the file of the TTCN-3 test module. This path is used to find the reference XML file relative to this path, by keeping the TTCN-3 code file system independent.
     * @return true if p_textToMatch and the contents of p_referenceXmlFile represent the same XML structure
     */
    external function matchFile(Raw p_textToMatch, File p_referenceXmlFile, FileList p_xsdFileList, out universal charstring p_matchError, File p_referenceTTCN3File := __FILE__) return boolean;

    testcase TC_Pos_050203_order_of_the_mapping_004() runs on C system C {
        var Raw v_rcv;
        var universal charstring v_matchError;

        map(self:p, system:p);

        // encode the message
        p.send(m_msg);

        alt {
            // compare the encoded message with the reference XML file
            []    p.check(receive(Raw:?) -> value v_rcv) {
                log("XML message ", v_rcv);
                if (matchFile(v_rcv, "Pos_050203_order_of_the_mapping_004.xml", { "Pos_050203_order_of_the_mapping_004.xsd", "Pos_050203_order_of_the_mapping_004_1.xsd", "Pos_050203_order_of_the_mapping_004_2.xsd" }, v_matchError)) {
                    alt {
                        // match decoded value to pass test
                        [] p.receive(m_msg) {
                            setverdict(pass, "Decoded value matches encoded template and reference XML");
                        }
                        [] p.receive {
                            setverdict(fail, "XML decoding failure");
                        }
                    }
                } else {
                    setverdict(fail, v_matchError);
                }
            }
            [] p.receive {
                setverdict(fail, "Raw decoding failure");
            }
        }
    }

    control {
        execute(TC_Pos_050203_order_of_the_mapping_004(), PX_TC_EXECUTION_TIMEOUT);
    }

}
+8 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="UTF-8"?>
<ns:MyType xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns:ns="schema:Pos_050203_order_of_the_mapping_004"
	xmlns:ns1="Pos_050203_order_of_the_mapping_004__MyNamespace"
	xmlns:ns2="Pos_050203_order_of_the_mapping_004_MyNamespace">
	<ns1:f1><ns1:a>1</ns1:a></ns1:f1>
	<ns2:f2><ns2:a>2</ns2:a></ns2:f2>
</ns:MyType>
 No newline at end of file
Loading