Skip to content

Commit

Permalink
Fixed a bug in ftClient about cli params
Browse files Browse the repository at this point in the history
  • Loading branch information
kzangeli committed Oct 14, 2024
1 parent e9c0398 commit 16902e8
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -114,13 +114,12 @@ Usage: orionld [option '-U' (extended usage)]
[option '-cSubCounters' <number of subscription counter updates before flush from sub-cache to DB (0: never, 1: always)>]
[option '-distributed' (turn on distributed operation)]
[option '-brokerId' <identity of this broker instance for registrations - for the Via header>]
[option '-subordinateEndpoint' <endpoint URL for reception of notificatiopns from subordinate subscriptions (distributed subscriptions)>]
[option '-pageSize' <default page size (no of entities, subscriptions, registrations)>]
[option '-dds' (turn on DDS support)]
[option '-ddsSubsTopics' <topics to subscribe to on DDS>]
[option '-ddsTopicType' <DDS topic type>]
[option '-configFile' <DDS configuration file>]
[option '-ddsEnablerConfigFile' <DDS Enabler configuration file>]
[option '-subordinateEndpoint' <endpoint URL for reception of notificatiopns from subordinate subscriptions (distributed subscriptions)>]
[option '-pageSize' <default page size (no of entities, subscriptions, registrations)>]
[option '-configFile' <Path to configuration file>]
[option '-duc' <URL to default user context>]

--TEARDOWN--
7 changes: 3 additions & 4 deletions test/functionalTest/cases/0000_cli/command_line_options.test
Original file line number Diff line number Diff line change
Expand Up @@ -103,13 +103,12 @@ Usage: orionld [option '-U' (extended usage)]
[option '-cSubCounters' <number of subscription counter updates before flush from sub-cache to DB (0: never, 1: always)>]
[option '-distributed' (turn on distributed operation)]
[option '-brokerId' <identity of this broker instance for registrations - for the Via header>]
[option '-subordinateEndpoint' <endpoint URL for reception of notificatiopns from subordinate subscriptions (distributed subscriptions)>]
[option '-pageSize' <default page size (no of entities, subscriptions, registrations)>]
[option '-dds' (turn on DDS support)]
[option '-ddsSubsTopics' <topics to subscribe to on DDS>]
[option '-ddsTopicType' <DDS topic type>]
[option '-configFile' <DDS configuration file>]
[option '-ddsEnablerConfigFile' <DDS Enabler configuration file>]
[option '-subordinateEndpoint' <endpoint URL for reception of notificatiopns from subordinate subscriptions (distributed subscriptions)>]
[option '-pageSize' <default page size (no of entities, subscriptions, registrations)>]
[option '-configFile' <Path to configuration file>]
[option '-duc' <URL to default user context>]

--TEARDOWN--
4 changes: 2 additions & 2 deletions test/functionalTest/cases/0000_dds/dds_notifications.test
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
the test client publishes on DDS, the broker receives DDS notifications and creates/updates the corresponding NGSI-LD entities

--SHELL-INIT--
$REPO_HOME/scripts/configFile.sh "P1,Camera,urn:ngsi-ld:camera:cam1,shutterSpeed" "P2,Arm,urn:ngsi-ld:arm:arm1,armReach" > /tmp/ddsConfig
$REPO_HOME/scripts/configFile.sh "P1,Camera,urn:ngsi-ld:camera:cam1,shutterSpeed" "P2,Arm,urn:ngsi-ld:arm:arm1,armReach" > $HOME/.orionld
dbInit CB
orionldStart CB -mongocOnly -dds -configFile /tmp/ddsConfig
orionldStart CB -mongocOnly -dds
ftClientStart -t 0-5000

--SHELL--
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ Test of orionld version service, with branch name
--SHELL-INIT--
dbInit CB
orionldStart CB -mongocOnly
$REPO_HOME/scripts/configFile.sh > ~/.ftClient
chmod 777 ~/.ftClient

ftClientStart -v -t 200
mkdir -p /tmp/orion/logs/ftClient2
ftClientStart -v -t 200 --port $FT2_PORT --logDir $FT2_LOG_DIR
Expand Down
25 changes: 14 additions & 11 deletions test/functionalTest/ftClient/ftClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -252,17 +252,6 @@ int main(int argC, char* argV[])
const char* progName = "ftClient";
char configFilePath[256];

// Config file
if (configFile == NULL)
{
char* home = getenv("HOME");
if (home != NULL)
{
snprintf(configFilePath, sizeof(configFilePath) - 1, "%s/.ftClient", home);
configFile = configFilePath;
}
}

ks = kargsInit(progName, kargs, "FTCLIENT");
if (ks != KargsOk)
{
Expand All @@ -277,6 +266,20 @@ int main(int argC, char* argV[])
exit(1);
}

// Config file
if (configFile == NULL)
{
char* home = getenv("HOME");
if (home != NULL)
{
snprintf(configFilePath, sizeof(configFilePath) - 1, "%s/.ftClient", home);
configFile = configFilePath;
}
}

if (configFile != NULL)
configFile = strdup(configFile);

int kt = ktInit(progName, logDir, logToScreen, logLevel, traceLevels, kaBuiltinVerbose, kaBuiltinDebug, fixme);

if (kt != 0)
Expand Down

0 comments on commit 16902e8

Please sign in to comment.