Warning, /pim/kdepim-runtime/resources/maildir/autotests/maildir.xml is written in an unsupported language. File is not indexed.

0001 <knut>
0002   <collection content="message/rfc822,inode/directory" rid="maildir/root" name="akonadi_maildir_resource_1" >
0003     <attribute type="AccessRights" >wcdC</attribute>
0004     <collection content="message/rfc822,inode/directory" rid="child2" name="child2" />
0005     <collection content="message/rfc822,inode/directory" rid="child1" name="child1" >
0006       <collection content="message/rfc822,inode/directory" rid="grandchild" name="grandchild" >
0007         <item mimetype="message/rfc822" rid="1237726881.6570.rfoxg!2,S" >
0008           <payload>Return-Path: &lt;commitfilter@new.kstuff.org>
0009 Received: from localhost (localhost [127.0.0.1])
0010          by smykowski.kdab.net (Cyrus v2.2.12) with LMTPA;
0011          Sun, 22 Mar 2009 12:10:48 +0100
0012 X-Sieve: CMU Sieve 2.2
0013 Received: from localhost (localhost [127.0.0.1])
0014         by smykowski.kdab.net (Postfix) with ESMTP id 4BDF8E6C790
0015         for &lt;asok@kdab.net>; Sun, 22 Mar 2009 12:10:48 +0100 (CET)
0016 Received: from smykowski.kdab.net ([127.0.0.1])
0017  by localhost (smykowski.kdab.net [127.0.0.1]) (amavisd-new, port 10024)
0018  with ESMTP id 03694-02 for &lt;asok@kdab.net>;
0019  Sun, 22 Mar 2009 12:10:45 +0100 (CET)
0020 Received: from localhost (localhost [127.0.0.1])
0021         by smykowski.kdab.net (Postfix) with ESMTP id B289FE6C79B
0022         for &lt;asok@kdab.net>; Sun, 22 Mar 2009 12:10:45 +0100 (CET)
0023 Received: from kdeget.osuosl.org (kdeget.osuosl.org [140.211.166.77])
0024         by smykowski.kdab.net (Postfix) with ESMTP id 3B465E6C790
0025         for &lt;asok@kdab.net>; Sun, 22 Mar 2009 12:10:45 +0100 (CET)
0026 Received: from ktown.kde.org ([131.246.120.250])
0027         by kdeget.osuosl.org with smtp (Exim 4.63)
0028         (envelope-from &lt;kde-commits-bounces-+commitfilter=new.kstuff.org@kde.org>)
0029         id 1LlLfE-0001OT-K7
0030         for commitfilter@new.kstuff.org; Sun, 22 Mar 2009 12:16:25 +0100
0031 Received: (qmail 23006 invoked by uid 72); 22 Mar 2009 11:16:19 -0000
0032 Received: (qmail 22986 invoked from network); 22 Mar 2009 11:16:14 -0000
0033 Received: from unknown (HELO office.kde.org) (195.135.221.67)
0034         by ktown.kde.org with SMTP; 22 Mar 2009 11:16:11 -0000
0035 Received: from svn.kde.org (localhost [127.0.0.1])
0036         by office.kde.org (Postfix) with SMTP id 85EE718E
0037         for &lt;kde-commits@kde.org>; Sun, 22 Mar 2009 12:16:12 +0100 (CET)
0038 Received: (nullmailer pid 13467 invoked by uid 30);
0039         Sun, 22 Mar 2009 11:16:12 -0000
0040 From: Volker Krause &lt;vkrause@kde.org>
0041 To: kde-commits@kde.org
0042 Subject: playground/pim/akonaditest/resourcetester
0043 X-Commit-Directories: (0) trunk/playground/pim/akonaditest/resourcetester
0044         trunk/playground/pim/akonaditest/resourcetester/tests
0045 MIME-Version: 1.0
0046 Content-Type: text/plain;
0047   charset=UTF-8
0048 Content-Transfer-Encoding: 8bit
0049 Date: Sun, 22 Mar 2009 11:16:12 +0000
0050 Message-Id: &lt;1237720572.493438.13466.nullmailer@svn.kde.org>
0051 X-BeenThere: kde-commits@kde.org
0052 X-Mailman-Version: 2.1.9
0053 Precedence: list
0054 Reply-To: kde-commits@kde.org
0055 List-Id: Notification of KDE commits &lt;kde-commits.kde.org>
0056 List-Unsubscribe: &lt;https://mail.kde.org/mailman/listinfo/kde-commits>,
0057         &lt;mailto:kde-commits-request@kde.org?subject=unsubscribe>
0058 List-Post: &lt;mailto:kde-commits@kde.org>
0059 List-Help: &lt;mailto:kde-commits-request@kde.org?subject=help>
0060 List-Subscribe: &lt;https://mail.kde.org/mailman/listinfo/kde-commits>,
0061         &lt;mailto:kde-commits-request@kde.org?subject=subscribe>
0062 X-Virus-Scanned: by amavisd-new at kdab.net
0063 X-Kolab-Scheduling-Message: FALSE
0064 X-UID: 26666
0065 X-Length: 11240
0066 Status: RO
0067 X-Status: ORC
0068 X-KMail-EncryptionState:  
0069 X-KMail-SignatureState:  
0070 X-KMail-MDN-Sent:  
0071 
0072 SVN commit 942640 by vkrause:
0073 
0074 Allow to specifiy the collection property used to identify corresponding
0075 collections.
0076 
0077 
0078  M  +2 -0      tests/vcardtest.js  
0079  M  +1 -1      tests/vcardtest.xml  
0080  M  +29 -14    xmloperations.cpp  
0081  M  +46 -0     xmloperations.h  
0082 
0083 
0084 --- trunk/playground/pim/akonaditest/resourcetester/tests/vcardtest.js #942639:942640
0085 @@ -4,6 +4,8 @@
0086  
0087  XmlOperations.setXmlFile( "vcardtest.xml" );
0088  XmlOperations.setRootCollections( Resource.identifier() );
0089 +XmlOperations.setCollectionKey( "None" ); // we only expect one collection
0090  XmlOperations.ignoreCollectionField( "Name" ); // name is the resource identifier and thus unpredictable
0091 +XmlOperations.ignoreCollectionField( "RemoteId" ); // remote id is the absolute path
0092  XmlOperations.assertEqual();
0093  
0094 --- trunk/playground/pim/akonaditest/resourcetester/tests/vcardtest.xml #942639:942640
0095 @@ -1,5 +1,5 @@
0096  &lt;knut>
0097 -  &lt;collection rid="/k/kde4/src/playground/pim/akonaditest/resourcetester/tests/vcardtest.vcf" name="akonadi_vcard_resource_0" content="text/directory">
0098 +  &lt;collection rid="vcardtest.vcf" name="akonadi_vcard_resource_0" content="text/directory">
0099      &lt;attribute type="AccessRights" >wcdW&lt;/attribute>
0100      &lt;attribute type="ENTITYDISPLAY" >("vcardtest.vcf" "office-address-book")&lt;/attribute>
0101      &lt;item rid="bb2slGmqxb" mimetype="text/directory">
0102 --- trunk/playground/pim/akonaditest/resourcetester/xmloperations.cpp #942639:942640
0103 @@ -31,9 +31,6 @@
0104  #include &lt;QFileInfo>
0105  #include &lt;QStringList>
0106  
0107 -#include &lt;boost/bind.hpp>
0108 -#include &lt;algorithm>
0109 -
0110  using namespace Akonadi;
0111  
0112  template &lt;typename T> QTextStream&amp; operator&lt;&lt;( QTextStream &amp;s, const QSet&lt;T> &amp;set )
0113 @@ -53,7 +50,8 @@
0114  
0115  XmlOperations::XmlOperations(QObject* parent) :
0116    QObject( parent ),
0117 -  mCollectionFields( 0xFF )
0118 +  mCollectionFields( 0xFF ),
0119 +  mCollectionKey( RemoteId )
0120  {
0121  }
0122  
0123 @@ -99,6 +97,17 @@
0124    return mErrorMsg;
0125  }
0126  
0127 +void XmlOperations::setCollectionKey(XmlOperations::CollectionField field)
0128 +{
0129 +  mCollectionKey = field;
0130 +}
0131 +
0132 +void XmlOperations::setCollectionKey(const QString&amp; fieldName)
0133 +{
0134 +  const QMetaEnum me = metaObject()->enumerator( metaObject()->indexOfEnumerator( "CollectionField" ) );
0135 +  setCollectionKey( static_cast&lt;CollectionField>( me.keyToValue( fieldName.toLatin1() ) ) );
0136 +}
0137 +
0138  void XmlOperations::ignoreCollectionField(XmlOperations::CollectionField field)
0139  {
0140    mCollectionFields = mCollectionFields &amp; ~field;
0141 @@ -137,8 +146,20 @@
0142  {
0143    Collection::List cols( _cols );
0144    Collection::List refCols( _refCols );
0145 -  std::sort( cols.begin(), cols.end(), boost::bind( &amp;Collection::remoteId, _1 ) &lt; boost::bind( &amp;Collection::remoteId, _2 ) );
0146 -  std::sort( refCols.begin(), refCols.end(), boost::bind( &amp;Collection::remoteId, _1 ) &lt; boost::bind( &amp;Collection::remoteId, _2 ) );
0147 +  switch ( mCollectionKey ) {
0148 +    case RemoteId:
0149 +      sortCollectionList( cols, &amp;Collection::remoteId );
0150 +      sortCollectionList( refCols, &amp;Collection::remoteId );
0151 +      break;
0152 +    case Name:
0153 +      sortCollectionList( cols, &amp;Collection::name );
0154 +      sortCollectionList( refCols, &amp;Collection::name );
0155 +      break;
0156 +    case None:
0157 +      break;
0158 +    default:
0159 +      Q_ASSERT( false );
0160 +  }
0161  
0162    for ( int i = 0; i &lt; cols.count(); ++i ) {
0163      const Collection col = cols.at( i );
0164 @@ -148,11 +169,6 @@
0165      }
0166  
0167      const Collection refCol = refCols.at( i );
0168 -    if ( col.remoteId() != refCol.remoteId() ) {
0169 -      mErrorMsg = QString::fromLatin1( "Collection with remote id '%1' is missing." ).arg( refCol.remoteId() );
0170 -      return false;
0171 -    }
0172 -
0173      if ( !compareCollection( col, refCol ) )
0174        return false;
0175    }
0176 @@ -177,14 +193,13 @@
0177  
0178  bool XmlOperations::compareCollection(const Collection&amp; _col, const Collection&amp; _refCol)
0179  {
0180 -  Q_ASSERT( _col.remoteId() == _refCol.remoteId() );
0181 -
0182    // normalize
0183    Collection col( normalize( _col ) );
0184    Collection refCol( normalize( _refCol ) );
0185    
0186    // compare the two collections
0187 -  if ( !compareValue( col, refCol, &amp;Collection::contentMimeTypes, ContentMimeType ) ||
0188 +  if ( !compareValue( col, refCol, &amp;Collection::remoteId, RemoteId ) ||
0189 +       !compareValue( col, refCol, &amp;Collection::contentMimeTypes, ContentMimeType ) ||
0190         !compareValue( col, refCol, &amp;Collection::name, Name ) )
0191      return false;
0192  
0193 --- trunk/playground/pim/akonaditest/resourcetester/xmloperations.h #942639:942640
0194 @@ -28,6 +28,10 @@
0195  #include &lt;QtCore/QObject>
0196  #include &lt;QtCore/QTextStream>
0197  
0198 +#include &lt;boost/bind.hpp>
0199 +#include &lt;algorithm>
0200 +
0201 +
0202  /**
0203    Compares a Akonadi collection sub-tree with reference data supplied in an XML file.
0204  */
0205 @@ -49,6 +53,7 @@
0206  
0207      Q_DECLARE_FLAGS( CollectionFields, CollectionField )
0208  
0209 +    void setCollectionKey( CollectionField field );
0210      void ignoreCollectionField( CollectionField field );
0211  
0212    public slots:
0213 @@ -59,6 +64,7 @@
0214      Akonadi::Item getItemByRemoteId(const QString&amp; rid);
0215      Akonadi::Collection getCollectionByRemoteId(const QString&amp; rid);
0216  
0217 +    void setCollectionKey( const QString &amp;fieldName );
0218      void ignoreCollectionField( const QString &amp;fieldName );
0219  
0220      bool compare();
0221 @@ -78,16 +84,25 @@
0222      template &lt;typename T> bool compareValue( const Akonadi::Collection &amp;col, const Akonadi::Collection &amp;refCol,
0223                                               T (Akonadi::Collection::*property)() const,
0224                                               CollectionField propertyType );
0225 +    template &lt;typename T> bool compareValue( const Akonadi::Collection &amp;col, const Akonadi::Collection &amp;refCol,
0226 +                                             T (Akonadi::Entity::*property)() const,
0227 +                                             CollectionField propertyType );
0228      template &lt;typename T> bool compareValue( const Akonadi::Item&amp; item, const Akonadi::Item&amp; refItem,
0229                                               T (Akonadi::Item::*property)() const,
0230                                               const char* propertyName );
0231      template &lt;typename T> bool compareValue( const T&amp; value, const T&amp; refValue );
0232  
0233 +    template &lt;typename T> void sortCollectionList( Akonadi::Collection::List &amp;list,
0234 +                                                   T ( Akonadi::Collection::*property)() const ) const;
0235 +    template &lt;typename T> void sortCollectionList( Akonadi::Collection::List &amp;list,
0236 +                                                   T ( Akonadi::Entity::*property)() const ) const;
0237 +
0238    private:
0239      Akonadi::Collection::List mRoots;
0240      Akonadi::XmlDocument mDocument;
0241      QString mErrorMsg;
0242      CollectionFields mCollectionFields;
0243 +    CollectionField mCollectionKey;
0244  };
0245  
0246  
0247 @@ -109,6 +124,23 @@
0248  }
0249  
0250  template &lt;typename T>
0251 +bool XmlOperations::compareValue( const Akonadi::Collection&amp; col, const Akonadi::Collection&amp; refCol,
0252 +                                  T (Akonadi::Entity::*property)() const,
0253 +                                  CollectionField propertyType )
0254 +{
0255 +  if ( mCollectionFields &amp; propertyType ) {
0256 +    const bool result = compareValue&lt;T>( ((col).*(property))(), ((refCol).*(property))() );
0257 +    if ( !result ) {
0258 +      const QMetaEnum me = metaObject()->enumerator( metaObject()->indexOfEnumerator( "CollectionField" ) );
0259 +      mErrorMsg.prepend( QString::fromLatin1( "Collection with remote id '%1' differs in property '%2':\n" )
0260 +      .arg( col.remoteId() ).arg( me.valueToKey( propertyType ) ) );
0261 +    }
0262 +    return result;
0263 +  }
0264 +  return true;
0265 +}
0266 +
0267 +template &lt;typename T>
0268  bool XmlOperations::compareValue( const Akonadi::Item&amp; item, const Akonadi::Item&amp; refItem,
0269                                    T (Akonadi::Item::*property)() const,
0270                                    const char* propertyName )
0271 @@ -131,4 +163,18 @@
0272    return false;
0273  }
0274  
0275 +template &lt;typename T>
0276 +void XmlOperations::sortCollectionList( Akonadi::Collection::List &amp;list,
0277 +                                        T ( Akonadi::Collection::*property)() const ) const
0278 +{
0279 +  std::sort( list.begin(), list.end(), boost::bind( property, _1 ) &lt; boost::bind( property, _2 ) );
0280 +}
0281 +
0282 +template &lt;typename T>
0283 +void XmlOperations::sortCollectionList( Akonadi::Collection::List &amp;list,
0284 +                                        T ( Akonadi::Entity::*property)() const ) const
0285 +{
0286 +  std::sort( list.begin(), list.end(), boost::bind( property, _1 ) &lt; boost::bind( property, _2 ) );
0287 +}
0288 +
0289  #endif
0290 </payload>
0291         </item>
0292       </collection>
0293       <item mimetype="message/rfc822" rid="1237726858.6570.dtdn4!2,S" >
0294         <payload>Return-Path: &lt;commitfilter@new.kstuff.org>
0295 Received: from localhost (localhost [127.0.0.1])
0296          by smykowski.kdab.net (Cyrus v2.2.12) with LMTPA;
0297          Sun, 22 Mar 2009 12:55:23 +0100
0298 X-Sieve: CMU Sieve 2.2
0299 Received: from localhost (localhost [127.0.0.1])
0300         by smykowski.kdab.net (Postfix) with ESMTP id EF869E6C77A
0301         for &lt;asok@kdab.net>; Sun, 22 Mar 2009 12:55:22 +0100 (CET)
0302 Received: from smykowski.kdab.net ([127.0.0.1])
0303  by localhost (smykowski.kdab.net [127.0.0.1]) (amavisd-new, port 10024)
0304  with ESMTP id 06346-10 for &lt;asok@kdab.net>;
0305  Sun, 22 Mar 2009 12:55:21 +0100 (CET)
0306 Received: from localhost (localhost [127.0.0.1])
0307         by smykowski.kdab.net (Postfix) with ESMTP id 24127E6C79E
0308         for &lt;asok@kdab.net>; Sun, 22 Mar 2009 12:55:21 +0100 (CET)
0309 Received: from kdeget.osuosl.org (kdeget.osuosl.org [140.211.166.77])
0310         by smykowski.kdab.net (Postfix) with ESMTP id D175FE6C77A
0311         for &lt;asok@kdab.net>; Sun, 22 Mar 2009 12:55:20 +0100 (CET)
0312 Received: from ktown.kde.org ([131.246.120.250])
0313         by kdeget.osuosl.org with smtp (Exim 4.63)
0314         (envelope-from &lt;kde-commits-bounces-+commitfilter=new.kstuff.org@kde.org>)
0315         id 1LlMMP-0003EH-9D
0316         for commitfilter@new.kstuff.org; Sun, 22 Mar 2009 13:01:02 +0100
0317 Received: (qmail 14097 invoked by uid 72); 22 Mar 2009 12:00:55 -0000
0318 Received: (qmail 14075 invoked from network); 22 Mar 2009 12:00:53 -0000
0319 Received: from unknown (HELO office.kde.org) (195.135.221.67)
0320         by ktown.kde.org with SMTP; 22 Mar 2009 12:00:51 -0000
0321 Received: from svn.kde.org (localhost [127.0.0.1])
0322         by office.kde.org (Postfix) with SMTP id 0F54D18E
0323         for &lt;kde-commits@kde.org>; Sun, 22 Mar 2009 13:00:53 +0100 (CET)
0324 Received: (nullmailer pid 17237 invoked by uid 30);
0325         Sun, 22 Mar 2009 12:00:53 -0000
0326 From: Volker Krause &lt;vkrause@kde.org>
0327 To: kde-commits@kde.org
0328 Subject: playground/pim/akonaditest/resourcetester
0329 X-Commit-Directories: (0) trunk/playground/pim/akonaditest/resourcetester
0330         trunk/playground/pim/akonaditest/resourcetester/tests
0331 MIME-Version: 1.0
0332 Content-Type: text/plain;
0333   charset=UTF-8
0334 Content-Transfer-Encoding: 8bit
0335 Date: Sun, 22 Mar 2009 12:00:53 +0000
0336 Message-Id: &lt;1237723253.005953.17235.nullmailer@svn.kde.org>
0337 X-BeenThere: kde-commits@kde.org
0338 X-Mailman-Version: 2.1.9
0339 Precedence: list
0340 Reply-To: kde-commits@kde.org
0341 List-Id: Notification of KDE commits &lt;kde-commits.kde.org>
0342 List-Unsubscribe: &lt;https://mail.kde.org/mailman/listinfo/kde-commits>,
0343         &lt;mailto:kde-commits-request@kde.org?subject=unsubscribe>
0344 List-Post: &lt;mailto:kde-commits@kde.org>
0345 List-Help: &lt;mailto:kde-commits-request@kde.org?subject=help>
0346 List-Subscribe: &lt;https://mail.kde.org/mailman/listinfo/kde-commits>,
0347         &lt;mailto:kde-commits-request@kde.org?subject=subscribe>
0348 X-Virus-Scanned: by amavisd-new at kdab.net
0349 X-Kolab-Scheduling-Message: FALSE
0350 X-UID: 26667
0351 X-Length: 4226
0352 Status: RO
0353 X-Status: ORC
0354 X-KMail-EncryptionState:  
0355 X-KMail-SignatureState:  
0356 X-KMail-MDN-Sent:  
0357 
0358 SVN commit 942650 by vkrause:
0359 
0360 Add CMake macro to run resource tests.
0361 
0362 
0363  M  +20 -0     CMakeLists.txt  
0364  A             tests/CMakeLists.txt  
0365  AM            tests/vcardtest-readonly.js   tests/vcardtest.js#942640
0366  AM            tests/vcardtest-readonly.xml   tests/vcardtest.xml#942640
0367 
0368 
0369 --- trunk/playground/pim/akonaditest/resourcetester/CMakeLists.txt #942649:942650
0370 @@ -17,6 +17,26 @@
0371  
0372  set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${KDE4_ENABLE_EXCEPTIONS}" )
0373  
0374 +macro( akonadi_add_resourcetest _testname _script )
0375 +  if ( ${EXECUTABLE_OUTPUT_PATH} )
0376 +    set( _exepath ${EXECUTABLE_OUTPUT_PATH} )
0377 +  else ( ${EXECUTABLE_OUTPUT_PATH} )
0378 +    set( _exepath ${CMAKE_CURRENT_BINARY_DIR}/.. )
0379 +  endif ( ${EXECUTABLE_OUTPUT_PATH} )
0380 +  if (WIN32)
0381 +    set(_resourcetester ${_exepath}/resourcetester.bat)
0382 +  else (WIN32)
0383 +    set(_resourcetester ${_exepath}/resourcetester)
0384 +  endif (WIN32)
0385 +  if (UNIX)
0386 +    set(_resourcetester ${_resourcetester}.shell)
0387 +  endif (UNIX)
0388 +
0389 +  add_test( ${_testname} ${_resourcetester} -c ${CMAKE_CURRENT_SOURCE_DIR}/${_script} )
0390 +endmacro( akonadi_add_resourcetest )
0391 +
0392 +add_subdirectory( tests )
0393 +
0394  set( resourcetester_SRCS
0395    global.cpp
0396    main.cpp
0397 ** trunk/playground/pim/akonaditest/resourcetester/tests/vcardtest-readonly.js #property svn:mergeinfo
0398    + 
0399 ** trunk/playground/pim/akonaditest/resourcetester/tests/vcardtest-readonly.xml #property svn:mergeinfo
0400    + 
0401 </payload>
0402       </item>
0403       <item mimetype="message/rfc822" rid="1237726875.6570.R4KOW!2,S" >
0404         <payload>Return-Path: &lt;commitfilter@new.kstuff.org>
0405 Received: from localhost (localhost [127.0.0.1])
0406          by smykowski.kdab.net (Cyrus v2.2.12) with LMTPA;
0407          Sun, 22 Mar 2009 13:16:01 +0100
0408 X-Sieve: CMU Sieve 2.2
0409 Received: from localhost (localhost [127.0.0.1])
0410         by smykowski.kdab.net (Postfix) with ESMTP id CA2E8E6C783
0411         for &lt;asok@kdab.net>; Sun, 22 Mar 2009 13:16:00 +0100 (CET)
0412 Received: from smykowski.kdab.net ([127.0.0.1])
0413  by localhost (smykowski.kdab.net [127.0.0.1]) (amavisd-new, port 10024)
0414  with ESMTP id 07855-05 for &lt;asok@kdab.net>;
0415  Sun, 22 Mar 2009 13:15:58 +0100 (CET)
0416 Received: from localhost (localhost [127.0.0.1])
0417         by smykowski.kdab.net (Postfix) with ESMTP id ABDFDE6C79B
0418         for &lt;asok@kdab.net>; Sun, 22 Mar 2009 13:15:58 +0100 (CET)
0419 Received: from kdeget.osuosl.org (kdeget.osuosl.org [140.211.166.77])
0420         by smykowski.kdab.net (Postfix) with ESMTP id 5CD44E6C783
0421         for &lt;asok@kdab.net>; Sun, 22 Mar 2009 13:15:58 +0100 (CET)
0422 Received: from ktown.kde.org ([131.246.120.250])
0423         by kdeget.osuosl.org with smtp (Exim 4.63)
0424         (envelope-from &lt;kde-commits-bounces-+commitfilter=new.kstuff.org@kde.org>)
0425         id 1LlMgP-00046D-6T
0426         for commitfilter@new.kstuff.org; Sun, 22 Mar 2009 13:21:41 +0100
0427 Received: (qmail 27078 invoked by uid 72); 22 Mar 2009 12:21:36 -0000
0428 Received: (qmail 27060 invoked from network); 22 Mar 2009 12:21:34 -0000
0429 Received: from unknown (HELO office.kde.org) (195.135.221.67)
0430         by ktown.kde.org with SMTP; 22 Mar 2009 12:21:32 -0000
0431 Received: from svn.kde.org (localhost [127.0.0.1])
0432         by office.kde.org (Postfix) with SMTP id 0A38E18E
0433         for &lt;kde-commits@kde.org>; Sun, 22 Mar 2009 13:21:34 +0100 (CET)
0434 Received: (nullmailer pid 20237 invoked by uid 30);
0435         Sun, 22 Mar 2009 12:21:34 -0000
0436 From: Volker Krause &lt;vkrause@kde.org>
0437 To: kde-commits@kde.org
0438 Subject: playground/pim/akonaditest/resourcetester
0439 X-Commit-Directories: (0) trunk/playground/pim/akonaditest/resourcetester
0440 MIME-Version: 1.0
0441 Content-Type: text/plain;
0442   charset=UTF-8
0443 Content-Transfer-Encoding: 8bit
0444 Date: Sun, 22 Mar 2009 12:21:34 +0000
0445 Message-Id: &lt;1237724494.009832.20236.nullmailer@svn.kde.org>
0446 X-BeenThere: kde-commits@kde.org
0447 X-Mailman-Version: 2.1.9
0448 Precedence: list
0449 Reply-To: kde-commits@kde.org
0450 List-Id: Notification of KDE commits &lt;kde-commits.kde.org>
0451 List-Unsubscribe: &lt;https://mail.kde.org/mailman/listinfo/kde-commits>,
0452         &lt;mailto:kde-commits-request@kde.org?subject=unsubscribe>
0453 List-Post: &lt;mailto:kde-commits@kde.org>
0454 List-Help: &lt;mailto:kde-commits-request@kde.org?subject=help>
0455 List-Subscribe: &lt;https://mail.kde.org/mailman/listinfo/kde-commits>,
0456         &lt;mailto:kde-commits-request@kde.org?subject=subscribe>
0457 X-Virus-Scanned: by amavisd-new at kdab.net
0458 X-Kolab-Scheduling-Message: FALSE
0459 X-UID: 26668
0460 X-Length: 4765
0461 Status: RO
0462 X-Status: ORC
0463 X-KMail-EncryptionState:  
0464 X-KMail-SignatureState:  
0465 X-KMail-MDN-Sent:  
0466 
0467 SVN commit 942656 by vkrause:
0468 
0469 - propagate script errors
0470 - make sure the Akonadi server is operational
0471 
0472 
0473  M  +5 -0      main.cpp  
0474  M  +13 -1     script.cpp  
0475  M  +6 -3      script.h  
0476 
0477 
0478 --- trunk/playground/pim/akonaditest/resourcetester/main.cpp #942655:942656
0479 @@ -21,6 +21,8 @@
0480  #include "global.h"
0481  #include "test.h"
0482  
0483 +#include &lt;akonadi/control.h>
0484 +
0485  #include &lt;KApplication>
0486  #include &lt;KAboutData>
0487  #include &lt;KCmdLineArgs>
0488 @@ -71,6 +73,9 @@
0489    signal( SIGQUIT, sigHandler );
0490  #endif
0491  
0492 +  if ( !Akonadi::Control::start() )
0493 +    qFatal( "Unable to start Akonadi!" );
0494 +
0495    Script *script = new Script();
0496  
0497    script->configure(path);
0498 --- trunk/playground/pim/akonaditest/resourcetester/script.cpp #942655:942656
0499 @@ -16,12 +16,13 @@
0500   */
0501  
0502  #include "script.h"
0503 +#include &lt;KDebug>
0504  #include &lt;qcoreapplication.h>
0505  
0506  Script::Script()
0507  {
0508    action = new Kross::Action(this, "ResourceTester");
0509 -  connect( action, SIGNAL(finished(Kross::Action*)), QCoreApplication::instance(), SLOT(quit()) );
0510 +  connect( action, SIGNAL(finished(Kross::Action*)), SLOT(finished(Kross::Action*)) );
0511  }
0512  
0513  void Script::configure(const QString &amp;path, QHash&lt;QString, QObject * > hash)
0514 @@ -51,4 +52,15 @@
0515    action->trigger();
0516  }
0517  
0518 +void Script::finished(Kross::Action* action)
0519 +{
0520 +  if ( action->hadError() ) {
0521 +    kError() &lt;&lt; action->errorMessage() &lt;&lt; action->errorTrace();
0522 +    QCoreApplication::instance()->exit( 1 );
0523 +  } else {
0524 +    QCoreApplication::instance()->quit();
0525 +  }
0526 +}
0527 +
0528 +
0529  #include "script.moc"
0530 --- trunk/playground/pim/akonaditest/resourcetester/script.h #942655:942656
0531 @@ -24,9 +24,6 @@
0532  class Script : public QObject
0533  {
0534    Q_OBJECT
0535 -  private:
0536 -    Kross::Action *action;
0537 -
0538    public:
0539      Script();
0540      void configure(const QString &amp;path, QHash&lt;QString, QObject *> hash);
0541 @@ -35,6 +32,12 @@
0542  
0543    public slots:
0544      void start();
0545 +
0546 +  private slots:
0547 +    void finished( Kross::Action *action );
0548 +
0549 +  private:
0550 +    Kross::Action *action;
0551  };
0552  
0553  #endif
0554 </payload>
0555       </item>
0556     </collection>
0557     <item mimetype="message/rfc822" rid="1237726845.6570.BejQg!2,S" >
0558       <payload>Return-Path: &lt;commitfilter@new.kstuff.org>
0559 Received: from localhost (localhost [127.0.0.1])
0560          by smykowski.kdab.net (Cyrus v2.2.12) with LMTPA;
0561          Sun, 22 Mar 2009 13:45:00 +0100
0562 X-Sieve: CMU Sieve 2.2
0563 Received: from localhost (localhost [127.0.0.1])
0564         by smykowski.kdab.net (Postfix) with ESMTP id 8C4FFE6C79B
0565         for &lt;asok@kdab.net>; Sun, 22 Mar 2009 13:45:00 +0100 (CET)
0566 Received: from smykowski.kdab.net ([127.0.0.1])
0567  by localhost (smykowski.kdab.net [127.0.0.1]) (amavisd-new, port 10024)
0568  with ESMTP id 09703-05 for &lt;asok@kdab.net>;
0569  Sun, 22 Mar 2009 13:45:00 +0100 (CET)
0570 Received: from localhost (localhost [127.0.0.1])
0571         by smykowski.kdab.net (Postfix) with ESMTP id 163D2E6C7AF
0572         for &lt;asok@kdab.net>; Sun, 22 Mar 2009 13:45:00 +0100 (CET)
0573 Received: from kdeget.osuosl.org (kdeget.osuosl.org [140.211.166.77])
0574         by smykowski.kdab.net (Postfix) with ESMTP id 31945E6C79E
0575         for &lt;asok@kdab.net>; Sun, 22 Mar 2009 13:44:59 +0100 (CET)
0576 Received: from ktown.kde.org ([131.246.120.250])
0577         by kdeget.osuosl.org with smtp (Exim 4.63)
0578         (envelope-from &lt;kde-commits-bounces-+commitfilter=new.kstuff.org@kde.org>)
0579         id 1LlN8R-0005Jr-VE
0580         for commitfilter@new.kstuff.org; Sun, 22 Mar 2009 13:50:40 +0100
0581 Received: (qmail 7667 invoked by uid 72); 22 Mar 2009 12:50:33 -0000
0582 Received: (qmail 7658 invoked from network); 22 Mar 2009 12:50:31 -0000
0583 Received: from unknown (HELO office.kde.org) (195.135.221.67)
0584         by ktown.kde.org with SMTP; 22 Mar 2009 12:50:29 -0000
0585 Received: from svn.kde.org (localhost [127.0.0.1])
0586         by office.kde.org (Postfix) with SMTP id 93E9F18E
0587         for &lt;kde-commits@kde.org>; Sun, 22 Mar 2009 13:50:30 +0100 (CET)
0588 Received: (nullmailer pid 25707 invoked by uid 30);
0589         Sun, 22 Mar 2009 12:50:30 -0000
0590 From: Volker Krause &lt;vkrause@kde.org>
0591 To: kde-commits@kde.org
0592 Subject: playground/pim/akonaditest/resourcetester
0593 X-Commit-Directories: (0) trunk/playground/pim/akonaditest/resourcetester
0594 MIME-Version: 1.0
0595 Content-Type: text/plain;
0596   charset=UTF-8
0597 Content-Transfer-Encoding: 8bit
0598 Date: Sun, 22 Mar 2009 12:50:30 +0000
0599 Message-Id: &lt;1237726230.394911.25706.nullmailer@svn.kde.org>
0600 X-BeenThere: kde-commits@kde.org
0601 X-Mailman-Version: 2.1.9
0602 Precedence: list
0603 Reply-To: kde-commits@kde.org
0604 List-Id: Notification of KDE commits &lt;kde-commits.kde.org>
0605 List-Unsubscribe: &lt;https://mail.kde.org/mailman/listinfo/kde-commits>,
0606         &lt;mailto:kde-commits-request@kde.org?subject=unsubscribe>
0607 List-Post: &lt;mailto:kde-commits@kde.org>
0608 List-Help: &lt;mailto:kde-commits-request@kde.org?subject=help>
0609 List-Subscribe: &lt;https://mail.kde.org/mailman/listinfo/kde-commits>,
0610         &lt;mailto:kde-commits-request@kde.org?subject=subscribe>
0611 X-Virus-Scanned: by amavisd-new at kdab.net
0612 X-Kolab-Scheduling-Message: FALSE
0613 X-UID: 26669
0614 X-Length: 5694
0615 Status: RO
0616 X-Status: RC
0617 X-KMail-EncryptionState:  
0618 X-KMail-SignatureState:  
0619 X-KMail-MDN-Sent:  
0620 
0621 SVN commit 942677 by vkrause:
0622 
0623 Add a safety timeout in case we do not receive the synchronized() signal
0624 or the resource hangs during syncing. The first seems to happen randomly
0625 if syncing is extremely fast.
0626 
0627 
0628  M  +40 -0     resourcesynchronizationjob.cpp  
0629  M  +1 -1      resourcesynchronizationjob.h  
0630 
0631 
0632 --- trunk/playground/pim/akonaditest/resourcetester/resourcesynchronizationjob.cpp #942676:942677
0633 @@ -18,12 +18,14 @@
0634  #include "resourcesynchronizationjob.h"
0635  
0636  #include &lt;akonadi/agentinstance.h>
0637 +#include &lt;akonadi/agentmanager.h>
0638  
0639  #include &lt;KDebug>
0640  #include &lt;KLocale>
0641  
0642  #include &lt;QDBusConnection>
0643  #include &lt;QDBusInterface>
0644 +#include &lt;QTimer>
0645  
0646  namespace Akonadi
0647  {
0648 @@ -31,15 +33,31 @@
0649  class ResourceSynchronizationJobPrivate
0650  {
0651    public:
0652 +    ResourceSynchronizationJobPrivate() :
0653 +      interface( 0 ),
0654 +      safetyTimer( 0 ),
0655 +      timeoutCount( 0 )
0656 +    {}
0657 +
0658      AgentInstance instance;
0659      QDBusInterface* interface;
0660 +    QTimer* safetyTimer;
0661 +    int timeoutCount;
0662 +    static int timeoutCountLimit;
0663  };
0664  
0665 +int ResourceSynchronizationJobPrivate::timeoutCountLimit = 60;
0666 +
0667  ResourceSynchronizationJob::ResourceSynchronizationJob(const AgentInstance&amp; instance, QObject* parent) :
0668    KJob( parent ),
0669    d( new ResourceSynchronizationJobPrivate )
0670  {
0671    d->instance = instance;
0672 +  d->safetyTimer = new QTimer( this );
0673 +  connect( d->safetyTimer, SIGNAL(timeout()), SLOT(slotTimeout()) );
0674 +  d->safetyTimer->setInterval( 10 * 1000 );
0675 +  d->safetyTimer->setSingleShot( false );
0676 +  d->safetyTimer->start();
0677  }
0678  
0679  ResourceSynchronizationJob::~ResourceSynchronizationJob()
0680 @@ -72,9 +90,31 @@
0681  
0682  void ResourceSynchronizationJob::slotSynchronized()
0683  {
0684 +  disconnect( d->interface, SIGNAL(synchronized()), this, SLOT(slotSynchronized()) );
0685 +  d->safetyTimer->stop();
0686    emitResult();
0687  }
0688  
0689 +void ResourceSynchronizationJob::slotTimeout()
0690 +{
0691 +  d->instance = AgentManager::self()->instance( d->instance.identifier() );
0692 +  d->timeoutCount++;
0693 +
0694 +  if ( d->timeoutCount > d->timeoutCountLimit ) {
0695 +    d->safetyTimer->stop();
0696 +    setError( UserDefinedError );
0697 +    setErrorText( i18n( "Resource synchronization timed out." ) );
0698 +    emitResult();
0699 +    return;
0700 +  }
0701 +
0702 +  if ( d->instance.status() == AgentInstance::Idle ) {
0703 +    // try again, we might have lost the synchronized() signal
0704 +    kDebug() &lt;&lt; "trying again to sync resource" &lt;&lt; d->instance.identifier();
0705 +    d->instance.synchronize();
0706 +  }
0707  }
0708  
0709 +}
0710 +
0711  #include "resourcesynchronizationjob.moc"
0712 --- trunk/playground/pim/akonaditest/resourcetester/resourcesynchronizationjob.h #942676:942677
0713 @@ -27,7 +27,6 @@
0714  
0715  /**
0716    Synchronizes a given resource.
0717 -  @todo Add safety timeouts.
0718  */
0719  class ResourceSynchronizationJob : public KJob
0720  {
0721 @@ -48,6 +47,7 @@
0722  
0723    private slots:
0724      void slotSynchronized();
0725 +    void slotTimeout();
0726  
0727    private:
0728      ResourceSynchronizationJobPrivate* const d;
0729 </payload>
0730     </item>
0731   </collection>
0732 </knut>