| [915dc18] | 1 | /*
|
|---|
| 2 | Copyright (C) 2015 EngSaS - Engineering Solutions and Services Langenbach. All rights reserved.
|
|---|
| 3 |
|
|---|
| 4 | This library is free software; you can redistribute it and/or
|
|---|
| 5 | modify it under the terms of the GNU Lesser General Public
|
|---|
| 6 | License as published by the Free Software Foundation; either
|
|---|
| 7 | version 2.1 of the License, or (at your option) any later version.
|
|---|
| 8 |
|
|---|
| 9 | This library is distributed in the hope that it will be useful,
|
|---|
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|---|
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|---|
| 12 | Lesser General Public License for more details.
|
|---|
| 13 |
|
|---|
| 14 | You should have received a copy of the GNU Lesser General Public
|
|---|
| 15 | License along with this library; if not, write to the Free Software
|
|---|
| 16 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
|---|
| 17 | MA 02110-1301 USA.
|
|---|
| 18 | */
|
|---|
| 19 |
|
|---|
| 20 | #ifndef WEBSERVERPROCESS_H
|
|---|
| 21 | #define WEBSERVERPROCESS_H
|
|---|
| 22 |
|
|---|
| 23 | #include <QThread>
|
|---|
| 24 | #include <sitestingglobal.h>
|
|---|
| 25 |
|
|---|
| 26 | class WebserverRunner;
|
|---|
| 27 |
|
|---|
| 28 | #include <QPointer>
|
|---|
| 29 | #include <QProcess>
|
|---|
| 30 |
|
|---|
| 31 | /**
|
|---|
| 32 | * @brief Starts the php build in webserver to allow testing against the webservice
|
|---|
| 33 | */
|
|---|
| 34 | class SI_TESTING_EXPORT WebserverProcess : public QThread {
|
|---|
| 35 | friend WebserverRunner;
|
|---|
| 36 |
|
|---|
| 37 | Q_OBJECT
|
|---|
| 38 | public:
|
|---|
| 39 | WebserverProcess(QObject *parent = NULL);
|
|---|
| 40 | ~WebserverProcess();
|
|---|
| 41 |
|
|---|
| 42 | static QString webserviceBaseUrl();
|
|---|
| 43 | static QString webserviceApiVersion();
|
|---|
| 44 |
|
|---|
| 45 | bool isRunning() const;
|
|---|
| 46 |
|
|---|
| 47 | void stopThread();
|
|---|
| 48 | void run();
|
|---|
| 49 | bool isStarted();
|
|---|
| 50 | bool waitForStart();
|
|---|
| 51 |
|
|---|
| 52 | private slots:
|
|---|
| 53 | void setStarted();
|
|---|
| 54 |
|
|---|
| 55 | private:
|
|---|
| 56 | static QString appendSlashToUrl(QString url);
|
|---|
| 57 |
|
|---|
| 58 | // QPointer<QProcess> _webserverProcess;
|
|---|
| 59 | // int _timeout;
|
|---|
| 60 | WebserverRunner *_runner;
|
|---|
| 61 | bool _finishedStartup;
|
|---|
| 62 | };
|
|---|
| 63 |
|
|---|
| 64 | #endif // WEBSERVERPROCESS_H
|
|---|