Made minor changes to the CASA AuthToken Client Test application to improve its use-ability.
This commit is contained in:
@@ -26,12 +26,15 @@
|
||||
#include "casa_c_authtoken.h"
|
||||
|
||||
// Globals
|
||||
char usageString[] = "usage: test -a serverAddress -p serverPort [-h]\n";
|
||||
char usageString[] = "usage: test -a serverAddress -p serverPort [-s serviceName] [-h]\n";
|
||||
|
||||
char *pServerAddress = NULL;
|
||||
int serverPort = 0;
|
||||
BOOLEAN execHttpTest = FALSE;
|
||||
|
||||
char serviceName[] = "testService";
|
||||
char *pServiceName = serviceName;
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
@@ -150,8 +153,8 @@ void NonHttpTest(void)
|
||||
char authToken[8192];
|
||||
int authTokenLen = sizeof(authToken);
|
||||
|
||||
// Obtain an authentication token for the testService
|
||||
retStatus = ObtainAuthToken("testService", pServerAddress, authToken, &authTokenLen);
|
||||
// Obtain an authentication token for the targeted service
|
||||
retStatus = ObtainAuthToken(pServiceName, pServerAddress, authToken, &authTokenLen);
|
||||
if (!CASA_SUCCESS(retStatus))
|
||||
{
|
||||
printf("-NonHttpTest- ObtainAuthToken failed with status %d\n", retStatus);
|
||||
@@ -281,8 +284,8 @@ void HttpTest(void)
|
||||
char authToken[4096];
|
||||
int authTokenLen = sizeof(authToken);
|
||||
|
||||
// Obtain an authentication token for the testService
|
||||
retStatus = ObtainAuthToken("testService", pServerAddress, authToken, &authTokenLen);
|
||||
// Obtain an authentication token for the targeted service
|
||||
retStatus = ObtainAuthToken(pServiceName, pServerAddress, authToken, &authTokenLen);
|
||||
if (!CASA_SUCCESS(retStatus))
|
||||
{
|
||||
printf("-HttpTest- ObtainAuthToken failed with status %d\n", retStatus);
|
||||
@@ -472,6 +475,21 @@ int main(int argc, char* argv[])
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else if (stricmp(argv[i], "-s") == 0)
|
||||
{
|
||||
// Service name option, the next argument should
|
||||
// contain the name of the service to be targeted.
|
||||
i++;
|
||||
if (argv[i] != NULL)
|
||||
{
|
||||
pServiceName = argv[i];
|
||||
}
|
||||
else
|
||||
{
|
||||
printf(usageString);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else if (stricmp(argv[i], "-h") == 0)
|
||||
{
|
||||
// Perform http test option
|
||||
|
||||
Reference in New Issue
Block a user