Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/GPS Shift support #2144

Merged
merged 11 commits into from
Jun 28, 2019
Merged
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---------------------------------------------------------------------------------------------------
-- 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
-- with the same value as those from HMI
---------------------------------------------------------------------------------------------------
--[[ 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)
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
-- 2) SDL transfers this request to HMI
-- 3) HMI does not send "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)
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---------------------------------------------------------------------------------------------------
-- 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
-- with the same value as those from HMI
---------------------------------------------------------------------------------------------------
--[[ 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)
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 does not send "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)
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
---------------------------------------------------------------------------------------------------
-- 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) Cut all parameters except longitudeDegrees, latitudeDegrees, altitude from stationLocation and
-- send GetInteriorVehicleData response to mobile without "shifted" item in "stationLocation" structure 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

-- [[ Local Functions ]]
local function getInteriorVehicleData(pShiftValue)
common.radioData.radioControlData.sisData.stationLocation.shifted = pShiftValue
local cid = common.getMobileSession():SendRPC("GetInteriorVehicleData", {
moduleType = "RADIO",
subscribe = false
})
EXPECT_HMICALL("RC.GetInteriorVehicleData", {
moduleType = "RADIO"
})
:Do(function(_, data)
common.getHMIConnection():SendResponse(data.id, data.method, "SUCCESS", {
moduleData = common.radioData,
isSubscribed = false
})
end)

local expectedRadioData = common.cloneTable(common.radioData)
expectedRadioData.radioControlData.sisData.stationLocation.shifted = nil
common.getMobileSession():ExpectResponse(cid, { success = true, resultCode = "SUCCESS",
isSubscribed = false,
moduleData = expectedRadioData
})
:ValidIf(function(_, data)
return common.checkShifted(data.payload.moduleData.radioControlData.sisData.stationLocation.shifted, nil)
end)
end

--[[ 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), getInteriorVehicleData, { v })
end

runner.Title("Postconditions")
runner.Step("Stop SDL", commonRC.postconditions)
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 does not send "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", commonRC.postconditions)
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
---------------------------------------------------------------------------------------------------
-- 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) Cut all parameters except longitudeDegrees, latitudeDegrees, altitude from stationLocation and send
-- OnInteriorVehicleData notification to mobile without "shifted" item in "stationLocation" structure
-- 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

-- [[ Local Functions ]]
local function onInteriorVehicleData(pShiftValue)
common.radioData.radioControlData.sisData.stationLocation.shifted = pShiftValue
common.getHMIConnection():SendNotification("RC.OnInteriorVehicleData", { moduleData = common.radioData })
local expectedRadioData = common.cloneTable(common.radioData)
expectedRadioData.radioControlData.sisData.stationLocation.shifted = nil
common.getMobileSession():ExpectNotification("OnInteriorVehicleData", { moduleData = expectedRadioData })
:ValidIf(function(_, data)
return common.checkShifted(data.payload.moduleData.radioControlData.sisData.stationLocation.shifted, nil)
end)
end

--[[ 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), onInteriorVehicleData, { v })
end

runner.Title("Postconditions")
runner.Step("Stop SDL", commonRC.postconditions)
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 does not send "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", commonRC.postconditions)
Loading