#include <map>
using namespace std;
-string EntryCalendarHREFProcessing = "";
-string EntryUUID = "";
+string entryCalendarHREFProcessing = "";
+string entryUUID = "";
TEST(CalDAV, BasicTests){
CalDAVStatus calDAVPlainStatus = calDAVPlain.GetConnectionData();
- ASSERT_EQ(calDAVPlainStatus.Hostname, connPlain.Hostname);
- ASSERT_EQ(calDAVPlainStatus.Username, connPlain.Username);
- ASSERT_EQ(calDAVPlainStatus.Port, connPlain.Port);
- ASSERT_EQ(calDAVPlainStatus.Prefix, connPlain.Prefix);
- ASSERT_EQ(calDAVPlainStatus.UseSSL, connPlain.UseSSL);
+ ASSERT_EQ(calDAVPlainStatus.hostname, connPlain.hostname);
+ ASSERT_EQ(calDAVPlainStatus.username, connPlain.username);
+ ASSERT_EQ(calDAVPlainStatus.port, connPlain.port);
+ ASSERT_EQ(calDAVPlainStatus.prefix, connPlain.prefix);
+ ASSERT_EQ(calDAVPlainStatus.useSSL, connPlain.useSSL);
// Verify that the connection was successful.
- CalDAVServerResult connResult = CalDAVPlain.Connect();
+ CalDAVServerResult connResult = calDAVPlain.Connect();
- ASSERT_EQ(CALDAVQUERYRESULT_OK, connResult.Result);
- ASSERT_EQ(200, connResult.HTTPCode);
- ASSERT_EQ(CURLE_OK, connResult.Code);
+ ASSERT_EQ(CALDAVQUERYRESULT_OK, connResult.result);
+ ASSERT_EQ(200, connResult.httpCode);
+ ASSERT_EQ(CURLE_OK, connResult.code);
// Do another connection and this time the connection should
// fail due to being an invalid host name.
CalDAVConnectionData connPlainFail;
- connPlainFail.Hostname = "server.invalid";
- connPlainFail.Username = "fail";
- connPlainFail.Password = "fail";
- connPlainFail.Port = 80;
- connPlainFail.UseSSL = false;
+ connPlainFail.hostname = "server.invalid";
+ connPlainFail.username = "fail";
+ connPlainFail.password = "fail";
+ connPlainFail.port = 80;
+ connPlainFail.useSSL = false;
// Setup the CalDAV connection object.
connResult = calDAVPlainFail.Connect();
- ASSERT_EQ(CALDAVQUERYRESULT_SERVERERROR, connResult.Result);
- ASSERT_EQ(0, connResult.HTTPCode);
- ASSERT_EQ(CURLE_COULDNT_RESOLVE_HOST, connResult.Code);
+ ASSERT_EQ(CALDAVQUERYRESULT_SERVERERROR, connResult.result);
+ ASSERT_EQ(0, connResult.httpCode);
+ ASSERT_EQ(CURLE_COULDNT_RESOLVE_HOST, connResult.code);
// (*nix version) Setup an initial connection (with a valid
// SSL certificate).
CalDAVStatus calDAVNormalStatus = calDAVNormal.GetConnectionData();
- ASSERT_EQ(calDAVNormalStatus.Hostname, connNormal.Hostname);
- ASSERT_EQ(calDAVNormalStatus.Username, connNormal.Username);
- ASSERT_EQ(calDAVNormalStatus.Port, connNormal.Port);
- ASSERT_EQ(calDAVNormalStatus.Prefix, connNormal.Prefix);
- ASSERT_EQ(calDAVNormalStatus.UseSSL, connNormal.UseSSL);
+ ASSERT_EQ(calDAVNormalStatus.hostname, connNormal.hostname);
+ ASSERT_EQ(calDAVNormalStatus.username, connNormal.username);
+ ASSERT_EQ(calDAVNormalStatus.port, connNormal.port);
+ ASSERT_EQ(calDAVNormalStatus.prefix, connNormal.prefix);
+ ASSERT_EQ(calDAVNormalStatus.useSSL, connNormal.useSSL);
// Verify that the connection was successful (with a valid
// SSL certificate).
- connResult = CalDAVNormal.Connect();
+ connResult = calDAVNormal.Connect();
- ASSERT_EQ(CALDAVQUERYRESULT_OK, connResult.Result);
- ASSERT_EQ(200, connResult.HTTPCode);
- ASSERT_EQ(CURLE_OK, connResult.Code);
+ ASSERT_EQ(CALDAVQUERYRESULT_OK, connResult.result);
+ ASSERT_EQ(200, connResult.httpCode);
+ ASSERT_EQ(CURLE_OK, connResult.code);
// (*nix version) Setup an initial connection on a server that
// will fail due to having an invalid SSL certificate.
CalDAVStatus calDAVInvalidSSLStatus = calDAVInvalidSSL.GetConnectionData();
- ASSERT_EQ(calDAVInvalidSSLStatus.Hostname, connInvalidSSL.Hostname);
- ASSERT_EQ(calDAVInvalidSSLStatus.Username, connInvalidSSL.Username);
- ASSERT_EQ(calDAVInvalidSSLStatus.Port, connInvalidSSL.Port);
- ASSERT_EQ(calDAVInvalidSSLStatus.Prefix, connInvalidSSL.Prefix);
- ASSERT_EQ(calDAVInvalidSSLStatus.UseSSL, connInvalidSSL.UseSSL);
+ ASSERT_EQ(calDAVInvalidSSLStatus.hostname, connInvalidSSL.hostname);
+ ASSERT_EQ(calDAVInvalidSSLStatus.username, connInvalidSSL.username);
+ ASSERT_EQ(calDAVInvalidSSLStatus.port, connInvalidSSL.port);
+ ASSERT_EQ(calDAVInvalidSSLStatus.prefix, connInvalidSSL.prefix);
+ ASSERT_EQ(calDAVInvalidSSLStatus.useSSL, connInvalidSSL.useSSL);
// Verify that the connection had failed. (with an invalid
// SSL certificate).
connResult = calDAVInvalidSSL.Connect();
- ASSERT_EQ(CALDAVQUERYRESULT_SERVERERROR, connResult.Result);
- ASSERT_EQ(0, connResult.HTTPCode);
- ASSERT_EQ(CURLE_SSL_CACERT, connResult.Code);
+ ASSERT_EQ(CALDAVQUERYRESULT_SERVERERROR, connResult.result);
+ ASSERT_EQ(0, connResult.httpCode);
+ ASSERT_EQ(CURLE_SSL_CACERT, connResult.code);
// (*nix version) Setup an inital connection on a server where
// a timeout occurs.
- connTimeout.Timeout = 5;
+ connTimeout.timeout = 5;
CalDAV calDAVTimeout;
calDAVTimeout.SetupConnectionData(&connTimeout);
CalDAVStatus calDAVTimeoutStatus = calDAVTimeout.GetConnectionData();
- ASSERT_EQ(calDAVTimeoutStatus.Hostname, connTimeout.Hostname);
- ASSERT_EQ(calDAVTimeoutStatus.Username, connTimeout.Username);
- ASSERT_EQ(calDAVTimeoutStatus.Port, connTimeout.Port);
- ASSERT_EQ(calDAVTimeoutStatus.Prefix, connTimeout.Prefix);
- ASSERT_EQ(calDAVTimeoutStatus.Timeout, connTimeout.Timeout);
- ASSERT_EQ(calDAVTimeoutStatus.UseSSL, connTimeout.UseSSL);
+ ASSERT_EQ(calDAVTimeoutStatus.hostname, connTimeout.hostname);
+ ASSERT_EQ(calDAVTimeoutStatus.username, connTimeout.username);
+ ASSERT_EQ(calDAVTimeoutStatus.port, connTimeout.port);
+ ASSERT_EQ(calDAVTimeoutStatus.prefix, connTimeout.prefix);
+ ASSERT_EQ(calDAVTimeoutStatus.timeout, connTimeout.timeout);
+ ASSERT_EQ(calDAVTimeoutStatus.useSSL, connTimeout.useSSL);
// Verify that the connection had timed out.
connResult = calDAVTimeout.Connect();
- ASSERT_EQ(CALDAVQUERYRESULT_SERVERERROR, connResult.Result);
- ASSERT_EQ(0, connResult.HTTPCode);
- ASSERT_EQ(CURLE_OPERATION_TIMEDOUT, connResult.Code);
+ ASSERT_EQ(CALDAVQUERYRESULT_SERVERERROR, connResult.result);
+ ASSERT_EQ(0, connResult.httpCode);
+ ASSERT_EQ(CURLE_OPERATION_TIMEDOUT, connResult.code);
}
// Setup the server address.
- if (connNormal.UseSSL == true){
+ if (connNormal.useSSL == true){
serverAddress += "https://";
} else {
serverAddress += "http://";
if (connNormal.port != 80){
serverAddress += ":";
- serverAddress += to_string(ConnNormal.Port);
+ serverAddress += to_string(connNormal.port);
}
serverAddress += "/principals/";
// Check the response from the server.
- connResult = cerverConnection.GetServerResult();
+ connResult = serverConnection.GetServerResult();
- EXPECT_EQ(CALDAVQUERYRESULT_OK, connResult.Result);
- ASSERT_EQ(207, connResult.HTTPCode);
- ASSERT_EQ(CURLE_OK, connResult.Code);
+ EXPECT_EQ(CALDAVQUERYRESULT_OK, connResult.result);
+ ASSERT_EQ(207, connResult.httpCode);
+ ASSERT_EQ(CURLE_OK, connResult.code);
// Get the calendar home.
- string calendarHome = serverConnection.GetCalendarHome(CurrentUserPrincipal);
+ string calendarHome = serverConnection.GetCalendarHome(currentUserPrincipal);
// Check the response from the server.
CalDAVServerResult connResult = serverConnection.Connect();
- EXPECT_EQ(CALDAVQUERYRESULT_OK, connResult.Result);
+ EXPECT_EQ(CALDAVQUERYRESULT_OK, connResult.result);
ASSERT_EQ(200, connResult.httpCode);
ASSERT_EQ(CURLE_OK, connResult.code);
CalDAVServerSupport connSupport = serverConnection.GetServerSupport();
connResult = serverConnection.GetServerResult();
- EXPECT_EQ(CALDAVQUERYRESULT_OK, connResult.Result);
+ EXPECT_EQ(CALDAVQUERYRESULT_OK, connResult.result);
ASSERT_EQ(200, connResult.httpCode);
ASSERT_EQ(CURLE_OK, connResult.code);
ASSERT_EQ(true, connSupport.basicSupport);
bool itemFound = false;
for (map<int,string>::iterator calendarNameIter = calendarList.name.begin();
- calendarNameIter != calendarList.Name.end(); calendarNameIter++){
+ calendarNameIter != calendarList.name.end(); calendarNameIter++){
if (calendarNameIter->second == "Scratching Calendar"){
itemFound = true;
// Connect to the server.
- CalDAVServerResult connResult = ServerConnection.Connect();
+ CalDAVServerResult connResult = serverConnection.Connect();
EXPECT_EQ(CALDAVQUERYRESULT_OK, connResult.result);
ASSERT_EQ(200, connResult.httpCode);
string calendarTagURL = "";
for (std::map<int,string>::iterator calHREFIter = calendarList.href.begin();
- calHREFIter != calendarList.HREF.end(); calHREFIter++){
+ calHREFIter != calendarList.href.end(); calHREFIter++){
if (calHREFIter->second.substr(calHREFIter->second.length() - 13) == "/unittestcal/"){