activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r767613 - in /activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration: Makefile.am main.cpp
Date Wed, 22 Apr 2009 18:45:54 GMT
Author: tabish
Date: Wed Apr 22 18:45:54 2009
New Revision: 767613

URL: http://svn.apache.org/viewvc?rev=767613&view=rev
Log:
http://issues.apache.org/activemq/browse/AMQCPP-238

Modified:
    activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/Makefile.am
    activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/main.cpp

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/Makefile.am
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/Makefile.am?rev=767613&r1=767612&r2=767613&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/Makefile.am (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/Makefile.am Wed Apr 22 18:45:54
2009
@@ -39,6 +39,7 @@
   activemq/test/openwire/OpenwireSlowListenerTest.cpp \
   activemq/test/openwire/OpenwireJmsMessageGroupsTest.cpp \
   TestRegistry.cpp \
+  util/teamcity/TeamCityProgressListener.cpp \
   main.cpp
 
 #  activemq/test/stomp/StompAsyncSenderTest.cpp \

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/main.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/main.cpp?rev=767613&r1=767612&r2=767613&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/main.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/main.cpp Wed Apr 22 18:45:54
2009
@@ -17,16 +17,47 @@
 
 #include <cppunit/extensions/TestFactoryRegistry.h>
 #include <cppunit/ui/text/TestRunner.h>
+#include <cppunit/TestListener.h>
 #include <cppunit/BriefTestProgressListener.h>
+#include <cppunit/Outputter.h>
+#include <cppunit/XmlOutputter.h>
 #include <cppunit/TestResult.h>
+#include <util/teamcity/TeamCityProgressListener.h>
 #include <activemq/util/Config.h>
 #include <activemq/library/ActiveMQCPP.h>
+#include <decaf/lang/Runtime.h>
+#include <decaf/lang/Integer.h>
 #include <iostream>
+#include <memory>
 
 int main( int argc AMQCPP_UNUSED, char **argv AMQCPP_UNUSED ) {
 
     activemq::library::ActiveMQCPP::initializeLibrary();
 
+    bool wasSuccessful = false;
+    std::ofstream outputFile;
+    bool useXMLOutputter = false;
+    std::auto_ptr<CppUnit::TestListener> listener( new CppUnit::BriefTestProgressListener
);
+
+    if( argc > 1 ) {
+        for( int i = 1; i < argc; ++i ) {
+            const std::string arg( argv[i] );
+            if( arg == "-teamcity" ) {
+                listener.reset( new test::util::teamcity::TeamCityProgressListener() );
+            } else if( arg == "-quiet" ) {
+                listener.reset( NULL );
+            } else if( arg == "-xml" ) {
+                if( ( i + 1 ) >= argc ) {
+                    std::cout << "-xml requires a filename to be specified" <<
std::endl;
+                    return -1;
+                }
+
+                std::ofstream outputFile( argv[++i] );
+                useXMLOutputter = true;
+            }
+        }
+    }
+
     try {
 
         CppUnit::TextUi::TestRunner runner;
@@ -34,10 +65,22 @@
         runner.addTest( registry.makeTest() );
 
         // Shows a message as each test starts
-        CppUnit::BriefTestProgressListener listener;
-        runner.eventManager().addListener( &listener );
+        if( listener.get() != NULL ) {
+            runner.eventManager().addListener( listener.get() );
+        }
+
+        // Specify XML output and inform the test runner of this format.  The TestRunner
+        // will delete the passed XmlOutputter for us.
+        if( useXMLOutputter ) {
+            runner.setOutputter( new CppUnit::XmlOutputter( &runner.result(), outputFile
) );
+        }
 
         bool wasSuccessful = runner.run( "", false );
+
+        if( useXMLOutputter ) {
+            outputFile.close();
+        }
+
         activemq::library::ActiveMQCPP::shutdownLibrary();
 
         return !wasSuccessful;



Mime
View raw message