Summary: | svc.conf.xml file support broken with ACE_HAS_VERSIONED_NAMESPACE | ||
---|---|---|---|
Product: | ACE | Reporter: | milan.cvetkovic |
Component: | ACEXML | Assignee: | Krishnakumar B <kitty> |
Status: | NEW --- | ||
Severity: | normal | ||
Priority: | P3 | ||
Version: | 5.7.6 | ||
Hardware: | All | ||
OS: | Linux | ||
Attachments: |
fixes Service_Config_Test for ACEXML, and adds plug in svcconf parser
Automated test for dynamically chosing the .conf file parser based on file extension |
Description
milan.cvetkovic
2010-02-11 13:24:01 CST
Created attachment 1253 [details]
fixes Service_Config_Test for ACEXML, and adds plug in svcconf parser
cd $ACE_ROOT
patch -p1 <ace-5.7.6-user-svcconf.patch
#define ACE_HAS_XML_SVC_CONF 1
#define ACE_HAS_VERSIONED_NAMESPACE 1
- Added new ACE_FILE_EXT_BASED_SVC_CONF which would modify behaviour
of ACE_HAS_CLASSIC_SVC_CONF so:
. default conf file is svc.conf
. declarations of ACE_STATIC_SERVICE_DIRECTIVE and
ACE_STATIC_SERVICE_DIRECTIVE are with "traditional" syntax
. It is possible to load other config file parsers based on the file
extensions.
- Fixed ACE_HAS_XML_SVC_CONF output to LM_DEBUG instead of LM_ERROR in
case of missing service, since the $ACE_ROOT/ace/run_test.pl expects
no LM_ERRORS in output log file for successful test
- Fixed ACE_HAS_XML_SVC_CONF parser to correctly load "dynamic" services
with ACE_VERSION manked in the name of initializer function, by using
$ACE_ROOT/ace/Parse_Node hierarchy
I tried the modifications with the following options in
$ACE_ROOT/ace/config.h
-config.h (1)
#define ACE_HAS_VERSIONED_NAMESPACE 1
#define ACE_HAS_CLASSIC_SVC_CONF 1
#include "config-linux.h"
-config.h (2)
#define ACE_HAS_VERSIONED_NAMESPACE 1
#define ACE_HAS_XML_SVC_CONF 1
#include "config-linux.h"
-config.h (3)
#define ACE_HAS_VERSIONED_NAMESPACE 1
#define ACE_HAS_CLASSIC_SVC_CONF 1
#define ACE_FILE_EXT_BASED_SVC_CONF 1
#include "config-linux.h"
I have tried to make the modifications the least intrusive, in hope to get them included in mainstream,
Some of the classes or functions might need a name change, since they are no longer "XML" only.
I modified ACEXML/apps/conffile only to make sure "dynamic" works correctly. The stream test fails in the original build, and I am not too familiar how this should work...
The above patch is tested with $ACE_ROOT/ace/Service_Config_Test. No new tests are needed? The bug originally described in "Summary" is already tested with Service_Config_Test for known configurations (traditional and xml conf files), and it fails with .xml.conf in ACE-5.6.7, and passes with the patch. I could add a new test case for ACE_FILE_EXT_BASED_SVC_CONF, but this is new feature that nobody (yet) relies on. For new features we do need a test, else if someone starts using it and there are problems, we have problems Created attachment 1256 [details]
Automated test for dynamically chosing the .conf file parser based on file extension
Ok, here is the test program to verify the new feature:
load .xml config file when
#define ACE_HAS_CLASSIC_SVC_CONF 1
#define ACE_FILE_EXT_BASED_SVC_CONF 1
is in config.h
Test only loads .conf.xml. file, since with this configuration, Service_Config_Test would have tested loading .conf file.
btw, while working on the test program, I noticed something suspicious in $ACE_ROOT/tests/Service_Config_Test.cpp: Inside two functions, namely testLoadingServiceConfFile and testLoadingServiceConfFileAndProcessNo there is a copy of ACE_Service_Config created on the stack with the comment: // We need this scope to make sure that the destructor for the // <ACE_Service_Config> gets called. ACE_Service_Config daemon; after which, daemon.open() is invoked. I believe that ACE_Service_Config is a monostate, and the second invocation of "ACE_Service_Config::open" simply returns "nah, I am already open" with status 0. This would mean that second of these two tests isn't really testing anything. |