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 void SetupConnectionObject();
51 void BypassSSLVerification(bool EnableBypass);
52 COServerResponse GetDefaultPrefix(std::string *ServerPrefix);
53 COServerResponse GetContact(std::string Location, std::string *PageData);
54 std::string GetErrorMessage();
55 SSLCertCollectionString BuildSSLCollection();
56 COConnectResult Connect(bool DoAuthentication);
57 std::string GetDefaultPrefix();
58 COServerResponse AddContact(std::string Location, std::string Data);
59 COServerResponse EditContact(std::string Location, std::string Data);
60 COServerResponse DeleteContact(std::string Location);
61 COServerResponse GetServerEntityTagValue(std::string Location);
62 COServerResponse GetContact(std::string Location);
63 COContactList GetContactList(std::string SyncToken);
65 bool IsTaskCompleted();
66 void SetupData(std::string Method, std::string Location, std::string Data);
68 bool CanDoProcessing();
70 COSSLVerified SSLVerify();
72 bool HasValidResponse();
75 // Variables to set for fake connection object.
77 std::string ResultServerPrefix = "";
78 COConnectResult ResultStatus = COCONNECT_UNITTESTFAIL;
79 bool ResultAuthPassed = false;
80 bool ResultCanProcess = false;
81 bool ResultSSLStatus = false;
82 COSSLVerified ResultSSLVerified = COSSL_NORESULT;
83 bool ResultValidResponse = false;
84 bool ResultSelfSigned = false;
85 bool ResultTaskCompleted = false;
86 CORequestResult TestRequestResult;
87 COContactList TestContactList;
88 std::string TestEntityTag = "";
89 int TestSessionCode = 0;
90 int TestResultCode = 0;
91 std::string TestResultMessage = "";
92 bool ResultTestMode = false;