diff options
author | jai <jai@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2004-07-01 20:39:33 +0000 |
---|---|---|
committer | jai <jai@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2004-07-01 20:39:33 +0000 |
commit | 5553c5d1f05132cd5c744a2736429e0702783d00 (patch) | |
tree | ba2ce10cc48e420b1e8ba1757cc37e03ff9caaf1 | |
parent | 5d287caec31ae7d51996898ecd6552954e9b64f7 (diff) | |
download | ATCD-5553c5d1f05132cd5c744a2736429e0702783d00.tar.gz |
Thu Jul 1 15:37:33 2004 Jaiganesh B <jai@dre.vanderbilt.edu>
13 files changed, 465 insertions, 0 deletions
diff --git a/TAO/CIAO/ChangeLog b/TAO/CIAO/ChangeLog index 53eba361a45..19e20ba7cc1 100644 --- a/TAO/CIAO/ChangeLog +++ b/TAO/CIAO/ChangeLog @@ -1,3 +1,20 @@ +Thu Jul 1 15:37:33 2004 Jaiganesh B <jai@dre.vanderbilt.edu> + + * DAnCE/tests/Config_Handlers/CompImplDesc_Handler_Test.cpp: + * DAnCE/tests/Config_Handlers/CompIntrDesc_Handler_Test.cpp: + * DAnCE/tests/Config_Handlers/CompPkgDesc_Handler_Test.cpp: + * DAnCE/tests/Config_Handlers/Domain_Handler_Test.cpp: + * DAnCE/tests/Config_Handlers/Handler_Test.cpp: + * DAnCE/tests/Config_Handlers/Handler_Test.h: + * DAnCE/tests/Config_Handlers/Handler_Test.i: + * DAnCE/tests/Config_Handlers/Handler_Tests.mpc: + * DAnCE/tests/Config_Handlers/IAD_Handler_Test.cpp: + * DAnCE/tests/Config_Handlers/PC_Handler_Test.cpp: + * DAnCE/tests/Config_Handlers/Plan_Handler_Test.cpp: + * DAnCE/tests/Config_Handlers/handler_test.mpb: + + Checking in the tests for the XML handlers. + Thu Jul 1 15:29:57 2004 Jaiganesh B <jai@dre.vanderbilt.edu> * DAnCE/tests/Config_Handlers/HUDisplay/Airframe.ccd: diff --git a/TAO/CIAO/DAnCE/tests/Config_Handlers/CompImplDesc_Handler_Test.cpp b/TAO/CIAO/DAnCE/tests/Config_Handlers/CompImplDesc_Handler_Test.cpp new file mode 100644 index 00000000000..ef03b09cec6 --- /dev/null +++ b/TAO/CIAO/DAnCE/tests/Config_Handlers/CompImplDesc_Handler_Test.cpp @@ -0,0 +1,16 @@ +// $Id$ + +#include "Handler_Test.h" + +#ifndef ACE_HAS_BROKEN_NESTED_TEMPLATES + +#include "Config_Handlers/CompImplDesc_Handler.h" + +int +ACE_TMAIN (int argc, ACE_TCHAR *argv[]) +{ + return run_test <CIAO::Config_Handler::CompImplDesc_Handler, Deployment::ComponentImplementationDescription> + (argc, argv, &CIAO::Config_Handler::CompImplDesc_Handler::process_ComponentImplementationDescription); +} + +#endif // ACE_HAS_BROKEN_NESTED_TEMPLATES diff --git a/TAO/CIAO/DAnCE/tests/Config_Handlers/CompIntrDesc_Handler_Test.cpp b/TAO/CIAO/DAnCE/tests/Config_Handlers/CompIntrDesc_Handler_Test.cpp new file mode 100644 index 00000000000..b6a33919068 --- /dev/null +++ b/TAO/CIAO/DAnCE/tests/Config_Handlers/CompIntrDesc_Handler_Test.cpp @@ -0,0 +1,16 @@ +// $Id$ + +#include "Handler_Test.h" + +#ifndef ACE_HAS_BROKEN_NESTED_TEMPLATES + +#include "Config_Handlers/CompIntrDesc_Handler.h" + +int +ACE_TMAIN (int argc, ACE_TCHAR *argv[]) +{ + return run_test <CIAO::Config_Handler::CompIntrDesc_Handler, Deployment::ComponentInterfaceDescription> + (argc, argv, &CIAO::Config_Handler::CompIntrDesc_Handler::process_ComponentInterfaceDescription); +} + +#endif // ACE_HAS_BROKEN_NESTED_TEMPLATES diff --git a/TAO/CIAO/DAnCE/tests/Config_Handlers/CompPkgDesc_Handler_Test.cpp b/TAO/CIAO/DAnCE/tests/Config_Handlers/CompPkgDesc_Handler_Test.cpp new file mode 100644 index 00000000000..adf64ee1380 --- /dev/null +++ b/TAO/CIAO/DAnCE/tests/Config_Handlers/CompPkgDesc_Handler_Test.cpp @@ -0,0 +1,16 @@ +// $Id$ + +#include "Handler_Test.h" + +#ifndef ACE_HAS_BROKEN_NESTED_TEMPLATES + +#include "Config_Handlers/CompPkgDesc_Handler.h" + +int +ACE_TMAIN (int argc, ACE_TCHAR *argv[]) +{ + return run_test <CIAO::Config_Handler::CompPkgDesc_Handler, Deployment::ComponentPackageDescription> + (argc, argv, &CIAO::Config_Handler::CompPkgDesc_Handler::process_ComponentPackageDescription); +} + +#endif // ACE_HAS_BROKEN_NESTED_TEMPLATES diff --git a/TAO/CIAO/DAnCE/tests/Config_Handlers/Domain_Handler_Test.cpp b/TAO/CIAO/DAnCE/tests/Config_Handlers/Domain_Handler_Test.cpp new file mode 100644 index 00000000000..4d0cf09ef99 --- /dev/null +++ b/TAO/CIAO/DAnCE/tests/Config_Handlers/Domain_Handler_Test.cpp @@ -0,0 +1,16 @@ +// $Id$ + +#include "Handler_Test.h" + +#ifndef ACE_HAS_BROKEN_NESTED_TEMPLATES + +#include "Config_Handlers/Domain_Handler.h" + +int +ACE_TMAIN (int argc, ACE_TCHAR *argv[]) +{ + return run_test <CIAO::Config_Handler::Domain_Handler, Deployment::Domain> + (argc, argv, &CIAO::Config_Handler::Domain_Handler::process_domain); +} + +#endif // ACE_HAS_BROKEN_NESTED_TEMPLATES diff --git a/TAO/CIAO/DAnCE/tests/Config_Handlers/Handler_Test.cpp b/TAO/CIAO/DAnCE/tests/Config_Handlers/Handler_Test.cpp new file mode 100644 index 00000000000..a00a939f113 --- /dev/null +++ b/TAO/CIAO/DAnCE/tests/Config_Handlers/Handler_Test.cpp @@ -0,0 +1,17 @@ +// $Id$ + +#include "Handler_Test.h" + +#ifdef ACE_HAS_BROKEN_NESTED_TEMPLATES + +int +ACE_TMAIN (int argc, ACE_TCHAR *argv[]) +{ + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("DaNCe internal testing doesn't work with compilers ") + ACE_TEXT ("not supporting nested templates (like VC6).\n"))); + return -1; +} + +#endif // ACE_HAS_BROKEN_NESTED_TEMPLATES + diff --git a/TAO/CIAO/DAnCE/tests/Config_Handlers/Handler_Test.h b/TAO/CIAO/DAnCE/tests/Config_Handlers/Handler_Test.h new file mode 100644 index 00000000000..a5598e8a55c --- /dev/null +++ b/TAO/CIAO/DAnCE/tests/Config_Handlers/Handler_Test.h @@ -0,0 +1,50 @@ +// $Id$ + +#ifndef HANDLER_TEST_H +#define HANDLER_TEST_H + +#include "ace/Log_Msg.h" +#include "ace/OS_main.h" + +#ifndef ACE_HAS_BROKEN_NESTED_TEMPLATES + +#include "ace/Get_Opt.h" +#include "ace/Auto_Ptr.h" +#include "tao/Exception.h" +#include "Config_Handlers/XercesString.h" +#include "Config_Handlers/Config_Handler_export.h" +#include "Config_Handlers/DnC_Dump.h" +#include "Config_Handlers/Config_Error_Handler.h" + +#include <xercesc/util/XMLUniDefs.hpp> +#include <xercesc/dom/DOM.hpp> + +using Config_Handler::XStr; +using xercesc::XMLUni; +using xercesc::XMLString; +using xercesc::XMLException; +using xercesc::DOMException; +using xercesc::DOMBuilder; +using xercesc::DOMImplementationRegistry; +using xercesc::DOMImplementationLS; +using xercesc::DOMImplementation; +using xercesc::DOMAttr; +using xercesc::DOMNamedNodeMap; +using xercesc::DOMLocator; +using xercesc::DOMError; +using xercesc::DOMNodeList; +using xercesc::DOMDocument; +using xercesc::DOMDocumentTraversal; +using xercesc::DOMNodeIterator; +using xercesc::DOMNode; +using xercesc::DOMNodeFilter; + +template <typename HANDLER, typename DATA> +int run_test (int argc, ACE_TCHAR *argv[], void (HANDLER::*func) (DATA&)); + +#include "Handler_Test.i" + +#endif // ACE_HAS_BROKEN_NESTED_TEMPLATES + +#endif // HANDLER_TEST_H + diff --git a/TAO/CIAO/DAnCE/tests/Config_Handlers/Handler_Test.i b/TAO/CIAO/DAnCE/tests/Config_Handlers/Handler_Test.i new file mode 100644 index 00000000000..eb6041b83d0 --- /dev/null +++ b/TAO/CIAO/DAnCE/tests/Config_Handlers/Handler_Test.i @@ -0,0 +1,197 @@ +// $Id$ + +#include "ace/Get_Opt.h" +#include "ace/Auto_Ptr.h" +#include "ace/Log_Msg.h" +#include "ace/OS_main.h" +#include "ace/Auto_Ptr.h" +#include "tao/Exception.h" +#include "Config_Handlers/XercesString.h" +#include <xercesc/util/XMLUniDefs.hpp> +#include "Config_Handlers/Config_Handler_export.h" +#include "Config_Handlers/DnC_Dump.h" +#include "Config_Handlers/Config_Error_Handler.h" + +using Config_Handler::XStr; +using xercesc::XMLUni; +using xercesc::XMLString; +using xercesc::XMLException; +using xercesc::DOMException; +using xercesc::DOMBuilder; +using xercesc::DOMImplementationRegistry; +using xercesc::DOMImplementationLS; +using xercesc::DOMImplementation; +using xercesc::DOMAttr; +using xercesc::DOMNamedNodeMap; +using xercesc::DOMLocator; +using xercesc::DOMError; +using xercesc::DOMNodeList; +using xercesc::DOMDocument; +using xercesc::DOMDocumentTraversal; +using xercesc::DOMNodeIterator; +using xercesc::DOMNode; +using xercesc::DOMNodeFilter; + +inline void +usage (const ACE_TCHAR* program) +{ + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("Usage: %s -u <URI>\n") + ACE_TEXT (" <URI>: URI identifying the resource\n"), + program)); +} + +template <typename HANDLER, typename DATA> +int run_test (int argc, ACE_TCHAR *argv[], void (HANDLER::*func) (DATA&)) +{ + ACE_TCHAR* url = 0; + + ACE_Get_Opt get_opt (argc, argv, ACE_TEXT ("u:")); + int c; + + while ((c = get_opt ()) != EOF) + { + switch (c) + { + case 'u': + url = get_opt.opt_arg(); + break; + default: + usage(argv[0]); + return -1; + } + } + + if (url == 0) { + usage(argv[0]); + return -1; + } + + // Initialize the ORB so that CORBA::Any will work + // + CORBA::ORB_var orb = CORBA::ORB_init (argc, argv, ""); + + // Initialize the Xerces run-time + try + { + xercesc::XMLPlatformUtils::Initialize(); + } + + catch (const XMLException& e) + { + char* message = XMLString::transcode (e.getMessage()); + ACE_Auto_Basic_Array_Ptr<char> cleanup_message (message); + ACE_DEBUG ((LM_DEBUG, "Error during initialization : %s\n", message)); + return 1; + } + + try + { + + // Instantiate the DOM parser. + static const XMLCh gLS[] = { xercesc::chLatin_L, + xercesc::chLatin_S, + xercesc::chNull }; + + // Get an implementation of the Load-Store (LS) interface + DOMImplementation* impl + = DOMImplementationRegistry::getDOMImplementation(gLS); + + auto_ptr<DOMImplementation> cleanup_impl (impl); + + // Create a DOMBuilder + DOMBuilder* parser = + ((DOMImplementationLS*)impl)->createDOMBuilder(DOMImplementationLS::MODE_SYNCHRONOUS, 0); + + auto_ptr<DOMBuilder> cleanup_builder (parser); + + // Discard comment nodes in the document + parser->setFeature (XMLUni::fgDOMComments, false); + + // Disable datatype normalization. The XML 1.0 attribute value + // normalization always occurs though. + parser->setFeature (XMLUni::fgDOMDatatypeNormalization, true); + + // Do not create EntityReference nodes in the DOM tree. No + // EntityReference nodes will be created, only the nodes + // corresponding to their fully expanded sustitution text will be + // created. + parser->setFeature (XMLUni::fgDOMEntities, false); + + // Perform Namespace processing. + parser->setFeature (XMLUni::fgDOMNamespaces, true); + + // Perform Validation + parser->setFeature (XMLUni::fgDOMValidation, true); + + // Do not include ignorable whitespace in the DOM tree. + parser->setFeature (XMLUni::fgDOMWhitespaceInElementContent, false); + + // Enable the parser schema support. + parser->setFeature (XMLUni::fgXercesSchema, true); + + // Enable full schema constraint checking, including checking which + // may be time-consuming or memory intensive. Currently, particle + // unique attribution constraint checking and particle derivation + // restriction checking are controlled by this option. + parser->setFeature (XMLUni::fgXercesSchemaFullChecking, true); + + // The parser will treat validation error as fatal and will exit. + parser->setFeature (XMLUni::fgXercesValidationErrorAsFatal, true); + + CIAO::Config_Handler::Config_Error_Handler handler; + parser->setErrorHandler(&handler); + + DOMDocument* doc = parser->parseURI(url); + auto_ptr<DOMDocument> cleanup_doc (doc); + + if (handler.getErrors()) + { + return 1; + } + HANDLER obj (doc, DOMNodeFilter::SHOW_ELEMENT | + DOMNodeFilter::SHOW_TEXT); + + DATA data; + (obj.*func)(data); + Deployment::DnC_Dump::dump (data); + //domain_handler.dump(domain); + + // parser->release (); + } + catch (const DOMException& e) + { + const unsigned int maxChars = 2047; + XMLCh errText[maxChars + 1]; + + ACE_ERROR ((LM_ERROR, "\nException occured while parsing %s: \n", url)); + ACE_ERROR ((LM_ERROR, "DOMException code: %d\n ", e.code)); + if (DOMImplementation::loadDOMExceptionMsg(e.code, errText, maxChars)) + { + char* message = XMLString::transcode (errText); + ACE_Auto_Basic_Array_Ptr<char> cleanup_message (message); + ACE_ERROR ((LM_ERROR, "Message is: %s\n", message)); + } + return 1; + } + catch (const XMLException& e) + { + char* message = XMLString::transcode (e.getMessage()); + ACE_Auto_Basic_Array_Ptr<char> cleanup_message (message); + ACE_ERROR ((LM_ERROR, "\nException occured: %s\n ", message)); + return 1; + } + catch (CORBA::Exception& ex) + { + ACE_PRINT_EXCEPTION (ex, "Caught CORBA Exception: "); + return 1; + } + catch (...) + { + ACE_ERROR ((LM_ERROR, "Caught unknown exception\n")); + return 1; + } + + xercesc::XMLPlatformUtils::Terminate(); + return 0; +} diff --git a/TAO/CIAO/DAnCE/tests/Config_Handlers/Handler_Tests.mpc b/TAO/CIAO/DAnCE/tests/Config_Handlers/Handler_Tests.mpc new file mode 100644 index 00000000000..f8bda5acc48 --- /dev/null +++ b/TAO/CIAO/DAnCE/tests/Config_Handlers/Handler_Tests.mpc @@ -0,0 +1,57 @@ +//$Id$ + +project (Domain_Handler_Test) : handler_test { + exename = domain + + Source_Files { + Domain_Handler_Test.cpp + } +} + +project (CompImpl_Handler_Test) : handler_test { + exename = compimpldesc + + Source_Files { + CompImplDesc_Handler_Test.cpp + } +} + +project (CompIntr_Handler_Test) : handler_test { + exename = compintrdesc + + Source_Files { + CompIntrDesc_Handler_Test.cpp + } +} + +project (CompPkg_Handler_Test) : handler_test { + exename = comppkgdesc + + Source_Files { + CompPkgDesc_Handler_Test.cpp + } +} + +project (IAD_Handler_Test) : handler_test { + exename = iad + + Source_Files { + IAD_Handler_Test.cpp + } +} + +project (PC_Handler_Test) : handler_test { + exename = pc + + Source_Files { + PC_Handler_Test.cpp + } +} + +project (Plan_Handler_Test) : handler_test { + exename = plan + + Source_Files { + Plan_Handler_Test.cpp + } +} diff --git a/TAO/CIAO/DAnCE/tests/Config_Handlers/IAD_Handler_Test.cpp b/TAO/CIAO/DAnCE/tests/Config_Handlers/IAD_Handler_Test.cpp new file mode 100644 index 00000000000..c71e11fce28 --- /dev/null +++ b/TAO/CIAO/DAnCE/tests/Config_Handlers/IAD_Handler_Test.cpp @@ -0,0 +1,16 @@ +// $Id$ + +#include "Handler_Test.h" + +#ifndef ACE_HAS_BROKEN_NESTED_TEMPLATES + +#include "Config_Handlers/IAD_Handler.h" + +int +ACE_TMAIN (int argc, ACE_TCHAR *argv[]) +{ + return run_test <CIAO::Config_Handler::IAD_Handler, Deployment::ImplementationArtifactDescription> + (argc, argv, &CIAO::Config_Handler::IAD_Handler::process_ImplementationArtifactDescription); +} + +#endif // ACE_HAS_BROKEN_NESTED_TEMPLATES diff --git a/TAO/CIAO/DAnCE/tests/Config_Handlers/PC_Handler_Test.cpp b/TAO/CIAO/DAnCE/tests/Config_Handlers/PC_Handler_Test.cpp new file mode 100644 index 00000000000..e8a8980108b --- /dev/null +++ b/TAO/CIAO/DAnCE/tests/Config_Handlers/PC_Handler_Test.cpp @@ -0,0 +1,16 @@ +// $Id$ + +#include "Handler_Test.h" + +#ifndef ACE_HAS_BROKEN_NESTED_TEMPLATES + +#include "Config_Handlers/PC_Handler.h" + +int +ACE_TMAIN (int argc, ACE_TCHAR *argv[]) +{ + return run_test <CIAO::Config_Handler::PC_Handler, Deployment::PackageConfiguration> + (argc, argv, &CIAO::Config_Handler::PC_Handler::process_PackageConfiguration); +} + +#endif // ACE_HAS_BROKEN_NESTED_TEMPLATES diff --git a/TAO/CIAO/DAnCE/tests/Config_Handlers/Plan_Handler_Test.cpp b/TAO/CIAO/DAnCE/tests/Config_Handlers/Plan_Handler_Test.cpp new file mode 100644 index 00000000000..e42d4d345a3 --- /dev/null +++ b/TAO/CIAO/DAnCE/tests/Config_Handlers/Plan_Handler_Test.cpp @@ -0,0 +1,16 @@ +// $Id$ + +#include "Handler_Test.h" + +#ifndef ACE_HAS_BROKEN_NESTED_TEMPLATES + +#include "Config_Handlers/Plan_Handler.h" + +int +ACE_TMAIN (int argc, ACE_TCHAR *argv[]) +{ + return run_test <CIAO::Config_Handler::Plan_Handler, Deployment::DeploymentPlan> + (argc, argv, &CIAO::Config_Handler::Plan_Handler::process_plan); +} + +#endif // ACE_HAS_BROKEN_NESTED_TEMPLATES diff --git a/TAO/CIAO/DAnCE/tests/Config_Handlers/handler_test.mpb b/TAO/CIAO/DAnCE/tests/Config_Handlers/handler_test.mpb new file mode 100644 index 00000000000..167efa08289 --- /dev/null +++ b/TAO/CIAO/DAnCE/tests/Config_Handlers/handler_test.mpb @@ -0,0 +1,15 @@ +//$Id$ + +project : taoexe, ciao_deployment_stub { // , portableserver, typecodefactory { + requires += dnc + dynamicflags = CONFIG_HANDLER_BUILD_DLL + macros += XML_USE_PTHREADS + includes += $(XERCESCROOT)/include /usr/include $(ACE_ROOT)/TAO/CIAO/DnC + libpaths += $(XERCESCROOT)/lib /usr/lib // $(ACE_ROOT)/lib + libs += xerces-c Config_Handlers // Deployment_stub Deployment_svnt + after += Config_Handlers + + Source_Files { + Handler_Test.cpp + } +} |