summaryrefslogtreecommitdiff
path: root/include/cppunit/plugin/PlugInManager.h
diff options
context:
space:
mode:
authorBaptiste Lepilleur <gaiacrtn@free.fr>2002-04-17 21:27:28 +0000
committerBaptiste Lepilleur <gaiacrtn@free.fr>2002-04-17 21:27:28 +0000
commit87e5cf8f526380c40f63208c6c9e785f73d327b7 (patch)
treeba1871a917dfae7667b31587ced4072d5d18657d /include/cppunit/plugin/PlugInManager.h
parent6c1e9ed0f8fd7339084186df71b4dfc4c98a524e (diff)
downloadcppunit-87e5cf8f526380c40f63208c6c9e785f73d327b7.tar.gz
Bumped version to 1.
bumped version to 1.9.3 * FAQ: added question about 4786 warning on VC++. * NEWS: updated. * contrib/msvc/readme.txt: moved to contrib/readme.txt. * contrib/xml-xsl/report.xsl: added XML style sheet contributed by 'cuppa' project team (http://sourceforge.jp/projects/cuppa/) * examples/cppunittest/TestResultTest.h: * examples/cppunittest/TestResultTest.cpp: added tests for startTestRun()/endTestRun(). * examples/simple/*: added. A simple example. * include/cppunit/BriefTestProgressListener.h: * src/cppunit/BriefTestProgressListener.cpp: added. Verbose progess listener that print the test name before running the test. * include/cppunit/TestListener.h: added startTestRun()/endTestRun(). * include/cppunit/TestResult.h: * src/cppunit/TestResult.cpp: added runTest(), to be called to run a test by test runner. * src/cppunit/TextTestRunner.cpp: * src/cppunit/TestRunner.cpp: updated to use TestResult::runTest(). * include/cppunit/plugin/PlugInManager.h: * src/cppunit/PlugInManager.cpp: added. Managers for all loaded plug-ins. * include/cppunit/plugin/TestPlugInDefaultImpl.h: * src/cppunit/TestPlugInDefaultImpl.cpp: renamed TestPlugInAdapter. All implementations are empty. * include/cppunit/plugin/TestPlugInSuite.h: removed. * src/cppunit/TestPlugInSuite.cpp: removed. Replaced by PlugInManager. * include/cppunit/plugin/TestPlugIn.h: rewrote the plug-in interface to provide more versatility. updated macros to match new interface. * include/cppunit/extensions/TestFactoryRegistry.h: * include/cppunit/extensions/TestFactoryRegistry.cpp: Added unregisterFactory(). Added convenience method addRegistry(). Rewrote registry life cycle management. AutoRegisterSuite can now detect that the registry has been destroy and not call to it to unregister its test factory. * include/cppunit/extensions/AutoRegisterTest.h: on destruction, the registered factory is unregistered from the registry. * include/cppunit/extensions/HelperMacros.h: added macros CPPUNIT_REGISTRY_ADD_TO_DEFAULT and CPPUNIT_REGISTRY_ADD to help build test suite hierarchy. * src/cppunit/msvc/DllPlugInTester/*: moved to src/cppunit/DllPlugInTester/. * src/cppunit/DllPlugInTester/DllPlugInTester.cpp: removed UNICODE stuffs. Use the PlugInManager instead of PlugInTestSuite. Simplified: only one test on command line, but many DLL can be specified. Added configurations to link against cppunit dll, those are now the default configuration (static linking don't make much sense for plug-in).
Diffstat (limited to 'include/cppunit/plugin/PlugInManager.h')
-rw-r--r--include/cppunit/plugin/PlugInManager.h101
1 files changed, 101 insertions, 0 deletions
diff --git a/include/cppunit/plugin/PlugInManager.h b/include/cppunit/plugin/PlugInManager.h
new file mode 100644
index 0000000..d3bbc5f
--- /dev/null
+++ b/include/cppunit/plugin/PlugInManager.h
@@ -0,0 +1,101 @@
+#ifndef CPPUNIT_PLUGIN_PLUGINMANAGER_H
+#define CPPUNIT_PLUGIN_PLUGINMANAGER_H
+
+#include <cppunit/Portability.h>
+
+#if !defined(CPPUNIT_NO_TESTPLUGIN)
+
+#if CPPUNIT_NEED_DLL_DECL
+#pragma warning( push )
+#pragma warning( disable: 4251 ) // X needs to have dll-interface to be used by clients of class Z
+#endif
+
+#include <cppunit/plugin/Parameters.h>
+struct CppUnitTestPlugIn;
+
+namespace CppUnit
+{
+
+class DynamicLibraryManager;
+class TestResult;
+
+
+/*! \brief Manges TestPlugIn.
+ */
+class CPPUNIT_API PlugInManager
+{
+public:
+ /*! Constructs a PlugInManager object.
+ */
+ PlugInManager();
+
+ /// Destructor.
+ virtual ~PlugInManager();
+
+ /*! Loads the specified plug-in.
+ *
+ * After being loaded, the CppUnitTestPlugIn::initialize() is called.
+ *
+ * \param libraryFileName Name of the file that contains the TestPlugIn.
+ * \param parameters List of string passed to the plug-in.
+ * \return Pointer on the DynamicLibraryManager associated to the library.
+ * Valid until the library is unloaded. Never \c NULL.
+ * \exception DynamicLibraryManager is thrown if an error occurs during loading.
+ */
+ void load( const std::string &libraryFileName,
+ const Parameters &parameters = Parameters() );
+
+ /*! Unloads the specified plug-in.
+ * \param libraryFileName Name of the file that contains the TestPlugIn passed
+ * to a previous call to load().
+ */
+ void unload( const std::string &libraryFileName );
+
+ /*! Gives a chance to each loaded plug-in to register TestListener.
+ *
+ * For each plug-in, call CppUnitTestPlugIn::addListener().
+ */
+ void addListener( TestResult *eventManager );
+
+ /*! Gives a chance to each loaded plug-in to unregister TestListener.
+ * For each plug-in, call CppUnitTestPlugIn::removeListener().
+ */
+ void removeListener( TestResult *eventManager );
+
+protected:
+ struct PlugInInfo
+ {
+ std::string m_fileName;
+ DynamicLibraryManager *m_manager;
+ CppUnitTestPlugIn *m_interface;
+ };
+
+ /*! Unloads the specified plug-in.
+ * \param plugIn Information about the plug-in.
+ */
+ void unload( PlugInInfo &plugIn );
+
+private:
+ /// Prevents the use of the copy constructor.
+ PlugInManager( const PlugInManager &copy );
+
+ /// Prevents the use of the copy operator.
+ void operator =( const PlugInManager &copy );
+
+private:
+ typedef std::deque<PlugInInfo> PlugIns;
+ PlugIns m_plugIns;
+};
+
+
+} // namespace CppUnit
+
+
+#if CPPUNIT_NEED_DLL_DECL
+#pragma warning( pop )
+#endif
+
+#endif // !defined(CPPUNIT_NO_TESTPLUGIN)
+
+
+#endif // CPPUNIT_PLUGIN_PLUGINMANAGER_H