diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2012-03-09 01:03:21 +1000 |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2012-03-09 01:03:21 +1000 |
commit | 646b70a2957f7493163dc717127639201056c27a (patch) | |
tree | 30c537ad5d77b64c203fbdf47511ecb0428ead83 /tests | |
parent | a3bb92819f13494c4d38a660a8ff16e0eded272d (diff) | |
parent | e631fc3a5a095ed73d46f6a589722b64bc9f9661 (diff) |
Merge branch 'master' of scm.dev.nokia.troll.no:qtmobility/qtm-serviceframework into master-integration
* 'master' of scm.dev.nokia.troll.no:qtmobility/qtm-serviceframework:
Case 949050: Failure of service framework testcases
Diffstat (limited to 'tests')
-rw-r--r-- | tests/manual/sfwtestclient/main.cpp | 63 | ||||
-rw-r--r-- | tests/manual/sfwtestclient/sfwtestclient.cpp | 151 | ||||
-rw-r--r-- | tests/manual/sfwtestclient/sfwtestclient.h | 70 | ||||
-rw-r--r-- | tests/manual/sfwtestclient/sfwtestclient.pro | 19 | ||||
-rw-r--r-- | tests/manual/sfwtestclient/sfwtestclient.ui | 86 | ||||
-rw-r--r-- | tests/manual/sfwtestservice/main.cpp | 72 | ||||
-rw-r--r-- | tests/manual/sfwtestservice/sfwtestservice.cpp | 86 | ||||
-rw-r--r-- | tests/manual/sfwtestservice/sfwtestservice.h | 66 | ||||
-rw-r--r-- | tests/manual/sfwtestservice/sfwtestservice.pro | 19 | ||||
-rw-r--r-- | tests/manual/sfwtestservice/sfwtestservice.xml | 14 |
10 files changed, 646 insertions, 0 deletions
diff --git a/tests/manual/sfwtestclient/main.cpp b/tests/manual/sfwtestclient/main.cpp new file mode 100644 index 0000000000..0cd4f44ad3 --- /dev/null +++ b/tests/manual/sfwtestclient/main.cpp @@ -0,0 +1,63 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Mobility Components. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "sfwtestclient.h" + +#include <QtGui> +#include <QApplication> + +/* + * This is the test client application for Service Framework which invokes + * Out Of Process service. This provides following two options in the UI + * 1. Add Service: This allows the user to add a service which is sfwtest + * OOP service + * 2. Invoke: This loads the OOP service and then Invokes the remote method + * provided by sfwtest service. + * + */ + +int main(int argc, char *argv[]) +{ + QApplication a(argc, argv); + sfwtestclient w; + w.showMaximized(); + return a.exec(); +} diff --git a/tests/manual/sfwtestclient/sfwtestclient.cpp b/tests/manual/sfwtestclient/sfwtestclient.cpp new file mode 100644 index 0000000000..98a587c0b4 --- /dev/null +++ b/tests/manual/sfwtestclient/sfwtestclient.cpp @@ -0,0 +1,151 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Mobility Components. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QtCore> +#include <QServiceManager> +#include <QFile> +#include <QFileInfo> + +#include "sfwtestclient.h" + +QTM_USE_NAMESPACE + +//This is the service XML which will be imported to this path by sfwtest service. +const QString sfwtestservicefile = "/resource/apps/xmldata/sfwtestservice.xml"; + +sfwtestclient::sfwtestclient(QWidget *parent) + : QMainWindow(parent) +{ + ui.setupUi(this); + + QObject::connect(ui.addServiceButton, SIGNAL(clicked()), + this, SLOT(addServiceButtonClicked())); + + QObject::connect(ui.invokeButton, SIGNAL(clicked()), + this, SLOT(invokeButtonClicked())); + +} + +sfwtestclient::~sfwtestclient() +{ + +} +/* + * This is a slot for Add Service Button, it adds the OOP sfwtest service. + */ +void sfwtestclient::addServiceButtonClicked() +{ + ui.textEditBox->clear(); + + QFileInfo fileInfo(sfwtestservicefile); + QString filePath = fileInfo.absoluteFilePath(); + QServiceManager serviceManager; + if (QFile::exists(filePath)) { + if (serviceManager.addService(filePath)) { + ui.textEditBox->setText("Add Service: Success\n"); + } + else { + ui.textEditBox->setText("Add Service: Service Exists Already\n"); + } + } + else { + ui.textEditBox->setText("Removing Service\n"); + serviceManager.removeService("SfwTestService\n"); + } + +} + +/* + * This is the slot for Invoke Button, which loads the OOP service + * and then invokes the Remote Method provided by the service. + */ +void sfwtestclient::invokeButtonClicked() +{ + ui.textEditBox->clear(); + + QServiceManager serviceManager; + QServiceFilter serviceFilter; + serviceFilter.setServiceName("SfwTestService"); + serviceFilter.setInterface("com.nokia.qt.SfwTest"); + + QList<QServiceInterfaceDescriptor> interfaceList; + interfaceList = serviceManager.findInterfaces(serviceFilter); + + if(!interfaceList.count()) { + ui.textEditBox->setText("No Interfaces Found\n"); + return; + } + + if(interfaceList.count() > 1) { + ui.textEditBox->setText("Multiple Interfaces Found\n"); + return; + } + ui.textEditBox->setText("Loading Interface...\n"); + + QObject *sfwTestService = NULL; + + sfwTestService = serviceManager.loadInterface(interfaceList.at(0)); + + if (sfwTestService) { + ui.textEditBox->setText("Loading Interface: Success\n"); + ui.textEditBox->setText("Invoking Interface Method: getServiceCount...\n"); + int result = 0; + + QMetaObject::invokeMethod(sfwTestService, "getServiceCount", Q_RETURN_ARG(int, result)); + + if (!result) { + ui.textEditBox->setText("Invoke Interface Method getServiceCount: No Services Found\n"); + } + else { + QString fmtString; + ui.textEditBox->setText(fmtString.sprintf("Invoke Interface Method getServiceCount: Found %d Services\n",result)); + } + delete sfwTestService; + sfwTestService = NULL; + + } + else { + ui.textEditBox->setText("Loading Interface: Failed\n"); + } + +} + + diff --git a/tests/manual/sfwtestclient/sfwtestclient.h b/tests/manual/sfwtestclient/sfwtestclient.h new file mode 100644 index 0000000000..91702eb9e0 --- /dev/null +++ b/tests/manual/sfwtestclient/sfwtestclient.h @@ -0,0 +1,70 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Mobility Components. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef SFWTESTCLIENT_H +#define SFWTESTCLIENT_H + +#include <QtGui/QMainWindow> +#include "ui_sfwtestclient.h" + +/* + * This is the class which has the UI for + * Service Framework Test client. + * + */ +class sfwtestclient : public QMainWindow +{ + Q_OBJECT + +public: + sfwtestclient(QWidget *parent = 0); + ~sfwtestclient(); + +public slots: + void addServiceButtonClicked(); + void invokeButtonClicked(); + + +private: + Ui::SfwTestClient ui; +}; + +#endif // SFWTESTCLIENT_H diff --git a/tests/manual/sfwtestclient/sfwtestclient.pro b/tests/manual/sfwtestclient/sfwtestclient.pro new file mode 100644 index 0000000000..67c13fadee --- /dev/null +++ b/tests/manual/sfwtestclient/sfwtestclient.pro @@ -0,0 +1,19 @@ +TEMPLATE = app +TARGET = sfwtestclient + +QT += core \ + gui + +CONFIG += mobility +MOBILITY = serviceframework + +HEADERS += sfwtestclient.h +SOURCES += main.cpp \ + sfwtestclient.cpp +FORMS += sfwtestclient.ui + +symbian: { + TARGET.UID3 = 0xe0d26e2c +} + + diff --git a/tests/manual/sfwtestclient/sfwtestclient.ui b/tests/manual/sfwtestclient/sfwtestclient.ui new file mode 100644 index 0000000000..2e7b55a665 --- /dev/null +++ b/tests/manual/sfwtestclient/sfwtestclient.ui @@ -0,0 +1,86 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>SfwTestClient</class> + <widget class="QMainWindow" name="SfwTestClient"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>400</width> + <height>340</height> + </rect> + </property> + <property name="contextMenuPolicy"> + <enum>Qt::ActionsContextMenu</enum> + </property> + <property name="windowTitle"> + <string>SfwTestClient</string> + </property> + <widget class="QWidget" name="centralwidget"> + <layout class="QVBoxLayout" name="verticalLayout"> + <item> + <widget class="QLabel" name="titleLabel"> + <property name="font"> + <font> + <pointsize>17</pointsize> + </font> + </property> + <property name="styleSheet"> + <string notr="true"/> + </property> + <property name="text"> + <string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Sans Serif'; font-size:12pt; font-weight:300; font-style:normal;"> +<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">SFW TEST CLIENT</p></body></html></string> + </property> + </widget> + </item> + <item> + <widget class="QTextEdit" name="textEditBox"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="readOnly"> + <bool>true</bool> + </property> + </widget> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_3"> + <item> + <widget class="QPushButton" name="addServiceButton"> + <property name="text"> + <string>Add Service</string> + </property> + </widget> + </item> + <item> + <spacer name="horizontalSpacer"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QPushButton" name="invokeButton"> + <property name="text"> + <string>Invoke</string> + </property> + </widget> + </item> + </layout> + </item> + </layout> + </widget> + </widget> + <resources/> + <connections/> +</ui> diff --git a/tests/manual/sfwtestservice/main.cpp b/tests/manual/sfwtestservice/main.cpp new file mode 100644 index 0000000000..d69a587567 --- /dev/null +++ b/tests/manual/sfwtestservice/main.cpp @@ -0,0 +1,72 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Mobility Components. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QtCore> +#include <QCoreApplication> +#include <QRemoteServiceRegister> +#include <QServiceManager> + +#include "sfwtestservice.h" + +QTM_USE_NAMESPACE + +/* + * This is a test service which provides an interface for testing + * the OOP service mechanism provided by Qt Mobility Service Framework. + * This main function of sfwtest service publishes + * its entires/services. + */ +int main(int argc, char *argv[]) +{ + QCoreApplication a(argc, argv); + + QRemoteServiceRegister *serviceRegisterSfwTest = new QRemoteServiceRegister(); + QRemoteServiceRegister::Entry serviceUriHandler = serviceRegisterSfwTest->createEntry< + SfwTestService> ("SfwTestService", "com.nokia.qt.SfwTest", "1.0"); + + serviceUriHandler.setInstantiationType(QRemoteServiceRegister::GlobalInstance); + serviceRegisterSfwTest->publishEntries("sfwtest"); + + serviceRegisterSfwTest->setQuitOnLastInstanceClosed(false); + + + return a.exec(); +} diff --git a/tests/manual/sfwtestservice/sfwtestservice.cpp b/tests/manual/sfwtestservice/sfwtestservice.cpp new file mode 100644 index 0000000000..f1f4706758 --- /dev/null +++ b/tests/manual/sfwtestservice/sfwtestservice.cpp @@ -0,0 +1,86 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Mobility Components. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QServiceManager> +#include <QEventLoop> +#include <QTimer> + +#include "sfwtestservice.h" + +// Enable this Macro for simulating long running method. +//#define ENABLE_LONG_RUNNING_EVENT + +QTM_USE_NAMESPACE + +SfwTestService::SfwTestService(QObject *parent) : + QObject(parent) +{ + +} + +SfwTestService::~SfwTestService() +{ + +} + +/* + * This is the method which clients can invoke remotely + * using service framework. This method return the total + * number of services available in service framework. + */ +int SfwTestService::getServiceCount() +{ + QServiceManager serviceManager; + QStringList serviceList = serviceManager.findServices(); + + //Below code simulates long running event to make this method + //time consuming. +#ifdef ENABLE_LONG_RUNNING_EVENT + + QEventLoop* loop = new QEventLoop( this ); + QTimer::singleShot(10000, loop, SLOT(quit())); + loop->exec(); + delete loop; + +#endif + + return serviceList.count(); +} diff --git a/tests/manual/sfwtestservice/sfwtestservice.h b/tests/manual/sfwtestservice/sfwtestservice.h new file mode 100644 index 0000000000..09a3079a24 --- /dev/null +++ b/tests/manual/sfwtestservice/sfwtestservice.h @@ -0,0 +1,66 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Mobility Components. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef SFWTESTSERVICE_H_ +#define SFWTESTSERVICE_H_ + +#include <QObject> +#include <QString> + +/* + * This class provides the Methods which can be + * invoked remotely by the clients using service framework. + */ +class SfwTestService: public QObject +{ + + Q_OBJECT +public: + + SfwTestService(QObject *parent = 0); + + ~SfwTestService(); + + Q_INVOKABLE + int getServiceCount(); +}; + +#endif /* SFWTESTSERVICE_H_ */ diff --git a/tests/manual/sfwtestservice/sfwtestservice.pro b/tests/manual/sfwtestservice/sfwtestservice.pro new file mode 100644 index 0000000000..7202ebbe87 --- /dev/null +++ b/tests/manual/sfwtestservice/sfwtestservice.pro @@ -0,0 +1,19 @@ +TEMPLATE = app +TARGET = sfwtest +CONFIG += mobility +MOBILITY = serviceframework +QT += core +QT -= gui +HEADERS += sfwtestservice.h +SOURCES += sfwtestservice.cpp \ + main.cpp + +symbian: { + TARGET.UID3 = 0xe3260ac0 + TARGET.VID = VID_DEFAULT + SYMBIAN_PLATFORMS = WINSCW ARMV5 + addFiles.sources = sfwtestservice.xml + addFiles.path = /resource/apps/xmldata/ + DEPLOYMENT += addFiles + +} diff --git a/tests/manual/sfwtestservice/sfwtestservice.xml b/tests/manual/sfwtestservice/sfwtestservice.xml new file mode 100644 index 0000000000..77f969001c --- /dev/null +++ b/tests/manual/sfwtestservice/sfwtestservice.xml @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="UTF-8"?> +<SFW version="1.1"> +<service> + <name>SfwTestService</name> + <ipcaddress>sfwtest</ipcaddress> + <description>Service for testing IPC Service</description> + <interface> + <name>com.nokia.qt.SfwTest</name> + <version>1.0</version> + <description>Interface for Test Service</description> + <capabilities></capabilities> + </interface> +</service> +</SFW>
\ No newline at end of file |