Skip to content

Commit

Permalink
created a test class header for globus api
Browse files Browse the repository at this point in the history
  • Loading branch information
nedvedba committed Nov 11, 2024
1 parent 7dad1dd commit 9acb26c
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 2 deletions.
6 changes: 4 additions & 2 deletions core/server/GlobusAPI.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<std::pair<std::string, std::string>> &a_params,
Expand All @@ -77,6 +76,9 @@ class GlobusAPI {
const std::string &a_url_path, const std::string &a_token,
const std::vector<std::pair<std::string, std::string>> &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<std::string> &a_events,
XfrStatus &status, std::string &a_err_msg);
Expand Down
43 changes: 43 additions & 0 deletions core/server/TestGlobusAPI.hpp
Original file line number Diff line number Diff line change
@@ -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 <curl/curl.h>

// Standard includes
#include <string>
#include <vector>

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<std::pair<std::string, std::string>> &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<std::pair<std::string, std::string>> &a_params,
const libjson::Value *a_body, std::string &a_result);
};

} // namespace Core
} // namespace SDMS

#endif

0 comments on commit 9acb26c

Please sign in to comment.