Index: src/CMakeLists.txt
===================================================================
--- src/CMakeLists.txt	(revision e4980702ba64d5e47a89bf5c21c5ba6da3f67eff)
+++ src/CMakeLists.txt	(revision 915dc1852a6aa7d67755cb64c0cff72edbe7dd4c)
@@ -24,4 +24,9 @@
 	FIND_PACKAGE(Qt5Network REQUIRED)
 	ADD_SUBDIRECTORY(lib)
+	IF(BUILD_TESTING)
+		FIND_PACKAGE(Qt5Test REQUIRED)
+		ADD_SUBDIRECTORY(testing)
+		ADD_SUBDIRECTORY(tests)
+	ENDIF()
 ENDIF(WITH_STATIONCLIENT)
 IF(WITH_WEBSERVICE)
Index: src/lib/silibconfig.h.in
===================================================================
--- src/lib/silibconfig.h.in	(revision e4980702ba64d5e47a89bf5c21c5ba6da3f67eff)
+++ src/lib/silibconfig.h.in	(revision 915dc1852a6aa7d67755cb64c0cff72edbe7dd4c)
@@ -1,4 +1,4 @@
 /*
-    Copyright (C) 2010 - 2012 EngSaS - Engineering Solutions and Services Langenbach. All rights reserved.
+    Copyright (C) 2015 EngSaS - Engineering Solutions and Services Langenbach. All rights reserved.
 
     This library is free software; you can redistribute it and/or
Index: src/lib/siwebserviceclient.cpp
===================================================================
--- src/lib/siwebserviceclient.cpp	(revision e4980702ba64d5e47a89bf5c21c5ba6da3f67eff)
+++ src/lib/siwebserviceclient.cpp	(revision 915dc1852a6aa7d67755cb64c0cff72edbe7dd4c)
@@ -45,10 +45,10 @@
 }
 
-SiWebserviceClient::ReplyType SiWebserviceClient::stationsRegister(SiWeatherStation station, QString &error)
+SiWebserviceClient::ReplyType SiWebserviceClient::stationsRegister(const SiWeatherStation &station, QString &error)
 {
 	if(!_networkManager)
 		return Error;
 
-	if(station.name().isEmpty() || station.city().isEmpty() || station.eMail().isEmpty()){
+	if(station.name().isEmpty() || station.city().isEmpty() || station.eMail().isEmpty() || station.type().isEmpty()){
 		error = tr("Station has empty name, city or eMail address. All of these are needed!");
 		return Error;
@@ -61,8 +61,10 @@
 	jsonStation["latitude"] = Library::geoCoordinateToString(station.latitude());
 	jsonStation["email"] = station.eMail();
+	jsonStation["type"] = station.type();
+	jsonStation["typeUrl"] = station.typeUrl().toString();
 	QJsonDocument jsonDocument(jsonStation);
 
 	QNetworkRequest request;
-	request.setUrl(QString("%1%2").arg(_baseUrl.toString()).arg("/stations/register"));
+	request.setUrl(QString("%1%2").arg(_baseUrl.toString()).arg("index.php/stations/register"));
 	request.setRawHeader("User-Agent", QString("SiWeather Library %1").arg(Library::version()).toUtf8());
 	request.setHeader(QNetworkRequest::ContentTypeHeader, 
@@ -81,21 +83,25 @@
 	
 	QByteArray data = reply->readAll();
-	QJsonDocument jsonDocument = QJsonDocument::fromBinaryData(data);
+	reply->deleteLater();
+
+	QJsonDocument jsonDocument = QJsonDocument::fromJson(data);
 	QJsonObject json = jsonDocument.object();
 	if(!json.contains("result")){
 		emit finishedStationsRegister(false, "", tr("No result in response found"));
+		emit finished(StationsRegister, false, data);
 		return;
 	}
 	if(json["result"].toString() != "success"){
 		emit finishedStationsRegister(false, "", tr("Operation failed for reason: %1").arg(json["message"].toString()));
+		emit finished(StationsRegister, false, data);
 		return;
 	}
 	if(!json.contains("uuid")){
 		emit finishedStationsRegister(false, "", tr("No uuid in response found"));
+		emit finished(StationsRegister, false, data);
 		return;
 	}
-	emit finishedStationsRegister(true, QUuid(json["uuid"].toString()), "");
-	emit finished(StationsRegister, data);
-	reply->deleteLater();
+	emit finishedStationsRegister(true, QUuid(json["uuid"].toString()), json["message"].toString());
+	emit finished(StationsRegister, false, data);
 }
 
@@ -120,3 +126,2 @@
 	return reply;
 }
-
Index: src/lib/siwebserviceclient.h
===================================================================
--- src/lib/siwebserviceclient.h	(revision e4980702ba64d5e47a89bf5c21c5ba6da3f67eff)
+++ src/lib/siwebserviceclient.h	(revision 915dc1852a6aa7d67755cb64c0cff72edbe7dd4c)
@@ -48,8 +48,8 @@
 				 * @brief Registers a station at the server and emits error() or finishedStationsRegister() if finished.
 				 */
-				ReplyType stationsRegister(SiWeatherStation station, QString &error);
+				ReplyType stationsRegister(const SiWeather::Library::SiWeatherStation& station, QString& error);
 
 			signals:
-				void error(ReplyType replyType, const QString &errorMessage) const;
+				void error(SiWeather::Library::SiWebserviceClient::ReplyType replyType, const QString &errorMessage) const;
 				/**
 				 * @brief Generic finish signal for all requests. Use specialized finished signals instead!
@@ -57,5 +57,5 @@
 				 * @see finishedStationsRegister
 				 */
-				void finished(ReplyType replyType, const QByteArray &data) const;
+				void finished(SiWeather::Library::SiWebserviceClient::ReplyType replyType, bool result, const QByteArray &data) const;
 				void finishedStationsRegister(bool result, const QUuid &uuid, const QString &message) const;
 				
Index: src/testing/CMakeLists.txt
===================================================================
--- src/testing/CMakeLists.txt	(revision 915dc1852a6aa7d67755cb64c0cff72edbe7dd4c)
+++ src/testing/CMakeLists.txt	(revision 915dc1852a6aa7d67755cb64c0cff72edbe7dd4c)
@@ -0,0 +1,80 @@
+######################
+#
+#    Copyright (C) 2015 EngSaS - Engineering Solutions and Services Langenbach. All rights reserved.
+#
+#    This library is free software; you can redistribute it and/or
+#    modify it under the terms of the GNU Lesser General Public
+#    License as published by the Free Software Foundation; either
+#    version 2.1 of the License, or (at your option) any later version.
+#
+#    This library is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+#    Lesser General Public License for more details.
+#
+#    You should have received a copy of the GNU Lesser General Public
+#    License along with this library; if not, write to the Free Software
+#    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+#    MA 02110-1301  USA.
+#
+######################
+
+SET(files_UI
+)
+
+SET(files_CPP
+	webserverprocess.cpp
+	private/webserverrunner.cpp
+)
+
+INCLUDE_DIRECTORIES(
+	${CMAKE_CURRENT_BINARY_DIR}
+	${CMAKE_CURRENT_SOURCE_DIR}
+	${CMAKE_CURRENT_BINARY_DIR}/private
+	${CMAKE_CURRENT_SOURCE_DIR}/private
+)
+ADD_DEFINITIONS(-DSI_BUILD_TESTING)
+SET(LINK_LIBRARIES ${QT_LIBRARIES})
+SET(LIBOUTDIR ${LIBRARY_OUTPUT_PATH})
+SET(SHAREDIR ${share_DIR})
+SET(WEBSERVICE_SERVER_DOCROOT ${WEB_OUTPUT_DIRECTORY})
+CONFIGURE_FILE(
+	${CMAKE_CURRENT_SOURCE_DIR}/sitestingconfig.h.in
+	${CMAKE_CURRENT_BINARY_DIR}/sitestingconfig.h
+)
+
+# 	QT5_WRAP_UI(libengsas_UI_H ${libengsas_UI})
+# 	QT5_ADD_TRANSLATION(libengsas_TRANS ${libengsas_TS})
+
+ADD_LIBRARY(libsiweather_testing SHARED
+	${files_CPP}
+# 	${files_UI_H}
+# 	${files_TRANS}
+)
+
+TARGET_LINK_LIBRARIES(libsiweather_testing
+  ${LINK_LIBRARIES}
+)
+
+qt5_use_modules(libsiweather_testing Core Network)
+
+SET_TARGET_PROPERTIES(libsiweather_testing PROPERTIES
+	OUTPUT_NAME "siweather-testing"
+	VERSION ${TARGET_VERSION_MAJOR}.${TARGET_VERSION_MINOR}.${${PROJECT_NAME}_PATCH_LEVEL}
+	SOVERSION ${TARGET_VERSION_MAJOR})
+
+# INSTALL(
+#   FILES ${files_TRANS}
+#   DESTINATION ${qm_DIR}
+#   COMPONENT library
+# )
+
+# SET(LIBENGSAS_VERSION ${${PROJECT_NAME}_VERSION})
+# SET(QTVERSION "${QT_VERSION_MAJOR}.${QT_VERSION_MINOR}.${QT_VERSION_PATCH}")
+# SET(depends_XML ${CMAKE_BINARY_DIR}/depends/libengsas-core.xml)
+# CONFIGURE_FILE(libengsas-core.xml.in ${depends_XML})
+# INSTALL(
+# 	FILES ${depends_XML}
+# 	DESTINATION ${depends_DIR}
+# 	COMPONENT library
+# )
Index: src/testing/private/webserverrunner.cpp
===================================================================
--- src/testing/private/webserverrunner.cpp	(revision 915dc1852a6aa7d67755cb64c0cff72edbe7dd4c)
+++ src/testing/private/webserverrunner.cpp	(revision 915dc1852a6aa7d67755cb64c0cff72edbe7dd4c)
@@ -0,0 +1,54 @@
+/*
+		Copyright (C) 2012 - 2013 EngSaS - Engineering Solutions and Services Langenbach. All rights reserved.
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+    MA 02110-1301  USA.
+*/
+
+
+#include "webserverrunner.h"
+#include "moc_webserverrunner.cpp"
+
+#include "sitestingconfig.h"
+#include "webserverprocess.h"
+
+#include <QProcess>
+#include <QDebug>
+
+WebserverRunner::WebserverRunner()
+	: QObject()
+{
+	
+}
+
+WebserverRunner::~WebserverRunner()
+{
+
+}
+
+void WebserverRunner::start()
+{
+	QStringList arguments;
+	arguments << QString("-S %1:%2").arg(QString(WEBSERVICE_SERVER_HOST)).arg(QString(WEBSERVICE_SERVER_PORT));
+ 	arguments << QString("-t %1").arg(WebserverProcess::appendSlashToUrl(QString(WEBSERVICE_SERVER_DOCROOT)));
+
+	qDebug() << QString("%1: Executing %2 %3").arg(metaObject()->className()).arg(QString(PHP_EXECUTABLE)).arg(arguments.join(" "));
+// 	_webserverProcess->setStandardInputFile("/tmp/test-input");
+// 	_webserverProcess->setStandardErrorFile("/tmp/test-error.log");
+// 	_webserverProcess->setStandardOutputFile("/tmp/test-output.log");
+	// must be executed in own thread, QProcess::start isn't working
+ 	QProcess::execute(QString(PHP_EXECUTABLE) +" "+ arguments.join(" "));
+}
+
Index: src/testing/private/webserverrunner.h
===================================================================
--- src/testing/private/webserverrunner.h	(revision 915dc1852a6aa7d67755cb64c0cff72edbe7dd4c)
+++ src/testing/private/webserverrunner.h	(revision 915dc1852a6aa7d67755cb64c0cff72edbe7dd4c)
@@ -0,0 +1,40 @@
+/*
+		Copyright (C) 2015 EngSaS - Engineering Solutions and Services Langenbach. All rights reserved.
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+    MA 02110-1301  USA.
+*/
+
+
+#ifndef WEBSERVERRUNNER_H
+#define WEBSERVERRUNNER_H
+
+#include <QObject>
+
+class WebserverRunner : public QObject
+{
+	Q_OBJECT
+	public:
+		WebserverRunner();
+		/**
+		 * @todo How to stop the process?
+		 */
+		~WebserverRunner();
+		
+	public slots:
+		void start();
+};
+
+#endif // WEBSERVERRUNNER_H
Index: src/testing/sitestingconfig.h.in
===================================================================
--- src/testing/sitestingconfig.h.in	(revision 915dc1852a6aa7d67755cb64c0cff72edbe7dd4c)
+++ src/testing/sitestingconfig.h.in	(revision 915dc1852a6aa7d67755cb64c0cff72edbe7dd4c)
@@ -0,0 +1,31 @@
+/*
+    Copyright (C) 2015 EngSaS - Engineering Solutions and Services Langenbach. All rights reserved.
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+    MA 02110-1301  USA.
+*/
+
+#ifndef SITESTINGCONFIG_H
+#define SITESTINGCONFIG_H
+
+#cmakedefine WEBSERVICE_BASE_URL "@WEBSERVICE_BASE_URL_COMPLETE@"
+#cmakedefine WEBSERVICE_SERVER_HOST "@WEBSERVICE_SERVER_HOST@"
+#cmakedefine WEBSERVICE_SERVER_PORT "@WEBSERVICE_SERVER_PORT@"
+#cmakedefine WEBSERVICE_SERVER_DOCROOT "@WEBSERVICE_SERVER_DOCROOT@"
+#cmakedefine PHP_EXECUTABLE "@PHP_EXECUTABLE@"
+
+#cmakedefine WEBSERVICE_API_VERSION "@WEBSERVICE_API_VERSION@"
+
+#endif // SITESTINGCONFIG_H
Index: src/testing/sitestingglobal.h
===================================================================
--- src/testing/sitestingglobal.h	(revision 915dc1852a6aa7d67755cb64c0cff72edbe7dd4c)
+++ src/testing/sitestingglobal.h	(revision 915dc1852a6aa7d67755cb64c0cff72edbe7dd4c)
@@ -0,0 +1,34 @@
+/*
+    Copyright (C) 2015 EngSaS - Engineering Solutions and Services Langenbach. All rights reserved.
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+    MA 02110-1301  USA.
+*/
+
+/**
+ * @brief Library with helpers to run the tests
+	* @author Joachim Langenbach
+	* 
+  */
+#ifndef SITESTINGGLOBAL_H
+#define SITESTINGGLOBAL_H
+
+#ifdef SI_BUILD_TESTING
+	#define SI_TESTING_EXPORT Q_DECL_EXPORT
+#else
+  #define SI_TESTING_EXPORT Q_DECL_IMPORT
+#endif
+
+#endif // SITESTINGGLOBAL_H
Index: src/testing/webserverprocess.cpp
===================================================================
--- src/testing/webserverprocess.cpp	(revision 915dc1852a6aa7d67755cb64c0cff72edbe7dd4c)
+++ src/testing/webserverprocess.cpp	(revision 915dc1852a6aa7d67755cb64c0cff72edbe7dd4c)
@@ -0,0 +1,139 @@
+/*
+    Copyright (C) 2015 EngSaS - Engineering Solutions and Services Langenbach. All rights reserved.
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+    MA 02110-1301  USA.
+*/
+
+#include "webserverprocess.h"
+#include "moc_webserverprocess.cpp"
+
+#include "sitestingconfig.h"
+
+#include "webserverrunner.h"
+
+#include <QTimer>
+#include <QTime>
+#include <QCoreApplication>
+#include <QTcpSocket>
+#include <QRegExp>
+
+WebserverProcess::WebserverProcess(QObject* parent)
+ : QThread(parent)
+{
+	_runner = NULL;
+	_finishedStartup = false;
+	connect(this, SIGNAL(started()), this, SLOT(setStarted()));
+}
+
+WebserverProcess::~WebserverProcess()
+{
+	if(_runner)
+		delete _runner;
+}
+
+QString WebserverProcess::webserviceBaseUrl()
+{
+	return appendSlashToUrl(QString(WEBSERVICE_BASE_URL));
+}
+
+QString WebserverProcess::webserviceApiVersion()
+{
+	return QString(WEBSERVICE_API_VERSION);
+}
+
+
+bool WebserverProcess::isRunning() const
+{
+	QRegExp regex("http:\\/\\/([^:]+)+:([0-9]+)");
+	if(regex.indexIn(webserviceBaseUrl()) < 0){
+			qDebug() << QString("Regex %1 to find host and port not matching in %2").arg(regex.pattern()).arg(webserviceBaseUrl());
+			return false;
+	}
+	QStringList capturedTexts = regex.capturedTexts();
+	if(capturedTexts.size() != 3){
+		qDebug() << QString("Regex %1 does not matches enough items in %2").arg(regex.pattern()).arg(webserviceBaseUrl());
+		return false;
+	}
+	QTcpSocket *socket = new QTcpSocket();
+	socket->connectToHost(capturedTexts[1], capturedTexts[2].toInt(), QIODevice::ReadOnly); 
+	if (!socket->waitForConnected(2000)){
+		qDebug() << QString("Webservice at %1:%2 not reachable").arg(capturedTexts[1]).arg(capturedTexts[2]);
+		delete socket;
+		return false;
+	}
+	socket->close();
+	delete socket;
+	return true;
+}
+
+void WebserverProcess::stopThread()
+{
+	// stopping thread
+	// cancel query first
+	// stop eventloop
+	quit();
+	// wait 2000 seconds to stop the eventloop
+	wait(2000);
+}
+
+void WebserverProcess::run()
+{
+	_runner = new WebserverRunner();
+	QTimer::singleShot(1, _runner, SLOT(start()));
+	exec();
+}
+
+bool WebserverProcess::isStarted()
+{
+	return _finishedStartup;
+}
+
+bool WebserverProcess::waitForStart()
+{
+	if(isStarted())
+		return true;
+
+	// wait for thread to be started
+	QTime dieTime = QTime::currentTime().addSecs(2);
+	// Userevents should be excluded see http://lists.trolltech.com/qt-interest/2007-01/thread00133-0.html
+	while( QTime::currentTime() < dieTime ){
+		QCoreApplication::processEvents(QEventLoop::ExcludeUserInputEvents, 100);
+		if(isStarted())
+			return true;
+	}
+
+	if(isStarted())
+		return true;
+	return false;
+}
+
+void WebserverProcess::setStarted()
+{
+	// Give the php webserver 5 seconds to start
+	QTime dieTime = QTime::currentTime().addSecs(5);
+	// Userevents should be excluded see http://lists.trolltech.com/qt-interest/2007-01/thread00133-0.html
+	while( QTime::currentTime() < dieTime ){
+		QCoreApplication::processEvents(QEventLoop::ExcludeUserInputEvents, 100);
+	}
+	_finishedStartup = true;
+}
+
+QString WebserverProcess::appendSlashToUrl(QString url)
+{
+	if(url.right(1) != "/")
+		url += "/";
+	return url;
+}
Index: src/testing/webserverprocess.h
===================================================================
--- src/testing/webserverprocess.h	(revision 915dc1852a6aa7d67755cb64c0cff72edbe7dd4c)
+++ src/testing/webserverprocess.h	(revision 915dc1852a6aa7d67755cb64c0cff72edbe7dd4c)
@@ -0,0 +1,64 @@
+/*
+    Copyright (C) 2015 EngSaS - Engineering Solutions and Services Langenbach. All rights reserved.
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+    MA 02110-1301  USA.
+*/
+
+#ifndef WEBSERVERPROCESS_H
+#define WEBSERVERPROCESS_H
+
+#include <QThread>
+#include <sitestingglobal.h>
+
+class WebserverRunner;
+
+#include <QPointer>
+#include <QProcess>
+
+/**
+ * @brief Starts the php build in webserver to allow testing against the webservice
+ */
+class SI_TESTING_EXPORT WebserverProcess : public QThread {
+	friend WebserverRunner;
+	
+	Q_OBJECT
+	public:
+		WebserverProcess(QObject *parent = NULL);
+		~WebserverProcess();
+
+		static QString webserviceBaseUrl();
+		static QString webserviceApiVersion();
+		
+		bool isRunning() const;
+	
+		void stopThread();
+		void run();
+		bool isStarted();
+		bool waitForStart();
+
+	private slots:
+		void setStarted();
+
+	private:
+		static QString appendSlashToUrl(QString url);
+
+// 		QPointer<QProcess> _webserverProcess;
+// 		int _timeout;
+		WebserverRunner *_runner;
+		bool _finishedStartup;
+};
+
+#endif // WEBSERVERPROCESS_H
Index: src/tests/CMakeLists.txt
===================================================================
--- src/tests/CMakeLists.txt	(revision 915dc1852a6aa7d67755cb64c0cff72edbe7dd4c)
+++ src/tests/CMakeLists.txt	(revision 915dc1852a6aa7d67755cb64c0cff72edbe7dd4c)
@@ -0,0 +1,60 @@
+######################
+#
+#    Copyright (C) 2015 EngSaS - Engineering Solutions and Services Langenbach. All rights reserved.
+#
+#    This library is free software; you can redistribute it and/or
+#    modify it under the terms of the GNU Lesser General Public
+#    License as published by the Free Software Foundation; either
+#    version 2.1 of the License, or (at your option) any later version.
+#
+#    This library is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+#    Lesser General Public License for more details.
+#
+#    You should have received a copy of the GNU Lesser General Public
+#    License along with this library; if not, write to the Free Software
+#    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+#    MA 02110-1301  USA.
+#
+######################
+
+INCLUDE_DIRECTORIES(
+	${CMAKE_CURRENT_BINARY_DIR}
+	${CMAKE_CURRENT_SOURCE_DIR}
+	${libsiweather_SOURCE_DIR}
+	${libsiweather_BINARY_DIR}
+	${libsiweather_testing_SOURCE_DIR}
+	${libsiweather_testing_BINARY_DIR}
+)
+ADD_DEFINITIONS(${QT_DEFINITIONS})
+
+#######################
+#
+# SiWeatherStation Test
+#
+#######################
+
+SET(test_CPP
+	siweatherstationtest.cpp
+)
+
+ADD_EXECUTABLE(testsiweatherstationtest ${test_CPP})
+TARGET_LINK_LIBRARIES(testsiweatherstationtest ${QT_LIBRARIES} libsiweather libsiweather_testing)
+qt5_use_modules(testsiweatherstationtest Core Test)
+ADD_TEST(TestSiWeatherStation ${EXECUTABLE_OUTPUT_PATH}/testsiweatherstationtest)
+
+#######################
+#
+# SiWebserviceClient Test
+#
+#######################
+
+SET(test_CPP
+	siwebserviceclienttest.cpp
+)
+
+ADD_EXECUTABLE(testsiwebserviceclient ${test_CPP})
+TARGET_LINK_LIBRARIES(testsiwebserviceclient ${QT_LIBRARIES} libsiweather libsiweather_testing)
+qt5_use_modules(testsiwebserviceclient Core Test)
+ADD_TEST(TestSiWebserviceClient ${EXECUTABLE_OUTPUT_PATH}/testsiwebserviceclient)
Index: src/tests/siweatherstationtest.cpp
===================================================================
--- src/tests/siweatherstationtest.cpp	(revision 915dc1852a6aa7d67755cb64c0cff72edbe7dd4c)
+++ src/tests/siweatherstationtest.cpp	(revision 915dc1852a6aa7d67755cb64c0cff72edbe7dd4c)
@@ -0,0 +1,96 @@
+/*
+    Copyright (C) 2015 EngSaS - Engineering Solutions and Services Langenbach. All rights reserved.
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+    MA 02110-1301  USA.
+*/
+
+#include "siweatherstationtest.h"
+#include "moc_siweatherstationtest.cpp"
+
+#include <siweatherstation.h>
+
+#include <QTest>
+
+using namespace SiWeather::Library;
+
+void SiWeatherStationTest::setUuid()
+{
+	QUuid uuid = QUuid::createUuid();
+	SiWeatherStation station;
+	station.setUuid(uuid.toString());
+	QCOMPARE(station.uuid(), uuid);
+}
+
+void SiWeatherStationTest::setName()
+{
+	QString value = "Station Name";
+	SiWeatherStation station;
+	station.setName(value);
+	QCOMPARE(station.name(), value);
+}
+
+void SiWeatherStationTest::setCity(){
+	QString value = "Station Name";
+	SiWeatherStation station;
+	station.setCity(value);
+	QCOMPARE(station.city(), value);
+}
+
+void SiWeatherStationTest::setLongitude(){
+	double coordinate = 12.12345;
+	SiWeatherStation station;
+	station.setLatitude(coordinate);
+	QCOMPARE(station.latitude(), coordinate);
+}
+
+void SiWeatherStationTest::setLatitude(){
+	double coordinate = 12.12345;
+	SiWeatherStation station;
+	station.setLongitude(coordinate);
+	QCOMPARE(station.longitude(), coordinate);
+}
+
+void SiWeatherStationTest::setType(){
+	QString value = "Station Type";
+	SiWeatherStation station;
+	station.setType(value);
+	QCOMPARE(station.type(), value);
+}
+
+void SiWeatherStationTest::setTypeUrl(){
+	QUrl value("http://example.org");
+	SiWeatherStation station;
+	station.setTypeUrl(value.toString());
+	QCOMPARE(station.typeUrl(), value);
+}
+
+void SiWeatherStationTest::setEMail(){
+	QString value = "test@example.org";
+	SiWeatherStation station;
+	station.setEMail(value);
+	QCOMPARE(station.eMail(), value);
+}
+
+void SiWeatherStationTest::constructor()
+{
+	QUuid uuid = QUuid::createUuid();
+	QString name = "Station Name";
+	SiWeatherStation station(uuid.toString(), name);
+	QCOMPARE(station.uuid(), uuid);
+	QCOMPARE(station.name(), name);
+}
+
+QTEST_MAIN(SiWeatherStationTest)
Index: src/tests/siweatherstationtest.h
===================================================================
--- src/tests/siweatherstationtest.h	(revision 915dc1852a6aa7d67755cb64c0cff72edbe7dd4c)
+++ src/tests/siweatherstationtest.h	(revision 915dc1852a6aa7d67755cb64c0cff72edbe7dd4c)
@@ -0,0 +1,40 @@
+/*
+    Copyright (C) 2015 EngSaS - Engineering Solutions and Services Langenbach. All rights reserved.
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+    MA 02110-1301  USA.
+*/
+
+#ifndef SIWEATHERSTATIONTEST_H
+#define SIWEATHERSTATIONTEST_H
+
+#include <QObject>
+
+class SiWeatherStationTest : public QObject
+{
+	Q_OBJECT
+	private slots:
+		void setUuid();
+		void setName();
+		void setCity();
+		void setLongitude();
+		void setLatitude();
+		void setType();
+		void setTypeUrl();
+		void setEMail();
+		void constructor();
+};
+
+#endif // SIWEATHERSTATIONTEST_H
Index: src/tests/siwebserviceclienttest.cpp
===================================================================
--- src/tests/siwebserviceclienttest.cpp	(revision 915dc1852a6aa7d67755cb64c0cff72edbe7dd4c)
+++ src/tests/siwebserviceclienttest.cpp	(revision 915dc1852a6aa7d67755cb64c0cff72edbe7dd4c)
@@ -0,0 +1,116 @@
+/*
+    Copyright (C) 2015 EngSaS - Engineering Solutions and Services Langenbach. All rights reserved.
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+    MA 02110-1301  USA.
+*/
+
+#include "siwebserviceclient.h"
+#include "moc_siwebserviceclienttest.cpp"
+
+#include <siwebserviceclient.h>
+#include <siweatherstation.h>
+
+#include <webserverprocess.h>
+
+#include <QTest>
+#include <QSignalSpy>
+
+using namespace SiWeather::Library;
+
+void SiWebserviceClientTest::initTestCase()
+{
+	_webserverProcess = new WebserverProcess(this);
+	_webserverProcess->start();
+	QCOMPARE(_webserverProcess->waitForStart(), true);
+}
+
+void SiWebserviceClientTest::cleanUpTestCase()
+{
+	QVERIFY(_webserverProcess);
+// 	QCOMPARE(_webserverProcess->stop(), true);
+	_webserverProcess->stopThread();
+}
+
+void SiWebserviceClientTest::apiVersion()
+{
+	QVERIFY(_webserverProcess);
+	QCOMPARE(_webserverProcess->isRunning(), true);
+
+	SiWebserviceClient *client = new SiWebserviceClient(_webserverProcess->webserviceBaseUrl(), this);
+	QCOMPARE(client->apiVersion(), _webserverProcess->webserviceApiVersion());
+
+	delete client;
+}
+
+void SiWebserviceClientTest::stationsRegister()
+{
+	QVERIFY(_webserverProcess);
+	QCOMPARE(_webserverProcess->isRunning(), true);
+
+	SiWebserviceClient *client = new SiWebserviceClient(_webserverProcess->webserviceBaseUrl(), this);
+	QSignalSpy spyError(client, SIGNAL(error(SiWeather::Library::SiWebserviceClient::ReplyType, const QString&)));
+	QSignalSpy spyFinished(client, SIGNAL(finished(SiWeather::Library::SiWebserviceClient::ReplyType, bool, const QByteArray&)));
+	QSignalSpy spyFinishedStationsRegister(client, SIGNAL(finishedStationsRegister(bool, const QUuid&, const QString&)));
+	QString errorMessage;
+
+	SiWeatherStation station;
+	QCOMPARE(client->stationsRegister(station, errorMessage), SiWebserviceClient::Error);
+	QCOMPARE(errorMessage.isEmpty(), false);
+	QCOMPARE(spyError.count(), 0);
+	QCOMPARE(spyFinished.count(), 0);
+	QCOMPARE(spyFinishedStationsRegister.count(), 0);
+
+	spyError.clear();
+	spyFinished.clear();
+	spyFinishedStationsRegister.clear();
+	errorMessage.clear();
+	station.setName("Test Station Name");
+	station.setCity("New York");
+	station.setEMail("test@example.org");
+	station.setLatitude(40.712778);
+	station.setLongitude(-74.005833);
+	station.setType("Test Type");
+
+	QCOMPARE(client->stationsRegister(station, errorMessage), SiWebserviceClient::StationsRegister);
+	QTest::qWarn(errorMessage.toUtf8());
+	QCOMPARE(errorMessage.isEmpty(), true);
+
+	// use long timeout to allow webservice query for geolocation!
+	QTime dieTime = QTime::currentTime().addSecs(10);
+	while(QTime::currentTime() < dieTime){
+		QCoreApplication::processEvents(QEventLoop::ExcludeUserInputEvents, 100);
+		if(spyError.count() != 0 || spyFinished.count() != 0)
+			break;
+	}
+
+	if(spyError.count() > 0){
+		QVariantList data = spyError.takeFirst();
+		QCOMPARE(data.count(), 2);
+		QWARN(data[1].toString().toUtf8());
+	}
+	QCOMPARE(spyError.count(), 0);
+	QCOMPARE(spyFinished.count(), 1);
+	QCOMPARE(spyFinishedStationsRegister.count(), 1);
+	QVariantList data = spyFinishedStationsRegister.takeFirst();
+	QCOMPARE(data.count(), 3);
+	QCOMPARE(data[0].toBool(), true);
+	QCOMPARE(data[1].toUuid().isNull(), false);
+	QCOMPARE(data[2].toString().isEmpty(), false);
+
+	delete client;
+}
+
+QTEST_MAIN(SiWebserviceClientTest)
Index: src/tests/siwebserviceclienttest.h
===================================================================
--- src/tests/siwebserviceclienttest.h	(revision 915dc1852a6aa7d67755cb64c0cff72edbe7dd4c)
+++ src/tests/siwebserviceclienttest.h	(revision 915dc1852a6aa7d67755cb64c0cff72edbe7dd4c)
@@ -0,0 +1,41 @@
+/*
+    Copyright (C) 2015 EngSaS - Engineering Solutions and Services Langenbach. All rights reserved.
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+    MA 02110-1301  USA.
+*/
+
+#ifndef SIWEBSERVICECLIENTTEST_H
+#define SIWEBSERVICECLIENTTEST_H
+
+#include <QObject>
+
+class WebserverProcess;
+
+class SiWebserviceClientTest : public QObject
+{
+	Q_OBJECT
+	private slots:
+		void initTestCase();
+		void cleanUpTestCase();
+		
+		void apiVersion();
+		void stationsRegister();
+		
+	private:
+		WebserverProcess *_webserverProcess;
+};
+
+#endif // SIWEBSERVICECLIENTTEST_H
Index: src/webservice/config/config.php.in
===================================================================
--- src/webservice/config/config.php.in	(revision e4980702ba64d5e47a89bf5c21c5ba6da3f67eff)
+++ src/webservice/config/config.php.in	(revision 915dc1852a6aa7d67755cb64c0cff72edbe7dd4c)
@@ -21,5 +21,5 @@
 $config = [
 	"mode" => "@WEBSERVICE_MODE@",
-	"webserviceBaseUrl" => "http://@WEBSERVICE_SERVER_HOST@:@WEBSERVICE_SERVER_PORT@@WEBSERVICE_BASE_URL@",
+	"webserviceBaseUrl" => "@WEBSERVICE_BASE_URL_COMPLETE@",
 	"spatialiteExtension" => "mod_spatialite.so",
 	"geonamesUsername" => "@WEBSERVICE_GEONAMES_USERNAME@",
Index: src/webservice/htdocs/SiWeather/Webservice/Location.php
===================================================================
--- src/webservice/htdocs/SiWeather/Webservice/Location.php	(revision e4980702ba64d5e47a89bf5c21c5ba6da3f67eff)
+++ src/webservice/htdocs/SiWeather/Webservice/Location.php	(revision 915dc1852a6aa7d67755cb64c0cff72edbe7dd4c)
@@ -50,5 +50,5 @@
 		$this->setRegion($regionName, $regionCode);
 		$this->setCountry($countryName, $countryCode);
-		$this->setLocation($longitude, $latitude);
+		$this->setLocation($latitude, $longitude);
 		$this->setTimezone($timeZone);
 	}
Index: src/webservice/htdocs/SiWeather/Webservice/WebserviceApi.php
===================================================================
--- src/webservice/htdocs/SiWeather/Webservice/WebserviceApi.php	(revision e4980702ba64d5e47a89bf5c21c5ba6da3f67eff)
+++ src/webservice/htdocs/SiWeather/Webservice/WebserviceApi.php	(revision 915dc1852a6aa7d67755cb64c0cff72edbe7dd4c)
@@ -203,5 +203,5 @@
 				}
 				if(!$validatedLocation){
-					$message  = "The city (". $json[city] .") and location (". $json["latitude"] .", ". $json["longitude"] .") you send, does not suite with locations we found at your given location (city, latitude, longitude):\n";
+					$message  = "The city (". $json["city"] .") and location (". $json["latitude"] .", ". $json["longitude"] .") you send, does not suite with locations we found at your given location (city, latitude, longitude):\n";
 					foreach($locations as $location){
 						$message .= "    ". $location->city() .": ". $location->latitude() .", ". $location->longitude() ."\n";
