Mantid
|
#include <ONCatHelper.h>
Public Member Functions | |
bool | allResponsesCalled () const |
bool | allResponsesCalledOnce () const |
MockONCatAPI ()=delete | |
MockONCatAPI (const MockResponseMap &responseMap) | |
~MockONCatAPI () | |
Public Member Functions inherited from Mantid::Kernel::InternetHelper | |
void | addHeader (const std::string &key, const std::string &value) |
Adds a header. More... | |
void | clearHeaders () |
Clears all headers. More... | |
void | clearProxy () |
Clears cached proxy details. More... | |
virtual HTTPStatus | downloadFile (const std::string &urlFile, const std::string &localFilePath="") |
Download a url and fetch it inside the local path given. More... | |
const std::string & | getBody () |
Gets the body set for future requests. More... | |
std::streamsize | getContentLength () |
Gets the content length. More... | |
const std::string & | getContentType () |
Gets the Content Type. More... | |
const std::string & | getHeader (const std::string &key) |
Gets the value of a header. More... | |
const std::string & | getMethod () |
Gets the method. More... | |
Kernel::ProxyInfo & | getProxy (const std::string &url) |
Gets proxy details for a system and a url. More... | |
const std::string & | getResponseReason () |
Gets the body set for future requests. More... | |
HTTPStatus | getResponseStatus () |
Gets the body set for future requests. More... | |
int | getTimeout () |
Gets the timeout in seconds. More... | |
StringToStringMap & | headers () |
Returns a reference to the headers map. More... | |
InternetHelper () | |
Constructor. More... | |
InternetHelper (const Kernel::ProxyInfo &proxy) | |
Constructor. More... | |
void | removeHeader (const std::string &key) |
Removes a header. More... | |
virtual void | reset () |
Resets properties to defaults (except the proxy) More... | |
virtual HTTPStatus | sendRequest (const std::string &url, std::ostream &responseStream) |
Performs a request using http or https depending on the url. More... | |
void | setBody (const std::ostringstream &body) |
Sets the body & content length for future requests, this will also set the method to POST is the body is not empty and GET if it is. More... | |
void | setBody (const std::string &body) |
Sets the body & content length for future requests, this will also set the method to POST is the body is not empty and GET if it is. More... | |
void | setBody (Poco::Net::HTMLForm &form) |
Sets the body & content length for future requests, this will also set the method to POST is the body is not empty and GET if it is. More... | |
void | setContentLength (std::streamsize length) |
Sets the content length. More... | |
void | setContentType (const std::string &contentType) |
Sets the Content Type. More... | |
void | setMethod (const std::string &method) |
Sets the Method. More... | |
void | setProxy (const Kernel::ProxyInfo &proxy) |
sets the proxy details. More... | |
void | setTimeout (int seconds) |
Sets the timeout in seconds. More... | |
virtual | ~InternetHelper () |
Destructor. More... | |
Protected Member Functions | |
InternetHelper::HTTPStatus | sendHTTPRequest (const std::string &url, std::ostream &responseStream) override |
Performs a request using http. More... | |
InternetHelper::HTTPStatus | sendHTTPSRequest (const std::string &url, std::ostream &responseStream) override |
Performs a request using https. More... | |
Protected Member Functions inherited from Mantid::Kernel::InternetHelper | |
void | createRequest (Poco::URI &uri) |
bool | isRelocated (const HTTPStatus &response) |
Checks the HTTP status to decide if this is a relocation. More... | |
void | logDebugRequestSending (const std::string &schemeName, const std::string &url) const |
Helper to log (debug level) the request being sent (careful not to print blatant passwords, etc.). More... | |
virtual HTTPStatus | processErrorStates (const Poco::Net::HTTPResponse &res, std::istream &rs, const std::string &url) |
Process any HTTP errors states. More... | |
InternetHelper::HTTPStatus | processRelocation (const Poco::Net::HTTPResponse &response, std::ostream &responseStream) |
virtual void | processResponseHeaders (const Poco::Net::HTTPResponse &res) |
Process any headers from the response stream Basic implementation does nothing. More... | |
virtual HTTPStatus | sendHTTPRequest (const std::string &url, std::ostream &responseStream) |
Performs a request using http. More... | |
virtual HTTPStatus | sendHTTPSRequest (const std::string &url, std::ostream &responseStream) |
Performs a request using https. More... | |
virtual HTTPStatus | sendRequestAndProcess (Poco::Net::HTTPClientSession &session, Poco::URI &uri, std::ostream &responseStream) |
void | setupProxyOnSession (Poco::Net::HTTPClientSession &session, const std::string &proxyUrl) |
void | throwNotConnected (const std::string &url, const Poco::Net::HostNotFoundException &ex) |
Throw an exception occurs when the computer is not connected to the internet. More... | |
Private Attributes | |
MockResponseCallCounts | m_responseCallCounts |
MockResponseMap | m_responseMap |
Definition at line 30 of file ONCatHelper.h.
|
delete |
Mantid::FrameworkTestHelpers::MockONCatAPI::MockONCatAPI | ( | const MockResponseMap & | responseMap | ) |
Definition at line 19 of file ONCatHelper.cpp.
References m_responseCallCounts.
|
default |
bool Mantid::FrameworkTestHelpers::MockONCatAPI::allResponsesCalled | ( | ) | const |
Definition at line 33 of file ONCatHelper.cpp.
References m_responseCallCounts.
bool Mantid::FrameworkTestHelpers::MockONCatAPI::allResponsesCalledOnce | ( | ) | const |
Definition at line 28 of file ONCatHelper.cpp.
References m_responseCallCounts.
|
overrideprotectedvirtual |
Performs a request using http.
url | the address to the network resource |
responseStream | The stream to fill with the reply on success |
Reimplemented from Mantid::Kernel::InternetHelper.
Definition at line 38 of file ONCatHelper.cpp.
References sendHTTPSRequest().
|
overrideprotectedvirtual |
Performs a request using https.
url | the address to the network resource |
responseStream | The stream to fill with the reply on success |
Reimplemented from Mantid::Kernel::InternetHelper.
Definition at line 42 of file ONCatHelper.cpp.
References m_responseCallCounts, m_responseMap, and Mantid::Kernel::InternetHelper::OK.
Referenced by sendHTTPRequest().
|
private |
Definition at line 45 of file ONCatHelper.h.
Referenced by allResponsesCalled(), allResponsesCalledOnce(), MockONCatAPI(), and sendHTTPSRequest().
|
private |
Definition at line 44 of file ONCatHelper.h.
Referenced by sendHTTPSRequest().