X-Git-Url: http://Server1/repobrowser/?p=xestiacalendar%2F.git;a=blobdiff_plain;f=source%2Ftests%2Fxestiacalendar_populate.cpp;h=156527f03c147454f4424767e42a07c7d6a96a52;hp=095870f859773640a4ba82cb8661f6e3788dfb91;hb=2e304ff435c80c07daaf0d3fbe8a9ab7d1ae70b1;hpb=d058825f5e9ae3713e7805071a55e2794f0c3b90 diff --git a/source/tests/xestiacalendar_populate.cpp b/source/tests/xestiacalendar_populate.cpp index 095870f..156527f 100644 --- a/source/tests/xestiacalendar_populate.cpp +++ b/source/tests/xestiacalendar_populate.cpp @@ -24,13 +24,13 @@ void populatecaldav(){ // Load the connection settings. - CalDAVConnectionData ConnNormal; - ProcessConnectionDataFileResult DataFileResult; - bool ValidDataNormal = false; + CalDAVConnectionData connNormal; + ProcessConnectionDataFileResult dataFileResult; + bool validDataNormal = false; - DataFileResult = ProcessConnectionDataFile("caldavtest.auth", &ConnNormal); - if (DataFileResult == PROCESSCONNECTIONDATAFILE_OK){ - ValidDataNormal = true; + dataFileResult = ProcessConnectionDataFile("caldavtest.auth", &connNormal); + if (dataFileResult == PROCESSCONNECTIONDATAFILE_OK){ + validDataNormal = true; } else { // Cannot read the caldavtest.auth file properly. @@ -49,21 +49,21 @@ void populatecaldav(){ // Connect to the server and create // the calendar. - string ServerAddress = ""; - string ServerUserPass = ""; + string serverAddress = ""; + string serverUserPass = ""; // Setup the server address. - string CalendarName = "Unit Testing Calendar"; - string CalendarShortName = "unittestcal"; + string calendarName = "Unit Testing Calendar"; + string calendarShortName = "unittestcal"; - PopulateCalDAV.SetupConnectionData(&ConnNormal); + populateCalDAV.setupConnectionData(&ConnNormal); - CalDAVServerResult ServerResult; + CalDAVServerResult serverResult; - ServerResult = PopulateCalDAV.Connect(); + serverResult = populateCalDAV.Connect(); - if (ServerResult.Code != CURLE_OK){ + if (serverResult.Code != CURLE_OK){ cout << "Error while connecting to the CalDAV server." << endl; cout << "Xestia Calendar Code: " << ServerResult.Result << endl; @@ -75,30 +75,30 @@ void populatecaldav(){ // Get the list of calendars. - CalDAVCalendarList CalendarList = PopulateCalDAV.GetCalendars(); + CalDAVCalendarList calendarList = populateCalDAV.GetCalendars(); - if (CalendarList.Name.size() == 0){ + if (calendarList.name.size() == 0){ cout << "Error while getting the list of calendars." << endl; return; } - string CalendarURI = ""; + string calendarURI = ""; // Look for the Unit testing calendar. - for (std::map::iterator CalNameIter = CalendarList.Name.begin(); - CalNameIter != CalendarList.Name.end(); CalNameIter++){ + for (std::map::iterator calNameIter = calendarList.name.begin(); + calNameIter != calendarList.Name.end(); calNameIter++){ - if (CalNameIter->second == "Unit Testing Calendar"){ - CalendarURI = CalendarList.HREF.find(CalNameIter->first)->second; + if (calNameIter->second == "Unit Testing Calendar"){ + calendarURI = calendarList.href.find(calNameIter->first)->second; break; } } - if (CalendarURI == ""){ + if (calendarURI == ""){ cout << "Error while getting the unit testing calendar URI" << endl; return; @@ -107,58 +107,58 @@ void populatecaldav(){ // Delete the previous calendar. - ServerResult = PopulateCalDAV.DeleteCalendar(&CalendarURI); + serverResult = PopulateCalDAV.DeleteCalendar(&calendarURI); - if (ServerResult.Code != CURLE_OK){ + if (serverResult.code != CURLE_OK){ cout << "Error while deleting a calendar." << endl; - cout << "Xestia Calendar Code: " << ServerResult.Result << endl; - cout << "cURL Code: " << ServerResult.Code << endl; - cout << "HTTP Code: " << ServerResult.HTTPCode << endl; + cout << "Xestia Calendar Code: " << serverResult.result << endl; + cout << "cURL Code: " << serverResult.code << endl; + cout << "HTTP Code: " << serverResult.httpCode << endl; return; } // Create the calendar. - ServerResult = PopulateCalDAV.AddCalendar(&CalendarName, &CalendarShortName); - - if (ServerResult.Code != CURLE_OK){ + serverResult = populateCalDAV.AddCalendar(&calendarName, &calendarShortName); + + if (serverResult.Code != CURLE_OK){ cout << "Error while adding a calendar." << endl; - cout << "Xestia Calendar Code: " << ServerResult.Result << endl; - cout << "cURL Code: " << ServerResult.Code << endl; - cout << "HTTP Code: " << ServerResult.HTTPCode << endl; + cout << "Xestia Calendar Code: " << serverResult.result << endl; + cout << "cURL Code: " << serverResult.code << endl; + cout << "HTTP Code: " << serverResult.httpCode << endl; return; } // Get the list of calendars with the new calendar added. - CalendarList = PopulateCalDAV.GetCalendars(); + calendarList = populateCalDAV.GetCalendars(); - if (CalendarList.Name.size() == 0){ + if (calendarList.name.size() == 0){ cout << "Error while getting the list of calendars." << endl; return; } - - CalendarURI = ""; + + calendarURI = ""; // Look for the Unit testing calendar. - for (std::map::iterator CalNameIter = CalendarList.Name.begin(); - CalNameIter != CalendarList.Name.end(); CalNameIter++){ + for (std::map::iterator calNameIter = calendarList.name.begin(); + calNameIter != calendarList.Name.end(); calNameIter++){ - if (CalNameIter->second == "Unit Testing Calendar"){ - CalendarURI = CalendarList.HREF.find(CalNameIter->first)->second; + if (calNameIter->second == "Unit Testing Calendar"){ + calendarURI = calendarList.href.find(calNameIter->first)->second; break; } } - if (CalendarURI == ""){ + if (calendarURI == ""){ cout << "Error while getting the unit testing calendar URI" << endl; return; @@ -167,9 +167,9 @@ void populatecaldav(){ // Create five entries. - string EntryUUIDs[5] = { "XC-UT1", "XC-UT2", "XC-UT3", "XC-UT4", "XC-UT5" }; - string EntryFilename[5] = { "xc-ut1.ics", "xc-ut2.ics", "xc-ut3.ics", "xc-ut4.ics", "xc-ut5.ics" }; - string EntryData[5] = { + string entryUUIDs[5] = { "XC-UT1", "XC-UT2", "XC-UT3", "XC-UT4", "XC-UT5" }; + string entryFilename[5] = { "xc-ut1.ics", "xc-ut2.ics", "xc-ut3.ics", "xc-ut4.ics", "xc-ut5.ics" }; + string entryData[5] = { "BEGIN:VCALENDAR\n" "VERSION:2.0\n" @@ -235,27 +235,27 @@ void populatecaldav(){ // Place the entries into the calendar. - string CalendarEntryURI = ""; + string calendarEntryURI = ""; - for (int EntrySeek = 0; EntrySeek < 5; EntrySeek++){ + for (int entrySeek = 0; entrySeek < 5; entrySeek++){ - CalendarEntryURI = CalendarURI; - CalendarEntryURI += EntryFilename[EntrySeek]; + calendarEntryURI = calendarURI; + calendarEntryURI += entryFilename[entrySeek]; - ServerResult = PopulateCalDAV.AddEntry(&CalendarEntryURI, &EntryData[EntrySeek]); + serverResult = PopulateCalDAV.AddEntry(&calendarEntryURI, &entryData[entrySeek]); - if (ServerResult.Code != CURLE_OK){ + if (serverResult.code != CURLE_OK){ cout << "Error while adding an entry to the unit testing calendar." << endl; - cout << "Xestia Calendar Code: " << ServerResult.Result << endl; - cout << "cURL Code: " << ServerResult.Code << endl; - cout << "HTTP Code: " << ServerResult.HTTPCode << endl; - cout << "URI address: " << CalendarEntryURI << endl; + cout << "Xestia Calendar Code: " << serverResult.result << endl; + cout << "cURL Code: " << serverResult.code << endl; + cout << "HTTP Code: " << serverResult.httpCode << endl; + cout << "URI address: " << calendarEntryURI << endl; return; } - CalendarEntryURI.clear(); + calendarEntryURI.clear(); }