Skip to content

Commit

Permalink
Rename buffer to azure buffer and update repos (#894)
Browse files Browse the repository at this point in the history
  • Loading branch information
jebrando authored Mar 6, 2019
1 parent 1078a7b commit e908dd2
Show file tree
Hide file tree
Showing 39 changed files with 211 additions and 213 deletions.
2 changes: 1 addition & 1 deletion deps/uhttp
6 changes: 3 additions & 3 deletions iothub_client/src/blob.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

#include "azure_c_shared_utility/httpapiex.h"
#include "azure_c_shared_utility/xlogging.h"
#include "azure_c_shared_utility/base64.h"
#include "azure_c_shared_utility/azure_base64.h"
#include "azure_c_shared_utility/shared_util_options.h"

BLOB_RESULT Blob_UploadBlock(
Expand Down Expand Up @@ -44,11 +44,11 @@ BLOB_RESULT Blob_UploadBlock(
}
else
{
STRING_HANDLE blockIdString = Base64_Encode_Bytes((const unsigned char*)temp, 6);
STRING_HANDLE blockIdString = Azure_Base64_Encode_Bytes((const unsigned char*)temp, 6);
if (blockIdString == NULL)
{
/*Codes_SRS_BLOB_02_033: [ If any previous operation that doesn't have an explicit failure description fails then Blob_UploadMultipleBlocksFromSasUri shall fail and return BLOB_ERROR ]*/
LogError("unable to Base64_Encode_Bytes");
LogError("unable to Azure_Base64_Encode_Bytes");
result = BLOB_ERROR;
}
else
Expand Down
10 changes: 5 additions & 5 deletions iothub_client/src/iothubtransporthttp.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#include "azure_c_shared_utility/httpapiex.h"
#include "azure_c_shared_utility/httpapiexsas.h"
#include "azure_c_shared_utility/strings.h"
#include "azure_c_shared_utility/base64.h"
#include "azure_c_shared_utility/azure_base64.h"
#include "azure_c_shared_utility/doublylinkedlist.h"
#include "azure_c_shared_utility/vector.h"
#include "azure_c_shared_utility/httpheaders.h"
Expand Down Expand Up @@ -1348,10 +1348,10 @@ static STRING_HANDLE make1EventJSONitem(PDLIST_ENTRY item, size_t *messageSizeCo
}
else
{
STRING_HANDLE encoded = Base64_Encode_Bytes(source, size);
STRING_HANDLE encoded = Azure_Base64_Encode_Bytes(source, size);
if (encoded == NULL)
{
LogError("unable to Base64_Encode_Bytes.");
LogError("unable to Azure_Base64_Encode_Bytes.");
STRING_delete(result);
result = NULL;
}
Expand Down Expand Up @@ -1745,7 +1745,7 @@ static void DoEvent(HTTPTRANSPORT_HANDLE_DATA* handleData, HTTPTRANSPORT_PERDEVI
else
{
// set_message_properties returning false does not necessarily mean the the function failed, it just means
// the the adding of messages should not continue and should try the next time. So you should not log if this
// the the adding of messages should not continue and should try the next time. So you should not log if this
// returns false
if (set_message_properties(message, &messageSize, clonedEventHTTPrequestHeaders, handleData, deviceData))
{
Expand Down Expand Up @@ -1785,7 +1785,7 @@ static void DoEvent(HTTPTRANSPORT_HANDLE_DATA* handleData, HTTPTRANSPORT_PERDEVI
else
{
/*Codes_SRS_TRANSPORTMULTITHTTP_17_080: [If a deviceSasToken does not exist, IoTHubTransportHttp_DoWork shall call HTTPAPIEX_SAS_ExecuteRequest passing the following parameters] */
if ((r = HTTPAPIEX_SAS_ExecuteRequest(deviceData->sasObject, handleData->httpApiExHandle, HTTPAPI_REQUEST_POST, STRING_c_str(deviceData->eventHTTPrelativePath),
if ((r = HTTPAPIEX_SAS_ExecuteRequest(deviceData->sasObject, handleData->httpApiExHandle, HTTPAPI_REQUEST_POST, STRING_c_str(deviceData->eventHTTPrelativePath),
clonedEventHTTPrequestHeaders, toBeSend, &statusCode, NULL, NULL )) != HTTPAPIEX_OK)
{
LogError("unable to HTTPAPIEX_SAS_ExecuteRequest");
Expand Down
24 changes: 12 additions & 12 deletions iothub_client/tests/blob_ut/blob_ut.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ static void my_gballoc_free(void* s)
#include "azure_c_shared_utility/httpapiex.h"
#include "azure_c_shared_utility/buffer_.h"
#include "azure_c_shared_utility/strings.h"
#include "azure_c_shared_utility/base64.h"
#include "azure_c_shared_utility/azure_base64.h"
#include "azure_c_shared_utility/httpheaders.h"
#include "azure_c_shared_utility/gballoc.h"
#include "azure_c_shared_utility/shared_util_options.h"
Expand Down Expand Up @@ -102,7 +102,7 @@ static void my_STRING_delete(STRING_HANDLE h)
my_gballoc_free((void*)h);
}

static STRING_HANDLE my_Base64_Encode_Bytes(const unsigned char* source, size_t size)
static STRING_HANDLE my_Azure_Base64_Encode_Bytes(const unsigned char* source, size_t size)
{
(void)source;
(void)size;
Expand Down Expand Up @@ -260,8 +260,8 @@ TEST_SUITE_INITIALIZE(TestSuiteInitialize)

REGISTER_GLOBAL_MOCK_HOOK(STRING_construct, my_STRING_construct);
REGISTER_GLOBAL_MOCK_FAIL_RETURN(STRING_construct, NULL);
REGISTER_GLOBAL_MOCK_HOOK(Base64_Encode_Bytes, my_Base64_Encode_Bytes);
REGISTER_GLOBAL_MOCK_FAIL_RETURN(Base64_Encode_Bytes, NULL);
REGISTER_GLOBAL_MOCK_HOOK(Azure_Base64_Encode_Bytes, my_Azure_Base64_Encode_Bytes);
REGISTER_GLOBAL_MOCK_FAIL_RETURN(Azure_Base64_Encode_Bytes, NULL);

REGISTER_GLOBAL_MOCK_FAIL_RETURN(STRING_concat, __FAILURE__);
REGISTER_GLOBAL_MOCK_FAIL_RETURN(STRING_concat_with_STRING, __FAILURE__);
Expand Down Expand Up @@ -364,7 +364,7 @@ TEST_FUNCTION(Blob_UploadMultipleBlocksFromSasUri_succeeds_when_HTTP_status_code
)); /*this is the content to be uploaded by this call*/

/*here some sprintf happens and that produces a string in the form: 000000...049999*/
STRICT_EXPECTED_CALL(Base64_Encode_Bytes(IGNORED_PTR_ARG, 6)) /*this is converting the produced blockID string to a base64 representation*/
STRICT_EXPECTED_CALL(Azure_Base64_Encode_Bytes(IGNORED_PTR_ARG, 6)) /*this is converting the produced blockID string to a base64 representation*/
.IgnoreArgument_source();

STRICT_EXPECTED_CALL(STRING_concat(IGNORED_PTR_ARG, "<Latest>")) /*this is building the XML*/
Expand Down Expand Up @@ -441,7 +441,7 @@ TEST_FUNCTION(Blob_UploadMultipleBlocksFromSasUri_fails_when_HTTPAPIEX_ExecuteRe
)); /*this is the content to be uploaded by this call*/

/*here some sprintf happens and that produces a string in the form: 000000...049999*/
STRICT_EXPECTED_CALL(Base64_Encode_Bytes(IGNORED_PTR_ARG, 6)) /*this is converting the produced blockID string to a base64 representation*/
STRICT_EXPECTED_CALL(Azure_Base64_Encode_Bytes(IGNORED_PTR_ARG, 6)) /*this is converting the produced blockID string to a base64 representation*/
.IgnoreArgument_source();

STRICT_EXPECTED_CALL(STRING_concat(IGNORED_PTR_ARG, "<Latest>")) /*this is building the XML*/
Expand Down Expand Up @@ -677,7 +677,7 @@ static void Blob_UploadMultipleBlocksFromSasUri_various_sizes_happy_path_Impl(HT
)); /*this is the content to be uploaded by this call*/

/*here some sprintf happens and that produces a string in the form: 000000...049999*/
STRICT_EXPECTED_CALL(Base64_Encode_Bytes(IGNORED_PTR_ARG, 6)) /*this is converting the produced blockID string to a base64 representation*/
STRICT_EXPECTED_CALL(Azure_Base64_Encode_Bytes(IGNORED_PTR_ARG, 6)) /*this is converting the produced blockID string to a base64 representation*/
.IgnoreArgument_source();

STRICT_EXPECTED_CALL(STRING_concat(IGNORED_PTR_ARG, "<Latest>")) /*this is building the XML*/
Expand Down Expand Up @@ -859,7 +859,7 @@ TEST_FUNCTION(Blob_UploadMultipleBlocksFromSasUri_various_sizes_with_certificate
)); /*this is the content to be uploaded by this call*/

/*here some sprintf happens and that produces a string in the form: 000000...049999*/
STRICT_EXPECTED_CALL(Base64_Encode_Bytes(IGNORED_PTR_ARG, 6)) /*this is converting the produced blockID string to a base64 representation*/
STRICT_EXPECTED_CALL(Azure_Base64_Encode_Bytes(IGNORED_PTR_ARG, 6)) /*this is converting the produced blockID string to a base64 representation*/
.IgnoreArgument_source();

STRICT_EXPECTED_CALL(STRING_concat(IGNORED_PTR_ARG, "<Latest>")) /*this is building the XML*/
Expand Down Expand Up @@ -1062,7 +1062,7 @@ TEST_FUNCTION(Blob_UploadMultipleBlocksFromSasUri_64MB_unhappy_paths)
)); /*this is the content to be uploaded by this call*/

/*here some sprintf happens and that produces a string in the form: 000000...049999*/
STRICT_EXPECTED_CALL(Base64_Encode_Bytes(IGNORED_PTR_ARG, 6)) /*this is converting the produced blockID string to a base64 representation*/ /*3, 16, 29... (16 numbers)*/
STRICT_EXPECTED_CALL(Azure_Base64_Encode_Bytes(IGNORED_PTR_ARG, 6)) /*this is converting the produced blockID string to a base64 representation*/ /*3, 16, 29... (16 numbers)*/
.IgnoreArgument_source();

STRICT_EXPECTED_CALL(STRING_concat(IGNORED_PTR_ARG, "<Latest>")) /*this is building the XML*/
Expand Down Expand Up @@ -1161,7 +1161,7 @@ TEST_FUNCTION(Blob_UploadMultipleBlocksFromSasUri_64MB_unhappy_paths)
umock_c_negative_tests_fail_call(i);
char temp_str[128];
sprintf(temp_str, "On failed call %lu", (unsigned long)i);

///act
context.toUpload = context.size; /* Reinit context */
BLOB_RESULT result = Blob_UploadMultipleBlocksFromSasUri("https://h.h/something?a=b", FileUpload_GetData_Callback, &context, &httpResponse, testValidBufferHandle, NULL, NULL);
Expand Down Expand Up @@ -1292,7 +1292,7 @@ TEST_FUNCTION(Blob_UploadMultipleBlocksFromSasUri_64MB_with_certificate_unhappy_
)); /*this is the content to be uploaded by this call*/

/*here some sprintf happens and that produces a string in the form: 000000...049999*/
STRICT_EXPECTED_CALL(Base64_Encode_Bytes(IGNORED_PTR_ARG, 6)) /*this is converting the produced blockID string to a base64 representation*/ /*3, 16, 29... (16 numbers)*/
STRICT_EXPECTED_CALL(Azure_Base64_Encode_Bytes(IGNORED_PTR_ARG, 6)) /*this is converting the produced blockID string to a base64 representation*/ /*3, 16, 29... (16 numbers)*/
.IgnoreArgument_source(); /* 5 */

STRICT_EXPECTED_CALL(STRING_concat(IGNORED_PTR_ARG, "<Latest>")) /*this is building the XML*/
Expand Down Expand Up @@ -1440,7 +1440,7 @@ TEST_FUNCTION(Blob_UploadFromSasUri_when_http_code_is_404_it_immediately_succeed
)); /*this is the content to be uploaded by this call*/

/*here some sprintf happens and that produces a string in the form: 000000...049999*/
STRICT_EXPECTED_CALL(Base64_Encode_Bytes(IGNORED_PTR_ARG, 6)) /*this is converting the produced blockID string to a base64 representation*/
STRICT_EXPECTED_CALL(Azure_Base64_Encode_Bytes(IGNORED_PTR_ARG, 6)) /*this is converting the produced blockID string to a base64 representation*/
.IgnoreArgument_source();

STRICT_EXPECTED_CALL(STRING_concat(IGNORED_PTR_ARG, "<Latest>")) /*this is building the XML*/
Expand Down
Loading

0 comments on commit e908dd2

Please sign in to comment.