[Libreoffice-commits] .: Branch 'feature/tubes2' - 2 commits - .gitignore tubes/inc tubes/qa tubes/README tubes/source tubes/test-config.ini

Will Thompson wjt at kemper.freedesktop.org
Thu Mar 22 04:57:17 PDT 2012


 .gitignore                       |    3 +++
 tubes/README                     |   10 ++++------
 tubes/inc/tubes/manager.hxx      |    6 +++---
 tubes/qa/test-config.ini.example |    5 +++++
 tubes/qa/test_manager.cxx        |   14 ++++++++++----
 tubes/source/manager.cxx         |   11 ++---------
 tubes/test-config.ini            |    3 ---
 7 files changed, 27 insertions(+), 25 deletions(-)

New commits:
commit 9fc45729868d76f450cdbf3bc427a25f55de61aa
Author: Will Thompson <will.thompson at collabora.co.uk>
Date:   Thu Mar 22 11:22:44 2012 +0000

    tubes: Give a useful error when test-config.ini is missing.

diff --git a/.gitignore b/.gitignore
index c1aef58..ce66673 100644
--- a/.gitignore
+++ b/.gitignore
@@ -130,3 +130,6 @@ test/user-template/user/psprint/pspfontcache
 # Somepeople love debugging
 gdbtrace.log
 valgrind.log
+
+# Tubes test stuff
+/tubes/qa/test-config.ini
diff --git a/tubes/README b/tubes/README
index 84d4892..3f2f637 100644
--- a/tubes/README
+++ b/tubes/README
@@ -37,12 +37,10 @@ Status 2012-03-20:
     is silenced down ... :-(
 
 * for the cppunittest needed:
-  * a jabber daemon running on localhost.localdomain
-  * two accounts configured in Empathy
-    * libo1 at localhost.localdomain
-    * libo2 at localhost.localdomain
-  * libo1 and libo2 must be contacts/buddies of each other
-  * both accounts need to be online in Empathy
+  * Configure two Jabber accounts in Empathy
+  * Both must be online and on each other's contact list
+  * Copy qa/test-config.ini.example to qa/test-config.ini, and specify those
+    two accounts' JIDs in it.
 
 * very nasty GMainLoop handling for cppunittest, HOPEFULLY we will get rid of
   that in a real LibO
diff --git a/tubes/qa/test-config.ini.example b/tubes/qa/test-config.ini.example
new file mode 100644
index 0000000..2d03ca8
--- /dev/null
+++ b/tubes/qa/test-config.ini.example
@@ -0,0 +1,5 @@
+# Locally-configured Jabber accounts used by Tubes test suite.  These accounts
+# must both be signed in and on each others' contact lists for the tests to
+# work.
+offerer=libo1 at localhost.localdomain
+accepter=libo2 at localhost.localdomain
diff --git a/tubes/qa/test_manager.cxx b/tubes/qa/test_manager.cxx
index f7461ba..ea5806d 100644
--- a/tubes/qa/test_manager.cxx
+++ b/tubes/qa/test_manager.cxx
@@ -88,6 +88,7 @@ public:
 private:
 // XXX The Jabber accounts specified in test-config.ini need to be setup in
 // Empathy, enabled, connected, and on each other's rosters.
+    rtl::OUString             maTestConfigIniURL;
     rtl::Bootstrap            maTestConfig;
 
     rtl::OUString             maAcc1;
@@ -101,12 +102,15 @@ static TeleManager* mpManager2 = NULL;
 static sal_uInt32 nSentPackets = 0;
 
 TestTeleTubes::TestTeleTubes()
-    : maTestConfig(getURLFromSrc("/tubes/test-config.ini"))
+    : maTestConfigIniURL(getURLFromSrc("/tubes/qa/test-config.ini")),
+      maTestConfig(maTestConfigIniURL)
 {
     TeleManager::addSuffixToNames( "TeleTest");
 
-    CPPUNIT_ASSERT( maTestConfig.getFrom("offerer", maAcc1));
-    CPPUNIT_ASSERT( maTestConfig.getFrom("accepter", maAcc2));
+    CPPUNIT_ASSERT_MESSAGE( "See README for how to set up test-config.ini",
+        maTestConfig.getFrom("offerer", maAcc1));
+    CPPUNIT_ASSERT_MESSAGE( "See README for how to set up test-config.ini",
+        maTestConfig.getFrom("accepter", maAcc2));
 }
 
 TestTeleTubes::~TestTeleTubes()
diff --git a/tubes/test-config.ini b/tubes/test-config.ini
deleted file mode 100644
index dba2be1..0000000
--- a/tubes/test-config.ini
+++ /dev/null
@@ -1,3 +0,0 @@
-# Locally-configured Jabber accounts used by Tubes test suite.
-offerer=libo1 at localhost.localdomain
-accepter=libo2 at localhost.localdomain
commit 8f0ec4cef3f3dc78f27a3e08b68eaa9d0f45608e
Author: Will Thompson <will.thompson at collabora.co.uk>
Date:   Thu Mar 22 11:06:42 2012 +0000

    Make startBuddySession() take a TpAccount *.

diff --git a/tubes/inc/tubes/manager.hxx b/tubes/inc/tubes/manager.hxx
index 7f325c3..122b959 100644
--- a/tubes/inc/tubes/manager.hxx
+++ b/tubes/inc/tubes/manager.hxx
@@ -113,7 +113,7 @@ public:
         @param rBuddy
             The buddy to be connected. Must be a contact of rAccount.
      */
-    bool                    startBuddySession( const rtl::OUString& rAccount, const rtl::OUString& rBuddy );
+    bool                    startBuddySession( TpAccount *pAccount, const rtl::OUString& rBuddy );
 
     void                    unregisterConference( TeleConferencePtr pConference );
 
@@ -195,14 +195,14 @@ public:
      */
     static void             addSuffixToNames( const char* pName );
 
+    TpAccount*              getAccount( const rtl::OString& rAccountID );
+
 private:
 
     TeleConferenceVector    maConferences;
 
     bool                    mbChannelReadyHandlerInvoked : 1;
 
-    TpAccount*              getAccount( const rtl::OString& rAccountID );
-
     static TeleManagerImpl* pImpl;
     static sal_uInt32       nRefCount;
     static rtl::OString     aNameSuffix;
diff --git a/tubes/qa/test_manager.cxx b/tubes/qa/test_manager.cxx
index 63077dc..f7461ba 100644
--- a/tubes/qa/test_manager.cxx
+++ b/tubes/qa/test_manager.cxx
@@ -190,7 +190,9 @@ void TestTeleTubes::testPrepareAccountManager2()
 
 void TestTeleTubes::testStartBuddySession1()
 {
-    bool bStarted = mpManager1->startBuddySession( maAcc1, maAcc2);
+    TpAccount *pAcc1 = mpManager1->getAccount( OUStringToOString( maAcc1, RTL_TEXTENCODING_UTF8));
+    CPPUNIT_ASSERT ( pAcc1 != 0);
+    bool bStarted = mpManager1->startBuddySession( pAcc1, maAcc2);
     CPPUNIT_ASSERT( bStarted == true);
 }
 
diff --git a/tubes/source/manager.cxx b/tubes/source/manager.cxx
index 796e986..2e1c696 100644
--- a/tubes/source/manager.cxx
+++ b/tubes/source/manager.cxx
@@ -392,19 +392,12 @@ bool TeleManager::startGroupSession( const rtl::OUString& rUConferenceRoom, cons
 
 
 /* TODO: factor out common code with startGroupSession() */
-bool TeleManager::startBuddySession( const rtl::OUString& rAccount, const rtl::OUString& rBuddy )
+bool TeleManager::startBuddySession( TpAccount *pAccount, const rtl::OUString& rBuddy )
 {
     INFO_LOGGER( "TeleManager::startBuddySession");
 
     MainLoopFlusher aFlusher( this);
 
-    OString aAccountID( OUStringToOString( rAccount, RTL_TEXTENCODING_UTF8));
-
-    TpAccount* pAccount = getAccount( aAccountID);
-    SAL_WARN_IF( !pAccount, "tubes", "TeleManager::startBuddySession: no account");
-    if (!pAccount)
-        return false;
-
     OString aSessionId( TeleManager::createUuid());
 
     TeleConferencePtr pConference( new TeleConference( this, NULL, aSessionId));
@@ -416,7 +409,7 @@ bool TeleManager::startBuddySession( const rtl::OUString& rAccount, const rtl::O
     pConference->setTarget( aTarget);
 
     SAL_INFO( "tubes", "TeleManager::startBuddySession: creating channel request from "
-            << aAccountID.getStr() << " to " << aTarget.getStr());
+            << tp_account_get_path_suffix( pAccount) << " to " << aTarget.getStr());
 
     GHashTable* pRequest = tp_asv_new(
             TP_PROP_CHANNEL_CHANNEL_TYPE, G_TYPE_STRING, TP_IFACE_CHANNEL_TYPE_DBUS_TUBE,


More information about the Libreoffice-commits mailing list