Logo Search packages:      
Sourcecode: kmess version File versions

kmesstest.cpp

/***************************************************************************
                          kmesstest.cpp  -  description
                             -------------------
    begin                : Sun Jan 5 2003
    copyright            : (C) 2003 by Mike K. Bennett
    email                : mkb137b@hotmail.com
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/

#include "kmesstest.h"

#include <math.h>
#include <stdlib.h>

#include <qlistview.h>
#include <qregexp.h>
#include <qfile.h>
#include <qcstring.h>

#include <kdebug.h>
#include <kapplication.h>

#include "settings/settingsdialog.h"
#include "network/msnnotificationconnection.h"
#include "network/msnswitchboardconnection.h"
#include "notification/contactonlinenotification.h"
#include "contact/contactbase.h"
#include "contact/contactlist.h"
#include "contact/group.h"
#include "currentaccount.h"
#include "kmess.h"
#include "kmessview.h"
#include "chat/chatwindow.h"
#include "chat/contactsidebar.h"
#include "chat/xsltransformation.h"
#include "nowlisteningclient.h"

#include "network/extra/httpsoapconnection.h"
#include "network/extra/soapmessage.h"
#include "network/extra/msnappdirectoryconnection.h"

// #include "network/upnp/manager.h"

// The constructor
KMessTest::KMessTest(KMess *kmess)
 : QObject()
 , kmess_(kmess)
{
}



// The destructor
KMessTest::~KMessTest()
{
  kdDebug() << "KMessTest DESTROYED" << endl;
}


#ifdef KMESSTEST

// The main testing function
void KMessTest::test()
{
  kdDebug() << "----------------------------------------" << endl << endl;
  testChatWindow();
//  testNotificationConnection();
//  testContactListWithNotificationConnection();
//  testConnect();
//  testSettings();
//  testSwitchboardConnection();
//  testNotifications();
//  testNowListening();
//  testSoapConnection();
//  testUpnpConnection();
//  testXslTransformation();
  kdDebug()  << endl << "----------------------------------------" << endl;

  // Close the application
}

void KMessTest::testChatWindow()
{
  ChatWindow *chatWindow = new ChatWindow();
  chatWindow->initialize();
  chatWindow->contactSidebar_->contactJoined("kmess2@codingdomain.com");
  chatWindow->contactSidebar_->contactJoined("kmess3@codingdomain.com");
  chatWindow->show();
}

void KMessTest::testNotifications()
{
  /*ContactOnlineNotification *cn = new ContactOnlineNotification( kmess_->systemTrayWidget_, this, "cn" );
  Contact *contact = kmess_->msnNotificationConnection_->contactList_->getContactByHandle( "mkb137b@hotmail.com" );
  if ( contact != 0 )
  {
    cn->contactOnline( contact );
  }*/
}

void KMessTest::testNowListening()
{
  NowListeningClient *client = new NowListeningClient();
  client->setEnabled( true );
}

void KMessTest::testNotificationConnection()                { }
void KMessTest::testContactListWithNotificationConnection() { }
void KMessTest::testConnect()                               { }
void KMessTest::testSettings()                              { }
void KMessTest::testSwitchboardConnection()                 { }



void KMessTest::testSoapConnection()
{
  MsnAppDirectoryConnection *appDir = new MsnAppDirectoryConnection();
  appDir->queryServiceList(MsnAppDirectoryConnection::GAMES);

//   QString xml = "<?xml version=\"1.0\" encoding=\"utf-8\"?>"
//       "<soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">"
//       "<soap:Header>"
//       "<PassportCookie xmlns=\"http://www.hotmail.msn.com/ws/2004/09/oim/rsi\">"
//       "<t> Removed for security reasons </t>"
//       "<p> Removed for security reasons </p>"
//       "</PassportCookie>"
//       "</soap:Header>"
//       "<soap:Body>"
//       "<GetMessage xmlns=\"http://www.hotmail.msn.com/ws/2004/09/oim/rsi\">"
//       "<messageId>MSG1132093467.11</messageId>"
//       "<alsoMarkAsRead>false</alsoMarkAsRead>"
//       "</GetMessage>"
//       "</soap:Body>"
//       "</soap:Envelope>";
// 
//   HttpSoapConnection *soap = new HttpSoapConnection("http://localhost:81/index.xml");
//   soap->sendRequest("http://www.hotmail.msn.com/ws/2004/09/oim/rsi/GetMessage", xml);
}



void KMessTest::testUpnpConnection()
{
//  UPnP::Manager *manager = UPnP::Manager::instance();
}


void KMessTest::testXslTransformation()
{
  // A simple test using XSL/XML data of the KMess website
  QString wwwRoot = "/srv/www/vhosts/kmess/htdocs";

  // Load XSL
  XslTransformation xsl;
  xsl.setStylesheet( wwwRoot + "/resources/xsl/kmess.xsl" );

  // Open XML
  QFile file( wwwRoot + "/index.xml" );
  bool open = file.open(IO_ReadOnly);
  if(! open)
  {
    kdWarning() << "Could not open file: " << file.name() << endl;
  }

  // Load XML
  QByteArray fileData = file.readAll();
  QString xml = QString::fromUtf8(fileData.data(), fileData.size());
  file.close();

  // Transform XML
  kdDebug() << "XSL transformation result:" << endl;
  kdDebug() << xsl.convertXmlString(xml);
}



#endif  // KMESSTEST


#include "kmesstest.moc"

Generated by  Doxygen 1.6.0   Back to index