From 9acb26c8a324c2aa9d4f52ecfa2561b48044de58 Mon Sep 17 00:00:00 2001 From: Blake Nedved Date: Thu, 7 Nov 2024 06:05:41 -0500 Subject: [PATCH] created a test class header for globus api --- core/server/GlobusAPI.hpp | 6 +++-- core/server/TestGlobusAPI.hpp | 43 +++++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+), 2 deletions(-) create mode 100644 core/server/TestGlobusAPI.hpp diff --git a/core/server/GlobusAPI.hpp b/core/server/GlobusAPI.hpp index c571a1e4a..87682d271 100644 --- a/core/server/GlobusAPI.hpp +++ b/core/server/GlobusAPI.hpp @@ -67,8 +67,7 @@ class GlobusAPI { void refreshAccessToken(const std::string &a_ref_tok, std::string &a_new_acc_tok, uint32_t &a_expires_in); -private: - void init(); +protected: long get(CURL *a_curl, const std::string &a_base_url, const std::string &a_url_path, const std::string &a_token, const std::vector> &a_params, @@ -77,6 +76,9 @@ class GlobusAPI { const std::string &a_url_path, const std::string &a_token, const std::vector> &a_params, const libjson::Value *a_body, std::string &a_result); + +private: + void init(); std::string getSubmissionID(const std::string &a_acc_token); bool eventsHaveErrors(const std::vector &a_events, XfrStatus &status, std::string &a_err_msg); diff --git a/core/server/TestGlobusAPI.hpp b/core/server/TestGlobusAPI.hpp new file mode 100644 index 000000000..fd72fdf82 --- /dev/null +++ b/core/server/TestGlobusAPI.hpp @@ -0,0 +1,43 @@ +#ifndef TESTGLOBUSAPICLIENT_HPP +#define TESTGLOBUSAPICLIENT_HPP +#pragma once + +// Local private includes +#include "GlobusAPI.hpp" + +// Local public includes +#include "common/DynaLog.hpp" +#include "common/SDMS.pb.h" +#include "common/libjson.hpp" + +// Third party includes +#include + +// Standard includes +#include +#include + +namespace SDMS { +namespace Core { + +class TestGlobusAPI: GlobusAPI { + TestGlobusAPI(); + explicit TestGlobusAPI(LogContext log_context); + + ~TestGlobusAPI(); + +public: + long get(CURL *a_curl, const std::string &a_base_url, + const std::string &a_url_path, const std::string &a_token, + const std::vector> &a_params, + std::string &a_result); + long post(CURL *a_curl, const std::string &a_base_url, + const std::string &a_url_path, const std::string &a_token, + const std::vector> &a_params, + const libjson::Value *a_body, std::string &a_result); +}; + +} // namespace Core +} // namespace SDMS + +#endif