You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4cxx-dev@logging.apache.org by mc...@apache.org on 2004/04/24 09:51:58 UTC

cvs commit: logging-log4cxx/tests/src/xml customleveltestcase.cpp domtestcase.cpp

mcatan      2004/04/24 00:51:58

  Modified:    include/log4cxx/xml domconfigurator.h
               src      optionconverter.cpp simplesocketserver.cpp
                        xmllayout.cpp
               tests/src main.cpp
               tests/src/customlogger xloggertestcase.cpp
               tests/src/defaultinit testcase2.cpp testcase4.cpp
               tests/src/varia errorhandlertestcase.cpp
               tests/src/xml customleveltestcase.cpp domtestcase.cpp
  Log:
  log4cxx could not compile when configured without XML
  
  Revision  Changes    Path
  1.14      +4 -1      logging-log4cxx/include/log4cxx/xml/domconfigurator.h
  
  Index: domconfigurator.h
  ===================================================================
  RCS file: /home/cvs/logging-log4cxx/include/log4cxx/xml/domconfigurator.h,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- domconfigurator.h	24 Apr 2004 06:55:03 -0000	1.13
  +++ domconfigurator.h	24 Apr 2004 07:51:58 -0000	1.14
  @@ -18,6 +18,9 @@
   #define _LOG4CXX_XML_DOM_CONFIGURATOR_H
   
   #include <log4cxx/config.h>
  +
  +#ifdef HAVE_XML
  +
   #include <log4cxx/helpers/tchar.h>
   #include <log4cxx/helpers/objectptr.h>
   #include <log4cxx/helpers/objectimpl.h>
  @@ -217,5 +220,5 @@
   	}  // namespace xml
   }; // namespace log4cxx
   
  +#endif // HAVE_XML
   #endif // _LOG4CXX_XML_DOM_CONFIGURATOR_H
  -
  
  
  
  1.14      +4 -0      logging-log4cxx/src/optionconverter.cpp
  
  Index: optionconverter.cpp
  ===================================================================
  RCS file: /home/cvs/logging-log4cxx/src/optionconverter.cpp,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- optionconverter.cpp	22 Apr 2004 21:21:33 -0000	1.13
  +++ optionconverter.cpp	24 Apr 2004 07:51:58 -0000	1.14
  @@ -35,7 +35,9 @@
   using namespace log4cxx;
   using namespace log4cxx::helpers;
   using namespace log4cxx::spi;
  +#ifdef HAVE_XML
   using namespace log4cxx::xml;
  +#endif
   
   String OptionConverter::DELIM_START = _T("${");
   TCHAR OptionConverter::DELIM_STOP  = _T('}');
  @@ -381,11 +383,13 @@
   	ConfiguratorPtr configurator;
   	String clazz = _clazz;
   	
  +#ifdef HAVE_XML
   	if(clazz.empty() && !configFileName.empty() 
   		&& StringHelper::endsWith(configFileName, _T(".xml")))
   	{
   		clazz = DOMConfigurator::getStaticClass().toString();
   	}
  +#endif
   	
   	if(!clazz.empty())
   	{
  
  
  
  1.10      +6 -9      logging-log4cxx/src/simplesocketserver.cpp
  
  Index: simplesocketserver.cpp
  ===================================================================
  RCS file: /home/cvs/logging-log4cxx/src/simplesocketserver.cpp,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- simplesocketserver.cpp	22 Apr 2004 21:21:34 -0000	1.9
  +++ simplesocketserver.cpp	24 Apr 2004 07:51:58 -0000	1.10
  @@ -32,7 +32,9 @@
   #include <log4cxx/helpers/stringhelper.h>
   
   using namespace log4cxx;
  +#ifdef HAVE_XML
   using namespace log4cxx::xml;
  +#endif
   using namespace log4cxx::net;
   using namespace log4cxx::helpers;
   
  @@ -49,18 +51,14 @@
   	USES_CONVERSION;
   	port = ttol(portStr.c_str());
   
  +#ifdef HAVE_XML
   	// tests if configFile ends with ".xml"
   	if (StringHelper::endsWith(configFile, _T(".xml")))
   	{
  -#ifdef WIN32
  -		::CoInitialize(0);
  -#endif
   		DOMConfigurator::configure(configFile);
  -#ifdef WIN32
  -		::CoUninitialize();
  -#endif
   	} 
   	else
  +#endif
   	{
   		PropertyConfigurator::configure(configFile);
   	}
  @@ -76,9 +74,8 @@
   	else
   	{
   		USES_CONVERSION;
  -		init(_T("4560"), _T("logconfig.xml"));
  -//		usage(_T("Wrong number of arguments."));
  -//		return 1;
  +		usage(_T("Wrong number of arguments."));
  +		return 1;
   	}
   
   	try
  
  
  
  1.14      +1 -0      logging-log4cxx/src/xmllayout.cpp
  
  Index: xmllayout.cpp
  ===================================================================
  RCS file: /home/cvs/logging-log4cxx/src/xmllayout.cpp,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- xmllayout.cpp	22 Apr 2004 21:21:34 -0000	1.13
  +++ xmllayout.cpp	24 Apr 2004 07:51:58 -0000	1.14
  @@ -125,3 +125,4 @@
   
   	output << _T("</log4j:event>") << std::endl;
   }
  +
  
  
  
  1.3       +10 -1     logging-log4cxx/tests/src/main.cpp
  
  Index: main.cpp
  ===================================================================
  RCS file: /home/cvs/logging-log4cxx/tests/src/main.cpp,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- main.cpp	22 Apr 2004 21:21:36 -0000	1.2
  +++ main.cpp	24 Apr 2004 07:51:58 -0000	1.3
  @@ -16,6 +16,8 @@
   
   #include <cppunit/extensions/TestFactoryRegistry.h>
   #include <cppunit/ui/text/TestRunner.h>
  +#include <stdexcept>
  +#include <iostream>
   
   int main( int argc, char **argv)
   {
  @@ -31,7 +33,14 @@
   	{
   		for (int n = 1; n < argc; n++)
   		{
  -			wasSuccessful = runner.run(argv[n], false) && wasSuccessful;
  +			try
  +			{
  +				wasSuccessful = runner.run(argv[n], false) && wasSuccessful;
  +			}
  +			catch(std::exception& e)
  +			{
  +				std::cout << e.what() << std::endl;
  +			}
   		}
   	}
   	else
  
  
  
  1.5       +7 -1      logging-log4cxx/tests/src/customlogger/xloggertestcase.cpp
  
  Index: xloggertestcase.cpp
  ===================================================================
  RCS file: /home/cvs/logging-log4cxx/tests/src/customlogger/xloggertestcase.cpp,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- xloggertestcase.cpp	22 Apr 2004 21:21:36 -0000	1.4
  +++ xloggertestcase.cpp	24 Apr 2004 07:51:58 -0000	1.5
  @@ -14,6 +14,10 @@
    * limitations under the License.
    */
   
  +#include <log4cxx/config.h>
  +
  +#ifdef HAVE_XML
  +
   #include <cppunit/TestFixture.h>
   #include <cppunit/extensions/HelperMacros.h>
   #include "xlogger.h"
  @@ -57,7 +61,7 @@
   	{
   		DOMConfigurator::configure(_T("input/xml/customLogger")
   			+number+_T(".xml"));
  -
  +		
   		int i = -1;
   		LOG4CXX_TRACE(logger, _T("Message ") << ++i);
   		LOG4CXX_DEBUG(logger, _T("Message ") << ++i);
  @@ -72,3 +76,5 @@
   };
   
   CPPUNIT_TEST_SUITE_REGISTRATION(XLoggerTestCase);
  +
  +#endif //HAVE_XML
  
  
  
  1.4       +6 -0      logging-log4cxx/tests/src/defaultinit/testcase2.cpp
  
  Index: testcase2.cpp
  ===================================================================
  RCS file: /home/cvs/logging-log4cxx/tests/src/defaultinit/testcase2.cpp,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- testcase2.cpp	22 Apr 2004 21:21:36 -0000	1.3
  +++ testcase2.cpp	24 Apr 2004 07:51:58 -0000	1.4
  @@ -13,6 +13,10 @@
    * See the License for the specific language governing permissions and
    * limitations under the License.
    */
  + 
  +#include <log4cxx/config.h>
  +
  +#ifdef HAVE_XML
   
   #include <cppunit/TestFixture.h>
   #include <cppunit/extensions/HelperMacros.h>
  @@ -52,3 +56,5 @@
   };
   
   CPPUNIT_TEST_SUITE_REGISTRATION(TestCase2);
  +
  +#endif //HAVE_XML
  
  
  
  1.4       +6 -0      logging-log4cxx/tests/src/defaultinit/testcase4.cpp
  
  Index: testcase4.cpp
  ===================================================================
  RCS file: /home/cvs/logging-log4cxx/tests/src/defaultinit/testcase4.cpp,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- testcase4.cpp	22 Apr 2004 21:21:36 -0000	1.3
  +++ testcase4.cpp	24 Apr 2004 07:51:58 -0000	1.4
  @@ -14,6 +14,10 @@
    * limitations under the License.
    */
   
  +#include <log4cxx/config.h>
  +
  +#ifdef HAVE_XML
  +
   #include <cppunit/TestFixture.h>
   #include <cppunit/extensions/HelperMacros.h>
   
  @@ -53,3 +57,5 @@
   };
   
   CPPUNIT_TEST_SUITE_REGISTRATION(TestCase4);
  +
  +#endif //HAVE_XML
  
  
  
  1.3       +6 -0      logging-log4cxx/tests/src/varia/errorhandlertestcase.cpp
  
  Index: errorhandlertestcase.cpp
  ===================================================================
  RCS file: /home/cvs/logging-log4cxx/tests/src/varia/errorhandlertestcase.cpp,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- errorhandlertestcase.cpp	22 Apr 2004 21:21:38 -0000	1.2
  +++ errorhandlertestcase.cpp	24 Apr 2004 07:51:58 -0000	1.3
  @@ -14,6 +14,10 @@
    * limitations under the License.
    */
   
  +#include <log4cxx/config.h>
  +
  +#ifdef HAVE_XML
  +
   #include <cppunit/TestFixture.h>
   #include <cppunit/extensions/HelperMacros.h>
   
  @@ -110,3 +114,5 @@
   };
   
   CPPUNIT_TEST_SUITE_REGISTRATION(ErrorHandlerTestCase);
  +
  +#endif //HAVE_XML
  
  
  
  1.3       +6 -0      logging-log4cxx/tests/src/xml/customleveltestcase.cpp
  
  Index: customleveltestcase.cpp
  ===================================================================
  RCS file: /home/cvs/logging-log4cxx/tests/src/xml/customleveltestcase.cpp,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- customleveltestcase.cpp	22 Apr 2004 21:21:38 -0000	1.2
  +++ customleveltestcase.cpp	24 Apr 2004 07:51:58 -0000	1.3
  @@ -14,6 +14,10 @@
    * limitations under the License.
    */
   
  +#include <log4cxx/config.h>
  +
  +#ifdef HAVE_XML
  +
   #include <cppunit/TestFixture.h>
   #include <cppunit/extensions/HelperMacros.h>
   
  @@ -100,3 +104,5 @@
   };
   
   CPPUNIT_TEST_SUITE_REGISTRATION(CustomLevelTestCase);
  +
  +#endif //HAVE_XML
  
  
  
  1.3       +6 -0      logging-log4cxx/tests/src/xml/domtestcase.cpp
  
  Index: domtestcase.cpp
  ===================================================================
  RCS file: /home/cvs/logging-log4cxx/tests/src/xml/domtestcase.cpp,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- domtestcase.cpp	22 Apr 2004 21:21:38 -0000	1.2
  +++ domtestcase.cpp	24 Apr 2004 07:51:58 -0000	1.3
  @@ -14,6 +14,10 @@
    * limitations under the License.
    */
   
  +#include <log4cxx/config.h>
  +
  +#ifdef HAVE_XML
  +
   #include <cppunit/TestFixture.h>
   #include <cppunit/extensions/HelperMacros.h>
   
  @@ -125,3 +129,5 @@
   };
   
   CPPUNIT_TEST_SUITE_REGISTRATION(DOMTestCase);
  +
  +#endif //HAVE_XML