-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial scripts for GPS Shift feature
- Loading branch information
1 parent
c3bb85f
commit bbf6788
Showing
10 changed files
with
396 additions
and
0 deletions.
There are no files selected for viewing
33 changes: 33 additions & 0 deletions
33
test_scripts/API/VehicleData/GpsShiftSupport/001_GetVehicleData_gps_shift.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
--------------------------------------------------------------------------------------------------- | ||
-- Proposal: | ||
-- https://github.com/smartdevicelink/sdl_evolution/blob/master/proposals/0199-Adding-GPS-Shift-support.md | ||
-- Description: | ||
-- In case: | ||
-- 1) Mobile sends GetVehicleData (gps) request | ||
-- 2) SDL transfers this request to HMI | ||
-- 3) HMI sends VehicleData response with "shifted" item | ||
-- SDL does: | ||
-- 1) Send GetVehicleData response to mobile with "shifted" item in "gps" parameter | ||
--------------------------------------------------------------------------------------------------- | ||
--[[ Required Shared libraries ]] | ||
local runner = require('user_modules/script_runner') | ||
local common = require('test_scripts/API/VehicleData/GpsShiftSupport/commonGpsShift') | ||
|
||
-- [[ Test Configuration ]] | ||
runner.testSettings.isSelfIncluded = false | ||
|
||
--[[ Scenario ]] | ||
runner.Title("Preconditions") | ||
runner.Step("Clean environment", common.preconditions) | ||
runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) | ||
runner.Step("Register App", common.registerApp) | ||
runner.Step("PTU", common.policyTableUpdate, { common.pTUpdateFunc }) | ||
runner.Step("Activate App", common.activateApp) | ||
|
||
runner.Title("Test") | ||
for _, v in pairs(common.shiftValue) do | ||
runner.Step("Get GPS VehicleData, gps-shifted " .. tostring(v), common.getVehicleData, { v }) | ||
end | ||
|
||
runner.Title("Postconditions") | ||
runner.Step("Stop SDL", common.postconditions) |
31 changes: 31 additions & 0 deletions
31
test_scripts/API/VehicleData/GpsShiftSupport/002_GetVehicleData_gps_without_shift.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
--------------------------------------------------------------------------------------------------- | ||
-- Proposal: | ||
-- https://github.com/smartdevicelink/sdl_evolution/blob/master/proposals/0199-Adding-GPS-Shift-support.md | ||
-- Description: | ||
-- In case: | ||
-- 1) Mobile sends GetVehicleData (gps) request without shifted item | ||
-- 2) SDL transfers this request to HMI | ||
-- 3) HMI not sends "shifted" item in "gps" parameter of GetVehicleData response | ||
-- SDL does: | ||
-- 1) Send GetVehicleData response to mobile without "shifted" item in "gps" parameter | ||
---------------------------------------------------------------------------------------------------- | ||
--[[ Required Shared libraries ]] | ||
local runner = require('user_modules/script_runner') | ||
local common = require('test_scripts/API/VehicleData/GpsShiftSupport/commonGpsShift') | ||
|
||
-- [[ Test Configuration ]] | ||
runner.testSettings.isSelfIncluded = false | ||
|
||
--[[ Scenario ]] | ||
runner.Title("Preconditions") | ||
runner.Step("Clean environment", common.preconditions) | ||
runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) | ||
runner.Step("Register App", common.registerApp) | ||
runner.Step("PTU", common.policyTableUpdate, { common.pTUpdateFunc }) | ||
runner.Step("Activate App", common.activateApp) | ||
|
||
runner.Title("Test") | ||
runner.Step("Get GPS VehicleData, without shift", common.getVehicleData, { nil }) | ||
|
||
runner.Title("Postconditions") | ||
runner.Step("Stop SDL", common.postconditions) |
33 changes: 33 additions & 0 deletions
33
test_scripts/API/VehicleData/GpsShiftSupport/003_OnVehicleData_gps_shift.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
--------------------------------------------------------------------------------------------------- | ||
-- Proposal: | ||
-- https://github.com/smartdevicelink/sdl_evolution/blob/master/proposals/0199-Adding-GPS-Shift-support.md | ||
-- Description: | ||
-- In case: | ||
-- 1) App registered and subscribed on vehicle data (gps) | ||
-- 2) HMI sends "shifted" item in "gps" parameter of OnVehicleData notification | ||
-- SDL does: | ||
-- 1) Send OnVehicleData notification to mobile with "shifted" item in "gps" parameter | ||
--------------------------------------------------------------------------------------------------- | ||
--[[ Required Shared libraries ]] | ||
local runner = require('user_modules/script_runner') | ||
local common = require('test_scripts/API/VehicleData/GpsShiftSupport/commonGpsShift') | ||
|
||
-- [[ Test Configuration ]] | ||
runner.testSettings.isSelfIncluded = false | ||
|
||
--[[ Scenario ]] | ||
runner.Title("Preconditions") | ||
runner.Step("Clean environment", common.preconditions) | ||
runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) | ||
runner.Step("Register App", common.registerApp) | ||
runner.Step("PTU", common.policyTableUpdate, { common.pTUpdateFunc }) | ||
runner.Step("Activate App", common.activateApp) | ||
runner.Step("Subscribe on GPS VehicleData", common.subscribeVehicleData) | ||
|
||
runner.Title("Test") | ||
for _, v in pairs(common.shiftValue) do | ||
runner.Step("Send On VehicleData with GpsShift " .. tostring(v), common.sendOnVehicleData, { v }) | ||
end | ||
|
||
runner.Title("Postconditions") | ||
runner.Step("Stop SDL", common.postconditions) |
31 changes: 31 additions & 0 deletions
31
test_scripts/API/VehicleData/GpsShiftSupport/004_OnVehicleData_gps_without_shift.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
--------------------------------------------------------------------------------------------------- | ||
-- Proposal: | ||
-- https://github.com/smartdevicelink/sdl_evolution/blob/master/proposals/0199-Adding-GPS-Shift-support.md | ||
-- Description: | ||
-- In case: | ||
-- 1) App registered and subscribed on vehicle data (gps) | ||
-- 2) HMI not sends "shifted" item in "gps" parameter of OnVehicleData notification | ||
-- SDL does: | ||
-- 1) Send OnVehicleData notification to mobile without "shifted" item in "gps" parameter | ||
--------------------------------------------------------------------------------------------------- | ||
--[[ Required Shared libraries ]] | ||
local runner = require('user_modules/script_runner') | ||
local common = require('test_scripts/API/VehicleData/GpsShiftSupport/commonGpsShift') | ||
|
||
-- [[ Test Configuration ]] | ||
runner.testSettings.isSelfIncluded = false | ||
|
||
--[[ Scenario ]] | ||
runner.Title("Preconditions") | ||
runner.Step("Clean environment", common.preconditions) | ||
runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) | ||
runner.Step("Register App", common.registerApp) | ||
runner.Step("PTU", common.policyTableUpdate, { common.pTUpdateFunc }) | ||
runner.Step("Activate App", common.activateApp) | ||
runner.Step("Subscribe on GPS VehicleData", common.subscribeVehicleData) | ||
|
||
runner.Title("Test") | ||
runner.Step("Send On VehicleData without shift", common.sendOnVehicleData, { nil }) | ||
|
||
runner.Title("Postconditions") | ||
runner.Step("Stop SDL", common.postconditions) |
35 changes: 35 additions & 0 deletions
35
...ipts/API/VehicleData/GpsShiftSupport/005_GetInteriorVehicleData_stationLocation_shift.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
--------------------------------------------------------------------------------------------------- | ||
-- Proposal: | ||
-- https://github.com/smartdevicelink/sdl_evolution/blob/master/proposals/0199-Adding-GPS-Shift-support.md | ||
-- Description: | ||
-- In case: | ||
-- 1) Mobile sends GetInteriorVehicleData request | ||
-- 2) SDL transfers this request to HMI | ||
-- 3) HMI sends "shifted" item in "stationLocation" parameter of "moduleData" parameter of GetInteriorVehicleData | ||
-- response | ||
-- SDL does: | ||
-- 1) Send GetInteriorVehicleData response to mobile with "shifted" item in "stationLocation" parameter of | ||
-- "moduleData" parameter | ||
--------------------------------------------------------------------------------------------------- | ||
--[[ Required Shared libraries ]] | ||
local runner = require('user_modules/script_runner') | ||
local common = require('test_scripts/API/VehicleData/GpsShiftSupport/commonGpsShift') | ||
local commonRC = require("test_scripts/RC/commonRC") | ||
|
||
-- [[ Test Configuration ]] | ||
runner.testSettings.isSelfIncluded = false | ||
|
||
--[[ Scenario ]] | ||
runner.Title("Preconditions") | ||
runner.Step("Clean environment", commonRC.preconditions) | ||
runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) | ||
runner.Step("Register App", common.registerAppWOPTU) | ||
runner.Step("Activate App", common.activateApp) | ||
|
||
runner.Title("Test") | ||
for _, v in pairs(common.shiftValue) do | ||
runner.Step("GetInteriorVehicleData RADIO module, shifted " .. tostring(v), common.getInteriorVehicleData, { v }) | ||
end | ||
|
||
runner.Title("Postconditions") | ||
runner.Step("Stop SDL", common.postconditions) |
33 changes: 33 additions & 0 deletions
33
.../VehicleData/GpsShiftSupport/006_GetInteriorVehicleData_stationLocation_without_shift.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
--------------------------------------------------------------------------------------------------- | ||
-- Proposal: | ||
-- https://github.com/smartdevicelink/sdl_evolution/blob/master/proposals/0199-Adding-GPS-Shift-support.md | ||
-- Description: | ||
-- In case: | ||
-- 1) Mobile sends GetInteriorVehicleData request | ||
-- 2) SDL transfers this request to HMI | ||
-- 3) HMI not sends "shifted" item in "stationLocation" parameter of "moduleData" parameter of GetInteriorVehicleData | ||
-- response | ||
-- SDL does: | ||
-- 1) Send GetInteriorVehicleData response to mobile without "shifted" item in "stationLocation" parameter of | ||
-- "moduleData" parameter | ||
--------------------------------------------------------------------------------------------------- | ||
--[[ Required Shared libraries ]] | ||
local runner = require('user_modules/script_runner') | ||
local common = require('test_scripts/API/VehicleData/GpsShiftSupport/commonGpsShift') | ||
local commonRC = require("test_scripts/RC/commonRC") | ||
|
||
-- [[ Test Configuration ]] | ||
runner.testSettings.isSelfIncluded = false | ||
|
||
--[[ Scenario ]] | ||
runner.Title("Preconditions") | ||
runner.Step("Clean environment", commonRC.preconditions) | ||
runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) | ||
runner.Step("Register App", common.registerAppWOPTU) | ||
runner.Step("Activate App", common.activateApp) | ||
|
||
runner.Title("Test") | ||
runner.Step("GetInteriorVehicleData RADIO module, without shifted", common.getInteriorVehicleData, { nil }) | ||
|
||
runner.Title("Postconditions") | ||
runner.Step("Stop SDL", common.postconditions) |
35 changes: 35 additions & 0 deletions
35
...ripts/API/VehicleData/GpsShiftSupport/007_OnInteriorVehicleData_stationLocation_shift.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
--------------------------------------------------------------------------------------------------- | ||
-- Proposal: | ||
-- https://github.com/smartdevicelink/sdl_evolution/blob/master/proposals/0199-Adding-GPS-Shift-support.md | ||
-- Description: | ||
-- In case: | ||
-- 1) App registered and subscribed on RADIO | ||
-- 2) HMI sends "shifted" item in "stationLocation" parameter of "moduleData" parameter of OnInteriorVehicleData | ||
-- notification | ||
-- SDL does: | ||
-- 1) Send OnInteriorVehicleData notification to mobile with "shifted" item in "stationLocation" parameter of | ||
-- "moduleData" parameter | ||
--------------------------------------------------------------------------------------------------- | ||
--[[ Required Shared libraries ]] | ||
local runner = require('user_modules/script_runner') | ||
local common = require('test_scripts/API/VehicleData/GpsShiftSupport/commonGpsShift') | ||
local commonRC = require("test_scripts/RC/commonRC") | ||
|
||
-- [[ Test Configuration ]] | ||
runner.testSettings.isSelfIncluded = false | ||
|
||
--[[ Scenario ]] | ||
runner.Title("Preconditions") | ||
runner.Step("Clean environment", commonRC.preconditions) | ||
runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) | ||
runner.Step("Register App", common.registerAppWOPTU) | ||
runner.Step("Activate App", common.activateApp) | ||
runner.Step("Subscribe on InteriorVehicleData, RADIO module", common.getInteriorVehicleData, { nil, true }) | ||
|
||
runner.Title("Test") | ||
for _, v in pairs(common.shiftValue) do | ||
runner.Step("OnInteriorVehicleData, RADIO module, shifted " .. tostring(v), common.onInteriorVehicleData, { v }) | ||
end | ||
|
||
runner.Title("Postconditions") | ||
runner.Step("Stop SDL", common.postconditions) |
33 changes: 33 additions & 0 deletions
33
...I/VehicleData/GpsShiftSupport/008_OnInteriorVehicleData_stationLocation_without_shift.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
--------------------------------------------------------------------------------------------------- | ||
-- Proposal: | ||
-- https://github.com/smartdevicelink/sdl_evolution/blob/master/proposals/0199-Adding-GPS-Shift-support.md | ||
-- Description: | ||
-- In case: | ||
-- 1) App registered and subscribed on RADIO | ||
-- 2) HMI not sends "shifted" item in "stationLocation" parameter of "moduleData" parameter of OnInteriorVehicleData | ||
-- notification | ||
-- SDL does: | ||
-- 1) Send OnInteriorVehicleData notification to mobile without "shifted" item in "stationLocation" parameter | ||
-- of "moduleData" parameter | ||
--------------------------------------------------------------------------------------------------- | ||
--[[ Required Shared libraries ]] | ||
local runner = require('user_modules/script_runner') | ||
local common = require('test_scripts/API/VehicleData/GpsShiftSupport/commonGpsShift') | ||
local commonRC = require("test_scripts/RC/commonRC") | ||
|
||
-- [[ Test Configuration ]] | ||
runner.testSettings.isSelfIncluded = false | ||
|
||
--[[ Scenario ]] | ||
runner.Title("Preconditions") | ||
runner.Step("Clean environment", commonRC.preconditions) | ||
runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) | ||
runner.Step("Register App", common.registerAppWOPTU) | ||
runner.Step("Activate App", common.activateApp) | ||
runner.Step("Subscribe on InteriorVehicleData, RADIO module", common.getInteriorVehicleData, { nil, true }) | ||
|
||
runner.Title("Test") | ||
runner.Step("OnInteriorVehicleData, RADIO module, without shifted ", common.onInteriorVehicleData, { nil }) | ||
|
||
runner.Title("Postconditions") | ||
runner.Step("Stop SDL", common.postconditions) |
124 changes: 124 additions & 0 deletions
124
test_scripts/API/VehicleData/GpsShiftSupport/commonGpsShift.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,124 @@ | ||
--------------------------------------------------------------------------------------------------- | ||
-- Common module | ||
--------------------------------------------------------------------------------------------------- | ||
--------------------------------------------------------------------------------------------------- | ||
--[[ General configuration parameters ]] | ||
config.defaultProtocolVersion = 2 | ||
--[[ Required Shared libraries ]] | ||
local actions = require("user_modules/sequences/actions") | ||
local utils = require('user_modules/utils') | ||
local commonRC = require("test_scripts/RC/commonRC") | ||
|
||
--[[ Variables ]] | ||
local m = actions | ||
m.cloneTable = utils.cloneTable | ||
m.radioData = commonRC.getModuleControlData("RADIO") | ||
m.shiftValue = { | ||
true, | ||
false | ||
} | ||
|
||
m.gpsParams = { | ||
longitudeDegrees = 42.5, | ||
latitudeDegrees = -83.3, | ||
utcYear = 2013, | ||
utcMonth = 2, | ||
utcDay = 14, | ||
utcHours = 13, | ||
utcMinutes = 16, | ||
utcSeconds = 54, | ||
compassDirection = "SOUTHWEST", | ||
pdop = 8.4, | ||
hdop = 5.9, | ||
vdop = 3.2, | ||
actual = false, | ||
satellites = 8, | ||
dimension = "2D", | ||
altitude = 7.7, | ||
heading = 173.99, | ||
speed = 2.78 | ||
} | ||
|
||
--[[ Functions ]] | ||
function m.pTUpdateFunc(tbl) | ||
tbl.policy_table.app_policies[config.application1.registerAppInterfaceParams.fullAppID].groups = {"Base-4", "Location-1"} | ||
end | ||
|
||
function m.checkShifted(data, pShiftValue) | ||
if pShiftValue == nil and data ~= nil then | ||
return false, "Vehicle data contains unexpected shifted parameter" | ||
end | ||
return true | ||
end | ||
|
||
function m.getVehicleData(pShiftValue) | ||
m.gpsParams.shifted = pShiftValue | ||
local cid = m.getMobileSession():SendRPC("GetVehicleData", { gps = true }) | ||
EXPECT_HMICALL("VehicleInfo.GetVehicleData", { gps = true }) | ||
:Do(function(_, data) | ||
m.getHMIConnection():SendResponse(data.id, data.method, "SUCCESS", { gps = m.gpsParams }) | ||
end) | ||
m.getMobileSession():ExpectResponse(cid, { success = true, resultCode = "SUCCESS", gps = m.gpsParams }) | ||
:ValidIf(function(_, data) | ||
return m.checkShifted(data.payload.gps.shifted, pShiftValue) | ||
end) | ||
end | ||
|
||
function m.subscribeVehicleData() | ||
local gpsResponseData = { | ||
dataType = "VEHICLEDATA_GPS", | ||
resultCode = "SUCCESS" | ||
} | ||
local cid = m.getMobileSession():SendRPC("SubscribeVehicleData", { gps = true }) | ||
EXPECT_HMICALL("VehicleInfo.SubscribeVehicleData", { gps = true }) | ||
:Do(function(_, data) | ||
m.getHMIConnection():SendResponse(data.id, data.method, "SUCCESS", { gps = gpsResponseData }) | ||
end) | ||
m.getMobileSession():ExpectResponse(cid, { success = true, resultCode = "SUCCESS", gps = gpsResponseData }) | ||
end | ||
|
||
function m.sendOnVehicleData(pShiftValue) | ||
m.gpsParams.shifted = pShiftValue | ||
m.getHMIConnection():SendNotification("VehicleInfo.OnVehicleData", { gps = m.gpsParams }) | ||
m.getMobileSession():ExpectNotification("OnVehicleData", { gps = m.gpsParams }) | ||
:ValidIf(function(_, data) | ||
return m.checkShifted(data.payload.gps.shifted, pShiftValue) | ||
end) | ||
end | ||
|
||
function m.getInteriorVehicleData(pShiftValue, pIsSubscribed) | ||
if not pIsSubscribed then pIsSubscribed = false end | ||
m.radioData.radioControlData.sisData.stationLocation.shifted = pShiftValue | ||
local cid = m.getMobileSession():SendRPC("GetInteriorVehicleData", { | ||
moduleType = "RADIO", | ||
subscribe = true | ||
}) | ||
EXPECT_HMICALL("RC.GetInteriorVehicleData", { | ||
moduleType = "RADIO", | ||
subscribe = true | ||
}) | ||
:Do(function(_, data) | ||
m.getHMIConnection():SendResponse(data.id, data.method, "SUCCESS", { | ||
moduleData = m.radioData, | ||
isSubscribed = pIsSubscribed | ||
}) | ||
end) | ||
m.getMobileSession():ExpectResponse(cid, { success = true, resultCode = "SUCCESS", | ||
isSubscribed = pIsSubscribed, | ||
moduleData = m.radioData | ||
}) | ||
:ValidIf(function(_, data) | ||
return m.checkShifted(data.payload.moduleData.radioControlData.sisData.stationLocation.shifted, pShiftValue) | ||
end) | ||
end | ||
|
||
function m.onInteriorVehicleData(pShiftValue) | ||
m.radioData.radioControlData.sisData.stationLocation.shifted = pShiftValue | ||
m.getHMIConnection():SendNotification("RC.OnInteriorVehicleData", { moduleData = m.radioData }) | ||
m.getMobileSession():ExpectNotification("OnInteriorVehicleData", { moduleData = m.radioData }) | ||
:ValidIf(function(_, data) | ||
return m.checkShifted(data.payload.moduleData.radioControlData.sisData.stationLocation.shifted, pShiftValue) | ||
end) | ||
end | ||
|
||
return m |
Oops, something went wrong.