Commit e30d6c82 authored by stancakapost's avatar stancakapost
Browse files

updated external function to support a list of xsd files

parent 2ab72ce9
Loading
Loading
Loading
Loading
+4 −4
Original line number Original line Diff line number Diff line
@@ -24,7 +24,7 @@ public class XmlDiffExtFctPlugin extends AnnotationsExternalFunctionPlugin {
                ((UniversalCharstringValue)xsdFileList.getField(i)).getString();
                ((UniversalCharstringValue)xsdFileList.getField(i)).getString();
            }
            }
        }
        }
        String description = null;
        String description = "";
        boolean res = false;
        boolean res = false;
        try {
        try {
            XmlDiff diff = new XmlDiff(strReferenceXmlFile, xsdFileArray, null);
            XmlDiff diff = new XmlDiff(strReferenceXmlFile, xsdFileArray, null);
@@ -37,9 +37,9 @@ public class XmlDiffExtFctPlugin extends AnnotationsExternalFunctionPlugin {
        }
        }
        if (!res && description == null)
        if (!res && description == null)
            description = "Unspecified error";
            description = "Unspecified error";
        if (!res) {
        
        p_matchError.setString(description);
        p_matchError.setString(description);
        }
        
        return newBooleanValue(res);
        return newBooleanValue(res);
    }
    }
}
}
+5 −0
Original line number Original line Diff line number Diff line
@@ -11,6 +11,11 @@
      <parameter id="class" value="com.testingtech.ttcn.rt.tri.ttlibrary.extfct.TTlibraryExtFuncProvider"/>
      <parameter id="class" value="com.testingtech.ttcn.rt.tri.ttlibrary.extfct.TTlibraryExtFuncProvider"/>
    </plugin>
    </plugin>
  </extfunc>
  </extfunc>
  <extfunc>
    <plugin id="com.testingtech.tri.extfct.XmlDiffExtFctPlugin">
      <parameter id="class" value="com.testingtech.tri.extfct.XmlDiffExtFctPlugin"/>
    </plugin>
  </extfunc>
  <port>
  <port>
    <plugin id="com.testingtech.ttcn.tri.LoopbackPortPlugin">
    <plugin id="com.testingtech.ttcn.tri.LoopbackPortPlugin">
      <parameter id="class" value="com.testingtech.ttcn.tri.LoopbackPortProvider"/>
      <parameter id="class" value="com.testingtech.ttcn.tri.LoopbackPortProvider"/>
+64 −0
Original line number Original line Diff line number Diff line
/***************************************************
 ** @author   STF 475
 ** @version  0.0.1
 ** @purpose  9:5.1.2, Test inclusion of a schema with the same namespace
 ** @verdict  pass accept, ttcn3verdict:pass
***************************************************/
// The following requirements are tested:
// XSD include element information items shall be ignored if the included schema element has the same target 
// namespace as the including one (implying the absence of the target namespace). 

module Pos_050102_includes_001 {

   import from schema_Pos_050102_includes_001 language "XSD" all;

   template MyType m_msg := 1;



    type universal charstring Raw;
    type universal charstring XsdFile;
    type record of XsdFile XsdFileList;

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

	external function matchFile(Raw p_textToMatch, XsdFile p_referenceXmlFile, XsdFileList p_xsdFileList, out universal charstring p_matchError) return boolean;
//    external function matchFile(Raw p_textToMatch, charstring p_filePath, out charstring p_matchError) return boolean;

    testcase TC_Pos_050102_includes_001() runs on C system C {
        var Raw v_rcv;
        var charstring v_matchError;
        map(self:p, system:p);
        p.send(m_msg);
        alt {
            []	p.check(receive(Raw:?) -> value v_rcv) {
                if (matchFile(v_rcv, "Pos_050102_includes_001.xml", { "Pos_050102_includes_001.xsd", "Pos_050102_includes_001_1.xsd" }, v_matchError)) {
                    alt {
                        [] p.receive(m_msg) {
                            setverdict(pass);
                        }
                        [] p.receive {
                            setverdict(fail, "XML decoding failure");
                        }
                    }
                } else {
                    setverdict(fail, v_matchError);
                }
            }
            [] p.receive {
                setverdict(fail, "Raw decoding failure");
            }
        }
    }

    control {
        execute(TC_Pos_050102_includes_001(), 5.0);
    }


}
+2 −0
Original line number Original line Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<ns1:MyType xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns1="schema:Pos_050102_includes_001">1</ns1:MyType>
 No newline at end of file
+7 −0
Original line number Original line Diff line number Diff line
<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema"
  targetNamespace="schema:Pos_050102_includes_001"
  xmlns:ns1="schema:Pos_050102_includes_001">
  <include schemaLocation="Pos_050102_includes_001_1.xsd" />
  <element name="MyType2" type="integer"/>
</schema>
Loading