#include <MockCurlWrapper.h>
Public Member Functions | |
| virtual void | customRequest (const te::core::URI &uri, const std::string &request, const std::string &body=std::string(""), const ::std::string &header=std::string("")) |
| Method to make a custom request, useful for performing a HTTP DELETE request. More... | |
| virtual void | downloadFile (const std::string &url, const std::string &filePath, te::common::TaskProgress *taskProgress=0) |
| Method to download a file retrieved from given URL and save into the specified file path. More... | |
| virtual void | downloadFile (const std::string &url, std::FILE *file, te::common::TaskProgress *taskProgress=0) |
| Method to download a file retrieved from given URL and save into the specified File. More... | |
| virtual void | get (const te::core::URI &uri, std::string &buffer) |
| Method to make a GET request. More... | |
| virtual AuthenticationMethod | getAuthenticationMethod () const |
| Gets current AuthenticationMethod. More... | |
| virtual std::string | getTaskMessage () const |
| This method gets the message that will be used on Progress Bar when this object is downloading some file. More... | |
| virtual std::string | getUsername () const |
| Gets the user name that will be used when an athentication method is set. More... | |
| virtual std::vector< std::string > | listFiles (const te::core::URI &uri) |
| Method to list files in a URI. More... | |
| MOCK_METHOD2 (downloadFile, void(const std::string &, const std::string &)) | |
| MOCK_METHOD2 (downloadFile, void(const std::string &, std::FILE *)) | |
| MockCurlWrapper ()=default | |
| virtual void | post (const te::core::URI &uri, const std::string &postFields, const ::std::string &header) |
| Method to request a post in a determined URI. More... | |
| virtual void | putFile (const te::core::URI &uri, const std::string &filePath, const ::std::string &header, te::common::TaskProgress *taskProgress=0) |
| Method to request a put with a file in a determined URI. More... | |
| virtual void | putFile (const te::core::URI &uri, FILE *file, const ::std::string &header, te::common::TaskProgress *taskProgress=0, const long &fileSize=0L) |
| Method to request a put a file in a determined URI. More... | |
| virtual const std::string & | response () const |
| Returns the last operation response if the protocol allows it. More... | |
| virtual const long | responseCode () const |
| Returns the last operation response code. More... | |
| virtual void | setAuthenticationMethod (const AuthenticationMethod &method) |
| Sets the authentication method that will be used on the requests. More... | |
| virtual void | setPassword (const std::string &password) |
| Sets the password that will be used when an athentication method is set. More... | |
| virtual void | setTaskMessage (const std::string &taskMessage) |
| This method sets the message that will be used on Progress Bar when this object is downloading some file. More... | |
| virtual void | setUsername (const std::string &username) |
| Sets the user name that will be used when an athentication method is set. More... | |
| virtual void | verifyURL (std::string url, uint32_t timeout) const |
| Verify if the URI is reacheble. More... | |
| virtual | ~MockCurlWrapper ()=default |
Protected Member Functions | |
| virtual void | addAuthParameters () |
| Adds HTTP Authentication parameters according to the current AuthenticationMethod. More... | |
| virtual void | clean () |
| Reset the curl handle and the class members. More... | |
| virtual void | downloadFile_ (const std::string &url, std::FILE *file, te::common::TaskProgress *taskProgress=0) |
| Private unsafe method to download a file retrieved from given URL and save into the specified File. More... | |
| std::unique_lock< std::mutex > | getLock () |
| virtual std::vector< std::string > | listFiles_ (const te::core::URI &uri) |
| Private unsafe method to list files in a URI. More... | |
| void | setOption (int option, std::string value) |
| void | setOption (int option, char *value) |
| void | setOption (int option, int value) |
Definition at line 33 of file MockCurlWrapper.h.
|
default |
|
virtualdefault |
|
protectedvirtualinherited |
Adds HTTP Authentication parameters according to the current AuthenticationMethod.
Definition at line 562 of file CurlWrapper.cpp.
References te::ws::core::HTTP_BASIC, te::ws::core::HTTP_DIGEST, te::ws::core::CurlWrapper::m_pimpl, and te::ws::core::NOT_AUTH.
Referenced by te::ws::core::CurlWrapper::downloadFile_(), and te::ws::core::CurlWrapper::get().
|
protectedvirtualinherited |
Reset the curl handle and the class members.
Definition at line 87 of file CurlWrapper.cpp.
References te::ws::core::CurlWrapper::m_pimpl.
Referenced by te::ws::core::CurlWrapper::customRequest(), te::ws::core::CurlWrapper::downloadFile(), te::ws::core::CurlWrapper::get(), te::ws::core::CurlWrapper::listFiles(), te::ws::core::CurlWrapper::post(), and te::ws::core::CurlWrapper::putFile().
|
virtualinherited |
Method to make a custom request, useful for performing a HTTP DELETE request.
| uri | The URI with the address information |
| request | The custom request |
Definition at line 427 of file CurlWrapper.cpp.
References te::ws::core::CurlWrapper::clean(), te::ws::core::CurlWrapper::m_pimpl, te::core::URI::uri(), and WriteResponse().
|
virtualinherited |
Method to download a file retrieved from given URL and save into the specified file path.
| url | URL that the file will be downloaded. |
| filePath | file path where downloaded file will be saved. |
Definition at line 199 of file CurlWrapper.cpp.
References file(), te::core::CharEncoding::fromUTF8(), and TE_TR.
|
virtualinherited |
Method to download a file retrieved from given URL and save into the specified File.
| url | URL that the file will be downloaded. |
| file | File where downloaded file will be write. |
Definition at line 220 of file CurlWrapper.cpp.
References te::ws::core::CurlWrapper::clean(), te::ws::core::CurlWrapper::downloadFile_(), and te::ws::core::CurlWrapper::getLock().
|
protectedvirtualinherited |
Private unsafe method to download a file retrieved from given URL and save into the specified File.
| url | URL that the file will be downloaded. |
| file | File where downloaded file will be write. |
Definition at line 227 of file CurlWrapper.cpp.
References te::ws::core::CurlWrapper::addAuthParameters(), DownloadProgress(), file(), te::gm::L, CurlProgress::m_baseMessage, CurlProgress::m_curl, te::ws::core::CurlWrapper::m_pimpl, CurlProgress::m_task, te::ws::core::NOT_AUTH, TE_TR, te::common::TaskProgress::UNDEFINED, and WriteFileCallback().
Referenced by te::ws::core::CurlWrapper::downloadFile().
|
virtualinherited |
Method to make a GET request.
| uri | The URI with the address information |
| buffer | Where the server answer will be write. |
Definition at line 475 of file CurlWrapper.cpp.
References te::ws::core::CurlWrapper::addAuthParameters(), te::ws::core::CurlWrapper::clean(), te::ws::core::CurlWrapper::m_pimpl, te::ws::core::NOT_AUTH, te::core::URI::uri(), and WriteResponse().
|
virtualinherited |
Gets current AuthenticationMethod.
Definition at line 542 of file CurlWrapper.cpp.
References te::ws::core::CurlWrapper::m_pimpl.
|
protectedinherited |
Definition at line 215 of file CurlWrapper.cpp.
References te::ws::core::CurlWrapper::m_pimpl.
Referenced by te::ws::core::CurlWrapper::downloadFile().
|
virtualinherited |
This method gets the message that will be used on Progress Bar when this object is downloading some file.
Definition at line 279 of file CurlWrapper.cpp.
References te::ws::core::CurlWrapper::m_pimpl.
|
virtualinherited |
Gets the user name that will be used when an athentication method is set.
Definition at line 552 of file CurlWrapper.cpp.
References te::ws::core::CurlWrapper::m_pimpl.
|
virtualinherited |
Method to list files in a URI.
| url | URL that the files will be listed. |
Definition at line 628 of file CurlWrapper.cpp.
References te::ws::core::CurlWrapper::clean(), and te::ws::core::CurlWrapper::listFiles_().
|
protectedvirtualinherited |
Private unsafe method to list files in a URI.
| url | URL that the files will be listed. |
Definition at line 634 of file CurlWrapper.cpp.
References te::ws::core::CurlWrapper::m_pimpl, te::core::URI::uri(), and WriteResponse().
Referenced by te::ws::core::CurlWrapper::listFiles().
| MockCurlWrapper::MOCK_METHOD2 | ( | downloadFile | , |
| void(const std::string &, const std::string &) | |||
| ) |
| MockCurlWrapper::MOCK_METHOD2 | ( | downloadFile | , |
| void(const std::string &, std::FILE *) | |||
| ) |
|
virtualinherited |
Method to request a post in a determined URI.
| uri | The URI with the address information to post |
| postFields | The parameters and values to post |
| header | A header to the post request |
Definition at line 291 of file CurlWrapper.cpp.
References te::ws::core::CurlWrapper::clean(), file(), te::ws::core::GetFileSize(), te::ws::core::CurlWrapper::m_pimpl, te::ws::core::CurlWrapper::putFile(), TE_TR, te::core::URI::uri(), and WriteResponse().
|
virtualinherited |
Method to request a put with a file in a determined URI.
| uri | The URI with the address information |
| file | Path The full path of the file to put |
| header | A header to the put request |
Referenced by te::ws::core::CurlWrapper::post().
|
virtualinherited |
Method to request a put a file in a determined URI.
| uri | The URI with the address information |
| file | Contains the file opened by the fstream |
| header | A header to the put request |
Definition at line 354 of file CurlWrapper.cpp.
References te::ws::core::CurlWrapper::clean(), file(), te::gm::L, CurlProgress::m_baseMessage, CurlProgress::m_curl, te::ws::core::CurlWrapper::m_pimpl, CurlProgress::m_task, read_data(), te::common::TaskProgress::UNDEFINED, UploadProgress(), te::core::URI::uri(), and WriteResponse().
|
virtualinherited |
Returns the last operation response if the protocol allows it.
Definition at line 532 of file CurlWrapper.cpp.
References te::ws::core::CurlWrapper::m_pimpl.
|
virtualinherited |
Returns the last operation response code.
Definition at line 526 of file CurlWrapper.cpp.
References te::ws::core::CurlWrapper::m_pimpl.
|
virtualinherited |
Sets the authentication method that will be used on the requests.
| method | (e. g.: Basic or Digest) |
Definition at line 537 of file CurlWrapper.cpp.
References te::ws::core::CurlWrapper::m_pimpl.
|
protectedinherited |
Definition at line 590 of file CurlWrapper.cpp.
References te::ws::core::CurlWrapper::m_pimpl.
|
protectedinherited |
Definition at line 596 of file CurlWrapper.cpp.
References te::ws::core::CurlWrapper::m_pimpl.
Definition at line 603 of file CurlWrapper.cpp.
References te::ws::core::CurlWrapper::m_pimpl.
|
virtualinherited |
Sets the password that will be used when an athentication method is set.
| password |
Definition at line 557 of file CurlWrapper.cpp.
References te::ws::core::CurlWrapper::m_pimpl.
|
virtualinherited |
This method sets the message that will be used on Progress Bar when this object is downloading some file.
| taskMessage | new message. |
Definition at line 285 of file CurlWrapper.cpp.
References te::ws::core::CurlWrapper::m_pimpl.
|
virtualinherited |
Sets the user name that will be used when an athentication method is set.
| username |
Definition at line 547 of file CurlWrapper.cpp.
References te::ws::core::CurlWrapper::m_pimpl.
|
virtualinherited |
Verify if the URI is reacheble.
| te::ws::core::Exception | Rise if the URI cannot be reached. |
Definition at line 609 of file CurlWrapper.cpp.
References te::ws::core::CurlWrapper::m_pimpl.