summaryrefslogtreecommitdiff
path: root/testshl2/inc/testshl/result
diff options
context:
space:
mode:
Diffstat (limited to 'testshl2/inc/testshl/result')
-rw-r--r--testshl2/inc/testshl/result/SynchronizedObject.h82
-rw-r--r--testshl2/inc/testshl/result/TestListener.h62
-rw-r--r--testshl2/inc/testshl/result/TestResult.h123
-rw-r--r--testshl2/inc/testshl/result/TestResultCollector.h165
-rw-r--r--testshl2/inc/testshl/result/TestSucessListener.h40
-rw-r--r--testshl2/inc/testshl/result/TextTestResult.h62
-rw-r--r--testshl2/inc/testshl/result/callbackfunc.h25
-rw-r--r--testshl2/inc/testshl/result/emacsTestResult.hxx82
-rw-r--r--testshl2/inc/testshl/result/log.hxx106
-rw-r--r--testshl2/inc/testshl/result/optionhelper.hxx98
-rw-r--r--testshl2/inc/testshl/result/outputter.hxx85
-rw-r--r--testshl2/inc/testshl/result/testshlTestResult.h72
12 files changed, 1002 insertions, 0 deletions
diff --git a/testshl2/inc/testshl/result/SynchronizedObject.h b/testshl2/inc/testshl/result/SynchronizedObject.h
new file mode 100644
index 000000000000..6994fdb1692e
--- /dev/null
+++ b/testshl2/inc/testshl/result/SynchronizedObject.h
@@ -0,0 +1,82 @@
+#ifndef CPPUNIT_SYNCHRONIZEDOBJECT_H
+#define CPPUNIT_SYNCHRONIZEDOBJECT_H
+
+#include <cppunit/Portability.h>
+#include <testshl/nocopy.hxx>
+
+namespace CppUnit
+{
+
+/*! \brief Base class for synchronized object.
+ *
+ * Synchronized object are object which members are used concurrently by mutiple
+ * threads.
+ *
+ * This class define the class SynchronizationObject which must be subclassed
+ * to implement an actual lock.
+ *
+ * Each instance of this class holds a pointer on a lock object.
+ *
+ * See src/msvc6/MfcSynchronizedObject.h for an example.
+ */
+class CPPUNIT_API SynchronizedObject
+{
+public:
+ /*! \brief Abstract synchronization object (mutex)
+ */
+ class SynchronizationObject
+ {
+ public:
+ SynchronizationObject() {}
+ virtual ~SynchronizationObject() {}
+
+ virtual void lock() {}
+ virtual void unlock() {}
+ };
+
+ /*! Constructs a SynchronizedObject object.
+ */
+ SynchronizedObject( SynchronizationObject *syncObject =0 );
+
+ /// Destructor.
+ virtual ~SynchronizedObject();
+
+protected:
+ /*! \brief Locks a synchronization object in the current scope.
+ */
+ class ExclusiveZone : NOCOPY
+ {
+ SynchronizationObject *m_syncObject;
+
+ public:
+ ExclusiveZone( SynchronizationObject *syncObject )
+ : m_syncObject( syncObject )
+ {
+ m_syncObject->lock();
+ }
+
+ ~ExclusiveZone()
+ {
+ m_syncObject->unlock ();
+ }
+ };
+
+ virtual void setSynchronizationObject( SynchronizationObject *syncObject );
+
+protected:
+ SynchronizationObject *m_syncObject;
+
+private:
+ /// Prevents the use of the copy constructor.
+ SynchronizedObject( const SynchronizedObject &copy );
+
+ /// Prevents the use of the copy operator.
+ void operator =( const SynchronizedObject &copy );
+};
+
+
+
+} // namespace CppUnit
+
+
+#endif // CPPUNIT_SYNCHRONIZEDOBJECT_H
diff --git a/testshl2/inc/testshl/result/TestListener.h b/testshl2/inc/testshl/result/TestListener.h
new file mode 100644
index 000000000000..0814f21b7e2f
--- /dev/null
+++ b/testshl2/inc/testshl/result/TestListener.h
@@ -0,0 +1,62 @@
+#ifndef CPPUNIT_TESTLISTENER_H // -*- C++ -*-
+#define CPPUNIT_TESTLISTENER_H
+
+#include <cppunit/Portability.h>
+
+
+namespace CppUnit {
+
+class Exception;
+class Test;
+class TestFailure;
+
+
+/*! \brief Listener for test progress and result.
+ * \ingroup TrackingTestExecution
+ *
+ * Implementing the Observer pattern a TestListener may be registered
+ * to a TestResult to obtain information on the testing progress. Use
+ * specialized sub classes of TestListener for text output
+ * (TextTestProgressListener). Do not use the Listener for the test
+ * result output, use a subclass of Outputter instead.
+ *
+ * The test framework distinguishes between failures and errors.
+ * A failure is anticipated and checked for with assertions. Errors are
+ * unanticipated problems signified by exceptions that are not generated
+ * by the framework.
+ *
+ * \see TestResult
+ */
+class CPPUNIT_API TestListener
+{
+public:
+ virtual ~TestListener() {}
+
+ /// Called when just before a TestCase is run.
+ virtual void startTest( Test *test ) =0 ;
+
+ /*! Called when a failure occurs while running a test.
+ * \see TestFailure.
+ * \warning \a failure is a temporary object that is destroyed after the
+ * method call. Use TestFailure::clone() to create a duplicate.
+ */
+ virtual void addFailure( const TestFailure &failure ) =0;
+
+ /// Called just after a TestCase was run (even if a failure occured).
+ virtual void endTest( Test *test ) =0;
+
+ // additional info
+ virtual void addInfo(Test *test, const char*) =0;
+
+ // info in which node we are
+ // helper functions to create tree structures
+ // old: virtual void enterNode( const char* ) =0;
+ // old: virtual void leaveNode( const char* ) =0;
+};
+
+
+} // namespace CppUnit
+
+#endif // CPPUNIT_TESTLISTENER_H
+
+
diff --git a/testshl2/inc/testshl/result/TestResult.h b/testshl2/inc/testshl/result/TestResult.h
new file mode 100644
index 000000000000..22b5d2346664
--- /dev/null
+++ b/testshl2/inc/testshl/result/TestResult.h
@@ -0,0 +1,123 @@
+#ifndef CPPUNIT_TESTRESULT_H
+#define CPPUNIT_TESTRESULT_H
+
+#include <cppunit/Portability.h>
+
+#if CPPUNIT_NEED_DLL_DECL
+#ifdef _MSC_VER
+#pragma warning( push )
+#pragma warning( disable: 4251 ) // X needs to have dll-interface to be used by clients of class Z
+#endif
+#endif
+
+#include <testshl/result/SynchronizedObject.h>
+#include <vector>
+#include <string>
+#include <deque>
+//!io #include <iostream>
+
+#include "testshl/result/optionhelper.hxx"
+#include "cppunit/TestFailure.h"
+
+class Outputter;
+namespace CppUnit {
+
+class Exception;
+class Test;
+// class TestFailure;
+class TestListener;
+
+#if CPPUNIT_NEED_DLL_DECL
+ template class CPPUNIT_API std::deque<TestListener *>;
+#endif
+
+/*! \brief Manages TestListener.
+ * \ingroup TrackingTestExecution
+ *
+ * A single instance of this class is used when running the test. It is usually
+ * created by the test runner (TestRunner).
+ *
+ * This class shouldn't have to be inherited from. Use a TestListener
+ * or one of its subclasses to be informed of the ongoing tests.
+ * Use a Outputter to receive a test summary once it has finished
+ *
+ * TestResult supplies a template method 'setSynchronizationObject()'
+ * so that subclasses can provide mutual exclusion in the face of multiple
+ * threads. This can be useful when tests execute in one thread and
+ * they fill a subclass of TestResult which effects change in another
+ * thread. To have mutual exclusion, override setSynchronizationObject()
+ * and make sure that you create an instance of ExclusiveZone at the
+ * beginning of each method.
+ *
+ * \see Test, TestListener, TestResultCollector, Outputter.
+ */
+class CPPUNIT_API TestResult : protected SynchronizedObject
+{
+protected:
+ OptionHelper m_aOptionHelper;
+
+public:
+ TestResult( GetOpt & _aOptions, SynchronizationObject *syncObject = 0 );
+ virtual ~TestResult();
+
+ virtual void addListener( TestListener *listener );
+ virtual void removeListener( TestListener *listener );
+
+ virtual void reset();
+ virtual void stop();
+
+ virtual bool shouldStop() const;
+
+ virtual void startTest( Test *test );
+ virtual void addError( Test *test, Exception *e, ErrorType::num eType=ErrorType::ET_ERROR);
+ virtual void addFailure( Test *test, Exception *e );
+ virtual void endTest( Test *test );
+
+ // LLA: additionals
+ virtual void addInfo(Test *test, const char *sInfo);
+
+ virtual void enterNode(const char* Node);
+ virtual void leaveNode(const char* Node);
+ virtual std::string getNodeName();
+
+ // if true, execution is allowed.
+ virtual bool isAllowedToExecute(std::string const & sName);
+ bool isOnlyShowJobs() {return m_aOptionHelper.isOnlyShowJobs();}
+ bool isOptionWhereAmI();
+
+ virtual void print(Outputter &);
+ void setExitValue(int _nValue) {m_nExitValue = _nValue;}
+ int getExitValue() {return m_nExitValue;}
+
+protected:
+ void addFailure( const TestFailure &failure );
+
+protected:
+ typedef std::deque<TestListener *> TestListeners;
+ TestListeners m_listeners;
+ bool m_stop;
+
+ // this vector is used to expand the test name with a current node name
+ std::vector<std::string> m_aCurrentNodeNames;
+
+ //# std::vector<std::string> m_aNodes;
+
+private:
+ TestResult( const TestResult &other );
+ TestResult &operator =( const TestResult &other );
+ int m_nExitValue;
+};
+
+
+} // namespace CppUnit
+
+
+#if CPPUNIT_NEED_DLL_DECL
+#ifdef _MSC_VER
+#pragma warning( pop )
+#endif
+#endif
+
+#endif // CPPUNIT_TESTRESULT_H
+
+
diff --git a/testshl2/inc/testshl/result/TestResultCollector.h b/testshl2/inc/testshl/result/TestResultCollector.h
new file mode 100644
index 000000000000..ddbe517f8935
--- /dev/null
+++ b/testshl2/inc/testshl/result/TestResultCollector.h
@@ -0,0 +1,165 @@
+#ifndef CPPUNIT_TESTRESULTCOLLECTOR_H
+#define CPPUNIT_TESTRESULTCOLLECTOR_H
+
+#include <cppunit/Portability.h>
+
+#if CPPUNIT_NEED_DLL_DECL
+#ifdef _MSC_VER
+#pragma warning( push )
+#pragma warning( disable: 4251 ) // X needs to have dll-interface to be used by clients of class Z
+#endif
+#endif
+
+#include <testshl/result/TestResult.h>
+#include <testshl/result/TestSucessListener.h>
+#include <deque>
+#include <vector>
+
+namespace CppUnit
+{
+
+
+#if CPPUNIT_NEED_DLL_DECL
+ template class CPPUNIT_API std::deque<TestFailure *>;
+ template class CPPUNIT_API std::deque<Test *>;
+#endif
+
+
+/*! \brief Collects test result.
+ * \ingroup WritingTestResult
+ * \ingroup BrowsingCollectedTestResult
+ *
+ * A TestResultCollector is a TestListener which collects the results of executing
+ * a test case. It is an instance of the Collecting Parameter pattern.
+ *
+ * The test framework distinguishes between failures and errors.
+ * A failure is anticipated and checked for with assertions. Errors are
+ * unanticipated problems signified by exceptions that are not generated
+ * by the framework.
+ * \see TestListener, TestFailure.
+ */
+
+class OneStringContainer
+{
+ std::string m_sName;
+protected:
+ OneStringContainer() {}
+public:
+ OneStringContainer(std::string const& _sName)
+ :m_sName(_sName){}
+ std::string getString() const {return m_sName;}
+ virtual ~OneStringContainer(){}
+};
+
+// -----------------------------------------------------------------------------
+class TestEnvelope : public OneStringContainer
+{
+ Test* m_pTest;
+public:
+ TestEnvelope():m_pTest(NULL){}
+
+ TestEnvelope(Test* _pTest, std::string const& _sName)
+ : OneStringContainer(_sName),
+ m_pTest(_pTest)
+ {}
+
+ Test* getTest() {return m_pTest;}
+ virtual ~TestEnvelope(){}
+
+};
+
+// -----------------------------------------------------------------------------
+class TestInfo : public TestEnvelope
+{
+public:
+ TestInfo(Test* _pTest, std::string const& _sName)
+ :TestEnvelope(_pTest, _sName)
+ {}
+};
+
+// -----------------------------------------------------------------------------
+class TestFailureEnvelope : public OneStringContainer
+{
+ TestFailure* m_pTestFailure;
+public:
+ TestFailureEnvelope():m_pTestFailure(NULL){}
+
+ TestFailureEnvelope(TestFailure* _pTestFailure, std::string const& _sName)
+ :OneStringContainer(_sName),
+ m_pTestFailure(_pTestFailure)
+ {}
+
+ TestFailure* getTestFailure() {return m_pTestFailure;}
+ virtual ~TestFailureEnvelope(){}
+
+};
+// -----------------------------------------------------------------------------
+
+class CPPUNIT_API TestResultCollector : public TestSucessListener
+{
+ TestResult* m_pResult;
+public:
+ typedef std::deque<TestFailureEnvelope *> TestFailures;
+ typedef std::deque<TestEnvelope *> Tests;
+ typedef std::vector<TestInfo *> TestInfos;
+
+
+ /*! Constructs a TestResultCollector object.
+ */
+ TestResultCollector( TestResult *_pResult, SynchronizationObject *syncObject = 0 );
+
+ /// Destructor.
+ virtual ~TestResultCollector();
+
+ void startTest( Test *test );
+ void endTest( Test *test );
+
+ void addFailure( const TestFailure &failure );
+
+ virtual void reset();
+
+ virtual int runTests() const;
+ virtual int testErrors() const;
+ virtual int testFailures() const;
+ virtual int testFailuresTotal() const;
+
+ virtual const TestFailures& failures() const;
+ virtual const Tests &tests() const;
+ virtual std::string getInfo(Test*);
+
+ virtual void addInfo(Test *test, const char *sInfo);
+
+ // virtual void enterNode(const char* Node);
+ // virtual void leaveNode(const char* Node);
+
+protected:
+ Tests m_tests;
+ TestFailures m_failures;
+ TestInfos m_aInfos;
+
+ int m_testErrors;
+
+ // this vector is used to expand the test name with a current node name
+ // std::vector<std::string> m_aCurrentNodeNames;
+ // std::string getNodeName();
+private:
+ /// Prevents the use of the copy constructor.
+ TestResultCollector( const TestResultCollector &copy );
+
+ /// Prevents the use of the copy operator.
+ void operator =( const TestResultCollector &copy );
+};
+
+
+
+} // namespace CppUnit
+
+
+#if CPPUNIT_NEED_DLL_DECL
+#ifdef _MSC_VER
+#pragma warning( pop )
+#endif
+#endif
+
+
+#endif // CPPUNIT_TESTRESULTCOLLECTOR_H
diff --git a/testshl2/inc/testshl/result/TestSucessListener.h b/testshl2/inc/testshl/result/TestSucessListener.h
new file mode 100644
index 000000000000..3eb53b9fc13f
--- /dev/null
+++ b/testshl2/inc/testshl/result/TestSucessListener.h
@@ -0,0 +1,40 @@
+#ifndef CPPUNIT_TESTSUCESSLISTENER_H
+#define CPPUNIT_TESTSUCESSLISTENER_H
+
+#include <testshl/result/SynchronizedObject.h>
+#include <testshl/result/TestListener.h>
+
+
+namespace CppUnit
+{
+
+/*! \brief TestListener that checks if any test case failed.
+ * \ingroup TrackingTestExecution
+ */
+class CPPUNIT_API TestSucessListener : public TestListener,
+ public SynchronizedObject
+{
+public:
+ /*! Constructs a TestSucessListener object.
+ */
+ TestSucessListener( SynchronizationObject *syncObject = 0 );
+
+ /// Destructor.
+ virtual ~TestSucessListener();
+
+ virtual void reset();
+
+ void addFailure( const TestFailure &failure );
+
+ /// Returns whether the entire test was successful or not.
+ virtual bool wasSuccessful() const;
+
+private:
+ bool m_sucess;
+};
+
+
+} // namespace CppUnit
+
+
+#endif // CPPUNIT_TESTSUCESSLISTENER_H
diff --git a/testshl2/inc/testshl/result/TextTestResult.h b/testshl2/inc/testshl/result/TextTestResult.h
new file mode 100644
index 000000000000..e2ba0ffba427
--- /dev/null
+++ b/testshl2/inc/testshl/result/TextTestResult.h
@@ -0,0 +1,62 @@
+#ifndef CPPUNIT_TEXTTESTRESULT_H
+#define CPPUNIT_TEXTTESTRESULT_H
+
+#include <testshl/result/TestResult.h>
+#include <testshl/result/TestResultCollector.h>
+#include <ostream>
+
+class GetOpt;
+namespace CppUnit {
+
+class SourceLine;
+class Exception;
+class Test;
+
+/*! \brief Holds printable test result (DEPRECATED).
+ * \ingroup TrackingTestExecution
+ *
+ * deprecated Use class TextTestProgressListener and TextOutputter instead.
+ */
+class CPPUNIT_API TextTestResult : public TestResult
+/* public TestResultCollector*/
+{
+ TestResultCollector m_aResulter;
+public:
+ TextTestResult(GetOpt& _aOptions);
+
+ virtual void addFailure( const TestFailure &failure );
+ virtual void startTest( Test *test );
+ virtual void endTest( Test *test );
+
+ virtual void print( std::ostream &stream );
+protected:
+
+ virtual void printFailures( std::ostream &stream );
+ virtual void printHeader( std::ostream &stream );
+
+ virtual void printFailure( TestFailure *failure,
+ int failureNumber,
+ std::ostream &stream );
+ virtual void printFailureListMark( int failureNumber,
+ std::ostream &stream );
+ virtual void printFailureTestName( TestFailure *failure,
+ std::ostream &stream );
+ virtual void printFailureType( TestFailure *failure,
+ std::ostream &stream );
+ virtual void printFailureLocation( SourceLine sourceLine,
+ std::ostream &stream );
+ virtual void printFailureDetail( Exception *thrownException,
+ std::ostream &stream );
+ virtual void printFailureWarning( std::ostream &stream );
+ virtual void printStatistics( std::ostream &stream );
+};
+
+/** insertion operator for easy output */
+std::ostream &operator <<( std::ostream &stream,
+ TextTestResult &result );
+
+} // namespace CppUnit
+
+#endif // CPPUNIT_TEXTTESTRESULT_H
+
+
diff --git a/testshl2/inc/testshl/result/callbackfunc.h b/testshl2/inc/testshl/result/callbackfunc.h
new file mode 100644
index 000000000000..606bf7179163
--- /dev/null
+++ b/testshl2/inc/testshl/result/callbackfunc.h
@@ -0,0 +1,25 @@
+#ifndef _callbackfunc_h
+#define _callbackfunc_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+ // this is the entry point from the DLL back to the executable.
+ long CallbackDispatch(int x, ...);
+
+//# void TestResult_startTest(hTestResult _pResult, hTest _pTest);
+//# void TestResult_addFailure( hTestResult _pResult, hTest _pTest, hException _pException );
+//# void TestResult_addError( hTestResult _pResult, hTest _pTest, hException _pException );
+//# void TestResult_endTest( hTestResult _pResult, hTest _pTest );
+//# bool TestResult_shouldStop(hTestResult _pResult);
+//# void TestResult_addInfo( hTestResult _pResult, hTest _pTest, const char* _sInfo );
+//#
+//# void TestResult_enterNode( hTestResult _pResult, const char* _sInfo );
+//# void TestResult_leaveNode( hTestResult _pResult, const char* _sInfo );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/testshl2/inc/testshl/result/emacsTestResult.hxx b/testshl2/inc/testshl/result/emacsTestResult.hxx
new file mode 100644
index 000000000000..7198ad7ce852
--- /dev/null
+++ b/testshl2/inc/testshl/result/emacsTestResult.hxx
@@ -0,0 +1,82 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile$
+ * $Revision$
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef cppunit_emacstestresult_h
+#define cppunit_emacstestresult_h
+
+#include <testshl/result/TestResult.h>
+#include <testshl/result/TestResultCollector.h>
+#include <ostream>
+#include "testshl/getopt.hxx"
+
+class Outputter;
+namespace CppUnit {
+
+class SourceLine;
+class Exception;
+class Test;
+
+/*! \brief Holds printable test result (DEPRECATED).
+ * \ingroup TrackingTestExecution
+ *
+ * deprecated Use class TextTestProgressListener and TextOutputter instead.
+ */
+ class CPPUNIT_API emacsTestResult : public TestResult
+
+/* ,public TestResultCollector*/
+ {
+ GetOpt & m_aOptions;
+ // OptionHelper m_aOptionHelper;
+ TestResultCollector m_aResulter;
+
+ public:
+ emacsTestResult(GetOpt & _aOptions);
+
+ // virtual void addFailure( const TestFailure &failure );
+ // virtual void startTest( Test *test );
+ // virtual void endTest( Test *test );
+
+ virtual void print( Outputter &stream );
+
+ protected:
+ virtual void printHeader( Outputter &stream );
+ // virtual void printTestLine( Outputter &stream, Test* pTest, std::string const& _sNodeName, std::string const& _sInfo);
+ virtual void printFailureLine( Outputter &stream, TestFailure* pFailure, std::string const& _sNodeName );
+ };
+
+/** insertion operator for easy output */
+// std::ostream &operator <<( std::ostream &stream,
+// emacsTestResult &result );
+
+} // namespace CppUnit
+
+#endif // CPPUNIT_testshlTESTRESULT_H
+
+
diff --git a/testshl2/inc/testshl/result/log.hxx b/testshl2/inc/testshl/result/log.hxx
new file mode 100644
index 000000000000..fe5816a7cb17
--- /dev/null
+++ b/testshl2/inc/testshl/result/log.hxx
@@ -0,0 +1,106 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile$
+ * $Revision$
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef __QADEV_REGSCAN_LOG_HXX__
+#define __QADEV_REGSCAN_LOG_HXX__
+
+#include <time.h>
+#include <rtl/ustring.hxx>
+#include <rtl/strbuf.hxx>
+#include <sal/types.h>
+#include <osl/thread.h>
+#include <osl/file.hxx>
+
+#include <testshl/nocopy.hxx>
+
+//!io #include <iostream>
+#include <vector>
+
+// using namespace std;
+
+
+/**
+ * Log derives the interface of the ::osl::File class ( is-a relation ).
+ * Its members (has-a relation) are the (full qualified)name of the log
+ * and an OStringBuffer which represents the content of the logfile.
+ * It provides the functionality of easy-to-use open and write logs
+ */
+//: Log
+class Log : NOCOPY {
+
+ ::osl::File* m_logfile; // fileobject
+ rtl::OUString m_logurl; // url of log
+ rtl::OStringBuffer m_buf; // content of log
+
+ Log();
+
+public:
+
+ //> c'tor
+ /**
+ * constructors argument is a full qualified UNC path
+ * @param OUString logfile ( full qualified UNC path )
+ */
+ Log( const rtl::OUString& logURL )
+ : m_logfile( new ::osl::File( logURL ))
+ , m_logurl(logURL)
+ {} ///< c'tor
+
+ //> d'tor
+ virtual ~Log()
+ {
+ m_logfile->close();
+ delete( m_logfile );
+ } ///< d'tor
+
+ //> inline methods
+ // returns a reference to name instance
+ inline rtl::OUString getLogURL() { return m_logurl; }
+ inline rtl::OString getName() { return rtl::OUStringToOString(
+ m_logurl, RTL_TEXTENCODING_ASCII_US ); }
+ ///< inline methods
+
+ // open logfile for overwrite (default) or append
+ ::osl::FileBase::RC open( sal_Bool append = sal_False );
+ ::osl::FileBase::RC close() { return m_logfile->close(); }
+
+
+ // write methods without (default) or with echo on display
+ ::osl::FileBase::RC write( const sal_Char* buf, sal_Bool v = sal_False );
+ ::osl::FileBase::RC write( const rtl::OString& buf,
+ sal_Bool v = sal_False );
+ //! ::osl::FileBase::RC write( rtl::OStringBuffer& buf,
+ //! sal_Bool v = sal_False );
+ ::osl::FileBase::RC write( const rtl::OUString& buf,
+ rtl_TextEncoding enc = RTL_TEXTENCODING_ASCII_US,
+ sal_Bool v = sal_False );
+
+}; ///:~ Log
+
+#endif
diff --git a/testshl2/inc/testshl/result/optionhelper.hxx b/testshl2/inc/testshl/result/optionhelper.hxx
new file mode 100644
index 000000000000..a3ae28cc4c81
--- /dev/null
+++ b/testshl2/inc/testshl/result/optionhelper.hxx
@@ -0,0 +1,98 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile$
+ * $Revision$
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef optionhelper_hxx
+#define optionhelper_hxx
+
+#include <string>
+
+#include <sal/types.h>
+
+#include "testshl/nocopy.hxx"
+#include "testshl/getopt.hxx"
+#include "testshl/joblist.hxx"
+
+// -----------------------------------------------------------------------------
+
+typedef std::vector<rtl::OString> OStringList;
+
+//!? Better: OptionHelper
+class OptionHelper : NOCOPY
+{
+ GetOpt & m_aOption;
+ JobList m_aJobOnlyList;
+ JobList m_aJobExcludeList;
+ OStringList m_aJobFilter;
+
+ std::string m_sProjectId;
+ std::string m_sBuildId;
+
+ std::string getProjectId() const;
+ std::string getBuildId() const;
+ std::string createDateTag(std::string const& _sProjectId, std::string const& _sBuildId);
+
+ void handleJobs();
+public:
+ OptionHelper(GetOpt & _aOption)
+ :m_aOption(_aOption)
+ {
+ if (m_aOption.hasOpt("-projectid"))
+ m_sProjectId = m_aOption.getOpt("-projectid");
+
+ if (m_aOption.hasOpt("-buildid"))
+ m_sBuildId = m_aOption.getOpt("-buildid");
+
+ handleJobs();
+ }
+
+ static std::string integerToAscii(sal_Int32 nValue);
+ static std::string twoDigits(std::string const& _sValue);
+
+ std::string createDateTag();
+ bool showErrors();
+ bool showTests();
+
+ JobList getJobOnlyList() {return m_aJobOnlyList;}
+ JobList getJobExcludeList() {return m_aJobExcludeList;}
+
+ bool isAllowedToExecute(std::string const& _sNode, std::string const& _sName);
+
+ bool isOnlyShowJobs() {return m_aOption.hasOpt("-onlyshowjobs") == sal_True ? true : false;}
+ GetOpt& getOptions() {return m_aOption;}
+ bool isVerbose() {return m_aOption.hasOpt("-verbose") == sal_True ? true : false;}
+ bool isOptionWhereAmI() {return m_aOption.hasOpt("-whereami") == sal_True ? true : false;}
+};
+
+// -----------------------------------------------------------------------------
+
+
+#endif
+
+
diff --git a/testshl2/inc/testshl/result/outputter.hxx b/testshl2/inc/testshl/result/outputter.hxx
new file mode 100644
index 000000000000..9ae49620201e
--- /dev/null
+++ b/testshl2/inc/testshl/result/outputter.hxx
@@ -0,0 +1,85 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile$
+ * $Revision$
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+//
+
+#ifndef outputter_hxx
+#define outputter_hxx
+
+#include <string>
+#include <ostream>
+#include <memory>
+#include "testshl/log.hxx"
+#include <sal/types.h>
+#include "testshl/nocopy.hxx"
+
+// #include <fstream>
+
+class Outputter : NOCOPY
+{
+ std::auto_ptr<Log> m_pLog;
+ std::ostream* m_pStream;
+
+ void writeToAll(const sal_Char* _pStr);
+public:
+ class endl
+ {
+ char c;
+ public:
+ endl():c('\0'){}
+ };
+public:
+ Outputter(Log * _pLog )
+ :m_pLog(_pLog),
+ m_pStream(NULL) {}
+
+ Outputter(std::ostream& _aStream)
+ :m_pLog(NULL),
+ m_pStream(&_aStream) {}
+
+ ~Outputter();
+
+ void write(const sal_Char*);
+ void write(std::string const&);
+ void write(sal_Int32);
+ // void write(double);
+};
+
+Outputter& operator <<( Outputter &stream, const sal_Char* );
+Outputter& operator <<( Outputter &stream, std::string const& );
+Outputter& operator <<( Outputter &stream, sal_Int32 );
+// Outputter& operator <<( Outputter &stream, double );
+
+Outputter& operator <<( Outputter &stream, Outputter::endl const&);
+
+// Outputter& operator <<( Outputter &stream, const char* );
+
+#endif
+
diff --git a/testshl2/inc/testshl/result/testshlTestResult.h b/testshl2/inc/testshl/result/testshlTestResult.h
new file mode 100644
index 000000000000..22a50a9a841e
--- /dev/null
+++ b/testshl2/inc/testshl/result/testshlTestResult.h
@@ -0,0 +1,72 @@
+#ifndef cppunit_testshltestresult_h
+#define cppunit_testshltestresult_h
+
+#include <map>
+#include <testshl/result/TestResult.h>
+#include <testshl/result/TestResultCollector.h>
+#include <ostream>
+#include "testshl/getopt.hxx"
+
+class Outputter;
+
+namespace CppUnit {
+
+class SourceLine;
+class Exception;
+class Test;
+
+struct ltstr
+{
+ bool operator()(const CppUnit::Test* p1, const CppUnit::Test* p2) const
+ {
+ return p1 < p2;
+ }
+};
+typedef std::map<CppUnit::Test*, bool, ltstr> TestPtrList;
+
+
+/*! \brief Holds printable test result (DEPRECATED).
+ * \ingroup TrackingTestExecution
+ *
+ * deprecated Use class TextTestProgressListener and TextOutputter instead.
+ */
+ class CPPUNIT_API testshlTestResult : public TestResult
+
+/* ,public TestResultCollector*/
+ {
+ GetOpt & m_aOptions;
+ // OptionHelper m_aOptionHelper;
+ TestResultCollector m_aResulter;
+
+ public:
+ testshlTestResult(GetOpt & _aOptions);
+ virtual ~testshlTestResult();
+
+ // virtual void addFailure( const TestFailure &failure );
+ // virtual void startTest( Test *test );
+ // virtual void endTest( Test *test );
+
+ virtual void print( Outputter &stream );
+
+ protected:
+ virtual void printHeader( Outputter &stream );
+
+ void printLines(Outputter &stream, HashMap & _aJobList);
+ void printFailedTests(Outputter &stream, TestPtrList &aFailedTests);
+ void printTestLines(Outputter &stream, TestPtrList &aFailedTests);
+ void printUnknownLines(Outputter &stream, HashMap & _aJobList);
+
+ virtual void printTestLine( Outputter &stream, Test* pTest, std::string const& _sNodeName, std::string const& _sInfo);
+ virtual void printFailureLine( Outputter &stream, TestFailure* pFailure, std::string const& _sNodeName );
+ virtual void printUnknownLine( Outputter &stream, std::string const& _sTestName);
+ };
+
+/** insertion operator for easy output */
+ Outputter &operator <<( Outputter &stream,
+ testshlTestResult &result );
+
+} // namespace CppUnit
+
+#endif // CPPUNIT_testshlTESTRESULT_H
+
+