#include <CWebService.h>
Definition at line 8 of file CWebService.h.
◆ CWebService()
CWebService::CWebService |
( |
| ) |
|
Constructs a CWebService object and immediately establishes a connection to the "testman" Web Service.
Definition at line 17 of file CWebService.cpp.
28 FATAL(
"InternetOpenW failed\n");
33 FATAL(
"InternetConnectW failed\n");
static const INTERNET_PORT ServerPort
static const WCHAR szHostname[]
#define INTERNET_OPEN_TYPE_PRECONFIG
HINTERNET WINAPI InternetConnectW(HINTERNET hInternet, LPCWSTR lpszServerName, INTERNET_PORT nServerPort, LPCWSTR lpszUserName, LPCWSTR lpszPassword, DWORD dwService, DWORD dwFlags, DWORD_PTR dwContext)
HINTERNET WINAPI InternetOpenW(LPCWSTR lpszAgent, DWORD dwAccessType, LPCWSTR lpszProxy, LPCWSTR lpszProxyBypass, DWORD dwFlags)
#define INTERNET_SERVICE_HTTP
◆ ~CWebService()
CWebService::~CWebService |
( |
| ) |
|
Destructs a CWebService object and closes all connections to the Web Service.
Definition at line 39 of file CWebService.cpp.
BOOL WINAPI InternetCloseHandle(HINTERNET hInternet)
◆ DoRequest()
Sends data to the Web Service.
- Parameters
-
InputData | A std::string containing all the data, which is going to be submitted as HTTP POST data. |
- Returns
- Returns a pointer to a char array containing the data received from the Web Service. The caller needs to free that pointer.
Definition at line 65 of file CWebService.cpp.
67 const WCHAR szHeaders[] =
L"Content-Type: application/x-www-form-urlencoded";
76 FATAL(
"HttpOpenRequestW failed\n");
78 Data.reset(
new char[InputData.size() + 1]);
82 FATAL(
"HttpSendRequestW failed\n");
86 FATAL(
"InternetQueryDataAvailable failed\n");
91 FATAL(
"InternetReadFile failed\n");
95 return Data.release();
#define INTERNET_FLAG_NO_CACHE_WRITE
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG _In_opt_ PVOID Data
#define INTERNET_FLAG_SECURE
#define INTERNET_FLAG_RELOAD
BOOL WINAPI InternetQueryDataAvailable(HINTERNET hFile, LPDWORD lpdwNumberOfBytesAvailable, DWORD dwFlags, DWORD_PTR dwContext)
_In_ ULONG _In_opt_ WDFREQUEST _In_opt_ PVOID _In_ size_t _In_ PVOID _In_ size_t _Out_ size_t * DataLength
BOOL WINAPI HttpSendRequestW(HINTERNET hHttpRequest, LPCWSTR lpszHeaders, DWORD dwHeaderLength, LPVOID lpOptional, DWORD dwOptionalLength)
static const WCHAR szServerFile[]
BOOL WINAPI InternetReadFile(HINTERNET hFile, LPVOID lpBuffer, DWORD dwNumOfBytesToRead, LPDWORD pdwNumOfBytesRead)
#define INTERNET_FLAG_NO_COOKIES
char * strcpy(char *DstString, const char *SrcString)
HINTERNET WINAPI HttpOpenRequestW(HINTERNET hHttpSession, LPCWSTR lpszVerb, LPCWSTR lpszObjectName, LPCWSTR lpszVersion, LPCWSTR lpszReferrer, LPCWSTR *lpszAcceptTypes, DWORD dwFlags, DWORD_PTR dwContext)
Referenced by Finish(), GetSuiteID(), GetTestID(), and Submit().
◆ Finish()
Interface to other classes for finishing this test run
- Parameters
-
TestType | Constant pointer to a char array containing the test type to be run (i.e. "wine") |
Definition at line 105 of file CWebService.cpp.
112 EXCEPTION(
"CWebService::Finish was called, but not a single result had been submitted!\n");
114 Data =
"action=finish";
116 Data +=
"&testtype=";
125 ss <<
"When finishing the test run, the server responded:" <<
endl <<
Response <<
endl;
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_INTERRUPT_CONFIG Configuration
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG _In_opt_ PVOID Data
PCHAR DoRequest(const string &InputData)
basic_ostream< _CharT, _Traits > &_STLP_CALL endl(basic_ostream< _CharT, _Traits > &__os)
#define EXCEPTION(Message)
int strcmp(const char *String1, const char *String2)
Referenced by CWineTest::Run().
◆ GetSuiteID()
Gets a Suite ID from the Web Service for this module/test combination.
- Parameters
-
TestType | Constant pointer to a char array containing the test type to be run (i.e. "wine") |
TestInfo | Pointer to a CTestInfo object containing information about the test |
- Returns
- Returns a pointer to a char array containing the Suite ID received from the Web Service. The caller needs to free that pointer.
Definition at line 179 of file CWebService.cpp.
184 Data =
"action=getsuiteid";
186 Data +=
"&testtype=";
200 ss <<
"Expected Suite ID, but received:" <<
endl << SuiteID <<
endl;
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_INTERRUPT_CONFIG Configuration
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG _In_opt_ PVOID Data
PCHAR DoRequest(const string &InputData)
basic_ostream< _CharT, _Traits > &_STLP_CALL endl(basic_ostream< _CharT, _Traits > &__os)
bool IsNumber(const char *Input)
Referenced by Submit().
◆ GetTestID()
Requests a Test ID from the Web Service for our test run.
- Parameters
-
TestType | Constant pointer to a char array containing the test type to be run (i.e. "wine") |
Definition at line 137 of file CWebService.cpp.
141 Data =
"action=gettestid";
144 Data +=
"&testtype=";
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_INTERRUPT_CONFIG Configuration
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG _In_opt_ PVOID Data
PCHAR DoRequest(const string &InputData)
basic_ostream< _CharT, _Traits > &_STLP_CALL endl(basic_ostream< _CharT, _Traits > &__os)
bool IsNumber(const char *Input)
Referenced by Submit().
◆ Submit()
Interface to other classes for submitting a result of one test
- Parameters
-
TestType | Constant pointer to a char array containing the test type to be run (i.e. "wine") |
TestInfo | Pointer to a CTestInfo object containing information about the test |
Definition at line 217 of file CWebService.cpp.
229 Data =
"action=submit";
231 Data +=
"&testtype=";
244 ss <<
"When submitting the result, the server responded:" <<
endl <<
Response <<
endl;
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_INTERRUPT_CONFIG Configuration
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG _In_opt_ PVOID Data
PCHAR DoRequest(const string &InputData)
void GetTestID(const char *TestType)
basic_ostream< _CharT, _Traits > &_STLP_CALL endl(basic_ostream< _CharT, _Traits > &__os)
string EscapeString(const char *Input)
int strcmp(const char *String1, const char *String2)
PCHAR GetSuiteID(const char *TestType, CTestInfo *TestInfo)
Referenced by CWineTest::Run().
◆ m_hHTTP
◆ m_hHTTPRequest
◆ m_hInet
◆ m_TestID
PCHAR CWebService::m_TestID |
|
private |
The documentation for this class was generated from the following files: