You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by am...@apache.org on 2010/08/09 22:04:20 UTC

svn commit: r983800 - in /xerces/c/trunk/tests/src/XSTSHarness: XMLHarnessHandlers.cpp XMLHarnessHandlers.hpp XSTSHarness.cpp XSTSHarnessHandlers.cpp XSTSHarnessHandlers.hpp

Author: amassari
Date: Mon Aug  9 20:04:19 2010
New Revision: 983800

URL: http://svn.apache.org/viewvc?rev=983800&view=rev
Log:
Add a switch to let XSTSHarness test different scanners

Modified:
    xerces/c/trunk/tests/src/XSTSHarness/XMLHarnessHandlers.cpp
    xerces/c/trunk/tests/src/XSTSHarness/XMLHarnessHandlers.hpp
    xerces/c/trunk/tests/src/XSTSHarness/XSTSHarness.cpp
    xerces/c/trunk/tests/src/XSTSHarness/XSTSHarnessHandlers.cpp
    xerces/c/trunk/tests/src/XSTSHarness/XSTSHarnessHandlers.hpp

Modified: xerces/c/trunk/tests/src/XSTSHarness/XMLHarnessHandlers.cpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/tests/src/XSTSHarness/XMLHarnessHandlers.cpp?rev=983800&r1=983799&r2=983800&view=diff
==============================================================================
--- xerces/c/trunk/tests/src/XSTSHarness/XMLHarnessHandlers.cpp (original)
+++ xerces/c/trunk/tests/src/XSTSHarness/XMLHarnessHandlers.cpp Mon Aug  9 20:04:19 2010
@@ -33,10 +33,11 @@
 // ---------------------------------------------------------------------------
 //  XMLHarnessHandlers: Constructors and Destructor
 // ---------------------------------------------------------------------------
-XMLHarnessHandlers::XMLHarnessHandlers(const XMLCh* baseURL) : BaseHarnessHandlers(baseURL)
+XMLHarnessHandlers::XMLHarnessHandlers(const XMLCh* baseURL, const XMLCh* scanner) : BaseHarnessHandlers(baseURL)
 , fTestBaseURL(5)
 {
     fParser = XMLReaderFactory::createXMLReader();
+    fParser->setProperty(XMLUni::fgXercesScannerName, (void*)scanner);
     fParser->setFeature(XMLUni::fgSAX2CoreValidation, true);
     fParser->setFeature(XMLUni::fgXercesDynamic, false);
     fParser->setErrorHandler(&fErrorHandler);

Modified: xerces/c/trunk/tests/src/XSTSHarness/XMLHarnessHandlers.hpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/tests/src/XSTSHarness/XMLHarnessHandlers.hpp?rev=983800&r1=983799&r2=983800&view=diff
==============================================================================
--- xerces/c/trunk/tests/src/XSTSHarness/XMLHarnessHandlers.hpp (original)
+++ xerces/c/trunk/tests/src/XSTSHarness/XMLHarnessHandlers.hpp Mon Aug  9 20:04:19 2010
@@ -37,7 +37,7 @@ public:
     // -----------------------------------------------------------------------
     //  Constructors and Destructor
     // -----------------------------------------------------------------------
-    XMLHarnessHandlers(const XMLCh* baseURL);
+    XMLHarnessHandlers(const XMLCh* baseURL, const XMLCh* scanner);
     ~XMLHarnessHandlers();
 
     // -----------------------------------------------------------------------

Modified: xerces/c/trunk/tests/src/XSTSHarness/XSTSHarness.cpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/tests/src/XSTSHarness/XSTSHarness.cpp?rev=983800&r1=983799&r2=983800&view=diff
==============================================================================
--- xerces/c/trunk/tests/src/XSTSHarness/XSTSHarness.cpp (original)
+++ xerces/c/trunk/tests/src/XSTSHarness/XSTSHarness.cpp Mon Aug  9 20:04:19 2010
@@ -42,7 +42,7 @@
 static XMLCh sz_XMLTestSuiteRoot[]={ chLatin_T, chLatin_E, chLatin_S, chLatin_T, chLatin_S, chLatin_U, chLatin_I, chLatin_T, chLatin_E, chNull };
 const XMLCh dummy[]={ chLatin_f, chLatin_i, chLatin_l, chLatin_e, chColon, chForwardSlash, chForwardSlash,
                        chLatin_d, chLatin_u, chLatin_m, chLatin_m, chLatin_y, chForwardSlash, chNull };
-
+const XMLCh* g_scanner = XMLUni::fgIGXMLScanner;
 
 // ---------------------------------------------------------------------------
 //  Local helper methods
@@ -247,6 +247,18 @@ int main(int argC, char* argV[])
         return 1;
     }
 
+    try
+    {
+        XMLPlatformUtils::Initialize();
+    }
+
+    catch (const XMLException& toCatch)
+    {
+        XERCES_STD_QUALIFIER cout << "Error during initialization! Message:\n"
+            << StrX(toCatch.getMessage()) << XERCES_STD_QUALIFIER endl;
+        return 1;
+    }
+
     int argInd;
     for (argInd = 1; argInd < argC; argInd++)
     {
@@ -261,9 +273,9 @@ int main(int argC, char* argV[])
             return 2;
         }
         // TODO: add option to generate the XML summarizing the result
-        else if (!strncmp(argV[argInd], "-v=", 3)
-             ||  !strncmp(argV[argInd], "-V=", 3))
+        else if (!strncmp(argV[argInd], "-scanner=", 9))
         {
+            g_scanner = XMLString::transcode(argV[argInd]+9);
         }
         else
         {
@@ -282,18 +294,6 @@ int main(int argC, char* argV[])
         return 1;
     }
 
-    try
-    {
-        XMLPlatformUtils::Initialize();
-    }
-
-    catch (const XMLException& toCatch)
-    {
-        XERCES_STD_QUALIFIER cout << "Error during initialization! Message:\n"
-            << StrX(toCatch.getMessage()) << XERCES_STD_QUALIFIER endl;
-        return 1;
-    }
-
     //
     //  Create a SAX parser object.
     //
@@ -321,24 +321,24 @@ int main(int argC, char* argV[])
     if(rootExtractor.isXMLSuite())
     {
         // XML Test Suite
-        handler=new XMLHarnessHandlers(uri);
+        handler=new XMLHarnessHandlers(uri, g_scanner);
     }
     else
     {
         // XMLSchema Test Suite
-        handler=new XSTSHarnessHandlers(uri);
+        handler=new XSTSHarnessHandlers(uri, g_scanner);
     }
     XMLString::release(&uniFile);
     delete [] uri;
     parser->setContentHandler(handler);
     parser->setErrorHandler(handler);
 
+    bool errorOccurred=false;
+    const unsigned long startMillis = XMLPlatformUtils::getCurrentMillis();
     //
     //  Get the starting time and kick off the parse of the indicated
-    //  file. Catch any exceptions that might propogate out of it.
+    //  file. Catch any exceptions that might propagate out of it.
     //
-    bool errorOccurred=false;
-    const unsigned long startMillis = XMLPlatformUtils::getCurrentMillis();
     try
     {
         parser->parse(xmlFile);
@@ -360,16 +360,18 @@ int main(int argC, char* argV[])
         XERCES_STD_QUALIFIER cout << "\nUnexpected exception during parsing: '" << xmlFile << "'\n";
         errorOccurred = true;
     }
+
     const unsigned long endMillis = XMLPlatformUtils::getCurrentMillis();
     unsigned long duration = endMillis - startMillis;
 
     if (handler->getSawErrors())
         errorOccurred = true;
 
-    XERCES_STD_QUALIFIER cout << "Total tests: " << handler->getTotalTests() << XERCES_STD_QUALIFIER endl;
-    XERCES_STD_QUALIFIER cout << "Failed tests: " << handler->getFailedTests() << XERCES_STD_QUALIFIER endl;
-    XERCES_STD_QUALIFIER cout << "Success rate: " << ((double)(handler->getTotalTests()-handler->getFailedTests()))/(double)handler->getTotalTests()*100 << "%" << XERCES_STD_QUALIFIER endl;
-    XERCES_STD_QUALIFIER cout << "Duration: ";
+    XERCES_STD_QUALIFIER cout << "Scanner: " << StrX(g_scanner) << XERCES_STD_QUALIFIER endl;
+    XERCES_STD_QUALIFIER cout << "  Total tests: " << handler->getTotalTests() << XERCES_STD_QUALIFIER endl;
+    XERCES_STD_QUALIFIER cout << "  Failed tests: " << handler->getFailedTests() << XERCES_STD_QUALIFIER endl;
+    XERCES_STD_QUALIFIER cout << "  Success rate: " << ((double)(handler->getTotalTests()-handler->getFailedTests()))/(double)handler->getTotalTests()*100 << "%" << XERCES_STD_QUALIFIER endl;
+    XERCES_STD_QUALIFIER cout << "  Duration: ";
     if(duration > 60000)
     {
         XERCES_STD_QUALIFIER cout << duration/60000 << ":";

Modified: xerces/c/trunk/tests/src/XSTSHarness/XSTSHarnessHandlers.cpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/tests/src/XSTSHarness/XSTSHarnessHandlers.cpp?rev=983800&r1=983799&r2=983800&view=diff
==============================================================================
--- xerces/c/trunk/tests/src/XSTSHarness/XSTSHarnessHandlers.cpp (original)
+++ xerces/c/trunk/tests/src/XSTSHarness/XSTSHarnessHandlers.cpp Mon Aug  9 20:04:19 2010
@@ -33,9 +33,10 @@
 // ---------------------------------------------------------------------------
 //  XSTSHarnessHandlers: Constructors and Destructor
 // ---------------------------------------------------------------------------
-XSTSHarnessHandlers::XSTSHarnessHandlers(const XMLCh* baseURL) : BaseHarnessHandlers(baseURL)
+XSTSHarnessHandlers::XSTSHarnessHandlers(const XMLCh* baseURL, const XMLCh* scanner) : BaseHarnessHandlers(baseURL)
 {
     fParser = XMLReaderFactory::createXMLReader();
+    fParser->setProperty(XMLUni::fgXercesScannerName, (void*)scanner);
     fParser->setFeature(XMLUni::fgSAX2CoreNameSpaces, true);
     fParser->setFeature(XMLUni::fgSAX2CoreNameSpacePrefixes, true);
     fParser->setFeature(XMLUni::fgSAX2CoreValidation, true);

Modified: xerces/c/trunk/tests/src/XSTSHarness/XSTSHarnessHandlers.hpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/tests/src/XSTSHarness/XSTSHarnessHandlers.hpp?rev=983800&r1=983799&r2=983800&view=diff
==============================================================================
--- xerces/c/trunk/tests/src/XSTSHarness/XSTSHarnessHandlers.hpp (original)
+++ xerces/c/trunk/tests/src/XSTSHarness/XSTSHarnessHandlers.hpp Mon Aug  9 20:04:19 2010
@@ -56,7 +56,7 @@ public:
     // -----------------------------------------------------------------------
     //  Constructors and Destructor
     // -----------------------------------------------------------------------
-    XSTSHarnessHandlers(const XMLCh* baseURL);
+    XSTSHarnessHandlers(const XMLCh* baseURL, const XMLCh* scanner);
     ~XSTSHarnessHandlers();
 
     // -----------------------------------------------------------------------



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xerces.apache.org
For additional commands, e-mail: commits-help@xerces.apache.org