Modified: logging/log4cxx/trunk/src/test/cpp/xml/customleveltestcase.cpp URL: http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/test/cpp/xml/customleveltestcase.cpp?rev=615984&r1=615983&r2=615984&view=diff ============================================================================== --- logging/log4cxx/trunk/src/test/cpp/xml/customleveltestcase.cpp (original) +++ logging/log4cxx/trunk/src/test/cpp/xml/customleveltestcase.cpp Mon Jan 28 10:40:19 2008 @@ -20,8 +20,7 @@ -#include <cppunit/TestFixture.h> -#include <cppunit/extensions/HelperMacros.h> +#include "../logunit.h" #include <log4cxx/logger.h> #include <log4cxx/xml/domconfigurator.h> @@ -38,7 +37,7 @@ using namespace log4cxx::xml; -class CustomLevelTestCase : public CppUnit::TestFixture +LOGUNIT_CLASS(CustomLevelTestCase) { CPPUNIT_TEST_SUITE(CustomLevelTestCase); CPPUNIT_TEST(test1);
Modified: logging/log4cxx/trunk/src/test/cpp/xml/domtestcase.cpp URL: http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/test/cpp/xml/domtestcase.cpp?rev=615984&r1=615983&r2=615984&view=diff ============================================================================== --- logging/log4cxx/trunk/src/test/cpp/xml/domtestcase.cpp (original) +++ logging/log4cxx/trunk/src/test/cpp/xml/domtestcase.cpp Mon Jan 28 10:40:19 2008 @@ -16,12 +16,9 @@ */ -#include <cppunit/TestFixture.h> -#include <cppunit/extensions/HelperMacros.h> - #include <log4cxx/logger.h> #include <log4cxx/xml/domconfigurator.h> - +#include "../logunit.h" #include "../util/compare.h" #include "xlevel.h" #include "../util/controlfilter.h" @@ -48,14 +45,14 @@ #define TEST1_2_PAT "^[0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\} [0-9]\\{2\\}:[0-9]\\{2\\}:[0-9]\\{2\\},[0-9]\\{3\\} " \ "\\[0x[0-9A-F]*]\\ (DEBUG|INFO|WARN|ERROR|FATAL) .* - Message [0-9]" -class DOMTestCase : public CppUnit::TestFixture +LOGUNIT_CLASS(DOMTestCase) { - CPPUNIT_TEST_SUITE(DOMTestCase); - CPPUNIT_TEST(test1); + LOGUNIT_TEST_SUITE(DOMTestCase); + LOGUNIT_TEST(test1); #if defined(_WIN32) - CPPUNIT_TEST(test2); + LOGUNIT_TEST(test2); #endif - CPPUNIT_TEST_SUITE_END(); + LOGUNIT_TEST_SUITE_END(); LoggerPtr root; LoggerPtr logger; @@ -118,8 +115,8 @@ const File witness2(LOG4CXX_TEST_STR("witness/dom.A2.1")); // TODO: A1 doesn't contain duplicate entries // - // CPPUNIT_ASSERT(Compare::compare(FILTERED_A1, witness1)); - CPPUNIT_ASSERT(Compare::compare(FILTERED_A2, witness2)); + // LOGUNIT_ASSERT(Compare::compare(FILTERED_A1, witness1)); + LOGUNIT_ASSERT(Compare::compare(FILTERED_A2, witness2)); } // @@ -153,8 +150,8 @@ const File witness2(LOG4CXX_TEST_STR("witness/dom.A2.2")); // TODO: A1 doesn't contain duplicate entries // - // CPPUNIT_ASSERT(Compare::compare(FILTERED_A1, witness1)); - CPPUNIT_ASSERT(Compare::compare(FILTERED_A2, witness2)); + // LOGUNIT_ASSERT(Compare::compare(FILTERED_A1, witness1)); + LOGUNIT_ASSERT(Compare::compare(FILTERED_A2, witness2)); } @@ -190,7 +187,7 @@ } }; -CPPUNIT_TEST_SUITE_REGISTRATION(DOMTestCase); +LOGUNIT_TEST_SUITE_REGISTRATION(DOMTestCase); const File DOMTestCase::TEMP_A1(LOG4CXX_TEST_STR("output/temp.A1")); const File DOMTestCase::TEMP_A2(LOG4CXX_TEST_STR("output/temp.A2")); Modified: logging/log4cxx/trunk/src/test/cpp/xml/xmllayouttest.cpp URL: http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/test/cpp/xml/xmllayouttest.cpp?rev=615984&r1=615983&r2=615984&view=diff ============================================================================== --- logging/log4cxx/trunk/src/test/cpp/xml/xmllayouttest.cpp (original) +++ logging/log4cxx/trunk/src/test/cpp/xml/xmllayouttest.cpp Mon Jan 28 10:40:19 2008 @@ -15,9 +15,7 @@ * limitations under the License. */ -#include <cppunit/TestFixture.h> -#include <cppunit/extensions/HelperMacros.h> - +#include "../logunit.h" #include <log4cxx/logger.h> #include <log4cxx/xml/xmllayout.h> #include <log4cxx/fileappender.h> @@ -56,30 +54,20 @@ * Test for XMLLayout. * */ -class XMLLayoutTest : public CppUnit::TestFixture { - CPPUNIT_TEST_SUITE(XMLLayoutTest); - CPPUNIT_TEST(testGetContentType); - CPPUNIT_TEST(testIgnoresThrowable); - CPPUNIT_TEST(testGetHeader); - CPPUNIT_TEST(testGetFooter); - CPPUNIT_TEST(testFormat); - CPPUNIT_TEST(testFormatWithNDC); - CPPUNIT_TEST(testGetSetLocationInfo); - CPPUNIT_TEST(testActivateOptions); - CPPUNIT_TEST(testProblemCharacters); - CPPUNIT_TEST(testNDCWithCDATA); - CPPUNIT_TEST_SUITE_END(); - -#if 0 - /** - * Construct new instance of XMLLayoutTest. - * - * @param testName test name. - */ - public XMLLayoutTest(final String testName) { - super(testName, "text/plain", false, null, null); - } -#endif +LOGUNIT_CLASS(XMLLayoutTest) { + LOGUNIT_TEST_SUITE(XMLLayoutTest); + LOGUNIT_TEST(testGetContentType); + LOGUNIT_TEST(testIgnoresThrowable); + LOGUNIT_TEST(testGetHeader); + LOGUNIT_TEST(testGetFooter); + LOGUNIT_TEST(testFormat); + LOGUNIT_TEST(testFormatWithNDC); + LOGUNIT_TEST(testGetSetLocationInfo); + LOGUNIT_TEST(testActivateOptions); + LOGUNIT_TEST(testProblemCharacters); + LOGUNIT_TEST(testNDCWithCDATA); + LOGUNIT_TEST_SUITE_END(); + public: /** @@ -105,14 +93,14 @@ void testGetContentType() { LogString expected(LOG4CXX_STR("text/plain")); LogString actual(XMLLayout().getContentType()); - CPPUNIT_ASSERT(expected == actual); + LOGUNIT_ASSERT(expected == actual); } /** * Tests ignoresThrowable. */ void testIgnoresThrowable() { - CPPUNIT_ASSERT_EQUAL(false, XMLLayout().ignoresThrowable()); + LOGUNIT_ASSERT_EQUAL(false, XMLLayout().ignoresThrowable()); } /** @@ -122,7 +110,7 @@ Pool p; LogString header; XMLLayout().appendHeader(header, p); - CPPUNIT_ASSERT_EQUAL((size_t) 0, header.size()); + LOGUNIT_ASSERT_EQUAL((size_t) 0, header.size()); } /** @@ -132,7 +120,7 @@ Pool p; LogString footer; XMLLayout().appendFooter(footer, p); - CPPUNIT_ASSERT_EQUAL((size_t) 0, footer.size()); + LOGUNIT_ASSERT_EQUAL((size_t) 0, footer.size()); } private: @@ -149,26 +137,26 @@ LogString header(LOG4CXX_STR("<log4j:eventSet xmlns:log4j='http://jakarta.apache.org/log4j/'>")); LogString::const_iterator iter(header.begin()); encoder->encode(header, iter, buf); - CPPUNIT_ASSERT(iter == header.end()); + LOGUNIT_ASSERT(iter == header.end()); iter = source.begin(); encoder->encode(source, iter, buf); - CPPUNIT_ASSERT(iter == source.end()); + LOGUNIT_ASSERT(iter == source.end()); LogString footer(LOG4CXX_STR("</log4j:eventSet>")); iter = footer.begin(); encoder->encode(footer, iter, buf); buf.flip(); apr_pool_t* apr_pool = (apr_pool_t*) p.getAPRPool(); apr_xml_parser* parser = apr_xml_parser_create(apr_pool); - CPPUNIT_ASSERT(parser != 0); + LOGUNIT_ASSERT(parser != 0); apr_status_t stat = apr_xml_parser_feed(parser, buf.data(), buf.remaining()); - CPPUNIT_ASSERT_EQUAL(APR_SUCCESS, stat); + LOGUNIT_ASSERT_EQUAL(APR_SUCCESS, stat); apr_xml_doc* doc = 0; stat = apr_xml_parser_done(parser, &doc); - CPPUNIT_ASSERT(doc != 0); + LOGUNIT_ASSERT(doc != 0); apr_xml_elem* eventSet = doc->root; - CPPUNIT_ASSERT(eventSet != 0); + LOGUNIT_ASSERT(eventSet != 0); apr_xml_elem* event = eventSet->first_child; - CPPUNIT_ASSERT(event != 0); + LOGUNIT_ASSERT(event != 0); return event; } @@ -200,11 +188,11 @@ void checkEventElement( apr_xml_elem* element, LoggingEventPtr& event) { std::string tagName("event"); - CPPUNIT_ASSERT_EQUAL(tagName, (std::string) element->name); + LOGUNIT_ASSERT_EQUAL(tagName, (std::string) element->name); LOG4CXX_ENCODE_CHAR(cLoggerName, event->getLoggerName()); - CPPUNIT_ASSERT_EQUAL(cLoggerName, getAttribute(element, "logger")); + LOGUNIT_ASSERT_EQUAL(cLoggerName, getAttribute(element, "logger")); LOG4CXX_ENCODE_CHAR(cLevelName, event->getLevel()->toString()); - CPPUNIT_ASSERT_EQUAL(cLevelName, getAttribute(element, "level")); + LOGUNIT_ASSERT_EQUAL(cLevelName, getAttribute(element, "level")); } /** @@ -215,8 +203,8 @@ void checkMessageElement( apr_xml_elem* element, std::string message) { std::string tagName = "message"; - CPPUNIT_ASSERT_EQUAL(tagName, (std::string) element->name); - CPPUNIT_ASSERT_EQUAL(message, getText(element)); + LOGUNIT_ASSERT_EQUAL(tagName, (std::string) element->name); + LOGUNIT_ASSERT_EQUAL(message, getText(element)); } /** @@ -226,9 +214,9 @@ */ void checkNDCElement(apr_xml_elem* element, std::string message) { std::string tagName = "NDC"; - CPPUNIT_ASSERT_EQUAL(tagName, (std::string) element->name); + LOGUNIT_ASSERT_EQUAL(tagName, (std::string) element->name); std::string dMessage = getText(element); - CPPUNIT_ASSERT_EQUAL(message, dMessage); + LOGUNIT_ASSERT_EQUAL(message, dMessage); } @@ -243,16 +231,16 @@ std::string tagName = "properties"; std::string dataTag = "data"; int childNodeCount = 0; - CPPUNIT_ASSERT_EQUAL(tagName, (std::string) element->name); + LOGUNIT_ASSERT_EQUAL(tagName, (std::string) element->name); for(apr_xml_elem* child = element->first_child; child != NULL; child = child->next) { - CPPUNIT_ASSERT_EQUAL(dataTag, (std::string) child->name); - CPPUNIT_ASSERT_EQUAL(key, getAttribute(child, "name")); - CPPUNIT_ASSERT_EQUAL(value, getAttribute(child, "value")); + LOGUNIT_ASSERT_EQUAL(dataTag, (std::string) child->name); + LOGUNIT_ASSERT_EQUAL(key, getAttribute(child, "name")); + LOGUNIT_ASSERT_EQUAL(value, getAttribute(child, "value")); childNodeCount++; } - CPPUNIT_ASSERT_EQUAL(1, childNodeCount); + LOGUNIT_ASSERT_EQUAL(1, childNodeCount); } public: @@ -281,7 +269,7 @@ checkMessageElement(node, "Hello, World"); } - CPPUNIT_ASSERT_EQUAL(1, childElementCount); + LOGUNIT_ASSERT_EQUAL(1, childElementCount); } @@ -319,7 +307,7 @@ } } - CPPUNIT_ASSERT_EQUAL(2, childElementCount); + LOGUNIT_ASSERT_EQUAL(2, childElementCount); } /** @@ -327,11 +315,11 @@ */ void testGetSetLocationInfo() { XMLLayout layout; - CPPUNIT_ASSERT_EQUAL(false, layout.getLocationInfo()); + LOGUNIT_ASSERT_EQUAL(false, layout.getLocationInfo()); layout.setLocationInfo(true); - CPPUNIT_ASSERT_EQUAL(true, layout.getLocationInfo()); + LOGUNIT_ASSERT_EQUAL(true, layout.getLocationInfo()); layout.setLocationInfo(false); - CPPUNIT_ASSERT_EQUAL(false, layout.getLocationInfo()); + LOGUNIT_ASSERT_EQUAL(false, layout.getLocationInfo()); } /** @@ -391,7 +379,7 @@ } } - CPPUNIT_ASSERT_EQUAL(3, childElementCount); + LOGUNIT_ASSERT_EQUAL(3, childElementCount); } /** @@ -417,14 +405,14 @@ node = node->next) { if (strcmp(node->name, "NDC") == 0) { ndcCount++; - CPPUNIT_ASSERT_EQUAL(ndcMessage, getText(node)); + LOGUNIT_ASSERT_EQUAL(ndcMessage, getText(node)); } } - CPPUNIT_ASSERT_EQUAL(1, ndcCount); + LOGUNIT_ASSERT_EQUAL(1, ndcCount); } }; -CPPUNIT_TEST_SUITE_REGISTRATION(XMLLayoutTest); +LOGUNIT_TEST_SUITE_REGISTRATION(XMLLayoutTest); Modified: logging/log4cxx/trunk/src/test/cpp/xml/xmllayouttestcase.cpp URL: http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/test/cpp/xml/xmllayouttestcase.cpp?rev=615984&r1=615983&r2=615984&view=diff ============================================================================== --- logging/log4cxx/trunk/src/test/cpp/xml/xmllayouttestcase.cpp (original) +++ logging/log4cxx/trunk/src/test/cpp/xml/xmllayouttestcase.cpp Mon Jan 28 10:40:19 2008 @@ -15,8 +15,7 @@ * limitations under the License. */ -#include <cppunit/TestFixture.h> -#include <cppunit/extensions/HelperMacros.h> +#include "../logunit.h" #include <log4cxx/logger.h> #include <log4cxx/xml/xmllayout.h> @@ -58,17 +57,16 @@ }; - -class XMLLayoutTestCase : public CppUnit::TestFixture +LOGUNIT_CLASS(XMLLayoutTestCase) { - CPPUNIT_TEST_SUITE(XMLLayoutTestCase); - CPPUNIT_TEST(basic); - CPPUNIT_TEST(locationInfo); - CPPUNIT_TEST(testCDATA); - CPPUNIT_TEST(testNull); - CPPUNIT_TEST(testMDC); - CPPUNIT_TEST(testMDCEscaped); - CPPUNIT_TEST_SUITE_END(); + LOGUNIT_TEST_SUITE(XMLLayoutTestCase); + LOGUNIT_TEST(basic); + LOGUNIT_TEST(locationInfo); + LOGUNIT_TEST(testCDATA); + LOGUNIT_TEST(testNull); + LOGUNIT_TEST(testMDC); + LOGUNIT_TEST(testMDCEscaped); + LOGUNIT_TEST_SUITE_END(); LoggerPtr root; LoggerPtr logger; @@ -114,7 +112,7 @@ throw; } - CPPUNIT_ASSERT(Compare::compare(filteredFile, LOG4CXX_FILE("witness/xmlLayout.1"))); + LOGUNIT_ASSERT(Compare::compare(filteredFile, LOG4CXX_FILE("witness/xmlLayout.1"))); } void locationInfo() @@ -131,7 +129,7 @@ XMLThreadFilter xmlThreadFilter; FilenameFilter xmlFilenameFilter(__FILE__, "XMLLayoutTestCase.java"); Filter line2XX("[23][0-9][0-9]", "X"); - Filter line5X("56", "X"); + Filter line5X("5[0-9]", "X"); std::vector<Filter *> filters; filters.push_back(&xmlFilenameFilter); @@ -150,7 +148,7 @@ throw; } - CPPUNIT_ASSERT(Compare::compare(filteredFile, LOG4CXX_FILE("witness/xmlLayout.2"))); + LOGUNIT_ASSERT(Compare::compare(filteredFile, LOG4CXX_FILE("witness/xmlLayout.2"))); } @@ -196,7 +194,7 @@ throw; } - CPPUNIT_ASSERT(Compare::compare(filteredFile, LOG4CXX_FILE("witness/xmlLayout.3"))); + LOGUNIT_ASSERT(Compare::compare(filteredFile, LOG4CXX_FILE("witness/xmlLayout.3"))); } void testNull() @@ -229,7 +227,7 @@ throw; } - CPPUNIT_ASSERT(Compare::compare(filteredFile, LOG4CXX_FILE("witness/xmlLayout.null"))); + LOGUNIT_ASSERT(Compare::compare(filteredFile, LOG4CXX_FILE("witness/xmlLayout.null"))); } void testMDC() @@ -267,7 +265,7 @@ throw; } - CPPUNIT_ASSERT(Compare::compare(filteredFile, LOG4CXX_FILE("witness/xmlLayout.mdc.1"))); + LOGUNIT_ASSERT(Compare::compare(filteredFile, LOG4CXX_FILE("witness/xmlLayout.mdc.1"))); } // not incuded in the tests for the moment ! @@ -306,7 +304,7 @@ throw; } - CPPUNIT_ASSERT(Compare::compare(filteredFile, LOG4CXX_FILE("witness/xmlLayout.mdc.2"))); + LOGUNIT_ASSERT(Compare::compare(filteredFile, LOG4CXX_FILE("witness/xmlLayout.mdc.2"))); } @@ -356,4 +354,4 @@ } }; -CPPUNIT_TEST_SUITE_REGISTRATION(XMLLayoutTestCase); +LOGUNIT_TEST_SUITE_REGISTRATION(XMLLayoutTestCase);
