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

[Internal review] Scripts for 3309 issue #190

Open
wants to merge 6 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@ local function preloadedUpdFunc(pTbl)
for key, value in pairs (pTbl.policy_table.vehicle_data.schema_items) do
if value.name == vehicleDataName then
pTbl.policy_table.vehicle_data.schema_items[key].since = "6.0.0"
break
elseif key == #pTbl.policy_table.vehicle_data.schema_items then
common.cprint(35, vehicleDataName .. " was not found in preloaded file")
common.fail(35, vehicleDataName .. " was not found in preloaded file")
end
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@ local function preloadedUpdFunc(pTbl)
for key, value in pairs (pTbl.policy_table.vehicle_data.schema_items) do
if value.name == vehicleDataName then
pTbl.policy_table.vehicle_data.schema_items[key].since = "6.1.0"
break
elseif key == #pTbl.policy_table.vehicle_data.schema_items then
common.cprint(35, vehicleDataName .. " was not found in preloaded file")
common.fail(35, vehicleDataName .. " was not found in preloaded file")
end
end
end
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
---------------------------------------------------------------------------------------------------
--Issue: https://github.com/smartdevicelink/sdl_core/issues/3309
---------------------------------------------------------------------------------------------------
-- Description: SDL resends the parameter from HMI to mobile app in case app version is greater then parameter version,
-- parameter is listed in DB and API

-- In case:
-- 1. App is registered with syncMsgVersion = 7.0
-- 2. "shifted" parameter in "gps" structure has since = 6.0 in DB and API
-- 3. App is subscribed on "gps" vehicle data
-- 4. App sends GetVehicleData(gps) request
-- 5. SDL transfers this request to HMI
-- 6. HMI sends GetVehicleData response with "shifted" item
-- SDL does:
-- - send GetVehicleData response to mobile app with allowed parameter "shifted"
-- 7. HMI sends OnVehicleData notification with "shifted" item in "gps" structure
-- SDL does:
-- - send OnVehicleData notification to app with "shifted" item in "gps" structure
---------------------------------------------------------------------------------------------------
--[[ Required Shared libraries ]]
local runner = require('user_modules/script_runner')
local common = require('test_scripts/API/VehicleData/VehicleDataVersioning/common')

-- [[ Test Configuration ]]
runner.testSettings.isSelfIncluded = false
config.application1.registerAppInterfaceParams.syncMsgVersion.majorVersion = 7
config.application1.registerAppInterfaceParams.syncMsgVersion.minorVersion = 0

--[[ Local Variables ]]
local parameter = "gps"
local shiftedIsExpected = true

--[[ 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("Activate App", common.activateApp)
runner.Step("RPC " .. common.rpc.sub, common.processSubscriptionRPC, { common.rpc.sub, parameter })

runner.Title("Test")
runner.Step("GetVehicleData", common.getVehicleDataGps, { shiftedIsExpected })
runner.Step("OnVehicleData", common.onVehicleDataGps, { shiftedIsExpected })

runner.Title("Postconditions")
runner.Step("Stop SDL", common.postconditions)
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
---------------------------------------------------------------------------------------------------
--Issue: https://github.com/smartdevicelink/sdl_core/issues/3309
---------------------------------------------------------------------------------------------------
-- Description: SDL resends the parameter from HMI to mobile app in case app version is equal to parameter version,
-- parameter is listed in DB and API

-- In case:
-- 1. App is registered with syncMsgVersion = 6.0
-- 2. "shifted" parameter in "gps" structure has since = 6.0 in DB and API
-- 3. App is subscribed on "gps" vehicle data
-- 4. App sends GetVehicleData(gps) request
-- 5. SDL transfers this request to HMI
-- 6. HMI sends GetVehicleData response with "shifted" item
-- SDL does:
-- - send GetVehicleData response to mobile app with allowed parameter "shifted"
-- 7. HMI sends OnVehicleData notification with "shifted" item in "gps" structure
-- SDL does:
-- - send OnVehicleData notification to app with "shifted" item in "gps" structure
---------------------------------------------------------------------------------------------------
--[[ Required Shared libraries ]]
local runner = require('user_modules/script_runner')
local common = require('test_scripts/API/VehicleData/VehicleDataVersioning/common')

-- [[ Test Configuration ]]
runner.testSettings.isSelfIncluded = false
config.application1.registerAppInterfaceParams.syncMsgVersion.majorVersion = 6
config.application1.registerAppInterfaceParams.syncMsgVersion.minorVersion = 0

--[[ Local Variables ]]
local parameter = "gps"
local shiftedIsExpected = true

--[[ 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("Activate App", common.activateApp)
runner.Step("RPC " .. common.rpc.sub, common.processSubscriptionRPC, { common.rpc.sub, parameter })

runner.Title("Test")
runner.Step("GetVehicleData", common.getVehicleDataGps, { shiftedIsExpected })
runner.Step("OnVehicleData", common.onVehicleDataGps, { shiftedIsExpected })

runner.Title("Postconditions")
runner.Step("Stop SDL", common.postconditions)
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
---------------------------------------------------------------------------------------------------
--Issue: https://github.com/smartdevicelink/sdl_core/issues/3309
---------------------------------------------------------------------------------------------------
-- Description: SDL does not send the parameter from HMI to mobile app in case app version is less
-- then parameter version, parameter is listed in DB and API

-- In case:
-- 1. App is registered with syncMsgVersion = 5.0
-- 2. "shifted" parameter in "gps" structure has since = 6.0 in DB and API
-- 3. App is subscribed on "gps" vehicle data
-- 4. App sends GetVehicleData(gps) request
-- 5. SDL transfers this request to HMI
-- 6. HMI sends GetVehicleData response with "shifted" item
-- SDL does:
-- - cut off the "shifted" parameter from HMI response that allowed for apps starting from 6.0 version
-- - send GetVehicleData response to mobile app without not allowed parameter "shifted"
-- 7. HMI sends OnVehicleData notification with "shifted" item in "gps" structure
-- SDL does:
-- - cut off the "shifted" parameter from HMI notification that allowed for apps starting from 6.0 version
-- - send OnVehicleData notification to app without "shifted" item in "gps" structure
---------------------------------------------------------------------------------------------------
--[[ Required Shared libraries ]]
local runner = require('user_modules/script_runner')
local common = require('test_scripts/API/VehicleData/VehicleDataVersioning/common')

-- [[ Test Configuration ]]
runner.testSettings.isSelfIncluded = false
config.application1.registerAppInterfaceParams.syncMsgVersion.majorVersion = 5
config.application1.registerAppInterfaceParams.syncMsgVersion.minorVersion = 0

--[[ Local Variables ]]
local parameter = "gps"
local shiftedIsNOTexpected = 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("Activate App", common.activateApp)
runner.Step("RPC " .. common.rpc.sub, common.processSubscriptionRPC, { common.rpc.sub, parameter })

runner.Title("Test")
runner.Step("GetVehicleData", common.getVehicleDataGps, { shiftedIsNOTexpected })
runner.Step("OnVehicleData", common.onVehicleDataGps, { shiftedIsNOTexpected})

runner.Title("Postconditions")
runner.Step("Stop SDL", common.postconditions)
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
---------------------------------------------------------------------------------------------------
--Issue: https://github.com/smartdevicelink/sdl_core/issues/3309
---------------------------------------------------------------------------------------------------
-- Description: SDL resends the parameter from HMI to mobile app in case app version is greater then parameter version,
-- parameter is listed in DB and API and parameter has different version in DB and API

-- In case:
-- 1. App is registered with syncMsgVersion = 6.5
-- 2. "shifted" parameter in "gps" structure has since = 7.0 in DB and since = 6.0 in API
-- 3. App is subscribed on "gps" vehicle data
-- 4. App sends GetVehicleData(gps) request
-- 5. SDL transfers this request to HMI
-- 6. HMI sends GetVehicleData response with "shifted" item
-- SDL does:
-- - send GetVehicleData response to mobile app with allowed parameter "shifted"
-- 7. HMI sends OnVehicleData notification with "shifted" item in "gps" structure
-- SDL does:
-- - send OnVehicleData notification to app with "shifted" item in "gps" structure
---------------------------------------------------------------------------------------------------
--[[ Required Shared libraries ]]
local runner = require('user_modules/script_runner')
local common = require('test_scripts/API/VehicleData/VehicleDataVersioning/common')

-- [[ Test Configuration ]]
runner.testSettings.isSelfIncluded = false
config.application1.registerAppInterfaceParams.syncMsgVersion.majorVersion = 6
config.application1.registerAppInterfaceParams.syncMsgVersion.minorVersion = 5

--[[ Local Variables ]]
local parameter = "gps"
local shiftedIsExpected = true

--[[ Local Functions ]]
local function preloadedUpdFunc(pTbl)
for key, value in pairs (pTbl.policy_table.vehicle_data.schema_items) do
if value.name == parameter then
for subKey, subValue in pairs (value.params) do
if subValue.name == "shifted" then
-- shifted has since="6.0" in API
pTbl.policy_table.vehicle_data.schema_items[key].params[subKey].since = "7.0"
break
elseif subKey == #value.params then
common.fail("'shifted' was not found in preloaded file")
end
end
break
elseif key == #pTbl.policy_table.vehicle_data.schema_items then
common.fail(parameter .. " was not found in preloaded file")
end
end
end

local function ptuFunc(pTbl)
pTbl.policy_table.functional_groupings["Location-1"].user_consent_prompt = nil
pTbl.policy_table.app_policies[common.getConfigAppParams(1).fullAppID].groups = { "Base-4", "Location-1" }
end

--[[ Scenario ]]
runner.Title("Preconditions")
runner.Step("Clean environment", common.preconditions)
runner.Step("Update preloaded file since=7.0 for shifted", common.updatePreloadedFile, { preloadedUpdFunc })
runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start)
runner.Step("Register App", common.registerApp)
runner.Step("PTU", common.policyTableUpdate, { ptuFunc })
runner.Step("Activate App", common.activateApp)
runner.Step("RPC " .. common.rpc.sub, common.processSubscriptionRPC, { common.rpc.sub, parameter })

runner.Title("Test")
runner.Step("GetVehicleData", common.getVehicleDataGps, { shiftedIsExpected })
runner.Step("OnVehicleData", common.onVehicleDataGps, { shiftedIsExpected })

runner.Title("Postconditions")
runner.Step("Stop SDL", common.postconditions)
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
---------------------------------------------------------------------------------------------------
--Issue: https://github.com/smartdevicelink/sdl_core/issues/3309
---------------------------------------------------------------------------------------------------
-- Description: SDL resends the parameter from HMI to mobile app in case app version is greater then parameter version,
-- parameter is listed in DB and API and parameter has different version in DB and API

-- In case:
-- 1. App is registered with syncMsgVersion = 8.0
-- 2. "shifted" parameter in "gps" structure has since = 7.0 in DB and since = 6.0 in API
-- 3. App is subscribed on "gps" vehicle data
-- 4. App sends GetVehicleData(gps) request
-- 5. SDL transfers this request to HMI
-- 6. HMI sends GetVehicleData response with "shifted" item
-- SDL does:
-- - send GetVehicleData response to mobile app with allowed parameter "shifted"
-- 7. HMI sends OnVehicleData notification with "shifted" item in "gps" structure
-- SDL does:
-- - send OnVehicleData notification to app with "shifted" item in "gps" structure
---------------------------------------------------------------------------------------------------
--[[ Required Shared libraries ]]
local runner = require('user_modules/script_runner')
local common = require('test_scripts/API/VehicleData/VehicleDataVersioning/common')

-- [[ Test Configuration ]]
runner.testSettings.isSelfIncluded = false
config.application1.registerAppInterfaceParams.syncMsgVersion.majorVersion = 8
config.application1.registerAppInterfaceParams.syncMsgVersion.minorVersion = 0

--[[ Local Variables ]]
local parameter = "gps"
local shiftedIsExpected = true

--[[ Local Functions ]]
local function preloadedUpdFunc(pTbl)
for key, value in pairs (pTbl.policy_table.vehicle_data.schema_items) do
if value.name == parameter then
for subKey, subValue in pairs (value.params) do
if subValue.name == "shifted" then
-- shifted has since="6.0" in API
pTbl.policy_table.vehicle_data.schema_items[key].params[subKey].since = "7.0"
break
elseif subKey == #value.params then
common.fail("'shifted' was not found in preloaded file")
end
end
break
elseif key == #pTbl.policy_table.vehicle_data.schema_items then
common.fail(parameter .. " was not found in preloaded file")
end
end
end

local function ptuFunc(pTbl)
pTbl.policy_table.functional_groupings["Location-1"].user_consent_prompt = nil
pTbl.policy_table.app_policies[common.getConfigAppParams(1).fullAppID].groups = { "Base-4", "Location-1" }
end

--[[ Scenario ]]
runner.Title("Preconditions")
runner.Step("Clean environment", common.preconditions)
runner.Step("Update preloaded file since=7.0 for shifted", common.updatePreloadedFile, { preloadedUpdFunc })
runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start)
runner.Step("Register App", common.registerApp)
runner.Step("PTU", common.policyTableUpdate, { ptuFunc })
runner.Step("Activate App", common.activateApp)
runner.Step("RPC " .. common.rpc.sub, common.processSubscriptionRPC, { common.rpc.sub, parameter })

runner.Title("Test")
runner.Step("GetVehicleData", common.getVehicleDataGps, { shiftedIsExpected })
runner.Step("OnVehicleData", common.onVehicleDataGps, { shiftedIsExpected })

runner.Title("Postconditions")
runner.Step("Stop SDL", common.postconditions)
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
---------------------------------------------------------------------------------------------------
--Issue: https://github.com/smartdevicelink/sdl_core/issues/3309
---------------------------------------------------------------------------------------------------
-- Description: SDL resends the parameter from HMI to mobile app in case app version is greater then parameter version,
-- parameter is listed in DB only

-- In case:
-- 1. App is registered with syncMsgVersion = 7.0
-- 2. Custom sub-parameter has since = 6.0 in DB
-- 3. App sends GetVehicleData(<custom parameter>) request
-- SDL does:
-- - transfer GetVehicleData request to HMI with sub-parameter
-- 4. HMI sends GetVehicleData response with sub-parameter
-- SDL does:
-- - send GetVehicleData response to mobile app with sub-parameter
-- 5. App sends SubscribeVehileData(<custom parameter>) request
-- SDL does:
-- - transfer SubscribeVehileData request to HMI with sub-parameter
-- 6. HMI sends SubscribeVehileData response
-- SDL does:
-- - send SubscribeVehileData response to mobile app
-- 7. HMI sends OnVehicleData notification with sub-parameter
-- SDL does:
-- - send OnVehicleData notification to app with sub-parameter
---------------------------------------------------------------------------------------------------
--[[ Required Shared libraries ]]
local runner = require('user_modules/script_runner')
local common = require('test_scripts/API/VehicleData/VehicleDataVersioning/common')

-- [[ Test Configuration ]]
runner.testSettings.isSelfIncluded = false
config.ValidateSchema = false
config.application1.registerAppInterfaceParams.syncMsgVersion.majorVersion = 7
config.application1.registerAppInterfaceParams.syncMsgVersion.minorVersion = 0

--[[ 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.ptuFuncOEM })
runner.Step("Activate App", common.activateApp)

runner.Title("Test")
runner.Step("GetVehicleData", common.getVehicleDataOEM)
runner.Step("SubscribeVehicleData", common.subscribeVehicleDataOEM)
runner.Step("OnVehicleData", common.onVehicleDataOEM)

runner.Title("Postconditions")
runner.Step("Stop SDL", common.postconditions)
Loading