1 // FakeConnectionObject.h - FakeConnectionObject class
3 // (c) 2012-2015 Xestia Software Development.
5 // This file is part of Xestia Address Book.
7 // Xestia Address Book is free software: you can redistribute it and/or modify
8 // it under the terms of the GNU General Public License as published by the
9 // Free Software Foundation, version 3 of the license.
11 // Xestia Address Book is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License along
17 // with Xestia Address Book. If not, see <http://www.gnu.org/licenses/>
19 #ifndef __CONNOBJECT_FAKECONNECTIONOBJECT_H__
20 #define __CONNOBJECT_FAKECONNECTIONOBJECT_H__
22 #include "../../connobject/ConnectionObject.h"
24 class FakeConnectionObject : public ConnectionObject {
28 //using ConnectionObject::ConnectionObject;
30 FakeConnectionObject(std::string ServerAddress, int ServerPort, std::string ServerUser, std::string ServerPass, bool ServerSSL);
31 FakeConnectionObject(std::string ServerAddress, int ServerPort, std::string ServerUser, std::string ServerPass, bool ServerSSL, std::string ServerPrefix, std::string ServerAccount);
35 ~FakeConnectionObject();
37 // Functions for fake connection object.
39 std::string GetServerAddress();
40 unsigned int GetServerPort();
41 std::string GetServerUser();
42 std::string GetServerPass();
43 std::string GetServerPrefix();
44 std::string GetServerAccount();
48 // Functions from the ConnectionObject interface.
50 COConnectResult Connect(bool DoAuthentication);
51 std::string GetDefaultPrefix();
52 COServerResponse AddContact(std::string Location, std::string Data);
53 COServerResponse EditContact(std::string Location, std::string Data);
54 COServerResponse DeleteContact(std::string Location);
55 COServerResponse GetServerEntityTagValue(std::string Location);
56 COServerResponse GetContact(std::string Location);
57 COContactList GetContactList(std::string SyncToken);
59 bool IsTaskCompleted();
60 void SetupData(std::string Method, std::string Location, std::string Data);
62 bool CanDoProcessing();
64 COSSLVerified SSLVerify();
66 bool HasValidResponse();
69 // Variables to set for fake connection object.
71 std::string ResultServerPrefix = "";
72 COConnectResult ResultStatus = COCONNECT_UNITTESTFAIL;
73 bool ResultAuthPassed = false;
74 bool ResultCanProcess = false;
75 bool ResultSSLStatus = false;
76 COSSLVerified ResultSSLVerified = COSSL_NORESULT;
77 bool ResultValidResponse = false;
78 bool ResultSelfSigned = false;
79 bool ResultTaskCompleted = false;
80 CORequestResult TestRequestResult;
81 COContactList TestContactList;
82 std::string TestEntityTag = "";
83 int TestSessionCode = 0;
84 int TestResultCode = 0;
85 std::string TestResultMessage = "";
86 bool ResultTestMode = false;