diff --git a/server/tests/js_tests/libs/utils.js b/server/tests/js_tests/libs/utils.js index 2836324..14dce26 100644 --- a/server/tests/js_tests/libs/utils.js +++ b/server/tests/js_tests/libs/utils.js @@ -1,7 +1,7 @@ "use strict"; -var colors = require("colors/safe"); -var sprintf = require("sprintf-js").sprintf; +const colors = require("colors/safe"); +const sprintf = require("sprintf-js").sprintf; function getParam(key) { var value; diff --git a/server/tests/js_tests/package.json b/server/tests/js_tests/package.json index dcd1739..95070c5 100644 --- a/server/tests/js_tests/package.json +++ b/server/tests/js_tests/package.json @@ -15,6 +15,7 @@ "node-ssdp": "^3.2.0", "q": "~1.4.1", "request": "^2.78.0", - "sprintf-js": "~1.0.3" + "sprintf-js": "~1.0.3", + "yargs": "^6.3.0" } } diff --git a/server/tests/js_tests/tests/discoverServerUnderTest.js b/server/tests/js_tests/tests/discoverServerUnderTest.js index 64b8f27..63f9694 100644 --- a/server/tests/js_tests/tests/discoverServerUnderTest.js +++ b/server/tests/js_tests/tests/discoverServerUnderTest.js @@ -4,8 +4,23 @@ var dial = require("../libs/dialClient.js"), utils = require("../libs/utils.js"), Q = require("q"); +const argv = require("yargs") + .usage("\nUsage: node " + __filename.slice(__dirname.length + 1) + "[options]") + .option("host", { + describe: "IP address of host on which DIAL server under test is running", + type: "string", + demand: true + }) + .option("application", { + alias: "app", + describe: "Application to test", + type: "string", + demand: true + }) + .help("help").alias("help", "h").argv; + function test() { - var testServer = utils.getParam("host"); + var testServer = argv.host; return new Q() .then(function () { diff --git a/server/tests/js_tests/tests/hideApplicationInHiddenState.js b/server/tests/js_tests/tests/hideApplicationInHiddenState.js index 9129bd0..d87715a 100644 --- a/server/tests/js_tests/tests/hideApplicationInHiddenState.js +++ b/server/tests/js_tests/tests/hideApplicationInHiddenState.js @@ -4,10 +4,31 @@ var dial = require("../libs/dialClient.js"), utils = require("../libs/utils.js"), Q = require("q"); +const argv = require("yargs") + .usage("\nUsage: node " + __filename.slice(__dirname.length + 1) + "[options]") + .option("host", { + describe: "IP address of host on which DIAL server under test is running", + type: "string", + demand: true + }) + .option("application", { + alias: "app", + describe: "Application to test", + type: "string", + demand: true + }) + .option("timeToWaitForStateChange", { + alias: "ttw", + describe: "Time(ms) to wait between state changes before querying application status", + type: "string", + default: 5000 + }) + .help("help").alias("help", "h").argv; + function test() { - var host = utils.getParam("host"); - var app = utils.getParam("app"); - var timeToWaitForStateChange = utils.getParam("timeToWaitForStateChange") || 5000; + var host = argv.host; + var app = argv.application; + var timeToWaitForStateChange = argv.timeToWaitForStateChange || 5000; return new Q() .then(function () { diff --git a/server/tests/js_tests/tests/hideApplicationInRunningState.js b/server/tests/js_tests/tests/hideApplicationInRunningState.js index 906b641..4b01e58 100644 --- a/server/tests/js_tests/tests/hideApplicationInRunningState.js +++ b/server/tests/js_tests/tests/hideApplicationInRunningState.js @@ -4,10 +4,31 @@ var dial = require("../libs/dialClient.js"), utils = require("../libs/utils.js"), Q = require("q"); +const argv = require("yargs") + .usage("\nUsage: node " + __filename.slice(__dirname.length + 1) + "[options]") + .option("host", { + describe: "IP address of host on which DIAL server under test is running", + type: "string", + demand: true + }) + .option("application", { + alias: "app", + describe: "Application to test", + type: "string", + demand: true + }) + .option("timeToWaitForStateChange", { + alias: "ttw", + describe: "Time(ms) to wait between state changes before querying application status", + type: "string", + default: 5000 + }) + .help("help").alias("help", "h").argv; + function test() { - var host = utils.getParam("host"); - var app = utils.getParam("app"); - var timeToWaitForStateChange = utils.getParam("timeToWaitForStateChange") || 5000; + var host = argv.host; + var app = argv.application; + var timeToWaitForStateChange = argv.timeToWaitForStateChange || 5000; return new Q() .then(function () { diff --git a/server/tests/js_tests/tests/hideInvalidApplicationInstance.js b/server/tests/js_tests/tests/hideInvalidApplicationInstance.js index 852f90d..af3be99 100644 --- a/server/tests/js_tests/tests/hideInvalidApplicationInstance.js +++ b/server/tests/js_tests/tests/hideInvalidApplicationInstance.js @@ -4,10 +4,31 @@ var dial = require("../libs/dialClient.js"), utils = require("../libs/utils.js"), Q = require("q"); +const argv = require("yargs") + .usage("\nUsage: node " + __filename.slice(__dirname.length + 1) + "[options]") + .option("host", { + describe: "IP address of host on which DIAL server under test is running", + type: "string", + demand: true + }) + .option("application", { + alias: "app", + describe: "Application to test", + type: "string", + demand: true + }) + .option("timeToWaitForStateChange", { + alias: "ttw", + describe: "Time(ms) to wait between state changes before querying application status", + type: "string", + default: 5000 + }) + .help("help").alias("help", "h").argv; + function test() { - var host = utils.getParam("host"); - var app = utils.getParam("app"); - var timeToWaitForStateChange = utils.getParam("timeToWaitForStateChange") || 5000; + var host = argv.host; + var app = argv.application; + var timeToWaitForStateChange = argv.timeToWaitForStateChange || 5000; return new Q() .then(function () { diff --git a/server/tests/js_tests/tests/launchApplicationInHiddenStateWithNoPayload.js b/server/tests/js_tests/tests/launchApplicationInHiddenStateWithNoPayload.js index 0903e34..42bb2fc 100644 --- a/server/tests/js_tests/tests/launchApplicationInHiddenStateWithNoPayload.js +++ b/server/tests/js_tests/tests/launchApplicationInHiddenStateWithNoPayload.js @@ -4,10 +4,31 @@ var dial = require("../libs/dialClient.js"), utils = require("../libs/utils.js"), Q = require("q"); +const argv = require("yargs") + .usage("\nUsage: node " + __filename.slice(__dirname.length + 1) + "[options]") + .option("host", { + describe: "IP address of host on which DIAL server under test is running", + type: "string", + demand: true + }) + .option("application", { + alias: "app", + describe: "Application to test", + type: "string", + demand: true + }) + .option("timeToWaitForStateChange", { + alias: "ttw", + describe: "Time(ms) to wait between state changes before querying application status", + type: "string", + default: 5000 + }) + .help("help").alias("help", "h").argv; + function test() { - var host = utils.getParam("host"); - var app = utils.getParam("app"); - var timeToWaitForStateChange = utils.getParam("timeToWaitForStateChange") || 5000; + var host = argv.host; + var app = argv.application; + var timeToWaitForStateChange = argv.timeToWaitForStateChange || 5000; return new Q() .then(function () { diff --git a/server/tests/js_tests/tests/launchApplicationInHiddenStateWithPayload.js b/server/tests/js_tests/tests/launchApplicationInHiddenStateWithPayload.js index 3f18f89..6d05455 100644 --- a/server/tests/js_tests/tests/launchApplicationInHiddenStateWithPayload.js +++ b/server/tests/js_tests/tests/launchApplicationInHiddenStateWithPayload.js @@ -4,10 +4,31 @@ var dial = require("../libs/dialClient.js"), utils = require("../libs/utils.js"), Q = require("q"); +const argv = require("yargs") + .usage("\nUsage: node " + __filename.slice(__dirname.length + 1) + "[options]") + .option("host", { + describe: "IP address of host on which DIAL server under test is running", + type: "string", + demand: true + }) + .option("application", { + alias: "app", + describe: "Application to test", + type: "string", + demand: true + }) + .option("timeToWaitForStateChange", { + alias: "ttw", + describe: "Time(ms) to wait between state changes before querying application status", + type: "string", + default: 5000 + }) + .help("help").alias("help", "h").argv; + function test() { - var host = utils.getParam("host"); - var app = utils.getParam("app"); - var timeToWaitForStateChange = utils.getParam("timeToWaitForStateChange") || 5000; + var host = argv.host; + var app = argv.application; + var timeToWaitForStateChange = argv.timeToWaitForStateChange || 5000; return new Q() .then(function () { diff --git a/server/tests/js_tests/tests/launchApplicationInRunningStateWithNoPayload.js b/server/tests/js_tests/tests/launchApplicationInRunningStateWithNoPayload.js index a1eb81b..35ee524 100644 --- a/server/tests/js_tests/tests/launchApplicationInRunningStateWithNoPayload.js +++ b/server/tests/js_tests/tests/launchApplicationInRunningStateWithNoPayload.js @@ -4,10 +4,31 @@ var dial = require("../libs/dialClient.js"), utils = require("../libs/utils.js"), Q = require("q"); +const argv = require("yargs") + .usage("\nUsage: node " + __filename.slice(__dirname.length + 1) + "[options]") + .option("host", { + describe: "IP address of host on which DIAL server under test is running", + type: "string", + demand: true + }) + .option("application", { + alias: "app", + describe: "Application to test", + type: "string", + demand: true + }) + .option("timeToWaitForStateChange", { + alias: "ttw", + describe: "Time(ms) to wait between state changes before querying application status", + type: "string", + default: 5000 + }) + .help("help").alias("help", "h").argv; + function test() { - var host = utils.getParam("host"); - var app = utils.getParam("app"); - var timeToWaitForStateChange = utils.getParam("timeToWaitForStateChange") || 5000; + var host = argv.host; + var app = argv.application; + var timeToWaitForStateChange = argv.timeToWaitForStateChange || 5000; return new Q() .then(function () { diff --git a/server/tests/js_tests/tests/launchApplicationInRunningStateWithPayload.js b/server/tests/js_tests/tests/launchApplicationInRunningStateWithPayload.js index ca7799f..8c7f587 100644 --- a/server/tests/js_tests/tests/launchApplicationInRunningStateWithPayload.js +++ b/server/tests/js_tests/tests/launchApplicationInRunningStateWithPayload.js @@ -4,10 +4,31 @@ var dial = require("../libs/dialClient.js"), utils = require("../libs/utils.js"), Q = require("q"); +const argv = require("yargs") + .usage("\nUsage: node " + __filename.slice(__dirname.length + 1) + "[options]") + .option("host", { + describe: "IP address of host on which DIAL server under test is running", + type: "string", + demand: true + }) + .option("application", { + alias: "app", + describe: "Application to test", + type: "string", + demand: true + }) + .option("timeToWaitForStateChange", { + alias: "ttw", + describe: "Time(ms) to wait between state changes before querying application status", + type: "string", + default: 5000 + }) + .help("help").alias("help", "h").argv; + function test() { - var host = utils.getParam("host"); - var app = utils.getParam("app"); - var timeToWaitForStateChange = utils.getParam("timeToWaitForStateChange") || 5000; + var host = argv.host; + var app = argv.application; + var timeToWaitForStateChange = argv.timeToWaitForStateChange || 5000; return new Q() .then(function () { diff --git a/server/tests/js_tests/tests/launchApplicationInStoppedStateWithNoPayload.js b/server/tests/js_tests/tests/launchApplicationInStoppedStateWithNoPayload.js index 1988d2a..def0569 100644 --- a/server/tests/js_tests/tests/launchApplicationInStoppedStateWithNoPayload.js +++ b/server/tests/js_tests/tests/launchApplicationInStoppedStateWithNoPayload.js @@ -4,10 +4,31 @@ var dial = require("../libs/dialClient.js"), utils = require("../libs/utils.js"), Q = require("q"); +const argv = require("yargs") + .usage("\nUsage: node " + __filename.slice(__dirname.length + 1) + "[options]") + .option("host", { + describe: "IP address of host on which DIAL server under test is running", + type: "string", + demand: true + }) + .option("application", { + alias: "app", + describe: "Application to test", + type: "string", + demand: true + }) + .option("timeToWaitForStateChange", { + alias: "ttw", + describe: "Time(ms) to wait between state changes before querying application status", + type: "string", + default: 5000 + }) + .help("help").alias("help", "h").argv; + function test() { - var host = utils.getParam("host"); - var app = utils.getParam("app"); - var timeToWaitForStateChange = utils.getParam("timeToWaitForStateChange") || 5000; + var host = argv.host; + var app = argv.application; + var timeToWaitForStateChange = argv.timeToWaitForStateChange || 5000; return new Q() .then(function () { diff --git a/server/tests/js_tests/tests/launchApplicationInStoppedStateWithPayload.js b/server/tests/js_tests/tests/launchApplicationInStoppedStateWithPayload.js index 32fc2b7..343c54c 100644 --- a/server/tests/js_tests/tests/launchApplicationInStoppedStateWithPayload.js +++ b/server/tests/js_tests/tests/launchApplicationInStoppedStateWithPayload.js @@ -4,10 +4,31 @@ var dial = require("../libs/dialClient.js"), utils = require("../libs/utils.js"), Q = require("q"); +const argv = require("yargs") + .usage("\nUsage: node " + __filename.slice(__dirname.length + 1) + "[options]") + .option("host", { + describe: "IP address of host on which DIAL server under test is running", + type: "string", + demand: true + }) + .option("application", { + alias: "app", + describe: "Application to test", + type: "string", + demand: true + }) + .option("timeToWaitForStateChange", { + alias: "ttw", + describe: "Time(ms) to wait between state changes before querying application status", + type: "string", + default: 5000 + }) + .help("help").alias("help", "h").argv; + function test() { - var host = utils.getParam("host"); - var app = utils.getParam("app"); - var timeToWaitForStateChange = utils.getParam("timeToWaitForStateChange") || 5000; + var host = argv.host; + var app = argv.application; + var timeToWaitForStateChange = argv.timeToWaitForStateChange || 5000; return new Q() .then(function () { diff --git a/server/tests/js_tests/tests/launchApplicationNotRecognized.js b/server/tests/js_tests/tests/launchApplicationNotRecognized.js index 43194ff..82fb0e5 100644 --- a/server/tests/js_tests/tests/launchApplicationNotRecognized.js +++ b/server/tests/js_tests/tests/launchApplicationNotRecognized.js @@ -4,9 +4,30 @@ var dial = require("../libs/dialClient.js"), utils = require("../libs/utils.js"), Q = require("q"); +const argv = require("yargs") + .usage("\nUsage: node " + __filename.slice(__dirname.length + 1) + "[options]") + .option("host", { + describe: "IP address of host on which DIAL server under test is running", + type: "string", + demand: true + }) + .option("application", { + alias: "app", + describe: "Application to test", + type: "string", + demand: true + }) + .option("timeToWaitForStateChange", { + alias: "ttw", + describe: "Time(ms) to wait between state changes before querying application status", + type: "string", + default: 5000 + }) + .help("help").alias("help", "h").argv; + function test() { - var host = utils.getParam("host"); - var timeToWaitForStateChange = utils.getParam("timeToWaitForStateChange") || 5000; + var host = argv.host; + var timeToWaitForStateChange = argv.timeToWaitForStateChange || 5000; return new Q() .then(function () { diff --git a/server/tests/js_tests/tests/launchApplicationWithExcessPayload.js b/server/tests/js_tests/tests/launchApplicationWithExcessPayload.js index 7be21f9..ee7f90e 100644 --- a/server/tests/js_tests/tests/launchApplicationWithExcessPayload.js +++ b/server/tests/js_tests/tests/launchApplicationWithExcessPayload.js @@ -4,9 +4,24 @@ var dial = require("../libs/dialClient.js"), utils = require("../libs/utils.js"), Q = require("q"); +const argv = require("yargs") + .usage("\nUsage: node " + __filename.slice(__dirname.length + 1) + "[options]") + .option("host", { + describe: "IP address of host on which DIAL server under test is running", + type: "string", + demand: true + }) + .option("application", { + alias: "app", + describe: "Application to test", + type: "string", + demand: true + }) + .help("help").alias("help", "h").argv; + function test() { - var host = utils.getParam("host"); - var app = utils.getParam("app"); + var host = argv.host; + var app = argv.application; var payload = "key=value&key=value&key=value&key=value&key=value&key=value&key=value&key=value&key=value&key=value&key=value&key=value&key=value&key=value&key=value&" + "key=value&key=value&key=value&key=value&key=value&key=value&key=value&key=value&key=value&key=value&key=value&key=value&key=value&key=value&key=value&key=value&" diff --git a/server/tests/js_tests/tests/stopApplicationInHiddenState.js b/server/tests/js_tests/tests/stopApplicationInHiddenState.js index a09f17e..7500cc3 100644 --- a/server/tests/js_tests/tests/stopApplicationInHiddenState.js +++ b/server/tests/js_tests/tests/stopApplicationInHiddenState.js @@ -4,10 +4,31 @@ var dial = require("../libs/dialClient.js"), utils = require("../libs/utils.js"), Q = require("q"); +const argv = require("yargs") + .usage("\nUsage: node " + __filename.slice(__dirname.length + 1) + "[options]") + .option("host", { + describe: "IP address of host on which DIAL server under test is running", + type: "string", + demand: true + }) + .option("application", { + alias: "app", + describe: "Application to test", + type: "string", + demand: true + }) + .option("timeToWaitForStateChange", { + alias: "ttw", + describe: "Time(ms) to wait between state changes before querying application status", + type: "string", + default: 5000 + }) + .help("help").alias("help", "h").argv; + function test() { - var host = utils.getParam("host"); - var app = utils.getParam("app"); - var timeToWaitForStateChange = utils.getParam("timeToWaitForStateChange") || 5000; + var host = argv.host; + var app = argv.application; + var timeToWaitForStateChange = argv.timeToWaitForStateChange || 5000; return new Q() .then(function () { diff --git a/server/tests/js_tests/tests/stopApplicationInRunningState.js b/server/tests/js_tests/tests/stopApplicationInRunningState.js index 099707c..f93dd52 100644 --- a/server/tests/js_tests/tests/stopApplicationInRunningState.js +++ b/server/tests/js_tests/tests/stopApplicationInRunningState.js @@ -4,10 +4,31 @@ var dial = require("../libs/dialClient.js"), utils = require("../libs/utils.js"), Q = require("q"); +const argv = require("yargs") + .usage("\nUsage: node " + __filename.slice(__dirname.length + 1) + "[options]") + .option("host", { + describe: "IP address of host on which DIAL server under test is running", + type: "string", + demand: true + }) + .option("application", { + alias: "app", + describe: "Application to test", + type: "string", + demand: true + }) + .option("timeToWaitForStateChange", { + alias: "ttw", + describe: "Time(ms) to wait between state changes before querying application status", + type: "string", + default: 5000 + }) + .help("help").alias("help", "h").argv; + function test() { - var host = utils.getParam("host"); - var app = utils.getParam("app"); - var timeToWaitForStateChange = utils.getParam("timeToWaitForStateChange") || 5000; + var host = argv.host; + var app = argv.application; + var timeToWaitForStateChange = argv.timeToWaitForStateChange || 5000; return new Q() .then(function () { diff --git a/server/tests/js_tests/tests/stopApplicationInStoppedState.js b/server/tests/js_tests/tests/stopApplicationInStoppedState.js index 3d7ca1d..d40ebbb 100644 --- a/server/tests/js_tests/tests/stopApplicationInStoppedState.js +++ b/server/tests/js_tests/tests/stopApplicationInStoppedState.js @@ -4,10 +4,31 @@ var dial = require("../libs/dialClient.js"), utils = require("../libs/utils.js"), Q = require("q"); +const argv = require("yargs") + .usage("\nUsage: node " + __filename.slice(__dirname.length + 1) + "[options]") + .option("host", { + describe: "IP address of host on which DIAL server under test is running", + type: "string", + demand: true + }) + .option("application", { + alias: "app", + describe: "Application to test", + type: "string", + demand: true + }) + .option("timeToWaitForStateChange", { + alias: "ttw", + describe: "Time(ms) to wait between state changes before querying application status", + type: "string", + default: 5000 + }) + .help("help").alias("help", "h").argv; + function test() { - var host = utils.getParam("host"); - var app = utils.getParam("app"); - var timeToWaitForStateChange = utils.getParam("timeToWaitForStateChange") || 5000; + var host = argv.host; + var app = argv.application; + var timeToWaitForStateChange = argv.timeToWaitForStateChange || 5000; var instanceUrl; return new Q() diff --git a/server/tests/js_tests/tests/stopInvalidApplicationInstance.js b/server/tests/js_tests/tests/stopInvalidApplicationInstance.js index 5437267..12d1101 100644 --- a/server/tests/js_tests/tests/stopInvalidApplicationInstance.js +++ b/server/tests/js_tests/tests/stopInvalidApplicationInstance.js @@ -4,10 +4,31 @@ var dial = require("../libs/dialClient.js"), utils = require("../libs/utils.js"), Q = require("q"); +const argv = require("yargs") + .usage("\nUsage: node " + __filename.slice(__dirname.length + 1) + "[options]") + .option("host", { + describe: "IP address of host on which DIAL server under test is running", + type: "string", + demand: true + }) + .option("application", { + alias: "app", + describe: "Application to test", + type: "string", + demand: true + }) + .option("timeToWaitForStateChange", { + alias: "ttw", + describe: "Time(ms) to wait between state changes before querying application status", + type: "string", + default: 5000 + }) + .help("help").alias("help", "h").argv; + function test() { - var host = utils.getParam("host"); - var app = utils.getParam("app"); - var timeToWaitForStateChange = utils.getParam("timeToWaitForStateChange") || 5000; + var host = argv.host; + var app = argv.application; + var timeToWaitForStateChange = argv.timeToWaitForStateChange || 5000; return new Q() .then(function () { diff --git a/server/tests/js_tests/tests/tests.js b/server/tests/js_tests/tests/tests.js index 5c21cad..0557226 100644 --- a/server/tests/js_tests/tests/tests.js +++ b/server/tests/js_tests/tests/tests.js @@ -2,6 +2,27 @@ var Q = require("q"); +const argv = require("yargs") + .usage("\nUsage: node " + __filename.slice(__dirname.length + 1) + "[options]") + .option("host", { + describe: "IP address of host on which DIAL server under test is running", + type: "string", + demand: true + }) + .option("application", { + alias: "app", + describe: "Application to test", + type: "string", + demand: true + }) + .option("timeToWaitForStateChange", { + alias: "ttw", + describe: "Time(ms) to wait between state changes before querying application status", + type: "string", + default: 5000 + }) + .help("help").alias("help", "h").argv; + var discoverServerUnderTest = require("../tests/discoverServerUnderTest.js"), launchApplicationNotRecognized = require("../tests/launchApplicationNotRecognized.js"), launchApplicationInRunningStateWithNoPayload = require("../tests/launchApplicationInRunningStateWithNoPayload.js"),