Skip to content

Commit

Permalink
Added to support new response code 202 in webpa
Browse files Browse the repository at this point in the history
  • Loading branch information
vasuki01 committed Sep 10, 2024
1 parent e93bd45 commit 7ee9f36
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/wdmp_internal.c
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,6 @@ void wdmp_form_get_response(res_struct *resObj, cJSON *response)

WdmpPrint("resObj->retStatus : %d\n",resObj->retStatus[0]);
getStatusCode(&statusCode, paramCount, resObj->retStatus);

result = (char *) malloc(sizeof(char) * MAX_RESULT_LEN);

if(resObj->u.paramRes->params)
Expand Down Expand Up @@ -840,6 +839,11 @@ void wdmp_form_table_response(res_struct *resObj, cJSON *response)
*statusCode = WDMP_STATUS_ATOMIC_GET_SET_FAILED;
break;
}
else if (ret[i] == WDMP_ERR_SESSION_IN_PROGRESS)
{
*statusCode = WDMP_STATUS_PREVIOUS_REQUEST_INPROGRESS;
break;
}
else
{
*statusCode = WDMP_STATUS_GENERAL_FALURE;
Expand Down
1 change: 1 addition & 0 deletions src/wdmp_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ typedef enum
{
WDMP_STATUS_SUCCESS = 200,
WDMP_ADDROW_STATUS_SUCCESS = 201,
WDMP_STATUS_PREVIOUS_REQUEST_INPROGRESS = 202,
WDMP_STATUS_GENERAL_FALURE = 520,
WDMP_STATUS_CID_TEST_FAILED = 550,
WDMP_STATUS_CMC_TEST_FAILED = 551,
Expand Down
27 changes: 27 additions & 0 deletions tests/simple.c
Original file line number Diff line number Diff line change
Expand Up @@ -1658,6 +1658,32 @@ void test_get_status_code()
}
}

void test_get_status_code_inprogress()
{
WDMP_RESPONSE_STATUS_CODE statusCode;
WDMP_STATUS * ret = NULL;
int paramCount = 3;

WdmpInfo("\n***************************************************** \n\n");

ret = (WDMP_STATUS *) malloc(sizeof(WDMP_STATUS)*paramCount);

ret[0] = WDMP_SUCCESS;
ret[1] = WDMP_SUCCESS;
ret[2] = WDMP_ERR_SESSION_IN_PROGRESS;

getStatusCode(&statusCode, paramCount, ret);

CU_ASSERT_EQUAL( WDMP_STATUS_PREVIOUS_REQUEST_INPROGRESS, statusCode );

WdmpInfo("statusCode : %d\n",statusCode);

if(ret)
{
free(ret);
}
}

void test_map_wdmp_status()
{
WDMP_STATUS status;
Expand Down Expand Up @@ -2554,6 +2580,7 @@ void add_response_form_suites ( CU_pSuite *suite )
CU_add_test( *suite, "Delete row Response Form", delete_row_res_form );
CU_add_test( *suite, "Table response Form", table_res_form );
CU_add_test( *suite, "Get status code", test_get_status_code );
CU_add_test( *suite, "Get status code session inprogress", test_get_status_code_inprogress );
CU_add_test( *suite, "Map wdmp status", test_map_wdmp_status );
CU_add_test( *suite, "Negative Get Response Form", neg_get_res_form );
CU_add_test( *suite, "Get Wildcard empty Response Form", get_wildcard_empty_value_res_form);
Expand Down

0 comments on commit 7ee9f36

Please sign in to comment.