oss_test_util.h 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. #ifndef OSS_TEST_UTIL_H
  2. #define OSS_TEST_UTIL_H
  3. #include "CuTest.h"
  4. #include "aos_http_io.h"
  5. #include "aos_string.h"
  6. #include "aos_transport.h"
  7. #include "aos_status.h"
  8. #include "oss_define.h"
  9. OSS_CPP_START
  10. #define test_object_base() do { \
  11. aos_str_set(&bucket, bucket_name); \
  12. aos_str_set(&object, object_name); \
  13. } while(0)
  14. void make_rand_string(aos_pool_t *p, int len, aos_string_t *data);
  15. aos_buf_t *make_random_buf(aos_pool_t *p, int len);
  16. void make_random_body(aos_pool_t *p, int count, aos_list_t *bc);
  17. int make_random_file(aos_pool_t *p, const char *filename, int len);
  18. int fill_test_file(aos_pool_t *p, const char *filename, const char *content);
  19. void init_test_config(oss_config_t *config, int is_cname);
  20. void init_test_request_options(oss_request_options_t *options, int is_cname);
  21. aos_status_t * create_test_bucket(const oss_request_options_t *options,
  22. const char *bucket_name, oss_acl_e oss_acl);
  23. aos_status_t *create_test_object(const oss_request_options_t *options, const char *bucket_name,
  24. const char *object_name, const char *data, aos_table_t *headers);
  25. aos_status_t *create_test_object_from_file(const oss_request_options_t *options, const char *bucket_name,
  26. const char *object_name, const char *filename, aos_table_t *headers);
  27. aos_status_t *delete_test_object(const oss_request_options_t *options,
  28. const char *bucket_name, const char *object_name);
  29. aos_status_t *init_test_multipart_upload(const oss_request_options_t *options, const char *bucket_name,
  30. const char *object_name, aos_string_t *upload_id);
  31. aos_status_t *abort_test_multipart_upload(const oss_request_options_t *options, const char *bucket_name,
  32. const char *object_name, aos_string_t *upload_id);
  33. aos_status_t *create_test_live_channel(const oss_request_options_t *options, const char *bucket_name,
  34. const char *live_channel);
  35. aos_status_t *delete_test_live_channel(const oss_request_options_t *options, const char *bucket_name,
  36. const char *live_channel);
  37. char *gen_test_signed_url(const oss_request_options_t *options, const char *bucket_name,
  38. const char *object_name, int64_t expires, aos_http_request_t *req);
  39. unsigned long get_file_size(const char *file_path);
  40. char *decrypt(const char *encrypted_str, aos_pool_t *pool);
  41. void percentage(int64_t consumed_bytes, int64_t total_bytes);
  42. void progress_callback(int64_t consumed_bytes, int64_t total_bytes);
  43. OSS_CPP_END
  44. #endif